From 2c611112567164b19b0f55d298be893eb953f950 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?George=20Guimar=C3=A3es?= Date: Wed, 29 Feb 2012 16:20:41 -0300 Subject: [PATCH 001/437] updates copyright notice --- _includes/bottom.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_includes/bottom.html b/_includes/bottom.html index 6072500e5..1d86a2775 100644 --- a/_includes/bottom.html +++ b/_includes/bottom.html @@ -24,7 +24,7 @@

From 3f4ac3c837e8a6cc7f008496b953252240d92e5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Wed, 29 Feb 2012 21:08:03 +0100 Subject: [PATCH 002/437] Update home page. --- css/style.css | Bin 39776 -> 39724 bytes images/contents/code.png | Bin 0 -> 14811 bytes index.html | 19 +++++++++++-------- 3 files changed, 11 insertions(+), 8 deletions(-) create mode 100644 images/contents/code.png diff --git a/css/style.css b/css/style.css index c4eff49ef2e0f167e3d6226f06506423844efd42..cf3673b3ece62560021eb7b91ff5f49923a779b0 100644 GIT binary patch delta 19 bcmaE`jcLs`rVV<&n>~E@F>Y4ycklrKSZoK~ delta 69 zcmZ3pjp@NQrVV<&!sQGF47v=-42eLxgdvk5pCNB@zpvl;mun*jhU9ZL}rMJW*xVns*$UzRpz z0DwElvX+~sid^GvqO`E^HT%O3ucZA#ksG+MMZOFawX!G(hE141sa}Vn2sn6A7^x%* zGF@IlL7ApvoGa2>&-L^6N#}F#`|LK~`u*h8<>ld2)^;{Gz=0u=j8qsI9smpxlh{bd zjnmcLmRu_Z1PZ$M!L^Mil|lR9;mO?ewh*b*(QQ$fy1IPU8h^6}&95>>fC5ax8hyMA zsq&e6AOQpZs3;xNQyNeeY5@)ip`J>`g#K}M;EZt2=H_nnwxCRY=lU(8 z-PoteKD|m%rsLlrecc=E#or8xFO`KMI}ThEeW&VKNWy#f`f^gVQ38W6Hy;u3K73AO zI2!zG`EJ~JNe^3R4ROLI8K>q6ORkL1m~wqq{EP^`CDC}X2Te#a!z_aI;CETa1W7kW z_8C2;jq~;eu+a?PaC)f@dLMORNi(nCq7X}3#Yfh-2Q;xqww3CiMwmj#U_G<3Pxn4j zr`!w#3wuwYfr86Jm$C4H;kdRfyjXCTPW^ihk$QN0?Z_2)gy=ka#dlGYtzOupbXQbbxGNpLw5&;`4|33lVza?g8lD?{7Ua7)8VNG{55yRy>%T zd;4tFJ-CD3GgJ2%y`35tCHETQq6(;xOf(IC)JV9p40t!C=?4JMtgEwJ7Nh={kHYp-s$Il|EUqryj#M1!=%v2iiy=l2XRqkC`3v{M%bRUXjHi>#rDh0aY1T8Tt~lD#|&_ zIb;PAdw{l3bzaN7C>xSCY;`z?NM|0{-0xF5XOIqDAA;>z-za_2?><8&8*Jt%++U0% z7-&H5Fz%3cf6EbPlM$v`rbU@@ihw@%qPAU5HBd+7`>sI`MHIgMXH6g zxwd)We9Qgo~T0xmvt5+14wFUFFbnsYT|0hYI^$QCuCcaD~t`VCb*^xaEd_k{kY%u_JKom}Ob3SXfwTn6z0#SO`t3Oz@4pM}cOjW-Pz%%qC1L3_B(t zB5=m(hHS=Ujb;pMO#hneoA%d*)u+{i*B>^pHAK}_)v?smH1gDsG-5WoHq11Vtc$Ks ztqHH)t!b~9tohd8H(WHn*PAzT*2gw}AMPE`9o!s@?OPnXPu)f)4p~m&OnD^SQ=G6e zpr?|j(re(aiq-hmnAu_4(c8hgA-d5%(;)>)B#g$K5Gz2;GR@L364g@MgI{~>baqX8 z+jx6=|MWJ0>3B(bNq=>DDgQ8kxxVS8tWS85A}JD9CbAUsmoTgqiV{li3+oHXOUo-X z>@aNHVxk=}!^zjr$1w6WqTMIo_uSV)$qMU`%p2p5{~4cKU|cX$AR%fW(Svq? z%!($1UWw&JBagm{AxNyxAV3`uub2v*(nfqMiAqvVibJJE$4wI)r<`0Mtrv%zC@y0y z87h@3qcDkV`e0^kc5a4gx^7BuwrFNQ;hTV#;*`is%}LctUrS0vYCtVm+E-*)6IU}= zbEBrD9ABVW#Z@k<%AzE#W~K60Kv#TO>aFA<9;`JieH12LJCRb6VO3<6c%G0^m(i*n zzR|=J*%AH5{OE;ifdCe*8jTq3BBwTOF|9s5tIeX_ukE6J{S!Q0*jTuCF1KTBTF-uB;$At5K_cUEKrpjq?rqq6G5@k_@_l6hvT0NJQw2juS5t z=N2a$ksXN{5gVD61D6ApJ(p9LRg*=^aJ?40ZeH_pyl%p&#Tl+zu^HB#=3DQY4Ky^e zS2Dd_P+nkJXxN4|GP85pI6o7J_c406(+0Ch^~%=6g03`mxY96P6?vhq{aVT1GL z!jD0T<;HJBu0+$p@5DSocVo|C7NGOx`pH7VyKh?{WxV`z>E}fM4tYRPQ&F(#=V1dn z)i7l-ry3PItIKWNS^lKuOVeIc=-J&_=|ZnLmwA)<-7mrkZpxlxnhK z2_=bg35kZ}hFNp_lb7SI+2mRJv28waZrAU&f!l!tUdj)JsKfGOy{XZ|&?ANHC4P@r z^n>ytm0Ee7?4I8t&J-t8&yD)#p|DAC(zE-s!&#Y(O>{QAjNSs@AHS3g=MRj7{v4y` zBwQxsVtF%087y_KsZQu*=)7H^J}$_nTdqet&ff*X%8JznKZpajF&RoNbTFEvv& z*}UOy>YZdAsa~L-`j4KEGutlhyzAzhoD25ze)fH)dw=u3_OiV;o_RvpLhZISdj0ML z&V%piJFd4mu9_(Ztcf5`QHk5ng-oaU5~6vtBXt z3m)*^|CJg`WNfT&#B&PGDabwMGjUhH$vW|Pg$u`;zOT5?h7*SyWV|w%=`QGcyWu&1 zJT^YY`;!^i`eARqOWkv!$)e@?u=Dx(Co~KRZ&Hg0M=-@3_1pQXapzed%ka};_FQ&0 zv?KZJvlam68QRYe(6iFV4W!ND>z6I_Gj}Hu!wu+h$`${>;oJ+n+nvX3_#7y|8>?tm(6;Pd2G?m4a`z#P!Nn52~ z-p9 zFbLNe+b#T!Ak272;HU4x@1{O<$VH#{y{p`d`Tga;-j__AVW=D?Ugo3e?k+F79FQ}1 zqJ+ncUr+NJ@fHg84lNTYhQdeQNK%dGFby+TKVd%cl_JtX^sG$B)l=T~?@;|TT7k#P zD-0#A0zcp9E1gfk0Qcy?%l!{A{$YDYWX6glPu&TsN?M}I7p-BHYJ&r}SIMiRj{dh* z1YSA(={pTs9X@Tc+Fu5p?w=FUF_~_gkapX)y*{1wg=MVOk&Y6znceR`v(-CIoh3eP zJ@21dU~gb}L92fukYEs}cLZPi9MhQip6U#TY?JICjtVE3zklD}7Ke9?=Zz-B3d$}k zK+Q_ddV4SMc^S%k*j-tUHa4A5ForQwoJ3;s8Nl}Fdb)f*#*5W*ZrBI!Fw^Dlk_qgk zwhLDHIDUJZ7Jp7Y+fVEsXmt7-uiC82_;#-+ZAYxz?XJIG`H`H$4q%Lj*@(3l-u_b( zaNZS`B_s!24oElYO_1Ph`wX{C**N?JpYS5wCeVqvtSPTJlS~%?9ZoMw3A_`v8rm%c zKK8C;Z;TI&BF6xhe#d<2ecX8MdGUJ8TWi#-1b*eug=e!7GxNioaX}6Dk{4A=br0>M z`g7n$*_%(a?=)fcrdN$6=eg=R=GoDiIrb0^B+eD*j(LH3MO~`th#}&X23?N!lMeeO zudUDA$mq(H{7%jyh@++>zFWtY?oq-?#_92i-BrDLZyIGI*5Tv0R}9~wQ=;;b*9POF zAU!cZQ&0v<5@8lf0$~P93Q7)Pye~073qK7%5B;&?Wq#Yz%MvhY=rBl1N@^TR1yuzN zad>b(K2<4s{kJ>I#h{WYhenL?-yM^k(F1w>$;v5v!PnEJ%*9M|9JrwwORSBYXGUon z0WD>Z{LeoYXO%L7lQ0;d$rWnH%Q@`v4nXu(_T^_bS&kmtH<#eKfmIqeweO5=mx<`I z%ye6GJGFjVO@mR_{pS zS>k4d`GnIk%~9rZ?y@v|;(|GuR_Qb8`2zK6YFP(<6CY7u-1l$+9@P-nsig*T3=zHD zPl$A8e#pAMFVtScPn9oj8_UhPxvRVO-dk@^o8QWLNDcnKkpG6oju{@}(hy7sFpQQN z682GU&}SHDA=(l80oCK5AV^Z%Lfd5B0(N2oQu1?e!4t6>LE$3I5}G6EbG9Rba!r!& z1vGHn_+r^>xrl~1C;gI>D3Qr6NXf~Y5ONDQMB#=ChHc4*esKI4EvhI&Gp#a(Fzp?C z9LrU`QBP9S)i@7ch4NBET;^_8c4-L78wvbXo^nF?mw$1i)TPQLyyL)A>k=7(c~fut_mj^^2zAg&1q;f8ko>Scn99hw zSjVU}IQ<0mE_-683aVnx>hSCKW`90|s-=d#;YcuAZ-*C*#@RiDWuvSl2u>Pqo_VoAlN=55E0U+}zhO zyCP^U<>_%o`5WeX@pyU7@BXZ7pz__<*Vun8^6-2_$c0GcyT%^jamdcWWyJjISYb+G z$8l@<2)89Xc;RF}Dlp_d^Ip@sQ+M$#*j&8L4^jv#l+4gY()S+X!wtY70ECqdzDr;L zI79*XY=8k06rtHoz@g_??k5;1l@QpfB3A&kVqhhqyhAh@!OV}^Am$sKf>3l~C@Pd0 zkZX}jXgeSXDfDmL`C#|hL!k`PgSh6gQYy$K7#f_JarHeuI^>ydOlHzFAzA)oR&|KX zD1tnryxY9;;@9xaNZNj%;mrNXTb(AmCR=bsVbXo>`LH#iQSnsq=k%RO->iOMexg!x zeXvwYdAL^0D@`P%3}Yq41-uSm6W2>1lw3lv6bTDlq8#LzQ~|M;?;72JrkCp*oLWps zdM|uWi3B14c>qh)My$R-&$#~2-JeO+<^&LBW992&JhK8*_CsXH!MkACo(O4a$zrJ^ zt7K6%Ja(mK+egc2^=UNiey^$KA1=^5xz3ai8xM>)rg-9b9(X$G*cs=S%SdH*YMRgn_+vaB_roFcinQ1)0_mHQIREW*h zqb0}CN;TEHq%AD3tEQ=a)iU3m+nCx&aDH4yxM#p)J<7s&!GANNcTb5i>%do3dNiR5lLDw6?!P@fZ zS4)Jf>y#Hvi%3ok^jyOxU*LIOoB<|?6`tuFzJ9u7ad4;dJgh+m=T0bio`BC8kNG(*O! zW|O9?7Q(gHug_sj+fkF+W5WyV{iN%ybC#oyBZgz6PQm5Ib?bnsbCaLkmtLdxWJ0t| z;hvP(7{)lB95y7vUqaf4qD@>~WYfcyKhVi*et3}Y$|Vb^rp1hhO@73Q3EYuyl9*qn zP2Z05t$w_!EU|7t6a-I+js1CqGmsHX^{LjZ71#S!ooK^kb=U1!^f=Ls#ff8o)t$Y* zzALwRG3WMsZy0$K>>xCtaNHyvtvnX26d@PcJTzy7&)h?)hxnu6h23@jTW*#2Pr~PW zBayg3fk3(MlNR^W(ZuSw{jPet@7M>M9$78Xhl^FA>;25i($o9ymqed}AR4lNu8&jO zc^cxxe#Jb?5bT)vLbHI@ml>M8}9J zc$v_-+%6V0zeTrxZc*| z=c)>_>A2Lq6d{1j24*knVQ#^1S3Vu^4R)7|@dz~c*!bdn?Sg)m1@(iHjORP;dy!6% z)+_DLJJtXCeFei3jv=)*4pBZ8Dqq_83!MOS%8IKZg+K1X`SLSdy3NoX{lI5}jyEr?mUi-$mx68Zdqg-Z7_0tIAEJF#e z2>+Se^MenOMH`l*feW@L7mKG+6i+@|JI^v(qaP-_#+~eg#}VJV@Ydx1Dt;t~JsRrS^%`fqeQXbrE{6Wq$Nq!Kk@*I$-PIw_s^=|Z zi2*m>ocO@VpOWR{NBW)WK^>XRw@tClUDqnt3b#+9quPg302~VZ-rd1{cD8*1z)%6C z&c)H(ywKa+yb@HNW6zCvo5XKN<73BqFT-nmj{*1eg8WMVyZaN1iNaUwdG0apA8m(m zkkoPl0N~L6YaoD(ENlRP7$7D3Q`H^hO3y<`MPsEm0SGSaUx$sVHGm7v5N2qqL`&1; z?~;zVqP|(qQ{Z|U^_iBUUP|P$QLbjKQ_rK_>75dzV%4ltw1SXYfLXa&T`xBy#8{W$?iM21*DHOLRO799gMe-At-9n zVd|rOloKY}c35jCz0k1_dwv}R{@Aw@MrJN=dO9c$I0cD30ax+kd5YfBP1X-6@L;>Rn-Fi*Jtjv!tQY3w!#Uc_C7~bV($U=Z z;|8J`qdh&+VE9lJt-p`lP-JaocS{%t8abGzOb!VNCSUEP$^9mH|JY(S>^2!igAb<0 z1az5ua0O;+m22dm*)+xCTTAqY|Aoys6F$#6PsAw)tJBP(@9nsrtgM>DsD-PFi1B@m zUN;}jE5b{UBVs;^7W3AC^!%y5C44kUnESY@iKyBntK4JR+Lk`6L(tz0p{|cIa2VH< z>omzrM#lL%<_FTnB^c6BO>MGz)M$(7_pNjKN&8$ndbbYP;&Sg zk@;@>PGK70WcEk&r(s}r;8?C`Y5U_P#TWvm#t6Oj+|`#IARp;8^L<69jyM6}5cg3` zbP!}~(EwP`f$3TBal@E^@}~o+KFLtusFqUhwkE_&J^VCxsB3b_VOs;D>Bibh!XhK@ z)TrNZVFh~JF``k`PdnO>t;?tSC$kYctnPb1>KfqcfW4W5UKEQN1* z1O^sP+|16!nwyAxVmpyLO53>aC{n+I8GNXr)xlL(uh5{L1JdydD7UMj`a#{i)JCr+ zL!Z^$KxU>~oWwvN7jb&N1%0nYlBIXHa#9&pl=F>C(C_e?pRBSC3=3UaAb)g6io#KxP7 zcWZe(ZcXj5l8q!nTXCh?D%i8fpB;O0{qCGYqb2sD0Da++nM6j*y6zPBLbg!TBkGed z=&)j`w<7Qo`4+&8Bz!Ul^Hu$|TeFdvkAVTiA#tO2326MHS98BhlQ;Q*X0LAsar8M| zXCXhR(BQU4e>yWxPi}~oO1{0T!|@RI_7|wDo6-S7w>s>E##Qx`R-*MET-p}ZE&#^ZaQX>stpaEwkG6I|)olzsG!_G!`bO~&dFZ%zuV5Mc_xlTY^wV~6dyR*JE;dGBuAb+6u`1~M3}DlLh!d9zGnx`% zY)IIVT+#XW+$GJW^d=L}?4~(9L7z9nTCG$YLa1DL)sApxuSZmFzpVksDkH>x&mbGu zIcp^0=c>Y};6$4iiP`(Ke%;fwqT86b+Ey>b6%_sHq2!rGg-WVTr-nhXeNj^}mP6a^ z(@G_$cqr4}Ab^d-O=R$4S?%xZ+gp4lLElc^q!q{pk+o=UujwynIhTtSeuVfE-vG;* z%HnNwq-S@oxGR3b0~OPAm>kUwL@H+xQXXKt)`17P2JT_sQ+e~3Vi@Z#ca%b3VLZ|` zM+HJhJv3T2>oA;vf#JDTKo-r9H{rHjZzRq2_P&#fXspoc>;p|L69}P7%`?IxDur5l z=O6YL{?}?mcq>iC<9ruiok^J;g1qmIstm^S10odct*J+k2XBrBZ;}cwT zP_l#u{8inEGMSyzZ)qDho;8IQ2#_D7BxSDeTo+DV~kFC?0q12EZ((XPQ zLC3>Cy%aIg3uNXxlDSKPi~<<-Pkw5S;i`5bt2<&jPA3phDnF6e*7M9b3b4IZr+hig zI5K$l$#oiE5>G}Haw-{W+q{a4;9s5<3CMEf!u@Hwy!bC1ahi5ZHM$MpqThF6M&N8# zgazd2lmy?LZ6WLsjS%xHnv!pt$z;84tR0;0I*S1hs4NeW`}YJk0ia}Avu-U{DUrq6 zgJ`#!a1eBJRyn1;sDIFSHYbOdgEuH^YiL*x4S$1LbR#^Qotx(yjqJ^EgEW>^t37Yv zdi7nJS!21On`Wu{?f(ugAXZGIUC}}Y@R=dA*JW|(;#QZ|BTk2AlYW`!#~yAnD)jdw z8AQJgJuSovvo~wd&0DF=lH1ZJoY&TwFTtorG~nz>8@>9AE<_amEQsF@clR7F2D{sX zz*F)xU3N2-L`fqL&BYm%l*I!?2IbF z6k?dEUVyO?(&@B54Z$XmT~u=Whhp&` zA8_Gd_Wg?_;A}uIfknyl7+SR?hoZT4-E$|WGY+2%zoNQeVllV*V5zS8xu+X2DD_05 zV`1~Cc5a4PrlC4jhH^{&L+){|sf9Hd!!ppO#+9r=;9!gbiX`A|0tvDVx1=61TCm(P zZF-&YF*6;OW%n2Pnij~CS889SCY~QXMst-(TVouGgL0m_%_kk_1`~e~uX@VZ#65pz zu#2&z^`CfMLubVK7Bqkhy&XbJPexMG{9p=V>Q@pku77LX+X$cr?oceS&O>PH1*h4_t z(8Hs7@7vnx@`o$Cw zL4h9Oy8Pn{3#U&+7+h%KG)V5(yZ`LaGpIwIA==Mg=RkPz$QaXOuE;^v7Bma?-Zaj=eg%Kv0fe?&XQII}c02LV;FH2y6821DEfp#d8O1j{tuuMcKjF}V zt>ly*Kug})7;jA2wOyG5ffLaFoc{S*VfmR1cm=mjh{j8x}KtAf6& zu+yUTv*cR~zh7LjHWxpa9k4u~KmAbYnk+>TU*MQo&yGyIdbV>(8jlsiR|Xu@1or&N z$)A+KGH>+Q&mln8fKX#iEK#t3j*O|6ZM)GaPr%v6&1aoL{P2P-&@lt&(SHJvMT1OHB-%y7FadxXB}a;u!%ZQj0v+F zR`=k4^kI~}jgtANERqMKw!OcdxK9|2Q)~3TYR4`=+c;_vE;1G_4!FDes`ue-v1^a4 zNX@~pw23R`js_-W$1N?V`DwLQ*+9c=hkA?%Enpm31j&H}5DG+@D+lws{mExs!Yjjz zFwl)4;(>C5W09}qHC~Gp;9CRNihg%tA(A)eGtv{$B0J(`N)u9Bu$p({y%?nYyt1;Z zrCt#f&rXN8pVL^%huUAtUic1EZbY(o-pG8CM;L_JVw~pD&zr?NokEtxwXL(%J1%C6 zWy@{X0%KpW=|NdrnzdYGlsv4NY_dVO0+-TWo}KkA2g_pG@#UieGJ`lz=(E)k(JgJw z+uD7Qm|p68wO*e;TtV-p=v4^lGr8m8f=U&_a=@rKEs#dC8sO%9=6Oc-Q)DL~yhALx zAef<_7a=@hk2pPnZ%bT+HY>BPO^B!3KlD*7e&QmaWz=L(;ea5VQbv;zN1-!g;u6bo zVQLf2^GKn^l<|xTV_Oc?&%K4MNM$&PE^}iJNTS6AuShh>F969ZX6li}GaTre1PWXd zDDahBVuG0#fF}8mDAkE<`(YJMbijBDe7NdZi|is83Ds;9k|?%)O$#5<3vxNGf^&R0 zqav75;R`ZtO3MKhwG&NfymThddmJA^=H`#>u=cC27ellLHewN=T?EqSs-@5wfVDLr|{i{8a9~2ma z3;Rc!6Zr56=wFy{n0x%a-9wPF-lSWZRz`+7B8C-+KVsvCJgh}bo_`WDdB0s`#0%Rk z=!MO=nYP^3InUKdP`1RSC^th-B+;!DRJz-D=bt49AUX%3h89Dhlv^{Y>IhfJ#${hR z8CiRww$|tKnXI;>hKlcP%w8#3+_D6{v^REaM`B@WnLnxUwXyjD+V@3`{cM6}>1+Crkw?>;#f_%M+H8zDRwc8)O!+Bxg$Zk^?+Q z@MIs^mo-HX8{EISo#8}GHXXbNWrV-!gfY(KxE`21=jOq*XPk+7RhgB_`0tCwcgZZ1 z26r*Cze~Vp_HAvCIEVTD`PoSj&%cf?Y&tJLb}Y zu*>I-d{Knr7r@jY#O6?H{t7}Vz+TYyK6M%WYQ3AKi=5V0DTARZpn1}J6h<(sGbJBs z+-NB!KNt#~$WzPt^r)zMeN)|T)8N+Rj-)N?mljK@c{6#W92dAyg=BYal+mCVb-IB~ zM)~PqhPCHWEEYvMT<3YyMk0iBPPWVHJ~Wa%~3fecXP2DV7G z6HxaF19}*88ZC5MIm-ZJWmds8Y?#&{E1DVIhD(H^{IqFv0nGz2DS)o8pP2Z?lv=!l zIr{M3bSB#ALqwKODC`<<%Mh(J>*JG?gXY0>3k2HB&eo&PM8RFBLt}_x&xy5)?p_GD zbn>02)YKN)!>aiozx>C5<64yAF`65ggOv(B09#KP$*#k#gU- zqj@N(*F|v!wx54ARBsUnT?kxd?axs^|IDY$nt_LjW3kG3E7-FcnY4t;z;?BJ+NkrQ z>!>cY9uxlVcxdWIi0P;07y`_Pln%CIwfuN{Ausv9&%{-YJ4VS#I@Hg}$yxu4+k<#V zZufpNGM1TJ^(f^{1g!cXh7h1joWa*+t>>{8GyWrU<^_j)v{+z#0^R}I7ZVX1E0ZPY zgo_8AD&MSvzkMt2H~8{|*tla|Dqo`$!z@QQx zJUQA8l7)@dsqkrtgRPs}_S&$ke60(k1)wUbIq01|Faf?7Ig!AJj0jwaw9KdLLe`$` z#F&s&%4|sVVn(rQKExoQYIje$Lz4o+wo)jE%*WEgMw>Mz<;coRrXx3jJP-k*`8mwW z>z69Ab!rJlTTn((%YzJIH06MTRpO9{qLyQ%=52}88{aYdS5X2K%k`=779aWxzXT32 z@lMzW5zDuyfySD@kQmTNFrKqVfA^FA^rv}_WNfqKxigR?l%Z* z-&op_Po9F-o@fQE@mDXstL1O!(cuLTf)qt(1@ZWrw_i+uzJvl~vx#Ofb*M zj3dvJaN6i8mfutyu?UK*9^#U{viUVI@~TDXz^AR3eW(Nqo`x46u-1`mS! z=tDCVp9QM`lS7lSkUq@q5h)$P2ve#Wy^s15%#mT!=baZedV1U4SM9wCOd{@8(6;e& zDpy@4*(m64X}Ae%z_KMSUobfd7CQP0V5IA02{c}@;9(DByPpJCvo`nO1aZ*id?^&b zqUSDT9y5t6aFi={)cgI^g05KF$y|I@rr^_15_RF$lkx-zAp}RKkN)K!f_J(PKx4Kk z8V~Aq=RbIEQf4ju=VVqA@S^i1R|kVqN=jFB&ZmBU#Q7fiKQn3OIb%D`FZYLY>ouRQ zOlzysBY`YsNPpEF5=moIpm(V80njOo6I(;1$?wyXpHn}s4(wxRVsdx%L!$3bKQA``n zNnvnq8DXcCmk#Pqd1;;u>&l+8>ws$=Nj|nsFZu76qngcT@j2%=nU@SjO7yQ8a|Zb4 z((V!b8_$q;{i9uz0iW82MUnP~5Zer&TEGT^6|{8`5=7jL7N>O-i>DF!2i1>Ctg*+Sk3=hc1h7+DumUz7!I~o1n&q|@( zj!_lRsQVF<0tz662}2Onw1BSZi$5sHqChG#mQjv@%;mGyz6{h0HT%NGOK_i$eK&6I zYmyrJPULf}z6!K$cuUB#7P|9P`r$1(uf~6m{M+Bs51D8US|1zP6~f7Ld+NMPpFlWe z177~zn4FD4epl}L+^w<&5#R#LHDc|POnaIx5gs!M45m;g+*wFA{G;eu@ikK(9ylj? zYh+(Cn+NK6eyuzI(o~BNCW?WSL=(X8jww(@wP69z45@tC7m<0vj59=A7&q*rFeiNO zE|c=^f~C)gC(<5R6%Uk?qznSd)O1A*sG<4L=XB4`_@6Uyl>H??1LXP%8N%_~Y95Fg z#%x=bfg2s2+|^C3Cf%7ouJVO7+WdV*=mfyGz9%f-2V>p#4Hg$of^5i(Yg1fe(VKv+ z_%Iw=kQ^{v@T2xPCE!W3b1(Qog^;?g9Q<#tu^3w3 zRT;JsbekB=y&zl%KQNc-!uzi1vUBXcTSHzr{C@z)aqIcRo@cDLhWxIva5wyN<`*CB+5c!OjNx znkk}9V2u3Fh?+aXrbYUl#xo-!nHRhW@XR=QNHC6l7bp!WEEo@k4(o4?sAn5b>^amP z9P%}wGYfVdOf7F4=>3U(?bG6IjvNx0_IYj1H}Ib^5FEEYK0CLiNn_Pyd6~)z?>miV zs7SePC0tZV6$Zn_XJe&OiA=P1VO-#~KdPA;p-^oa;BAbRss3+D(I~3j+kF!gCH(ux zgC)yKkD0#Ah*@~8+n}^7(XH@|D$& z2ry4f85geoVN3m=DS_uWq-&4!3rzhb%mFENKG^1x5HKA3 z2wXF=l1m^7;%rD{%`7$lDQw;J$g=u>M}letd%&&Gs`kWuX|k4->4+`~B0|z%BEb+v zc#N6Lx^7+A=g||_`-=viFc>vNI8ZKD6PrIe8QxdNi^%!uDaG}f#&QGu6dM+XgJ0U{ zA?~QEbx1xYuc^zuK)HaUsHwY9bS0s*$zXWy3ye@9Ac}nLK@vExk_iu31}j$Xok~$r zP4U%%Ay*q0{29uYbc2qN4W7y7>EAY-7Cf)gn)h7Iy2>V3|B?!x*+he%0&*a&}l#@*~JHJ`g49z0-pGQ0w%0lLyezA1@ zG>DgKrSNHNGXHn6RK@{73Hm6)f6g{!3baABAytGuTNf=#x)mdfkGM5s3|vW|AXl7t zA^rFJHh3bnptlqTEskPDwH)~WI+-I!!Ji4;#Ev|!Y)}d!a)_WxGC}l4#YVJ4&&~eC zST7)K-wF|*ga0Rl?>t8i*#8{XSx~5beqpK~%2N)8AN}pi3ushoX}__1>S6AJp>#99 zj>pDe?r~q@&%Eh>j@ndkFe|T3 z+>ct`MpWijY1UVVSe@9+W?^FRQX+eXG!*_hI6&R!II)>OzKnKS*Rl)`x74~EV_(lK zM90MMPyxoYN11B>Cjz+jzAH!Fe_rk zDm1?yIIUq&51lvJxcFGf!D*iOF=-pDpc!Ug$e(*}Bk6~lv%=k9GjkR(&d4JjP2jfp z*!?}83!f(nty_lv>CU-#jC>5Jkk+Ah2VQI%9^0_-XBz5V27+F7R`tpWE5Xb7HVRe2 zsKWwDQQ*dIZM1#SdgMPBoGHP14*$!<2-7k9Vqd_faU=Eve--g>RY^=Y!tCl88&LA? thAEFE!hrk>AExiW&4ddOVw literal 0 HcmV?d00001 diff --git a/index.html b/index.html index f1dc61efb..7605b4ac6 100644 --- a/index.html +++ b/index.html @@ -7,18 +7,21 @@
- Responsive Video + Elixir Sample + +

What is Elixir?

+
-

Duis platea risus elementum in tortor parturient sed, pulvinar dignissim parturient a proin risus elementum sed velit natoque pid vel nunc in non, enim scelerisque turpis. Aenean mauris lundium, turpis massa diam eros nisi facilisis. Ultrices integer augue. Lacus turpis…

-
+

Elixir is a programming language built on top of the Erlang VM. As Erlang, it is a functional language built to support distributed, fault-tolerant, non-stop applications with hot code swapping.

+

Elixir is also dynamic typed but, differently from Erlang, it is also homoiconic, allowing meta-programming via macros. Elixir also supports polymorphism via protocols (similar to Clojure's), dynamic records and provides a reference mechanism.

+

Finally, Elixir and Erlang share the same bytecode and data types. This means you can invoke Erlang code from Elixir (and vice-versa) without any conversion or performance hit. This allows a developer to mix the expressiveness of Elixir with the robustness and performance of Erlang.

+

If you want to learn more, you can either check the getting started guide or the repository on Github.

+
- - + +

{% include bottom.html %} \ No newline at end of file From 8116e42e055dc4d9d6f142c5dbebb867aa259711 Mon Sep 17 00:00:00 2001 From: Jason Toy Date: Fri, 2 Mar 2012 23:37:07 +0800 Subject: [PATCH 012/437] string interpolation example --- getting_started/1.markdown | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/getting_started/1.markdown b/getting_started/1.markdown index ced216244..ccf3ce53f 100644 --- a/getting_started/1.markdown +++ b/getting_started/1.markdown @@ -83,6 +83,12 @@ Strings in Elixir are UTF-8 binaries delimited by double quotes. A single-quoted iex> 'string' 'string' +There is also string interpolation: + + iex> name = "world" + iex> "hello #{name}" + "hello world" + We can use the `is_binary` and `is_list` helpers to detect if a given string is a binary (double-quoted) or a list (single-quoted): iex> is_binary "string" From ed31e8d2dd48eb042c49f102c1fab2c66ff5635b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Fri, 2 Mar 2012 22:07:55 +0100 Subject: [PATCH 013/437] Reduce twitter count to 2. --- _includes/top.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/_includes/top.html b/_includes/top.html index d58d5339d..fa67f4778 100644 --- a/_includes/top.html +++ b/_includes/top.html @@ -10,16 +10,16 @@ - + From b78d5e9960b331c4283be665b87d8f9727229762 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sat, 3 Mar 2012 21:56:21 +0100 Subject: [PATCH 014/437] Mention the homebrew recipe. --- getting_started/1.markdown | 28 ++++++++++++++++++++-------- getting_started/3.markdown | 2 +- index.html | 4 ++-- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/getting_started/1.markdown b/getting_started/1.markdown index ccf3ce53f..8175f1075 100644 --- a/getting_started/1.markdown +++ b/getting_started/1.markdown @@ -13,7 +13,23 @@ Keep in mind that Elixir is still in development and sometimes you may get poorl ## 1.1 Installation -Elixir isn't available in any distribution yet, but you can download and compile it in few steps: +The only pre-requisite for Elixir is Erlang, version R15B later. You can check your Erlang version by calling `erl` in the command line. You will see some information as follow: + + Erlang R15B (erts-5.8.4) [source] [64-bit] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false] + +After getting Erlang in your machine, you can install Elixir via distributions or manually. + +### 1.1.1 Distributions + +Elixir is available in some distributions, they are: + +* [Homebrew for Mac OS X via this gist](https://gist.github.com/1955470) + +If you don't use any of the distributions above, don't worry! Continue reading for manual install steps. + +### 1.1.2 Manual install + +You can download and compile Elixir in few steps: $ git clone https://github.com/elixir-lang/elixir.git $ cd elixir @@ -22,20 +38,16 @@ Elixir isn't available in any distribution yet, but you can download and compile $ bin/elixir -v Elixir 0.4.0.dev -If tests pass, we are ready to go. But if tests fail it is likely you have an outdated Erlang version (Elixir requires Erlang R15B or later). You can check your Erlang version by calling `erl` in the command line. You will see some information as follow: - - Erlang R15B (erts-5.8.4) [source] [64-bit] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false] - -If you have the correct version and tests still fail, feel free to open an issue in the issues tracker on Github. +If tests pass, you are ready to go. Otherwise, feel free to open an issue [in the issues tracker on Github](https://github.com/elixir-lang/elixir). -> Note: if you are planning to develop projects with Elixir, we recommend adding the bin directory in Elixir git repository to your PATH for easier access to binaries. +> Note: if you are planning to develop projects with Elixir and manually installed it, we recommend adding the bin directory in Elixir git repository to your PATH for easier access to binaries. > > export PATH="$PATH:/path/to/elixir/bin" > ## 1.2 Interactive mode -We can start Elixir interactive mode by running `bin/iex` in the same directory you compiled Elixir. In interactive mode, we can type any Elixir expression. Let's warm up with some basic arithmetic expressions: +We can start Elixir interactive mode by running `bin/iex` in the same directory you compiled Elixir or by simply running `iex` if you installed it from a distribution. In interactive mode, we can type any Elixir expression. Let's warm up with some basic arithmetic expressions: iex> 1 + 1 2 diff --git a/getting_started/3.markdown b/getting_started/3.markdown index cf2f410cc..13f38fe03 100644 --- a/getting_started/3.markdown +++ b/getting_started/3.markdown @@ -35,7 +35,7 @@ Most of the times it is convenient to write modules into files so they can be co end end -This file can be compiled using `bin/elixirc`: +This file can be compiled using `bin/elixirc` (or simply `elixirc` if you installed Elixir via a distribution): bin/elixirc math.ex diff --git a/index.html b/index.html index 1a2f2e995..85ad9b116 100644 --- a/index.html +++ b/index.html @@ -17,7 +17,7 @@

What is Elixir?

Elixir is a programming language built on top of the Erlang VM. As Erlang, it is a functional language built to support distributed, fault-tolerant, non-stop applications with hot code swapping.

Elixir is also dynamic typed but, differently from Erlang, it is also homoiconic, allowing meta-programming via macros. Elixir also supports polymorphism via protocols (similar to Clojure's), dynamic records and provides a reference mechanism.

Finally, Elixir and Erlang share the same bytecode and data types. This means you can invoke Erlang code from Elixir (and vice-versa) without any conversion or performance hit. This allows a developer to mix the expressiveness of Elixir with the robustness and performance of Erlang.

-

If you want to learn more, you can either check the getting started guide or the repository on Github.

+

If you want to install Elixir or learn more about it, check our getting started guide.

@@ -31,7 +31,7 @@

What is Elixir?

Other Links

  • #elixir-lang on freenode IRC
  • -
  • Twitter account
  • +
  • Twitter
  • Mailing list
  • Issues Tracker
  • Textmate Bundle
  • From 6ab2bde98b8b9571f47672519c282b91a6bb1c6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Mon, 5 Mar 2012 16:28:40 +0100 Subject: [PATCH 015/437] Fix wrong return result in part 2. --- getting_started/2.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/getting_started/2.markdown b/getting_started/2.markdown index 4861cbe52..be2c1e3cd 100644 --- a/getting_started/2.markdown +++ b/getting_started/2.markdown @@ -48,7 +48,7 @@ Since updating a tuple is expensive, when we want to iterate, add or remove elem In the example above, we have assigned the head of the list to the variable `head` and the tail of the list to the variable `tail`. The [`Enum` module](https://github.com/elixir-lang/elixir/blob/master/lib/enum.ex) provides several helpers to manipulate lists (and other enumerables in general) while the [List module](https://github.com/elixir-lang/elixir/blob/master/lib/list.ex) provides several helpers specific to lists: iex> Enum.map [1,2,3], fn(x) -> x * 2 end - [4,5,6] + [2,4,6] iex> List.flatten [1,[2],3] [1,2,3] From 135bdfb5794288da777abdd2fc4e13ffb74ea22b Mon Sep 17 00:00:00 2001 From: Carlos Galdino Date: Mon, 5 Mar 2012 16:51:02 -0300 Subject: [PATCH 016/437] Highlight code --- _includes/top.html | 3 +- css/syntax.css | 60 +++++++++++++++++++++ getting_started/1.markdown | 50 +++++++++++++++-- getting_started/2.markdown | 106 ++++++++++++++++++++++++++++++++++++- getting_started/3.markdown | 50 ++++++++++++++++- getting_started/4.markdown | 26 ++++++++- getting_started/5.markdown | 44 ++++++++++++++- getting_started/6.markdown | 32 +++++++++++ 8 files changed, 362 insertions(+), 9 deletions(-) create mode 100644 css/syntax.css diff --git a/_includes/top.html b/_includes/top.html index fa67f4778..af0d7474f 100644 --- a/_includes/top.html +++ b/_includes/top.html @@ -5,6 +5,7 @@ {{ page.title }} + @@ -49,4 +50,4 @@

    -
    \ No newline at end of file +
    diff --git a/css/syntax.css b/css/syntax.css new file mode 100644 index 000000000..2774b7649 --- /dev/null +++ b/css/syntax.css @@ -0,0 +1,60 @@ +.highlight { background: #ffffff; } +.highlight .c { color: #999988; font-style: italic } /* Comment */ +.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */ +.highlight .k { font-weight: bold } /* Keyword */ +.highlight .o { font-weight: bold } /* Operator */ +.highlight .cm { color: #999988; font-style: italic } /* Comment.Multiline */ +.highlight .cp { color: #999999; font-weight: bold } /* Comment.Preproc */ +.highlight .c1 { color: #999988; font-style: italic } /* Comment.Single */ +.highlight .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */ +.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ +.highlight .gd .x { color: #000000; background-color: #ffaaaa } /* Generic.Deleted.Specific */ +.highlight .ge { font-style: italic } /* Generic.Emph */ +.highlight .gr { color: #aa0000 } /* Generic.Error */ +.highlight .gh { color: #999999 } /* Generic.Heading */ +.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ +.highlight .gi .x { color: #000000; background-color: #aaffaa } /* Generic.Inserted.Specific */ +.highlight .go { color: #888888 } /* Generic.Output */ +.highlight .gp { color: #555555 } /* Generic.Prompt */ +.highlight .gs { font-weight: bold } /* Generic.Strong */ +.highlight .gu { color: #aaaaaa } /* Generic.Subheading */ +.highlight .gt { color: #aa0000 } /* Generic.Traceback */ +.highlight .kc { font-weight: bold } /* Keyword.Constant */ +.highlight .kd { font-weight: bold } /* Keyword.Declaration */ +.highlight .kp { font-weight: bold } /* Keyword.Pseudo */ +.highlight .kr { font-weight: bold } /* Keyword.Reserved */ +.highlight .kt { color: #445588; font-weight: bold } /* Keyword.Type */ +.highlight .m { color: #009999 } /* Literal.Number */ +.highlight .s { color: #d14 } /* Literal.String */ +.highlight .na { color: #008080 } /* Name.Attribute */ +.highlight .nb { color: #0086B3 } /* Name.Builtin */ +.highlight .nc { color: #445588; font-weight: bold } /* Name.Class */ +.highlight .no { color: #008080 } /* Name.Constant */ +.highlight .ni { color: #800080 } /* Name.Entity */ +.highlight .ne { color: #990000; font-weight: bold } /* Name.Exception */ +.highlight .nf { color: #990000; font-weight: bold } /* Name.Function */ +.highlight .nn { color: #555555 } /* Name.Namespace */ +.highlight .nt { color: #000080 } /* Name.Tag */ +.highlight .nv { color: #008080 } /* Name.Variable */ +.highlight .ow { font-weight: bold } /* Operator.Word */ +.highlight .w { color: #bbbbbb } /* Text.Whitespace */ +.highlight .mf { color: #009999 } /* Literal.Number.Float */ +.highlight .mh { color: #009999 } /* Literal.Number.Hex */ +.highlight .mi { color: #009999 } /* Literal.Number.Integer */ +.highlight .mo { color: #009999 } /* Literal.Number.Oct */ +.highlight .sb { color: #d14 } /* Literal.String.Backtick */ +.highlight .sc { color: #d14 } /* Literal.String.Char */ +.highlight .sd { color: #d14 } /* Literal.String.Doc */ +.highlight .s2 { color: #d14 } /* Literal.String.Double */ +.highlight .se { color: #d14 } /* Literal.String.Escape */ +.highlight .sh { color: #d14 } /* Literal.String.Heredoc */ +.highlight .si { color: #d14 } /* Literal.String.Interpol */ +.highlight .sx { color: #d14 } /* Literal.String.Other */ +.highlight .sr { color: #009926 } /* Literal.String.Regex */ +.highlight .s1 { color: #d14 } /* Literal.String.Single */ +.highlight .ss { color: #990073 } /* Literal.String.Symbol */ +.highlight .bp { color: #999999 } /* Name.Builtin.Pseudo */ +.highlight .vc { color: #008080 } /* Name.Variable.Class */ +.highlight .vg { color: #008080 } /* Name.Variable.Global */ +.highlight .vi { color: #008080 } /* Name.Variable.Instance */ +.highlight .il { color: #009999 } /* Literal.Number.Integer.Long */ diff --git a/getting_started/1.markdown b/getting_started/1.markdown index 8175f1075..d89e7c226 100644 --- a/getting_started/1.markdown +++ b/getting_started/1.markdown @@ -31,12 +31,14 @@ If you don't use any of the distributions above, don't worry! Continue reading f You can download and compile Elixir in few steps: + {% highlight console %} $ git clone https://github.com/elixir-lang/elixir.git $ cd elixir $ make test $ bin/elixir -v Elixir 0.4.0.dev + {% endhighlight %} If tests pass, you are ready to go. Otherwise, feel free to open an issue [in the issues tracker on Github](https://github.com/elixir-lang/elixir). @@ -49,21 +51,25 @@ If tests pass, you are ready to go. Otherwise, feel free to open an issue [in th We can start Elixir interactive mode by running `bin/iex` in the same directory you compiled Elixir or by simply running `iex` if you installed it from a distribution. In interactive mode, we can type any Elixir expression. Let's warm up with some basic arithmetic expressions: + {% highlight iex %} iex> 1 + 1 2 iex> 10 - 5 5 iex> 10 / 2 5.0 + {% endhighlight %} Notice `10 / 2` returned a float `5.0` instead of an integer. This is expected, in Elixir the operator `/` always returns a float. In case you want to do integer division or get the division remainder, you can invoke the `div` and `rem` functions: + {% highlight iex %} iex> div(10, 2) 5 iex> div 10, 2 5 iex> rem 10, 3 1 + {% endhighlight %} In the example above, we called two functions called `div` and `rem`. Notice that parenthesis are not required in order to invoke a function. We are going to discuss more about it later. Let's move forward and see which other data types we have in Elixir: @@ -71,38 +77,49 @@ In the example above, we called two functions called `div` and `rem`. Notice tha Some basic types are: + {% highlight iex %} iex> 1 # integer iex> 1.0 # float iex> :atom # atom / symbol iex> {1,2,3} # tuple iex> [1,2,3] # list + {% endhighlight %} Elixir also provides functions (note the dot between the variable and arguments when calling a function): + {% highlight iex %} # function iex> x = fn(a, b) -> a + b end #Fun iex> x.(1, 2) 3 + {% endhighlight %} And double-quoted strings: + {% highlight iex %} iex> "string" "string" + {% endhighlight %} Strings in Elixir are UTF-8 binaries delimited by double quotes. A single-quoted string in Elixir is called a char list and is simply a list of characters: + {% highlight iex %} iex> 'string' 'string' + {% endhighlight %} There is also string interpolation: - iex> name = "world" - iex> "hello #{name}" - "hello world" + {% highlight iex %} + iex> name = "world" + iex> "hello #{name}" + "hello world" + {% endhighlight %} We can use the `is_binary` and `is_list` helpers to detect if a given string is a binary (double-quoted) or a list (single-quoted): + {% highlight iex %} iex> is_binary "string" true iex> is_list "string" @@ -112,25 +129,32 @@ We can use the `is_binary` and `is_list` helpers to detect if a given string is false iex> is_list 'string' true + {% endhighlight %} Although they represent the same thing, double-quoted and single-quoted strings are different and best suited for different scenarios: + {% highlight iex %} iex> "string" == 'string' false + {% endhighlight %} Most of the cases, developers should use double-quoted strings as their representation is more compact. We are going to discuss this subject with more detail in the next chapter. Elixir also provides `true` and `false` as booleans: + {% highlight iex %} iex> true true iex> is_boolean false true + {% endhighlight %} Booleans are represented internally as atoms: + {% highlight iex %} iex> is_atom(true) true + {% endhighlight %} Elixir also provides Port, References and PIDs as data types (usually used in process communication) but they are out of the scope of a getting started tutorial. For now, let's take a look at the basic operators in Elixir before we move on to the next chapter. @@ -140,65 +164,83 @@ As we saw earlier, Elixir provides `+`, `-`, `*`, `/` as arithmetic operators. Elixir also provides `++` and `--` to manipulate lists: + {% highlight iex %} iex> [1,2,3] ++ [4,5,6] [1,2,3,4,5,6] iex> [1,2,3] -- [2] [1,3] + {% endhighlight %} Since single-quoted strings are lists, we can also use `++` and `--` as operators to manipulate them: + {% highlight iex %} iex> 'some' ++ ' example' 'some example' iex> 'some' -- 'oe' 'sm' + {% endhighlight %} Notice that `++` and `--` cannot be used to manipulate double quoted strings, as they are binaries. That said, string concatenation is done via `<>`: + {% highlight iex %} iex> "foo" <> "bar" "foobar" + {% endhighlight %} Elixir also provides three boolean operators: `or`, `and` and `not`. Those operators are strict in the sense those operators expects only booleans (true or false) as arguments: + {% highlight iex %} iex> true and true true iex> false or is_atom(:example) true + {% endhighlight %} Giving a non-boolean as argument will raise an exception: + {% highlight iex %} iex> 1 and true ** (::ArgumentError) argument error + {% endhighlight %} `or` and `and` are short-circuit operators. They just execute the right side in case the left side is not enough to determine the result: + {% highlight iex %} iex> false and error("This error will never be raised") false iex> true or error("This error will never be raised") true + {% endhighlight %} > Note: If you are an Erlang developer, `and` and `or` in Elixir actually map to the `andalso` and `orelse` operators in Erlang. Elixir also provides `==`, `!=`, `===`, `!===`, `<=`, `>=`, `<` and `>` as comparison operators: + {% highlight iex %} iex> 1 == 1 true iex> 1 != 2 true iex> 1 < 2 true + {% endhighlight %} The difference between `==` and `===` is that the latter is more strict when comparing integers and floats: + {% highlight iex %} iex> 1 == 1.0 true iex> 1 === 1.0 false + {% endhighlight %} In Elixir, we can compare two different data types: + {% highlight iex %} iex> 1 < :atom true + {% endhighlight %} The reason we can compare different data types is for pragmatism. Sorting algorithms don't need to worry about different data types in order to sort. The overall sorting order is defined below: @@ -206,4 +248,4 @@ The reason we can compare different data types is for pragmatism. Sorting algori You actually don't need to memorize this ordering, it is important just to know an order exists. -Well, that is it for the introduction. In the next chapter, we are going to discuss some basic functions, data types conversions and a bit of control-flow. \ No newline at end of file +Well, that is it for the introduction. In the next chapter, we are going to discuss some basic functions, data types conversions and a bit of control-flow. diff --git a/getting_started/2.markdown b/getting_started/2.markdown index be2c1e3cd..d7e8eecf1 100644 --- a/getting_started/2.markdown +++ b/getting_started/2.markdown @@ -13,27 +13,34 @@ In this section we are going a bit deeper into the basic data-types, learn some Elixir provides both lists and tuples: + {% highlight iex %} iex> is_list [1,2,3] true iex> is_tuple {1,2,3} true + {% endhighlight %} While both are used to store items, they differ on how those items are stored in memory. Lists are implemented as linked lists (where each item in the list points to the next item) while tuples are stored contiguously in memory. This means that accessing a tuple element is very fast (constant time) and can be achieved using the `elem` function (notice that indexes in Elixir data-types start with `1`): + {% highlight iex %} iex> elem { :a, :b, :c }, 1 :a + {% endhighlight %} On the other hand, updating a tuple is expensive as it needs to duplicate the tuple contents in memory. Updating a tuple can be done with the `setelem` function: + {% highlight iex %} iex> setelem { :a, :b, :c }, 1, :d {:d,:b,:c} + {% endhighlight %} > Note: If you are an Erlang developer, you will notice that we used the `elem` and `setelem` functions instead of Erlang's `element` and `setelement`. The reason for this choice is that Elixir attempts to normalize Erlang API's to always receive the `subject` of the function as the first argument. Since updating a tuple is expensive, when we want to iterate, add or remove elements, we use lists. Since lists are linked, it means accessing the first element of the list is very cheap, however, accessing the n-th element will require the algorithm to pass through n-1 nodes before reaching the n-th. We can access the `head` of the list as follows: + {% highlight iex %} iex> [head | tail] = [1,2,3] [1,2,3] iex> head @@ -44,39 +51,48 @@ Since updating a tuple is expensive, when we want to iterate, add or remove elem [1,2,3] iex> length [head | tail] 3 + {% endhighlight %} In the example above, we have assigned the head of the list to the variable `head` and the tail of the list to the variable `tail`. The [`Enum` module](https://github.com/elixir-lang/elixir/blob/master/lib/enum.ex) provides several helpers to manipulate lists (and other enumerables in general) while the [List module](https://github.com/elixir-lang/elixir/blob/master/lib/list.ex) provides several helpers specific to lists: + {% highlight iex %} iex> Enum.map [1,2,3], fn(x) -> x * 2 end [2,4,6] iex> List.flatten [1,[2],3] [1,2,3] + {% endhighlight %} ## 2.2 Lists and binaries In the previous chapter we have discussed double- and single-quoted strings. Double quoted strings are binaries while single-quoted strings are lists: + {% highlight iex %} iex> "string" == 'string' false iex> is_binary "string" true iex> is_list 'string' true + {% endhighlight %} In fact, both double-quoted and single-quoted representations are just a shorter representation of binaries and lists. Considering that `?a` in Elixir returns the ASCII integer for the letter `a`, we could also write: + {% highlight iex %} iex> <> "abc" iex> [?a, ?b, ?c] 'abc' + {% endhighlight %} In such cases, Elixir detects that all characters in the list and in the binary are printable and returns the quoted representation. However, adding a non-printable character forces them to be printed differently: + {% highlight iex %} iex> <> <<97,98,99,1>> iex> [?a, ?b, ?c, 1] [97,98,99,1] + {% endhighlight %} Since lists are implemented as linked lists, it means a string represented as list usually takes a lot of space in memory (in ASCII, it would be one byte for each character and another byte to point to the next character). For this reason, binary (double-quoted) strings are preferred unless you want to explicitly iterate over the string as a list. @@ -88,8 +104,10 @@ Elixir's plans is to provide a small standard library responsible for handling m Erlang ships with a group of libraries called OTP (Open Telecom Platform). Besides an standard library, OTP provides several facilities to build OTP applications with supervisors that are robust, distributed and fault-tolerant. Invoking those libraries from Elixir is quite straight-forward, for example, we can call the [function `flatten` from the module `lists`](http://www.erlang.org/doc/man/lists.html#flatten-1) as follows: + {% highlight iex %} iex> Erlang.lists.flatten [1,[2],3] [1,2,3] + {% endhighlight %} Erlang's OTP is very well documented and a developer should not have problems going around it: @@ -100,22 +118,27 @@ Erlang's OTP is very well documented and a developer should not have problems go When discussing lists, we saw the following example: + {% highlight iex %} iex> [h | t] = [1,2,3] [1, 2, 3] iex> h 1 iex> t [2, 3] + {% endhighlight %} In Elixir, `=` does not mean assignment as in programming languages like Java and Ruby. `=` is actually a match operator which will check if the expressions on both left and right side match. Consider this example: + {% highlight iex %} iex> { 1, 2, 3 } = { 1, 2, 3 } { 1, 2, 3 } iex> { 1, 2, 3 } = { 1, 4, 3 } ** (::MatchError) no match of right hand side value: {1,4,3} + {% endhighlight %} If the tuples given on the left and right side do not match, an error is raised. If any of the tuples contain a variable, this variable will always be assigned: + {% highlight iex %} iex> { 1, x, 3 } = { 1, 2, 3 } { 1, 2, 3 } iex> x @@ -124,21 +147,27 @@ If the tuples given on the left and right side do not match, an error is raised. { 1, 4, 3 } iex> x 4 + {% endhighlight %} This is exactly what happened in the list example: + {% highlight iex %} iex> [h | t] = [1,2,3] [1, 2, 3] + {% endhighlight %} We have assigned the head of the list to `h` and the tail to `t`. In fact, if we want to check if the head of the list is `1` and assign the tail, we could do: + {% highlight iex %} iex> [1 | t] = [1,2,3] [1, 2, 3] iex> [0 | t] = [1,2,3] ** (::MatchError) no match of right hand side value: [1,2,3] + {% endhighlight %} In case you want to pattern match against the value of a variable, you can use the `^` operator: + {% highlight iex %} iex> x = 1 1 iex> ^x = 1 @@ -147,115 +176,148 @@ In case you want to pattern match against the value of a variable, you can use t ** (::MatchError) no match of right hand side value: 2 iex> x = 2 2 + {% endhighlight %} In Elixir, it is a common practice to assign a variable to underscore `_` if we don't intend to use it. For example, if only the head of the list matters to us, we can assign the tail to underscore: + {% highlight iex %} iex> [h | _] = [1,2,3] [1, 2, 3] iex> h 1 + {% endhighlight %} The variable `_` in Elixir is special in the sense it can never be assigned. Trying to read from it gives an unbound variable error: + {% highlight iex %} iex> _ ** (ErlangError) erlang error {:unbound_var, :_} + {% endhighlight %} Although pattern matching allow powerful constructs, its usage is limited. For instance, you cannot make function calls on the left side of the match. The following example is invalid: + {% highlight iex %} iex> Erlang.lists.flatten([1,[2],3]) = [1,2,3] ** (ErlangError) erlang error :illegal_pattern + {% endhighlight %} ## 2.5 Key-values One of the first control flow constructs we usually learn is the conditional `if`. In Elixir, we can write `if` in these two equivalent ways: + {% highlight iex %} iex> if true, do: 1 + 2 3 iex> if true do ...> 1 + 2 ...> end 3 + {% endhighlight %} Both examples above are simply different ways of expressing key-value arguments. Key-value arguments are a list of two-item tuples, where the first element is an atom representing the key and the second is the value. Elixir provides a syntax-shortcut for creating such key-values: + {% highlight iex %} iex> [a: 1, b: 2] [{:a, 1}, {:b, 2}] + {% endhighlight %} In order to manipulate those key-value arguments, we can use the [`Orddict` module](https://github.com/elixir-lang/elixir/blob/master/lib/orddict.ex): + {% highlight iex %} iex> x = [a: 1, b: 2] [{:a, 1}, {:b, 2}] iex> Orddict.get x, :a 1 iex> Orddict.get x, :c nil + {% endhighlight %} Going back to the `if` example, we invoked it passing a condition (`true`) and a key-value argument (`do: 1 + 2`): + {% highlight iex %} iex> if true, do: 1 + 2 3 + {% endhighlight %} Since the key-value argument is the last argument, the brackets are optional. These are all equivalent: + {% highlight iex %} iex> if true, do: 1 + 2 3 iex> if true, [do: 1 + 2] 3 iex> if(true, [do: 1 + 2]) 3 + {% endhighlight %} Besides, we can also pass an `else` clause to `if`: + {% highlight iex %} iex> if false, do: 1 + 2, else: 10 + 3 13 + {% endhighlight %} However, most of the times `if` clauses are longer than the examples above. In such cases, we usually use the block format: + {% highlight iex %} iex> if true do ...> 1 + 2 ...> end + {% endhighlight %} Internally, this is converted to the same key-value arguments as above. This feature is called key-value blocks. You can pass `else:` as option as well: + {% highlight elixir %} if false do 1 + 2 else: 10 + 3 end + {% endhighlight %} Key-value blocks are similar to Ruby blocks. Parenthesis can be added as follows: + {% highlight elixir %} if(false) do 1 + 2 else: 10 + 3 end + {% endhighlight %} Key-value blocks are an important feature that allow developers to create their own control structures as if they were part of the language itself. For instance, none of the control structures we are going to see in the next section are keywords. They are all implemented using key-values blocks. Elixir supports two syntaxes for key-value blocks: `do`/`end` and `->`/`end`. The first one always binds to the farthest function call, while the latter to the closest. For example, the following expression: + {% highlight elixir %} Enum.map [1,2,3], fn(x) do x * 2 end + {% endhighlight %} Would be parsed as: + {% highlight elixir %} Enum.map([1,2,3], fn(x)) do x * 2 end + {% endhighlight %} Which is not what we want since `do` is binding to the farthest function call, in this case: `Enum.map`. We can fix this by using `->`, forcing the key-value block to bind to the `fn`: + {% highlight elixir %} Enum.map [1,2,3], fn(x) -> x * 2 end + {% endhighlight %} Which is then parsed as: + {% highlight elixir %} Enum.map([1,2,3], fn(x) -> x * 2 end) + {% endhighlight %} A good rule of thumb is: always use `->/end` when defining functions with `fn`, use `do/end` for all other structures. If we follow this rule, everything works transparently. @@ -267,6 +329,7 @@ In this section we are going to describe Elixir main control structures. Refreshing from the section above, all these calls are equivalent: + {% highlight elixir %} if false, do: 1 + 2, else: 10 + 3 if false do @@ -281,9 +344,11 @@ Refreshing from the section above, all these calls are equivalent: else: 10 + 3 end + {% endhighlight %} `if` also accepts many `elsif:` clauses: + {% highlight elixir %} if 1 + 1 == 3 do IO.puts "Impossible" elsif: 1 + 1 == 2 @@ -293,6 +358,7 @@ Refreshing from the section above, all these calls are equivalent: else: IO.puts "This won't" end + {% endhighlight %} In Elixir, all values except `false` and `nil` evaluates to true. So there is no need to convert them to false. @@ -302,6 +368,7 @@ In the previous chapter, we discussed the boolean operators `and`, `or` and `not To work around this limitation, Elixir provides three operators with similar functionality but that accept any argument: `||`, `&&` and `!`. For those operators, all values except `false` and `nil` will evaluate to true. + {% highlight elixir %} # Short-circuit or iex> 1 || true 1 @@ -321,11 +388,13 @@ To work around this limitation, Elixir provides three operators with similar fun false iex> !nil true + {% endhighlight %} ### 2.6.3 Case In this section we have introduced pattern matching via the `=` operator. Sometimes however it is convenient to match an expression against several expressions until we find a matching one. For such cases, we use `case`: + {% highlight elixir %} case { 1, 2, 3 } do match: { 4, 5, 6 } IO.puts "This won't match" @@ -334,9 +403,11 @@ In this section we have introduced pattern matching via the `=` operator. Someti else: IO.puts "No match" end + {% endhighlight %} As in the `=` operator, any assigned variable will be overridden in the match clause. In case you want to pattern match against a variable, you need to use the `^` operator: + {% highlight elixir %} x = 1 case 10 do match: ^x @@ -344,9 +415,11 @@ As in the `=` operator, any assigned variable will be overridden in the match cl else: IO.puts "Will match" end + {% endhighlight %} Each match clause also supports special conditions to be given via guards: + {% highlight elixir %} case { 1, 2, 3 } do match: { 4, 5, 6 } IO.puts "This won't match" @@ -355,6 +428,7 @@ Each match clause also supports special conditions to be given via guards: else: IO.puts "No match" end + {% endhighlight %} In the example above, the second clause will only match when x is positive. The Erlang VM only allows few expressions as guards, they are: @@ -402,18 +476,22 @@ In the example above, the second clause will only match when x is positive. The Many independent guard clauses can also be given at the same time. For example, consider a function that checks if the first element of a tuple or a list is zero. It could be written as: + {% highlight elixir %} def first_is_zero?(tuple_or_list) when elem(tuple_or_list, 1) == 0 or hd(tuple_or_list) == 0 do true end + {% endhighlight %} However, the example above will always fail because, if the argument is a list, calling `elem` in a list will raise an error. On the other hand, if the element is a tuple, calling `hd` in a tuple will also raise an error. That said, we can rewrite it to become two different clauses: + {% highlight elixir %} def first_is_zero?(tuple_or_list) when elem(tuple_or_list, 1) == 0 when hd(tuple_or_list) == 0 do true end + {% endhighlight %} In such cases, if there is an error in one of the guards, it won't affect the next one. @@ -421,32 +499,41 @@ In such cases, if there is an error in one of the guards, it won't affect the ne Throughout this guide, we have created many functions in examples. The syntax for creating functions is: + {% highlight elixir %} fn(a, b) -> a + b end + {% endhighlight %} But it could also be written as (the previous example is preferred though): + {% highlight elixir %} fn(a, b, do: a + b) fn(a, b) do a + b end + {% endhighlight %} As an immutable language, the binding of the function is also immutable. This means that setting a variable inside the function does not affect its outer scope: + {% highlight elixir %} x = 1 (fn -> x = 2 end).() x #=> 1 + {% endhighlight %} ### 2.6.5 Loops Due to data structure immutability, loops in Elixir (and in functional programming languages) are written differently from conventional imperative languages. For example, in an imperative language, one would write: + {% highlight elixir %} for(i = 0; i < array.length; i++) { array[i] = array[i] * 2 } + {% endhighlight %} In the example above, we are mutating the array which is not possible in Elixir. Therefore, in functional languages recursion happens by calling an anonymous or a named function recursively, until we reach a condition. Consider the example below that manually sums all the items in the list: + {% highlight iex %} iex> loop [1,2,3], 0 do ...> match: [h|t], acc ...> recur(t, h + acc) @@ -454,15 +541,18 @@ In the example above, we are mutating the array which is not possible in Elixir. ...> acc ...> end 6 + {% endhighlight %} In the example above, we pass a list `[1,2,3]` and the initial value `0` as arguments to loop. The list `[1,2,3]` is then matched against `[h|t]` which assigns `h = 1` and `t = [2,3]` and 0 is assigned to `acc`. Then, we add the head of the list to the accumulator `h + acc` and call the loop again using the `recur` function, passing the tail of the list as argument. The tail will once again match the `[h|t]` until the list is empty, matching the final clause which returns the final result of `6`. In other words, the loop is called 4 times until the list is empty and the recursion stops: + {% highlight elixir %} loop [1,2,3], 0 loop [2,3], 1 loop [3], 3 loop [], 6 + {% endhighlight %} > Note: `loop/recur` is also a Clojure idiom, although differently from Clojure, `recur` in Elixir does not ensure a tail call was made. @@ -470,15 +560,18 @@ Then, we add the head of the list to the accumulator `h + acc` and call the loop The next control-flow mechanism is `try/catch/after`: + {% highlight iex %} iex> try do ...> throw 13 ...> catch: number ...> number ...> end 13 + {% endhighlight %} `try/catch` is the main mechanism for catching values thrown by Elixir runtime. It also supports an `after` clause that is invoked regardless if the value was caught or not: + {% highlight iex %} iex> try do ...> throw 13 ...> catch: nan when not is_number(nan) @@ -489,9 +582,11 @@ The next control-flow mechanism is `try/catch/after`: Didn't catch ** throw 13 erl_eval:expr/3 + {% endhighlight %} There is one particularity that applies to `try/catch/after` when compared to other control-flow expressions. The Erlang VM considers such clauses unsafe (since they may fail or not) and do not allow variables defined inside `try/catch/after` to be accessed from the outer scope: + {% highlight iex %} iex> try do ...> new_var = 1 ...> catch: value @@ -500,9 +595,11 @@ There is one particularity that applies to `try/catch/after` when compared to ot 1 iex> new_var ** error :undef + {% endhighlight %} The common strategy then is to make explicit all arguments that are required after the `try`: + {% highlight elixir %} { x, y } = try do x = calculate_some_value() y = some_other_value() @@ -512,11 +609,13 @@ The common strategy then is to make explicit all arguments that are required aft end x #=> returns the value of x or nil for failures + {% endhighlight %} ### 2.6.7 Rescue While `catch` clauses inside `try` are simply a pattern matching mechanism, `rescue` provides a higher abstraction around exceptions. `rescue` allows a developer to rescue an exception by its name and not by its internal contents. Consider the following examples: + {% highlight elixir %} try do raise "some error" rescue: RuntimeError @@ -543,6 +642,7 @@ While `catch` clauses inside `try` are simply a pattern matching mechanism, `res rescue: x in _ x.message end + {% endhighlight %} Custom exceptions can be defined using the `defexception` macro. Check [the exceptions file for some examples](https://github.com/elixir-lang/elixir/tree/master/lib/exception.ex). @@ -552,6 +652,7 @@ The last control-flow mechanism we are going to discuss is essential to Elixir's In order to exchange messages, each process has a mailbox where the received messages are stored. The `receive` mechanism allows us to go through this mailbox searching for a message that matches the given pattern. Here is an example that uses the arrow operator `<-` to send a message to the current process and then collects this message from its mailbox: + {% highlight iex %} # Get the current process id iex> current_pid = self() @@ -565,9 +666,11 @@ In order to exchange messages, each process has a mailbox where the received mes ...> IO.puts "Hello from #{inspect(pid)}" ...> end Hello from <0.36.0> + {% endhighlight %} You may not see exactly `<0.36.0>` back, but something similar. If there are no messages in the mailbox, the current process will hang until a matching message arrives, unless an after clause is given: + {% highlight iex %} iex> receive do ...> match: :waiting ...> IO.puts "This may never come" @@ -575,6 +678,7 @@ You may not see exactly `<0.36.0>` back, but something similar. If there are no ...> IO.puts "Too late" ...> end Too late + {% endhighlight %} In most cases, we don't send messages directly with `<-` nor write `receive` control expressions. Instead, we use many of the abstractions provided by OTP which will be discussed later. @@ -584,4 +688,4 @@ Elixir ships with many default functions automatically available in the current Besides the functions provided by Elixir, Elixir imports many of the root function from Erlang. The function `length`, `is_list`, `is_number` and many others we discussed above comes from Erlang. [The full documented list is available on the OTP documentation page](http://www.erlang.org/doc/man/erlang.html). -All those functions and control flow expressions are essential for building Elixir programs. The next chapter will discuss how to organize our code into modules, so it can be easily re-used between different components. \ No newline at end of file +All those functions and control flow expressions are essential for building Elixir programs. The next chapter will discuss how to organize our code into modules, so it can be easily re-used between different components. diff --git a/getting_started/3.markdown b/getting_started/3.markdown index 13f38fe03..e2cc50b3b 100644 --- a/getting_started/3.markdown +++ b/getting_started/3.markdown @@ -9,11 +9,14 @@ guide: 3 In Elixir, you can group several functions into a module. In the previous chapter, we have invoked for example functions from the module List: + {% highlight iex %} iex> List.flatten [1,[2],3] [1, 2, 3] + {% endhighlight %} In order to create our own modules in Elixir, all we have to do is to call the `defmodule` function and use `def` to define our functions: + {% highlight iex %} iex> defmodule Math do ...> def sum(a, b) do ...> a + b @@ -22,6 +25,7 @@ In order to create our own modules in Elixir, all we have to do is to call the ` iex> Math.sum(1, 2) 3 + {% endhighlight %} Before diving into modules, let's first have a brief overview about compilation. @@ -29,11 +33,13 @@ Before diving into modules, let's first have a brief overview about compilation. Most of the times it is convenient to write modules into files so they can be compiled and re-used. Let's assume we have a file named `math.ex` with the following contents: + {% highlight elixir %} defmodule Math do def sum(a, b) do a + b end end + {% endhighlight %} This file can be compiled using `bin/elixirc` (or simply `elixirc` if you installed Elixir via a distribution): @@ -41,8 +47,10 @@ This file can be compiled using `bin/elixirc` (or simply `elixirc` if you instal Which will then generate a file named `::Math.beam` containing the bytecode for the defined module. Now, if we start `bin/iex` again, our module definition will be available (considering `bin/iex` is being started in the same directory the bytecode file is): + {% highlight iex %} iex> Math.sum(1, 2) 3 + {% endhighlight %} Elixir projects are usually organized into three directories: @@ -60,6 +68,7 @@ Where `-pa` stands for `path append`. The same option can also be passed to `eli Besides the Elixir file `.ex`, Elixir also supports `.exs` files for scripting. Elixir treats both files exactly the same way, the only difference is in intention. `.ex` files are meant to be compiled while `.exs` files are used for scripting, without a need for compilation. For instance, one can create a file called `math.exs`: + {% highlight elixir %} defmodule Math do def sum(a, b) do a + b @@ -67,6 +76,7 @@ Besides the Elixir file `.ex`, Elixir also supports `.exs` files for scripting. end IO.puts Math.sum(1, 2) + {% endhighlight %} And execute it as: @@ -78,6 +88,7 @@ The file will be compiled in memory and executed, printing 3 as result. No bytec Inside a module, we can define functions with `def` and private functions with `defp`. A function defined with `def` is available to be invoked from other modules while a private function can only be invoked locally. + {% highlight elixir %} defmodule Math do def sum(a, b) do do_sum(a, b) @@ -90,9 +101,11 @@ Inside a module, we can define functions with `def` and private functions with ` Math.sum(1, 2) #=> 3 Math.do_sum(1, 2) #=> ** (UndefinedFunctionError) + {% endhighlight %} Function declarations also supports guards and multiple clauses. If a function has several clauses, Elixir will try each clause until find one that matches. For example, here is the implementation for a function that checks if the given number is zero or not: + {% highlight elixir %} defmodule Math do def zero?(0) do true @@ -108,6 +121,7 @@ Function declarations also supports guards and multiple clauses. If a function h Math.zero?([1,2,3]) #=> ** (FunctionClauseError) + {% endhighlight %} Notice that giving an argument that does not match any of the clauses raises an error. @@ -119,6 +133,7 @@ In order to support software-reuse, Elixir supports two directives. As we are go We use `import` whenever we want to easily access functions or macros from others modules without using the qualified name. For instance, if we want to use the `values` function from `Orddict` several times in a module and we don't want to always type `Orddict.values`, we can simply import it: + {% highlight elixir %} defmodule Math do import Orddict, only: [values: 1] @@ -126,21 +141,26 @@ We use `import` whenever we want to easily access functions or macros from other # call values(orddict) end end + {% endhighlight %} In this case, we are importing only the function `values` (with arity 1) from `Orddict`. Although `only:` is optional, its usage is recommended. `except` could also be given as an option. If we want to import only `:functions` or `:macros` from a given module, we can also pass a first argument selecting the scope: + {% highlight elixir %} import :macros, MyMacros + {% endhighlight %} And then we can use `only` or `except` to filter the macros being included. Finally, note that `import` is **lexical**, this means we can import specific macros inside specific functions: + {% highlight elixir %} defmodule Math do def some_function do import Orddict, only: [values: 1] # call values(orddict) end end + {% endhighlight %} In the example above, we imported `Orddict.values` only for during that specific function. `values` won't be available in any other functions in that module. @@ -148,21 +168,27 @@ In the example above, we imported `Orddict.values` only for during that specific `require` is responsible to enforce that a module is loaded and to setup references aliases for a given module. For instance, one can do: + {% highlight elixir %} defmodule Math do require MyOrddict, as: Orddict end + {% endhighlight %} And now, any reference to `Orddict` will be automatically replaced by `MyOrddict`. In case one wants to access the original `Orddict`, it can be done by prefixing the module name with `::`: + {% highlight elixir %} Orddict.values #=> uses ::MyOrddict.values ::Orddict.values #=> uses ::Orddict.values + {% endhighlight %} In general, a module does not need to be required before usage, except if we want to use the macros available in that module. For instance, suppose we created our own `my_if` implementation in a module named `MyMacros`. If we want to invoke it, we need to first explicitly require `MyMacros`: + {% highlight elixir %} defmodule Math do require MyMacros MyMacros.my_if do_something, it_works end + {% endhighlight %} An attempt to call a macro that was not loaded will raise an error. Note that, as the import directive, `require` is lexical. @@ -170,16 +196,20 @@ An attempt to call a macro that was not loaded will raise an error. Note that, a Elixir also allows module to store their own data. The canonical example for such data is annotating that a module implements the OTP behavior called `gen_server`: + {% highlight elixir %} defmodule MyServer do @behavior :gen_server # ... callbacks ... end + {% endhighlight %} Now if the module above does not implement any of the callbacks required by `gen_server`, a warning will be raised. Another data used internally by Elixir is is the `@vsn`: + {% highlight elixir %} defmodule MyServer do @vsn 2 end + {% endhighlight %} `@vsn` refers to version and is used by the code reloading mechanism to check if a module is updated or not. If no version is specified, the version is set to the MD5 of the module functions. @@ -202,14 +232,18 @@ The following are also reserved by Elixir (as they have special semantics to the Besides the built-in data above, any developer can also add custom data: + {% highlight elixir %} defmodule MyServer do @my_data 13 IO.inspect @my_data #=> 13 end + {% endhighlight %} After the module is compiled, the stored custom data can be accessed via `__info__(:data)` and it will return an `Orddict`: + {% highlight elixir %} MyServer.__info__(:data) #=> [my_data: 13] + {% endhighlight %} > Note: Erlang developers may be wondering why Elixir provides its own data abstraction instead of using Erlang attributes. Erlang attributes are basically a list which also allow duplicated entries. For Elixir, since the same data may be read and updated several times during compilation, it makes more sense to have a dictionary structure instead of a list. Erlang developers wishing to have the attributes functionality have two options: > @@ -221,10 +255,12 @@ After the module is compiled, the stored custom data can be accessed via `__info In Elixir, nesting a module inside the other does not affect its name: + {% highlight elixir %} defmodule Foo do defmodule Bar do end end + {% endhighlight %} The example above will define two modules `Foo` and `Bar`. Notice that the second module is **not** called `Foo::Bar`. In general, nesting modules is discouraged in Elixir. @@ -232,38 +268,50 @@ The example above will define two modules `Foo` and `Bar`. Notice that the secon In Erlang (and consequently in the Erlang VM), modules and functions are represented by atoms. For instance, this is valid Erlang code: + {% highlight elixir %} Mod = lists, Mod:flatten([1,[2],3]). + {% endhighlight %} In the example above, we store the atom `lists` in the variable `Mod` and then invoked the function flatten in it. In Elixir, exactly the same idiom is allowed. In fact, we could call the same function `flatten` in `lists` as: + {% highlight iex %} iex> :lists.flatten([1,[2],3]) [1,2,3] + {% endhighlight %} This mechanism is exactly what empowers Elixir references. Elixir references are uppercase identifiers (like `List`, `Orddict`, etc) that are converted to an atom representing a module at compilation time. For instance, by default `List` translates to the atom `::List`: + {% highlight iex %} iex> List ::List iex> is_atom(List) true + {% endhighlight %} References are powerful when used with the `require` directive discussed above. For instance, let's imagine our Math module relies heavily on the `Orddict` module. If, at some point, we find out most algorithms in `Orddict` could be implemented in a much faster way, we could implement `FastOrddict` and use it as a drop-in replacement: + {% highlight elixir %} defmodule Math do require FastOrddict, as: Orddict # ... end + {% endhighlight %} Now any reference to `Orddict` will be automatically replaced by `FastOrddict`. In case one wants to access the original `Orddict`, it can be done by prefixing the module name with `::`: + {% highlight elixir %} Orddict.values #=> uses ::FastOrddict.values ::Orddict.values #=> uses ::Orddict.values + {% endhighlight %} Finally, in Elixir `::` is simply an operator (like `+`). It is used to concatenate two references: + {% highlight iex %} iex> Foo::Bar ::Foo::Bar iex> Foo :: Bar ::Foo::Bar + {% endhighlight %} -> Note: a reference does not actually ensure the reference really exists. For instance, `::FooBarBaz` will return an atom regardless if a `::FooBarBaz` module is defined or not. \ No newline at end of file +> Note: a reference does not actually ensure the reference really exists. For instance, `::FooBarBaz` will return an atom regardless if a `::FooBarBaz` module is defined or not. diff --git a/getting_started/4.markdown b/getting_started/4.markdown index 717a5014c..891d69fbf 100644 --- a/getting_started/4.markdown +++ b/getting_started/4.markdown @@ -13,45 +13,59 @@ Elixir provides both protocols and records. This section will outline the main f Records are simple structures that holds values. For example, we can define a `FileInfo` record that is supposed to store information about files as follow: + {% highlight elixir %} defrecord FileInfo, atime: nil, mtime: nil, accesses: 0 + {% endhighlight %} The line above will define a module named `FileInfo` which contain a function named `new` that returns a new record and other functions to read and set the values in the record. Therefore, we can do: + {% highlight elixir %} file_info = FileInfo.new(atime: now()) file_info.atime #=> Returns the value of atime file_info.atime(now()) #=> Updates the value of atime + {% endhighlight %} Elixir will also define a `update_#{field}` function that accepts a function as argument that will receive the old value and update the current value with the result of the function: + {% highlight elixir %} file_info = FileInfo.new(accesses: 10) file_info = file_info.update_accesses(fn(x) -> x + 1 end) file_info.accesses #=> 11 + {% endhighlight %} Internally, a record is simply a tuple where the first element is always the record module name. This can be noticed if we create and print the record in Interactive Elixir (`bin/iex`): + {% highlight iex %} iex> defrecord FileInfo, atime: nil, mtime: nil iex> FileInfo.new {::FileInfo, nil, nil} + {% endhighlight %} ### 4.1.1 Default based functions Depending on the default value, Elixir will define helpers to interact with the record. For example, the test framework that ships with Elixir, called ExUnit, defines a record which keeps track of how many tests were executed and the failures that happened. The record definition is similar to: + {% highlight iex %} iex> defrecord Config, counter: 0, failures: [] + {% endhighlight %} Since `counter` is an integer, Elixir automatically defines a helper named `increment_counter` that will increase the counter value: + {% highlight iex %} iex> new_config = Config.new.increment_counter {::Config, 1, []} iex> new_config.counter 1 + {% endhighlight %} `increment_counter` also accepts a number to increment as argument: + {% highlight iex %} iex> new_config = Config.new.increment_counter 10 {::Config, 10, []} iex> new_config.counter 10 + {% endhighlight %} On the other hand, if the default value is a list Elixir will define the two following helpers: @@ -66,10 +80,13 @@ In Elixir, only `false` and `nil` are considered falsy values. Everything else e We could implement this protocol as follow: + {% highlight elixir %} defprotocol Blank, [ blank?(data) ] + {% endhighlight %} The protocol expects a function called `blank?` expecting one argument to be implemented. We can implement this protocol for some Elixir data types as follow: + {% highlight elixir %} # Numbers are never blank defimpl Blank, for: Number do def blank?(number), do: false @@ -87,6 +104,7 @@ The protocol expects a function called `blank?` expecting one argument to be imp def blank?(nil), do: true def blank?(_), do: false end + {% endhighlight %} And we would do so for all native data types. The types available are: @@ -106,13 +124,17 @@ And we would do so for all native data types. The types available are: Implementing the protocol for all 9 types above can be cumbersome. Even more if you consider that Number, Function, PID, Port and Reference are never going to be blank. For this reason, Elixir allows us to declare that we are going to implement the protocol just for some types, as follows: + {% highlight elixir %} defprotocol Blank, [blank?(data)], only: [Atom, Tuple, List, BitString, Any] + {% endhighlight %} Since we also specified `Any` as a data type, if the data type is not any of Atom, Tuple, List or BitString, it will automatically fallback to Any: + {% highlight elixir %} defimpl Blank, for: Any do def blank?(_), do: false end + {% endhighlight %} Now all data types that we have not specified will be automatically considered non blank. @@ -120,9 +142,11 @@ Now all data types that we have not specified will be automatically considered n The real benefit of protocols comes when mixed with records. For instance, one may implement a custom dictionary as a Red-Black tree and this dictionary should also be considered blank in case it has no items. That said, the developer just needs to implement the protocol for this dictionary: + {% highlight elixir %} defimpl Blank, for: RedBlack::Dict do def blank?(dict), do: RedBlack.empty?(dict) end + {% endhighlight %} In the example above, we have implemented `blank?` for the custom dictionary that simply delegates to `RedBlack.empty?`. Finally, since records are simply tuples, the default implementation for records can be given in the tuple implementation. @@ -135,4 +159,4 @@ Elixir ships with three built-in protocols, they are: * List::Chars - specifies how to convert a data structures with characters to lists * String::Inspect - specifies how to convert any data structure to a string for inspection -You can check the source code of those files for more information about how the protocol is used and how to implement your own. With this, we have finally finished this section which has described `defrecord`, `defprotocol` and `defimpl`. Next, we are going to discuss macros with `defmacro`! \ No newline at end of file +You can check the source code of those files for more information about how the protocol is used and how to implement your own. With this, we have finally finished this section which has described `defrecord`, `defprotocol` and `defimpl`. Next, we are going to discuss macros with `defmacro`! diff --git a/getting_started/5.markdown b/getting_started/5.markdown index f2446ecca..3f1dd9f72 100644 --- a/getting_started/5.markdown +++ b/getting_started/5.markdown @@ -13,11 +13,15 @@ Elixir is an homoiconic language. Any Elixir program can be represented using it The building block of Elixir homoiconicity is a tuple with three elements, for example: + {% highlight elixir %} { :sum, 1, [1, 2, 3] } + {% endhighlight %} The tuple above represents a function call to sum passing 1, 2 and 3 as arguments. The tuple elements are: + {% highlight elixir %} { Tuple | Atom, Integer, List | Atom } + {% endhighlight %} * The first element of the tuple is always an atom or another tuple in the same representation; * The second element of the tuple is always an integer representing the line number; @@ -25,26 +29,34 @@ The tuple above represents a function call to sum passing 1, 2 and 3 as argument You can get the representation of any expression by using the quote macro: + {% highlight iex %} iex> quote do: sum(1, 2, 3) { :sum, 0, [1, 2, 3] } + {% endhighlight %} Everything in Elixir is a function call and can be represented by such tuples. For example, operators are represented as such: + {% highlight iex %} iex> quote do: 1 + 2 { :"+", 0, [1, 2] } + {% endhighlight %} Even a tuple is represented as a call to `{}`: + {% highlight iex %} iex> quote do: { 1, 2, 3 } { :"{}", 0, [1, 2, 3] } + {% endhighlight %} The only exception to this rule are the five Elixir literals below. Literals are data types that when quoted return themselves. They are: + {% highlight elixir %} :sum #=> Atoms 1.0 #=> Numbers [1,2] #=> Lists "binaries" #=> Binaries {key, value} #=> Key-value pairs (i.e. a tuple with two elements) + {% endhighlight %} With those basic structures in mind, we are ready to define our own macro. @@ -52,46 +64,62 @@ With those basic structures in mind, we are ready to define our own macro. A macro can be define using `defmacro`. For instance, we can define a macro called `unless` which works the same as Ruby's unless in just few lines of code: + {% highlight elixir %} defmodule MyMacro do defmacro unless(clause, options) do quote do: if(!unquote(clause), unquote(options)) end end + {% endhighlight %} Similarly to `if`, `unless` expects two arguments: a `clause` and `options`: + {% highlight elixir %} require MyMacro MyMacro.unless var, do: IO.puts "false" + {% endhighlight %} However, since `unless` is a macro, it won't receive values when invoked, but instead, its expressions. For example, if one calls: + {% highlight elixir %} unless 2 + 2 == 5, do: call_function() + {% endhighlight %} Our `unless` macro will receive the following: + {% highlight elixir %} unless({:==, 1, [{:+, 1, [2, 2]}, 5]}, { :call_function, 1, [] }) + {% endhighlight %} Then our `unless` macro will call `quote`, to return a tree representation of the `if` clause. This means we are transforming our `unless` in a `if`! There is a common mistake when quoting expressions which is that developers usually forget to `unquote` the proper expression. In order to understand what `unquote` does, let's simply remove it: + {% highlight elixir %} defmacro unless(clause, options) do quote do: if(!clause, options) end + {% endhighlight %} When called as `unless 2 + 2 == 5, do: call_function()`, our `unless` would then literally return: + {% highlight elixir %} if(!clause, options) + {% endhighlight %} Which would fail because the clause and options variables are not defined in the current scope. If we add `unquote` back: + {% highlight elixir %} defmacro unless(clause, options) do quote do: if(!unquote(clause), unquote(options)) end + {% endhighlight %} Which will then return: + {% highlight elixir %} if(!(2 + 2 == 5), do: call_function()) + {% endhighlight %} In other words, unquote is a mechanism to inject expressions into the tree being quoted and is essential to the meta-programming mechanism. Elixir also provides `unquote_splicing` allowing us to inject many expressions at once. @@ -101,6 +129,7 @@ We can define any macro we want, including override the built-in macros provided Elixir macros follow Scheme conventions and are hygienic. This means a variable defined inside a macro won't conflict with a variable defined in the context the macro is inserted. For example: + {% highlight elixir %} defmodule Hygiene do defmacro no_interference do quote do: a = 1 @@ -112,9 +141,11 @@ Elixir macros follow Scheme conventions and are hygienic. This means a variable a = 13 Hygiene.no_interference a # => 13 + {% endhighlight %} In the example above, even if the macro injects `a = 1`, it does not affect the variable `a`. In case the macro wants to explicitly affect the context, it can use `var!`: + {% highlight elixir %} defmodule Hygiene do defmacro interference do quote do: var!(a) = 1 @@ -126,14 +157,18 @@ In the example above, even if the macro injects `a = 1`, it does not affect the a = 13 Hygiene.interference a # => 1 + {% endhighlight %} Macros hygiene only works because Elixir marks a variable as coming from the quote. For example, consider this: + {% highlight iex %} iex> quote do: x { :x, 0, :quoted } + {% endhighlight %} Notice that the third element is `:quoted`. It means that x may be a function call with 0 arguments or a variable coming from a quote. On the other hand, an unquoted variable would have the third element equals to nil. Let's consider this final example: + {% highlight elixir %} defmodule Hygiene do defmacro quoted(x) do quote do @@ -141,9 +176,11 @@ Notice that the third element is `:quoted`. It means that x may be a function ca end end end + {% endhighlight %} In the example above, we have defined a macro called `quoted` that returns an unquoted variable, a quoted variable and a function call. Calling this macro will return: + {% highlight elixir %} require Hygiene Hygiene.quoted(x) @@ -152,6 +189,7 @@ In the example above, we have defined a macro called `quoted` that returns an un { :x, 1, :quoted }, { :x, 1, [] } } + {% endhighlight %} Summing up: if the third element is a list, it is certainly a function call. If not, it may be a variable (coming from a quote or not) or a function call. @@ -159,6 +197,7 @@ Summing up: if the third element is a list, it is certainly a function call. If In order to support recursion, macros cannot be called locally. For example, one cannot write: + {% highlight elixir %} defmodule MyMacros defmacro delegate([h|t], to: target) do # ... @@ -167,9 +206,11 @@ In order to support recursion, macros cannot be called locally. For example, one # Call the macro delegate just defined above delegate [values: 1], to: List end + {% endhighlight %} In order to access the macro, it needs to be defined in an outer module: + {% highlight elixir %} defmodule MyMacros::Support defmacro delegate([h|t], to: target) do # ... @@ -180,5 +221,6 @@ In order to access the macro, it needs to be defined in an outer module: require MyMacros::Support, import: true delegate [values: 1], to: List end + {% endhighlight %} -With this note, we finish our introduction to macros. Next, let's move to the next chapter which will discuss several topics as native code compilation, partial application and others. \ No newline at end of file +With this note, we finish our introduction to macros. Next, let's move to the next chapter which will discuss several topics as native code compilation, partial application and others. diff --git a/getting_started/6.markdown b/getting_started/6.markdown index f9778b201..5928ea4ff 100644 --- a/getting_started/6.markdown +++ b/getting_started/6.markdown @@ -11,21 +11,27 @@ guide: 6 Elixir uses the module data described in chapter 3 to drive its documentation system. For instance, consider the following example: + {% highlight elixir %} defmodule MyModule do @moduledoc "It does X" @doc "Returns the version" def version, do: 1 end + {% endhighlight %} In the example above, we are adding a module documentation to MyModule via `@moduledoc` and using `@doc` to document each function. When compiled with the `--docs` option, we will be able to inspect the documentation attributes in runtime (remember to start iex in the same directory you compiled the module): + {% highlight console %} $ elixirc my_module.ex --docs $ iex + {% endhighlight %} + {% highlight iex %} iex> MyModule.__info__(:docs) [{ { :version, 0 }, 5, :def, "Returns the version" }] iex> MyModule.__info__(:moduledoc) {1,"It does X"} + {% endhighlight %} `__info__(:docs)` returns a list of tuples where each tuple contains the function/arity pair, the line the function was defined, the kind of the function (`def` or `defmacro`, docs applied to `defp` are always ignored) and the comments. The comment should be either a binary or a boolean. @@ -33,6 +39,7 @@ Similarly, `__info__(:moduledoc)` returns a tuple with the line the module was d In case `--docs` is not provided during compilation, both calls would return nil. Elixir promotes the use of markdown in documentation, since it is a widely available format. Consider for example the documentation for `Module.add_doc` which allows us to dynamically add a documentation to a function: + {% highlight elixir %} @doc """ Attaches documentation to a given function. It expects the module the function belongs to, the line (a non negative @@ -50,6 +57,7 @@ In case `--docs` is not provided during compilation, both calls would return nil """ def add_doc(module, line, kind, tuple, doc) + {% endhighlight %} In the example, we use heredocs to allow the documentation to spawn several lines and markdown to style the documentation. @@ -57,22 +65,28 @@ In the example, we use heredocs to allow the documentation to spawn several line Elixir also supports partial application. Let's suppose we have a list of strings and we want to calculate the size for each them. We could do it as follow: + {% highlight iex %} iex> list = ["foo", "bar", "baz"] ["foo","bar","baz"] iex> Enum.map list, fn(x) -> size(x) end [3,3,3] + {% endhighlight %} However, with partial application, we could also do: + {% highlight iex %} iex> Enum.map list, size(&1) [3,3,3] + {% endhighlight %} In the example above, we have invoked the function `size` passing `&1` as argument asking Elixir to generate a function that expects one argument and that argument will be passed to `size`. Since operators are also function calls they can also be partially applied: + {% highlight iex %} iex> Enum.map [1,2,3], &1 * 2 [2,4,6] + {% endhighlight %} All functions can be partially applied, except [Elixir's special forms](https://github.com/elixir-lang/elixir/tree/master/lib/elixir/special_forms.ex). @@ -80,6 +94,7 @@ All functions can be partially applied, except [Elixir's special forms](https:// `use` is a macro intended to a common API for extension. For instance, in order to use the `ExUnit` test framework that ships with Elixir, you simply need to use `ExUnit::Case` in your module: + {% highlight elixir %} defmodule AssertionTest do use ExUnit::Case @@ -87,9 +102,11 @@ All functions can be partially applied, except [Elixir's special forms](https:// true = true end end + {% endhighlight %} By calling `use`, a hook called `__using__` will be invoked in `ExUnit::Case` which will then do the proper setup. In general, `use` is simply a translation to: + {% highlight elixir %} defmodule AssertionTest do require ExUnit::Case ExUnit::Case.__using__(::AssertionTest) @@ -98,6 +115,7 @@ By calling `use`, a hook called `__using__` will be invoked in `ExUnit::Case` wh true = true end end + {% endhighlight %} In general, we recommend APIs to expose a `__using__` hook in case they want to expose functionality to developers. @@ -105,17 +123,22 @@ In general, we recommend APIs to expose a `__using__` hook in case they want to Elixir also provides list and bit comprehensions. List comprehensions allow you to quickly build a list from another list: + {% highlight iex %} iex> lc n in [1,2,3,4], do: n * 2 [2,4,6,8] + {% endhighlight %} Or, using key-value blocks: + {% highlight elixir %} lc n in [1,2,3,4] do n * 2 end + {% endhighlight %} A comprehension accepts several expressions. Those expressions can be generators, as in `x in [1,2,3,4]`, or filters: + {% highlight iex %} # A comprehension with a generator and a filter iex> lc n in [1,2,3,4,5,6], rem(n, 2) == 0, do: n [2,4,6] @@ -123,9 +146,11 @@ A comprehension accepts several expressions. Those expressions can be generators # A comprehension with two generators iex> lc x in [1,2], y in [2,3], do: x*y [2,3,4,6] + {% endhighlight %} Elixir provides generators for both lists and bitstrings: + {% highlight iex %} # A list generator: iex> lc n in [1,2,3,4], do: n * 2 [2,4,6,8] @@ -133,20 +158,26 @@ Elixir provides generators for both lists and bitstrings: # A bit string generator: iex> lc <> in <<1,2,3,4>>, do: n * 2 [2,4,6,8] + {% endhighlight %} Bit string generators are quite useful when you need to organize bit string streams: + {% highlight iex %} iex> pixels = <<213,45,132,64,76,32,76,0,0,234,32,15>> iex> lc <> in pixels, do: {r,g,b} [{213,45,132},{64,76,32},{76,0,0},{234,32,15}] + {% endhighlight %} Remember, as strings are binaries and a binary is a bitstring, we can also use strings on comprehensions. For instance, the example below removes all white space characters from a string via bit comprehensions: + {% highlight iex %} iex> bc <> in " hello world ", c != ?\s, do: <> "helloworld" + {% endhighlight %} Elixir does its best to hide the differences between list and bit string generators. However, there is a special case due to Erlang limitation that we need to explicitly tell Erlang that a list is being given as argument: + {% highlight iex %} # This will fail because when Elixir sees that the left side # of the in expression is a bit string, it expects the right side # to be a bit string as well: @@ -160,6 +191,7 @@ Elixir does its best to hide the differences between list and bit string generat # For consistency, inbin is also available: iex> lc inbin(<>, <<1,2,3>>), do: n*2 [2,4,6] + {% endhighlight %} ## 6.5 Native compilation From 4007328c30676bb1002f4304a07666f78fa2809f Mon Sep 17 00:00:00 2001 From: Carlos Galdino Date: Tue, 6 Mar 2012 00:39:10 -0300 Subject: [PATCH 017/437] Fix highlighting --- getting_started/1.markdown | 248 ++++++------ getting_started/2.markdown | 802 ++++++++++++++++++------------------- getting_started/3.markdown | 296 +++++++------- getting_started/4.markdown | 136 +++---- getting_started/5.markdown | 244 +++++------ getting_started/6.markdown | 226 +++++------ 6 files changed, 976 insertions(+), 976 deletions(-) diff --git a/getting_started/1.markdown b/getting_started/1.markdown index d89e7c226..be03269d1 100644 --- a/getting_started/1.markdown +++ b/getting_started/1.markdown @@ -31,14 +31,14 @@ If you don't use any of the distributions above, don't worry! Continue reading f You can download and compile Elixir in few steps: - {% highlight console %} - $ git clone https://github.com/elixir-lang/elixir.git - $ cd elixir - $ make test +{% highlight console %} +$ git clone https://github.com/elixir-lang/elixir.git +$ cd elixir +$ make test - $ bin/elixir -v - Elixir 0.4.0.dev - {% endhighlight %} +$ bin/elixir -v +Elixir 0.4.0.dev +{% endhighlight %} If tests pass, you are ready to go. Otherwise, feel free to open an issue [in the issues tracker on Github](https://github.com/elixir-lang/elixir). @@ -51,25 +51,25 @@ If tests pass, you are ready to go. Otherwise, feel free to open an issue [in th We can start Elixir interactive mode by running `bin/iex` in the same directory you compiled Elixir or by simply running `iex` if you installed it from a distribution. In interactive mode, we can type any Elixir expression. Let's warm up with some basic arithmetic expressions: - {% highlight iex %} - iex> 1 + 1 - 2 - iex> 10 - 5 - 5 - iex> 10 / 2 - 5.0 - {% endhighlight %} +{% highlight iex %} +iex> 1 + 1 +2 +iex> 10 - 5 +5 +iex> 10 / 2 +5.0 +{% endhighlight %} Notice `10 / 2` returned a float `5.0` instead of an integer. This is expected, in Elixir the operator `/` always returns a float. In case you want to do integer division or get the division remainder, you can invoke the `div` and `rem` functions: - {% highlight iex %} - iex> div(10, 2) - 5 - iex> div 10, 2 - 5 - iex> rem 10, 3 - 1 - {% endhighlight %} +{% highlight iex %} +iex> div(10, 2) +5 +iex> div 10, 2 +5 +iex> rem 10, 3 +1 +{% endhighlight %} In the example above, we called two functions called `div` and `rem`. Notice that parenthesis are not required in order to invoke a function. We are going to discuss more about it later. Let's move forward and see which other data types we have in Elixir: @@ -77,84 +77,84 @@ In the example above, we called two functions called `div` and `rem`. Notice tha Some basic types are: - {% highlight iex %} - iex> 1 # integer - iex> 1.0 # float - iex> :atom # atom / symbol - iex> {1,2,3} # tuple - iex> [1,2,3] # list - {% endhighlight %} +{% highlight iex %} +iex> 1 # integer +iex> 1.0 # float +iex> :atom # atom / symbol +iex> {1,2,3} # tuple +iex> [1,2,3] # list +{% endhighlight %} Elixir also provides functions (note the dot between the variable and arguments when calling a function): - {% highlight iex %} - # function - iex> x = fn(a, b) -> a + b end - #Fun - iex> x.(1, 2) - 3 - {% endhighlight %} +{% highlight iex %} +# function +iex> x = fn(a, b) -> a + b end +#Fun +iex> x.(1, 2) +3 +{% endhighlight %} And double-quoted strings: - {% highlight iex %} - iex> "string" - "string" - {% endhighlight %} +{% highlight iex %} +iex> "string" +"string" +{% endhighlight %} Strings in Elixir are UTF-8 binaries delimited by double quotes. A single-quoted string in Elixir is called a char list and is simply a list of characters: - {% highlight iex %} - iex> 'string' - 'string' - {% endhighlight %} +{% highlight iex %} +iex> 'string' +'string' +{% endhighlight %} There is also string interpolation: - {% highlight iex %} - iex> name = "world" - iex> "hello #{name}" - "hello world" - {% endhighlight %} +{% highlight iex %} +iex> name = "world" +iex> "hello #{name}" +"hello world" +{% endhighlight %} We can use the `is_binary` and `is_list` helpers to detect if a given string is a binary (double-quoted) or a list (single-quoted): - {% highlight iex %} - iex> is_binary "string" - true - iex> is_list "string" - false +{% highlight iex %} +iex> is_binary "string" +true +iex> is_list "string" +false - iex> is_binary 'string' - false - iex> is_list 'string' - true - {% endhighlight %} +iex> is_binary 'string' +false +iex> is_list 'string' +true +{% endhighlight %} Although they represent the same thing, double-quoted and single-quoted strings are different and best suited for different scenarios: - {% highlight iex %} - iex> "string" == 'string' - false - {% endhighlight %} +{% highlight iex %} +iex> "string" == 'string' +false +{% endhighlight %} Most of the cases, developers should use double-quoted strings as their representation is more compact. We are going to discuss this subject with more detail in the next chapter. Elixir also provides `true` and `false` as booleans: - {% highlight iex %} - iex> true - true - iex> is_boolean false - true - {% endhighlight %} +{% highlight iex %} +iex> true +true +iex> is_boolean false +true +{% endhighlight %} Booleans are represented internally as atoms: - {% highlight iex %} - iex> is_atom(true) - true - {% endhighlight %} +{% highlight iex %} +iex> is_atom(true) +true +{% endhighlight %} Elixir also provides Port, References and PIDs as data types (usually used in process communication) but they are out of the scope of a getting started tutorial. For now, let's take a look at the basic operators in Elixir before we move on to the next chapter. @@ -164,83 +164,83 @@ As we saw earlier, Elixir provides `+`, `-`, `*`, `/` as arithmetic operators. Elixir also provides `++` and `--` to manipulate lists: - {% highlight iex %} - iex> [1,2,3] ++ [4,5,6] - [1,2,3,4,5,6] - iex> [1,2,3] -- [2] - [1,3] - {% endhighlight %} +{% highlight iex %} +iex> [1,2,3] ++ [4,5,6] +[1,2,3,4,5,6] +iex> [1,2,3] -- [2] +[1,3] +{% endhighlight %} Since single-quoted strings are lists, we can also use `++` and `--` as operators to manipulate them: - {% highlight iex %} - iex> 'some' ++ ' example' - 'some example' - iex> 'some' -- 'oe' - 'sm' - {% endhighlight %} +{% highlight iex %} +iex> 'some' ++ ' example' +'some example' +iex> 'some' -- 'oe' +'sm' +{% endhighlight %} Notice that `++` and `--` cannot be used to manipulate double quoted strings, as they are binaries. That said, string concatenation is done via `<>`: - {% highlight iex %} - iex> "foo" <> "bar" - "foobar" - {% endhighlight %} +{% highlight iex %} +iex> "foo" <> "bar" +"foobar" +{% endhighlight %} Elixir also provides three boolean operators: `or`, `and` and `not`. Those operators are strict in the sense those operators expects only booleans (true or false) as arguments: - {% highlight iex %} - iex> true and true - true - iex> false or is_atom(:example) - true - {% endhighlight %} +{% highlight iex %} +iex> true and true +true +iex> false or is_atom(:example) +true +{% endhighlight %} Giving a non-boolean as argument will raise an exception: - {% highlight iex %} - iex> 1 and true - ** (::ArgumentError) argument error - {% endhighlight %} +{% highlight iex %} +iex> 1 and true +** (::ArgumentError) argument error +{% endhighlight %} `or` and `and` are short-circuit operators. They just execute the right side in case the left side is not enough to determine the result: - {% highlight iex %} - iex> false and error("This error will never be raised") - false +{% highlight iex %} +iex> false and error("This error will never be raised") +false - iex> true or error("This error will never be raised") - true - {% endhighlight %} +iex> true or error("This error will never be raised") +true +{% endhighlight %} > Note: If you are an Erlang developer, `and` and `or` in Elixir actually map to the `andalso` and `orelse` operators in Erlang. Elixir also provides `==`, `!=`, `===`, `!===`, `<=`, `>=`, `<` and `>` as comparison operators: - {% highlight iex %} - iex> 1 == 1 - true - iex> 1 != 2 - true - iex> 1 < 2 - true - {% endhighlight %} +{% highlight iex %} +iex> 1 == 1 +true +iex> 1 != 2 +true +iex> 1 < 2 +true +{% endhighlight %} The difference between `==` and `===` is that the latter is more strict when comparing integers and floats: - {% highlight iex %} - iex> 1 == 1.0 - true - iex> 1 === 1.0 - false - {% endhighlight %} +{% highlight iex %} +iex> 1 == 1.0 +true +iex> 1 === 1.0 +false +{% endhighlight %} In Elixir, we can compare two different data types: - {% highlight iex %} - iex> 1 < :atom - true - {% endhighlight %} +{% highlight iex %} +iex> 1 < :atom +true +{% endhighlight %} The reason we can compare different data types is for pragmatism. Sorting algorithms don't need to worry about different data types in order to sort. The overall sorting order is defined below: diff --git a/getting_started/2.markdown b/getting_started/2.markdown index d7e8eecf1..f4f36d831 100644 --- a/getting_started/2.markdown +++ b/getting_started/2.markdown @@ -13,86 +13,86 @@ In this section we are going a bit deeper into the basic data-types, learn some Elixir provides both lists and tuples: - {% highlight iex %} - iex> is_list [1,2,3] - true - iex> is_tuple {1,2,3} - true - {% endhighlight %} +{% highlight iex %} +iex> is_list [1,2,3] +true +iex> is_tuple {1,2,3} +true +{% endhighlight %} While both are used to store items, they differ on how those items are stored in memory. Lists are implemented as linked lists (where each item in the list points to the next item) while tuples are stored contiguously in memory. This means that accessing a tuple element is very fast (constant time) and can be achieved using the `elem` function (notice that indexes in Elixir data-types start with `1`): - {% highlight iex %} - iex> elem { :a, :b, :c }, 1 - :a - {% endhighlight %} +{% highlight iex %} +iex> elem { :a, :b, :c }, 1 +:a +{% endhighlight %} On the other hand, updating a tuple is expensive as it needs to duplicate the tuple contents in memory. Updating a tuple can be done with the `setelem` function: - {% highlight iex %} - iex> setelem { :a, :b, :c }, 1, :d - {:d,:b,:c} - {% endhighlight %} +{% highlight iex %} +iex> setelem { :a, :b, :c }, 1, :d +{:d,:b,:c} +{% endhighlight %} > Note: If you are an Erlang developer, you will notice that we used the `elem` and `setelem` functions instead of Erlang's `element` and `setelement`. The reason for this choice is that Elixir attempts to normalize Erlang API's to always receive the `subject` of the function as the first argument. Since updating a tuple is expensive, when we want to iterate, add or remove elements, we use lists. Since lists are linked, it means accessing the first element of the list is very cheap, however, accessing the n-th element will require the algorithm to pass through n-1 nodes before reaching the n-th. We can access the `head` of the list as follows: - {% highlight iex %} - iex> [head | tail] = [1,2,3] - [1,2,3] - iex> head - 1 - iex> tail - [2,3] - iex> [head | tail] - [1,2,3] - iex> length [head | tail] - 3 - {% endhighlight %} +{% highlight iex %} +iex> [head | tail] = [1,2,3] +[1,2,3] +iex> head +1 +iex> tail +[2,3] +iex> [head | tail] +[1,2,3] +iex> length [head | tail] +3 +{% endhighlight %} In the example above, we have assigned the head of the list to the variable `head` and the tail of the list to the variable `tail`. The [`Enum` module](https://github.com/elixir-lang/elixir/blob/master/lib/enum.ex) provides several helpers to manipulate lists (and other enumerables in general) while the [List module](https://github.com/elixir-lang/elixir/blob/master/lib/list.ex) provides several helpers specific to lists: - {% highlight iex %} - iex> Enum.map [1,2,3], fn(x) -> x * 2 end - [2,4,6] - iex> List.flatten [1,[2],3] - [1,2,3] - {% endhighlight %} +{% highlight iex %} +iex> Enum.map [1,2,3], fn(x) -> x * 2 end +[2,4,6] +iex> List.flatten [1,[2],3] +[1,2,3] +{% endhighlight %} ## 2.2 Lists and binaries In the previous chapter we have discussed double- and single-quoted strings. Double quoted strings are binaries while single-quoted strings are lists: - {% highlight iex %} - iex> "string" == 'string' - false - iex> is_binary "string" - true - iex> is_list 'string' - true - {% endhighlight %} +{% highlight iex %} +iex> "string" == 'string' +false +iex> is_binary "string" +true +iex> is_list 'string' +true +{% endhighlight %} In fact, both double-quoted and single-quoted representations are just a shorter representation of binaries and lists. Considering that `?a` in Elixir returns the ASCII integer for the letter `a`, we could also write: - {% highlight iex %} - iex> <> - "abc" - iex> [?a, ?b, ?c] - 'abc' - {% endhighlight %} +{% highlight iex %} +iex> <> +"abc" +iex> [?a, ?b, ?c] +'abc' +{% endhighlight %} In such cases, Elixir detects that all characters in the list and in the binary are printable and returns the quoted representation. However, adding a non-printable character forces them to be printed differently: - {% highlight iex %} - iex> <> - <<97,98,99,1>> +{% highlight iex %} +iex> <> +<<97,98,99,1>> - iex> [?a, ?b, ?c, 1] - [97,98,99,1] - {% endhighlight %} +iex> [?a, ?b, ?c, 1] +[97,98,99,1] +{% endhighlight %} Since lists are implemented as linked lists, it means a string represented as list usually takes a lot of space in memory (in ASCII, it would be one byte for each character and another byte to point to the next character). For this reason, binary (double-quoted) strings are preferred unless you want to explicitly iterate over the string as a list. @@ -104,10 +104,10 @@ Elixir's plans is to provide a small standard library responsible for handling m Erlang ships with a group of libraries called OTP (Open Telecom Platform). Besides an standard library, OTP provides several facilities to build OTP applications with supervisors that are robust, distributed and fault-tolerant. Invoking those libraries from Elixir is quite straight-forward, for example, we can call the [function `flatten` from the module `lists`](http://www.erlang.org/doc/man/lists.html#flatten-1) as follows: - {% highlight iex %} - iex> Erlang.lists.flatten [1,[2],3] - [1,2,3] - {% endhighlight %} +{% highlight iex %} +iex> Erlang.lists.flatten [1,[2],3] +[1,2,3] +{% endhighlight %} Erlang's OTP is very well documented and a developer should not have problems going around it: @@ -118,206 +118,206 @@ Erlang's OTP is very well documented and a developer should not have problems go When discussing lists, we saw the following example: - {% highlight iex %} - iex> [h | t] = [1,2,3] - [1, 2, 3] - iex> h - 1 - iex> t - [2, 3] - {% endhighlight %} +{% highlight iex %} +iex> [h | t] = [1,2,3] +[1, 2, 3] +iex> h +1 +iex> t +[2, 3] +{% endhighlight %} In Elixir, `=` does not mean assignment as in programming languages like Java and Ruby. `=` is actually a match operator which will check if the expressions on both left and right side match. Consider this example: - {% highlight iex %} - iex> { 1, 2, 3 } = { 1, 2, 3 } - { 1, 2, 3 } - iex> { 1, 2, 3 } = { 1, 4, 3 } - ** (::MatchError) no match of right hand side value: {1,4,3} - {% endhighlight %} +{% highlight iex %} +iex> { 1, 2, 3 } = { 1, 2, 3 } +{ 1, 2, 3 } +iex> { 1, 2, 3 } = { 1, 4, 3 } +** (::MatchError) no match of right hand side value: {1,4,3} +{% endhighlight %} If the tuples given on the left and right side do not match, an error is raised. If any of the tuples contain a variable, this variable will always be assigned: - {% highlight iex %} - iex> { 1, x, 3 } = { 1, 2, 3 } - { 1, 2, 3 } - iex> x - 2 - iex> { 1, x, 3 } = { 1, 4, 3 } - { 1, 4, 3 } - iex> x - 4 - {% endhighlight %} +{% highlight iex %} +iex> { 1, x, 3 } = { 1, 2, 3 } +{ 1, 2, 3 } +iex> x +2 +iex> { 1, x, 3 } = { 1, 4, 3 } +{ 1, 4, 3 } +iex> x +4 +{% endhighlight %} This is exactly what happened in the list example: - {% highlight iex %} - iex> [h | t] = [1,2,3] - [1, 2, 3] - {% endhighlight %} +{% highlight iex %} +iex> [h | t] = [1,2,3] +[1, 2, 3] +{% endhighlight %} We have assigned the head of the list to `h` and the tail to `t`. In fact, if we want to check if the head of the list is `1` and assign the tail, we could do: - {% highlight iex %} - iex> [1 | t] = [1,2,3] - [1, 2, 3] - iex> [0 | t] = [1,2,3] - ** (::MatchError) no match of right hand side value: [1,2,3] - {% endhighlight %} +{% highlight iex %} +iex> [1 | t] = [1,2,3] +[1, 2, 3] +iex> [0 | t] = [1,2,3] +** (::MatchError) no match of right hand side value: [1,2,3] +{% endhighlight %} In case you want to pattern match against the value of a variable, you can use the `^` operator: - {% highlight iex %} - iex> x = 1 - 1 - iex> ^x = 1 - 1 - iex> ^x = 2 - ** (::MatchError) no match of right hand side value: 2 - iex> x = 2 - 2 - {% endhighlight %} +{% highlight iex %} +iex> x = 1 +1 +iex> ^x = 1 +1 +iex> ^x = 2 +** (::MatchError) no match of right hand side value: 2 +iex> x = 2 +2 +{% endhighlight %} In Elixir, it is a common practice to assign a variable to underscore `_` if we don't intend to use it. For example, if only the head of the list matters to us, we can assign the tail to underscore: - {% highlight iex %} - iex> [h | _] = [1,2,3] - [1, 2, 3] - iex> h - 1 - {% endhighlight %} +{% highlight iex %} +iex> [h | _] = [1,2,3] +[1, 2, 3] +iex> h +1 +{% endhighlight %} The variable `_` in Elixir is special in the sense it can never be assigned. Trying to read from it gives an unbound variable error: - {% highlight iex %} - iex> _ - ** (ErlangError) erlang error {:unbound_var, :_} - {% endhighlight %} +{% highlight iex %} +iex> _ +** (ErlangError) erlang error {:unbound_var, :_} +{% endhighlight %} Although pattern matching allow powerful constructs, its usage is limited. For instance, you cannot make function calls on the left side of the match. The following example is invalid: - {% highlight iex %} - iex> Erlang.lists.flatten([1,[2],3]) = [1,2,3] - ** (ErlangError) erlang error :illegal_pattern - {% endhighlight %} +{% highlight iex %} +iex> Erlang.lists.flatten([1,[2],3]) = [1,2,3] +** (ErlangError) erlang error :illegal_pattern +{% endhighlight %} ## 2.5 Key-values One of the first control flow constructs we usually learn is the conditional `if`. In Elixir, we can write `if` in these two equivalent ways: - {% highlight iex %} - iex> if true, do: 1 + 2 - 3 - iex> if true do - ...> 1 + 2 - ...> end - 3 - {% endhighlight %} +{% highlight iex %} +iex> if true, do: 1 + 2 +3 +iex> if true do +...> 1 + 2 +...> end +3 +{% endhighlight %} Both examples above are simply different ways of expressing key-value arguments. Key-value arguments are a list of two-item tuples, where the first element is an atom representing the key and the second is the value. Elixir provides a syntax-shortcut for creating such key-values: - {% highlight iex %} - iex> [a: 1, b: 2] - [{:a, 1}, {:b, 2}] - {% endhighlight %} +{% highlight iex %} +iex> [a: 1, b: 2] +[{:a, 1}, {:b, 2}] +{% endhighlight %} In order to manipulate those key-value arguments, we can use the [`Orddict` module](https://github.com/elixir-lang/elixir/blob/master/lib/orddict.ex): - {% highlight iex %} - iex> x = [a: 1, b: 2] - [{:a, 1}, {:b, 2}] - iex> Orddict.get x, :a - 1 - iex> Orddict.get x, :c - nil - {% endhighlight %} +{% highlight iex %} +iex> x = [a: 1, b: 2] +[{:a, 1}, {:b, 2}] +iex> Orddict.get x, :a +1 +iex> Orddict.get x, :c +nil +{% endhighlight %} Going back to the `if` example, we invoked it passing a condition (`true`) and a key-value argument (`do: 1 + 2`): - {% highlight iex %} - iex> if true, do: 1 + 2 - 3 - {% endhighlight %} +{% highlight iex %} +iex> if true, do: 1 + 2 +3 +{% endhighlight %} Since the key-value argument is the last argument, the brackets are optional. These are all equivalent: - {% highlight iex %} - iex> if true, do: 1 + 2 - 3 - iex> if true, [do: 1 + 2] - 3 - iex> if(true, [do: 1 + 2]) - 3 - {% endhighlight %} +{% highlight iex %} +iex> if true, do: 1 + 2 +3 +iex> if true, [do: 1 + 2] +3 +iex> if(true, [do: 1 + 2]) +3 +{% endhighlight %} Besides, we can also pass an `else` clause to `if`: - {% highlight iex %} - iex> if false, do: 1 + 2, else: 10 + 3 - 13 - {% endhighlight %} +{% highlight iex %} +iex> if false, do: 1 + 2, else: 10 + 3 +13 +{% endhighlight %} However, most of the times `if` clauses are longer than the examples above. In such cases, we usually use the block format: - {% highlight iex %} - iex> if true do - ...> 1 + 2 - ...> end - {% endhighlight %} +{% highlight iex %} +iex> if true do +...> 1 + 2 +...> end +{% endhighlight %} Internally, this is converted to the same key-value arguments as above. This feature is called key-value blocks. You can pass `else:` as option as well: - {% highlight elixir %} - if false do - 1 + 2 - else: - 10 + 3 - end - {% endhighlight %} +{% highlight elixir %} +if false do + 1 + 2 +else: + 10 + 3 +end +{% endhighlight %} Key-value blocks are similar to Ruby blocks. Parenthesis can be added as follows: - {% highlight elixir %} - if(false) do - 1 + 2 - else: - 10 + 3 - end - {% endhighlight %} +{% highlight elixir %} +if(false) do + 1 + 2 +else: + 10 + 3 +end +{% endhighlight %} Key-value blocks are an important feature that allow developers to create their own control structures as if they were part of the language itself. For instance, none of the control structures we are going to see in the next section are keywords. They are all implemented using key-values blocks. Elixir supports two syntaxes for key-value blocks: `do`/`end` and `->`/`end`. The first one always binds to the farthest function call, while the latter to the closest. For example, the following expression: - {% highlight elixir %} - Enum.map [1,2,3], fn(x) do - x * 2 - end - {% endhighlight %} +{% highlight elixir %} +Enum.map [1,2,3], fn(x) do + x * 2 +end +{% endhighlight %} Would be parsed as: - {% highlight elixir %} - Enum.map([1,2,3], fn(x)) do - x * 2 - end - {% endhighlight %} +{% highlight elixir %} +Enum.map([1,2,3], fn(x)) do + x * 2 +end +{% endhighlight %} Which is not what we want since `do` is binding to the farthest function call, in this case: `Enum.map`. We can fix this by using `->`, forcing the key-value block to bind to the `fn`: - {% highlight elixir %} - Enum.map [1,2,3], fn(x) -> - x * 2 - end - {% endhighlight %} +{% highlight elixir %} +Enum.map [1,2,3], fn(x) -> + x * 2 +end +{% endhighlight %} Which is then parsed as: - {% highlight elixir %} - Enum.map([1,2,3], fn(x) -> - x * 2 - end) - {% endhighlight %} +{% highlight elixir %} +Enum.map([1,2,3], fn(x) -> + x * 2 +end) +{% endhighlight %} A good rule of thumb is: always use `->/end` when defining functions with `fn`, use `do/end` for all other structures. If we follow this rule, everything works transparently. @@ -329,36 +329,36 @@ In this section we are going to describe Elixir main control structures. Refreshing from the section above, all these calls are equivalent: - {% highlight elixir %} - if false, do: 1 + 2, else: 10 + 3 +{% highlight elixir %} +if false, do: 1 + 2, else: 10 + 3 - if false do - 1 + 2 - else: - 10 + 3 - end +if false do + 1 + 2 +else: + 10 + 3 +end - # Although this is valid, its usage is discouraged. - if(false) -> - 1 + 2 - else: - 10 + 3 - end - {% endhighlight %} +# Although this is valid, its usage is discouraged. +if(false) -> + 1 + 2 +else: + 10 + 3 +end +{% endhighlight %} `if` also accepts many `elsif:` clauses: - {% highlight elixir %} - if 1 + 1 == 3 do - IO.puts "Impossible" - elsif: 1 + 1 == 2 - IO.puts "This will match" - elsif: true - IO.puts "This won't because the one above matched" - else: - IO.puts "This won't" - end - {% endhighlight %} +{% highlight elixir %} +if 1 + 1 == 3 do + IO.puts "Impossible" +elsif: 1 + 1 == 2 + IO.puts "This will match" +elsif: true + IO.puts "This won't because the one above matched" +else: + IO.puts "This won't" +end +{% endhighlight %} In Elixir, all values except `false` and `nil` evaluates to true. So there is no need to convert them to false. @@ -368,67 +368,67 @@ In the previous chapter, we discussed the boolean operators `and`, `or` and `not To work around this limitation, Elixir provides three operators with similar functionality but that accept any argument: `||`, `&&` and `!`. For those operators, all values except `false` and `nil` will evaluate to true. - {% highlight elixir %} - # Short-circuit or - iex> 1 || true - 1 - iex> false || 11 - 11 - - # Short-circuit and - iex> nil && 13 - nil - iex> true && 17 - 17 - - # Short-circuit ! - iex> !true - false - iex> !1 - false - iex> !nil - true - {% endhighlight %} +{% highlight elixir %} +# Short-circuit or +iex> 1 || true +1 +iex> false || 11 +11 + +# Short-circuit and +iex> nil && 13 +nil +iex> true && 17 +17 + +# Short-circuit ! +iex> !true +false +iex> !1 +false +iex> !nil +true +{% endhighlight %} ### 2.6.3 Case In this section we have introduced pattern matching via the `=` operator. Sometimes however it is convenient to match an expression against several expressions until we find a matching one. For such cases, we use `case`: - {% highlight elixir %} - case { 1, 2, 3 } do - match: { 4, 5, 6 } - IO.puts "This won't match" - match: { 1, x, 3 } - IO.puts "This will match and assign x" - else: - IO.puts "No match" - end - {% endhighlight %} +{% highlight elixir %} +case { 1, 2, 3 } do +match: { 4, 5, 6 } + IO.puts "This won't match" +match: { 1, x, 3 } + IO.puts "This will match and assign x" +else: + IO.puts "No match" +end +{% endhighlight %} As in the `=` operator, any assigned variable will be overridden in the match clause. In case you want to pattern match against a variable, you need to use the `^` operator: - {% highlight elixir %} - x = 1 - case 10 do - match: ^x - IO.puts "Won't match" - else: - IO.puts "Will match" - end - {% endhighlight %} +{% highlight elixir %} +x = 1 +case 10 do +match: ^x + IO.puts "Won't match" +else: + IO.puts "Will match" +end +{% endhighlight %} Each match clause also supports special conditions to be given via guards: - {% highlight elixir %} - case { 1, 2, 3 } do - match: { 4, 5, 6 } - IO.puts "This won't match" - match: { 1, x, 3 } when x > 0 - IO.puts "This will match and assign x" - else: - IO.puts "No match" - end - {% endhighlight %} +{% highlight elixir %} +case { 1, 2, 3 } do +match: { 4, 5, 6 } + IO.puts "This won't match" +match: { 1, x, 3 } when x > 0 + IO.puts "This will match and assign x" +else: + IO.puts "No match" +end +{% endhighlight %} In the example above, the second clause will only match when x is positive. The Erlang VM only allows few expressions as guards, they are: @@ -476,22 +476,22 @@ In the example above, the second clause will only match when x is positive. The Many independent guard clauses can also be given at the same time. For example, consider a function that checks if the first element of a tuple or a list is zero. It could be written as: - {% highlight elixir %} - def first_is_zero?(tuple_or_list) when - elem(tuple_or_list, 1) == 0 or hd(tuple_or_list) == 0 do - true - end - {% endhighlight %} +{% highlight elixir %} +def first_is_zero?(tuple_or_list) when + elem(tuple_or_list, 1) == 0 or hd(tuple_or_list) == 0 do + true +end +{% endhighlight %} However, the example above will always fail because, if the argument is a list, calling `elem` in a list will raise an error. On the other hand, if the element is a tuple, calling `hd` in a tuple will also raise an error. That said, we can rewrite it to become two different clauses: - {% highlight elixir %} - def first_is_zero?(tuple_or_list) when - elem(tuple_or_list, 1) == 0 when - hd(tuple_or_list) == 0 do - true - end - {% endhighlight %} +{% highlight elixir %} +def first_is_zero?(tuple_or_list) when + elem(tuple_or_list, 1) == 0 when + hd(tuple_or_list) == 0 do + true +end +{% endhighlight %} In such cases, if there is an error in one of the guards, it won't affect the next one. @@ -499,60 +499,60 @@ In such cases, if there is an error in one of the guards, it won't affect the ne Throughout this guide, we have created many functions in examples. The syntax for creating functions is: - {% highlight elixir %} - fn(a, b) -> a + b end - {% endhighlight %} +{% highlight elixir %} +fn(a, b) -> a + b end +{% endhighlight %} But it could also be written as (the previous example is preferred though): - {% highlight elixir %} - fn(a, b, do: a + b) +{% highlight elixir %} +fn(a, b, do: a + b) - fn(a, b) do - a + b - end - {% endhighlight %} +fn(a, b) do + a + b +end +{% endhighlight %} As an immutable language, the binding of the function is also immutable. This means that setting a variable inside the function does not affect its outer scope: - {% highlight elixir %} - x = 1 - (fn -> x = 2 end).() - x #=> 1 - {% endhighlight %} +{% highlight elixir %} +x = 1 +(fn -> x = 2 end).() +x #=> 1 +{% endhighlight %} ### 2.6.5 Loops Due to data structure immutability, loops in Elixir (and in functional programming languages) are written differently from conventional imperative languages. For example, in an imperative language, one would write: - {% highlight elixir %} - for(i = 0; i < array.length; i++) { - array[i] = array[i] * 2 - } - {% endhighlight %} +{% highlight elixir %} +for(i = 0; i < array.length; i++) { + array[i] = array[i] * 2 +} +{% endhighlight %} In the example above, we are mutating the array which is not possible in Elixir. Therefore, in functional languages recursion happens by calling an anonymous or a named function recursively, until we reach a condition. Consider the example below that manually sums all the items in the list: - {% highlight iex %} - iex> loop [1,2,3], 0 do - ...> match: [h|t], acc - ...> recur(t, h + acc) - ...> match: [], acc - ...> acc - ...> end - 6 - {% endhighlight %} +{% highlight iex %} +iex> loop [1,2,3], 0 do +...> match: [h|t], acc +...> recur(t, h + acc) +...> match: [], acc +...> acc +...> end +6 +{% endhighlight %} In the example above, we pass a list `[1,2,3]` and the initial value `0` as arguments to loop. The list `[1,2,3]` is then matched against `[h|t]` which assigns `h = 1` and `t = [2,3]` and 0 is assigned to `acc`. Then, we add the head of the list to the accumulator `h + acc` and call the loop again using the `recur` function, passing the tail of the list as argument. The tail will once again match the `[h|t]` until the list is empty, matching the final clause which returns the final result of `6`. In other words, the loop is called 4 times until the list is empty and the recursion stops: - {% highlight elixir %} - loop [1,2,3], 0 - loop [2,3], 1 - loop [3], 3 - loop [], 6 - {% endhighlight %} +{% highlight elixir %} +loop [1,2,3], 0 +loop [2,3], 1 +loop [3], 3 +loop [], 6 +{% endhighlight %} > Note: `loop/recur` is also a Clojure idiom, although differently from Clojure, `recur` in Elixir does not ensure a tail call was made. @@ -560,89 +560,89 @@ Then, we add the head of the list to the accumulator `h + acc` and call the loop The next control-flow mechanism is `try/catch/after`: - {% highlight iex %} - iex> try do - ...> throw 13 - ...> catch: number - ...> number - ...> end - 13 - {% endhighlight %} +{% highlight iex %} +iex> try do +...> throw 13 +...> catch: number +...> number +...> end +13 +{% endhighlight %} `try/catch` is the main mechanism for catching values thrown by Elixir runtime. It also supports an `after` clause that is invoked regardless if the value was caught or not: - {% highlight iex %} - iex> try do - ...> throw 13 - ...> catch: nan when not is_number(nan) - ...> nan - ...> after: - ...> IO.puts "Didn't catch" - ...> end - Didn't catch - ** throw 13 - erl_eval:expr/3 - {% endhighlight %} +{% highlight iex %} +iex> try do +...> throw 13 +...> catch: nan when not is_number(nan) +...> nan +...> after: +...> IO.puts "Didn't catch" +...> end +Didn't catch +** throw 13 + erl_eval:expr/3 +{% endhighlight %} There is one particularity that applies to `try/catch/after` when compared to other control-flow expressions. The Erlang VM considers such clauses unsafe (since they may fail or not) and do not allow variables defined inside `try/catch/after` to be accessed from the outer scope: - {% highlight iex %} - iex> try do - ...> new_var = 1 - ...> catch: value - ...> value - ...> end - 1 - iex> new_var - ** error :undef - {% endhighlight %} +{% highlight iex %} +iex> try do +...> new_var = 1 +...> catch: value +...> value +...> end +1 +iex> new_var +** error :undef +{% endhighlight %} The common strategy then is to make explicit all arguments that are required after the `try`: - {% highlight elixir %} - { x, y } = try do - x = calculate_some_value() - y = some_other_value() - { x, y } - catch: _ - { nil, nil } - end +{% highlight elixir %} +{ x, y } = try do + x = calculate_some_value() + y = some_other_value() + { x, y } +catch: _ + { nil, nil } +end - x #=> returns the value of x or nil for failures - {% endhighlight %} +x #=> returns the value of x or nil for failures +{% endhighlight %} ### 2.6.7 Rescue While `catch` clauses inside `try` are simply a pattern matching mechanism, `rescue` provides a higher abstraction around exceptions. `rescue` allows a developer to rescue an exception by its name and not by its internal contents. Consider the following examples: - {% highlight elixir %} - try do - raise "some error" - rescue: RuntimeError - "rescued" - end - - try do - raise "some error" - rescue: [RuntimeError] - "rescued" - end - - # rescue and assign to x - try do - raise "some error" - rescue: x in [RuntimeError] - # all exceptions respond to message - x.message - end - - # rescue all (discouraged) and assign to x - try do - raise ArgumentError, message: "unexpected argument" - rescue: x in _ - x.message - end - {% endhighlight %} +{% highlight elixir %} +try do + raise "some error" +rescue: RuntimeError + "rescued" +end + +try do + raise "some error" +rescue: [RuntimeError] + "rescued" +end + +# rescue and assign to x +try do + raise "some error" +rescue: x in [RuntimeError] + # all exceptions respond to message + x.message +end + +# rescue all (discouraged) and assign to x +try do + raise ArgumentError, message: "unexpected argument" +rescue: x in _ + x.message +end +{% endhighlight %} Custom exceptions can be defined using the `defexception` macro. Check [the exceptions file for some examples](https://github.com/elixir-lang/elixir/tree/master/lib/exception.ex). @@ -652,33 +652,33 @@ The last control-flow mechanism we are going to discuss is essential to Elixir's In order to exchange messages, each process has a mailbox where the received messages are stored. The `receive` mechanism allows us to go through this mailbox searching for a message that matches the given pattern. Here is an example that uses the arrow operator `<-` to send a message to the current process and then collects this message from its mailbox: - {% highlight iex %} - # Get the current process id - iex> current_pid = self() +{% highlight iex %} +# Get the current process id +iex> current_pid = self() - # Spawn another process that will send a message to current_pid - iex> spawn fn(do: current_pid <- { :hello, self() }) - <0.36.0> +# Spawn another process that will send a message to current_pid +iex> spawn fn(do: current_pid <- { :hello, self() }) +<0.36.0> - # Collect the message - iex> receive do - ...> match: { :hello, pid } - ...> IO.puts "Hello from #{inspect(pid)}" - ...> end - Hello from <0.36.0> - {% endhighlight %} +# Collect the message +iex> receive do +...> match: { :hello, pid } +...> IO.puts "Hello from #{inspect(pid)}" +...> end +Hello from <0.36.0> +{% endhighlight %} You may not see exactly `<0.36.0>` back, but something similar. If there are no messages in the mailbox, the current process will hang until a matching message arrives, unless an after clause is given: - {% highlight iex %} - iex> receive do - ...> match: :waiting - ...> IO.puts "This may never come" - ...> after: 1000 # 1 second - ...> IO.puts "Too late" - ...> end - Too late - {% endhighlight %} +{% highlight iex %} +iex> receive do +...> match: :waiting +...> IO.puts "This may never come" +...> after: 1000 # 1 second +...> IO.puts "Too late" +...> end +Too late +{% endhighlight %} In most cases, we don't send messages directly with `<-` nor write `receive` control expressions. Instead, we use many of the abstractions provided by OTP which will be discussed later. diff --git a/getting_started/3.markdown b/getting_started/3.markdown index e2cc50b3b..f655430f8 100644 --- a/getting_started/3.markdown +++ b/getting_started/3.markdown @@ -9,23 +9,23 @@ guide: 3 In Elixir, you can group several functions into a module. In the previous chapter, we have invoked for example functions from the module List: - {% highlight iex %} - iex> List.flatten [1,[2],3] - [1, 2, 3] - {% endhighlight %} +{% highlight iex %} +iex> List.flatten [1,[2],3] +[1, 2, 3] +{% endhighlight %} In order to create our own modules in Elixir, all we have to do is to call the `defmodule` function and use `def` to define our functions: - {% highlight iex %} - iex> defmodule Math do - ...> def sum(a, b) do - ...> a + b - ...> end - ...> end +{% highlight iex %} +iex> defmodule Math do +...> def sum(a, b) do +...> a + b +...> end +...> end - iex> Math.sum(1, 2) - 3 - {% endhighlight %} +iex> Math.sum(1, 2) +3 +{% endhighlight %} Before diving into modules, let's first have a brief overview about compilation. @@ -33,13 +33,13 @@ Before diving into modules, let's first have a brief overview about compilation. Most of the times it is convenient to write modules into files so they can be compiled and re-used. Let's assume we have a file named `math.ex` with the following contents: - {% highlight elixir %} - defmodule Math do - def sum(a, b) do - a + b - end - end - {% endhighlight %} +{% highlight elixir %} +defmodule Math do + def sum(a, b) do + a + b + end +end +{% endhighlight %} This file can be compiled using `bin/elixirc` (or simply `elixirc` if you installed Elixir via a distribution): @@ -47,10 +47,10 @@ This file can be compiled using `bin/elixirc` (or simply `elixirc` if you instal Which will then generate a file named `::Math.beam` containing the bytecode for the defined module. Now, if we start `bin/iex` again, our module definition will be available (considering `bin/iex` is being started in the same directory the bytecode file is): - {% highlight iex %} - iex> Math.sum(1, 2) - 3 - {% endhighlight %} +{% highlight iex %} +iex> Math.sum(1, 2) +3 +{% endhighlight %} Elixir projects are usually organized into three directories: @@ -68,15 +68,15 @@ Where `-pa` stands for `path append`. The same option can also be passed to `eli Besides the Elixir file `.ex`, Elixir also supports `.exs` files for scripting. Elixir treats both files exactly the same way, the only difference is in intention. `.ex` files are meant to be compiled while `.exs` files are used for scripting, without a need for compilation. For instance, one can create a file called `math.exs`: - {% highlight elixir %} - defmodule Math do - def sum(a, b) do - a + b - end - end +{% highlight elixir %} +defmodule Math do + def sum(a, b) do + a + b + end +end - IO.puts Math.sum(1, 2) - {% endhighlight %} +IO.puts Math.sum(1, 2) +{% endhighlight %} And execute it as: @@ -88,40 +88,40 @@ The file will be compiled in memory and executed, printing 3 as result. No bytec Inside a module, we can define functions with `def` and private functions with `defp`. A function defined with `def` is available to be invoked from other modules while a private function can only be invoked locally. - {% highlight elixir %} - defmodule Math do - def sum(a, b) do - do_sum(a, b) - end +{% highlight elixir %} +defmodule Math do + def sum(a, b) do + do_sum(a, b) + end - defp do_sum(a, b) do - a + b - end - end + defp do_sum(a, b) do + a + b + end +end - Math.sum(1, 2) #=> 3 - Math.do_sum(1, 2) #=> ** (UndefinedFunctionError) - {% endhighlight %} +Math.sum(1, 2) #=> 3 +Math.do_sum(1, 2) #=> ** (UndefinedFunctionError) +{% endhighlight %} Function declarations also supports guards and multiple clauses. If a function has several clauses, Elixir will try each clause until find one that matches. For example, here is the implementation for a function that checks if the given number is zero or not: - {% highlight elixir %} - defmodule Math do - def zero?(0) do - true - end +{% highlight elixir %} +defmodule Math do + def zero?(0) do + true + end - def zero?(x) when is_number(x) do - false - end - end + def zero?(x) when is_number(x) do + false + end +end - Math.zero?(0) #=> true - Math.zero?(1) #=> false +Math.zero?(0) #=> true +Math.zero?(1) #=> false - Math.zero?([1,2,3]) - #=> ** (FunctionClauseError) - {% endhighlight %} +Math.zero?([1,2,3]) +#=> ** (FunctionClauseError) +{% endhighlight %} Notice that giving an argument that does not match any of the clauses raises an error. @@ -133,34 +133,34 @@ In order to support software-reuse, Elixir supports two directives. As we are go We use `import` whenever we want to easily access functions or macros from others modules without using the qualified name. For instance, if we want to use the `values` function from `Orddict` several times in a module and we don't want to always type `Orddict.values`, we can simply import it: - {% highlight elixir %} - defmodule Math do - import Orddict, only: [values: 1] +{% highlight elixir %} +defmodule Math do + import Orddict, only: [values: 1] - def some_function do - # call values(orddict) - end - end - {% endhighlight %} + def some_function do + # call values(orddict) + end +end +{% endhighlight %} In this case, we are importing only the function `values` (with arity 1) from `Orddict`. Although `only:` is optional, its usage is recommended. `except` could also be given as an option. If we want to import only `:functions` or `:macros` from a given module, we can also pass a first argument selecting the scope: - {% highlight elixir %} - import :macros, MyMacros - {% endhighlight %} +{% highlight elixir %} +import :macros, MyMacros +{% endhighlight %} And then we can use `only` or `except` to filter the macros being included. Finally, note that `import` is **lexical**, this means we can import specific macros inside specific functions: - {% highlight elixir %} - defmodule Math do - def some_function do - import Orddict, only: [values: 1] - # call values(orddict) - end - end - {% endhighlight %} +{% highlight elixir %} +defmodule Math do + def some_function do + import Orddict, only: [values: 1] + # call values(orddict) + end +end +{% endhighlight %} In the example above, we imported `Orddict.values` only for during that specific function. `values` won't be available in any other functions in that module. @@ -168,27 +168,27 @@ In the example above, we imported `Orddict.values` only for during that specific `require` is responsible to enforce that a module is loaded and to setup references aliases for a given module. For instance, one can do: - {% highlight elixir %} - defmodule Math do - require MyOrddict, as: Orddict - end - {% endhighlight %} +{% highlight elixir %} +defmodule Math do + require MyOrddict, as: Orddict +end +{% endhighlight %} And now, any reference to `Orddict` will be automatically replaced by `MyOrddict`. In case one wants to access the original `Orddict`, it can be done by prefixing the module name with `::`: - {% highlight elixir %} - Orddict.values #=> uses ::MyOrddict.values - ::Orddict.values #=> uses ::Orddict.values - {% endhighlight %} +{% highlight elixir %} +Orddict.values #=> uses ::MyOrddict.values +::Orddict.values #=> uses ::Orddict.values +{% endhighlight %} In general, a module does not need to be required before usage, except if we want to use the macros available in that module. For instance, suppose we created our own `my_if` implementation in a module named `MyMacros`. If we want to invoke it, we need to first explicitly require `MyMacros`: - {% highlight elixir %} - defmodule Math do - require MyMacros - MyMacros.my_if do_something, it_works - end - {% endhighlight %} +{% highlight elixir %} +defmodule Math do + require MyMacros + MyMacros.my_if do_something, it_works +end +{% endhighlight %} An attempt to call a macro that was not loaded will raise an error. Note that, as the import directive, `require` is lexical. @@ -196,20 +196,20 @@ An attempt to call a macro that was not loaded will raise an error. Note that, a Elixir also allows module to store their own data. The canonical example for such data is annotating that a module implements the OTP behavior called `gen_server`: - {% highlight elixir %} - defmodule MyServer do - @behavior :gen_server - # ... callbacks ... - end - {% endhighlight %} +{% highlight elixir %} +defmodule MyServer do + @behavior :gen_server + # ... callbacks ... +end +{% endhighlight %} Now if the module above does not implement any of the callbacks required by `gen_server`, a warning will be raised. Another data used internally by Elixir is is the `@vsn`: - {% highlight elixir %} - defmodule MyServer do - @vsn 2 - end - {% endhighlight %} +{% highlight elixir %} +defmodule MyServer do + @vsn 2 +end +{% endhighlight %} `@vsn` refers to version and is used by the code reloading mechanism to check if a module is updated or not. If no version is specified, the version is set to the MD5 of the module functions. @@ -232,18 +232,18 @@ The following are also reserved by Elixir (as they have special semantics to the Besides the built-in data above, any developer can also add custom data: - {% highlight elixir %} - defmodule MyServer do - @my_data 13 - IO.inspect @my_data #=> 13 - end - {% endhighlight %} +{% highlight elixir %} +defmodule MyServer do + @my_data 13 + IO.inspect @my_data #=> 13 +end +{% endhighlight %} After the module is compiled, the stored custom data can be accessed via `__info__(:data)` and it will return an `Orddict`: - {% highlight elixir %} - MyServer.__info__(:data) #=> [my_data: 13] - {% endhighlight %} +{% highlight elixir %} +MyServer.__info__(:data) #=> [my_data: 13] +{% endhighlight %} > Note: Erlang developers may be wondering why Elixir provides its own data abstraction instead of using Erlang attributes. Erlang attributes are basically a list which also allow duplicated entries. For Elixir, since the same data may be read and updated several times during compilation, it makes more sense to have a dictionary structure instead of a list. Erlang developers wishing to have the attributes functionality have two options: > @@ -255,12 +255,12 @@ After the module is compiled, the stored custom data can be accessed via `__info In Elixir, nesting a module inside the other does not affect its name: - {% highlight elixir %} - defmodule Foo do - defmodule Bar do - end - end - {% endhighlight %} +{% highlight elixir %} +defmodule Foo do + defmodule Bar do + end +end +{% endhighlight %} The example above will define two modules `Foo` and `Bar`. Notice that the second module is **not** called `Foo::Bar`. In general, nesting modules is discouraged in Elixir. @@ -268,50 +268,50 @@ The example above will define two modules `Foo` and `Bar`. Notice that the secon In Erlang (and consequently in the Erlang VM), modules and functions are represented by atoms. For instance, this is valid Erlang code: - {% highlight elixir %} - Mod = lists, - Mod:flatten([1,[2],3]). - {% endhighlight %} +{% highlight elixir %} +Mod = lists, +Mod:flatten([1,[2],3]). +{% endhighlight %} In the example above, we store the atom `lists` in the variable `Mod` and then invoked the function flatten in it. In Elixir, exactly the same idiom is allowed. In fact, we could call the same function `flatten` in `lists` as: - {% highlight iex %} - iex> :lists.flatten([1,[2],3]) - [1,2,3] - {% endhighlight %} +{% highlight iex %} +iex> :lists.flatten([1,[2],3]) +[1,2,3] +{% endhighlight %} This mechanism is exactly what empowers Elixir references. Elixir references are uppercase identifiers (like `List`, `Orddict`, etc) that are converted to an atom representing a module at compilation time. For instance, by default `List` translates to the atom `::List`: - {% highlight iex %} - iex> List - ::List - iex> is_atom(List) - true - {% endhighlight %} +{% highlight iex %} +iex> List +::List +iex> is_atom(List) +true +{% endhighlight %} References are powerful when used with the `require` directive discussed above. For instance, let's imagine our Math module relies heavily on the `Orddict` module. If, at some point, we find out most algorithms in `Orddict` could be implemented in a much faster way, we could implement `FastOrddict` and use it as a drop-in replacement: - {% highlight elixir %} - defmodule Math do - require FastOrddict, as: Orddict - # ... - end - {% endhighlight %} +{% highlight elixir %} +defmodule Math do + require FastOrddict, as: Orddict + # ... +end +{% endhighlight %} Now any reference to `Orddict` will be automatically replaced by `FastOrddict`. In case one wants to access the original `Orddict`, it can be done by prefixing the module name with `::`: - {% highlight elixir %} - Orddict.values #=> uses ::FastOrddict.values - ::Orddict.values #=> uses ::Orddict.values - {% endhighlight %} +{% highlight elixir %} +Orddict.values #=> uses ::FastOrddict.values +::Orddict.values #=> uses ::Orddict.values +{% endhighlight %} Finally, in Elixir `::` is simply an operator (like `+`). It is used to concatenate two references: - {% highlight iex %} - iex> Foo::Bar - ::Foo::Bar - iex> Foo :: Bar - ::Foo::Bar - {% endhighlight %} +{% highlight iex %} +iex> Foo::Bar +::Foo::Bar +iex> Foo :: Bar +::Foo::Bar +{% endhighlight %} > Note: a reference does not actually ensure the reference really exists. For instance, `::FooBarBaz` will return an atom regardless if a `::FooBarBaz` module is defined or not. diff --git a/getting_started/4.markdown b/getting_started/4.markdown index 891d69fbf..c4c12c525 100644 --- a/getting_started/4.markdown +++ b/getting_started/4.markdown @@ -13,59 +13,59 @@ Elixir provides both protocols and records. This section will outline the main f Records are simple structures that holds values. For example, we can define a `FileInfo` record that is supposed to store information about files as follow: - {% highlight elixir %} - defrecord FileInfo, atime: nil, mtime: nil, accesses: 0 - {% endhighlight %} +{% highlight elixir %} +defrecord FileInfo, atime: nil, mtime: nil, accesses: 0 +{% endhighlight %} The line above will define a module named `FileInfo` which contain a function named `new` that returns a new record and other functions to read and set the values in the record. Therefore, we can do: - {% highlight elixir %} - file_info = FileInfo.new(atime: now()) - file_info.atime #=> Returns the value of atime - file_info.atime(now()) #=> Updates the value of atime - {% endhighlight %} +{% highlight elixir %} +file_info = FileInfo.new(atime: now()) +file_info.atime #=> Returns the value of atime +file_info.atime(now()) #=> Updates the value of atime +{% endhighlight %} Elixir will also define a `update_#{field}` function that accepts a function as argument that will receive the old value and update the current value with the result of the function: - {% highlight elixir %} - file_info = FileInfo.new(accesses: 10) - file_info = file_info.update_accesses(fn(x) -> x + 1 end) - file_info.accesses #=> 11 - {% endhighlight %} +{% highlight elixir %} +file_info = FileInfo.new(accesses: 10) +file_info = file_info.update_accesses(fn(x) -> x + 1 end) +file_info.accesses #=> 11 +{% endhighlight %} Internally, a record is simply a tuple where the first element is always the record module name. This can be noticed if we create and print the record in Interactive Elixir (`bin/iex`): - {% highlight iex %} - iex> defrecord FileInfo, atime: nil, mtime: nil - iex> FileInfo.new - {::FileInfo, nil, nil} - {% endhighlight %} +{% highlight iex %} +iex> defrecord FileInfo, atime: nil, mtime: nil +iex> FileInfo.new +{::FileInfo, nil, nil} +{% endhighlight %} ### 4.1.1 Default based functions Depending on the default value, Elixir will define helpers to interact with the record. For example, the test framework that ships with Elixir, called ExUnit, defines a record which keeps track of how many tests were executed and the failures that happened. The record definition is similar to: - {% highlight iex %} - iex> defrecord Config, counter: 0, failures: [] - {% endhighlight %} +{% highlight iex %} +iex> defrecord Config, counter: 0, failures: [] +{% endhighlight %} Since `counter` is an integer, Elixir automatically defines a helper named `increment_counter` that will increase the counter value: - {% highlight iex %} - iex> new_config = Config.new.increment_counter - {::Config, 1, []} - iex> new_config.counter - 1 - {% endhighlight %} +{% highlight iex %} +iex> new_config = Config.new.increment_counter +{::Config, 1, []} +iex> new_config.counter +1 +{% endhighlight %} `increment_counter` also accepts a number to increment as argument: - {% highlight iex %} - iex> new_config = Config.new.increment_counter 10 - {::Config, 10, []} - iex> new_config.counter - 10 - {% endhighlight %} +{% highlight iex %} +iex> new_config = Config.new.increment_counter 10 +{::Config, 10, []} +iex> new_config.counter +10 +{% endhighlight %} On the other hand, if the default value is a list Elixir will define the two following helpers: @@ -80,31 +80,31 @@ In Elixir, only `false` and `nil` are considered falsy values. Everything else e We could implement this protocol as follow: - {% highlight elixir %} - defprotocol Blank, [ blank?(data) ] - {% endhighlight %} +{% highlight elixir %} +defprotocol Blank, [ blank?(data) ] +{% endhighlight %} The protocol expects a function called `blank?` expecting one argument to be implemented. We can implement this protocol for some Elixir data types as follow: - {% highlight elixir %} - # Numbers are never blank - defimpl Blank, for: Number do - def blank?(number), do: false - end - - # Just empty list is blank - defimpl Blank, for: List do - def blank?([]), do: true - def blank?(_), do: false - end - - # Just the atoms false and nil are blank - defimpl Blank, for: Atom do - def blank?(false), do: true - def blank?(nil), do: true - def blank?(_), do: false - end - {% endhighlight %} +{% highlight elixir %} +# Numbers are never blank +defimpl Blank, for: Number do + def blank?(number), do: false +end + +# Just empty list is blank +defimpl Blank, for: List do + def blank?([]), do: true + def blank?(_), do: false +end + +# Just the atoms false and nil are blank +defimpl Blank, for: Atom do + def blank?(false), do: true + def blank?(nil), do: true + def blank?(_), do: false +end +{% endhighlight %} And we would do so for all native data types. The types available are: @@ -124,17 +124,17 @@ And we would do so for all native data types. The types available are: Implementing the protocol for all 9 types above can be cumbersome. Even more if you consider that Number, Function, PID, Port and Reference are never going to be blank. For this reason, Elixir allows us to declare that we are going to implement the protocol just for some types, as follows: - {% highlight elixir %} - defprotocol Blank, [blank?(data)], only: [Atom, Tuple, List, BitString, Any] - {% endhighlight %} +{% highlight elixir %} +defprotocol Blank, [blank?(data)], only: [Atom, Tuple, List, BitString, Any] +{% endhighlight %} Since we also specified `Any` as a data type, if the data type is not any of Atom, Tuple, List or BitString, it will automatically fallback to Any: - {% highlight elixir %} - defimpl Blank, for: Any do - def blank?(_), do: false - end - {% endhighlight %} +{% highlight elixir %} +defimpl Blank, for: Any do + def blank?(_), do: false +end +{% endhighlight %} Now all data types that we have not specified will be automatically considered non blank. @@ -142,11 +142,11 @@ Now all data types that we have not specified will be automatically considered n The real benefit of protocols comes when mixed with records. For instance, one may implement a custom dictionary as a Red-Black tree and this dictionary should also be considered blank in case it has no items. That said, the developer just needs to implement the protocol for this dictionary: - {% highlight elixir %} - defimpl Blank, for: RedBlack::Dict do - def blank?(dict), do: RedBlack.empty?(dict) - end - {% endhighlight %} +{% highlight elixir %} +defimpl Blank, for: RedBlack::Dict do + def blank?(dict), do: RedBlack.empty?(dict) +end +{% endhighlight %} In the example above, we have implemented `blank?` for the custom dictionary that simply delegates to `RedBlack.empty?`. Finally, since records are simply tuples, the default implementation for records can be given in the tuple implementation. diff --git a/getting_started/5.markdown b/getting_started/5.markdown index 3f1dd9f72..737180d9e 100644 --- a/getting_started/5.markdown +++ b/getting_started/5.markdown @@ -13,15 +13,15 @@ Elixir is an homoiconic language. Any Elixir program can be represented using it The building block of Elixir homoiconicity is a tuple with three elements, for example: - {% highlight elixir %} - { :sum, 1, [1, 2, 3] } - {% endhighlight %} +{% highlight elixir %} +{ :sum, 1, [1, 2, 3] } +{% endhighlight %} The tuple above represents a function call to sum passing 1, 2 and 3 as arguments. The tuple elements are: - {% highlight elixir %} - { Tuple | Atom, Integer, List | Atom } - {% endhighlight %} +{% highlight elixir %} +{ Tuple | Atom, Integer, List | Atom } +{% endhighlight %} * The first element of the tuple is always an atom or another tuple in the same representation; * The second element of the tuple is always an integer representing the line number; @@ -29,34 +29,34 @@ The tuple above represents a function call to sum passing 1, 2 and 3 as argument You can get the representation of any expression by using the quote macro: - {% highlight iex %} - iex> quote do: sum(1, 2, 3) - { :sum, 0, [1, 2, 3] } - {% endhighlight %} +{% highlight iex %} +iex> quote do: sum(1, 2, 3) +{ :sum, 0, [1, 2, 3] } +{% endhighlight %} Everything in Elixir is a function call and can be represented by such tuples. For example, operators are represented as such: - {% highlight iex %} - iex> quote do: 1 + 2 - { :"+", 0, [1, 2] } - {% endhighlight %} +{% highlight iex %} +iex> quote do: 1 + 2 +{ :"+", 0, [1, 2] } +{% endhighlight %} Even a tuple is represented as a call to `{}`: - {% highlight iex %} - iex> quote do: { 1, 2, 3 } - { :"{}", 0, [1, 2, 3] } - {% endhighlight %} +{% highlight iex %} +iex> quote do: { 1, 2, 3 } +{ :"{}", 0, [1, 2, 3] } +{% endhighlight %} The only exception to this rule are the five Elixir literals below. Literals are data types that when quoted return themselves. They are: - {% highlight elixir %} - :sum #=> Atoms - 1.0 #=> Numbers - [1,2] #=> Lists - "binaries" #=> Binaries - {key, value} #=> Key-value pairs (i.e. a tuple with two elements) - {% endhighlight %} +{% highlight elixir %} +:sum #=> Atoms +1.0 #=> Numbers +[1,2] #=> Lists +"binaries" #=> Binaries +{key, value} #=> Key-value pairs (i.e. a tuple with two elements) +{% endhighlight %} With those basic structures in mind, we are ready to define our own macro. @@ -64,62 +64,62 @@ With those basic structures in mind, we are ready to define our own macro. A macro can be define using `defmacro`. For instance, we can define a macro called `unless` which works the same as Ruby's unless in just few lines of code: - {% highlight elixir %} - defmodule MyMacro do - defmacro unless(clause, options) do - quote do: if(!unquote(clause), unquote(options)) - end - end - {% endhighlight %} +{% highlight elixir %} +defmodule MyMacro do + defmacro unless(clause, options) do + quote do: if(!unquote(clause), unquote(options)) + end +end +{% endhighlight %} Similarly to `if`, `unless` expects two arguments: a `clause` and `options`: - {% highlight elixir %} - require MyMacro - MyMacro.unless var, do: IO.puts "false" - {% endhighlight %} +{% highlight elixir %} +require MyMacro +MyMacro.unless var, do: IO.puts "false" +{% endhighlight %} However, since `unless` is a macro, it won't receive values when invoked, but instead, its expressions. For example, if one calls: - {% highlight elixir %} - unless 2 + 2 == 5, do: call_function() - {% endhighlight %} +{% highlight elixir %} +unless 2 + 2 == 5, do: call_function() +{% endhighlight %} Our `unless` macro will receive the following: - {% highlight elixir %} - unless({:==, 1, [{:+, 1, [2, 2]}, 5]}, { :call_function, 1, [] }) - {% endhighlight %} +{% highlight elixir %} +unless({:==, 1, [{:+, 1, [2, 2]}, 5]}, { :call_function, 1, [] }) +{% endhighlight %} Then our `unless` macro will call `quote`, to return a tree representation of the `if` clause. This means we are transforming our `unless` in a `if`! There is a common mistake when quoting expressions which is that developers usually forget to `unquote` the proper expression. In order to understand what `unquote` does, let's simply remove it: - {% highlight elixir %} - defmacro unless(clause, options) do - quote do: if(!clause, options) - end - {% endhighlight %} +{% highlight elixir %} +defmacro unless(clause, options) do + quote do: if(!clause, options) +end +{% endhighlight %} When called as `unless 2 + 2 == 5, do: call_function()`, our `unless` would then literally return: - {% highlight elixir %} - if(!clause, options) - {% endhighlight %} +{% highlight elixir %} +if(!clause, options) +{% endhighlight %} Which would fail because the clause and options variables are not defined in the current scope. If we add `unquote` back: - {% highlight elixir %} - defmacro unless(clause, options) do - quote do: if(!unquote(clause), unquote(options)) - end - {% endhighlight %} +{% highlight elixir %} +defmacro unless(clause, options) do + quote do: if(!unquote(clause), unquote(options)) +end +{% endhighlight %} Which will then return: - {% highlight elixir %} - if(!(2 + 2 == 5), do: call_function()) - {% endhighlight %} +{% highlight elixir %} +if(!(2 + 2 == 5), do: call_function()) +{% endhighlight %} In other words, unquote is a mechanism to inject expressions into the tree being quoted and is essential to the meta-programming mechanism. Elixir also provides `unquote_splicing` allowing us to inject many expressions at once. @@ -129,67 +129,67 @@ We can define any macro we want, including override the built-in macros provided Elixir macros follow Scheme conventions and are hygienic. This means a variable defined inside a macro won't conflict with a variable defined in the context the macro is inserted. For example: - {% highlight elixir %} - defmodule Hygiene do - defmacro no_interference do - quote do: a = 1 - end - end +{% highlight elixir %} +defmodule Hygiene do + defmacro no_interference do + quote do: a = 1 + end +end - require Hygiene +require Hygiene - a = 13 - Hygiene.no_interference - a # => 13 - {% endhighlight %} +a = 13 +Hygiene.no_interference +a # => 13 +{% endhighlight %} In the example above, even if the macro injects `a = 1`, it does not affect the variable `a`. In case the macro wants to explicitly affect the context, it can use `var!`: - {% highlight elixir %} - defmodule Hygiene do - defmacro interference do - quote do: var!(a) = 1 - end - end +{% highlight elixir %} +defmodule Hygiene do + defmacro interference do + quote do: var!(a) = 1 + end +end - require Hygiene +require Hygiene - a = 13 - Hygiene.interference - a # => 1 - {% endhighlight %} +a = 13 +Hygiene.interference +a # => 1 +{% endhighlight %} Macros hygiene only works because Elixir marks a variable as coming from the quote. For example, consider this: - {% highlight iex %} - iex> quote do: x - { :x, 0, :quoted } - {% endhighlight %} +{% highlight iex %} +iex> quote do: x +{ :x, 0, :quoted } +{% endhighlight %} Notice that the third element is `:quoted`. It means that x may be a function call with 0 arguments or a variable coming from a quote. On the other hand, an unquoted variable would have the third element equals to nil. Let's consider this final example: - {% highlight elixir %} - defmodule Hygiene do - defmacro quoted(x) do - quote do - { unquote(x), x, x() } - end - end +{% highlight elixir %} +defmodule Hygiene do + defmacro quoted(x) do + quote do + { unquote(x), x, x() } end - {% endhighlight %} + end +end +{% endhighlight %} In the example above, we have defined a macro called `quoted` that returns an unquoted variable, a quoted variable and a function call. Calling this macro will return: - {% highlight elixir %} - require Hygiene +{% highlight elixir %} +require Hygiene - Hygiene.quoted(x) - #=> { - { :x, 1, nil }, - { :x, 1, :quoted }, - { :x, 1, [] } - } - {% endhighlight %} +Hygiene.quoted(x) +#=> { + { :x, 1, nil }, + { :x, 1, :quoted }, + { :x, 1, [] } +} +{% endhighlight %} Summing up: if the third element is a list, it is certainly a function call. If not, it may be a variable (coming from a quote or not) or a function call. @@ -197,30 +197,30 @@ Summing up: if the third element is a list, it is certainly a function call. If In order to support recursion, macros cannot be called locally. For example, one cannot write: - {% highlight elixir %} - defmodule MyMacros - defmacro delegate([h|t], to: target) do - # ... - end +{% highlight elixir %} +defmodule MyMacros + defmacro delegate([h|t], to: target) do + # ... + end - # Call the macro delegate just defined above - delegate [values: 1], to: List - end - {% endhighlight %} + # Call the macro delegate just defined above + delegate [values: 1], to: List +end +{% endhighlight %} In order to access the macro, it needs to be defined in an outer module: - {% highlight elixir %} - defmodule MyMacros::Support - defmacro delegate([h|t], to: target) do - # ... - end - end - - defmodule MyMacros - require MyMacros::Support, import: true - delegate [values: 1], to: List - end - {% endhighlight %} +{% highlight elixir %} +defmodule MyMacros::Support + defmacro delegate([h|t], to: target) do + # ... + end +end + +defmodule MyMacros + require MyMacros::Support, import: true + delegate [values: 1], to: List +end +{% endhighlight %} With this note, we finish our introduction to macros. Next, let's move to the next chapter which will discuss several topics as native code compilation, partial application and others. diff --git a/getting_started/6.markdown b/getting_started/6.markdown index 5928ea4ff..8e7d2f3e0 100644 --- a/getting_started/6.markdown +++ b/getting_started/6.markdown @@ -11,27 +11,27 @@ guide: 6 Elixir uses the module data described in chapter 3 to drive its documentation system. For instance, consider the following example: - {% highlight elixir %} - defmodule MyModule do - @moduledoc "It does X" +{% highlight elixir %} +defmodule MyModule do + @moduledoc "It does X" - @doc "Returns the version" - def version, do: 1 - end - {% endhighlight %} + @doc "Returns the version" + def version, do: 1 +end +{% endhighlight %} In the example above, we are adding a module documentation to MyModule via `@moduledoc` and using `@doc` to document each function. When compiled with the `--docs` option, we will be able to inspect the documentation attributes in runtime (remember to start iex in the same directory you compiled the module): - {% highlight console %} - $ elixirc my_module.ex --docs - $ iex - {% endhighlight %} - {% highlight iex %} - iex> MyModule.__info__(:docs) - [{ { :version, 0 }, 5, :def, "Returns the version" }] - iex> MyModule.__info__(:moduledoc) - {1,"It does X"} - {% endhighlight %} +{% highlight console %} +$ elixirc my_module.ex --docs +$ iex +{% endhighlight %} +{% highlight iex %} +iex> MyModule.__info__(:docs) +[{ { :version, 0 }, 5, :def, "Returns the version" }] +iex> MyModule.__info__(:moduledoc) +{1,"It does X"} +{% endhighlight %} `__info__(:docs)` returns a list of tuples where each tuple contains the function/arity pair, the line the function was defined, the kind of the function (`def` or `defmacro`, docs applied to `defp` are always ignored) and the comments. The comment should be either a binary or a boolean. @@ -39,25 +39,25 @@ Similarly, `__info__(:moduledoc)` returns a tuple with the line the module was d In case `--docs` is not provided during compilation, both calls would return nil. Elixir promotes the use of markdown in documentation, since it is a widely available format. Consider for example the documentation for `Module.add_doc` which allows us to dynamically add a documentation to a function: - {% highlight elixir %} - @doc """ - Attaches documentation to a given function. It expects - the module the function belongs to, the line (a non negative - integer), the kind (`:def` or `:defmacro`), a tuple representing - the function and its arity and the documentation, which should - be either a binary or a boolean. +{% highlight elixir %} +@doc """ +Attaches documentation to a given function. It expects +the module the function belongs to, the line (a non negative +integer), the kind (`:def` or `:defmacro`), a tuple representing +the function and its arity and the documentation, which should +be either a binary or a boolean. - ## Examples +## Examples - defmodule MyModule do - Module.add_doc(__MODULE__, __LINE__ + 1, - :def, { :version, 0}, "Manually added docs") - def version, do: 1 - end + defmodule MyModule do + Module.add_doc(__MODULE__, __LINE__ + 1, + :def, { :version, 0}, "Manually added docs") + def version, do: 1 + end - """ - def add_doc(module, line, kind, tuple, doc) - {% endhighlight %} +""" +def add_doc(module, line, kind, tuple, doc) +{% endhighlight %} In the example, we use heredocs to allow the documentation to spawn several lines and markdown to style the documentation. @@ -65,28 +65,28 @@ In the example, we use heredocs to allow the documentation to spawn several line Elixir also supports partial application. Let's suppose we have a list of strings and we want to calculate the size for each them. We could do it as follow: - {% highlight iex %} - iex> list = ["foo", "bar", "baz"] - ["foo","bar","baz"] - iex> Enum.map list, fn(x) -> size(x) end - [3,3,3] - {% endhighlight %} +{% highlight iex %} +iex> list = ["foo", "bar", "baz"] +["foo","bar","baz"] +iex> Enum.map list, fn(x) -> size(x) end +[3,3,3] +{% endhighlight %} However, with partial application, we could also do: - {% highlight iex %} - iex> Enum.map list, size(&1) - [3,3,3] - {% endhighlight %} +{% highlight iex %} +iex> Enum.map list, size(&1) +[3,3,3] +{% endhighlight %} In the example above, we have invoked the function `size` passing `&1` as argument asking Elixir to generate a function that expects one argument and that argument will be passed to `size`. Since operators are also function calls they can also be partially applied: - {% highlight iex %} - iex> Enum.map [1,2,3], &1 * 2 - [2,4,6] - {% endhighlight %} +{% highlight iex %} +iex> Enum.map [1,2,3], &1 * 2 +[2,4,6] +{% endhighlight %} All functions can be partially applied, except [Elixir's special forms](https://github.com/elixir-lang/elixir/tree/master/lib/elixir/special_forms.ex). @@ -94,28 +94,28 @@ All functions can be partially applied, except [Elixir's special forms](https:// `use` is a macro intended to a common API for extension. For instance, in order to use the `ExUnit` test framework that ships with Elixir, you simply need to use `ExUnit::Case` in your module: - {% highlight elixir %} - defmodule AssertionTest do - use ExUnit::Case +{% highlight elixir %} +defmodule AssertionTest do + use ExUnit::Case - def test_always_pass do - true = true - end - end - {% endhighlight %} + def test_always_pass do + true = true + end +end +{% endhighlight %} By calling `use`, a hook called `__using__` will be invoked in `ExUnit::Case` which will then do the proper setup. In general, `use` is simply a translation to: - {% highlight elixir %} - defmodule AssertionTest do - require ExUnit::Case - ExUnit::Case.__using__(::AssertionTest) +{% highlight elixir %} +defmodule AssertionTest do + require ExUnit::Case + ExUnit::Case.__using__(::AssertionTest) - def test_always_pass do - true = true - end - end - {% endhighlight %} + def test_always_pass do + true = true + end +end +{% endhighlight %} In general, we recommend APIs to expose a `__using__` hook in case they want to expose functionality to developers. @@ -123,75 +123,75 @@ In general, we recommend APIs to expose a `__using__` hook in case they want to Elixir also provides list and bit comprehensions. List comprehensions allow you to quickly build a list from another list: - {% highlight iex %} - iex> lc n in [1,2,3,4], do: n * 2 - [2,4,6,8] - {% endhighlight %} +{% highlight iex %} +iex> lc n in [1,2,3,4], do: n * 2 +[2,4,6,8] +{% endhighlight %} Or, using key-value blocks: - {% highlight elixir %} - lc n in [1,2,3,4] do - n * 2 - end - {% endhighlight %} +{% highlight elixir %} +lc n in [1,2,3,4] do + n * 2 +end +{% endhighlight %} A comprehension accepts several expressions. Those expressions can be generators, as in `x in [1,2,3,4]`, or filters: - {% highlight iex %} - # A comprehension with a generator and a filter - iex> lc n in [1,2,3,4,5,6], rem(n, 2) == 0, do: n - [2,4,6] +{% highlight iex %} +# A comprehension with a generator and a filter +iex> lc n in [1,2,3,4,5,6], rem(n, 2) == 0, do: n +[2,4,6] - # A comprehension with two generators - iex> lc x in [1,2], y in [2,3], do: x*y - [2,3,4,6] - {% endhighlight %} +# A comprehension with two generators +iex> lc x in [1,2], y in [2,3], do: x*y +[2,3,4,6] +{% endhighlight %} Elixir provides generators for both lists and bitstrings: - {% highlight iex %} - # A list generator: - iex> lc n in [1,2,3,4], do: n * 2 - [2,4,6,8] +{% highlight iex %} +# A list generator: +iex> lc n in [1,2,3,4], do: n * 2 +[2,4,6,8] - # A bit string generator: - iex> lc <> in <<1,2,3,4>>, do: n * 2 - [2,4,6,8] - {% endhighlight %} +# A bit string generator: +iex> lc <> in <<1,2,3,4>>, do: n * 2 +[2,4,6,8] +{% endhighlight %} Bit string generators are quite useful when you need to organize bit string streams: - {% highlight iex %} - iex> pixels = <<213,45,132,64,76,32,76,0,0,234,32,15>> - iex> lc <> in pixels, do: {r,g,b} - [{213,45,132},{64,76,32},{76,0,0},{234,32,15}] - {% endhighlight %} +{% highlight iex %} +iex> pixels = <<213,45,132,64,76,32,76,0,0,234,32,15>> +iex> lc <> in pixels, do: {r,g,b} +[{213,45,132},{64,76,32},{76,0,0},{234,32,15}] +{% endhighlight %} Remember, as strings are binaries and a binary is a bitstring, we can also use strings on comprehensions. For instance, the example below removes all white space characters from a string via bit comprehensions: - {% highlight iex %} - iex> bc <> in " hello world ", c != ?\s, do: <> - "helloworld" - {% endhighlight %} +{% highlight iex %} +iex> bc <> in " hello world ", c != ?\s, do: <> +"helloworld" +{% endhighlight %} Elixir does its best to hide the differences between list and bit string generators. However, there is a special case due to Erlang limitation that we need to explicitly tell Erlang that a list is being given as argument: - {% highlight iex %} - # This will fail because when Elixir sees that the left side - # of the in expression is a bit string, it expects the right side - # to be a bit string as well: - iex> lc <> in [<<1>>,<<2>>,<<3>>], do: n*2 - ** (ErlangError) erlang error {:bad_generator,[<<1>>,<<2>>,<<3>>]} - - # You need to be explicit and use inlist: - iex> lc inlist(<>, [<<1>>,<<2>>,<<3>>]), do: n*2 - [2,4,6] - - # For consistency, inbin is also available: - iex> lc inbin(<>, <<1,2,3>>), do: n*2 - [2,4,6] - {% endhighlight %} +{% highlight iex %} +# This will fail because when Elixir sees that the left side +# of the in expression is a bit string, it expects the right side +# to be a bit string as well: +iex> lc <> in [<<1>>,<<2>>,<<3>>], do: n*2 +** (ErlangError) erlang error {:bad_generator,[<<1>>,<<2>>,<<3>>]} + +# You need to be explicit and use inlist: +iex> lc inlist(<>, [<<1>>,<<2>>,<<3>>]), do: n*2 +[2,4,6] + +# For consistency, inbin is also available: +iex> lc inbin(<>, <<1,2,3>>), do: n*2 +[2,4,6] +{% endhighlight %} ## 6.5 Native compilation From f110aca11cd2ea51c00846fad0e50968071fd9d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Tue, 6 Mar 2012 01:16:13 -0300 Subject: [PATCH 018/437] Revert "Merge pull request #3 from carlosgaldino/master" Reason: Seems like github doesn't updated the pygment to GitHub Pages This reverts commit c770777bd883ac0a2930d8115b916cac8bffe087, reversing changes made to 6ab2bde98b8b9571f47672519c282b91a6bb1c6e. --- _includes/top.html | 3 +- css/syntax.css | 60 ---- getting_started/1.markdown | 208 +++++------ getting_started/2.markdown | 700 ++++++++++++++++--------------------- getting_started/3.markdown | 250 ++++++------- getting_started/4.markdown | 114 +++--- getting_started/5.markdown | 202 +++++------ getting_started/6.markdown | 194 +++++----- 8 files changed, 689 insertions(+), 1042 deletions(-) delete mode 100644 css/syntax.css diff --git a/_includes/top.html b/_includes/top.html index af0d7474f..fa67f4778 100644 --- a/_includes/top.html +++ b/_includes/top.html @@ -5,7 +5,6 @@ {{ page.title }} - @@ -50,4 +49,4 @@

    -
    +
    \ No newline at end of file diff --git a/css/syntax.css b/css/syntax.css deleted file mode 100644 index 2774b7649..000000000 --- a/css/syntax.css +++ /dev/null @@ -1,60 +0,0 @@ -.highlight { background: #ffffff; } -.highlight .c { color: #999988; font-style: italic } /* Comment */ -.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */ -.highlight .k { font-weight: bold } /* Keyword */ -.highlight .o { font-weight: bold } /* Operator */ -.highlight .cm { color: #999988; font-style: italic } /* Comment.Multiline */ -.highlight .cp { color: #999999; font-weight: bold } /* Comment.Preproc */ -.highlight .c1 { color: #999988; font-style: italic } /* Comment.Single */ -.highlight .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */ -.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ -.highlight .gd .x { color: #000000; background-color: #ffaaaa } /* Generic.Deleted.Specific */ -.highlight .ge { font-style: italic } /* Generic.Emph */ -.highlight .gr { color: #aa0000 } /* Generic.Error */ -.highlight .gh { color: #999999 } /* Generic.Heading */ -.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ -.highlight .gi .x { color: #000000; background-color: #aaffaa } /* Generic.Inserted.Specific */ -.highlight .go { color: #888888 } /* Generic.Output */ -.highlight .gp { color: #555555 } /* Generic.Prompt */ -.highlight .gs { font-weight: bold } /* Generic.Strong */ -.highlight .gu { color: #aaaaaa } /* Generic.Subheading */ -.highlight .gt { color: #aa0000 } /* Generic.Traceback */ -.highlight .kc { font-weight: bold } /* Keyword.Constant */ -.highlight .kd { font-weight: bold } /* Keyword.Declaration */ -.highlight .kp { font-weight: bold } /* Keyword.Pseudo */ -.highlight .kr { font-weight: bold } /* Keyword.Reserved */ -.highlight .kt { color: #445588; font-weight: bold } /* Keyword.Type */ -.highlight .m { color: #009999 } /* Literal.Number */ -.highlight .s { color: #d14 } /* Literal.String */ -.highlight .na { color: #008080 } /* Name.Attribute */ -.highlight .nb { color: #0086B3 } /* Name.Builtin */ -.highlight .nc { color: #445588; font-weight: bold } /* Name.Class */ -.highlight .no { color: #008080 } /* Name.Constant */ -.highlight .ni { color: #800080 } /* Name.Entity */ -.highlight .ne { color: #990000; font-weight: bold } /* Name.Exception */ -.highlight .nf { color: #990000; font-weight: bold } /* Name.Function */ -.highlight .nn { color: #555555 } /* Name.Namespace */ -.highlight .nt { color: #000080 } /* Name.Tag */ -.highlight .nv { color: #008080 } /* Name.Variable */ -.highlight .ow { font-weight: bold } /* Operator.Word */ -.highlight .w { color: #bbbbbb } /* Text.Whitespace */ -.highlight .mf { color: #009999 } /* Literal.Number.Float */ -.highlight .mh { color: #009999 } /* Literal.Number.Hex */ -.highlight .mi { color: #009999 } /* Literal.Number.Integer */ -.highlight .mo { color: #009999 } /* Literal.Number.Oct */ -.highlight .sb { color: #d14 } /* Literal.String.Backtick */ -.highlight .sc { color: #d14 } /* Literal.String.Char */ -.highlight .sd { color: #d14 } /* Literal.String.Doc */ -.highlight .s2 { color: #d14 } /* Literal.String.Double */ -.highlight .se { color: #d14 } /* Literal.String.Escape */ -.highlight .sh { color: #d14 } /* Literal.String.Heredoc */ -.highlight .si { color: #d14 } /* Literal.String.Interpol */ -.highlight .sx { color: #d14 } /* Literal.String.Other */ -.highlight .sr { color: #009926 } /* Literal.String.Regex */ -.highlight .s1 { color: #d14 } /* Literal.String.Single */ -.highlight .ss { color: #990073 } /* Literal.String.Symbol */ -.highlight .bp { color: #999999 } /* Name.Builtin.Pseudo */ -.highlight .vc { color: #008080 } /* Name.Variable.Class */ -.highlight .vg { color: #008080 } /* Name.Variable.Global */ -.highlight .vi { color: #008080 } /* Name.Variable.Instance */ -.highlight .il { color: #009999 } /* Literal.Number.Integer.Long */ diff --git a/getting_started/1.markdown b/getting_started/1.markdown index be03269d1..8175f1075 100644 --- a/getting_started/1.markdown +++ b/getting_started/1.markdown @@ -31,14 +31,12 @@ If you don't use any of the distributions above, don't worry! Continue reading f You can download and compile Elixir in few steps: -{% highlight console %} -$ git clone https://github.com/elixir-lang/elixir.git -$ cd elixir -$ make test + $ git clone https://github.com/elixir-lang/elixir.git + $ cd elixir + $ make test -$ bin/elixir -v -Elixir 0.4.0.dev -{% endhighlight %} + $ bin/elixir -v + Elixir 0.4.0.dev If tests pass, you are ready to go. Otherwise, feel free to open an issue [in the issues tracker on Github](https://github.com/elixir-lang/elixir). @@ -51,25 +49,21 @@ If tests pass, you are ready to go. Otherwise, feel free to open an issue [in th We can start Elixir interactive mode by running `bin/iex` in the same directory you compiled Elixir or by simply running `iex` if you installed it from a distribution. In interactive mode, we can type any Elixir expression. Let's warm up with some basic arithmetic expressions: -{% highlight iex %} -iex> 1 + 1 -2 -iex> 10 - 5 -5 -iex> 10 / 2 -5.0 -{% endhighlight %} + iex> 1 + 1 + 2 + iex> 10 - 5 + 5 + iex> 10 / 2 + 5.0 Notice `10 / 2` returned a float `5.0` instead of an integer. This is expected, in Elixir the operator `/` always returns a float. In case you want to do integer division or get the division remainder, you can invoke the `div` and `rem` functions: -{% highlight iex %} -iex> div(10, 2) -5 -iex> div 10, 2 -5 -iex> rem 10, 3 -1 -{% endhighlight %} + iex> div(10, 2) + 5 + iex> div 10, 2 + 5 + iex> rem 10, 3 + 1 In the example above, we called two functions called `div` and `rem`. Notice that parenthesis are not required in order to invoke a function. We are going to discuss more about it later. Let's move forward and see which other data types we have in Elixir: @@ -77,84 +71,66 @@ In the example above, we called two functions called `div` and `rem`. Notice tha Some basic types are: -{% highlight iex %} -iex> 1 # integer -iex> 1.0 # float -iex> :atom # atom / symbol -iex> {1,2,3} # tuple -iex> [1,2,3] # list -{% endhighlight %} + iex> 1 # integer + iex> 1.0 # float + iex> :atom # atom / symbol + iex> {1,2,3} # tuple + iex> [1,2,3] # list Elixir also provides functions (note the dot between the variable and arguments when calling a function): -{% highlight iex %} -# function -iex> x = fn(a, b) -> a + b end -#Fun -iex> x.(1, 2) -3 -{% endhighlight %} + # function + iex> x = fn(a, b) -> a + b end + #Fun + iex> x.(1, 2) + 3 And double-quoted strings: -{% highlight iex %} -iex> "string" -"string" -{% endhighlight %} + iex> "string" + "string" Strings in Elixir are UTF-8 binaries delimited by double quotes. A single-quoted string in Elixir is called a char list and is simply a list of characters: -{% highlight iex %} -iex> 'string' -'string' -{% endhighlight %} + iex> 'string' + 'string' There is also string interpolation: -{% highlight iex %} -iex> name = "world" -iex> "hello #{name}" -"hello world" -{% endhighlight %} + iex> name = "world" + iex> "hello #{name}" + "hello world" We can use the `is_binary` and `is_list` helpers to detect if a given string is a binary (double-quoted) or a list (single-quoted): -{% highlight iex %} -iex> is_binary "string" -true -iex> is_list "string" -false + iex> is_binary "string" + true + iex> is_list "string" + false -iex> is_binary 'string' -false -iex> is_list 'string' -true -{% endhighlight %} + iex> is_binary 'string' + false + iex> is_list 'string' + true Although they represent the same thing, double-quoted and single-quoted strings are different and best suited for different scenarios: -{% highlight iex %} -iex> "string" == 'string' -false -{% endhighlight %} + iex> "string" == 'string' + false Most of the cases, developers should use double-quoted strings as their representation is more compact. We are going to discuss this subject with more detail in the next chapter. Elixir also provides `true` and `false` as booleans: -{% highlight iex %} -iex> true -true -iex> is_boolean false -true -{% endhighlight %} + iex> true + true + iex> is_boolean false + true Booleans are represented internally as atoms: -{% highlight iex %} -iex> is_atom(true) -true -{% endhighlight %} + iex> is_atom(true) + true Elixir also provides Port, References and PIDs as data types (usually used in process communication) but they are out of the scope of a getting started tutorial. For now, let's take a look at the basic operators in Elixir before we move on to the next chapter. @@ -164,83 +140,65 @@ As we saw earlier, Elixir provides `+`, `-`, `*`, `/` as arithmetic operators. Elixir also provides `++` and `--` to manipulate lists: -{% highlight iex %} -iex> [1,2,3] ++ [4,5,6] -[1,2,3,4,5,6] -iex> [1,2,3] -- [2] -[1,3] -{% endhighlight %} + iex> [1,2,3] ++ [4,5,6] + [1,2,3,4,5,6] + iex> [1,2,3] -- [2] + [1,3] Since single-quoted strings are lists, we can also use `++` and `--` as operators to manipulate them: -{% highlight iex %} -iex> 'some' ++ ' example' -'some example' -iex> 'some' -- 'oe' -'sm' -{% endhighlight %} + iex> 'some' ++ ' example' + 'some example' + iex> 'some' -- 'oe' + 'sm' Notice that `++` and `--` cannot be used to manipulate double quoted strings, as they are binaries. That said, string concatenation is done via `<>`: -{% highlight iex %} -iex> "foo" <> "bar" -"foobar" -{% endhighlight %} + iex> "foo" <> "bar" + "foobar" Elixir also provides three boolean operators: `or`, `and` and `not`. Those operators are strict in the sense those operators expects only booleans (true or false) as arguments: -{% highlight iex %} -iex> true and true -true -iex> false or is_atom(:example) -true -{% endhighlight %} + iex> true and true + true + iex> false or is_atom(:example) + true Giving a non-boolean as argument will raise an exception: -{% highlight iex %} -iex> 1 and true -** (::ArgumentError) argument error -{% endhighlight %} + iex> 1 and true + ** (::ArgumentError) argument error `or` and `and` are short-circuit operators. They just execute the right side in case the left side is not enough to determine the result: -{% highlight iex %} -iex> false and error("This error will never be raised") -false + iex> false and error("This error will never be raised") + false -iex> true or error("This error will never be raised") -true -{% endhighlight %} + iex> true or error("This error will never be raised") + true > Note: If you are an Erlang developer, `and` and `or` in Elixir actually map to the `andalso` and `orelse` operators in Erlang. Elixir also provides `==`, `!=`, `===`, `!===`, `<=`, `>=`, `<` and `>` as comparison operators: -{% highlight iex %} -iex> 1 == 1 -true -iex> 1 != 2 -true -iex> 1 < 2 -true -{% endhighlight %} + iex> 1 == 1 + true + iex> 1 != 2 + true + iex> 1 < 2 + true The difference between `==` and `===` is that the latter is more strict when comparing integers and floats: -{% highlight iex %} -iex> 1 == 1.0 -true -iex> 1 === 1.0 -false -{% endhighlight %} + iex> 1 == 1.0 + true + iex> 1 === 1.0 + false In Elixir, we can compare two different data types: -{% highlight iex %} -iex> 1 < :atom -true -{% endhighlight %} + iex> 1 < :atom + true The reason we can compare different data types is for pragmatism. Sorting algorithms don't need to worry about different data types in order to sort. The overall sorting order is defined below: @@ -248,4 +206,4 @@ The reason we can compare different data types is for pragmatism. Sorting algori You actually don't need to memorize this ordering, it is important just to know an order exists. -Well, that is it for the introduction. In the next chapter, we are going to discuss some basic functions, data types conversions and a bit of control-flow. +Well, that is it for the introduction. In the next chapter, we are going to discuss some basic functions, data types conversions and a bit of control-flow. \ No newline at end of file diff --git a/getting_started/2.markdown b/getting_started/2.markdown index f4f36d831..be2c1e3cd 100644 --- a/getting_started/2.markdown +++ b/getting_started/2.markdown @@ -13,86 +13,70 @@ In this section we are going a bit deeper into the basic data-types, learn some Elixir provides both lists and tuples: -{% highlight iex %} -iex> is_list [1,2,3] -true -iex> is_tuple {1,2,3} -true -{% endhighlight %} + iex> is_list [1,2,3] + true + iex> is_tuple {1,2,3} + true While both are used to store items, they differ on how those items are stored in memory. Lists are implemented as linked lists (where each item in the list points to the next item) while tuples are stored contiguously in memory. This means that accessing a tuple element is very fast (constant time) and can be achieved using the `elem` function (notice that indexes in Elixir data-types start with `1`): -{% highlight iex %} -iex> elem { :a, :b, :c }, 1 -:a -{% endhighlight %} + iex> elem { :a, :b, :c }, 1 + :a On the other hand, updating a tuple is expensive as it needs to duplicate the tuple contents in memory. Updating a tuple can be done with the `setelem` function: -{% highlight iex %} -iex> setelem { :a, :b, :c }, 1, :d -{:d,:b,:c} -{% endhighlight %} + iex> setelem { :a, :b, :c }, 1, :d + {:d,:b,:c} > Note: If you are an Erlang developer, you will notice that we used the `elem` and `setelem` functions instead of Erlang's `element` and `setelement`. The reason for this choice is that Elixir attempts to normalize Erlang API's to always receive the `subject` of the function as the first argument. Since updating a tuple is expensive, when we want to iterate, add or remove elements, we use lists. Since lists are linked, it means accessing the first element of the list is very cheap, however, accessing the n-th element will require the algorithm to pass through n-1 nodes before reaching the n-th. We can access the `head` of the list as follows: -{% highlight iex %} -iex> [head | tail] = [1,2,3] -[1,2,3] -iex> head -1 -iex> tail -[2,3] -iex> [head | tail] -[1,2,3] -iex> length [head | tail] -3 -{% endhighlight %} + iex> [head | tail] = [1,2,3] + [1,2,3] + iex> head + 1 + iex> tail + [2,3] + iex> [head | tail] + [1,2,3] + iex> length [head | tail] + 3 In the example above, we have assigned the head of the list to the variable `head` and the tail of the list to the variable `tail`. The [`Enum` module](https://github.com/elixir-lang/elixir/blob/master/lib/enum.ex) provides several helpers to manipulate lists (and other enumerables in general) while the [List module](https://github.com/elixir-lang/elixir/blob/master/lib/list.ex) provides several helpers specific to lists: -{% highlight iex %} -iex> Enum.map [1,2,3], fn(x) -> x * 2 end -[2,4,6] -iex> List.flatten [1,[2],3] -[1,2,3] -{% endhighlight %} + iex> Enum.map [1,2,3], fn(x) -> x * 2 end + [2,4,6] + iex> List.flatten [1,[2],3] + [1,2,3] ## 2.2 Lists and binaries In the previous chapter we have discussed double- and single-quoted strings. Double quoted strings are binaries while single-quoted strings are lists: -{% highlight iex %} -iex> "string" == 'string' -false -iex> is_binary "string" -true -iex> is_list 'string' -true -{% endhighlight %} + iex> "string" == 'string' + false + iex> is_binary "string" + true + iex> is_list 'string' + true In fact, both double-quoted and single-quoted representations are just a shorter representation of binaries and lists. Considering that `?a` in Elixir returns the ASCII integer for the letter `a`, we could also write: -{% highlight iex %} -iex> <> -"abc" -iex> [?a, ?b, ?c] -'abc' -{% endhighlight %} + iex> <> + "abc" + iex> [?a, ?b, ?c] + 'abc' In such cases, Elixir detects that all characters in the list and in the binary are printable and returns the quoted representation. However, adding a non-printable character forces them to be printed differently: -{% highlight iex %} -iex> <> -<<97,98,99,1>> + iex> <> + <<97,98,99,1>> -iex> [?a, ?b, ?c, 1] -[97,98,99,1] -{% endhighlight %} + iex> [?a, ?b, ?c, 1] + [97,98,99,1] Since lists are implemented as linked lists, it means a string represented as list usually takes a lot of space in memory (in ASCII, it would be one byte for each character and another byte to point to the next character). For this reason, binary (double-quoted) strings are preferred unless you want to explicitly iterate over the string as a list. @@ -104,10 +88,8 @@ Elixir's plans is to provide a small standard library responsible for handling m Erlang ships with a group of libraries called OTP (Open Telecom Platform). Besides an standard library, OTP provides several facilities to build OTP applications with supervisors that are robust, distributed and fault-tolerant. Invoking those libraries from Elixir is quite straight-forward, for example, we can call the [function `flatten` from the module `lists`](http://www.erlang.org/doc/man/lists.html#flatten-1) as follows: -{% highlight iex %} -iex> Erlang.lists.flatten [1,[2],3] -[1,2,3] -{% endhighlight %} + iex> Erlang.lists.flatten [1,[2],3] + [1,2,3] Erlang's OTP is very well documented and a developer should not have problems going around it: @@ -118,206 +100,162 @@ Erlang's OTP is very well documented and a developer should not have problems go When discussing lists, we saw the following example: -{% highlight iex %} -iex> [h | t] = [1,2,3] -[1, 2, 3] -iex> h -1 -iex> t -[2, 3] -{% endhighlight %} + iex> [h | t] = [1,2,3] + [1, 2, 3] + iex> h + 1 + iex> t + [2, 3] In Elixir, `=` does not mean assignment as in programming languages like Java and Ruby. `=` is actually a match operator which will check if the expressions on both left and right side match. Consider this example: -{% highlight iex %} -iex> { 1, 2, 3 } = { 1, 2, 3 } -{ 1, 2, 3 } -iex> { 1, 2, 3 } = { 1, 4, 3 } -** (::MatchError) no match of right hand side value: {1,4,3} -{% endhighlight %} + iex> { 1, 2, 3 } = { 1, 2, 3 } + { 1, 2, 3 } + iex> { 1, 2, 3 } = { 1, 4, 3 } + ** (::MatchError) no match of right hand side value: {1,4,3} If the tuples given on the left and right side do not match, an error is raised. If any of the tuples contain a variable, this variable will always be assigned: -{% highlight iex %} -iex> { 1, x, 3 } = { 1, 2, 3 } -{ 1, 2, 3 } -iex> x -2 -iex> { 1, x, 3 } = { 1, 4, 3 } -{ 1, 4, 3 } -iex> x -4 -{% endhighlight %} + iex> { 1, x, 3 } = { 1, 2, 3 } + { 1, 2, 3 } + iex> x + 2 + iex> { 1, x, 3 } = { 1, 4, 3 } + { 1, 4, 3 } + iex> x + 4 This is exactly what happened in the list example: -{% highlight iex %} -iex> [h | t] = [1,2,3] -[1, 2, 3] -{% endhighlight %} + iex> [h | t] = [1,2,3] + [1, 2, 3] We have assigned the head of the list to `h` and the tail to `t`. In fact, if we want to check if the head of the list is `1` and assign the tail, we could do: -{% highlight iex %} -iex> [1 | t] = [1,2,3] -[1, 2, 3] -iex> [0 | t] = [1,2,3] -** (::MatchError) no match of right hand side value: [1,2,3] -{% endhighlight %} + iex> [1 | t] = [1,2,3] + [1, 2, 3] + iex> [0 | t] = [1,2,3] + ** (::MatchError) no match of right hand side value: [1,2,3] In case you want to pattern match against the value of a variable, you can use the `^` operator: -{% highlight iex %} -iex> x = 1 -1 -iex> ^x = 1 -1 -iex> ^x = 2 -** (::MatchError) no match of right hand side value: 2 -iex> x = 2 -2 -{% endhighlight %} + iex> x = 1 + 1 + iex> ^x = 1 + 1 + iex> ^x = 2 + ** (::MatchError) no match of right hand side value: 2 + iex> x = 2 + 2 In Elixir, it is a common practice to assign a variable to underscore `_` if we don't intend to use it. For example, if only the head of the list matters to us, we can assign the tail to underscore: -{% highlight iex %} -iex> [h | _] = [1,2,3] -[1, 2, 3] -iex> h -1 -{% endhighlight %} + iex> [h | _] = [1,2,3] + [1, 2, 3] + iex> h + 1 The variable `_` in Elixir is special in the sense it can never be assigned. Trying to read from it gives an unbound variable error: -{% highlight iex %} -iex> _ -** (ErlangError) erlang error {:unbound_var, :_} -{% endhighlight %} + iex> _ + ** (ErlangError) erlang error {:unbound_var, :_} Although pattern matching allow powerful constructs, its usage is limited. For instance, you cannot make function calls on the left side of the match. The following example is invalid: -{% highlight iex %} -iex> Erlang.lists.flatten([1,[2],3]) = [1,2,3] -** (ErlangError) erlang error :illegal_pattern -{% endhighlight %} + iex> Erlang.lists.flatten([1,[2],3]) = [1,2,3] + ** (ErlangError) erlang error :illegal_pattern ## 2.5 Key-values One of the first control flow constructs we usually learn is the conditional `if`. In Elixir, we can write `if` in these two equivalent ways: -{% highlight iex %} -iex> if true, do: 1 + 2 -3 -iex> if true do -...> 1 + 2 -...> end -3 -{% endhighlight %} + iex> if true, do: 1 + 2 + 3 + iex> if true do + ...> 1 + 2 + ...> end + 3 Both examples above are simply different ways of expressing key-value arguments. Key-value arguments are a list of two-item tuples, where the first element is an atom representing the key and the second is the value. Elixir provides a syntax-shortcut for creating such key-values: -{% highlight iex %} -iex> [a: 1, b: 2] -[{:a, 1}, {:b, 2}] -{% endhighlight %} + iex> [a: 1, b: 2] + [{:a, 1}, {:b, 2}] In order to manipulate those key-value arguments, we can use the [`Orddict` module](https://github.com/elixir-lang/elixir/blob/master/lib/orddict.ex): -{% highlight iex %} -iex> x = [a: 1, b: 2] -[{:a, 1}, {:b, 2}] -iex> Orddict.get x, :a -1 -iex> Orddict.get x, :c -nil -{% endhighlight %} + iex> x = [a: 1, b: 2] + [{:a, 1}, {:b, 2}] + iex> Orddict.get x, :a + 1 + iex> Orddict.get x, :c + nil Going back to the `if` example, we invoked it passing a condition (`true`) and a key-value argument (`do: 1 + 2`): -{% highlight iex %} -iex> if true, do: 1 + 2 -3 -{% endhighlight %} + iex> if true, do: 1 + 2 + 3 Since the key-value argument is the last argument, the brackets are optional. These are all equivalent: -{% highlight iex %} -iex> if true, do: 1 + 2 -3 -iex> if true, [do: 1 + 2] -3 -iex> if(true, [do: 1 + 2]) -3 -{% endhighlight %} + iex> if true, do: 1 + 2 + 3 + iex> if true, [do: 1 + 2] + 3 + iex> if(true, [do: 1 + 2]) + 3 Besides, we can also pass an `else` clause to `if`: -{% highlight iex %} -iex> if false, do: 1 + 2, else: 10 + 3 -13 -{% endhighlight %} + iex> if false, do: 1 + 2, else: 10 + 3 + 13 However, most of the times `if` clauses are longer than the examples above. In such cases, we usually use the block format: -{% highlight iex %} -iex> if true do -...> 1 + 2 -...> end -{% endhighlight %} + iex> if true do + ...> 1 + 2 + ...> end Internally, this is converted to the same key-value arguments as above. This feature is called key-value blocks. You can pass `else:` as option as well: -{% highlight elixir %} -if false do - 1 + 2 -else: - 10 + 3 -end -{% endhighlight %} + if false do + 1 + 2 + else: + 10 + 3 + end Key-value blocks are similar to Ruby blocks. Parenthesis can be added as follows: -{% highlight elixir %} -if(false) do - 1 + 2 -else: - 10 + 3 -end -{% endhighlight %} + if(false) do + 1 + 2 + else: + 10 + 3 + end Key-value blocks are an important feature that allow developers to create their own control structures as if they were part of the language itself. For instance, none of the control structures we are going to see in the next section are keywords. They are all implemented using key-values blocks. Elixir supports two syntaxes for key-value blocks: `do`/`end` and `->`/`end`. The first one always binds to the farthest function call, while the latter to the closest. For example, the following expression: -{% highlight elixir %} -Enum.map [1,2,3], fn(x) do - x * 2 -end -{% endhighlight %} + Enum.map [1,2,3], fn(x) do + x * 2 + end Would be parsed as: -{% highlight elixir %} -Enum.map([1,2,3], fn(x)) do - x * 2 -end -{% endhighlight %} + Enum.map([1,2,3], fn(x)) do + x * 2 + end Which is not what we want since `do` is binding to the farthest function call, in this case: `Enum.map`. We can fix this by using `->`, forcing the key-value block to bind to the `fn`: -{% highlight elixir %} -Enum.map [1,2,3], fn(x) -> - x * 2 -end -{% endhighlight %} + Enum.map [1,2,3], fn(x) -> + x * 2 + end Which is then parsed as: -{% highlight elixir %} -Enum.map([1,2,3], fn(x) -> - x * 2 -end) -{% endhighlight %} + Enum.map([1,2,3], fn(x) -> + x * 2 + end) A good rule of thumb is: always use `->/end` when defining functions with `fn`, use `do/end` for all other structures. If we follow this rule, everything works transparently. @@ -329,36 +267,32 @@ In this section we are going to describe Elixir main control structures. Refreshing from the section above, all these calls are equivalent: -{% highlight elixir %} -if false, do: 1 + 2, else: 10 + 3 + if false, do: 1 + 2, else: 10 + 3 -if false do - 1 + 2 -else: - 10 + 3 -end + if false do + 1 + 2 + else: + 10 + 3 + end -# Although this is valid, its usage is discouraged. -if(false) -> - 1 + 2 -else: - 10 + 3 -end -{% endhighlight %} + # Although this is valid, its usage is discouraged. + if(false) -> + 1 + 2 + else: + 10 + 3 + end `if` also accepts many `elsif:` clauses: -{% highlight elixir %} -if 1 + 1 == 3 do - IO.puts "Impossible" -elsif: 1 + 1 == 2 - IO.puts "This will match" -elsif: true - IO.puts "This won't because the one above matched" -else: - IO.puts "This won't" -end -{% endhighlight %} + if 1 + 1 == 3 do + IO.puts "Impossible" + elsif: 1 + 1 == 2 + IO.puts "This will match" + elsif: true + IO.puts "This won't because the one above matched" + else: + IO.puts "This won't" + end In Elixir, all values except `false` and `nil` evaluates to true. So there is no need to convert them to false. @@ -368,67 +302,59 @@ In the previous chapter, we discussed the boolean operators `and`, `or` and `not To work around this limitation, Elixir provides three operators with similar functionality but that accept any argument: `||`, `&&` and `!`. For those operators, all values except `false` and `nil` will evaluate to true. -{% highlight elixir %} -# Short-circuit or -iex> 1 || true -1 -iex> false || 11 -11 - -# Short-circuit and -iex> nil && 13 -nil -iex> true && 17 -17 - -# Short-circuit ! -iex> !true -false -iex> !1 -false -iex> !nil -true -{% endhighlight %} + # Short-circuit or + iex> 1 || true + 1 + iex> false || 11 + 11 + + # Short-circuit and + iex> nil && 13 + nil + iex> true && 17 + 17 + + # Short-circuit ! + iex> !true + false + iex> !1 + false + iex> !nil + true ### 2.6.3 Case In this section we have introduced pattern matching via the `=` operator. Sometimes however it is convenient to match an expression against several expressions until we find a matching one. For such cases, we use `case`: -{% highlight elixir %} -case { 1, 2, 3 } do -match: { 4, 5, 6 } - IO.puts "This won't match" -match: { 1, x, 3 } - IO.puts "This will match and assign x" -else: - IO.puts "No match" -end -{% endhighlight %} + case { 1, 2, 3 } do + match: { 4, 5, 6 } + IO.puts "This won't match" + match: { 1, x, 3 } + IO.puts "This will match and assign x" + else: + IO.puts "No match" + end As in the `=` operator, any assigned variable will be overridden in the match clause. In case you want to pattern match against a variable, you need to use the `^` operator: -{% highlight elixir %} -x = 1 -case 10 do -match: ^x - IO.puts "Won't match" -else: - IO.puts "Will match" -end -{% endhighlight %} + x = 1 + case 10 do + match: ^x + IO.puts "Won't match" + else: + IO.puts "Will match" + end Each match clause also supports special conditions to be given via guards: -{% highlight elixir %} -case { 1, 2, 3 } do -match: { 4, 5, 6 } - IO.puts "This won't match" -match: { 1, x, 3 } when x > 0 - IO.puts "This will match and assign x" -else: - IO.puts "No match" -end -{% endhighlight %} + case { 1, 2, 3 } do + match: { 4, 5, 6 } + IO.puts "This won't match" + match: { 1, x, 3 } when x > 0 + IO.puts "This will match and assign x" + else: + IO.puts "No match" + end In the example above, the second clause will only match when x is positive. The Erlang VM only allows few expressions as guards, they are: @@ -476,22 +402,18 @@ In the example above, the second clause will only match when x is positive. The Many independent guard clauses can also be given at the same time. For example, consider a function that checks if the first element of a tuple or a list is zero. It could be written as: -{% highlight elixir %} -def first_is_zero?(tuple_or_list) when - elem(tuple_or_list, 1) == 0 or hd(tuple_or_list) == 0 do - true -end -{% endhighlight %} + def first_is_zero?(tuple_or_list) when + elem(tuple_or_list, 1) == 0 or hd(tuple_or_list) == 0 do + true + end However, the example above will always fail because, if the argument is a list, calling `elem` in a list will raise an error. On the other hand, if the element is a tuple, calling `hd` in a tuple will also raise an error. That said, we can rewrite it to become two different clauses: -{% highlight elixir %} -def first_is_zero?(tuple_or_list) when - elem(tuple_or_list, 1) == 0 when - hd(tuple_or_list) == 0 do - true -end -{% endhighlight %} + def first_is_zero?(tuple_or_list) when + elem(tuple_or_list, 1) == 0 when + hd(tuple_or_list) == 0 do + true + end In such cases, if there is an error in one of the guards, it won't affect the next one. @@ -499,60 +421,48 @@ In such cases, if there is an error in one of the guards, it won't affect the ne Throughout this guide, we have created many functions in examples. The syntax for creating functions is: -{% highlight elixir %} -fn(a, b) -> a + b end -{% endhighlight %} + fn(a, b) -> a + b end But it could also be written as (the previous example is preferred though): -{% highlight elixir %} -fn(a, b, do: a + b) + fn(a, b, do: a + b) -fn(a, b) do - a + b -end -{% endhighlight %} + fn(a, b) do + a + b + end As an immutable language, the binding of the function is also immutable. This means that setting a variable inside the function does not affect its outer scope: -{% highlight elixir %} -x = 1 -(fn -> x = 2 end).() -x #=> 1 -{% endhighlight %} + x = 1 + (fn -> x = 2 end).() + x #=> 1 ### 2.6.5 Loops Due to data structure immutability, loops in Elixir (and in functional programming languages) are written differently from conventional imperative languages. For example, in an imperative language, one would write: -{% highlight elixir %} -for(i = 0; i < array.length; i++) { - array[i] = array[i] * 2 -} -{% endhighlight %} + for(i = 0; i < array.length; i++) { + array[i] = array[i] * 2 + } In the example above, we are mutating the array which is not possible in Elixir. Therefore, in functional languages recursion happens by calling an anonymous or a named function recursively, until we reach a condition. Consider the example below that manually sums all the items in the list: -{% highlight iex %} -iex> loop [1,2,3], 0 do -...> match: [h|t], acc -...> recur(t, h + acc) -...> match: [], acc -...> acc -...> end -6 -{% endhighlight %} + iex> loop [1,2,3], 0 do + ...> match: [h|t], acc + ...> recur(t, h + acc) + ...> match: [], acc + ...> acc + ...> end + 6 In the example above, we pass a list `[1,2,3]` and the initial value `0` as arguments to loop. The list `[1,2,3]` is then matched against `[h|t]` which assigns `h = 1` and `t = [2,3]` and 0 is assigned to `acc`. Then, we add the head of the list to the accumulator `h + acc` and call the loop again using the `recur` function, passing the tail of the list as argument. The tail will once again match the `[h|t]` until the list is empty, matching the final clause which returns the final result of `6`. In other words, the loop is called 4 times until the list is empty and the recursion stops: -{% highlight elixir %} -loop [1,2,3], 0 -loop [2,3], 1 -loop [3], 3 -loop [], 6 -{% endhighlight %} + loop [1,2,3], 0 + loop [2,3], 1 + loop [3], 3 + loop [], 6 > Note: `loop/recur` is also a Clojure idiom, although differently from Clojure, `recur` in Elixir does not ensure a tail call was made. @@ -560,89 +470,79 @@ loop [], 6 The next control-flow mechanism is `try/catch/after`: -{% highlight iex %} -iex> try do -...> throw 13 -...> catch: number -...> number -...> end -13 -{% endhighlight %} + iex> try do + ...> throw 13 + ...> catch: number + ...> number + ...> end + 13 `try/catch` is the main mechanism for catching values thrown by Elixir runtime. It also supports an `after` clause that is invoked regardless if the value was caught or not: -{% highlight iex %} -iex> try do -...> throw 13 -...> catch: nan when not is_number(nan) -...> nan -...> after: -...> IO.puts "Didn't catch" -...> end -Didn't catch -** throw 13 - erl_eval:expr/3 -{% endhighlight %} + iex> try do + ...> throw 13 + ...> catch: nan when not is_number(nan) + ...> nan + ...> after: + ...> IO.puts "Didn't catch" + ...> end + Didn't catch + ** throw 13 + erl_eval:expr/3 There is one particularity that applies to `try/catch/after` when compared to other control-flow expressions. The Erlang VM considers such clauses unsafe (since they may fail or not) and do not allow variables defined inside `try/catch/after` to be accessed from the outer scope: -{% highlight iex %} -iex> try do -...> new_var = 1 -...> catch: value -...> value -...> end -1 -iex> new_var -** error :undef -{% endhighlight %} + iex> try do + ...> new_var = 1 + ...> catch: value + ...> value + ...> end + 1 + iex> new_var + ** error :undef The common strategy then is to make explicit all arguments that are required after the `try`: -{% highlight elixir %} -{ x, y } = try do - x = calculate_some_value() - y = some_other_value() - { x, y } -catch: _ - { nil, nil } -end + { x, y } = try do + x = calculate_some_value() + y = some_other_value() + { x, y } + catch: _ + { nil, nil } + end -x #=> returns the value of x or nil for failures -{% endhighlight %} + x #=> returns the value of x or nil for failures ### 2.6.7 Rescue While `catch` clauses inside `try` are simply a pattern matching mechanism, `rescue` provides a higher abstraction around exceptions. `rescue` allows a developer to rescue an exception by its name and not by its internal contents. Consider the following examples: -{% highlight elixir %} -try do - raise "some error" -rescue: RuntimeError - "rescued" -end - -try do - raise "some error" -rescue: [RuntimeError] - "rescued" -end - -# rescue and assign to x -try do - raise "some error" -rescue: x in [RuntimeError] - # all exceptions respond to message - x.message -end - -# rescue all (discouraged) and assign to x -try do - raise ArgumentError, message: "unexpected argument" -rescue: x in _ - x.message -end -{% endhighlight %} + try do + raise "some error" + rescue: RuntimeError + "rescued" + end + + try do + raise "some error" + rescue: [RuntimeError] + "rescued" + end + + # rescue and assign to x + try do + raise "some error" + rescue: x in [RuntimeError] + # all exceptions respond to message + x.message + end + + # rescue all (discouraged) and assign to x + try do + raise ArgumentError, message: "unexpected argument" + rescue: x in _ + x.message + end Custom exceptions can be defined using the `defexception` macro. Check [the exceptions file for some examples](https://github.com/elixir-lang/elixir/tree/master/lib/exception.ex). @@ -652,33 +552,29 @@ The last control-flow mechanism we are going to discuss is essential to Elixir's In order to exchange messages, each process has a mailbox where the received messages are stored. The `receive` mechanism allows us to go through this mailbox searching for a message that matches the given pattern. Here is an example that uses the arrow operator `<-` to send a message to the current process and then collects this message from its mailbox: -{% highlight iex %} -# Get the current process id -iex> current_pid = self() + # Get the current process id + iex> current_pid = self() -# Spawn another process that will send a message to current_pid -iex> spawn fn(do: current_pid <- { :hello, self() }) -<0.36.0> + # Spawn another process that will send a message to current_pid + iex> spawn fn(do: current_pid <- { :hello, self() }) + <0.36.0> -# Collect the message -iex> receive do -...> match: { :hello, pid } -...> IO.puts "Hello from #{inspect(pid)}" -...> end -Hello from <0.36.0> -{% endhighlight %} + # Collect the message + iex> receive do + ...> match: { :hello, pid } + ...> IO.puts "Hello from #{inspect(pid)}" + ...> end + Hello from <0.36.0> You may not see exactly `<0.36.0>` back, but something similar. If there are no messages in the mailbox, the current process will hang until a matching message arrives, unless an after clause is given: -{% highlight iex %} -iex> receive do -...> match: :waiting -...> IO.puts "This may never come" -...> after: 1000 # 1 second -...> IO.puts "Too late" -...> end -Too late -{% endhighlight %} + iex> receive do + ...> match: :waiting + ...> IO.puts "This may never come" + ...> after: 1000 # 1 second + ...> IO.puts "Too late" + ...> end + Too late In most cases, we don't send messages directly with `<-` nor write `receive` control expressions. Instead, we use many of the abstractions provided by OTP which will be discussed later. @@ -688,4 +584,4 @@ Elixir ships with many default functions automatically available in the current Besides the functions provided by Elixir, Elixir imports many of the root function from Erlang. The function `length`, `is_list`, `is_number` and many others we discussed above comes from Erlang. [The full documented list is available on the OTP documentation page](http://www.erlang.org/doc/man/erlang.html). -All those functions and control flow expressions are essential for building Elixir programs. The next chapter will discuss how to organize our code into modules, so it can be easily re-used between different components. +All those functions and control flow expressions are essential for building Elixir programs. The next chapter will discuss how to organize our code into modules, so it can be easily re-used between different components. \ No newline at end of file diff --git a/getting_started/3.markdown b/getting_started/3.markdown index f655430f8..13f38fe03 100644 --- a/getting_started/3.markdown +++ b/getting_started/3.markdown @@ -9,23 +9,19 @@ guide: 3 In Elixir, you can group several functions into a module. In the previous chapter, we have invoked for example functions from the module List: -{% highlight iex %} -iex> List.flatten [1,[2],3] -[1, 2, 3] -{% endhighlight %} + iex> List.flatten [1,[2],3] + [1, 2, 3] In order to create our own modules in Elixir, all we have to do is to call the `defmodule` function and use `def` to define our functions: -{% highlight iex %} -iex> defmodule Math do -...> def sum(a, b) do -...> a + b -...> end -...> end + iex> defmodule Math do + ...> def sum(a, b) do + ...> a + b + ...> end + ...> end -iex> Math.sum(1, 2) -3 -{% endhighlight %} + iex> Math.sum(1, 2) + 3 Before diving into modules, let's first have a brief overview about compilation. @@ -33,13 +29,11 @@ Before diving into modules, let's first have a brief overview about compilation. Most of the times it is convenient to write modules into files so they can be compiled and re-used. Let's assume we have a file named `math.ex` with the following contents: -{% highlight elixir %} -defmodule Math do - def sum(a, b) do - a + b - end -end -{% endhighlight %} + defmodule Math do + def sum(a, b) do + a + b + end + end This file can be compiled using `bin/elixirc` (or simply `elixirc` if you installed Elixir via a distribution): @@ -47,10 +41,8 @@ This file can be compiled using `bin/elixirc` (or simply `elixirc` if you instal Which will then generate a file named `::Math.beam` containing the bytecode for the defined module. Now, if we start `bin/iex` again, our module definition will be available (considering `bin/iex` is being started in the same directory the bytecode file is): -{% highlight iex %} -iex> Math.sum(1, 2) -3 -{% endhighlight %} + iex> Math.sum(1, 2) + 3 Elixir projects are usually organized into three directories: @@ -68,15 +60,13 @@ Where `-pa` stands for `path append`. The same option can also be passed to `eli Besides the Elixir file `.ex`, Elixir also supports `.exs` files for scripting. Elixir treats both files exactly the same way, the only difference is in intention. `.ex` files are meant to be compiled while `.exs` files are used for scripting, without a need for compilation. For instance, one can create a file called `math.exs`: -{% highlight elixir %} -defmodule Math do - def sum(a, b) do - a + b - end -end + defmodule Math do + def sum(a, b) do + a + b + end + end -IO.puts Math.sum(1, 2) -{% endhighlight %} + IO.puts Math.sum(1, 2) And execute it as: @@ -88,40 +78,36 @@ The file will be compiled in memory and executed, printing 3 as result. No bytec Inside a module, we can define functions with `def` and private functions with `defp`. A function defined with `def` is available to be invoked from other modules while a private function can only be invoked locally. -{% highlight elixir %} -defmodule Math do - def sum(a, b) do - do_sum(a, b) - end + defmodule Math do + def sum(a, b) do + do_sum(a, b) + end - defp do_sum(a, b) do - a + b - end -end + defp do_sum(a, b) do + a + b + end + end -Math.sum(1, 2) #=> 3 -Math.do_sum(1, 2) #=> ** (UndefinedFunctionError) -{% endhighlight %} + Math.sum(1, 2) #=> 3 + Math.do_sum(1, 2) #=> ** (UndefinedFunctionError) Function declarations also supports guards and multiple clauses. If a function has several clauses, Elixir will try each clause until find one that matches. For example, here is the implementation for a function that checks if the given number is zero or not: -{% highlight elixir %} -defmodule Math do - def zero?(0) do - true - end + defmodule Math do + def zero?(0) do + true + end - def zero?(x) when is_number(x) do - false - end -end + def zero?(x) when is_number(x) do + false + end + end -Math.zero?(0) #=> true -Math.zero?(1) #=> false + Math.zero?(0) #=> true + Math.zero?(1) #=> false -Math.zero?([1,2,3]) -#=> ** (FunctionClauseError) -{% endhighlight %} + Math.zero?([1,2,3]) + #=> ** (FunctionClauseError) Notice that giving an argument that does not match any of the clauses raises an error. @@ -133,34 +119,28 @@ In order to support software-reuse, Elixir supports two directives. As we are go We use `import` whenever we want to easily access functions or macros from others modules without using the qualified name. For instance, if we want to use the `values` function from `Orddict` several times in a module and we don't want to always type `Orddict.values`, we can simply import it: -{% highlight elixir %} -defmodule Math do - import Orddict, only: [values: 1] + defmodule Math do + import Orddict, only: [values: 1] - def some_function do - # call values(orddict) - end -end -{% endhighlight %} + def some_function do + # call values(orddict) + end + end In this case, we are importing only the function `values` (with arity 1) from `Orddict`. Although `only:` is optional, its usage is recommended. `except` could also be given as an option. If we want to import only `:functions` or `:macros` from a given module, we can also pass a first argument selecting the scope: -{% highlight elixir %} -import :macros, MyMacros -{% endhighlight %} + import :macros, MyMacros And then we can use `only` or `except` to filter the macros being included. Finally, note that `import` is **lexical**, this means we can import specific macros inside specific functions: -{% highlight elixir %} -defmodule Math do - def some_function do - import Orddict, only: [values: 1] - # call values(orddict) - end -end -{% endhighlight %} + defmodule Math do + def some_function do + import Orddict, only: [values: 1] + # call values(orddict) + end + end In the example above, we imported `Orddict.values` only for during that specific function. `values` won't be available in any other functions in that module. @@ -168,27 +148,21 @@ In the example above, we imported `Orddict.values` only for during that specific `require` is responsible to enforce that a module is loaded and to setup references aliases for a given module. For instance, one can do: -{% highlight elixir %} -defmodule Math do - require MyOrddict, as: Orddict -end -{% endhighlight %} + defmodule Math do + require MyOrddict, as: Orddict + end And now, any reference to `Orddict` will be automatically replaced by `MyOrddict`. In case one wants to access the original `Orddict`, it can be done by prefixing the module name with `::`: -{% highlight elixir %} -Orddict.values #=> uses ::MyOrddict.values -::Orddict.values #=> uses ::Orddict.values -{% endhighlight %} + Orddict.values #=> uses ::MyOrddict.values + ::Orddict.values #=> uses ::Orddict.values In general, a module does not need to be required before usage, except if we want to use the macros available in that module. For instance, suppose we created our own `my_if` implementation in a module named `MyMacros`. If we want to invoke it, we need to first explicitly require `MyMacros`: -{% highlight elixir %} -defmodule Math do - require MyMacros - MyMacros.my_if do_something, it_works -end -{% endhighlight %} + defmodule Math do + require MyMacros + MyMacros.my_if do_something, it_works + end An attempt to call a macro that was not loaded will raise an error. Note that, as the import directive, `require` is lexical. @@ -196,20 +170,16 @@ An attempt to call a macro that was not loaded will raise an error. Note that, a Elixir also allows module to store their own data. The canonical example for such data is annotating that a module implements the OTP behavior called `gen_server`: -{% highlight elixir %} -defmodule MyServer do - @behavior :gen_server - # ... callbacks ... -end -{% endhighlight %} + defmodule MyServer do + @behavior :gen_server + # ... callbacks ... + end Now if the module above does not implement any of the callbacks required by `gen_server`, a warning will be raised. Another data used internally by Elixir is is the `@vsn`: -{% highlight elixir %} -defmodule MyServer do - @vsn 2 -end -{% endhighlight %} + defmodule MyServer do + @vsn 2 + end `@vsn` refers to version and is used by the code reloading mechanism to check if a module is updated or not. If no version is specified, the version is set to the MD5 of the module functions. @@ -232,18 +202,14 @@ The following are also reserved by Elixir (as they have special semantics to the Besides the built-in data above, any developer can also add custom data: -{% highlight elixir %} -defmodule MyServer do - @my_data 13 - IO.inspect @my_data #=> 13 -end -{% endhighlight %} + defmodule MyServer do + @my_data 13 + IO.inspect @my_data #=> 13 + end After the module is compiled, the stored custom data can be accessed via `__info__(:data)` and it will return an `Orddict`: -{% highlight elixir %} -MyServer.__info__(:data) #=> [my_data: 13] -{% endhighlight %} + MyServer.__info__(:data) #=> [my_data: 13] > Note: Erlang developers may be wondering why Elixir provides its own data abstraction instead of using Erlang attributes. Erlang attributes are basically a list which also allow duplicated entries. For Elixir, since the same data may be read and updated several times during compilation, it makes more sense to have a dictionary structure instead of a list. Erlang developers wishing to have the attributes functionality have two options: > @@ -255,12 +221,10 @@ MyServer.__info__(:data) #=> [my_data: 13] In Elixir, nesting a module inside the other does not affect its name: -{% highlight elixir %} -defmodule Foo do - defmodule Bar do - end -end -{% endhighlight %} + defmodule Foo do + defmodule Bar do + end + end The example above will define two modules `Foo` and `Bar`. Notice that the second module is **not** called `Foo::Bar`. In general, nesting modules is discouraged in Elixir. @@ -268,50 +232,38 @@ The example above will define two modules `Foo` and `Bar`. Notice that the secon In Erlang (and consequently in the Erlang VM), modules and functions are represented by atoms. For instance, this is valid Erlang code: -{% highlight elixir %} -Mod = lists, -Mod:flatten([1,[2],3]). -{% endhighlight %} + Mod = lists, + Mod:flatten([1,[2],3]). In the example above, we store the atom `lists` in the variable `Mod` and then invoked the function flatten in it. In Elixir, exactly the same idiom is allowed. In fact, we could call the same function `flatten` in `lists` as: -{% highlight iex %} -iex> :lists.flatten([1,[2],3]) -[1,2,3] -{% endhighlight %} + iex> :lists.flatten([1,[2],3]) + [1,2,3] This mechanism is exactly what empowers Elixir references. Elixir references are uppercase identifiers (like `List`, `Orddict`, etc) that are converted to an atom representing a module at compilation time. For instance, by default `List` translates to the atom `::List`: -{% highlight iex %} -iex> List -::List -iex> is_atom(List) -true -{% endhighlight %} + iex> List + ::List + iex> is_atom(List) + true References are powerful when used with the `require` directive discussed above. For instance, let's imagine our Math module relies heavily on the `Orddict` module. If, at some point, we find out most algorithms in `Orddict` could be implemented in a much faster way, we could implement `FastOrddict` and use it as a drop-in replacement: -{% highlight elixir %} -defmodule Math do - require FastOrddict, as: Orddict - # ... -end -{% endhighlight %} + defmodule Math do + require FastOrddict, as: Orddict + # ... + end Now any reference to `Orddict` will be automatically replaced by `FastOrddict`. In case one wants to access the original `Orddict`, it can be done by prefixing the module name with `::`: -{% highlight elixir %} -Orddict.values #=> uses ::FastOrddict.values -::Orddict.values #=> uses ::Orddict.values -{% endhighlight %} + Orddict.values #=> uses ::FastOrddict.values + ::Orddict.values #=> uses ::Orddict.values Finally, in Elixir `::` is simply an operator (like `+`). It is used to concatenate two references: -{% highlight iex %} -iex> Foo::Bar -::Foo::Bar -iex> Foo :: Bar -::Foo::Bar -{% endhighlight %} + iex> Foo::Bar + ::Foo::Bar + iex> Foo :: Bar + ::Foo::Bar -> Note: a reference does not actually ensure the reference really exists. For instance, `::FooBarBaz` will return an atom regardless if a `::FooBarBaz` module is defined or not. +> Note: a reference does not actually ensure the reference really exists. For instance, `::FooBarBaz` will return an atom regardless if a `::FooBarBaz` module is defined or not. \ No newline at end of file diff --git a/getting_started/4.markdown b/getting_started/4.markdown index c4c12c525..717a5014c 100644 --- a/getting_started/4.markdown +++ b/getting_started/4.markdown @@ -13,59 +13,45 @@ Elixir provides both protocols and records. This section will outline the main f Records are simple structures that holds values. For example, we can define a `FileInfo` record that is supposed to store information about files as follow: -{% highlight elixir %} -defrecord FileInfo, atime: nil, mtime: nil, accesses: 0 -{% endhighlight %} + defrecord FileInfo, atime: nil, mtime: nil, accesses: 0 The line above will define a module named `FileInfo` which contain a function named `new` that returns a new record and other functions to read and set the values in the record. Therefore, we can do: -{% highlight elixir %} -file_info = FileInfo.new(atime: now()) -file_info.atime #=> Returns the value of atime -file_info.atime(now()) #=> Updates the value of atime -{% endhighlight %} + file_info = FileInfo.new(atime: now()) + file_info.atime #=> Returns the value of atime + file_info.atime(now()) #=> Updates the value of atime Elixir will also define a `update_#{field}` function that accepts a function as argument that will receive the old value and update the current value with the result of the function: -{% highlight elixir %} -file_info = FileInfo.new(accesses: 10) -file_info = file_info.update_accesses(fn(x) -> x + 1 end) -file_info.accesses #=> 11 -{% endhighlight %} + file_info = FileInfo.new(accesses: 10) + file_info = file_info.update_accesses(fn(x) -> x + 1 end) + file_info.accesses #=> 11 Internally, a record is simply a tuple where the first element is always the record module name. This can be noticed if we create and print the record in Interactive Elixir (`bin/iex`): -{% highlight iex %} -iex> defrecord FileInfo, atime: nil, mtime: nil -iex> FileInfo.new -{::FileInfo, nil, nil} -{% endhighlight %} + iex> defrecord FileInfo, atime: nil, mtime: nil + iex> FileInfo.new + {::FileInfo, nil, nil} ### 4.1.1 Default based functions Depending on the default value, Elixir will define helpers to interact with the record. For example, the test framework that ships with Elixir, called ExUnit, defines a record which keeps track of how many tests were executed and the failures that happened. The record definition is similar to: -{% highlight iex %} -iex> defrecord Config, counter: 0, failures: [] -{% endhighlight %} + iex> defrecord Config, counter: 0, failures: [] Since `counter` is an integer, Elixir automatically defines a helper named `increment_counter` that will increase the counter value: -{% highlight iex %} -iex> new_config = Config.new.increment_counter -{::Config, 1, []} -iex> new_config.counter -1 -{% endhighlight %} + iex> new_config = Config.new.increment_counter + {::Config, 1, []} + iex> new_config.counter + 1 `increment_counter` also accepts a number to increment as argument: -{% highlight iex %} -iex> new_config = Config.new.increment_counter 10 -{::Config, 10, []} -iex> new_config.counter -10 -{% endhighlight %} + iex> new_config = Config.new.increment_counter 10 + {::Config, 10, []} + iex> new_config.counter + 10 On the other hand, if the default value is a list Elixir will define the two following helpers: @@ -80,31 +66,27 @@ In Elixir, only `false` and `nil` are considered falsy values. Everything else e We could implement this protocol as follow: -{% highlight elixir %} -defprotocol Blank, [ blank?(data) ] -{% endhighlight %} + defprotocol Blank, [ blank?(data) ] The protocol expects a function called `blank?` expecting one argument to be implemented. We can implement this protocol for some Elixir data types as follow: -{% highlight elixir %} -# Numbers are never blank -defimpl Blank, for: Number do - def blank?(number), do: false -end - -# Just empty list is blank -defimpl Blank, for: List do - def blank?([]), do: true - def blank?(_), do: false -end - -# Just the atoms false and nil are blank -defimpl Blank, for: Atom do - def blank?(false), do: true - def blank?(nil), do: true - def blank?(_), do: false -end -{% endhighlight %} + # Numbers are never blank + defimpl Blank, for: Number do + def blank?(number), do: false + end + + # Just empty list is blank + defimpl Blank, for: List do + def blank?([]), do: true + def blank?(_), do: false + end + + # Just the atoms false and nil are blank + defimpl Blank, for: Atom do + def blank?(false), do: true + def blank?(nil), do: true + def blank?(_), do: false + end And we would do so for all native data types. The types available are: @@ -124,17 +106,13 @@ And we would do so for all native data types. The types available are: Implementing the protocol for all 9 types above can be cumbersome. Even more if you consider that Number, Function, PID, Port and Reference are never going to be blank. For this reason, Elixir allows us to declare that we are going to implement the protocol just for some types, as follows: -{% highlight elixir %} -defprotocol Blank, [blank?(data)], only: [Atom, Tuple, List, BitString, Any] -{% endhighlight %} + defprotocol Blank, [blank?(data)], only: [Atom, Tuple, List, BitString, Any] Since we also specified `Any` as a data type, if the data type is not any of Atom, Tuple, List or BitString, it will automatically fallback to Any: -{% highlight elixir %} -defimpl Blank, for: Any do - def blank?(_), do: false -end -{% endhighlight %} + defimpl Blank, for: Any do + def blank?(_), do: false + end Now all data types that we have not specified will be automatically considered non blank. @@ -142,11 +120,9 @@ Now all data types that we have not specified will be automatically considered n The real benefit of protocols comes when mixed with records. For instance, one may implement a custom dictionary as a Red-Black tree and this dictionary should also be considered blank in case it has no items. That said, the developer just needs to implement the protocol for this dictionary: -{% highlight elixir %} -defimpl Blank, for: RedBlack::Dict do - def blank?(dict), do: RedBlack.empty?(dict) -end -{% endhighlight %} + defimpl Blank, for: RedBlack::Dict do + def blank?(dict), do: RedBlack.empty?(dict) + end In the example above, we have implemented `blank?` for the custom dictionary that simply delegates to `RedBlack.empty?`. Finally, since records are simply tuples, the default implementation for records can be given in the tuple implementation. @@ -159,4 +135,4 @@ Elixir ships with three built-in protocols, they are: * List::Chars - specifies how to convert a data structures with characters to lists * String::Inspect - specifies how to convert any data structure to a string for inspection -You can check the source code of those files for more information about how the protocol is used and how to implement your own. With this, we have finally finished this section which has described `defrecord`, `defprotocol` and `defimpl`. Next, we are going to discuss macros with `defmacro`! +You can check the source code of those files for more information about how the protocol is used and how to implement your own. With this, we have finally finished this section which has described `defrecord`, `defprotocol` and `defimpl`. Next, we are going to discuss macros with `defmacro`! \ No newline at end of file diff --git a/getting_started/5.markdown b/getting_started/5.markdown index 737180d9e..f2446ecca 100644 --- a/getting_started/5.markdown +++ b/getting_started/5.markdown @@ -13,15 +13,11 @@ Elixir is an homoiconic language. Any Elixir program can be represented using it The building block of Elixir homoiconicity is a tuple with three elements, for example: -{% highlight elixir %} -{ :sum, 1, [1, 2, 3] } -{% endhighlight %} + { :sum, 1, [1, 2, 3] } The tuple above represents a function call to sum passing 1, 2 and 3 as arguments. The tuple elements are: -{% highlight elixir %} -{ Tuple | Atom, Integer, List | Atom } -{% endhighlight %} + { Tuple | Atom, Integer, List | Atom } * The first element of the tuple is always an atom or another tuple in the same representation; * The second element of the tuple is always an integer representing the line number; @@ -29,34 +25,26 @@ The tuple above represents a function call to sum passing 1, 2 and 3 as argument You can get the representation of any expression by using the quote macro: -{% highlight iex %} -iex> quote do: sum(1, 2, 3) -{ :sum, 0, [1, 2, 3] } -{% endhighlight %} + iex> quote do: sum(1, 2, 3) + { :sum, 0, [1, 2, 3] } Everything in Elixir is a function call and can be represented by such tuples. For example, operators are represented as such: -{% highlight iex %} -iex> quote do: 1 + 2 -{ :"+", 0, [1, 2] } -{% endhighlight %} + iex> quote do: 1 + 2 + { :"+", 0, [1, 2] } Even a tuple is represented as a call to `{}`: -{% highlight iex %} -iex> quote do: { 1, 2, 3 } -{ :"{}", 0, [1, 2, 3] } -{% endhighlight %} + iex> quote do: { 1, 2, 3 } + { :"{}", 0, [1, 2, 3] } The only exception to this rule are the five Elixir literals below. Literals are data types that when quoted return themselves. They are: -{% highlight elixir %} -:sum #=> Atoms -1.0 #=> Numbers -[1,2] #=> Lists -"binaries" #=> Binaries -{key, value} #=> Key-value pairs (i.e. a tuple with two elements) -{% endhighlight %} + :sum #=> Atoms + 1.0 #=> Numbers + [1,2] #=> Lists + "binaries" #=> Binaries + {key, value} #=> Key-value pairs (i.e. a tuple with two elements) With those basic structures in mind, we are ready to define our own macro. @@ -64,62 +52,46 @@ With those basic structures in mind, we are ready to define our own macro. A macro can be define using `defmacro`. For instance, we can define a macro called `unless` which works the same as Ruby's unless in just few lines of code: -{% highlight elixir %} -defmodule MyMacro do - defmacro unless(clause, options) do - quote do: if(!unquote(clause), unquote(options)) - end -end -{% endhighlight %} + defmodule MyMacro do + defmacro unless(clause, options) do + quote do: if(!unquote(clause), unquote(options)) + end + end Similarly to `if`, `unless` expects two arguments: a `clause` and `options`: -{% highlight elixir %} -require MyMacro -MyMacro.unless var, do: IO.puts "false" -{% endhighlight %} + require MyMacro + MyMacro.unless var, do: IO.puts "false" However, since `unless` is a macro, it won't receive values when invoked, but instead, its expressions. For example, if one calls: -{% highlight elixir %} -unless 2 + 2 == 5, do: call_function() -{% endhighlight %} + unless 2 + 2 == 5, do: call_function() Our `unless` macro will receive the following: -{% highlight elixir %} -unless({:==, 1, [{:+, 1, [2, 2]}, 5]}, { :call_function, 1, [] }) -{% endhighlight %} + unless({:==, 1, [{:+, 1, [2, 2]}, 5]}, { :call_function, 1, [] }) Then our `unless` macro will call `quote`, to return a tree representation of the `if` clause. This means we are transforming our `unless` in a `if`! There is a common mistake when quoting expressions which is that developers usually forget to `unquote` the proper expression. In order to understand what `unquote` does, let's simply remove it: -{% highlight elixir %} -defmacro unless(clause, options) do - quote do: if(!clause, options) -end -{% endhighlight %} + defmacro unless(clause, options) do + quote do: if(!clause, options) + end When called as `unless 2 + 2 == 5, do: call_function()`, our `unless` would then literally return: -{% highlight elixir %} -if(!clause, options) -{% endhighlight %} + if(!clause, options) Which would fail because the clause and options variables are not defined in the current scope. If we add `unquote` back: -{% highlight elixir %} -defmacro unless(clause, options) do - quote do: if(!unquote(clause), unquote(options)) -end -{% endhighlight %} + defmacro unless(clause, options) do + quote do: if(!unquote(clause), unquote(options)) + end Which will then return: -{% highlight elixir %} -if(!(2 + 2 == 5), do: call_function()) -{% endhighlight %} + if(!(2 + 2 == 5), do: call_function()) In other words, unquote is a mechanism to inject expressions into the tree being quoted and is essential to the meta-programming mechanism. Elixir also provides `unquote_splicing` allowing us to inject many expressions at once. @@ -129,67 +101,57 @@ We can define any macro we want, including override the built-in macros provided Elixir macros follow Scheme conventions and are hygienic. This means a variable defined inside a macro won't conflict with a variable defined in the context the macro is inserted. For example: -{% highlight elixir %} -defmodule Hygiene do - defmacro no_interference do - quote do: a = 1 - end -end + defmodule Hygiene do + defmacro no_interference do + quote do: a = 1 + end + end -require Hygiene + require Hygiene -a = 13 -Hygiene.no_interference -a # => 13 -{% endhighlight %} + a = 13 + Hygiene.no_interference + a # => 13 In the example above, even if the macro injects `a = 1`, it does not affect the variable `a`. In case the macro wants to explicitly affect the context, it can use `var!`: -{% highlight elixir %} -defmodule Hygiene do - defmacro interference do - quote do: var!(a) = 1 - end -end + defmodule Hygiene do + defmacro interference do + quote do: var!(a) = 1 + end + end -require Hygiene + require Hygiene -a = 13 -Hygiene.interference -a # => 1 -{% endhighlight %} + a = 13 + Hygiene.interference + a # => 1 Macros hygiene only works because Elixir marks a variable as coming from the quote. For example, consider this: -{% highlight iex %} -iex> quote do: x -{ :x, 0, :quoted } -{% endhighlight %} + iex> quote do: x + { :x, 0, :quoted } Notice that the third element is `:quoted`. It means that x may be a function call with 0 arguments or a variable coming from a quote. On the other hand, an unquoted variable would have the third element equals to nil. Let's consider this final example: -{% highlight elixir %} -defmodule Hygiene do - defmacro quoted(x) do - quote do - { unquote(x), x, x() } + defmodule Hygiene do + defmacro quoted(x) do + quote do + { unquote(x), x, x() } + end + end end - end -end -{% endhighlight %} In the example above, we have defined a macro called `quoted` that returns an unquoted variable, a quoted variable and a function call. Calling this macro will return: -{% highlight elixir %} -require Hygiene + require Hygiene -Hygiene.quoted(x) -#=> { - { :x, 1, nil }, - { :x, 1, :quoted }, - { :x, 1, [] } -} -{% endhighlight %} + Hygiene.quoted(x) + #=> { + { :x, 1, nil }, + { :x, 1, :quoted }, + { :x, 1, [] } + } Summing up: if the third element is a list, it is certainly a function call. If not, it may be a variable (coming from a quote or not) or a function call. @@ -197,30 +159,26 @@ Summing up: if the third element is a list, it is certainly a function call. If In order to support recursion, macros cannot be called locally. For example, one cannot write: -{% highlight elixir %} -defmodule MyMacros - defmacro delegate([h|t], to: target) do - # ... - end + defmodule MyMacros + defmacro delegate([h|t], to: target) do + # ... + end - # Call the macro delegate just defined above - delegate [values: 1], to: List -end -{% endhighlight %} + # Call the macro delegate just defined above + delegate [values: 1], to: List + end In order to access the macro, it needs to be defined in an outer module: -{% highlight elixir %} -defmodule MyMacros::Support - defmacro delegate([h|t], to: target) do - # ... - end -end + defmodule MyMacros::Support + defmacro delegate([h|t], to: target) do + # ... + end + end -defmodule MyMacros - require MyMacros::Support, import: true - delegate [values: 1], to: List -end -{% endhighlight %} + defmodule MyMacros + require MyMacros::Support, import: true + delegate [values: 1], to: List + end -With this note, we finish our introduction to macros. Next, let's move to the next chapter which will discuss several topics as native code compilation, partial application and others. +With this note, we finish our introduction to macros. Next, let's move to the next chapter which will discuss several topics as native code compilation, partial application and others. \ No newline at end of file diff --git a/getting_started/6.markdown b/getting_started/6.markdown index 8e7d2f3e0..f9778b201 100644 --- a/getting_started/6.markdown +++ b/getting_started/6.markdown @@ -11,27 +11,21 @@ guide: 6 Elixir uses the module data described in chapter 3 to drive its documentation system. For instance, consider the following example: -{% highlight elixir %} -defmodule MyModule do - @moduledoc "It does X" + defmodule MyModule do + @moduledoc "It does X" - @doc "Returns the version" - def version, do: 1 -end -{% endhighlight %} + @doc "Returns the version" + def version, do: 1 + end In the example above, we are adding a module documentation to MyModule via `@moduledoc` and using `@doc` to document each function. When compiled with the `--docs` option, we will be able to inspect the documentation attributes in runtime (remember to start iex in the same directory you compiled the module): -{% highlight console %} -$ elixirc my_module.ex --docs -$ iex -{% endhighlight %} -{% highlight iex %} -iex> MyModule.__info__(:docs) -[{ { :version, 0 }, 5, :def, "Returns the version" }] -iex> MyModule.__info__(:moduledoc) -{1,"It does X"} -{% endhighlight %} + $ elixirc my_module.ex --docs + $ iex + iex> MyModule.__info__(:docs) + [{ { :version, 0 }, 5, :def, "Returns the version" }] + iex> MyModule.__info__(:moduledoc) + {1,"It does X"} `__info__(:docs)` returns a list of tuples where each tuple contains the function/arity pair, the line the function was defined, the kind of the function (`def` or `defmacro`, docs applied to `defp` are always ignored) and the comments. The comment should be either a binary or a boolean. @@ -39,25 +33,23 @@ Similarly, `__info__(:moduledoc)` returns a tuple with the line the module was d In case `--docs` is not provided during compilation, both calls would return nil. Elixir promotes the use of markdown in documentation, since it is a widely available format. Consider for example the documentation for `Module.add_doc` which allows us to dynamically add a documentation to a function: -{% highlight elixir %} -@doc """ -Attaches documentation to a given function. It expects -the module the function belongs to, the line (a non negative -integer), the kind (`:def` or `:defmacro`), a tuple representing -the function and its arity and the documentation, which should -be either a binary or a boolean. + @doc """ + Attaches documentation to a given function. It expects + the module the function belongs to, the line (a non negative + integer), the kind (`:def` or `:defmacro`), a tuple representing + the function and its arity and the documentation, which should + be either a binary or a boolean. -## Examples + ## Examples - defmodule MyModule do - Module.add_doc(__MODULE__, __LINE__ + 1, - :def, { :version, 0}, "Manually added docs") - def version, do: 1 - end + defmodule MyModule do + Module.add_doc(__MODULE__, __LINE__ + 1, + :def, { :version, 0}, "Manually added docs") + def version, do: 1 + end -""" -def add_doc(module, line, kind, tuple, doc) -{% endhighlight %} + """ + def add_doc(module, line, kind, tuple, doc) In the example, we use heredocs to allow the documentation to spawn several lines and markdown to style the documentation. @@ -65,28 +57,22 @@ In the example, we use heredocs to allow the documentation to spawn several line Elixir also supports partial application. Let's suppose we have a list of strings and we want to calculate the size for each them. We could do it as follow: -{% highlight iex %} -iex> list = ["foo", "bar", "baz"] -["foo","bar","baz"] -iex> Enum.map list, fn(x) -> size(x) end -[3,3,3] -{% endhighlight %} + iex> list = ["foo", "bar", "baz"] + ["foo","bar","baz"] + iex> Enum.map list, fn(x) -> size(x) end + [3,3,3] However, with partial application, we could also do: -{% highlight iex %} -iex> Enum.map list, size(&1) -[3,3,3] -{% endhighlight %} + iex> Enum.map list, size(&1) + [3,3,3] In the example above, we have invoked the function `size` passing `&1` as argument asking Elixir to generate a function that expects one argument and that argument will be passed to `size`. Since operators are also function calls they can also be partially applied: -{% highlight iex %} -iex> Enum.map [1,2,3], &1 * 2 -[2,4,6] -{% endhighlight %} + iex> Enum.map [1,2,3], &1 * 2 + [2,4,6] All functions can be partially applied, except [Elixir's special forms](https://github.com/elixir-lang/elixir/tree/master/lib/elixir/special_forms.ex). @@ -94,28 +80,24 @@ All functions can be partially applied, except [Elixir's special forms](https:// `use` is a macro intended to a common API for extension. For instance, in order to use the `ExUnit` test framework that ships with Elixir, you simply need to use `ExUnit::Case` in your module: -{% highlight elixir %} -defmodule AssertionTest do - use ExUnit::Case + defmodule AssertionTest do + use ExUnit::Case - def test_always_pass do - true = true - end -end -{% endhighlight %} + def test_always_pass do + true = true + end + end By calling `use`, a hook called `__using__` will be invoked in `ExUnit::Case` which will then do the proper setup. In general, `use` is simply a translation to: -{% highlight elixir %} -defmodule AssertionTest do - require ExUnit::Case - ExUnit::Case.__using__(::AssertionTest) + defmodule AssertionTest do + require ExUnit::Case + ExUnit::Case.__using__(::AssertionTest) - def test_always_pass do - true = true - end -end -{% endhighlight %} + def test_always_pass do + true = true + end + end In general, we recommend APIs to expose a `__using__` hook in case they want to expose functionality to developers. @@ -123,75 +105,61 @@ In general, we recommend APIs to expose a `__using__` hook in case they want to Elixir also provides list and bit comprehensions. List comprehensions allow you to quickly build a list from another list: -{% highlight iex %} -iex> lc n in [1,2,3,4], do: n * 2 -[2,4,6,8] -{% endhighlight %} + iex> lc n in [1,2,3,4], do: n * 2 + [2,4,6,8] Or, using key-value blocks: -{% highlight elixir %} -lc n in [1,2,3,4] do - n * 2 -end -{% endhighlight %} + lc n in [1,2,3,4] do + n * 2 + end A comprehension accepts several expressions. Those expressions can be generators, as in `x in [1,2,3,4]`, or filters: -{% highlight iex %} -# A comprehension with a generator and a filter -iex> lc n in [1,2,3,4,5,6], rem(n, 2) == 0, do: n -[2,4,6] + # A comprehension with a generator and a filter + iex> lc n in [1,2,3,4,5,6], rem(n, 2) == 0, do: n + [2,4,6] -# A comprehension with two generators -iex> lc x in [1,2], y in [2,3], do: x*y -[2,3,4,6] -{% endhighlight %} + # A comprehension with two generators + iex> lc x in [1,2], y in [2,3], do: x*y + [2,3,4,6] Elixir provides generators for both lists and bitstrings: -{% highlight iex %} -# A list generator: -iex> lc n in [1,2,3,4], do: n * 2 -[2,4,6,8] + # A list generator: + iex> lc n in [1,2,3,4], do: n * 2 + [2,4,6,8] -# A bit string generator: -iex> lc <> in <<1,2,3,4>>, do: n * 2 -[2,4,6,8] -{% endhighlight %} + # A bit string generator: + iex> lc <> in <<1,2,3,4>>, do: n * 2 + [2,4,6,8] Bit string generators are quite useful when you need to organize bit string streams: -{% highlight iex %} -iex> pixels = <<213,45,132,64,76,32,76,0,0,234,32,15>> -iex> lc <> in pixels, do: {r,g,b} -[{213,45,132},{64,76,32},{76,0,0},{234,32,15}] -{% endhighlight %} + iex> pixels = <<213,45,132,64,76,32,76,0,0,234,32,15>> + iex> lc <> in pixels, do: {r,g,b} + [{213,45,132},{64,76,32},{76,0,0},{234,32,15}] Remember, as strings are binaries and a binary is a bitstring, we can also use strings on comprehensions. For instance, the example below removes all white space characters from a string via bit comprehensions: -{% highlight iex %} -iex> bc <> in " hello world ", c != ?\s, do: <> -"helloworld" -{% endhighlight %} + iex> bc <> in " hello world ", c != ?\s, do: <> + "helloworld" Elixir does its best to hide the differences between list and bit string generators. However, there is a special case due to Erlang limitation that we need to explicitly tell Erlang that a list is being given as argument: -{% highlight iex %} -# This will fail because when Elixir sees that the left side -# of the in expression is a bit string, it expects the right side -# to be a bit string as well: -iex> lc <> in [<<1>>,<<2>>,<<3>>], do: n*2 -** (ErlangError) erlang error {:bad_generator,[<<1>>,<<2>>,<<3>>]} - -# You need to be explicit and use inlist: -iex> lc inlist(<>, [<<1>>,<<2>>,<<3>>]), do: n*2 -[2,4,6] - -# For consistency, inbin is also available: -iex> lc inbin(<>, <<1,2,3>>), do: n*2 -[2,4,6] -{% endhighlight %} + # This will fail because when Elixir sees that the left side + # of the in expression is a bit string, it expects the right side + # to be a bit string as well: + iex> lc <> in [<<1>>,<<2>>,<<3>>], do: n*2 + ** (ErlangError) erlang error {:bad_generator,[<<1>>,<<2>>,<<3>>]} + + # You need to be explicit and use inlist: + iex> lc inlist(<>, [<<1>>,<<2>>,<<3>>]), do: n*2 + [2,4,6] + + # For consistency, inbin is also available: + iex> lc inbin(<>, <<1,2,3>>), do: n*2 + [2,4,6] ## 6.5 Native compilation From d0f29326798acfe051184e83b0ffd8409efa19c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Wed, 7 Mar 2012 09:55:08 +0100 Subject: [PATCH 019/437] Add pseudo variables. --- getting_started/6.markdown | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/getting_started/6.markdown b/getting_started/6.markdown index f9778b201..92d9992b3 100644 --- a/getting_started/6.markdown +++ b/getting_started/6.markdown @@ -161,7 +161,17 @@ Elixir does its best to hide the differences between list and bit string generat iex> lc inbin(<>, <<1,2,3>>), do: n*2 [2,4,6] -## 6.5 Native compilation +## 6.5 Pseudo variables + +Elixir provides with some pseudo-variables. Those variables can only be read and never assigned to. They are: + +* `__MODULE__` - Returns an atom representing the current module or nil; +* `__FUNCTION__` - Returns a tuple representing the current function by name and arity or nil; +* `__LINE__` - Returns an integer representing the current line; +* `__FILE__` - Returns a string representing the current file; +* `__LOCAL__` - Works as a proxy to force a function call to resolve locally (and not be expanded as a macro); + +## 6.6 Native compilation Elixir can compile to native code using the Hipe compiler. All you need to do is to export the following before running your code: From 883f8792cf9e12ca349b30f2d73b2f0bd6c3a793 Mon Sep 17 00:00:00 2001 From: Carlos Galdino Date: Wed, 7 Mar 2012 11:35:09 -0300 Subject: [PATCH 020/437] Add link to vim-elixir --- index.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 85ad9b116..57cbe493c 100644 --- a/index.html +++ b/index.html @@ -35,8 +35,9 @@

    Other Links

  • Mailing list
  • Issues Tracker
  • Textmate Bundle
  • +
  • Vim Elixir
-{% include bottom.html %} \ No newline at end of file +{% include bottom.html %} From f298ce3ea2d8d2041a940dbd7ac59c17da334793 Mon Sep 17 00:00:00 2001 From: Alexei Sholik Date: Thu, 22 Mar 2012 18:20:47 +0200 Subject: [PATCH 021/437] Fix a number of issues in the guide --- getting_started/2.markdown | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/getting_started/2.markdown b/getting_started/2.markdown index be2c1e3cd..475a2de30 100644 --- a/getting_started/2.markdown +++ b/getting_started/2.markdown @@ -148,19 +148,19 @@ In case you want to pattern match against the value of a variable, you can use t iex> x = 2 2 -In Elixir, it is a common practice to assign a variable to underscore `_` if we don't intend to use it. For example, if only the head of the list matters to us, we can assign the tail to underscore: +In Elixir, it is a common practice to assign a value to underscore `_` if we don't intend to use it. For example, if only the head of the list matters to us, we can assign the tail to underscore: iex> [h | _] = [1,2,3] [1, 2, 3] iex> h 1 -The variable `_` in Elixir is special in the sense it can never be assigned. Trying to read from it gives an unbound variable error: +The variable `_` in Elixir is special in the sense it can never be read from. Trying to read from it gives an unbound variable error: iex> _ ** (ErlangError) erlang error {:unbound_var, :_} -Although pattern matching allow powerful constructs, its usage is limited. For instance, you cannot make function calls on the left side of the match. The following example is invalid: +Although pattern matching allows us to build powerful constructs, its usage is limited. For instance, you cannot make function calls on the left side of the match. The following example is invalid: iex> Erlang.lists.flatten([1,[2],3]) = [1,2,3] ** (ErlangError) erlang error :illegal_pattern @@ -231,7 +231,7 @@ Key-value blocks are similar to Ruby blocks. Parenthesis can be added as follows 10 + 3 end -Key-value blocks are an important feature that allow developers to create their own control structures as if they were part of the language itself. For instance, none of the control structures we are going to see in the next section are keywords. They are all implemented using key-values blocks. +Key-value blocks are an important feature that allow developers to create their own control structures as if they were part of the language itself. For instance, none of the control structures we are going to see in the next section are keywords. They are all implemented using key-value blocks. Elixir supports two syntaxes for key-value blocks: `do`/`end` and `->`/`end`. The first one always binds to the farthest function call, while the latter to the closest. For example, the following expression: @@ -294,13 +294,13 @@ Refreshing from the section above, all these calls are equivalent: IO.puts "This won't" end -In Elixir, all values except `false` and `nil` evaluates to true. So there is no need to convert them to false. +In Elixir, all values except `false` and `nil` evaluate to true. So there is no need to convert them to boolean. ### 2.6.2 Other boolean operators In the previous chapter, we discussed the boolean operators `and`, `or` and `not`. Those operators are strict in the sense they only accept booleans as arguments. -To work around this limitation, Elixir provides three operators with similar functionality but that accept any argument: `||`, `&&` and `!`. For those operators, all values except `false` and `nil` will evaluate to true. +To work around this limitation, Elixir provides three operators with similar functionality but that accept arguments of any type: `||`, `&&` and `!`. For those operators, all values except `false` and `nil` will evaluate to true. # Short-circuit or iex> 1 || true @@ -548,7 +548,7 @@ Custom exceptions can be defined using the `defexception` macro. Check [the exce ### 2.6.8 Receive -The last control-flow mechanism we are going to discuss is essential to Elixir's and Erlang's actor mechanism. In Elixir, every code run in processes that exchange messages between them. Those processes are not Operating System processes (they are actually quite light-weight) but called so since they do not share state with each other. +The last control-flow mechanism we are going to discuss is essential to Elixir's and Erlang's actor mechanism. In Elixir, the code is run in separate processes that exchange messages between them. Those processes are not Operating System processes (they are actually quite light-weight) but are called so since they do not share state with each other. In order to exchange messages, each process has a mailbox where the received messages are stored. The `receive` mechanism allows us to go through this mailbox searching for a message that matches the given pattern. Here is an example that uses the arrow operator `<-` to send a message to the current process and then collects this message from its mailbox: @@ -582,6 +582,6 @@ In most cases, we don't send messages directly with `<-` nor write `receive` con Elixir ships with many default functions automatically available in the current scope. Besides all the control flow expressions seen above, Elixir also adds: `elem` and `setelem` to read and set values in tuples, `inspect` that returns the representation of a given data type as string and many others. [Many of these functions with documentation and examples are available in `Elixir::Builtin`](https://github.com/elixir-lang/elixir/tree/master/lib/elixir/builtin.ex) and [Elixir special forms are available in `Elixir::SpecialForms`](https://github.com/elixir-lang/elixir/tree/master/lib/elixir/special_forms.ex). -Besides the functions provided by Elixir, Elixir imports many of the root function from Erlang. The function `length`, `is_list`, `is_number` and many others we discussed above comes from Erlang. [The full documented list is available on the OTP documentation page](http://www.erlang.org/doc/man/erlang.html). +Besides the functions provided by Elixir, Elixir imports many of the root function from Erlang. The functions `length`, `is_list`, `is_number` and many others we discussed above come from Erlang. [The full documented list is available on the OTP documentation page](http://www.erlang.org/doc/man/erlang.html). -All those functions and control flow expressions are essential for building Elixir programs. The next chapter will discuss how to organize our code into modules, so it can be easily re-used between different components. \ No newline at end of file +All those functions and control flow expressions are essential for building Elixir programs. The next chapter will discuss how to organize our code into modules, so it can be easily re-used between different components. From 13c0bb110758db41f5dae96979ae75c9b9c3f5b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Thu, 22 Mar 2012 17:55:06 +0100 Subject: [PATCH 022/437] Update getting_started/1.markdown --- getting_started/1.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/getting_started/1.markdown b/getting_started/1.markdown index 8175f1075..b0c7bb561 100644 --- a/getting_started/1.markdown +++ b/getting_started/1.markdown @@ -157,7 +157,7 @@ Notice that `++` and `--` cannot be used to manipulate double quoted strings, as iex> "foo" <> "bar" "foobar" -Elixir also provides three boolean operators: `or`, `and` and `not`. Those operators are strict in the sense those operators expects only booleans (true or false) as arguments: +Elixir also provides three boolean operators: `or`, `and` and `not`. Those operators are strict in the sense they expect a boolean (true or false) as first argument: iex> true and true true From ba6aca6a3977bf9d1cd71f18a557df635126de4f Mon Sep 17 00:00:00 2001 From: Alexei Sholik Date: Thu, 22 Mar 2012 21:51:44 +0200 Subject: [PATCH 023/437] Fix issues in Chapter 3 of the guide --- getting_started/3.markdown | 42 +++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/getting_started/3.markdown b/getting_started/3.markdown index 13f38fe03..743843ac6 100644 --- a/getting_started/3.markdown +++ b/getting_started/3.markdown @@ -7,7 +7,7 @@ guide: 3 # 3 Modules -In Elixir, you can group several functions into a module. In the previous chapter, we have invoked for example functions from the module List: +In Elixir, you can group several functions into a module. In the previous chapter, for example, we have invoked functions from the module List: iex> List.flatten [1,[2],3] [1, 2, 3] @@ -91,7 +91,7 @@ Inside a module, we can define functions with `def` and private functions with ` Math.sum(1, 2) #=> 3 Math.do_sum(1, 2) #=> ** (UndefinedFunctionError) -Function declarations also supports guards and multiple clauses. If a function has several clauses, Elixir will try each clause until find one that matches. For example, here is the implementation for a function that checks if the given number is zero or not: +Function declarations also supports guards and multiple clauses. If a function has several clauses, Elixir will try each clause until it finds one that matches. For example, here is the implementation for a function that checks if the given number is zero or not: defmodule Math do def zero?(0) do @@ -142,11 +142,11 @@ And then we can use `only` or `except` to filter the macros being included. Fina end end -In the example above, we imported `Orddict.values` only for during that specific function. `values` won't be available in any other functions in that module. +In the example above, the imported `Orddict.values` is only visible within that specific function. `values` won't be available in any other function in that module (or any other module for that matter). ### 3.4.2 require -`require` is responsible to enforce that a module is loaded and to setup references aliases for a given module. For instance, one can do: +`require` ensures that a module is loaded and provides a means to setup reference aliases for a given module. For instance, one can do: defmodule Math do require MyOrddict, as: Orddict @@ -164,11 +164,11 @@ In general, a module does not need to be required before usage, except if we wan MyMacros.my_if do_something, it_works end -An attempt to call a macro that was not loaded will raise an error. Note that, as the import directive, `require` is lexical. +An attempt to call a macro that was not loaded will raise an error. Note that, as the `import` directive, `require` is lexical. ## 3.5 Module data -Elixir also allows module to store their own data. The canonical example for such data is annotating that a module implements the OTP behavior called `gen_server`: +Elixir also allows modules to store their own data. The canonical example for such data is annotating that a module implements the OTP behavior called `gen_server`: defmodule MyServer do @behavior :gen_server @@ -181,26 +181,26 @@ Now if the module above does not implement any of the callbacks required by `gen @vsn 2 end -`@vsn` refers to version and is used by the code reloading mechanism to check if a module is updated or not. If no version is specified, the version is set to the MD5 of the module functions. +`@vsn` refers to the version and is used by the code reloading mechanism to check if a module has been updated or not. If no version is specified, the version is set to the MD5 checksum of the module functions. Elixir has a handful of reserved data attributes. The following are currently functional in Elixir: * `@behaviour` and `@behavior` - used for specifying an OTP or user-defined behavior; * `@vsn` - used for specifying the module version; * `@compile` - provides options for the module compilation; -* `@moduledoc` - provides documentation to the current module; -* `@doc` - provides documentation to the next function; -* `@on_load` - provides a function, with arity 0, that will be invoked whenever the module is loaded. The function needs to return `:ok`, otherwise the loading of the function is aborted; -* `@overridable` - when true, the function can be overridden and referenced later using the special form `super`; +* `@moduledoc` - provides documentation for the current module; +* `@doc` - provides documentation for the function that follows it; +* `@on_load` - provides a function, with arity 0, that will be invoked whenever the module is loaded. The function has to return `:ok`, otherwise the loading of the module is aborted; +* `@overridable` - when true, the function following it can be overridden and referenced later using the special form `super`; -The following are also reserved by Elixir (as they have special semantics to the Erlang VM) but not currently supported (if you need support to any of these in your current projects, please make yourself heard in the issues tracker): +The following ones are also reserved by Elixir (as they have special semantics to the Erlang VM) but not currently supported (if you need support for any of these in your current projects, please open a ticket on the issue tracker): -* `@spec` - provides an specification for the next function to be defined; -* `@callback` - provides an specification for the behavior callback; +* `@spec` - provides a specification for the function following it; +* `@callback` - provides a specification for the behavior callback; * `@type` - provides a type to be used in @spec; * `@export_type` - provides a type to be used in @spec that can be accessed from external specs; -Besides the built-in data above, any developer can also add custom data: +Besides the built-in data attributes outlined above, any developer can also add custom data: defmodule MyServer do @my_data 13 @@ -211,7 +211,7 @@ After the module is compiled, the stored custom data can be accessed via `__info MyServer.__info__(:data) #=> [my_data: 13] -> Note: Erlang developers may be wondering why Elixir provides its own data abstraction instead of using Erlang attributes. Erlang attributes are basically a list which also allow duplicated entries. For Elixir, since the same data may be read and updated several times during compilation, it makes more sense to have a dictionary structure instead of a list. Erlang developers wishing to have the attributes functionality have two options: +> Note: Erlang developers may be wondering why Elixir provides its own data abstraction instead of using Erlang attributes. Erlang attributes are basically lists which also allow duplicated entries. For Elixir, since the same data may be read and updated several times during compilation, it makes more sense to have a dictionary structure instead of a list. Erlang developers wishing to have the attributes functionality have two options: > > 1) Manually add Erlang attributes via the `Module.add_attribute(module, attribute, value)` API; > @@ -226,7 +226,7 @@ In Elixir, nesting a module inside the other does not affect its name: end end -The example above will define two modules `Foo` and `Bar`. Notice that the second module is **not** called `Foo::Bar`. In general, nesting modules is discouraged in Elixir. +The example above will define two modules `Foo` and `Bar`. Notice that the second module is **not** called `Foo::Bar`. In general, nesting of modules is discouraged in Elixir. ## 3.7 References @@ -235,19 +235,19 @@ In Erlang (and consequently in the Erlang VM), modules and functions are represe Mod = lists, Mod:flatten([1,[2],3]). -In the example above, we store the atom `lists` in the variable `Mod` and then invoked the function flatten in it. In Elixir, exactly the same idiom is allowed. In fact, we could call the same function `flatten` in `lists` as: +In the example above, we store the atom `lists` in the variable `Mod` and then invoke the function `flatten` in it. In Elixir, exactly the same idiom is allowed. In fact, we could call the same function `flatten` in `lists` as: iex> :lists.flatten([1,[2],3]) [1,2,3] -This mechanism is exactly what empowers Elixir references. Elixir references are uppercase identifiers (like `List`, `Orddict`, etc) that are converted to an atom representing a module at compilation time. For instance, by default `List` translates to the atom `::List`: +This mechanism is exactly what empowers Elixir references. A reference in Elixir is a capitalized identifier (like `List`, `Orddict`, etc) which is converted to an atom representing a module during compilation. For instance, by default `List` translates to the atom `::List`: iex> List ::List iex> is_atom(List) true -References are powerful when used with the `require` directive discussed above. For instance, let's imagine our Math module relies heavily on the `Orddict` module. If, at some point, we find out most algorithms in `Orddict` could be implemented in a much faster way, we could implement `FastOrddict` and use it as a drop-in replacement: +References are powerful when used with the `require` directive discussed above. For instance, let's imagine that our Math module relies heavily on the `Orddict` module. If, at some point, we find out most algorithms in `Orddict` could be implemented in a much faster way, we could implement `FastOrddict` and use it as a drop-in replacement: defmodule Math do require FastOrddict, as: Orddict @@ -266,4 +266,4 @@ Finally, in Elixir `::` is simply an operator (like `+`). It is used to concaten iex> Foo :: Bar ::Foo::Bar -> Note: a reference does not actually ensure the reference really exists. For instance, `::FooBarBaz` will return an atom regardless if a `::FooBarBaz` module is defined or not. \ No newline at end of file +> Note: a reference does not actually ensure the referenced module really exists. For instance, `::FooBarBaz` will return an atom regardless if a `::FooBarBaz` module is defined or not. From d50e74e8f92461a5e5b6fa32c1fe81e90932abe0 Mon Sep 17 00:00:00 2001 From: Alexei Sholik Date: Thu, 22 Mar 2012 22:50:49 +0200 Subject: [PATCH 024/437] Mention lexical scoping more specifically --- getting_started/3.markdown | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/getting_started/3.markdown b/getting_started/3.markdown index 743843ac6..94593f6a1 100644 --- a/getting_started/3.markdown +++ b/getting_started/3.markdown @@ -113,7 +113,7 @@ Notice that giving an argument that does not match any of the clauses raises an ## 3.4 Directives -In order to support software-reuse, Elixir supports two directives. As we are going to see below, they are called directives because they are the only functions in Elixir that are **lexical**. +In order to support software-reuse, Elixir supports two directives. As we are going to see below, they are called directives because they are the only functions in Elixir that have **lexical scope**. ### 3.4.1 import @@ -133,7 +133,7 @@ If we want to import only `:functions` or `:macros` from a given module, we can import :macros, MyMacros -And then we can use `only` or `except` to filter the macros being included. Finally, note that `import` is **lexical**, this means we can import specific macros inside specific functions: +And then we can use `only` or `except` to filter the macros being included. Finally, note that `import` is **lexically scoped**, this means we can import specific macros inside specific functions: defmodule Math do def some_function do @@ -164,7 +164,7 @@ In general, a module does not need to be required before usage, except if we wan MyMacros.my_if do_something, it_works end -An attempt to call a macro that was not loaded will raise an error. Note that, as the `import` directive, `require` is lexical. +An attempt to call a macro that was not loaded will raise an error. Note that, as the `import` directive, `require` is also lexically scoped. ## 3.5 Module data From 5652355b5e648ca1a41c29ab60b09c89d7ecab85 Mon Sep 17 00:00:00 2001 From: Alexei Sholik Date: Fri, 23 Mar 2012 12:10:57 +0200 Subject: [PATCH 025/437] Update Chapter 4 --- getting_started/4.markdown | 47 ++++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 12 deletions(-) diff --git a/getting_started/4.markdown b/getting_started/4.markdown index 717a5014c..16a3e7d15 100644 --- a/getting_started/4.markdown +++ b/getting_started/4.markdown @@ -11,23 +11,23 @@ Elixir provides both protocols and records. This section will outline the main f ## 4.1 Records -Records are simple structures that holds values. For example, we can define a `FileInfo` record that is supposed to store information about files as follow: +Records are simple structures that hold values. For example, we can define a `FileInfo` record that is supposed to store information about files as follows: defrecord FileInfo, atime: nil, mtime: nil, accesses: 0 -The line above will define a module named `FileInfo` which contain a function named `new` that returns a new record and other functions to read and set the values in the record. Therefore, we can do: +The line above defines a module named `FileInfo` which contains a function named `new` (that returns a new record) and other functions to read and set the values in the record. Therefore, we can do: file_info = FileInfo.new(atime: now()) file_info.atime #=> Returns the value of atime file_info.atime(now()) #=> Updates the value of atime -Elixir will also define a `update_#{field}` function that accepts a function as argument that will receive the old value and update the current value with the result of the function: +Elixir will also define an `update_#{field}` function that accepts a function of one argument. When we invoke the update function, it calls the function we have provided passing it the current value of the field and updates the field with the value returned from our function: file_info = FileInfo.new(accesses: 10) file_info = file_info.update_accesses(fn(x) -> x + 1 end) file_info.accesses #=> 11 -Internally, a record is simply a tuple where the first element is always the record module name. This can be noticed if we create and print the record in Interactive Elixir (`bin/iex`): +Internally, a record is simply a tuple where the first element is always the record module name. We can check this by creating and printing a record in Interactive Elixir (`bin/iex`): iex> defrecord FileInfo, atime: nil, mtime: nil iex> FileInfo.new @@ -55,20 +55,43 @@ Since `counter` is an integer, Elixir automatically defines a helper named `incr On the other hand, if the default value is a list Elixir will define the two following helpers: -* `prepend_field` - Receives another list and prepend its values -* `merge_field` - Receives an orddict (which is a list of tuples) and merge it into the current value; +* `prepend_field` - Receives another list and prepends its values +* `merge_field` - Receives an orddict (which is a list of tuples) and merges it into the current value; + +Keep in mind that objects in Elixir are immutable. Every time you update a record's field, a new record is returned with the corresponding field updated. For example: + + iex> new_config = Config.new + {::Config, 0, []} + iex> new_config.counter + 0 + iex> new_config.increment_counter + {::Config, 1, []} + +Notice how `increment_counter` returned not simply an updated value of the `counter` field, but a whole new object which has its `counter` field set to the old value plus one. What will happen if we call `increment_counter` multiple times? + + iex> new_config.increment_counter + {::Config, 1, []} + iex> new_config.increment_counter + {::Config, 1, []} + +Since `new_config` remains unchanged, we get a new object with the `counter` field's value set to `1` every time we call `increment_counter`. In order to keep the new object, we need to assign it to a variable: + + iex> new_config = new_config.increment_counter + {::Config, 1, []} + iex> new_config.increment_counter + {::Config, 2, []} ## 4.2 Protocols -Protocols allows us to define contracts. Dispatching a protocol is available to any data type as long as it implements the prototype. Let's consider a practical example. +Protocols allow us to define contracts. Dispatching a protocol is available to any data type as long as it implements the prototype. Let's consider a practical example. In Elixir, only `false` and `nil` are considered falsy values. Everything else evaluates to true. Depending on the application, it may be important to specify a `blank?` protocol that returns a boolean for other data types that should be considered blank. For instance, an empty list or an empty binary could be considered blanks. -We could implement this protocol as follow: +We could implement this protocol as follows: defprotocol Blank, [ blank?(data) ] -The protocol expects a function called `blank?` expecting one argument to be implemented. We can implement this protocol for some Elixir data types as follow: +The protocol expects a function called `blank?` expecting one argument to be implemented. We can implement this protocol for some Elixir data types in the following way: # Numbers are never blank defimpl Blank, for: Number do @@ -104,7 +127,7 @@ And we would do so for all native data types. The types available are: ### 4.2.1 Selecting implementations -Implementing the protocol for all 9 types above can be cumbersome. Even more if you consider that Number, Function, PID, Port and Reference are never going to be blank. For this reason, Elixir allows us to declare that we are going to implement the protocol just for some types, as follows: +Implementing the protocol for all 9 types above can be cumbersome. Even more if you consider that Number, Function, PID, Port and Reference are never going to be blank. For this reason, Elixir allows us to declare the fact that we are going to implement the protocol just for some types, as follows: defprotocol Blank, [blank?(data)], only: [Atom, Tuple, List, BitString, Any] @@ -114,7 +137,7 @@ Since we also specified `Any` as a data type, if the data type is not any of Ato def blank?(_), do: false end -Now all data types that we have not specified will be automatically considered non blank. +Now all data types that we have not specified will be automatically considered non-blank. ### 4.2.2 Using protocols with records @@ -135,4 +158,4 @@ Elixir ships with three built-in protocols, they are: * List::Chars - specifies how to convert a data structures with characters to lists * String::Inspect - specifies how to convert any data structure to a string for inspection -You can check the source code of those files for more information about how the protocol is used and how to implement your own. With this, we have finally finished this section which has described `defrecord`, `defprotocol` and `defimpl`. Next, we are going to discuss macros with `defmacro`! \ No newline at end of file +You can check the source code for those protocols for more information about how each one is used and how to implement your own. With this, we have finally finished this section which has described `defrecord`, `defprotocol` and `defimpl`. Next, we are going to discuss macros with `defmacro`! From fe4bf570b9f5f1a74da2c8acac1b7311957b94af Mon Sep 17 00:00:00 2001 From: Alexei Sholik Date: Fri, 23 Mar 2012 12:42:31 +0200 Subject: [PATCH 026/437] Rename 'object' -> 'record' --- getting_started/4.markdown | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/getting_started/4.markdown b/getting_started/4.markdown index 16a3e7d15..a2628a93f 100644 --- a/getting_started/4.markdown +++ b/getting_started/4.markdown @@ -58,7 +58,7 @@ On the other hand, if the default value is a list Elixir will define the two fol * `prepend_field` - Receives another list and prepends its values * `merge_field` - Receives an orddict (which is a list of tuples) and merges it into the current value; -Keep in mind that objects in Elixir are immutable. Every time you update a record's field, a new record is returned with the corresponding field updated. For example: +Keep in mind that records (as any other data structure) in Elixir are immutable. Every time you update a record's field, a new record is returned with the corresponding field updated. For example: iex> new_config = Config.new {::Config, 0, []} @@ -67,14 +67,14 @@ Keep in mind that objects in Elixir are immutable. Every time you update a recor iex> new_config.increment_counter {::Config, 1, []} -Notice how `increment_counter` returned not simply an updated value of the `counter` field, but a whole new object which has its `counter` field set to the old value plus one. What will happen if we call `increment_counter` multiple times? +Notice how `increment_counter` returned not simply an updated value of the `counter` field, but a whole new record which has its `counter` field set to the old value plus one. What will happen if we call `increment_counter` multiple times? iex> new_config.increment_counter {::Config, 1, []} iex> new_config.increment_counter {::Config, 1, []} -Since `new_config` remains unchanged, we get a new object with the `counter` field's value set to `1` every time we call `increment_counter`. In order to keep the new object, we need to assign it to a variable: +Since `new_config` remains unchanged, we get a new record with the `counter` field's value set to `1` every time we call `increment_counter`. In order to keep the new record, we need to assign it to a variable: iex> new_config = new_config.increment_counter {::Config, 1, []} From b1b2211c8e9fce84623b21fc444071f9db6ff1bd Mon Sep 17 00:00:00 2001 From: Alexei Sholik Date: Fri, 23 Mar 2012 12:50:14 +0200 Subject: [PATCH 027/437] Clarify the fact that records are tuples --- getting_started/4.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/getting_started/4.markdown b/getting_started/4.markdown index a2628a93f..81ce297de 100644 --- a/getting_started/4.markdown +++ b/getting_started/4.markdown @@ -147,7 +147,7 @@ The real benefit of protocols comes when mixed with records. For instance, one m def blank?(dict), do: RedBlack.empty?(dict) end -In the example above, we have implemented `blank?` for the custom dictionary that simply delegates to `RedBlack.empty?`. Finally, since records are simply tuples, the default implementation for records can be given in the tuple implementation. +In the example above, we have implemented `blank?` for the custom dictionary that simply delegates to `RedBlack.empty?`. Finally, since records are simply tuples, one can add a default protocol implementation to any record by defining a default implementation for tuples. ### 4.2.3 Built-in protocols From 4e442679058131695e44c52a8c5918629ac2c01a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Fri, 23 Mar 2012 12:02:41 +0100 Subject: [PATCH 028/437] Update getting_started/4.markdown --- getting_started/4.markdown | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/getting_started/4.markdown b/getting_started/4.markdown index 81ce297de..e21bdc9a0 100644 --- a/getting_started/4.markdown +++ b/getting_started/4.markdown @@ -141,13 +141,15 @@ Now all data types that we have not specified will be automatically considered n ### 4.2.2 Using protocols with records -The real benefit of protocols comes when mixed with records. For instance, one may implement a custom dictionary as a Red-Black tree and this dictionary should also be considered blank in case it has no items. That said, the developer just needs to implement the protocol for this dictionary: +The real benefit of protocols comes when mixed with records. For instance, imagine we have a module called `RedBlack` that provides an API to create and manipulate Red-Black trees. This module represents such trees via a record named `RedBlack::Tree` and we want this tree to be considered blank in case it has no items. To achieve this, the developer just needs to implement the protocol for `RedBlack::Tree`: - defimpl Blank, for: RedBlack::Dict do - def blank?(dict), do: RedBlack.empty?(dict) + defimpl Blank, for: RedBlack::Tree do + def blank?(tree), do: RedBlack.empty?(tree) end -In the example above, we have implemented `blank?` for the custom dictionary that simply delegates to `RedBlack.empty?`. Finally, since records are simply tuples, one can add a default protocol implementation to any record by defining a default implementation for tuples. +In the example above, we have implemented `blank?` for `RedBlack::Tree` that simply delegates to `RedBlack.empty?` passing the tree as argument. This implementation doesn't need to be defined inside the `RedBlack` tree or inside the record, but anywhere in the code. + +Finally, since records are simply tuples, one can add a default protocol implementation to any record by defining a default implementation for tuples. ### 4.2.3 Built-in protocols From c00c9df795a71f083eb6ad5a75a7241afa736d99 Mon Sep 17 00:00:00 2001 From: Alexei Sholik Date: Fri, 23 Mar 2012 18:33:12 +0200 Subject: [PATCH 029/437] Update getting_started/5.markdown --- getting_started/5.markdown | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/getting_started/5.markdown b/getting_started/5.markdown index f2446ecca..3bc090abe 100644 --- a/getting_started/5.markdown +++ b/getting_started/5.markdown @@ -21,7 +21,7 @@ The tuple above represents a function call to sum passing 1, 2 and 3 as argument * The first element of the tuple is always an atom or another tuple in the same representation; * The second element of the tuple is always an integer representing the line number; -* The third element of the tuple are the arguments for the function call. The third argument may also be an atom (`nil` or `:quoted`), meaning that the tuple may not represent a function call, but a variable. +* The third element of the tuple is either a list of arguments for the function call or an atom (`nil` or `:quoted`), meaning that the tuple represents a variable, not a function call. You can get the representation of any expression by using the quote macro: @@ -50,7 +50,7 @@ With those basic structures in mind, we are ready to define our own macro. ## 5.2 Defining our own macro -A macro can be define using `defmacro`. For instance, we can define a macro called `unless` which works the same as Ruby's unless in just few lines of code: +A macro can be defined using `defmacro`. For instance, in just a few lines of code we can define a macro called `unless` which works the same way Ruby's `unless` does: defmodule MyMacro do defmacro unless(clause, options) do @@ -63,15 +63,15 @@ Similarly to `if`, `unless` expects two arguments: a `clause` and `options`: require MyMacro MyMacro.unless var, do: IO.puts "false" -However, since `unless` is a macro, it won't receive values when invoked, but instead, its expressions. For example, if one calls: +However, since `unless` is a macro, its arguments are not evaluated when it's invoked but are instead passed literally. For example, if one calls: unless 2 + 2 == 5, do: call_function() -Our `unless` macro will receive the following: +our `unless` macro will receive the following: unless({:==, 1, [{:+, 1, [2, 2]}, 5]}, { :call_function, 1, [] }) -Then our `unless` macro will call `quote`, to return a tree representation of the `if` clause. This means we are transforming our `unless` in a `if`! +Then our `unless` macro will call `quote`, to return a tree representation of the `if` clause. This means we are transforming our `unless` into an `if`! There is a common mistake when quoting expressions which is that developers usually forget to `unquote` the proper expression. In order to understand what `unquote` does, let's simply remove it: @@ -89,13 +89,13 @@ Which would fail because the clause and options variables are not defined in the quote do: if(!unquote(clause), unquote(options)) end -Which will then return: +`unless` will then return: if(!(2 + 2 == 5), do: call_function()) -In other words, unquote is a mechanism to inject expressions into the tree being quoted and is essential to the meta-programming mechanism. Elixir also provides `unquote_splicing` allowing us to inject many expressions at once. +In other words, unquote is a mechanism to inject expressions into the tree being quoted and it is an essential tool of the meta-programming. Elixir also provides `unquote_splicing` allowing us to inject many expressions at once. -We can define any macro we want, including override the built-in macros provided by Elixir. The only exceptions are Elixir special forms that cannot be overridden, [the full list of special forms is available in `Elixir::SpecialForms`](https://github.com/elixir-lang/elixir/tree/master/lib/elixir/special_forms.ex). +We can define any macro we want, including ones that override the built-in macros provided by Elixir. The only exceptions are Elixir special forms that cannot be overridden, [the full list of special forms is available in `Elixir::SpecialForms`](https://github.com/elixir-lang/elixir/tree/master/lib/elixir/special_forms.ex). ## 5.3 Macros hygiene @@ -132,7 +132,7 @@ Macros hygiene only works because Elixir marks a variable as coming from the quo iex> quote do: x { :x, 0, :quoted } -Notice that the third element is `:quoted`. It means that x may be a function call with 0 arguments or a variable coming from a quote. On the other hand, an unquoted variable would have the third element equals to nil. Let's consider this final example: +Notice that the third element is `:quoted`. It means that x may be a function call with 0 arguments or a variable coming from a quote. On the other hand, an unquoted variable would have the third element equal to nil. Let's consider this final example: defmodule Hygiene do defmacro quoted(x) do @@ -181,4 +181,4 @@ In order to access the macro, it needs to be defined in an outer module: delegate [values: 1], to: List end -With this note, we finish our introduction to macros. Next, let's move to the next chapter which will discuss several topics as native code compilation, partial application and others. \ No newline at end of file +With this note, we finish our introduction to macros. Next, let's move to the next chapter which will discuss several topics such as native code compilation, partial application and others. From bf4eafe57aa8f33f49f28f0df658ff05b20f8442 Mon Sep 17 00:00:00 2001 From: Alexei Sholik Date: Fri, 23 Mar 2012 18:33:27 +0200 Subject: [PATCH 030/437] Update getting_started/6.markdown --- getting_started/6.markdown | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/getting_started/6.markdown b/getting_started/6.markdown index 92d9992b3..e19c9874c 100644 --- a/getting_started/6.markdown +++ b/getting_started/6.markdown @@ -18,7 +18,7 @@ Elixir uses the module data described in chapter 3 to drive its documentation sy def version, do: 1 end -In the example above, we are adding a module documentation to MyModule via `@moduledoc` and using `@doc` to document each function. When compiled with the `--docs` option, we will be able to inspect the documentation attributes in runtime (remember to start iex in the same directory you compiled the module): +In the example above, we are adding a module documentation to MyModule via `@moduledoc` and using `@doc` to document each function. When compiled with the `--docs` option, we will be able to inspect the documentation attributes in runtime (remember to start iex in the same directory you compiled the module in): $ elixirc my_module.ex --docs $ iex @@ -27,11 +27,11 @@ In the example above, we are adding a module documentation to MyModule via `@mod iex> MyModule.__info__(:moduledoc) {1,"It does X"} -`__info__(:docs)` returns a list of tuples where each tuple contains the function/arity pair, the line the function was defined, the kind of the function (`def` or `defmacro`, docs applied to `defp` are always ignored) and the comments. The comment should be either a binary or a boolean. +`__info__(:docs)` returns a list of tuples where each tuple contains a function/arity pair, the line the function was defined on, the kind of the function (`def` or `defmacro`, docs applied to `defp` are always ignored) and the comments. The comment should be either a binary or a boolean. -Similarly, `__info__(:moduledoc)` returns a tuple with the line the module was defined and its comments. +Similarly, `__info__(:moduledoc)` returns a tuple with the line the module was defined on and its comments. -In case `--docs` is not provided during compilation, both calls would return nil. Elixir promotes the use of markdown in documentation, since it is a widely available format. Consider for example the documentation for `Module.add_doc` which allows us to dynamically add a documentation to a function: +In case `--docs` was not provided during compilation, both calls would return nil. Elixir promotes the use of markdown in documentation, since it is a widely available format. Consider, for example, the documentation for `Module.add_doc` which allows us to dynamically add documentation to a function: @doc """ Attaches documentation to a given function. It expects @@ -51,11 +51,11 @@ In case `--docs` is not provided during compilation, both calls would return nil """ def add_doc(module, line, kind, tuple, doc) -In the example, we use heredocs to allow the documentation to spawn several lines and markdown to style the documentation. +In the example, we use heredocs to allow the documentation to span over several lines and markdown to style the documentation. ## 6.2 Partial application -Elixir also supports partial application. Let's suppose we have a list of strings and we want to calculate the size for each them. We could do it as follow: +Elixir also supports partial application. Let's suppose we have a list of strings and we want to calculate the size for each of them. We could do it in the following way: iex> list = ["foo", "bar", "baz"] ["foo","bar","baz"] @@ -140,12 +140,12 @@ Bit string generators are quite useful when you need to organize bit string stre iex> lc <> in pixels, do: {r,g,b} [{213,45,132},{64,76,32},{76,0,0},{234,32,15}] -Remember, as strings are binaries and a binary is a bitstring, we can also use strings on comprehensions. For instance, the example below removes all white space characters from a string via bit comprehensions: +Remember, as strings are binaries and a binary is a bitstring, we can also use strings in comprehensions. For instance, the example below removes all white space characters from a string via bit comprehensions: iex> bc <> in " hello world ", c != ?\s, do: <> "helloworld" -Elixir does its best to hide the differences between list and bit string generators. However, there is a special case due to Erlang limitation that we need to explicitly tell Erlang that a list is being given as argument: +Elixir does its best to hide the differences between list and bit string generators. However, there is a special case due to Erlang limitation where we need to explicitly tell Erlang that a list is being given as argument: # This will fail because when Elixir sees that the left side # of the in expression is a bit string, it expects the right side @@ -163,7 +163,7 @@ Elixir does its best to hide the differences between list and bit string generat ## 6.5 Pseudo variables -Elixir provides with some pseudo-variables. Those variables can only be read and never assigned to. They are: +Elixir provides a set of pseudo-variables. Those variables can only be read and never assigned to. They are: * `__MODULE__` - Returns an atom representing the current module or nil; * `__FUNCTION__` - Returns a tuple representing the current function by name and arity or nil; @@ -173,6 +173,6 @@ Elixir provides with some pseudo-variables. Those variables can only be read and ## 6.6 Native compilation -Elixir can compile to native code using the Hipe compiler. All you need to do is to export the following before running your code: +Elixir can compile to native code using the Hipe compiler. All you need to do is export the following environment variable before running your code: export ERL_COMPILER_OPTIONS=native From dd04782a48fe211e0cd3e7aefea4ee8f756d598f Mon Sep 17 00:00:00 2001 From: Alexei Sholik Date: Fri, 23 Mar 2012 19:29:09 +0200 Subject: [PATCH 031/437] A small grammar fix in Chapter 5 --- getting_started/5.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/getting_started/5.markdown b/getting_started/5.markdown index 3bc090abe..dace785bc 100644 --- a/getting_started/5.markdown +++ b/getting_started/5.markdown @@ -93,7 +93,7 @@ Which would fail because the clause and options variables are not defined in the if(!(2 + 2 == 5), do: call_function()) -In other words, unquote is a mechanism to inject expressions into the tree being quoted and it is an essential tool of the meta-programming. Elixir also provides `unquote_splicing` allowing us to inject many expressions at once. +In other words, unquote is a mechanism to inject expressions into the tree being quoted and it is an essential tool for meta-programming. Elixir also provides `unquote_splicing` allowing us to inject many expressions at once. We can define any macro we want, including ones that override the built-in macros provided by Elixir. The only exceptions are Elixir special forms that cannot be overridden, [the full list of special forms is available in `Elixir::SpecialForms`](https://github.com/elixir-lang/elixir/tree/master/lib/elixir/special_forms.ex). From fd7cf7ec128bf2dffb389ae2a15f82abb2c0a11e Mon Sep 17 00:00:00 2001 From: Alexei Sholik Date: Fri, 23 Mar 2012 19:38:54 +0200 Subject: [PATCH 032/437] Rephrase the explanation of 'use' --- getting_started/6.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/getting_started/6.markdown b/getting_started/6.markdown index e19c9874c..f56b17138 100644 --- a/getting_started/6.markdown +++ b/getting_started/6.markdown @@ -78,7 +78,7 @@ All functions can be partially applied, except [Elixir's special forms](https:// ## 6.3 Use -`use` is a macro intended to a common API for extension. For instance, in order to use the `ExUnit` test framework that ships with Elixir, you simply need to use `ExUnit::Case` in your module: +`use` is a macro that provides a common API for module extension. For instance, in order to use the `ExUnit` test framework that ships with Elixir, you simply need to use `ExUnit::Case` in your module: defmodule AssertionTest do use ExUnit::Case From 8fa420d1e56c4698d87360233ce4d7315b324bab Mon Sep 17 00:00:00 2001 From: Alexei Sholik Date: Fri, 23 Mar 2012 20:01:21 +0200 Subject: [PATCH 033/437] Another little wording fix --- getting_started/5.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/getting_started/5.markdown b/getting_started/5.markdown index dace785bc..d7cf7338d 100644 --- a/getting_started/5.markdown +++ b/getting_started/5.markdown @@ -168,7 +168,7 @@ In order to support recursion, macros cannot be called locally. For example, one delegate [values: 1], to: List end -In order to access the macro, it needs to be defined in an outer module: +In order for us to access the macro, it needs to be defined in an outer module: defmodule MyMacros::Support defmacro delegate([h|t], to: target) do From ca17a462ade3825991c398bed6502d8dc22b53f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Fri, 23 Mar 2012 21:23:25 +0100 Subject: [PATCH 034/437] Small fixes. --- getting_started/2.markdown | 4 ++-- getting_started/3.markdown | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/getting_started/2.markdown b/getting_started/2.markdown index 475a2de30..08729cf8f 100644 --- a/getting_started/2.markdown +++ b/getting_started/2.markdown @@ -45,7 +45,7 @@ Since updating a tuple is expensive, when we want to iterate, add or remove elem iex> length [head | tail] 3 -In the example above, we have assigned the head of the list to the variable `head` and the tail of the list to the variable `tail`. The [`Enum` module](https://github.com/elixir-lang/elixir/blob/master/lib/enum.ex) provides several helpers to manipulate lists (and other enumerables in general) while the [List module](https://github.com/elixir-lang/elixir/blob/master/lib/list.ex) provides several helpers specific to lists: +In the example above, we have assigned the head of the list to the variable `head` and the tail of the list to the variable `tail`. The [`Enum` module](https://github.com/elixir-lang/elixir/blob/master/lib/enum.ex) provides several helpers to manipulate lists (and other enumerables in general) while the [`List` module](https://github.com/elixir-lang/elixir/blob/master/lib/list.ex) provides several helpers specific to lists: iex> Enum.map [1,2,3], fn(x) -> x * 2 end [2,4,6] @@ -112,7 +112,7 @@ In Elixir, `=` does not mean assignment as in programming languages like Java an iex> { 1, 2, 3 } = { 1, 2, 3 } { 1, 2, 3 } iex> { 1, 2, 3 } = { 1, 4, 3 } - ** (::MatchError) no match of right hand side value: {1,4,3} + ** (MatchError) no match of right hand side value: {1,4,3} If the tuples given on the left and right side do not match, an error is raised. If any of the tuples contain a variable, this variable will always be assigned: diff --git a/getting_started/3.markdown b/getting_started/3.markdown index 94593f6a1..097a17d46 100644 --- a/getting_started/3.markdown +++ b/getting_started/3.markdown @@ -54,7 +54,7 @@ In many cases, since the bytecode is in `ebin`, you need to explicitly tell Elix bin/iex -pa ebin -Where `-pa` stands for `path append`. The same option can also be passed to `elixir` and `elixirc` executables. You can execute `bin/elixir` and `bin/elixirc` to get a full list of options. +Where `-pa` stands for `path append`. The same option can also be passed to `elixir` and `elixirc` executables. You can execute `bin/elixir` and `bin/elixirc` without arguments to get a list with all options. ## 3.2 Scripted mode @@ -191,7 +191,7 @@ Elixir has a handful of reserved data attributes. The following are currently fu * `@moduledoc` - provides documentation for the current module; * `@doc` - provides documentation for the function that follows it; * `@on_load` - provides a function, with arity 0, that will be invoked whenever the module is loaded. The function has to return `:ok`, otherwise the loading of the module is aborted; -* `@overridable` - when true, the function following it can be overridden and referenced later using the special form `super`; +* `@overridable` - when true, the following function can be overridden and referenced later using the special form `super`; The following ones are also reserved by Elixir (as they have special semantics to the Erlang VM) but not currently supported (if you need support for any of these in your current projects, please open a ticket on the issue tracker): From cc1e40bdf96a78f571814f52a9507ff2037287ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sun, 25 Mar 2012 10:56:41 +0200 Subject: [PATCH 035/437] Add a section about orddicts. --- getting_started/2.markdown | 74 ++++++++++++++++++++------------------ 1 file changed, 39 insertions(+), 35 deletions(-) diff --git a/getting_started/2.markdown b/getting_started/2.markdown index 08729cf8f..04af20eed 100644 --- a/getting_started/2.markdown +++ b/getting_started/2.markdown @@ -52,7 +52,30 @@ In the example above, we have assigned the head of the list to the variable `hea iex> List.flatten [1,[2],3] [1,2,3] -## 2.2 Lists and binaries +## 2.2 Ordered dictionaries + +Elixir also provides a special syntax to create ordered dictionaries. They can be created as follow: + + iex> [a: 1, b: 2] + [{:a,1},{:b,2}] + +Notice in the example above an Ordered dictionary (from now on called Orddict) is nothing more than a list of two element tuples, where the first element of the tuple is an atom. It is important to notice that the dictionary is ordered according to the ordering of the terms and not according to insertion order: + + iex> [foo: 1, bar: 2] + [{:bar,2},{:foo,1}] + +The reason for such ordering is faster access when reading and updating the dictionary. In order to manipulate Orddicts, we can use the [`Orddict` module](https://github.com/elixir-lang/elixir/blob/master/lib/orddict.ex): + + iex> x = [a: 1, b: 2] + [{:a, 1}, {:b, 2}] + iex> Orddict.get x, :a + 1 + iex> Orddict.get x, :c + nil + +Check the module for other functions and their respective documentation. + +## 2.3 Char lists and binaries In the previous chapter we have discussed double- and single-quoted strings. Double quoted strings are binaries while single-quoted strings are lists: @@ -82,7 +105,7 @@ Since lists are implemented as linked lists, it means a string represented as li Currently, Elixir does not ship with any library for doing string manipulation, but this will be amended soon. -## 2.3 Calling Erlang functions +## 2.4 Calling Erlang functions Elixir's plans is to provide a small standard library responsible for handling most basic structures (lists, ordered dicts, strings and so forth) and IO. That said, complex applications will require the developer to use Erlang's libraries. @@ -96,7 +119,7 @@ Erlang's OTP is very well documented and a developer should not have problems go * [OTP docs](http://www.erlang.org/doc/) * [Standard library docs](http://www.erlang.org/doc/man/STDLIB_app.html) -## 2.4 Pattern matching +## 2.5 Pattern matching When discussing lists, we saw the following example: @@ -165,7 +188,7 @@ Although pattern matching allows us to build powerful constructs, its usage is l iex> Erlang.lists.flatten([1,[2],3]) = [1,2,3] ** (ErlangError) erlang error :illegal_pattern -## 2.5 Key-values +## 2.6 Key-values One of the first control flow constructs we usually learn is the conditional `if`. In Elixir, we can write `if` in these two equivalent ways: @@ -176,26 +199,7 @@ One of the first control flow constructs we usually learn is the conditional `if ...> end 3 -Both examples above are simply different ways of expressing key-value arguments. Key-value arguments are a list of two-item tuples, where the first element is an atom representing the key and the second is the value. Elixir provides a syntax-shortcut for creating such key-values: - - iex> [a: 1, b: 2] - [{:a, 1}, {:b, 2}] - -In order to manipulate those key-value arguments, we can use the [`Orddict` module](https://github.com/elixir-lang/elixir/blob/master/lib/orddict.ex): - - iex> x = [a: 1, b: 2] - [{:a, 1}, {:b, 2}] - iex> Orddict.get x, :a - 1 - iex> Orddict.get x, :c - nil - -Going back to the `if` example, we invoked it passing a condition (`true`) and a key-value argument (`do: 1 + 2`): - - iex> if true, do: 1 + 2 - 3 - -Since the key-value argument is the last argument, the brackets are optional. These are all equivalent: +Both examples above are simply different ways of expressing key-value arguments. Key-value arguments are based on the Ordered dictionaries we just discussed above. Since the key-value argument is the last argument, the brackets are optional. These are all equivalent: iex> if true, do: 1 + 2 3 @@ -259,11 +263,11 @@ Which is then parsed as: A good rule of thumb is: always use `->/end` when defining functions with `fn`, use `do/end` for all other structures. If we follow this rule, everything works transparently. -## 2.6 Control flow structures +## 2.7 Control flow structures In this section we are going to describe Elixir main control structures. -### 2.6.1 If +### 2.7.1 If Refreshing from the section above, all these calls are equivalent: @@ -296,7 +300,7 @@ Refreshing from the section above, all these calls are equivalent: In Elixir, all values except `false` and `nil` evaluate to true. So there is no need to convert them to boolean. -### 2.6.2 Other boolean operators +### 2.7.2 Other boolean operators In the previous chapter, we discussed the boolean operators `and`, `or` and `not`. Those operators are strict in the sense they only accept booleans as arguments. @@ -322,7 +326,7 @@ To work around this limitation, Elixir provides three operators with similar fun iex> !nil true -### 2.6.3 Case +### 2.7.3 Case In this section we have introduced pattern matching via the `=` operator. Sometimes however it is convenient to match an expression against several expressions until we find a matching one. For such cases, we use `case`: @@ -417,7 +421,7 @@ However, the example above will always fail because, if the argument is a list, In such cases, if there is an error in one of the guards, it won't affect the next one. -### 2.6.4 Functions +### 2.7.4 Functions Throughout this guide, we have created many functions in examples. The syntax for creating functions is: @@ -437,7 +441,7 @@ As an immutable language, the binding of the function is also immutable. This me (fn -> x = 2 end).() x #=> 1 -### 2.6.5 Loops +### 2.7.5 Loops Due to data structure immutability, loops in Elixir (and in functional programming languages) are written differently from conventional imperative languages. For example, in an imperative language, one would write: @@ -466,7 +470,7 @@ Then, we add the head of the list to the accumulator `h + acc` and call the loop > Note: `loop/recur` is also a Clojure idiom, although differently from Clojure, `recur` in Elixir does not ensure a tail call was made. -### 2.6.6 Try +### 2.7.6 Try The next control-flow mechanism is `try/catch/after`: @@ -513,7 +517,7 @@ The common strategy then is to make explicit all arguments that are required aft x #=> returns the value of x or nil for failures -### 2.6.7 Rescue +### 2.7.7 Rescue While `catch` clauses inside `try` are simply a pattern matching mechanism, `rescue` provides a higher abstraction around exceptions. `rescue` allows a developer to rescue an exception by its name and not by its internal contents. Consider the following examples: @@ -546,7 +550,7 @@ While `catch` clauses inside `try` are simply a pattern matching mechanism, `res Custom exceptions can be defined using the `defexception` macro. Check [the exceptions file for some examples](https://github.com/elixir-lang/elixir/tree/master/lib/exception.ex). -### 2.6.8 Receive +### 2.7.8 Receive The last control-flow mechanism we are going to discuss is essential to Elixir's and Erlang's actor mechanism. In Elixir, the code is run in separate processes that exchange messages between them. Those processes are not Operating System processes (they are actually quite light-weight) but are called so since they do not share state with each other. @@ -578,9 +582,9 @@ You may not see exactly `<0.36.0>` back, but something similar. If there are no In most cases, we don't send messages directly with `<-` nor write `receive` control expressions. Instead, we use many of the abstractions provided by OTP which will be discussed later. -## 2.7 Default functions +## 2.8 Built-in functions -Elixir ships with many default functions automatically available in the current scope. Besides all the control flow expressions seen above, Elixir also adds: `elem` and `setelem` to read and set values in tuples, `inspect` that returns the representation of a given data type as string and many others. [Many of these functions with documentation and examples are available in `Elixir::Builtin`](https://github.com/elixir-lang/elixir/tree/master/lib/elixir/builtin.ex) and [Elixir special forms are available in `Elixir::SpecialForms`](https://github.com/elixir-lang/elixir/tree/master/lib/elixir/special_forms.ex). +Elixir ships with many built-in functions automatically available in the current scope. Besides all the control flow expressions seen above, Elixir also adds: `elem` and `setelem` to read and set values in tuples, `inspect` that returns the representation of a given data type as string and many others. [Many of these functions with documentation and examples are available in `Elixir::Builtin`](https://github.com/elixir-lang/elixir/tree/master/lib/elixir/builtin.ex) and [Elixir special forms are available in `Elixir::SpecialForms`](https://github.com/elixir-lang/elixir/tree/master/lib/elixir/special_forms.ex). Besides the functions provided by Elixir, Elixir imports many of the root function from Erlang. The functions `length`, `is_list`, `is_number` and many others we discussed above come from Erlang. [The full documented list is available on the OTP documentation page](http://www.erlang.org/doc/man/erlang.html). From 98e1900e3862b9e010b00308c36181410e12f711 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sun, 25 Mar 2012 23:13:20 +0200 Subject: [PATCH 036/437] Update docs to use new dot syntax. --- getting_started/1.markdown | 4 +- getting_started/2.markdown | 6 +-- getting_started/3.markdown | 99 ++++++++++++++++++++++++-------------- getting_started/4.markdown | 32 ++++++------ getting_started/5.markdown | 34 ++++++++----- getting_started/6.markdown | 10 ++-- 6 files changed, 112 insertions(+), 73 deletions(-) diff --git a/getting_started/1.markdown b/getting_started/1.markdown index b0c7bb561..dbbc29bdd 100644 --- a/getting_started/1.markdown +++ b/getting_started/1.markdown @@ -36,7 +36,7 @@ You can download and compile Elixir in few steps: $ make test $ bin/elixir -v - Elixir 0.4.0.dev + Elixir 0.9.0.dev If tests pass, you are ready to go. Otherwise, feel free to open an issue [in the issues tracker on Github](https://github.com/elixir-lang/elixir). @@ -167,7 +167,7 @@ Elixir also provides three boolean operators: `or`, `and` and `not`. Those opera Giving a non-boolean as argument will raise an exception: iex> 1 and true - ** (::ArgumentError) argument error + ** (ArgumentError) argument error `or` and `and` are short-circuit operators. They just execute the right side in case the left side is not enough to determine the result: diff --git a/getting_started/2.markdown b/getting_started/2.markdown index 04af20eed..54acdb933 100644 --- a/getting_started/2.markdown +++ b/getting_started/2.markdown @@ -158,7 +158,7 @@ We have assigned the head of the list to `h` and the tail to `t`. In fact, if we iex> [1 | t] = [1,2,3] [1, 2, 3] iex> [0 | t] = [1,2,3] - ** (::MatchError) no match of right hand side value: [1,2,3] + ** (MatchError) no match of right hand side value: [1,2,3] In case you want to pattern match against the value of a variable, you can use the `^` operator: @@ -167,7 +167,7 @@ In case you want to pattern match against the value of a variable, you can use t iex> ^x = 1 1 iex> ^x = 2 - ** (::MatchError) no match of right hand side value: 2 + ** (MatchError) no match of right hand side value: 2 iex> x = 2 2 @@ -584,7 +584,7 @@ In most cases, we don't send messages directly with `<-` nor write `receive` con ## 2.8 Built-in functions -Elixir ships with many built-in functions automatically available in the current scope. Besides all the control flow expressions seen above, Elixir also adds: `elem` and `setelem` to read and set values in tuples, `inspect` that returns the representation of a given data type as string and many others. [Many of these functions with documentation and examples are available in `Elixir::Builtin`](https://github.com/elixir-lang/elixir/tree/master/lib/elixir/builtin.ex) and [Elixir special forms are available in `Elixir::SpecialForms`](https://github.com/elixir-lang/elixir/tree/master/lib/elixir/special_forms.ex). +Elixir ships with many built-in functions automatically available in the current scope. Besides all the control flow expressions seen above, Elixir also adds: `elem` and `setelem` to read and set values in tuples, `inspect` that returns the representation of a given data type as string and many others. [Many of these functions with documentation and examples are available in `Elixir.Builtin`](https://github.com/elixir-lang/elixir/tree/master/lib/elixir/builtin.ex) and [Elixir special forms are available in `Elixir.SpecialForms`](https://github.com/elixir-lang/elixir/tree/master/lib/elixir/special_forms.ex). Besides the functions provided by Elixir, Elixir imports many of the root function from Erlang. The functions `length`, `is_list`, `is_number` and many others we discussed above come from Erlang. [The full documented list is available on the OTP documentation page](http://www.erlang.org/doc/man/erlang.html). diff --git a/getting_started/3.markdown b/getting_started/3.markdown index 097a17d46..921122393 100644 --- a/getting_started/3.markdown +++ b/getting_started/3.markdown @@ -39,7 +39,7 @@ This file can be compiled using `bin/elixirc` (or simply `elixirc` if you instal bin/elixirc math.ex -Which will then generate a file named `::Math.beam` containing the bytecode for the defined module. Now, if we start `bin/iex` again, our module definition will be available (considering `bin/iex` is being started in the same directory the bytecode file is): +Which will then generate a file named `Math.beam` containing the bytecode for the defined module. Now, if we start `bin/iex` again, our module definition will be available (considering `bin/iex` is being started in the same directory the bytecode file is): iex> Math.sum(1, 2) 3 @@ -113,9 +113,56 @@ Notice that giving an argument that does not match any of the clauses raises an ## 3.4 Directives -In order to support software-reuse, Elixir supports two directives. As we are going to see below, they are called directives because they are the only functions in Elixir that have **lexical scope**. +In order to support software-reuse, Elixir supports three directives. As we are going to see below, they are called directives because they are the only functions in Elixir that have **lexical scope**. -### 3.4.1 import +### 3.4.1 refer + +`refer` allows you to setup references to a given module. For instance, one can do: + + defmodule Math do + refer MyOrddict, as: Orddict + end + +And now, any reference to `Orddict` will be automatically replaced by `MyOrddict`. In case one wants to access the original `Orddict`, it can be done by accessing the module directly via `__MAIN__`: + + Orddict.values #=> uses MyOrddict.values + Orddict.values #=> uses __MAIN__.Orddict.values + +Calling `refer` without an `as` option sets the reference automatically to the last part of the module name, for example: + + refer Foo.Bar.Baz + +Is the same as: + + refer Foo.Bar.Baz, as: Baz + +Notice that `refer` is **lexically scoped**, which allows you to set references inside specific functions: + + defmodule Math do + def add(a, b) do + refer MyOrddict, as: Orddict + # ... + end + + def minus(a, b) do + # ... + end + end + +In the example above, since we are invoking `refer` inside the function `add`, the reference will just be valid inside the function `add`. `minus` won't be affected at all. + +### 3.4.2 require + +In general, a module does not need to be required before usage, except if we want to use the macros available in that module. For instance, suppose we created our own `my_if` implementation in a module named `MyMacros`. If we want to invoke it, we need to first explicitly require `MyMacros`: + + defmodule Math do + require MyMacros + MyMacros.my_if do_something, it_works + end + +An attempt to call a macro that was not loaded will raise an error. Note that, as the `refer` directive, `require` is also lexically scoped. + +### 3.4.3 import We use `import` whenever we want to easily access functions or macros from others modules without using the qualified name. For instance, if we want to use the `values` function from `Orddict` several times in a module and we don't want to always type `Orddict.values`, we can simply import it: @@ -144,27 +191,7 @@ And then we can use `only` or `except` to filter the macros being included. Fina In the example above, the imported `Orddict.values` is only visible within that specific function. `values` won't be available in any other function in that module (or any other module for that matter). -### 3.4.2 require - -`require` ensures that a module is loaded and provides a means to setup reference aliases for a given module. For instance, one can do: - - defmodule Math do - require MyOrddict, as: Orddict - end - -And now, any reference to `Orddict` will be automatically replaced by `MyOrddict`. In case one wants to access the original `Orddict`, it can be done by prefixing the module name with `::`: - - Orddict.values #=> uses ::MyOrddict.values - ::Orddict.values #=> uses ::Orddict.values - -In general, a module does not need to be required before usage, except if we want to use the macros available in that module. For instance, suppose we created our own `my_if` implementation in a module named `MyMacros`. If we want to invoke it, we need to first explicitly require `MyMacros`: - - defmodule Math do - require MyMacros - MyMacros.my_if do_something, it_works - end - -An attempt to call a macro that was not loaded will raise an error. Note that, as the `import` directive, `require` is also lexically scoped. +Note that importing a module automatically requires it. Furthermore, `import` also accept `as:` as option which is automatically passed to `refer` in order to create a reference. ## 3.5 Module data @@ -226,7 +253,7 @@ In Elixir, nesting a module inside the other does not affect its name: end end -The example above will define two modules `Foo` and `Bar`. Notice that the second module is **not** called `Foo::Bar`. In general, nesting of modules is discouraged in Elixir. +The example above will define two modules `Foo` and `Bar`. Notice that the second module is **not** called `Foo.Bar`. In general, nesting of modules is discouraged in Elixir. ## 3.7 References @@ -240,10 +267,10 @@ In the example above, we store the atom `lists` in the variable `Mod` and then i iex> :lists.flatten([1,[2],3]) [1,2,3] -This mechanism is exactly what empowers Elixir references. A reference in Elixir is a capitalized identifier (like `List`, `Orddict`, etc) which is converted to an atom representing a module during compilation. For instance, by default `List` translates to the atom `::List`: +This mechanism is exactly what empowers Elixir references. A reference in Elixir is a capitalized identifier (like `List`, `Orddict`, etc) which is converted to an atom representing a module during compilation. For instance, by default `List` translates to the atom `List`: iex> List - ::List + List iex> is_atom(List) true @@ -254,16 +281,16 @@ References are powerful when used with the `require` directive discussed above. # ... end -Now any reference to `Orddict` will be automatically replaced by `FastOrddict`. In case one wants to access the original `Orddict`, it can be done by prefixing the module name with `::`: +Now any reference to `Orddict` will be automatically replaced by `FastOrddict`. In case one wants to access the original `Orddict`, it can be done by prefixing the module name with ``: - Orddict.values #=> uses ::FastOrddict.values - ::Orddict.values #=> uses ::Orddict.values + Orddict.values #=> uses FastOrddict.values + Orddict.values #=> uses Orddict.values -Finally, in Elixir `::` is simply an operator (like `+`). It is used to concatenate two references: +Finally, in Elixir `` is simply an operator (like `+`). It is used to concatenate two references: - iex> Foo::Bar - ::Foo::Bar - iex> Foo :: Bar - ::Foo::Bar + iex> Foo.Bar + Foo.Bar + iex> Foo Bar + Foo.Bar -> Note: a reference does not actually ensure the referenced module really exists. For instance, `::FooBarBaz` will return an atom regardless if a `::FooBarBaz` module is defined or not. +> Note: a reference does not actually ensure the referenced module really exists. For instance, `FooBarBaz` will return an atom regardless if a `FooBarBaz` module is defined or not. diff --git a/getting_started/4.markdown b/getting_started/4.markdown index e21bdc9a0..1e987527f 100644 --- a/getting_started/4.markdown +++ b/getting_started/4.markdown @@ -31,7 +31,7 @@ Internally, a record is simply a tuple where the first element is always the rec iex> defrecord FileInfo, atime: nil, mtime: nil iex> FileInfo.new - {::FileInfo, nil, nil} + {FileInfo, nil, nil} ### 4.1.1 Default based functions @@ -42,14 +42,14 @@ Depending on the default value, Elixir will define helpers to interact with the Since `counter` is an integer, Elixir automatically defines a helper named `increment_counter` that will increase the counter value: iex> new_config = Config.new.increment_counter - {::Config, 1, []} + {Config, 1, []} iex> new_config.counter 1 `increment_counter` also accepts a number to increment as argument: iex> new_config = Config.new.increment_counter 10 - {::Config, 10, []} + {Config, 10, []} iex> new_config.counter 10 @@ -61,25 +61,25 @@ On the other hand, if the default value is a list Elixir will define the two fol Keep in mind that records (as any other data structure) in Elixir are immutable. Every time you update a record's field, a new record is returned with the corresponding field updated. For example: iex> new_config = Config.new - {::Config, 0, []} + {Config, 0, []} iex> new_config.counter 0 iex> new_config.increment_counter - {::Config, 1, []} + {Config, 1, []} Notice how `increment_counter` returned not simply an updated value of the `counter` field, but a whole new record which has its `counter` field set to the old value plus one. What will happen if we call `increment_counter` multiple times? iex> new_config.increment_counter - {::Config, 1, []} + {Config, 1, []} iex> new_config.increment_counter - {::Config, 1, []} + {Config, 1, []} Since `new_config` remains unchanged, we get a new record with the `counter` field's value set to `1` every time we call `increment_counter`. In order to keep the new record, we need to assign it to a variable: iex> new_config = new_config.increment_counter - {::Config, 1, []} + {Config, 1, []} iex> new_config.increment_counter - {::Config, 2, []} + {Config, 2, []} ## 4.2 Protocols @@ -141,13 +141,13 @@ Now all data types that we have not specified will be automatically considered n ### 4.2.2 Using protocols with records -The real benefit of protocols comes when mixed with records. For instance, imagine we have a module called `RedBlack` that provides an API to create and manipulate Red-Black trees. This module represents such trees via a record named `RedBlack::Tree` and we want this tree to be considered blank in case it has no items. To achieve this, the developer just needs to implement the protocol for `RedBlack::Tree`: +The real benefit of protocols comes when mixed with records. For instance, imagine we have a module called `RedBlack` that provides an API to create and manipulate Red-Black trees. This module represents such trees via a record named `RedBlack.Tree` and we want this tree to be considered blank in case it has no items. To achieve this, the developer just needs to implement the protocol for `RedBlack.Tree`: - defimpl Blank, for: RedBlack::Tree do + defimpl Blank, for: RedBlack.Tree do def blank?(tree), do: RedBlack.empty?(tree) end -In the example above, we have implemented `blank?` for `RedBlack::Tree` that simply delegates to `RedBlack.empty?` passing the tree as argument. This implementation doesn't need to be defined inside the `RedBlack` tree or inside the record, but anywhere in the code. +In the example above, we have implemented `blank?` for `RedBlack.Tree` that simply delegates to `RedBlack.empty?` passing the tree as argument. This implementation doesn't need to be defined inside the `RedBlack` tree or inside the record, but anywhere in the code. Finally, since records are simply tuples, one can add a default protocol implementation to any record by defining a default implementation for tuples. @@ -155,9 +155,9 @@ Finally, since records are simply tuples, one can add a default protocol impleme Elixir ships with three built-in protocols, they are: -* Enum::Iterator - specifies an iteration contract for any data structure -* String::Chars - specifies how to convert a data structure with characters to binary -* List::Chars - specifies how to convert a data structures with characters to lists -* String::Inspect - specifies how to convert any data structure to a string for inspection +* Enum.Iterator - specifies an iteration contract for any data structure +* String.Chars - specifies how to convert a data structure with characters to binary +* List.Chars - specifies how to convert a data structures with characters to lists +* String.Inspect - specifies how to convert any data structure to a string for inspection You can check the source code for those protocols for more information about how each one is used and how to implement your own. With this, we have finally finished this section which has described `defrecord`, `defprotocol` and `defimpl`. Next, we are going to discuss macros with `defmacro`! diff --git a/getting_started/5.markdown b/getting_started/5.markdown index d7cf7338d..b96ac58ac 100644 --- a/getting_started/5.markdown +++ b/getting_started/5.markdown @@ -95,7 +95,7 @@ Which would fail because the clause and options variables are not defined in the In other words, unquote is a mechanism to inject expressions into the tree being quoted and it is an essential tool for meta-programming. Elixir also provides `unquote_splicing` allowing us to inject many expressions at once. -We can define any macro we want, including ones that override the built-in macros provided by Elixir. The only exceptions are Elixir special forms that cannot be overridden, [the full list of special forms is available in `Elixir::SpecialForms`](https://github.com/elixir-lang/elixir/tree/master/lib/elixir/special_forms.ex). +We can define any macro we want, including ones that override the built-in macros provided by Elixir. The only exceptions are Elixir special forms that cannot be overridden, [the full list of special forms is available in `Elixir.SpecialForms`](https://github.com/elixir-lang/elixir/tree/master/lib/elixir/special_forms.ex). ## 5.3 Macros hygiene @@ -107,11 +107,17 @@ Elixir macros follow Scheme conventions and are hygienic. This means a variable end end - require Hygiene + defmodule HygieneTest do + def go do + require Hygiene + a = 13 + Hygiene.no_interference + a + end + end - a = 13 - Hygiene.no_interference - a # => 13 + HygieneTest.go + # => 13 In the example above, even if the macro injects `a = 1`, it does not affect the variable `a`. In case the macro wants to explicitly affect the context, it can use `var!`: @@ -121,11 +127,17 @@ In the example above, even if the macro injects `a = 1`, it does not affect the end end - require Hygiene + defmodule HygieneTest do + def go do + require Hygiene + a = 13 + Hygiene.interference + a + end + end - a = 13 - Hygiene.interference - a # => 1 + HygieneTest.go + # => 1 Macros hygiene only works because Elixir marks a variable as coming from the quote. For example, consider this: @@ -170,14 +182,14 @@ In order to support recursion, macros cannot be called locally. For example, one In order for us to access the macro, it needs to be defined in an outer module: - defmodule MyMacros::Support + defmodule MyMacros.Support defmacro delegate([h|t], to: target) do # ... end end defmodule MyMacros - require MyMacros::Support, import: true + require MyMacros.Support, import: true delegate [values: 1], to: List end diff --git a/getting_started/6.markdown b/getting_started/6.markdown index f56b17138..088eaa8fc 100644 --- a/getting_started/6.markdown +++ b/getting_started/6.markdown @@ -78,21 +78,21 @@ All functions can be partially applied, except [Elixir's special forms](https:// ## 6.3 Use -`use` is a macro that provides a common API for module extension. For instance, in order to use the `ExUnit` test framework that ships with Elixir, you simply need to use `ExUnit::Case` in your module: +`use` is a macro that provides a common API for module extension. For instance, in order to use the `ExUnit` test framework that ships with Elixir, you simply need to use `ExUnit.Case` in your module: defmodule AssertionTest do - use ExUnit::Case + use ExUnit.Case def test_always_pass do true = true end end -By calling `use`, a hook called `__using__` will be invoked in `ExUnit::Case` which will then do the proper setup. In general, `use` is simply a translation to: +By calling `use`, a hook called `__using__` will be invoked in `ExUnit.Case` which will then do the proper setup. In general, `use` is simply a translation to: defmodule AssertionTest do - require ExUnit::Case - ExUnit::Case.__using__(::AssertionTest) + require ExUnit.Case + ExUnit.Case.__using__(AssertionTest) def test_always_pass do true = true From bb418136a1e32efa43bedccd558b22a2aac49efd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sun, 25 Mar 2012 23:17:39 +0200 Subject: [PATCH 037/437] Update code.png --- images/contents/code.png | Bin 14811 -> 0 bytes images/contents/home-code.png | Bin 0 -> 14863 bytes index.html | 2 +- 3 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 images/contents/code.png create mode 100644 images/contents/home-code.png diff --git a/images/contents/code.png b/images/contents/code.png deleted file mode 100644 index 9ffedda783a9cf86e3a95bf315b9bf43adfe7434..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 14811 zcmcJVQ*b6s6sEt}wmGrwWMbRq#F*IpV%xTD+qRR5HLl;mun*jhU9ZL}rMJW*xVns*$UzRpz z0DwElvX+~sid^GvqO`E^HT%O3ucZA#ksG+MMZOFawX!G(hE141sa}Vn2sn6A7^x%* zGF@IlL7ApvoGa2>&-L^6N#}F#`|LK~`u*h8<>ld2)^;{Gz=0u=j8qsI9smpxlh{bd zjnmcLmRu_Z1PZ$M!L^Mil|lR9;mO?ewh*b*(QQ$fy1IPU8h^6}&95>>fC5ax8hyMA zsq&e6AOQpZs3;xNQyNeeY5@)ip`J>`g#K}M;EZt2=H_nnwxCRY=lU(8 z-PoteKD|m%rsLlrecc=E#or8xFO`KMI}ThEeW&VKNWy#f`f^gVQ38W6Hy;u3K73AO zI2!zG`EJ~JNe^3R4ROLI8K>q6ORkL1m~wqq{EP^`CDC}X2Te#a!z_aI;CETa1W7kW z_8C2;jq~;eu+a?PaC)f@dLMORNi(nCq7X}3#Yfh-2Q;xqww3CiMwmj#U_G<3Pxn4j zr`!w#3wuwYfr86Jm$C4H;kdRfyjXCTPW^ihk$QN0?Z_2)gy=ka#dlGYtzOupbXQbbxGNpLw5&;`4|33lVza?g8lD?{7Ua7)8VNG{55yRy>%T zd;4tFJ-CD3GgJ2%y`35tCHETQq6(;xOf(IC)JV9p40t!C=?4JMtgEwJ7Nh={kHYp-s$Il|EUqryj#M1!=%v2iiy=l2XRqkC`3v{M%bRUXjHi>#rDh0aY1T8Tt~lD#|&_ zIb;PAdw{l3bzaN7C>xSCY;`z?NM|0{-0xF5XOIqDAA;>z-za_2?><8&8*Jt%++U0% z7-&H5Fz%3cf6EbPlM$v`rbU@@ihw@%qPAU5HBd+7`>sI`MHIgMXH6g zxwd)We9Qgo~T0xmvt5+14wFUFFbnsYT|0hYI^$QCuCcaD~t`VCb*^xaEd_k{kY%u_JKom}Ob3SXfwTn6z0#SO`t3Oz@4pM}cOjW-Pz%%qC1L3_B(t zB5=m(hHS=Ujb;pMO#hneoA%d*)u+{i*B>^pHAK}_)v?smH1gDsG-5WoHq11Vtc$Ks ztqHH)t!b~9tohd8H(WHn*PAzT*2gw}AMPE`9o!s@?OPnXPu)f)4p~m&OnD^SQ=G6e zpr?|j(re(aiq-hmnAu_4(c8hgA-d5%(;)>)B#g$K5Gz2;GR@L364g@MgI{~>baqX8 z+jx6=|MWJ0>3B(bNq=>DDgQ8kxxVS8tWS85A}JD9CbAUsmoTgqiV{li3+oHXOUo-X z>@aNHVxk=}!^zjr$1w6WqTMIo_uSV)$qMU`%p2p5{~4cKU|cX$AR%fW(Svq? z%!($1UWw&JBagm{AxNyxAV3`uub2v*(nfqMiAqvVibJJE$4wI)r<`0Mtrv%zC@y0y z87h@3qcDkV`e0^kc5a4gx^7BuwrFNQ;hTV#;*`is%}LctUrS0vYCtVm+E-*)6IU}= zbEBrD9ABVW#Z@k<%AzE#W~K60Kv#TO>aFA<9;`JieH12LJCRb6VO3<6c%G0^m(i*n zzR|=J*%AH5{OE;ifdCe*8jTq3BBwTOF|9s5tIeX_ukE6J{S!Q0*jTuCF1KTBTF-uB;$At5K_cUEKrpjq?rqq6G5@k_@_l6hvT0NJQw2juS5t z=N2a$ksXN{5gVD61D6ApJ(p9LRg*=^aJ?40ZeH_pyl%p&#Tl+zu^HB#=3DQY4Ky^e zS2Dd_P+nkJXxN4|GP85pI6o7J_c406(+0Ch^~%=6g03`mxY96P6?vhq{aVT1GL z!jD0T<;HJBu0+$p@5DSocVo|C7NGOx`pH7VyKh?{WxV`z>E}fM4tYRPQ&F(#=V1dn z)i7l-ry3PItIKWNS^lKuOVeIc=-J&_=|ZnLmwA)<-7mrkZpxlxnhK z2_=bg35kZ}hFNp_lb7SI+2mRJv28waZrAU&f!l!tUdj)JsKfGOy{XZ|&?ANHC4P@r z^n>ytm0Ee7?4I8t&J-t8&yD)#p|DAC(zE-s!&#Y(O>{QAjNSs@AHS3g=MRj7{v4y` zBwQxsVtF%087y_KsZQu*=)7H^J}$_nTdqet&ff*X%8JznKZpajF&RoNbTFEvv& z*}UOy>YZdAsa~L-`j4KEGutlhyzAzhoD25ze)fH)dw=u3_OiV;o_RvpLhZISdj0ML z&V%piJFd4mu9_(Ztcf5`QHk5ng-oaU5~6vtBXt z3m)*^|CJg`WNfT&#B&PGDabwMGjUhH$vW|Pg$u`;zOT5?h7*SyWV|w%=`QGcyWu&1 zJT^YY`;!^i`eARqOWkv!$)e@?u=Dx(Co~KRZ&Hg0M=-@3_1pQXapzed%ka};_FQ&0 zv?KZJvlam68QRYe(6iFV4W!ND>z6I_Gj}Hu!wu+h$`${>;oJ+n+nvX3_#7y|8>?tm(6;Pd2G?m4a`z#P!Nn52~ z-p9 zFbLNe+b#T!Ak272;HU4x@1{O<$VH#{y{p`d`Tga;-j__AVW=D?Ugo3e?k+F79FQ}1 zqJ+ncUr+NJ@fHg84lNTYhQdeQNK%dGFby+TKVd%cl_JtX^sG$B)l=T~?@;|TT7k#P zD-0#A0zcp9E1gfk0Qcy?%l!{A{$YDYWX6glPu&TsN?M}I7p-BHYJ&r}SIMiRj{dh* z1YSA(={pTs9X@Tc+Fu5p?w=FUF_~_gkapX)y*{1wg=MVOk&Y6znceR`v(-CIoh3eP zJ@21dU~gb}L92fukYEs}cLZPi9MhQip6U#TY?JICjtVE3zklD}7Ke9?=Zz-B3d$}k zK+Q_ddV4SMc^S%k*j-tUHa4A5ForQwoJ3;s8Nl}Fdb)f*#*5W*ZrBI!Fw^Dlk_qgk zwhLDHIDUJZ7Jp7Y+fVEsXmt7-uiC82_;#-+ZAYxz?XJIG`H`H$4q%Lj*@(3l-u_b( zaNZS`B_s!24oElYO_1Ph`wX{C**N?JpYS5wCeVqvtSPTJlS~%?9ZoMw3A_`v8rm%c zKK8C;Z;TI&BF6xhe#d<2ecX8MdGUJ8TWi#-1b*eug=e!7GxNioaX}6Dk{4A=br0>M z`g7n$*_%(a?=)fcrdN$6=eg=R=GoDiIrb0^B+eD*j(LH3MO~`th#}&X23?N!lMeeO zudUDA$mq(H{7%jyh@++>zFWtY?oq-?#_92i-BrDLZyIGI*5Tv0R}9~wQ=;;b*9POF zAU!cZQ&0v<5@8lf0$~P93Q7)Pye~073qK7%5B;&?Wq#Yz%MvhY=rBl1N@^TR1yuzN zad>b(K2<4s{kJ>I#h{WYhenL?-yM^k(F1w>$;v5v!PnEJ%*9M|9JrwwORSBYXGUon z0WD>Z{LeoYXO%L7lQ0;d$rWnH%Q@`v4nXu(_T^_bS&kmtH<#eKfmIqeweO5=mx<`I z%ye6GJGFjVO@mR_{pS zS>k4d`GnIk%~9rZ?y@v|;(|GuR_Qb8`2zK6YFP(<6CY7u-1l$+9@P-nsig*T3=zHD zPl$A8e#pAMFVtScPn9oj8_UhPxvRVO-dk@^o8QWLNDcnKkpG6oju{@}(hy7sFpQQN z682GU&}SHDA=(l80oCK5AV^Z%Lfd5B0(N2oQu1?e!4t6>LE$3I5}G6EbG9Rba!r!& z1vGHn_+r^>xrl~1C;gI>D3Qr6NXf~Y5ONDQMB#=ChHc4*esKI4EvhI&Gp#a(Fzp?C z9LrU`QBP9S)i@7ch4NBET;^_8c4-L78wvbXo^nF?mw$1i)TPQLyyL)A>k=7(c~fut_mj^^2zAg&1q;f8ko>Scn99hw zSjVU}IQ<0mE_-683aVnx>hSCKW`90|s-=d#;YcuAZ-*C*#@RiDWuvSl2u>Pqo_VoAlN=55E0U+}zhO zyCP^U<>_%o`5WeX@pyU7@BXZ7pz__<*Vun8^6-2_$c0GcyT%^jamdcWWyJjISYb+G z$8l@<2)89Xc;RF}Dlp_d^Ip@sQ+M$#*j&8L4^jv#l+4gY()S+X!wtY70ECqdzDr;L zI79*XY=8k06rtHoz@g_??k5;1l@QpfB3A&kVqhhqyhAh@!OV}^Am$sKf>3l~C@Pd0 zkZX}jXgeSXDfDmL`C#|hL!k`PgSh6gQYy$K7#f_JarHeuI^>ydOlHzFAzA)oR&|KX zD1tnryxY9;;@9xaNZNj%;mrNXTb(AmCR=bsVbXo>`LH#iQSnsq=k%RO->iOMexg!x zeXvwYdAL^0D@`P%3}Yq41-uSm6W2>1lw3lv6bTDlq8#LzQ~|M;?;72JrkCp*oLWps zdM|uWi3B14c>qh)My$R-&$#~2-JeO+<^&LBW992&JhK8*_CsXH!MkACo(O4a$zrJ^ zt7K6%Ja(mK+egc2^=UNiey^$KA1=^5xz3ai8xM>)rg-9b9(X$G*cs=S%SdH*YMRgn_+vaB_roFcinQ1)0_mHQIREW*h zqb0}CN;TEHq%AD3tEQ=a)iU3m+nCx&aDH4yxM#p)J<7s&!GANNcTb5i>%do3dNiR5lLDw6?!P@fZ zS4)Jf>y#Hvi%3ok^jyOxU*LIOoB<|?6`tuFzJ9u7ad4;dJgh+m=T0bio`BC8kNG(*O! zW|O9?7Q(gHug_sj+fkF+W5WyV{iN%ybC#oyBZgz6PQm5Ib?bnsbCaLkmtLdxWJ0t| z;hvP(7{)lB95y7vUqaf4qD@>~WYfcyKhVi*et3}Y$|Vb^rp1hhO@73Q3EYuyl9*qn zP2Z05t$w_!EU|7t6a-I+js1CqGmsHX^{LjZ71#S!ooK^kb=U1!^f=Ls#ff8o)t$Y* zzALwRG3WMsZy0$K>>xCtaNHyvtvnX26d@PcJTzy7&)h?)hxnu6h23@jTW*#2Pr~PW zBayg3fk3(MlNR^W(ZuSw{jPet@7M>M9$78Xhl^FA>;25i($o9ymqed}AR4lNu8&jO zc^cxxe#Jb?5bT)vLbHI@ml>M8}9J zc$v_-+%6V0zeTrxZc*| z=c)>_>A2Lq6d{1j24*knVQ#^1S3Vu^4R)7|@dz~c*!bdn?Sg)m1@(iHjORP;dy!6% z)+_DLJJtXCeFei3jv=)*4pBZ8Dqq_83!MOS%8IKZg+K1X`SLSdy3NoX{lI5}jyEr?mUi-$mx68Zdqg-Z7_0tIAEJF#e z2>+Se^MenOMH`l*feW@L7mKG+6i+@|JI^v(qaP-_#+~eg#}VJV@Ydx1Dt;t~JsRrS^%`fqeQXbrE{6Wq$Nq!Kk@*I$-PIw_s^=|Z zi2*m>ocO@VpOWR{NBW)WK^>XRw@tClUDqnt3b#+9quPg302~VZ-rd1{cD8*1z)%6C z&c)H(ywKa+yb@HNW6zCvo5XKN<73BqFT-nmj{*1eg8WMVyZaN1iNaUwdG0apA8m(m zkkoPl0N~L6YaoD(ENlRP7$7D3Q`H^hO3y<`MPsEm0SGSaUx$sVHGm7v5N2qqL`&1; z?~;zVqP|(qQ{Z|U^_iBUUP|P$QLbjKQ_rK_>75dzV%4ltw1SXYfLXa&T`xBy#8{W$?iM21*DHOLRO799gMe-At-9n zVd|rOloKY}c35jCz0k1_dwv}R{@Aw@MrJN=dO9c$I0cD30ax+kd5YfBP1X-6@L;>Rn-Fi*Jtjv!tQY3w!#Uc_C7~bV($U=Z z;|8J`qdh&+VE9lJt-p`lP-JaocS{%t8abGzOb!VNCSUEP$^9mH|JY(S>^2!igAb<0 z1az5ua0O;+m22dm*)+xCTTAqY|Aoys6F$#6PsAw)tJBP(@9nsrtgM>DsD-PFi1B@m zUN;}jE5b{UBVs;^7W3AC^!%y5C44kUnESY@iKyBntK4JR+Lk`6L(tz0p{|cIa2VH< z>omzrM#lL%<_FTnB^c6BO>MGz)M$(7_pNjKN&8$ndbbYP;&Sg zk@;@>PGK70WcEk&r(s}r;8?C`Y5U_P#TWvm#t6Oj+|`#IARp;8^L<69jyM6}5cg3` zbP!}~(EwP`f$3TBal@E^@}~o+KFLtusFqUhwkE_&J^VCxsB3b_VOs;D>Bibh!XhK@ z)TrNZVFh~JF``k`PdnO>t;?tSC$kYctnPb1>KfqcfW4W5UKEQN1* z1O^sP+|16!nwyAxVmpyLO53>aC{n+I8GNXr)xlL(uh5{L1JdydD7UMj`a#{i)JCr+ zL!Z^$KxU>~oWwvN7jb&N1%0nYlBIXHa#9&pl=F>C(C_e?pRBSC3=3UaAb)g6io#KxP7 zcWZe(ZcXj5l8q!nTXCh?D%i8fpB;O0{qCGYqb2sD0Da++nM6j*y6zPBLbg!TBkGed z=&)j`w<7Qo`4+&8Bz!Ul^Hu$|TeFdvkAVTiA#tO2326MHS98BhlQ;Q*X0LAsar8M| zXCXhR(BQU4e>yWxPi}~oO1{0T!|@RI_7|wDo6-S7w>s>E##Qx`R-*MET-p}ZE&#^ZaQX>stpaEwkG6I|)olzsG!_G!`bO~&dFZ%zuV5Mc_xlTY^wV~6dyR*JE;dGBuAb+6u`1~M3}DlLh!d9zGnx`% zY)IIVT+#XW+$GJW^d=L}?4~(9L7z9nTCG$YLa1DL)sApxuSZmFzpVksDkH>x&mbGu zIcp^0=c>Y};6$4iiP`(Ke%;fwqT86b+Ey>b6%_sHq2!rGg-WVTr-nhXeNj^}mP6a^ z(@G_$cqr4}Ab^d-O=R$4S?%xZ+gp4lLElc^q!q{pk+o=UujwynIhTtSeuVfE-vG;* z%HnNwq-S@oxGR3b0~OPAm>kUwL@H+xQXXKt)`17P2JT_sQ+e~3Vi@Z#ca%b3VLZ|` zM+HJhJv3T2>oA;vf#JDTKo-r9H{rHjZzRq2_P&#fXspoc>;p|L69}P7%`?IxDur5l z=O6YL{?}?mcq>iC<9ruiok^J;g1qmIstm^S10odct*J+k2XBrBZ;}cwT zP_l#u{8inEGMSyzZ)qDho;8IQ2#_D7BxSDeTo+DV~kFC?0q12EZ((XPQ zLC3>Cy%aIg3uNXxlDSKPi~<<-Pkw5S;i`5bt2<&jPA3phDnF6e*7M9b3b4IZr+hig zI5K$l$#oiE5>G}Haw-{W+q{a4;9s5<3CMEf!u@Hwy!bC1ahi5ZHM$MpqThF6M&N8# zgazd2lmy?LZ6WLsjS%xHnv!pt$z;84tR0;0I*S1hs4NeW`}YJk0ia}Avu-U{DUrq6 zgJ`#!a1eBJRyn1;sDIFSHYbOdgEuH^YiL*x4S$1LbR#^Qotx(yjqJ^EgEW>^t37Yv zdi7nJS!21On`Wu{?f(ugAXZGIUC}}Y@R=dA*JW|(;#QZ|BTk2AlYW`!#~yAnD)jdw z8AQJgJuSovvo~wd&0DF=lH1ZJoY&TwFTtorG~nz>8@>9AE<_amEQsF@clR7F2D{sX zz*F)xU3N2-L`fqL&BYm%l*I!?2IbF z6k?dEUVyO?(&@B54Z$XmT~u=Whhp&` zA8_Gd_Wg?_;A}uIfknyl7+SR?hoZT4-E$|WGY+2%zoNQeVllV*V5zS8xu+X2DD_05 zV`1~Cc5a4PrlC4jhH^{&L+){|sf9Hd!!ppO#+9r=;9!gbiX`A|0tvDVx1=61TCm(P zZF-&YF*6;OW%n2Pnij~CS889SCY~QXMst-(TVouGgL0m_%_kk_1`~e~uX@VZ#65pz zu#2&z^`CfMLubVK7Bqkhy&XbJPexMG{9p=V>Q@pku77LX+X$cr?oceS&O>PH1*h4_t z(8Hs7@7vnx@`o$Cw zL4h9Oy8Pn{3#U&+7+h%KG)V5(yZ`LaGpIwIA==Mg=RkPz$QaXOuE;^v7Bma?-Zaj=eg%Kv0fe?&XQII}c02LV;FH2y6821DEfp#d8O1j{tuuMcKjF}V zt>ly*Kug})7;jA2wOyG5ffLaFoc{S*VfmR1cm=mjh{j8x}KtAf6& zu+yUTv*cR~zh7LjHWxpa9k4u~KmAbYnk+>TU*MQo&yGyIdbV>(8jlsiR|Xu@1or&N z$)A+KGH>+Q&mln8fKX#iEK#t3j*O|6ZM)GaPr%v6&1aoL{P2P-&@lt&(SHJvMT1OHB-%y7FadxXB}a;u!%ZQj0v+F zR`=k4^kI~}jgtANERqMKw!OcdxK9|2Q)~3TYR4`=+c;_vE;1G_4!FDes`ue-v1^a4 zNX@~pw23R`js_-W$1N?V`DwLQ*+9c=hkA?%Enpm31j&H}5DG+@D+lws{mExs!Yjjz zFwl)4;(>C5W09}qHC~Gp;9CRNihg%tA(A)eGtv{$B0J(`N)u9Bu$p({y%?nYyt1;Z zrCt#f&rXN8pVL^%huUAtUic1EZbY(o-pG8CM;L_JVw~pD&zr?NokEtxwXL(%J1%C6 zWy@{X0%KpW=|NdrnzdYGlsv4NY_dVO0+-TWo}KkA2g_pG@#UieGJ`lz=(E)k(JgJw z+uD7Qm|p68wO*e;TtV-p=v4^lGr8m8f=U&_a=@rKEs#dC8sO%9=6Oc-Q)DL~yhALx zAef<_7a=@hk2pPnZ%bT+HY>BPO^B!3KlD*7e&QmaWz=L(;ea5VQbv;zN1-!g;u6bo zVQLf2^GKn^l<|xTV_Oc?&%K4MNM$&PE^}iJNTS6AuShh>F969ZX6li}GaTre1PWXd zDDahBVuG0#fF}8mDAkE<`(YJMbijBDe7NdZi|is83Ds;9k|?%)O$#5<3vxNGf^&R0 zqav75;R`ZtO3MKhwG&NfymThddmJA^=H`#>u=cC27ellLHewN=T?EqSs-@5wfVDLr|{i{8a9~2ma z3;Rc!6Zr56=wFy{n0x%a-9wPF-lSWZRz`+7B8C-+KVsvCJgh}bo_`WDdB0s`#0%Rk z=!MO=nYP^3InUKdP`1RSC^th-B+;!DRJz-D=bt49AUX%3h89Dhlv^{Y>IhfJ#${hR z8CiRww$|tKnXI;>hKlcP%w8#3+_D6{v^REaM`B@WnLnxUwXyjD+V@3`{cM6}>1+Crkw?>;#f_%M+H8zDRwc8)O!+Bxg$Zk^?+Q z@MIs^mo-HX8{EISo#8}GHXXbNWrV-!gfY(KxE`21=jOq*XPk+7RhgB_`0tCwcgZZ1 z26r*Cze~Vp_HAvCIEVTD`PoSj&%cf?Y&tJLb}Y zu*>I-d{Knr7r@jY#O6?H{t7}Vz+TYyK6M%WYQ3AKi=5V0DTARZpn1}J6h<(sGbJBs z+-NB!KNt#~$WzPt^r)zMeN)|T)8N+Rj-)N?mljK@c{6#W92dAyg=BYal+mCVb-IB~ zM)~PqhPCHWEEYvMT<3YyMk0iBPPWVHJ~Wa%~3fecXP2DV7G z6HxaF19}*88ZC5MIm-ZJWmds8Y?#&{E1DVIhD(H^{IqFv0nGz2DS)o8pP2Z?lv=!l zIr{M3bSB#ALqwKODC`<<%Mh(J>*JG?gXY0>3k2HB&eo&PM8RFBLt}_x&xy5)?p_GD zbn>02)YKN)!>aiozx>C5<64yAF`65ggOv(B09#KP$*#k#gU- zqj@N(*F|v!wx54ARBsUnT?kxd?axs^|IDY$nt_LjW3kG3E7-FcnY4t;z;?BJ+NkrQ z>!>cY9uxlVcxdWIi0P;07y`_Pln%CIwfuN{Ausv9&%{-YJ4VS#I@Hg}$yxu4+k<#V zZufpNGM1TJ^(f^{1g!cXh7h1joWa*+t>>{8GyWrU<^_j)v{+z#0^R}I7ZVX1E0ZPY zgo_8AD&MSvzkMt2H~8{|*tla|Dqo`$!z@QQx zJUQA8l7)@dsqkrtgRPs}_S&$ke60(k1)wUbIq01|Faf?7Ig!AJj0jwaw9KdLLe`$` z#F&s&%4|sVVn(rQKExoQYIje$Lz4o+wo)jE%*WEgMw>Mz<;coRrXx3jJP-k*`8mwW z>z69Ab!rJlTTn((%YzJIH06MTRpO9{qLyQ%=52}88{aYdS5X2K%k`=779aWxzXT32 z@lMzW5zDuyfySD@kQmTNFrKqVfA^FA^rv}_WNfqKxigR?l%Z* z-&op_Po9F-o@fQE@mDXstL1O!(cuLTf)qt(1@ZWrw_i+uzJvl~vx#Ofb*M zj3dvJaN6i8mfutyu?UK*9^#U{viUVI@~TDXz^AR3eW(Nqo`x46u-1`mS! z=tDCVp9QM`lS7lSkUq@q5h)$P2ve#Wy^s15%#mT!=baZedV1U4SM9wCOd{@8(6;e& zDpy@4*(m64X}Ae%z_KMSUobfd7CQP0V5IA02{c}@;9(DByPpJCvo`nO1aZ*id?^&b zqUSDT9y5t6aFi={)cgI^g05KF$y|I@rr^_15_RF$lkx-zAp}RKkN)K!f_J(PKx4Kk z8V~Aq=RbIEQf4ju=VVqA@S^i1R|kVqN=jFB&ZmBU#Q7fiKQn3OIb%D`FZYLY>ouRQ zOlzysBY`YsNPpEF5=moIpm(V80njOo6I(;1$?wyXpHn}s4(wxRVsdx%L!$3bKQA``n zNnvnq8DXcCmk#Pqd1;;u>&l+8>ws$=Nj|nsFZu76qngcT@j2%=nU@SjO7yQ8a|Zb4 z((V!b8_$q;{i9uz0iW82MUnP~5Zer&TEGT^6|{8`5=7jL7N>O-i>DF!2i1>Ctg*+Sk3=hc1h7+DumUz7!I~o1n&q|@( zj!_lRsQVF<0tz662}2Onw1BSZi$5sHqChG#mQjv@%;mGyz6{h0HT%NGOK_i$eK&6I zYmyrJPULf}z6!K$cuUB#7P|9P`r$1(uf~6m{M+Bs51D8US|1zP6~f7Ld+NMPpFlWe z177~zn4FD4epl}L+^w<&5#R#LHDc|POnaIx5gs!M45m;g+*wFA{G;eu@ikK(9ylj? zYh+(Cn+NK6eyuzI(o~BNCW?WSL=(X8jww(@wP69z45@tC7m<0vj59=A7&q*rFeiNO zE|c=^f~C)gC(<5R6%Uk?qznSd)O1A*sG<4L=XB4`_@6Uyl>H??1LXP%8N%_~Y95Fg z#%x=bfg2s2+|^C3Cf%7ouJVO7+WdV*=mfyGz9%f-2V>p#4Hg$of^5i(Yg1fe(VKv+ z_%Iw=kQ^{v@T2xPCE!W3b1(Qog^;?g9Q<#tu^3w3 zRT;JsbekB=y&zl%KQNc-!uzi1vUBXcTSHzr{C@z)aqIcRo@cDLhWxIva5wyN<`*CB+5c!OjNx znkk}9V2u3Fh?+aXrbYUl#xo-!nHRhW@XR=QNHC6l7bp!WEEo@k4(o4?sAn5b>^amP z9P%}wGYfVdOf7F4=>3U(?bG6IjvNx0_IYj1H}Ib^5FEEYK0CLiNn_Pyd6~)z?>miV zs7SePC0tZV6$Zn_XJe&OiA=P1VO-#~KdPA;p-^oa;BAbRss3+D(I~3j+kF!gCH(ux zgC)yKkD0#Ah*@~8+n}^7(XH@|D$& z2ry4f85geoVN3m=DS_uWq-&4!3rzhb%mFENKG^1x5HKA3 z2wXF=l1m^7;%rD{%`7$lDQw;J$g=u>M}letd%&&Gs`kWuX|k4->4+`~B0|z%BEb+v zc#N6Lx^7+A=g||_`-=viFc>vNI8ZKD6PrIe8QxdNi^%!uDaG}f#&QGu6dM+XgJ0U{ zA?~QEbx1xYuc^zuK)HaUsHwY9bS0s*$zXWy3ye@9Ac}nLK@vExk_iu31}j$Xok~$r zP4U%%Ay*q0{29uYbc2qN4W7y7>EAY-7Cf)gn)h7Iy2>V3|B?!x*+he%0&*a&}l#@*~JHJ`g49z0-pGQ0w%0lLyezA1@ zG>DgKrSNHNGXHn6RK@{73Hm6)f6g{!3baABAytGuTNf=#x)mdfkGM5s3|vW|AXl7t zA^rFJHh3bnptlqTEskPDwH)~WI+-I!!Ji4;#Ev|!Y)}d!a)_WxGC}l4#YVJ4&&~eC zST7)K-wF|*ga0Rl?>t8i*#8{XSx~5beqpK~%2N)8AN}pi3ushoX}__1>S6AJp>#99 zj>pDe?r~q@&%Eh>j@ndkFe|T3 z+>ct`MpWijY1UVVSe@9+W?^FRQX+eXG!*_hI6&R!II)>OzKnKS*Rl)`x74~EV_(lK zM90MMPyxoYN11B>Cjz+jzAH!Fe_rk zDm1?yIIUq&51lvJxcFGf!D*iOF=-pDpc!Ug$e(*}Bk6~lv%=k9GjkR(&d4JjP2jfp z*!?}83!f(nty_lv>CU-#jC>5Jkk+Ah2VQI%9^0_-XBz5V27+F7R`tpWE5Xb7HVRe2 zsKWwDQQ*dIZM1#SdgMPBoGHP14*$!<2-7k9Vqd_faU=Eve--g>RY^=Y!tCl88&LA? thAEFE!hrk>AExiW&4ddOVw diff --git a/images/contents/home-code.png b/images/contents/home-code.png new file mode 100644 index 0000000000000000000000000000000000000000..482aaa084cc26e8f6cce489287eeadd5454929ec GIT binary patch literal 14863 zcmcI~V{j%;@a7w5W82Bbwv&x*+qP}nw(V?e+qP}{zrVVxtGdru_hDvgYN`i~n(n7N zTuw$5777ar006*>iwP5s4upQ0EmC zl&Q(Zxxl}7-@I&{biDL@%xrP5JxokqULH}V5-i3AW}06`(bqU-5caavki zVymTq06w=~=+?2MGDvT1Y{}c6zxaxE)SIM6F3w-I20u)Jb1QTazyKqVMsKe|@_hPk za6rEw5+WunzyY>|FCsF=kKr6IN}Wg_ME}zX9pbZ(s$=zpO{CCgf_)Ve*zXwN7s5{} z3J%~$2{|iLlK@nOnt=jBC?->}zyXcWQO@N4M!EoYXnoAH+1Xp|O$bB#T;B!cTiZ0L z=QmNZbevoG?+4x8_}f8|#j-F2hyEM? z?ps$bqQjOMJs53KBD#EJvt8w zgSOR2el?8YE&2NAVfqkaD35H6)7{V1NmpII z!k$yeAikx+%UGCza4hS;T;z(D{$1Q4PX3z>DO=5SA3Mjode)q`yXxMUvheDX}-swOxVA29&EFf zcA*b?&Wzk*w6|-V<#iSxeW%`925Y)^mPc16=*Dcnt&t^Aio+ECVCFT+bCSdI3)JVg z`oTzG7RStso)t9d<$%)z)#^_H`EImU@-;2-{iWyrvp|7xeEsd3+tb#2*24UhyYr(D zlovz2qxHQ33@G^8-#Y;S25!TG#4Pyrn8opZ9KMRgP4rRJ%@Ybb1NLb@exx_F8^19= zrmkN!Km?9 z#MB6IVP9c@K_DR_B4m4D`7m-(W&#@m4+MCGSj2}g_%LM>{&}LcIAAf%BF=dP^Jpi* zcVgmricuURpaz_^AS+QgBC@!LQR73-e`kxt%Q4zzT?=y*ke7j!p)4{eA)YgygIB<_ z_-pW2=lz`%Vusg%st#ur?8pO|wLhhH0&2(d#@&kbiP91J>D8mR!eEHPGNBtrMGoQ! z;|OWL8b~`8rCozTQ##nd*=QNj3Kt7)~+d3CC zSG0gKyEx}G7q!q?yw=OGD`c0!Zka_#3zQmKIoNz4VjtNG%T25UQycBt3$eFw8~jS@ z#rI9|jZH&SO;8P9O+%CXj9^W8g}Uz91l@E2N*X}Y7q|N-j4+E}5uyE;EaXm@PyxAo z?5Ri;X%4|M(hX8B^2%x2nbFzgsn?mpS;U#mZ1jS6!N^?X?8SoTJlQ<@tZp%Wv93uk zLl`3lV;rUeMg*n}gA`L0BO?WK$s!#nx!$spqy=fy`eQe{;;qLM5!R^85p4qY6sfh^bz{R|}?el3M9=#Be!N9Tl>m6wOt zA1~9__Sclx^f%|%@=w#(o7*0;`h-Vu!Xg0$d~;zxQN3FJDE{=`u-=fow7f#ScD=@3 zCc@6R_PCx|%zT}ERDBmyitz$Kk>N*1_jdvqC&P2-N*+BOvsWb zmFS+7GAJvkd;~hQycGWNa;cChtps;sNQC7?nB?lz9F)Ov3dsc$+HqKkB9fM3q2j5M zvJ(hKkH!YZ=f-G8YeqE23&ytNJ_*Pvj)`0pY~(F8wM6(tx)gk+y+wL8aW%6wx61Mg z@davC?BzmAjPer77K-l$)Ww&jUh?iD!RkX2M`04R<0%yx7DX0`=Ls2g87&&&>rI@I z?a}WHPo7w2uprS&(Qwhu(#lh2Qz}z48jKo!8qOLw&tX@08;Wfw$$#@$)jOm-bwY~{ zsvX5mbyWFNt2Apq6lBF_RBJVEs=I@H;(P+X$w1r##R4zD`CwUK6Ja}|<3vhCI7Ent zrG{gMg@yJ% z#2(5VIv?Z_x(#Ir1r2ureF7Z|j~^KqF&dG^m*>8F>7OhXIeJb`ZsDt>$qenqjuV3z z%YoB~P>HOG(}8w^;>wc4z)S7J{)dr}YtOns++gX?;-B%pZ4&>YrlMe@ufqlu@*%Qf zHf3@aCg;1jv-}D3*QVX3(6jrq()k`!cGD))dlS5IFXz=qJ8v{?6{F=x#A@PVQF+mF zQPGCvh8a`alh@~8xIC(@J2mqs1aP^ctmiJ85bp{z{0CTc4#IxpUzPZN2)xdVg1{bQt@gv*3n zbT7In-NlYorE$#+&G!qWr+KM#^R;M)x%&VpDPgOjOo`I*KFX(xb&Hzw&GYJidiplu zlKNq>WMO&Xc7A`3_{8ue35y3CixrKvkztfEp0SqUSnEf{pt{}S)*{uc(e$jN+_UZ^ zeW)?!e0;&dmWTa|O~nR$JImJ58oR^Tr?N%6^6TAtZG#0D7<; za$p6&g1eKqfYZTH$-3z(ez@?tp2tx8p#6XcSp*p*(IgQb@5Ymx^@yE?>574e?||#! zT6{E-uCcxm+c7k!AorNt&`sqw>%{#HIvjoKq2eJMS_FE4?n-yMtDy7!mh=4S*x(p@ zKQo}^)7El_qWeOPQQhNl`|E2zGz=blLLDEIFU1S#$LXqZ`(zI_HF=0GUe~1??_>C_ z`nco%Wm`FO>4ZeMhBf3@k(qu1XQ03$A(DOp}Y<4!J1IgQq zI^fp}q^~cad%2e*h$@SV8yFz_LRR`p15`?dKn-F@CWiLzcPc27FC=#}XN*Bt1#pQe z!9fpF9kiW~L6QicbNV>_jX@7Xhxw6Sk>04@ub#acwU*5xz|q)BYv1w^^+5Y@Al483 z9oF7_s7I=VO>Gw!XpE4QdzKz>ruR2Eb2Jx^dEVUd1$HzzYk zG2d0fR`9c|w-Gj=wmdkx=x$r5p78c7GBQP4CHo_!+SGb`)u$yC2QubThI{&xR-nef zX8t+?FXIE2ho%#!i{j8O7iHXjN1+Gp=i6_sH<=(qPa#aC%v;UPO-5+RKWFqr9-9HD zp3)xf4g%>OITJpH)LTYhOqugA4J}tEVJ`8FG}2D!tW49zL&o}guzm`;zM*v8$u@zV{VaE@_;p zdsQh-ZVlpE6WtECukq-ZOxF!?n=R`e?~eMyGN$TC2hrNht`F~->g}eE67SaTk1utQ zcM$Brm1{8gUvN{~d~dxDY4qIBb$Wx=Nw$wih2soA_IG#1;q7C2BMGs5QcJQBGh#Dd zUh~|ZdNS@dSLP#)O(&#uVRWP?k!akyP~BP{&RL+TEgFj=RL%zfwR=mcXNIlw}CDK&_kHXjdi}A3r>0!BQtCG2jyT(!ddC+>< zyLYtD6khd)XN@`Axzah>+0mIP#vmp*<`vtvX@O})U8>Qr9^9lVb&kffCd(z4wfF4s z$nvDjcFqEjgPH@5Yx|YfQNl^a>G6rpRlR9X8d)Ry;nSFB4ELd9qQa5qI^6;v4FL~* zUf_YK+14w&C{3feg+><)kg&+v#HFLZ&Gu^x(8P`g+a_odhMXx`KQD z*S^_Vr6k|PFI3><3gzRa9F};yAe0rBr59!?)^6)}=iu4?6-rm-pNuW%@#wP5bZb)^ z*pC5EnIHp^y&0`-ug7#*2Sy+bTY+$n$Bkup8JUb1zX z41+8<8$912mH1~c!qnE#Rw-Bi?HK=*{M=IGPol8$$Ai15CChtDM8z4?Kk5Q9#TCZ9`h38KY^W z)ufK4sCJ(O=B&0lH}=Ddn^Cd7a>!ds)<@U9TC7_no7r4?xuV!}oE+>-Tyvb;PR|cW zub;=hLPqkxj&rPXYWE!ZN!QjyGXnA^-*p})Uf^NtAd?E_75Kn;pt{i%5U|jXk!mpe zaO<6Sg^gsDgq>7iSe7Ye2y5zXGephsHt`i4=I?(u>PWppEH`1=4lldd4)k z8=M{$pI5T*+j?TGbNLVT@9oLLOEF{`v-J5UlzUxe^5kAS)#8onrNaBcjv_6JHBz0% zA17!i$&<~MixxtTS_^* zoe;0XTrQq2Z+P5Zv~(4JdV3rDZUi4+j_}yw@O@TUBHRyISlRU%-W)27NNrf}%%7k) z1qLo0ZAW+qy{12ETDI#he)yV;w|IaGq4<+&I|+L~LcBQusJMWzvVjj#Q~;|G0EZdS zPl(7rvjI5t_|E+T0Vd}MS&?J+hm;Gb#FMd$CdQrqT^q=7i&+qgLI6RII1O|oSP5wp z1VjXBk2M$U7JJB_L39w;JX%T)p7e_nb9zi=mzx@4x(khgD2-o==a@+aEHer>Pe1Q2 zue|szd?S*o&wD6yZ{kj~$)?E~6i$F>k7F)um48GeRpcdoJJKhsFDO4zKDj^g<*HSId2aqD$Gs{sT%O%rCJUzAH}% zoBz^}E@UNKU!ZMJzkk0!fz+G;q+p4AmVWAt6>Qeq@m>q>RlX z-)#M49<4HktkLH=+5FoXk~7zd>~Z~(4$}x*1lt{3GaV!2{Bnt2kyW)Wt|h5OVYSq( z+M>|7($>_(_Gb48<2>my>qg;deUJ63yFGVGaUpWwJ7DwZVM%o}cHfs`7c7}B3~3Vs zs(*9f1}84ODk3GS4fiC&PrNfTDHq9Mlz5AWiGb?COmMpK0LNX1EK)W$SDT6iRXx>6 z`;w}#ysnzE_D$V%XLfyZJ;CW|3HIXeM$2!`8P@~P#CH`4#SoVe_^7DZU(#{-C(>-( zZ7i-=>Ti*P&~UY{Iz4WRkJBFJCxQc_sWWBCCAG9W@|84vV;9stA*@V)pL}ca5wslh zf~nw02p}HyZ$blz?NIX}I)i5Itb5^VKo$iSAYlZ6rmq|kufmK;_~wDqBQFJQ3Yq2Y z%QDMYn$S2=w_*tmvgnWMR+{Ta>K~ZLnb(-1*=aW2H#xU)cciIAGDSZk5ya96Gmtw@ zmCiEGiq9@EjW9GYSuj7+tkTia3f0Wi#?_kjY)1w#k9lI$WDut@YYsMtH#fLj+>zg! zUjM#*h>d_|fd+&2KyIPZBK$&QK{-JE`28)k|MyV1oZZ|KQ(V33lB>?V__4Yal*X!BpZaLmuXXXW85pB zZ;Fdd>tF@Jlft9>PtdxOe5u~mYPBNTCe?{n^cMGB4nB!}=Af>Rm2&SPq!`!Cs^4$cV4X-RNb3f86T>A-MAC34Tyal}F zKF{hL&qw1cW41dg={}>M%-Y1Y_@B-eg)R@%%Ztw+JKv(cvV6!0e!1R`t>AUG^Vep-Pc<<(qwtU6Qm`{2b2*&N zDD8zd|7?eD{)Vka%>So~{dn^A|Eq)GM5O65~sviZZfI<_3ZW@merE9`Mm@DRTkI>OgNVBxaUbUPE;?yH|JPy zVt@6EF&tHVa}2C}GE}Ct(F6q-ZPJ3hB84aJ!s+rWT<|T6OjGtEw@o|Gq2{U6YiZ19QEQ<&WlXlzsxtH^Y$CGsC-|FXKxEb0KE{*fi z;r)`O<0qQ!>H$s3jrR@VjUAUNmkQS}{G-~(QUEj}%ayP?sY?l`6^n&C{=cnrnou1T3{blwk?jPFz%T7$)5deTj z{;vT6GO{oL00Mxx&>tl?peyZPT8gU6Jqbae0)BNE0o3}ipy)yb4dkdO8oljO5SEo! zN;vXdF2g=jl9dN?rP-Vo)>JAZ%e1+IBNWZ+6bct1lJcPC^OWR~2x#I64E(F&`>wjI z2`@T$L4IJ}uD*P3H`$)oZ7*35*Bjp)Co=ZV&R|CAooIDwofYvJglKtnYSdbiweuCAt$xj&i9xz6DJ1m5&b356_gjZ%~#OHBGtbrG!`BG_i`2&SeS5p@ycH>~qpmOxvQ0a<1fLUeF1-rG^WL?#^i_^*7R;g2UC+9RwZYkOY<} zk0c#4hzBAQE6qtq6M~oHbFQ$?S+bLFjvSCJ0#s$|ZO!d*M{VT3W^l9|#DJz<|J?h^ zc4A^S&j}y!nqS>8!lIJPIaDW{m*3B+aiJ@C(=jLYK&{U2{n&g>wHnwh0(u}|5|ora zzPB+1{bXyoaDI%09C~<51^G?yp7MMV5NA2~cDuse*dS{(QysUdj%FNUV08kO`2|?t zh4nmNe;j|G{y8oPBw+0g{N>kAM`Z3NU|l(0Ywn_U+kv`u1$>z6#Q z#G7C1X`dMbhyMf|#Zd;K3-!M#-czF%gss75X z*mCUVg~!tNP~rfT`m+Q93bf?RR$?fe-!1Ii!Zn*eL3d_#!^L$nF~qqCfXqufY8F2y ziDw`GA?6!B{x~HmtEqPy$$Z6$0a|I|j>Z81^IIOe?o?C!Jnj$xYX(ud)X!K7UO z$msDG%RZroh(*Szv{0liKZZ7!(q@m}zCAR61}=4^gHsw z(R-Wpc6a(9Q$5{9Vj*9#+u5VAY!OX?m@@xIG>OnEQ(!HM!T0Ky-9-!9Dn zKq`5zvDfMy4?jqPrLgbYo)2@Kt@|w3%P%fr#iec}_WR7X2X0kRd)A+W`Qp}7x`f`p zJ*d6cdg_TW$9qq!9sbww+db-VmA{o+xp#x=KWK>*H8Ub(tdfPQ5JRSQT2owkPO>-1 z_^P1a2AJe`C(%EeTvcWH!5Z!_ABNaU{mr$lulU!!WT8MK(ayAo^BFXt;c)#H)_AS( zym}5_rwRf?Zeobo98Ru*Jgt2Nt>+y0MH{7lZ5p!DWVl?VLXR#QDUkD1bl(n*yzC|$ zsvJ7a@IwS+XT?apyb52BVwxITk3juu0htfTvc>EFE-ED;D-*gfrVliIU-vtPATn~2 z>SmJmRJ^FJ@RnOy^|)6MwkaRSqP6q#JNCORj}X>v1oc4Y)$rudY}&L8O!Tk7A?NVL zPk{1iO^<#>)q!JyKLlBaaD?k@prnp#E2J{RGjcl>_dlLv!80hWxoyl6{J8?Q`hMhy zOa4_|RCLM_Ym|t)ugCW*wgfMb%p>e_QRiL$7qB?t`zD-G{m&@M3M ze!Hh+$U2G(`#eKU(g8n6ZF&NMW1Cxcm>NFS1CN{d<7i3ew83vU)m>|g*R=&^^#oHu zhN4FF*jl{T$9$B{1;5C`ycDh2rAu~J+}iQGKhm%I1DQKQ=}At5_6!t-6Q6KBxLwV_ zU1(*HQSWO~gO7YL{sd!uU{8J`^n_>$s<^xz{7v>`@-}FNRLx_Zpj5%X^MTvS8$fN9 zwTrqjo;a|~?XF&CV**+Fmp@nCjBXBcs#lMHc@FI6WLu?5ePUjV#`%Pv?Mu(*`s7Tj z8lkmWNTk%Yi#bW~B_f+8(dX;1JFAMAvDfM7jaa%o42-8x*QuEDI+C(ueJ^}aX|qSk zVK0;M)y2@7rbBxhVwEWoi2ytMU}ld%Bkytk0?F^jkrM64csXRU6a}}scnZan(u{_B z8ZJWfX;ZO&rtj~r%69NgJPq}DpQu$^*7ad_#|Spk4a#>@Bj`!;ot8`etl@UZn9PheqC?GP~fqn zs*Lqd{75%hNOYbabHpNU^0!x%ERGNl={~QDCX`#VBcdf?Eep@9z?frRdfT`4-`c|JrAjxgTK@D1izlgq zKX5&DIP6+j)wOMi?gp-5uerk81-3ohu(`c^H12hEJRDN9%W9>fMjWm7e^UL?IJ;m> z>Let5+r$hn{^Tb-BaQ7Mdc<-DOUO3?OHnc7BZRLrFpDv>Q{B3~Pf&#%_Cc}cJ&Ipk zi`(s`cs`uXN+k8gH;>4$;5#U;t0F8J$UJ5RgN2Q&Zv908+*UG6di%*33 zJQJPAV|QG~j%}v^x^p!GrgdGcKQLbQzydsy+9e0m;DexX&G?r|8PA4UamIw8(iGUx zyraVd1v|AATb($E1O_jC+a_^<#AIM@) z%D2&G^YEY;19hQ&gj*3r4P6w*D^Aa|*btm7>++g0s^+fsALmstc4EQT&k%kS z%XbUfC*=;x#m*i`WaVz8uBtu$$SnpypX(Dc(ZlTu2o&2j{ezqQ!V1yr<&>+pnX$py zjM69cDc1+prR@^7Kd$p18nrZMA#2&XZgQ)5q5V7|Tv>Cn8a7^pyuR-dmg_a8@|*9S z;<4gReLtx0wU-A4@--9=zx>WvCy+nYLcIzY0Z)|ndHnR#y8=SHd=lQe*(7lg@R zwqt*vDKb}-|5O8yPpkD{b*M2H`6q26z~p3X-;L9b`%I(xsks*nLEfW$-9G$-@eRrQ z`F*Pm4hS1rkW~PuQu7_$%jVt{Tw+TLe75$SNEN__-@^^RX6de6!DaJtSJFLY6LAoz z2TrrNG`s@r=Kle%7oZZL61U9&eAG_2*@T_okpW$6#&>-Y=rKBj4MW&y88HHj{tnUV z$&@3Bez_eDMu%vfXHDMyE7L39+pdTFB1!_$n+E(JhmBYkFO&$qM(+u(ErWIn++AQu zTJq*aE-t*@!7OmX+Io7JVRWirsV=js@MPs&ROpse~41+=n_rq+Og$3&c~}R9K&#j zxn#k?nM(X@&L%vzgQGP%Ji?D@1A=)^FQ3#C+mPQlf*u{V!VC61)gaRQV(_T6$i-$R z!l9)Qz(UR~gP7DdR_t2xYhv*7UeprRb(=#r)((!asaoxln%tz| z@QUXW45a?{?kd)dNsoae_W>6Lk_DtrVi2F{F-5TajwD~NC%btKM@zEL@{5F`SH7pCeIxfn;FK53(cWn zzA+f*_e?0base$A=&XlIz*s(tx{{I-H%rExFk#T_V3TeVU@)Z%p%`Z&3c*$UuJSb) zHt-}k!>P-W=SM@O88j_!o0pAF;GZM3lgfl>Y~P zOWtqXuxsW~Gcj~;KxSQ%-K9rzkBt%mXW6m+Z^R`gz#c6!1KpHF>p^{xnR-^)1s*dS0sF)lxmW2|*?=DdYrG7vzK9F4V4DRXQ zPE2YetQA}bboys%!eB89NON-y-vfDEH)n8;rL z9wdve_dwDkjU&nu-_8Y&jH_Y)0IH1#4UOA)cCN*eAwj^lUcwTYw)N)~2HI8^%_$v$ zh$zHEdH1t|(M$F|q9sRCcC-sD)nrB=f`S(Vj0saeot^gp-;gJCrxu!sM{jY`ZG_#^ z@FIEw@Lh#S`mpqx&t)YpuwePvMo&eXm(fGx7}Jtu3=kl{WeQj(F7ZnMUld)?#4U(K z9ksO-+|zn+>^O998EMr9=+}%5uS47M>N5(>R1-~ocDS*=ZerLQtc7$C3ha6XTm+h@ zr(wC_AAQdtu+Xt5SrMD@?yk!IaR){;Q?tZk7_hEr>M@JAJ=Ne)UFo%)4#TCGz$LyC z++pc3sUqh1?C^C$XJY$XNP;1xB`ovzKt!AI@0DXacU#*z|DB$s;G$_ntMO?aV{hp} zb(CQ+YvXkBNchOMjULW+D7^l87i;5DsJQQ?>AH1+I)dMm>e~+17xSnb1_+rsUwy-3 zt<(mR=Fjs-8wejmHXI*+D%ePX?2f*Y)vxv{iT5~l?ol=WlFXegxkJFA*SlIvC#f32 zd!WO6K<~SEG7S8p{VtKCv`JC6YJ+x!J|j~P-lw=I1V$U6uBv-S5X#EXEV?+rZy$pizG_k}ILB zE0O8vO`2yu?iep6VP7RVJ$>s8=P%qn$<6D@@aRTv&6A7|K4|T`9&#s4X%P_CEDUrP5LfD?9+|u3g5}A@ zAR3D2(!2_%&s5CTqLAr(^Sq|`&i1-*2blQYNcvxCJzYilc&8FPb_d-De-0p)qwJQR zL?#nz!7Z|;=2M#CX^|D{q=_S*_Sj@I2GW_`c!7x1m_P1w;SP1jSJ58)kXpRegv3T* zod)kUo`gt$%W7*<1Jj~@a55jRx}}UPJZ8=Lb?zhw)pO$8Px-E(*F4q4ldp^>A)*a7Y6*rO=tT? zjF2_6PdCWm4KQ$ZE;-nKIveuMHiqsRQKb5%e>|`J$Cy@e#N;>5cF`=T5DNAU2PR0Jy%TvG)D3kC4WHfsnThK$tjM%fk6)I-B*+3&^XJIN=kE}pISI}%xK zI*HDWJq^mF3FFkTn&G}doYH&Nhv_-~;5`g+k){z+H(!iPKPW7_axsGrLX6W4kZ5UtNtK9pFmDnG0g^>?GKH42#i3!Ux>7kCV)Gd z!+zii1UZ7`>D6Z3C5JkM(ukTj(}uvk_mF5P?AGqR1;q}DOo&~qfzkJnqpkWGp5zYG zF?4gnhb(8EdCeWU9@(xhf0^CvhL+=0Lje|f+c|qPvcHyM7Q^{iMVEFr)njk6yr&oX zt)&Dbl_jaiR$qcKYF@9!FLV*9*R3$&sqn_6?)84`RNgFS+zAy zc1#5SO1d?o%C|=7-WEwIK z(Loy)Vc>K5}nw}6(X?Y>6(A*5Qr4gaAXs+8OLIzNbI%i>Yt@)YHkJgrO(wsVHS6mW3k zda+a}{Z;qcZ*QaNbej(M4`6&FG@l5-e4`5uHIPB|w7V|d-vJJG72v>QS43T4poHj> zC52@m@elgj+DdWW{u z5esiZ)Rl_y5MP<0&*R78GF)*X(IK-pf?KY*TW#sTGW|hy9O5&%JzJS1tlIc?KW7q{ zGo`Cut!{J5pg`Eb>Hfyu+I9Wvkp0QZZy}8%_<9eIF1S=pu~p=e*UOAXG7jLt=v_#r zS;|c+Gzt}`GAZD2o98sBLScF%w5$Rb7{|r__k-eLcf??qlW2tnKuTbnMX*F>HfFaYoEWC&#t|@g&=>R9?g+vJ0UfuD-t?=)IcBirM*c!w)ex z8ivpar_`yv#HF!AxKKr+#gT4}o3V#%4xPoL8Qfx6AJFFn^(Qp=(-?uwzLdO@bK!L; zRLW1ino{!p*Q(D%&Wb!q9t6UE^Wx=Y$3yXVL5m9-iUjIyBKd^8W-E9T>)JBJXG#Q6)?jsR6?u& zut=Rsn^{fekGxEg%9>>6qzZm^^h2rAzFc`dpNV{%yl+03);fcazLivgRy%oz=k+*l z6sMbK;?9N}=q4aZj+> z>_E5@dT?EOM7z3;0EMOXWqJiWxgFATZ!a!O#A<*2pF>-_v{ha^3N?&M%(qb+j#;(F zn~O|QTUQ{>rWL!RvhV{aTI#?`Z}r*N(T1ofInckNQ0M5JPMVMe3d=JOM}Gi__%UhhW_w#I zK>mq@sx{7Z#Aw`eB8s*&41ypAjy>#&@fW&*wE>aw;$FWlI?kX4-`p$-67Ar7TpZ&Z zj#L?pdU&(nnCzSyB8f4#rk~TT+w(MeRCEw@s2{X`&J4f1tTKK>2oGz!9d+-YDpm3S zqgU;)4wGuscHZmK4^$pjPJ3#8fvfs)c7)5MX5)6d0#4Y6tuL`VIxBPabHRo{aOdp{ zS8;ZGkQkJ!{{a-mqgx+am@W>%_o??0QY1BU+HyOzi2IO45G?(W zY$RIj8Fqw;0`>nFn2=_iP?A0LQiKx0WTTazZz~mv!)z7lDs|L(llk2*Q5?M`*39sed{wj?hBU3ghyk zLHrW_S&61q8eiI@2N9zbk!ApsWeHZL+F3>0nI_RPQ*k2PUaP^EEOP-*0X`!YhQo5K z;LQ$#9wBI#3-7$FfPO46F$J`~y&jbt{9-}rIu(FT437`YPzl2RUm}{lOdF3Eg)Y96njB^Wk|j_lgeWz-czWGGh>Kfao2}D7 z(T)&N3*-EpeM5txw=UXP(Pm=T)(a>?pg$P-U+7|?GMRhb7Jq|5wp%Qy8M<5M?DRX*8S2`E@^ zs-!nUp-_v+km(P$;5z-nH~kl!5MTIyT*7t{W;96l2e&R`>Dm!qBS;e@*bxq^9ZW;1kFIo5J~^eqwjQvJc~B7{Woc7*ZHq`;RkpHc|GWA=a(;=93i%5Oh9xvox+JjkSk|AH^gA zkz7G^-Y}M-QEY?jc1!E6sKD5(Dhl#i-+jc+wRb} zpYsQ4+_YpGde9#)yRwl`ImaM8u@nci?Q*S0iBUptPqL~toAR>F_D#mq5fQogfP?Ne z`S9>xWA=NEtNk=>*oLbdm}6s@9G9bu2$(`D006Mef3*OcG>uo;*;{XmmZNQ`>+hG%4$@`+vSRfh zy{BSgd76O{0S5}4NL0VHi&UEe9>wg?cS1_Yuvn5Je2p3c>%|$##@2&D971G`7!j;y zzIw6!a(D+7g_WQD&gmne0jd~OyDD4O`QSWnzz(nd33?(ETi{-W6=flJA>dJJ*jVbR zvw2ISa8fSxtl}n?`t~mFu9uFoN7w52!WyI8rd#HfO4&z3AlQ6!!5u9=L?)m&)f{(K zS65Ul*)iO*Mw=YE+U9#ES~cbW#n6ngS$v%yC4DT&9Fva-x?aDl?fBuq{a|`w6~O(p zDj7Jp<&
- Elixir Sample + Elixir Sample
@@ -32,4 +33,4 @@

Index

-{% include bottom.html %} \ No newline at end of file +{% include bottom.html %} From a54ebfa73cf27825e18f1693c097fab194c66546 Mon Sep 17 00:00:00 2001 From: Alexei Sholik Date: Sun, 8 Apr 2012 23:19:49 +0300 Subject: [PATCH 051/437] Remove a misleading line --- getting_started/7.markdown | 2 -- 1 file changed, 2 deletions(-) diff --git a/getting_started/7.markdown b/getting_started/7.markdown index 53d1dc117..9b52b6fc5 100644 --- a/getting_started/7.markdown +++ b/getting_started/7.markdown @@ -39,8 +39,6 @@ The documentation site is not yet available, but the [code][7] is there and it's ## 7.4 Join The Community -~~Here's a list of projects that are being developed. You may join one, or start your own.~~ - Remember that in case of any difficulties, you can always visit the **#elixir-lang** channel on **irc.freenode.net** or send a message to the [mailing list][6]. You can be sure that there will be someone willing to help. [1]: https://github.com/alco/elixir/wiki/Erlang-Syntax:-A-Crash-Course From 9be6328d0b3a5011787603da7f13ff7faf01c3ea Mon Sep 17 00:00:00 2001 From: Rondy Sousa Date: Fri, 13 Apr 2012 16:08:01 -0300 Subject: [PATCH 052/437] Add post layout (basic version) and some sample posts --- _layouts/post.html | 58 +++++-------------- ...04-13-first-post-on-elixir-s-blog.markdown | 6 ++ ...12-04-13-latest-news-about-elixir.markdown | 6 ++ 3 files changed, 25 insertions(+), 45 deletions(-) create mode 100644 _posts/2012-04-13-first-post-on-elixir-s-blog.markdown create mode 100644 _posts/2012-04-13-latest-news-about-elixir.markdown diff --git a/_layouts/post.html b/_layouts/post.html index 41379eff4..c96632673 100644 --- a/_layouts/post.html +++ b/_layouts/post.html @@ -1,56 +1,24 @@ ---- -title: Elixir -active: 1 ---- - {% include top.html %}
-
- - - +
+
+
+ + +
+ {{ content }} +
+
+
- -
- {% include bottom.html %} \ No newline at end of file diff --git a/_posts/2012-04-13-first-post-on-elixir-s-blog.markdown b/_posts/2012-04-13-first-post-on-elixir-s-blog.markdown new file mode 100644 index 000000000..705a45778 --- /dev/null +++ b/_posts/2012-04-13-first-post-on-elixir-s-blog.markdown @@ -0,0 +1,6 @@ +--- +layout: post +title: First post on Elixir's Blog +--- + +Body text goes here. diff --git a/_posts/2012-04-13-latest-news-about-elixir.markdown b/_posts/2012-04-13-latest-news-about-elixir.markdown new file mode 100644 index 000000000..83e566a0f --- /dev/null +++ b/_posts/2012-04-13-latest-news-about-elixir.markdown @@ -0,0 +1,6 @@ +--- +layout: post +title: Latest news about Elixir +--- + +What we've been doing... From 8d45bb83f2943672bce0e978b6df388990d188ef Mon Sep 17 00:00:00 2001 From: Rondy Sousa Date: Fri, 13 Apr 2012 16:10:01 -0300 Subject: [PATCH 053/437] Add blog page to list post entries --- blog.html | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 blog.html diff --git a/blog.html b/blog.html new file mode 100644 index 000000000..8be0b1e3b --- /dev/null +++ b/blog.html @@ -0,0 +1,33 @@ +--- +title: Elixir's Blog +--- +{% include top.html %} + +
+
+ + {% for post in site.posts %} +
+ + +
+ {{ post.content | strip_html | truncatewords:80 }} +
+
+ {% endfor %} +
+ + +
+ + + + +{% include bottom.html %} From cf2e73eb8d338cd803af4197f597dd264a2cd853 Mon Sep 17 00:00:00 2001 From: Rondy Sousa Date: Fri, 13 Apr 2012 16:16:51 -0300 Subject: [PATCH 054/437] Add 'Blog' item to menu --- _includes/top.html | 1 + blog.html | 2 ++ 2 files changed, 3 insertions(+) diff --git a/_includes/top.html b/_includes/top.html index fa67f4778..c0fa2b4ba 100644 --- a/_includes/top.html +++ b/_includes/top.html @@ -39,6 +39,7 @@

diff --git a/blog.html b/blog.html index 8be0b1e3b..ba7fe74b2 100644 --- a/blog.html +++ b/blog.html @@ -1,6 +1,8 @@ --- title: Elixir's Blog +active: 3 --- + {% include top.html %}
From e58e960109ebf895178222c7fb25dad4cff05e5b Mon Sep 17 00:00:00 2001 From: Rondy Sousa Date: Fri, 13 Apr 2012 16:36:21 -0300 Subject: [PATCH 055/437] Remove annoying tabs --- _includes/bottom.html | 12 ++++++------ _includes/top.html | 36 +++++++++++++++++------------------ _layouts/getting_started.html | 36 +++++++++++++++++------------------ index.html | 34 ++++++++++++++++----------------- 4 files changed, 59 insertions(+), 59 deletions(-) diff --git a/_includes/bottom.html b/_includes/bottom.html index a8b23e0c9..fad86b705 100644 --- a/_includes/bottom.html +++ b/_includes/bottom.html @@ -1,8 +1,8 @@ -
-
-
- - + +
+
+ + + @@ -23,24 +23,24 @@ -
-
-

unescape/1 @@ -137,7 +142,7 @@

Examples

In the example above, we pass a string with \n escaped and we return a version with it unescaped.

- Source + Source

unescape/2 @@ -174,7 +179,7 @@

Examples

Binary.unescape "example\\n", unescape_map(&1)
 
- Source + Source

unescape_tokens/1 @@ -186,7 +191,7 @@

Examples

when implementing your own sigils. Check the implementation of Elixir::Builtin.__b__ for examples.

- Source + Source

unescape_tokens/2 @@ -194,7 +199,7 @@

Examples

Unescape the given tokens according to the given map. Check unescape_tokens/1 and unescaped/2 for more information.

- Source + Source
diff --git a/docs/Elixir.Builtin.html b/docs/Elixir.Builtin.html index 0ec967e02..e5c9ca0ce 100644 --- a/docs/Elixir.Builtin.html +++ b/docs/Elixir.Builtin.html @@ -28,8 +28,8 @@

Elixir.Builtin provides the default macros and functions -Elixir imports to your environment. Those macros and functions -can be skipped or cherry-picked via the import function. For +Elixir imports into your environment. Those macros and functions +can be skipped or cherry-picked via the import macro. For instance, if you want to tell Elixir to not import the case macro, you can do:

@@ -39,6 +39,11 @@

Elixir also has special forms that are always imported and cannot be skipped. These are described in Elixir.SpecialForms.

+

Some of the functions described in this module are simply +a proxy to its Erlang counterpart. Although they are documented +here for convenience, you can access their original documentation +at http://www.erlang.org/doc/man/erlang.html.

+

@@ -52,6 +57,11 @@

Functions summary

- - - -

Macros summary

- + + + +

Macros summary

+ + + + +
+

Functions

+
+

+ abs/1 +

+

Returns an integer or float which is the arithmetical absolute value of number.

+ +

Allowed in guard tests.

+ +

Examples

+ +
abs(-3.33) #=> 3.33
+abs(-3)    #=> 3
+
+
+ Source +
+

+ apply/2 +

+

Invokes the given fun with the array of arguments args.

+ +

Examples

+ +
apply fn(x) -> x * 2 end, [2]
+#=> 4
+
+
+ Source +
+

+ apply/3 +

+

Invokes the given fun from module with the array of arguments args.

+ +

Examples

+ +
apply List, reverse, [[1,2,3]]
+#=> [3,2,1]
+
+
+ Source +
+

+ atom_to_binary/2 +

+

Returns a binary which corresponds to the text representation of atom. +If encoding is latin1, there will be one byte for each character in the text +representation. If encoding is utf8 or unicode, the characters will be encoded +using UTF-8 (meaning that characters from 16#80 up to 0xFF will be encoded in +two bytes).

+ +

Examples

+ +
atom_to_binary(:elixir, utf8) #=> "elixir"
+
+
+ Source +
+

+ atom_to_list/1 +

+

Returns a string which corresponds to the text representation of atom.

+ +

Examples

+ +
atom_to_list(:elixir) #=> 'elixir'
+
+
+ Source +
+

+ binary_to_atom/2 +

+

Returns the atom whose text representation is binary. If encoding is latin1, +no translation of bytes in the binary is done. If encoding is utf8 or unicode, +the binary must contain valid UTF-8 sequences; furthermore, only Unicode +characters up to 0xFF are allowed.

+ +

Examples

+ +
binary_to_atom("elixir", :utf8) #=> :elixir
+
+
+ Source +
+

+ binary_to_existing_atom/2 +

+

Works like binary_to_atom/2, but the atom must already exist.

+
+ Source +
+

+ binary_to_list/1 +

+

Returns a list of integers which correspond to the bytes of binary.

+
+ Source +
+

+ binary_to_list/3 +

+

As binarytolist/1, but returns a list of integers corresponding to the bytes +from position start to position stop in binary. Positions in the binary +are numbered starting from 1.

+
+ Source +
+

+ binary_to_term/1 +

+

Returns an Erlang term which is the result of decoding the binary +object binary, which must be encoded according to the Erlang external +term format.

+ +

Examples

+ +
binary_to_term(term_to_binary("foo")) #=> true
+
+
+ Source +
+

+ binary_to_term/2 +

+

As binary_to_term/1, but accepts a safe option useful when receiving +binaries from an untrusted source.

+ +

When enabled, it prevents decoding data that may be used to attack the +Erlang system. In the event of receiving unsafe data, decoding fails +with a badarg error.

+ +

Currently, this prevents creation of new atoms directly, creation of +new atoms indirectly (as they are embedded in certain structures like pids, +refs, funs, etc), and creation of new external function references. None +of those resources are currently garbage collected, so unchecked creation +of them can exhaust available memory.

+ +

Examples

+ +
binary_to_term(term_to_binary("foo"), [:safe])
+
+
+ Source +
+

+ bit_size/1 +

+

Returns an integer which is the size in bits of bitstring.

+ +

Allowed in guard tests.

+ +

Examples

+ +
bit_size(<<433|16,3|3>>) #=> 19
+bit_size(<<1,2,3>>) #=> 24
+
+
+ Source +
+

+ bitstring_to_list/1 +

+

Returns a list of integers which correspond to the bytes of bitstring. If the +number of bits in the binary is not divisible by 8, the last element of the list will +be a bitstring containing the remaining bits (1 up to 7 bits).

+
+ Source +
+

+ byte_size/1 +

+

Returns an integer which is the number of bytes needed to contain bitstring. +(That is, if the number of bits in Bitstring is not divisible by 8, the resulting +number of bytes will be rounded up.)

+ +

Allowed in guard tests.

+ +

Examples

+ +
byte_size(<<433|16,3|3>>) #=> 3
+byte_size(<<1,2,3>>) #=> 3
+
+
+ Source +
+

+ exit/1 +

+

Stops the execution of the calling process with the given reason. +Since evaluating this function causes the process to terminate, +it has no return value.

+ +

Examples

+ +
exit(:normal)
+exit(:seems_bad)
+
+
+ Source +
+

+ float/1 +

+

Converts the given number to a float. Allowed in guard clauses.

+
+ Source +
+

+ float_to_list/1 +

+

Returns a char list which corresponds to the text representation of the given float.

+ +

Examples

+ +
float_to_list(7.0)
+#=> '7.00000000000000000000e+00'
+
+
+ Source +
+

+ halt/0 +

+

The same as halt(0, []).

+
+ Source +
+

+ halt/1 +

+

The same as halt(status, []).

+
+ Source +
+

+ halt/2 +

+

Halts the Erlang runtime system where the first argument status must be a +non-negative integer, a char list, or the atom :abort.

+ +
    +
  • If an integer, the runtime system exits with the integer value which +is returned to the Operating System;

  • +
  • If a char list, an erlang crash dump is produced with status as slogan, +and then the runtime system exits with status code 1;

  • +
  • If :abort, the runtime system aborts producing a core dump, if that is +enabled in the operating system.

  • +
+ +

Note that on many platforms, only the status codes 0-255 are supported +by the operating system.

+ +

For integer status, Erlang runtime system closes all ports and allows async +threads to finish their operations before exiting. To exit without such +flushing, pass options [flush: false] instead.

+ +

Examples

+ +
halt(0)
+halt(1, flush: false)
+halt(:abort)
+
+
+ Source +
+

+ hd/1 +

+

Returns the head of a list, raises badarg if the list is empty.

+
+ Source +
+

+ integer_to_list/1 +

+

Returns a char list which corresponds to the text representation of the given integer.

+ +

Examples

+ +
integer_to_list(7)
+#=> '7'
+
+
+ Source +
+

+ integer_to_list/2 +

+

Returns a char list which corresponds to the text representation of the +given integer in the given case.

+ +

Examples

+ +
integer_to_list(1023, 16).
+#=> "3FF"
+
+
+ Source +
+

+ iolist_size/1 +

+

Returns the size of an iolist.

+ +

Examples

+ +
iolist_size([1,2|<<3,4>>])
+#=> 4
+
+
+ Source +
+

+ iolist_to_binary/1 +

+

Returns a binary which is made from the integers and binaries in iolist.

+ +

Examples

+ +
bin1 = <<1,2,3>>
+bin2 = <<4,5>>
+bin3 = <<6>>
+
+iolist_to_binary([bin1,1,[2,3,bin2],4|bin3])
+#=> <<1,2,3,1,2,3,4,5,4,6>>
+
+
+ Source +
+

+ is_atom/1 +

+

Returns true if term is an atom; otherwise returns false.

+ +

Allowed in guard tests.

+
+ Source +
+

+ is_binary/1 +

+

Returns true if term is a binary; otherwise returns false.

+ +

A binary always contains a complete number of bytes.

+ +

Allowed in guard tests.

+
+ Source +
+

+ is_bitstring/1 +

+

Returns true if term is a bitstring (including a binary); otherwise returns false.

+ +

Allowed in guard tests.

+
+ Source +
+

+ is_boolean/1 +

+

Returns true if term is either the atom true or the atom false (i.e. a boolean); +otherwise returns false.

+ +

Allowed in guard tests.

+
+ Source +
+

+ is_float/1 +

+

Returns true if term is a floating point number; otherwise returns false.

+ +

Allowed in guard tests.

+
+ Source +
+

+ is_function/1 +

+

Returns true if term is a function; otherwise returns false.

+ +

Allowed in guard tests.

+
+ Source +
+

+ is_function/2 +

+

Returns true if term is a function that can be applied with arity number of arguments; +otherwise returns false.

+ +

Allowed in guard tests.

+
+ Source +
+

+ is_integer/1 +

+

Returns true if term is an integer; otherwise returns false.

+ +

Allowed in guard tests.

+
+ Source +
+

+ is_list/1 +

+

Returns true if term is a list with zero or more elements; otherwise returns false.

+ +

Allowed in guard tests.

+
+ Source +
+

+ is_number/1 +

+

Returns true if term is either an integer or a floating point number; +otherwise returns false.

+ +

Allowed in guard tests.

+
+ Source +
+

+ is_pid/1 +

+

Returns true if term is a pid (process identifier); otherwise returns false.

+ +

Allowed in guard tests.

+
+ Source +
+

+ is_port/1 +

+

Returns true if term is a port identifier; otherwise returns false.

+ +

Allowed in guard tests.

+
+ Source +
+

+ is_reference/1 +

+

Returns true if term is a reference; otherwise returns false.

+ +

Allowed in guard tests.

+
+ Source +
+

+ is_tuple/1 +

+

Returns true if term is a tuple; otherwise returns false.

+ +

Allowed in guard tests.

+
+ Source +
+

+ length/1 +

+

Returns the length of list.

+ +

Allowed in guard tests.

+ +

Examples

+ +
length([1,2,3,4,5,6,7,8,9]) #=> 9
+
+
+ Source +
+

+ list_to_atom/1 +

+

Returns the atom whose text representation is char_list.

+ +

Examples

+ +
list_to_atom('elixir') #=> :elixir
+
+
+ Source +
+

+ list_to_binary/1 +

+

Returns a binary which is made from the content of char_list.

+ +

Examples

+ +
list_to_binary('Elixir') #=> "Elixir"
+
+
+ Source +
+

+ list_to_bitstring/1 +

+

Returns a bitstring which is made from the integers and bitstrings in bitstring_list. +(the last tail in bitstring_list is allowed to be a bitstring.)

+ +

Examples

+ +
bin1 = <<1,2,3>>
+bin2 = <<4,5>>
+bin3 = <<6,7|4>>
+
+list_to_binary([bin1,1,[2,3,bin2],4|bin3])
+#=> <<1,2,3,1,2,3,4,5,4,6,7|4>>
+
+
+ Source +
+

+ list_to_existing_atom/1 +

+

Returns the atom whose text representation is char_list, but only if there already +exists such atom.

+
+ Source +
+

+ list_to_float/1 +

+

Returns the float whose text representation is char_list.

+ +

Examples

+ +
list_to_float('2.2017764e+0') #=> 2.2017764
+
+
+ Source +
+

+ list_to_integer/1 +

+

Returns an integer whose text representation is char_list.

+ +

Examples

+ +
list_to_integer('123') #=> 123
+
+
+ Source +
+

+ list_to_integer/2 +

+

Returns an integer whose text representation in base base is char_list.

+ +

Examples

+ +
> list_to_integer('3FF', 16) #=> 1023
+
+
+ Source +
+

+ list_to_pid/1 +

+

Returns a pid whose text representation is char_list.

+ +

Examples

+ +
list_to_pid('<0.41>') #=> <0.4.1>
+
+
+ Source +
+

+ list_to_tuple/1 +

+

Returns a tuple which corresponds to list. list can contain any Erlang terms.

+ +

Examples

+ +
list_to_tuple([share, [:elixir, 163]]). #=> {share, [:elixir, 163]}
+
+
+ Source +
+

+ make_ref/0 +

+

Returns an almost unique reference.

+ +

The returned reference will re-occur after approximately 2^82 calls; +therefore it is unique enough for practical purposes.

- - +

Examples

- -
-

Functions

-
-

- apply/2 +

make_ref()
+#=> #Ref<0.0.0.135>
+
+
+ Source +
+

+ max/2

-

Invokes the given fun with the array of arguments args.

+

Return the biggest of the two given terms according to +Erlang's term ordering. If the terms compare equal, the +first one is returned.

Examples

-
apply fn(x) -> x * 2 end, [2]
-#=> 4
+
max(1, 2) #=> 2
 
- Source + Source
-

- apply/3 +

+ min/2

-

Invokes the given fun from module with the array of arguments args.

+

Return the smallest of the two given terms according to +Erlang's term ordering. If the terms compare equal, the +first one is returned.

Examples

-
apply List, reverse, [[1,2,3]]
-#=> [3,2,1]
+
min(1, 2) #=> 1
 
- Source + Source +
+

+ node/0 +

+

Returns an atom representing the name of the local node. +If the node is not alive, nonode@nohost is returned instead.

+ +

Allowed in guard tests.

+
+ Source +
+

+ node/1 +

+

Returns the node where the given argmuent is located. +The argument can be a pid, a reference, or a port. +If the local node is not alive, nonode@nohost is returned.

+ +

Allowed in guard tests.

+
+ Source +
+

+ pid_to_list/1 +

+

Returns a char list which corresponds to the text representation of pid. +This function is intended for debugging and for use in the Erlang operating +system. It should not be used in application programs.

+
+ Source

raise/1 @@ -347,7 +1414,7 @@

Examples

end
- Source + Source

raise/2 @@ -368,7 +1435,167 @@

Examples

raise ArgumentError, message: "Sample"
 
- Source + Source +
+

+ round/1 +

+

Returns an integer by rounding the given number. +Allowed in guard tests.

+ +

Examples

+ +
round(5.5) #=> 6
+
+
+ Source +
+

+ size/1 +

+

Returns the size of the given argument, which must be a tuple +or a binary. If possible, please use tuplesize or binarysize.

+
+ Source +
+

+ spawn/1 +

+

Spawns the given function and returns its pid. +Check the module Process for other functions that handle +process, including spawning functions in nodes.

+ +

Examples

+ +
current = Process.self
+child   = spawn(fn -> current <- { Process.self, 1 + 2 } end)
+
+receive
+match: { ^child, 3 }
+  IO.puts "Received 3 back"
+end
+
+
+ Source +
+

+ spawn/3 +

+

Spawns the given module and function passing the given args +and returns its pid.

+ +

Check the module Process for other functions that handle +process, including spawning functions in nodes.

+ +

Examples

+ +
spawn(SomeModule, :function, [1,2,3])
+
+
+ Source +
+

+ spawn_link/1 +

+

Spawns the given function, links it to the current process and returns its pid. +Check the module Process for other functions that handle +process, including spawning functions in nodes.

+ +

Examples

+ +
current = Process.self
+child   = spawn_link(fn -> current <- { Process.self, 1 + 2 } end)
+
+receive
+match: { ^child, 3 }
+  IO.puts "Received 3 back"
+end
+
+
+ Source +
+

+ spawn_link/3 +

+

Spawns the given module and function passing the given args, +links it to the current process and returns its pid.

+ +

Check the module Process for other functions that handle +process, including spawning functions in nodes.

+ +

Examples

+ +
spawn_link(SomeModule, :function, [1,2,3])
+
+
+ Source +
+

+ term_to_binary/1 +

+

Returns a binary data which is the result of encoding the given term +according to the Erlang external term format.

+ +

This can be used for a variety of purposes, for example, writing a term +to a file in an efficient way, or sending an Erlang term to some type +of communications channel not supported by distributed Erlang.

+
+ Source +
+

+ term_to_binary/2 +

+

The same as term_to_binary/1 but also supports two options:

+ +
    +
  • compressed: the level of compression to be used from 0 to 9;
  • +
  • minorversion: used to control the details of encoding. Can be 0 or 1, +please read http://www.erlang.org/doc/man/erlang.html#termto_binary-2 +for more details
  • +
+
+ Source +
+

+ throw/1 +

+

A non-local return from a function. Check try/2 for more information.

+
+ Source +
+

+ tl/1 +

+

Returns the tail of a list. Raises ArgumentError if the list is empty.

+
+ Source +
+

+ trunc/1 +

+

Returns an integer by the truncating the given number. +Allowed in guard clauses.

+ +

Examples

+ +
trunc(5.5) #=> 5
+
+
+ Source +
+

+ tuple_size/1 +

+

Returns the size of a tuple.

+
+ Source +
+

+ tuple_to_list/1 +

+

Converts a tuple to a list.

+
+ Source
@@ -382,7 +1609,7 @@

Macros

Implements the unary operator ! as a macro. It receives any argument and returns true if it is false or nil. Returns false -otherwise.

+otherwise. Not allowed in guard clauses.

Examples

@@ -391,7 +1618,44 @@

Examples

!false #=> true !nil #=> true

- Source + Source +
+

+ !=/2 +

+

Returns true if the two items are not equal.

+ +

This operator considers 1 and 1.0 to be equal. For strict +comparison, use !== instead.

+ +

As Erlang, Elixir can compare any term. Allowed in guard clauses.

+ +

Examples

+ +
1 != 2
+#=> true
+1 != 1.0
+#=> false
+
+
+ Source +
+

+ !==/2 +

+

Returns true if the two items are strictly not equal. +As Erlang, Elixir can compare any term. Allowed in guard clauses.

+ +

Examples

+ +
1 !== 2
+#=> true
+
+1 !== 1.0
+#=> true
+
+
+ Source

&&/2 @@ -412,12 +1676,139 @@

Examples

this operator accepts any expression as arguments, not only booleans, however it is not allowed in guards.

- Source + Source +
+

+ */2 +

+

Arithmetic multiplication. Allowed in guard clauses.

+ +

Examples

+ +
1 * 2 #=> 2
+
+
+ Source +
+

+ +/2 +

+

Arithmetic plus. Allowed in guard clauses.

+ +

Examples

+ +
1 + 2 #=> 3
+
+
+ Source +
+

+ ++/2 +

+

Concatenates two lists. Allowed in guard clauses.

+ +

Examples

+ +
[1] ++ [2,3]
+#=> [1,2,3]
+
+'foo' ++ 'bar'
+#=> 'foobar'
+
+
+ Source +
+

+ -/2 +

+

Arithmetic minus. Allowed in guard clauses.

+ +

Examples

+ +
1 - 2 #=> -1
+
+
+ Source +
+

+ --/2 +

+

Removes the first occorrence of an item on the left +for each item on the right. Allowed in guard clauses.

+ +

Examples

+ +
[1,2,3] -- [1,2]
+#=> [3]
+
+[1,2,3,2,1] -- [1,2,2]
+#=> [3,1]
+
+
+ Source +
+

+ //2 +

+

Arithmetic division. Differently from other languages, +the result is always a float. Use div and rem if you want +a natural division or the remainder. Allowed in guard clauses.

+ +

Examples

+ +
1 / 2 #=> 0.5
+2 / 1 #=> 2.0
+
+
+ Source +
+

+ +

+

Return true if left is less than right. +As Erlang, Elixir can compare any term. Allowed in guard clauses.

+ +

Examples

+ +
1 < 2
+#=> true
+
+
+ Source +
+

+ <-/2 +

+

Sends a message to the process identified on the left. +A process can be identified bu its PID or, if it is registered, +by an atom.

+ +

Examples

+ +
process = Process.self
+process <- { :ok, "Sending myself a message" }
+
+
+ Source +
+

+ <=/2 +

+

Return true if left is less than or equal to right. +As Erlang, Elixir can compare any term. Allowed in guard clauses.

+ +

Examples

+ +
1 <= 2
+#=> true
+
+
+ Source

<>/2

-

Concatenates two binaries.

+

Concatenates two binaries. Allowed in guard clauses.

Examples

@@ -431,7 +1822,73 @@

Examples

x #=> "bar"
- Source + Source +
+

+ ==/2 +

+

Returns true if the two items are equal.

+ +

This operator considers 1 and 1.0 to be equal. For strict +comparison, use === instead.

+ +

As Erlang, Elixir can compare any term. Allowed in guard clauses.

+ +

Examples

+ +
1 == 2
+#=> false
+
+1 == 1.0
+#=> true
+
+
+ Source +
+

+ ===/2 +

+

Returns true if the two items are strictly equal. +As Erlang, Elixir can compare any term. Allowed in guard clauses.

+ +

Examples

+ +
1 === 2
+#=> false
+
+1 === 1.0
+#=> false
+
+
+ Source +
+

+ >/2 +

+

Return true if left is more than right. +As Erlang, Elixir can compare any term. Allowed in guard clauses.

+ +

Examples

+ +
1 > 2
+#=> false
+
+
+ Source +
+

+ >=/2 +

+

Return true if left is more than or equal to right. +As Erlang, Elixir can compare any term. Allowed in guard clauses.

+ +

Examples

+ +
1 >= 2
+#=> false
+
+
+ Source

__B__/2 @@ -445,7 +1902,7 @@

Examples

%B(f#{o}o) #=> "f\#{o}o"
- Source + Source

__C__/2 @@ -459,7 +1916,7 @@

Examples

%C(f#{o}o) #=> 'f\#{o}o'
- Source + Source

__b__/2 @@ -473,7 +1930,7 @@

Examples

%b(f#{:o}o) #=> "foo"
- Source + Source

__c__/2 @@ -487,7 +1944,7 @@

Examples

%c(f#{:o}o) #=> 'foo'
- Source + Source

__r__/2 @@ -499,7 +1956,7 @@

Examples

Regex.match? %r(foo), "foo"  #=> true
 
- Source + Source

access/2 @@ -529,38 +1986,54 @@

Examples

access a, 1 #=> :a
- Source + Source +
+

+ and/2 +

+

Boolean and. Arguments needs to necessarily be booleans. +Allowed in guard clauses.

+ +

Examples

+ +
true and false
+#=> false
+
+
+ Source

atom_to_binary/1

Returns a binary which corresponds to the text representation -of some_atom in UTF8 encoding.

+of some_atom in UTF8 encoding. Allowed in guard clauses.

Examples

atom_to_binary :my_atom #=> "my_atom"
 
- Source + Source

binary_to_atom/1

Returns the atom whose text representation is -some_binary in UTF8 encoding.

+some_binary in UTF8 encoding. +Allowed in guard clauses.

Examples

binary_to_atom "my_atom" #=> :my_atom
 
- Source + Source

binary_to_existing_atom/1

-

Works like binary_to_atom but the atom must exist.

+

Works like binary_to_atom but the atom must exist. +Allowed in guard clauses.

Examples

@@ -568,7 +2041,7 @@

Examples

binary_to_existing_atom "my_atom" #=> :my_atom
- Source + Source

case/2 @@ -624,7 +2097,7 @@

Examples

end
- Source + Source

def/2 @@ -701,7 +2174,7 @@

Dynamic generation with atoms

because each entry k is a an atom and invoking def unquote(k)() would be invalid Elixir syntax.

- Source + Source

def/4 @@ -739,7 +2212,7 @@

Examples

end
- Source + Source

defdelegate/2 @@ -763,7 +2236,7 @@

Examples

#=> [3,2,1]
- Source + Source

defexception/4 @@ -772,7 +2245,7 @@

Examples

The defined record must implement message/1 as API, otherwise an error is raised. Check exception.ex for examples.

- Source + Source

defimpl/3 @@ -780,7 +2253,7 @@

Examples

Defines an implementation for the given protocol. See defprotocol/2 for examples.

- Source + Source

defmodule/2 @@ -825,7 +2298,7 @@

Dynamic names

Elixir will accept any module name as long as the expression returns an atom.

- Source + Source

defoverridable/1 @@ -834,7 +2307,7 @@

Dynamic names

An overridable function is lazily defined, allowing a developer to customize it.

- Source + Source

defp/2 @@ -858,14 +2331,14 @@

Examples

In the example above, sum is private and accessing it through Foo.sum will raise an error.

- Source + Source

defp/4

The same as def/4 but generates a private function.

- Source + Source

defprotocol/2 @@ -978,7 +2451,7 @@

Protocols + Records

Finally, since records are simply tuples, one can add a default protocol implementation to any record by defining a default implementation for tuples.

- Source + Source

defrecord/4 @@ -1043,7 +2516,7 @@

Documentation

defrecord Config, [counter: 0, failures: []], moduledoc: "A simple record"
 
- Source + Source

destructure/2 @@ -1084,7 +2557,7 @@

Examples

the first value from the right side. Otherwise, it will raise a CaseClauseError.

- Source + Source

div/2 @@ -1098,7 +2571,7 @@

Examples

5 div 2 #=> 2
 
- Source + Source

elem/2 @@ -1111,7 +2584,7 @@

Example

tuple = { :foo, :bar, 3 } elem(tuple, 1) #=> :foo

- Source + Source

if/2 @@ -1166,7 +2639,7 @@

Key-value blocks examples

end
- Source + Source

in/2 @@ -1186,7 +2659,7 @@

Examples

x == 1 or x == 2 or x == 3
 
- Source + Source

inspect/1 @@ -1199,7 +2672,7 @@

Examples

#=> ":foo"
- Source + Source

is_exception/1 @@ -1212,7 +2685,7 @@

Examples

is_exception(1) #=> false
- Source + Source

is_record/2 @@ -1229,13 +2702,14 @@

Examples

is_record(Config.new, List) #=> false
- Source + Source

is_regex/1

-
- Source +

Check if the given argument is a regex.

+
+ Source

match?/2 @@ -1262,7 +2736,35 @@

Examples

Enum.filter list, match?({:a, x } when x < 2, &1)
- Source + Source +
+

+ not/1 +

+

Boolean not. Argument needs to necessarily be a boolean. +Allowed in guard clauses.

+ +

Examples

+ +
not false
+#=> true
+
+
+ Source +
+

+ or/2 +

+

Boolean or. Arguments needs to necessarily be booleans. +Allowed in guard clauses.

+ +

Examples

+ +
true or false
+#=> true
+
+
+ Source

receive/1 @@ -1309,7 +2811,7 @@

Examples

will occur immediately.

- Source + Source

rem/2 @@ -1323,7 +2825,7 @@

Examples

5 rem 2 #=> 1
 
- Source + Source

setelem/3 @@ -1336,7 +2838,7 @@

Example

tuple = { :foo, :bar, 3 } setelem(tuple, 1, :baz) #=> { :baz, :bar, 3 }

- Source + Source

to_binary/1 @@ -1350,7 +2852,7 @@

Examples

#=> "foo"
- Source + Source

to_char_list/1 @@ -1363,7 +2865,7 @@

Examples

#=> 'foo'
- Source + Source

try/1 @@ -1464,7 +2966,7 @@

Catching exits and Erlang errors

Although the second form should be avoided in favor of raise/rescue control mechanisms.

- Source + Source

unless/2 @@ -1473,7 +2975,7 @@

Catching exits and Erlang errors

unless a value evalutes to true. Check if for examples and documentation.

- Source + Source

use/2 @@ -1506,7 +3008,30 @@

Examples

end
- Source + Source +
+

+ var!/1 +

+

When used inside quoting, marks that the variable should not +be hygienezed. Check Elixir.SpecialForms.quote/1 for more +information.

+
+ Source +
+

+ xor/2 +

+

Boolean xor. Arguments needs to necessarily be booleans. +Allowed in guard clauses.

+ +

Examples

+ +
true xor false
+#=> true
+
+
+ Source

||/2 @@ -1527,7 +3052,7 @@

Examples

this operator accepts any expression as arguments, not only booleans, however it is not allowed in guards.

- Source + Source diff --git a/docs/Process.html b/docs/Process.html index 60d62cc20..2a0a23dd2 100644 --- a/docs/Process.html +++ b/docs/Process.html @@ -66,6 +66,11 @@

Functions summary

demonitor/2 +
  • + + exit/2 + +
  • flag/2 @@ -171,6 +176,36 @@

    Functions summary

    spawn_link/4
  • +
  • + + spawn_monitor/1 + +
  • +
  • + + spawn_monitor/3 + +
  • +
  • + + spawn_opt/2 + +
  • +
  • + + spawn_opt/3 + +
  • +
  • + + spawn_opt/4 + +
  • +
  • + + spawn_opt/5 + +
  • unlink/1 @@ -229,7 +264,34 @@

    Functions

    See http://www.erlang.org/doc/man/erlang.html#demonitor-2 for more info.

    - Source + Source +
    +

    + exit/2 +

    +

    Sends an exit signal with the given reason to the pid.

    + +

    The following behavior apply if reason is any term except :normal or :kill:

    + +

    1) If pid is not trapping exits, pid itself will exist with the given reason;

    + +

    2) If pid is trapping exits, the exit signal is transformed into a message + {'EXIT', from, reason} and delivered to the message queue of pid;

    + +

    3) If reason is the atom :normal, pid will not exit. If it is trapping exits, + the exit signal is transformed into a message {'EXIT', from, :normal} and + delivered to its message queue;

    + +

    4) If reason is the atom :kill, that is if exit(pid, :kill) is called, an + untrappable exit signal is sent to pid which will unconditionally exit with + exit reason :killed.

    + +

    Examples

    + +
    Process.exit(other, :kil)
    +
    +
    + Source

    flag/2 @@ -239,7 +301,7 @@

    Functions

    See http://www.erlang.org/doc/man/erlang.html#process_flag-2 for more info.

    - Source + Source

    flag/3 @@ -250,7 +312,7 @@

    Functions

    See http://www.erlang.org/doc/man/erlang.html#process_flag-3 for more info.

    - Source + Source

    get/0 @@ -283,7 +345,7 @@

    Functions

    See http://www.erlang.org/doc/man/erlang.html#process_info-2 for more info.

    - Source + Source

    link/1 @@ -293,7 +355,7 @@

    Functions

    See http://www.erlang.org/doc/man/erlang.html#link-1 for more info.

    - Source + Source

    list/0 @@ -307,7 +369,7 @@

    Functions

    See http://www.erlang.org/doc/man/erlang.html#processes-0 for more info.

    - Source + Source

    monitor/1 @@ -317,7 +379,7 @@

    Functions

    See http://www.erlang.org/doc/man/erlang.html#monitor-2 for more info.

    - Source + Source

    put/2 @@ -335,14 +397,14 @@

    Functions

    See http://www.erlang.org/doc/man/erlang.html#register-2 for more info.

    - Source + Source

    registered/0

    Returns a list of names which have been registered using register/2.

    - Source + Source

    self/0 @@ -354,79 +416,133 @@

    Functions

    spawn/1

    -

    Returns the pid of a new process started by the application of fun to the -empty list []. Otherwise works like spawn/3.

    +

    Returns the pid of a new process started by the application of fun. +Otherwise works like spawn/3.

    - Source + Source

    spawn/2

    -

    Returns the pid of a new process started by the application of fun to the -empty list [] on node. If node does not exist, a useless pid is returned. +

    Returns the pid of a new process started by the application of fun +on node. If node does not exist, a useless pid is returned. Otherwise works like spawn/3.

    - Source + Source

    spawn/3

    Returns the pid of a new process started by the application of -module.function to args. The new process created will be placed in the system +module.function(args). The new process created will be placed in the system scheduler queue and be run some time later.

    See http://www.erlang.org/doc/man/erlang.html#spawn-3 for more info.

    - Source + Source

    spawn/4

    Returns the pid of a new process started by the application of -module.function to args on node. If node does not exists, a useless +module.function(args) on node. If node does not exists, a useless pid is returned. Otherwise works like spawn/3.

    - Source + Source

    spawn_link/1

    -

    Returns the pid of a new process started by the application of fun to the -empty list []. A link is created between the calling process and the new +

    Returns the pid of a new process started by the application of fun. +A link is created between the calling process and the new process, atomically. Otherwise works like spawn/3.

    - Source + Source

    spawn_link/2

    -

    Returns the pid of a new process started by the application of fun to the -empty list [] on node. A link is created between the calling process and the +

    Returns the pid of a new process started by the application of fun +on node. A link is created between the calling process and the new process, atomically. If node does not exist, a useless pid is returned (and due to the link, an exit signal with exit reason :noconnection will be received). Otherwise works like spawn/3.

    - Source + Source

    spawn_link/3

    Returns the pid of a new process started by the application of -module.function to args. A link is created between the calling process +module.function(args). A link is created between the calling process and the new process, atomically. Otherwise works like spawn/3.

    - Source + Source

    spawn_link/4

    Returns the pid of a new process started by the application of -module.function to args on node. A link is created between the calling +module.function(args) on node. A link is created between the calling process and the new process, atomically. If node does not exist, a useless pid is returned (and due to the link, an exit signal with exit reason :noconnection will be received). Otherwise works like spawn/3.

    - Source + Source +
    +

    + spawn_monitor/1 +

    +

    Returns the pid of a new process started by the application of fun +and reference for a monitor created to the new process. +Otherwise works like spawn/3.

    +
    + Source +
    +

    + spawn_monitor/3 +

    +

    A new process is started by the application of module.function(args) +and the process is monitored at the same time. Returns the pid and a +reference for the monitor. Otherwise works like spawn/3.

    +
    + Source +
    +

    + spawn_opt/2 +

    +

    The same as spawn/1 but accepts extra options as arguments. +Please read http://www.erlang.org/doc/man/erlang.html#spawn_opt-4 for +documentation of the options.

    +
    + Source +
    +

    + spawn_opt/3 +

    +

    The same as spawn/2 but accepts extra options as arguments. +Please read http://www.erlang.org/doc/man/erlang.html#spawn_opt-4 for +documentation of the options.

    +
    + Source +
    +

    + spawn_opt/4 +

    +

    The same as spawn/3 but accepts extra options as arguments. +Please read http://www.erlang.org/doc/man/erlang.html#spawn_opt-4 for +documentation of the options.

    +
    + Source +
    +

    + spawn_opt/5 +

    +

    The same as spawn/4 but accepts extra options as arguments. +Please read http://www.erlang.org/doc/man/erlang.html#spawn_opt-4 for +documentation of the options.

    +
    + Source

    unlink/1 @@ -437,7 +553,7 @@

    Functions

    See http://www.erlang.org/doc/man/erlang.html#unlink-1 for more info.

    - Source + Source

    unregister/1 @@ -446,7 +562,7 @@

    Functions

    See http://www.erlang.org/doc/man/erlang.html#unregister-1 for more info.

    - Source + Source

    whereis/1 @@ -456,7 +572,7 @@

    Functions

    See http://www.erlang.org/doc/man/erlang.html#whereis-1 for more info.

    - Source + Source
    diff --git a/docs/modules_list.html b/docs/modules_list.html index b54886a4f..57d753022 100644 --- a/docs/modules_list.html +++ b/docs/modules_list.html @@ -405,6 +405,20 @@

    Elixir.Builtin

  • +
  • + + !=/2 + + Elixir.Builtin +
  • + +
  • + + !==/2 + + Elixir.Builtin +
  • +
  • &&/2 @@ -414,231 +428,665 @@

  • - <>/2 + */2 + + Elixir.Builtin +
  • + +
  • + + +/2 + + Elixir.Builtin +
  • + +
  • + + ++/2 + + Elixir.Builtin +
  • + +
  • + + -/2 + + Elixir.Builtin +
  • + +
  • + + --/2 + + Elixir.Builtin +
  • + +
  • + + //2 + + Elixir.Builtin +
  • + +
  • + + + + Elixir.Builtin +
  • + +
  • + + <-/2 + + Elixir.Builtin +
  • + +
  • + + <=/2 + + Elixir.Builtin +
  • + +
  • + + <>/2 + + Elixir.Builtin +
  • + +
  • + + ==/2 + + Elixir.Builtin +
  • + +
  • + + ===/2 + + Elixir.Builtin +
  • + +
  • + + >/2 + + Elixir.Builtin +
  • + +
  • + + >=/2 + + Elixir.Builtin +
  • + +
  • + + __B__/2 + + Elixir.Builtin +
  • + +
  • + + __C__/2 + + Elixir.Builtin +
  • + +
  • + + __b__/2 + + Elixir.Builtin +
  • + +
  • + + __c__/2 + + Elixir.Builtin +
  • + +
  • + + __r__/2 + + Elixir.Builtin +
  • + +
  • + + abs/1 + + Elixir.Builtin +
  • + +
  • + + access/2 + + Elixir.Builtin +
  • + +
  • + + and/2 + + Elixir.Builtin +
  • + +
  • + + apply/2 + + Elixir.Builtin +
  • + +
  • + + apply/3 + + Elixir.Builtin +
  • + +
  • + + atom_to_binary/1 + + Elixir.Builtin +
  • + +
  • + + atom_to_binary/2 + + Elixir.Builtin +
  • + +
  • + + atom_to_list/1 + + Elixir.Builtin +
  • + +
  • + + binary_to_atom/1 + + Elixir.Builtin +
  • + +
  • + + binary_to_atom/2 + + Elixir.Builtin +
  • + +
  • + + binary_to_existing_atom/1 + + Elixir.Builtin +
  • + +
  • + + binary_to_existing_atom/2 + + Elixir.Builtin +
  • + +
  • + + binary_to_list/1 + + Elixir.Builtin +
  • + +
  • + + binary_to_list/3 + + Elixir.Builtin +
  • + +
  • + + binary_to_term/1 + + Elixir.Builtin +
  • + +
  • + + binary_to_term/2 + + Elixir.Builtin +
  • + +
  • + + bit_size/1 + + Elixir.Builtin +
  • + +
  • + + bitstring_to_list/1 + + Elixir.Builtin +
  • + +
  • + + byte_size/1 + + Elixir.Builtin +
  • + +
  • + + case/2 + + Elixir.Builtin +
  • + +
  • + + def/2 + + Elixir.Builtin +
  • + +
  • + + def/4 + + Elixir.Builtin +
  • + +
  • + + defdelegate/2 + + Elixir.Builtin +
  • + +
  • + + defexception/4 + + Elixir.Builtin +
  • + +
  • + + defimpl/3 + + Elixir.Builtin +
  • + +
  • + + defmodule/2 + + Elixir.Builtin +
  • + +
  • + + defoverridable/1 + + Elixir.Builtin +
  • + +
  • + + defp/2 + + Elixir.Builtin +
  • + +
  • + + defp/4 + + Elixir.Builtin +
  • + +
  • + + defprotocol/2 + + Elixir.Builtin +
  • + +
  • + + defrecord/4 + + Elixir.Builtin +
  • + +
  • + + destructure/2 + + Elixir.Builtin +
  • + +
  • + + div/2 + + Elixir.Builtin +
  • + +
  • + + elem/2 + + Elixir.Builtin +
  • + +
  • + + exit/1 + + Elixir.Builtin +
  • + +
  • + + float/1 + + Elixir.Builtin +
  • + +
  • + + float_to_list/1 Elixir.Builtin
  • - __B__/2 + halt/0 Elixir.Builtin
  • - __C__/2 + halt/1 Elixir.Builtin
  • - __b__/2 + halt/2 Elixir.Builtin
  • - __c__/2 + hd/1 Elixir.Builtin
  • - __r__/2 + if/2 Elixir.Builtin
  • - access/2 + in/2 Elixir.Builtin
  • - apply/2 + inspect/1 Elixir.Builtin
  • - apply/3 + integer_to_list/1 Elixir.Builtin
  • - atom_to_binary/1 + integer_to_list/2 Elixir.Builtin
  • - binary_to_atom/1 + iolist_size/1 Elixir.Builtin
  • - binary_to_existing_atom/1 + iolist_to_binary/1 Elixir.Builtin
  • - case/2 + is_atom/1 Elixir.Builtin
  • - def/2 + is_binary/1 Elixir.Builtin
  • - def/4 + is_bitstring/1 Elixir.Builtin
  • - defdelegate/2 + is_boolean/1 Elixir.Builtin
  • - defexception/4 + is_exception/1 Elixir.Builtin
  • - defimpl/3 + is_float/1 Elixir.Builtin
  • - defmodule/2 + is_function/1 Elixir.Builtin
  • - defoverridable/1 + is_function/2 Elixir.Builtin
  • - defp/2 + is_integer/1 Elixir.Builtin
  • - defp/4 + is_list/1 Elixir.Builtin
  • - defprotocol/2 + is_number/1 Elixir.Builtin
  • - defrecord/4 + is_pid/1 Elixir.Builtin
  • - destructure/2 + is_port/1 Elixir.Builtin
  • - div/2 + is_record/2 Elixir.Builtin
  • - elem/2 + is_reference/1 Elixir.Builtin
  • - if/2 + is_regex/1 Elixir.Builtin
  • - in/2 + is_tuple/1 Elixir.Builtin
  • - inspect/1 + length/1 Elixir.Builtin
  • - is_exception/1 + list_to_atom/1 Elixir.Builtin
  • - is_record/2 + list_to_binary/1 Elixir.Builtin
  • - is_regex/1 + list_to_bitstring/1 + + Elixir.Builtin +
  • + +
  • + + list_to_existing_atom/1 + + Elixir.Builtin +
  • + +
  • + + list_to_float/1 + + Elixir.Builtin +
  • + +
  • + + list_to_integer/1 + + Elixir.Builtin +
  • + +
  • + + list_to_integer/2 + + Elixir.Builtin +
  • + +
  • + + list_to_pid/1 + + Elixir.Builtin +
  • + +
  • + + list_to_tuple/1 + + Elixir.Builtin +
  • + +
  • + + make_ref/0 Elixir.Builtin
  • @@ -650,6 +1098,55 @@

    Elixir.Builtin

  • +
  • + + max/2 + + Elixir.Builtin +
  • + +
  • + + min/2 + + Elixir.Builtin +
  • + +
  • + + node/0 + + Elixir.Builtin +
  • + +
  • + + node/1 + + Elixir.Builtin +
  • + +
  • + + not/1 + + Elixir.Builtin +
  • + +
  • + + or/2 + + Elixir.Builtin +
  • + +
  • + + pid_to_list/1 + + Elixir.Builtin +
  • +
  • raise/1 @@ -678,6 +1175,13 @@

    Elixir.Builtin

  • +
  • + + round/1 + + Elixir.Builtin +
  • +
  • setelem/3 @@ -685,6 +1189,69 @@

    Elixir.Builtin

  • +
  • + + size/1 + + Elixir.Builtin +
  • + +
  • + + spawn/1 + + Elixir.Builtin +
  • + +
  • + + spawn/3 + + Elixir.Builtin +
  • + +
  • + + spawn_link/1 + + Elixir.Builtin +
  • + +
  • + + spawn_link/3 + + Elixir.Builtin +
  • + +
  • + + term_to_binary/1 + + Elixir.Builtin +
  • + +
  • + + term_to_binary/2 + + Elixir.Builtin +
  • + +
  • + + throw/1 + + Elixir.Builtin +
  • + +
  • + + tl/1 + + Elixir.Builtin +
  • +
  • to_binary/1 @@ -699,6 +1266,13 @@

    Elixir.Builtin

  • +
  • + + trunc/1 + + Elixir.Builtin +
  • +
  • try/1 @@ -706,6 +1280,20 @@

    Elixir.Builtin

  • +
  • + + tuple_size/1 + + Elixir.Builtin +
  • + +
  • + + tuple_to_list/1 + + Elixir.Builtin +
  • +
  • unless/2 @@ -720,6 +1308,20 @@

    Elixir.Builtin

  • +
  • + + var!/1 + + Elixir.Builtin +
  • + +
  • + + xor/2 + + Elixir.Builtin +
  • +
  • ||/2 @@ -2178,6 +2780,13 @@

    Process

  • +
  • + + exit/2 + + Process +
  • +
  • flag/2 @@ -2325,6 +2934,48 @@

    Process

  • +
  • + + spawn_monitor/1 + + Process +
  • + +
  • + + spawn_monitor/3 + + Process +
  • + +
  • + + spawn_opt/2 + + Process +
  • + +
  • + + spawn_opt/3 + + Process +
  • + +
  • + + spawn_opt/4 + + Process +
  • + +
  • + + spawn_opt/5 + + Process +
  • +
  • unlink/1 diff --git a/docs/output/Access.Atom.html b/docs/output/Access.Atom.html deleted file mode 100644 index 3f59c2519..000000000 --- a/docs/output/Access.Atom.html +++ /dev/null @@ -1,109 +0,0 @@ - - - - Access.Atom - - - - - - - - - - - - -
    -

    - Access.Atom - - impl - -

    - - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - access/2 -

    -

    Access the atom via keywords. Different from other -implementations, the Access protocol for atoms is -special cased during compilation time to provide -faster read and write access for records.

    - -

    This pattern can also be used in guards, which is -a very useful way to extract information from a -record.

    - -

    Examples

    - -
    def increment(State[counter: counter] = state) do
    -  state.counter(counter + 1)
    -end
    -
    - -

    In the example above, we use the Access protocol on atoms -to match the counter field in the record State. Considering -the record definition is as follows:

    - -
    defrecord State, counter: 0, other: nil
    -
    - -

    The clause above is translated to:

    - -
    def increment({ State, counter, _ } = state) do
    -  state.counter(counter + 1)
    -end
    -
    - -

    Which is a very convenient way to pattern match and have -faster read times. The same pattern can be used to create -a new record:

    - -
    def new_state(counter) do
    -  State[counter: counter]
    -end
    -
    - -

    All fields not specified on creation defaults to their -default value.

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/Access.BitString.html b/docs/output/Access.BitString.html deleted file mode 100644 index 45b119d40..000000000 --- a/docs/output/Access.BitString.html +++ /dev/null @@ -1,78 +0,0 @@ - - - - Access.BitString - - - - - - - - - - - - -
    -

    - Access.BitString - - impl - -

    - - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - access/2 -

    -

    Access the binary via a predicate.

    - -

    If a regular expression, it returns a binary with the -matched contents.

    - -

    Examples

    - -
    binary = "abc"
    -Binary.access binary, %r(a) #=> "a"
    -
    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/Access.Function.html b/docs/output/Access.Function.html deleted file mode 100644 index 75cb82ab6..000000000 --- a/docs/output/Access.Function.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - Access.Function - - - - - - - - - - - - -
    -

    - Access.Function - - impl - -

    - - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - access/2 -

    -

    The Access protocol for functions simply invokes -the function passing the item as argument. This -is useful because it allows a function to be -passed as argument in places a dict would also fit.

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/Access.List.html b/docs/output/Access.List.html deleted file mode 100644 index 475f9d215..000000000 --- a/docs/output/Access.List.html +++ /dev/null @@ -1,89 +0,0 @@ - - - - Access.List - - - - - - - - - - - - -
    -

    - Access.List - - impl - -

    - - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - access/2 -

    -

    Access the list via a predicate.

    - -

    If a regular expression, it returns a list with the -matched contents.

    - -

    If an atom, assumes the list is a keywords list and -access the key in the keywords equals to the given -atom.

    - -

    Notice this protocol does not implement an integer -lookup. This is intentional since doing an index -based access on lists is usually undesired.

    - -

    Examples

    - -
    list = 'sample'
    -list[%r/a/] #=> 'a'
    -
    -keywords = [a: 1, b: 2]
    -keywords[:a] #=> 1
    -
    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/Access.Tuple.html b/docs/output/Access.Tuple.html deleted file mode 100644 index 62d6e71ab..000000000 --- a/docs/output/Access.Tuple.html +++ /dev/null @@ -1,78 +0,0 @@ - - - - Access.Tuple - - - - - - - - - - - - -
    -

    - Access.Tuple - - impl - -

    - - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - access/2 -

    -

    Access the tuple via an integer. Negative indexes -performs an inverted lookup, for example, -1 can be -used to retrieve the last item in the tuple. Returns -nil if an out of bounds access occurs.

    - -

    Examples

    - -
    tuple = { :a, :b, :c }
    -tuple[-1] #=> :c
    -
    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/Access.html b/docs/output/Access.html deleted file mode 100644 index 8ae50d425..000000000 --- a/docs/output/Access.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - Access - - - - - - - - - - - - -
    -

    - Access - - protocol - -

    - - -
    -

    The Access protocol is the underlying protocol invoked -when the brackets syntax is used. For instance, foo[bar] -is translated to access foo, bar which, by default, -invokes Access.access protocol.

    - -

    This protocol is implemented by default for most builtin -types, like tuples, atoms, functions, etc.

    - -
    - - - Source - - -

    Implementations

    - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - access/2 -

    -

    Receives the element being accessed and the access item.

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/ArgumentError.html b/docs/output/ArgumentError.html deleted file mode 100644 index 1df5e4eee..000000000 --- a/docs/output/ArgumentError.html +++ /dev/null @@ -1,145 +0,0 @@ - - - - ArgumentError - - - - - - - - - - - - -
    -

    - ArgumentError - - exception - -

    - - - - Source - - - - -

    Fields (and defaults)

    -
      - -
    • - - message: "argument error" - -
    • - -
    - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - exception/1 -

    -
    - Source -
    -

    - exception/2 -

    -
    - Source -
    -

    - message/1 -

    -
    - Source -
    -

    - message/2 -

    -
    - Source -
    -

    - new/0 -

    -
    - Source -
    -

    - new/1 -

    -
    - Source -
    -

    - update_message/2 -

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/ArithmeticError.html b/docs/output/ArithmeticError.html deleted file mode 100644 index b120ef790..000000000 --- a/docs/output/ArithmeticError.html +++ /dev/null @@ -1,145 +0,0 @@ - - - - ArithmeticError - - - - - - - - - - - - -
    -

    - ArithmeticError - - exception - -

    - - - - Source - - - - -

    Fields (and defaults)

    -
      - -
    • - - message: "bad argument in arithmetic expression" - -
    • - -
    - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - exception/1 -

    -
    - Source -
    -

    - exception/2 -

    -
    - Source -
    -

    - message/1 -

    -
    - Source -
    -

    - message/2 -

    -
    - Source -
    -

    - new/0 -

    -
    - Source -
    -

    - new/1 -

    -
    - Source -
    -

    - update_message/2 -

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/BadArityError.html b/docs/output/BadArityError.html deleted file mode 100644 index 66723218f..000000000 --- a/docs/output/BadArityError.html +++ /dev/null @@ -1,195 +0,0 @@ - - - - BadArityError - - - - - - - - - - - - -
    -

    - BadArityError - - exception - -

    - - - - Source - - - - -

    Fields (and defaults)

    -
      - -
    • - - args: nil - -
    • - -
    • - - function: nil - -
    • - -
    - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - args/1 -

    -
    - Source -
    -

    - args/2 -

    -
    - Source -
    -

    - exception/1 -

    -
    - Source -
    -

    - exception/2 -

    -
    - Source -
    -

    - function/1 -

    -
    - Source -
    -

    - function/2 -

    -
    - Source -
    -

    - message/1 -

    -
    - Source -
    -

    - new/0 -

    -
    - Source -
    -

    - new/1 -

    -
    - Source -
    -

    - update_args/2 -

    -
    - Source -
    -

    - update_function/2 -

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/BadFunctionError.html b/docs/output/BadFunctionError.html deleted file mode 100644 index f71203516..000000000 --- a/docs/output/BadFunctionError.html +++ /dev/null @@ -1,156 +0,0 @@ - - - - BadFunctionError - - - - - - - - - - - - -
    -

    - BadFunctionError - - exception - -

    - - - - Source - - - - -

    Fields (and defaults)

    -
      - -
    • - - actual: nil - -
    • - -
    - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - actual/1 -

    -
    - Source -
    -

    - actual/2 -

    -
    - Source -
    -

    - exception/1 -

    -
    - Source -
    -

    - exception/2 -

    -
    - Source -
    -

    - message/1 -

    -
    - Source -
    -

    - new/0 -

    -
    - Source -
    -

    - new/1 -

    -
    - Source -
    -

    - update_actual/2 -

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/Binary.Chars.Atom.html b/docs/output/Binary.Chars.Atom.html deleted file mode 100644 index 0147163f6..000000000 --- a/docs/output/Binary.Chars.Atom.html +++ /dev/null @@ -1,70 +0,0 @@ - - - - Binary.Chars.Atom - - - - - - - - - - - - -
    -

    - Binary.Chars.Atom - - impl - -

    - - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - to_binary/1 -

    -

    Convert the atom literally to a binary, except -nil which is converted to an empty string.

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/Binary.Chars.BitString.html b/docs/output/Binary.Chars.BitString.html deleted file mode 100644 index c99718b52..000000000 --- a/docs/output/Binary.Chars.BitString.html +++ /dev/null @@ -1,69 +0,0 @@ - - - - Binary.Chars.BitString - - - - - - - - - - - - -
    -

    - Binary.Chars.BitString - - impl - -

    - - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - to_binary/1 -

    -

    Simply returns the binary itself.

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/Binary.Chars.List.html b/docs/output/Binary.Chars.List.html deleted file mode 100644 index 41429f50e..000000000 --- a/docs/output/Binary.Chars.List.html +++ /dev/null @@ -1,78 +0,0 @@ - - - - Binary.Chars.List - - - - - - - - - - - - -
    -

    - Binary.Chars.List - - impl - -

    - - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - to_binary/1 -

    -

    Consider the list is an iolist and converts it -to a binary. This allows a list of binaries, or -a charlist, or a mix of both, to be converted -successfully.

    - -

    Examples

    - -
    to_binary 'foo' #=> "foo"
    -to_binary ["foo", 'bar'] #=> "foobar"
    -
    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/Binary.Chars.Number.html b/docs/output/Binary.Chars.Number.html deleted file mode 100644 index 3ab66b009..000000000 --- a/docs/output/Binary.Chars.Number.html +++ /dev/null @@ -1,69 +0,0 @@ - - - - Binary.Chars.Number - - - - - - - - - - - - -
    -

    - Binary.Chars.Number - - impl - -

    - - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - to_binary/1 -

    -

    Simply converts the number (integer or a float) to a binary.

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/Binary.Chars.html b/docs/output/Binary.Chars.html deleted file mode 100644 index c822cafe5..000000000 --- a/docs/output/Binary.Chars.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - Binary.Chars - - - - - - - - - - - - -
    -

    - Binary.Chars - - protocol - -

    - - -
    -

    The Binary.Chars protocol is responsible for -converting a structure to a Binary (only if applicable). -The only function required to be implemented is -to_binary which does the conversion.

    - -

    The to_binary function automatically imported -by Elixir.Builtin invokes this protocol. String -interpolation also invokes to_binary in its -arguments. For example, "foo#{bar}" is the same -as "foo" <> to_binary(bar).

    - -
    - - - Source - - -

    Implementations

    - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - to_binary/1 -

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/Binary.Inspect.Any.html b/docs/output/Binary.Inspect.Any.html deleted file mode 100644 index b8ad0b677..000000000 --- a/docs/output/Binary.Inspect.Any.html +++ /dev/null @@ -1,75 +0,0 @@ - - - - Binary.Inspect.Any - - - - - - - - - - - - -
    -

    - Binary.Inspect.Any - - impl - -

    - - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - inspect/1 -

    -

    For all other terms not implemented, we use the default -Erlang representation.

    - -

    Examples

    - -
    inspect Process.self #=> "<0.35.0>"
    -
    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/Binary.Inspect.Atom.html b/docs/output/Binary.Inspect.Atom.html deleted file mode 100644 index 3a18760dc..000000000 --- a/docs/output/Binary.Inspect.Atom.html +++ /dev/null @@ -1,79 +0,0 @@ - - - - Binary.Inspect.Atom - - - - - - - - - - - - -
    -

    - Binary.Inspect.Atom - - impl - -

    - - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - inspect/1 -

    -

    Represents the atom as an Elixir term. -The atoms false, true and nil are simply -quoted. Modules are properly represented -as modules using the dot notation.

    - -

    Examples

    - -
    inspect(:foo)    #=> ":foo"
    -inspect(nil)     #=> "nil"
    -inspect(Foo.Bar) #=> "Foo.Bar"
    -
    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/Binary.Inspect.BitString.html b/docs/output/Binary.Inspect.BitString.html deleted file mode 100644 index da1fe0685..000000000 --- a/docs/output/Binary.Inspect.BitString.html +++ /dev/null @@ -1,76 +0,0 @@ - - - - Binary.Inspect.BitString - - - - - - - - - - - - -
    -

    - Binary.Inspect.BitString - - impl - -

    - - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - inspect/1 -

    -

    Represents the string as itself escaping -all necessary characters.

    - -

    Examples

    - -
    inspect("bar")   #=> "bar"
    -inspect("f\"oo") #=> "f\"oo"
    -
    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/Binary.Inspect.List.html b/docs/output/Binary.Inspect.List.html deleted file mode 100644 index 3dc06c2b8..000000000 --- a/docs/output/Binary.Inspect.List.html +++ /dev/null @@ -1,89 +0,0 @@ - - - - Binary.Inspect.List - - - - - - - - - - - - -
    -

    - Binary.Inspect.List - - impl - -

    - - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - container_join/3 -

    -
    - Source -
    -

    - inspect/1 -

    -

    Represents a list checking if it can be printed or not. -If so, a single-quoted representation is returned, -otherwise the brackets syntax is used.

    - -

    Examples

    - -
    inspect('bar')       #=> 'bar'
    -inspect([0|'bar'])   #=> "[0,98,97,114]"
    -inspect([:foo,:bar]) #=> "[:foo, :bar]"
    -
    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/Binary.Inspect.Number.html b/docs/output/Binary.Inspect.Number.html deleted file mode 100644 index 52c57f848..000000000 --- a/docs/output/Binary.Inspect.Number.html +++ /dev/null @@ -1,74 +0,0 @@ - - - - Binary.Inspect.Number - - - - - - - - - - - - -
    -

    - Binary.Inspect.Number - - impl - -

    - - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - inspect/1 -

    -

    Represents the number as a binary.

    - -

    Examples

    - -
    inspect(1) #=> "1"
    -
    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/Binary.Inspect.Regex.html b/docs/output/Binary.Inspect.Regex.html deleted file mode 100644 index 27179e40a..000000000 --- a/docs/output/Binary.Inspect.Regex.html +++ /dev/null @@ -1,74 +0,0 @@ - - - - Binary.Inspect.Regex - - - - - - - - - - - - -
    -

    - Binary.Inspect.Regex - - impl - -

    - - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - inspect/1 -

    -

    Represents the Regex using the %r"" syntax.

    - -

    Examples

    - -
    inspect(%r/foo/m) #=> "%r\"foo\"m"
    -
    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/Binary.Inspect.Tuple.html b/docs/output/Binary.Inspect.Tuple.html deleted file mode 100644 index 6821b2867..000000000 --- a/docs/output/Binary.Inspect.Tuple.html +++ /dev/null @@ -1,76 +0,0 @@ - - - - Binary.Inspect.Tuple - - - - - - - - - - - - -
    -

    - Binary.Inspect.Tuple - - impl - -

    - - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - inspect/1 -

    -

    Inspect tuples. If the tuple represents a record, -it shows it nicely formatted using the access syntax.

    - -

    Examples

    - -
    inspect({1,2,3})            #=> "{1,2,3}"
    -inspect(ArgumentError.new)  #=> ArgumentError[message: "argument error"]
    -
    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/Binary.Inspect.html b/docs/output/Binary.Inspect.html deleted file mode 100644 index c330a64dc..000000000 --- a/docs/output/Binary.Inspect.html +++ /dev/null @@ -1,125 +0,0 @@ - - - - Binary.Inspect - - - - - - - - - - - - -
    -

    - Binary.Inspect - - protocol - -

    - - -
    -

    The Binary.Inspect protocol is responsible for -converting any structure to a Binary for textual -representation. All basic data structures (tuple, -list, function, pid, etc) implement the inspect -protocol. Other structures are adviced to implement -the protocol in order to provide pretty printing.

    - -
    - - - Source - - -

    Implementations

    - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - inspect/1 -

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/Binary.html b/docs/output/Binary.html deleted file mode 100644 index a636a3ae2..000000000 --- a/docs/output/Binary.html +++ /dev/null @@ -1,205 +0,0 @@ - - - - Binary - - - - - - - - - - - - -
    -

    - Binary - -

    - - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - access/2 -

    -

    Simply invokes the Access protocol for the given binary. -Check Access.BitString for more information.

    -
    - Source -
    -

    - escape/2 -

    -

    Receives a char list and escapes all special chars (like \n) -and interpolation markers. A last argument is given and wraps -the whole char list given.

    - -

    Examples

    - -
    Binary.escape "foo", ?'
    -#=> "'foo'"
    -
    -
    - Source -
    -

    - printable?/1 -

    -

    Check if a binary is printable considering it is encoded -as UTF-8. Returns true if so, false otherwise.

    - -

    Examples

    - -
    Binary.printable?("abc") #=> true
    -
    -
    - Source -
    -

    - unescape/1 -

    -

    Unescape the given chars. The unescaping is driven by the same -rules as single- and double-quoted strings. Check unescape/2 -for information on how to customize the escaping map.

    - -

    In this setup, Elixir will escape the following: \b, \d, -\e, \f, \n, \r, \s, \t and \v. Octals are also -escaped according to the latin1 set they represent.

    - -

    Examples

    - -
    Binary.unescape "example\\n"
    -# => "example\n"
    -
    - -

    In the example above, we pass a string with \n escaped -and we return a version with it unescaped.

    -
    - Source -
    -

    - unescape/2 -

    -

    Unescape the given chars according to the map given. -Check unescape/1 if you want to use the same map as Elixir -single- and double-quoted strings.

    - -

    Map

    - -

    The map must be a function. The function receives an integer -representing the number of the characters it wants to unescape. -Here is the default mapping function implemented by Elixir:

    - -
    def unescape_map(?b), do: ?\b
    -def unescape_map(?d), do: ?\d
    -def unescape_map(?e), do: ?\e
    -def unescape_map(?f), do: ?\f
    -def unescape_map(?n), do: ?\n
    -def unescape_map(?r), do: ?\r
    -def unescape_map(?s), do: ?\s
    -def unescape_map(?t), do: ?\t
    -def unescape_map(?v), do: ?\v
    -def unescape_map(e), do: e
    -
    - -

    If the unescape_map function returns false. The char is -not escaped and \ is kept in the char list.

    - -

    Examples

    - -

    Using the unescape_map defined above is easy:

    - -
    Binary.unescape "example\\n", unescape_map(&1)
    -
    -
    - Source -
    -

    - unescape_tokens/1 -

    -

    Unescape the given tokens according to the default map. -Check unescape/1 and unescape/2 for more information -about unescaping. Only tokens that are char lists are -unescaped, all others are ignored. This method is useful -when implementing your own sigils. Check the implementation -of Elixir::Builtin.__b__ for examples.

    -
    - Source -
    -

    - unescape_tokens/2 -

    -

    Unescape the given tokens according to the given map. -Check unescape_tokens/1 and unescaped/2 for more information.

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/Bitwise.html b/docs/output/Bitwise.html deleted file mode 100644 index 3882275f4..000000000 --- a/docs/output/Bitwise.html +++ /dev/null @@ -1,133 +0,0 @@ - - - - Bitwise - - - - - - - - - - - - -
    -

    - Bitwise - -

    - - -
    -

    This module provide macros for bitwise operators -provided by Erlang. These macros can be used in guards.

    - -
    - - - Source - - - - - - - - -

    Macros summary

    - - - - - - -
    -

    Macros

    -
    -

    - band/2 -

    -

    Bitwise and.

    -
    - Source -
    -

    - bnot/1 -

    -

    Bitwise not.

    -
    - Source -
    -

    - bor/2 -

    -

    Bitwise or.

    -
    - Source -
    -

    - bsl/2 -

    -

    Arithmetic bitshift left.

    -
    - Source -
    -

    - bsr/2 -

    -

    Arithmetic bitshift right.

    -
    - Source -
    -

    - bxor/2 -

    -

    Bitwise xor.

    -
    - Source -
    -
    - -
    - - diff --git a/docs/output/CaseClauseError.html b/docs/output/CaseClauseError.html deleted file mode 100644 index 47d7115b5..000000000 --- a/docs/output/CaseClauseError.html +++ /dev/null @@ -1,156 +0,0 @@ - - - - CaseClauseError - - - - - - - - - - - - -
    -

    - CaseClauseError - - exception - -

    - - - - Source - - - - -

    Fields (and defaults)

    -
      - -
    • - - actual: nil - -
    • - -
    - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - actual/1 -

    -
    - Source -
    -

    - actual/2 -

    -
    - Source -
    -

    - exception/1 -

    -
    - Source -
    -

    - exception/2 -

    -
    - Source -
    -

    - message/1 -

    -
    - Source -
    -

    - new/0 -

    -
    - Source -
    -

    - new/1 -

    -
    - Source -
    -

    - update_actual/2 -

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/Code.html b/docs/output/Code.html deleted file mode 100644 index d2d55757b..000000000 --- a/docs/output/Code.html +++ /dev/null @@ -1,244 +0,0 @@ - - - - Code - - - - - - - - - - - - -
    -

    - Code - -

    - - -
    -

    The Code module is responsible to manage code compilation, -code evaluation and code loading.

    - -
    - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - append_path/1 -

    -

    Appends a path to Erlang VM code path.

    -
    - Source -
    -

    - compile_string/2 -

    -

    Compiles the given string and returns a list of tuples where -the first element is the module name and the second one is its -binary.

    - -

    For compiling many files at once, check Elixir.ParallelCompiler.

    -
    - Source -
    -

    - compiler_options/0 -

    -

    Loads the compilation options from the code server. -Check compiler_options/1 for more information.

    -
    - Source -
    -

    - compiler_options/1 -

    -

    Sets compilation options. Those options are global -since they are stored by Elixir's Code Server.

    - -

    Available options are:

    - -
      -
    • docs - when true, retain documentation in the compiled module;
    • -
    • debug_info - when true, retain debug information in the compiled module. -Notice debug information can be used to reconstruct the source code;
    • -
    • ignoremoduleconflict - when true, override modules that were already defined;
    • -
    -
    - Source -
    -

    - ensure_loaded/1 -

    -

    Ensure if the given module is loaded. If the module is already loaded, -it works as no-op. If the module was not loaded yet, it tries to load it.

    - -

    If it succeeds loading the module anyhow, it returns { :module, module }. -If not, returns { :error, reason } with the error reason.

    -
    - Source -
    -

    - eval/3 -

    -

    Evalutes the contents given by string. The second argument is the binding -(which should be a Keyword) followed by a keyword list of options. The -options can be:

    - -
      -
    • :file - the file to be considered in the evaluation
    • -
    • :line - the line the script starts
    • -
    • :delegate_locals_to - delegate local calls to the given module, -otherwise functions are evaluated inside Erlang's default scope.
    • -
    - -

    Examples

    - -
    Code.eval "a + b", [a: 1, b: 2], file: __FILE__, line: __LINE__
    -# => { 3, [ {:a, 1}, {:b, 2} ] }
    -
    -
    - Source -
    -

    - eval_quoted/3 -

    -

    Evalutes the quoted contents.

    - -

    Examples

    - -
    contents = quote hygiene: false, do: a + b
    -Code.eval_quoted contents, [a: 1, b: 2], file: __FILE__, line: __LINE__
    -# => { 3, [ {:a, 1}, {:b, 2} ] }
    -
    -
    - Source -
    -

    - load_file/2 -

    -

    Loads the given file. Accepts relative_to as an argument to tell -where the file is located. If the file was already required/loaded, -loads it again. It returns the full path of the loaded file.

    - -

    When loading a file, you may skip passing .exs as extension as Elixir -automatically adds it for you.

    -
    - Source -
    -

    - loaded_files/0 -

    -

    Returns all the loaded files.

    -
    - Source -
    -

    - prepend_path/1 -

    -

    Prepends a path to Erlang VM code path.

    -
    - Source -
    -

    - require_file/2 -

    -

    Requires the given file. Accepts relative_to as an argument to tell -where the file is located. If the file was already required/loaded, -returns nil, otherwise the full path of the loaded file.

    - -

    When requiring a file, you may skip passing .exs as extension as -Elixir automatically adds it for you.

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/CompileError.html b/docs/output/CompileError.html deleted file mode 100644 index aa3b13263..000000000 --- a/docs/output/CompileError.html +++ /dev/null @@ -1,234 +0,0 @@ - - - - CompileError - - - - - - - - - - - - -
    -

    - CompileError - - exception - -

    - - - - Source - - - - -

    Fields (and defaults)

    -
      - -
    • - - description: "compile error" - -
    • - -
    • - - file: nil - -
    • - -
    • - - line: nil - -
    • - -
    - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - description/1 -

    -
    - Source -
    -

    - description/2 -

    -
    - Source -
    -

    - exception/1 -

    -
    - Source -
    -

    - exception/2 -

    -
    - Source -
    -

    - file/1 -

    -
    - Source -
    -

    - file/2 -

    -
    - Source -
    -

    - line/1 -

    -
    - Source -
    -

    - line/2 -

    -
    - Source -
    -

    - message/1 -

    -
    - Source -
    -

    - new/0 -

    -
    - Source -
    -

    - new/1 -

    -
    - Source -
    -

    - update_description/2 -

    -
    - Source -
    -

    - update_file/2 -

    -
    - Source -
    -

    - update_line/2 -

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/Dict.HashDict.Record.html b/docs/output/Dict.HashDict.Record.html deleted file mode 100644 index 231af5418..000000000 --- a/docs/output/Dict.HashDict.Record.html +++ /dev/null @@ -1,200 +0,0 @@ - - - - Dict.HashDict.Record - - - - - - - - - - - - -
    -

    - Dict.HashDict.Record - - impl - -

    - - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - delete/2 -

    -
    - Source -
    -

    - empty/1 -

    -
    - Source -
    -

    - get/3 -

    -
    - Source -
    -

    - has_key?/2 -

    -
    - Source -
    -

    - keys/1 -

    -
    - Source -
    -

    - merge/2 -

    -
    - Source -
    -

    - merge/3 -

    -
    - Source -
    -

    - put/3 -

    -
    - Source -
    -

    - size/1 -

    -
    - Source -
    -

    - to_list/1 -

    -
    - Source -
    -

    - update/3 -

    -
    - Source -
    -

    - update/4 -

    -
    - Source -
    -

    - values/1 -

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/Dict.Orddict.Record.html b/docs/output/Dict.Orddict.Record.html deleted file mode 100644 index 299875f93..000000000 --- a/docs/output/Dict.Orddict.Record.html +++ /dev/null @@ -1,200 +0,0 @@ - - - - Dict.Orddict.Record - - - - - - - - - - - - -
    -

    - Dict.Orddict.Record - - impl - -

    - - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - delete/2 -

    -
    - Source -
    -

    - empty/1 -

    -
    - Source -
    -

    - get/3 -

    -
    - Source -
    -

    - has_key?/2 -

    -
    - Source -
    -

    - keys/1 -

    -
    - Source -
    -

    - merge/2 -

    -
    - Source -
    -

    - merge/3 -

    -
    - Source -
    -

    - put/3 -

    -
    - Source -
    -

    - size/1 -

    -
    - Source -
    -

    - to_list/1 -

    -
    - Source -
    -

    - update/3 -

    -
    - Source -
    -

    - update/4 -

    -
    - Source -
    -

    - values/1 -

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/Dict.html b/docs/output/Dict.html deleted file mode 100644 index e3fc24399..000000000 --- a/docs/output/Dict.html +++ /dev/null @@ -1,325 +0,0 @@ - - - - Dict - - - - - - - - - - - - -
    -

    - Dict - - protocol - -

    - - -
    -

    This module provides the Dict protocol -with the goal of being a common API -to work with dictionaries.

    - -
    - - - Source - - -

    Implementations

    - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - delete/2 -

    -

    Removes the entry stored under the given key from dict. -If dict does not contain key, returns the dictionary unchanged.

    - -

    Examples

    - -
    Dict.delete [a: 1, b: 2], :a  #=> [b: 2]
    -Dict.delete [b: 2], :a        #=> [b: 2]
    -
    -
    - Source -
    -

    - empty/1 -

    -

    Returns an empty dict of the same type as dict.

    -
    - Source -
    -

    - get/2 -

    -

    Returns the value associated with key in dict. If dict does not -contain key, returns default (or nil if not provided).

    - -

    Examples

    - -
    Dict.get [a: 1], :a     #=> 1
    -Dict.get [a: 1], :b     #=> nil
    -Dict.get [a: 1], :b, 3  #=> 3
    -
    -
    - Source -
    -

    - get/3 -

    -
    - Source -
    -

    - has_key?/2 -

    -

    Returns whether the given key exists in the given dict.

    - -

    Examples

    - -
    Dict.has_key?([a:, 1], :a)  #=> true
    -Dict.has_key?([a:, 1], :b)  #=> false
    -
    -
    - Source -
    -

    - keys/1 -

    -

    Returns a list containing all dict's keys. -The keys are not guaranteed to be sorted, unless -the underlying dict implementation defines so.

    - -

    Examples

    - -
    Dict.keys [a: 1, b: 2]  #=> [:a,:b]
    -
    -
    - Source -
    -

    - merge/2 -

    -

    Merges two dicts into one. If the dicts have duplicated entries, the one -given as second argument wins.

    - -

    Examples

    - -
    Dict.merge [a: 1, b: 2], [a: 3, d: 4]
    -#=> [a:3, b:2, d: 4]
    -
    -
    - Source -
    -

    - merge/3 -

    -

    Merges two dicts into one. If the dicts have duplicated entries, the given -function is invoked to solve conflicts.

    - -

    Examples

    - -
    Dict.merge [a: 1, b: 2], [a: 3, d: 4], fn(_k, v1, v2) ->
    -  v1 + v2
    -end
    -#=> [a: 4, b: 2, d: 4]
    -
    -
    - Source -
    -

    - put/3 -

    -

    Stores the given value under key in dict. -If dict already has key, the stored value is replaced by the new one.

    - -

    Examples

    - -
    Dict.put [a: 1, b: 2], :a, 3
    -#=> [a: 3, b: 2]
    -
    -
    - Source -
    -

    - size/1 -

    -

    Returns the number of elements in dict.

    - -

    Examples

    - -
    Dict.size [a: 1, b: 2]  #=> 2
    -
    -
    - Source -
    -

    - to_list/1 -

    -

    Returns a list of key-value pairs stored in dict. -No particular order is enforced.

    -
    - Source -
    -

    - update/3 -

    -

    Update a value in dict by calling fun on the value to get a new -value. An exception is generated if key is not present in the dict.

    - -

    Examples

    - -
    Dict.update [a: 1, b: 2], :a, fn(val) -> -val end
    -#=> [a: -1, b: 2]
    -
    -
    - Source -
    -

    - update/4 -

    -

    Update a value in dict by calling fun on the value to get a new value. If -key is not present in dict then initial will be stored as the first -value.

    - -

    Examples

    - -
    Dict.update [a: 1, b: 2], :c, 3, fn(val) -> -val end
    -#=> [a: 1, b: 2, c: 3]
    -
    -
    - Source -
    -

    - values/1 -

    -

    Returns a list containing all dict's values.

    - -

    Examples

    - -
    Dict.values [a: 1, b: 2]  #=> [1,2]
    -
    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/EEx.AssignsEngine.html b/docs/output/EEx.AssignsEngine.html deleted file mode 100644 index 1a8e207ad..000000000 --- a/docs/output/EEx.AssignsEngine.html +++ /dev/null @@ -1,71 +0,0 @@ - - - - EEx.AssignsEngine - - - - - - - - - - - - -
    -

    - EEx.AssignsEngine - -

    - - -
    -

    An abstract engine that, when used with the -TransformerEngine, allows a developer to access -assigns using @ as syntax.

    - -

    This engine is included by default on the SmartEngine.

    - -

    Examples

    - -
    defmodule MyEngine do
    -  use EEx.TransformerEngine
    -  use EEx.AssignsEngine
    -end
    -
    -EEx.eval_string("<%= @foo %>", assigns: [foo: 1])
    -#=> 1
    -
    - -

    In the example above, we can access the value foo under -the binding assigns using @foo. This is useful when -a template, after compiled, may receive different assigns -and the developer don't want to recompile it for each -variable set.

    - -
    - - - Source - - - - - - - - - - - - -
    - - diff --git a/docs/output/EEx.Engine.html b/docs/output/EEx.Engine.html deleted file mode 100644 index da6c0c9d2..000000000 --- a/docs/output/EEx.Engine.html +++ /dev/null @@ -1,121 +0,0 @@ - - - - EEx.Engine - - - - - - - - - - - - -
    -

    - EEx.Engine - -

    - - -
    -

    This is the basic EEx engine that ships with Elixir. -An engine needs to implement two functions:

    - -
      -
    • handle_text(buffer, text) - it receives the buffer, -the text and must return a new quoted expression;

    • -
    • handle_expr(buffer, marker, expr) - it receives the buffer, -the marker, the expr and must return a new quoted expression;

    • -
    - -

    The marker is what follows exactly after <%. For example, - <% foo %> has an empty marker, but <%= foo %> has '=' - as marker. The allowed markers so far are:

    - -
      -
    • ''
    • -
    • '='
    • -
    - -

    Read handle_expr/3 below for more information about the markers - implemented by default by this engine.

    - -
    - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - behaviour_info/1 -

    -
    - Source -
    -

    - handle_expr/3 -

    -

    Implements expressions according to the markers.

    - -
    <% Elixir expression - inline with output %>
    -<%= Elixir expression - replace with result %>
    -
    - -

    All other markers are not implemented by this engine.

    -
    - Source -
    -

    - handle_text/2 -

    -

    The default implementation simply concatenates text to the buffer.

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/EEx.ForEngine.html b/docs/output/EEx.ForEngine.html deleted file mode 100644 index 18c2e9155..000000000 --- a/docs/output/EEx.ForEngine.html +++ /dev/null @@ -1,65 +0,0 @@ - - - - EEx.ForEngine - - - - - - - - - - - - -
    -

    - EEx.ForEngine - -

    - - -
    -

    An abstract engine that, when used with the -TransformerEngine, allows a developer to easily loop -using for.

    - -

    This engine is included by default on the SmartEngine.

    - -

    Examples

    - -
    defmodule MyEngine do
    -  use EEx.TransformerEngine
    -  use EEx.ForEngine
    -end
    -
    -EEx.eval_string("<%= for x in [1,2,3] do %><%= x %>\n<% end %>", assigns: [foo: 1])
    -#=> "1\n2\n3\n"
    -
    - -
    - - - Source - - - - - - - - - - - - -
    - - diff --git a/docs/output/EEx.SmartEngine.html b/docs/output/EEx.SmartEngine.html deleted file mode 100644 index 18d9fd770..000000000 --- a/docs/output/EEx.SmartEngine.html +++ /dev/null @@ -1,86 +0,0 @@ - - - - EEx.SmartEngine - - - - - - - - - - - - -
    -

    - EEx.SmartEngine - -

    - - -
    -

    An engine meant for end-user usage that includes both -AssignsEngine and ForEngine conveniences. Therefore, -a developer can easily access assigns via @ and loop -using for. Read EEx.AssignsEngine and EEx.ForEngine -for examples.

    - -
    - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - handle_expr/3 -

    -
    - Source -
    -

    - handle_text/2 -

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/EEx.SyntaxError.html b/docs/output/EEx.SyntaxError.html deleted file mode 100644 index 564d44959..000000000 --- a/docs/output/EEx.SyntaxError.html +++ /dev/null @@ -1,145 +0,0 @@ - - - - EEx.SyntaxError - - - - - - - - - - - - -
    -

    - EEx.SyntaxError - - exception - -

    - - - - Source - - - - -

    Fields (and defaults)

    -
      - -
    • - - message: nil - -
    • - -
    - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - exception/1 -

    -
    - Source -
    -

    - exception/2 -

    -
    - Source -
    -

    - message/1 -

    -
    - Source -
    -

    - message/2 -

    -
    - Source -
    -

    - new/0 -

    -
    - Source -
    -

    - new/1 -

    -
    - Source -
    -

    - update_message/2 -

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/EEx.TransformerEngine.html b/docs/output/EEx.TransformerEngine.html deleted file mode 100644 index e5929b133..000000000 --- a/docs/output/EEx.TransformerEngine.html +++ /dev/null @@ -1,57 +0,0 @@ - - - - EEx.TransformerEngine - - - - - - - - - - - - -
    -

    - EEx.TransformerEngine - -

    - - -
    -

    An abstract engine that is meant to be used and -built upon in other modules. This engine implements -the EEx.Engine behavior and provides a transform -overridable directive that allows a developer to -customize the expression returned by the engine.

    - -

    Check EEx.AssignsEngine, EEx.ForEngine and -EEx.SmartEngine for examples of using this module.

    - -
    - - - Source - - - - - - - - - - - - -
    - - diff --git a/docs/output/EEx.html b/docs/output/EEx.html deleted file mode 100644 index a25fc922b..000000000 --- a/docs/output/EEx.html +++ /dev/null @@ -1,272 +0,0 @@ - - - - EEx - - - - - - - - - - - - -
    -

    - EEx - -

    - - -
    -

    EEx stands for Embedded Elixir. It allows you to embed -Elixir code inside a string in a robust way:

    - -
    EEx.eval_string "foo <%= bar %>", [bar: "baz"]
    -#=> "foo baz"
    -
    - -

    API

    - -

    This module provides 3 main APIs for you to use:

    - -

    1) Evaluate a string (eval_string) or a file (eval_file) - directly. This is the simplest API to use but also the - slowest, since the code is evaluated and not compiled before;

    - -

    2) Define a function from a string (function_from_string) - or a file (function_from_file). This allows you to embed - the template as a function inside a module which will then - be compiled. This is the preferred API;

    - -

    3) Compile a string (compile_string) or a file (compile_file) - into Elixir syntax tree. This is the API used by both functions - above and is available to you if you want to provide your own - ways of handling the compiled template.

    - -

    Engine

    - -

    EEx has the concept of engines which allows you to modify or -transform the code extracted from the given string or file.

    - -

    By default, EEx uses the EEx.SmartEngine that provides some -conveniences on top of the simple EEx.Engine.

    - -

    Tags

    - -

    EEx.SmartEngine supports the following tags:

    - -
    <% Elixir expression - inline with output %>
    -<%= Elixir expression - replace with result %>
    -
    - -

    All expressions that output something to the template -must use the equals sign (=). Since everything in -Elixir is a macro, there are no exceptions for this rule. -For example, while some template languages would special- -case if clauses, they are treated the same in EEx and -also requires = in order to have their result printed:

    - -
    <%= if true do %>
    -  It is obviously true
    -<% else: %>
    -  This will never appear
    -<% end %>
    -
    - -

    Notice that different engines may have different rules -for each tag. Other tags may be added in future versions.

    - -

    Macros

    - -

    EEx.SmartEngine also adds two macros to your template. -The first one is the for macro, which allows you to easily -loop a variable:

    - -
    EEx.eval_string "<%= for x in [1,2,3] do %><%= x %>\n<% end %>", []
    -# => "1\n2\n3\n"
    -
    - -

    It also adds defines a macro named @ that allows easy access:

    - -
    EEx.eval_string "<%= @foo %>", assigns: [foo: 1]
    -# => 1
    -
    - -

    In other words, <%= @foo %> is simply translated to:

    - -
    <%= Keyword.get assigns, :foo %>
    -
    - -

    The assigns extension is useful when the number of variables -required by the template is not specified at compilation time.

    - -
    - - - Source - - - - - - -

    Functions summary

    - - - - -

    Macros summary

    - - - - -
    -

    Functions

    -
    -

    - compile_file/2 -

    -

    Get a filename and generate a quoted expression -that can be evaluated by Elixir or compiled to a function.

    -
    - Source -
    -

    - compile_string/2 -

    -

    Get a string source and generate a quoted expression -that can be evaluated by Elixir or compiled to a function.

    -
    - Source -
    -

    - eval_file/3 -

    -

    Get a filename and evaluate the values using the bindings.

    - -

    Examples

    - -
    # sample.ex
    -foo <%= bar %>
    -
    -# iex
    -EEx.eval_file "sample.ex", [bar: "baz"]
    -#=> "foo baz"
    -
    -
    - Source -
    -

    - eval_string/3 -

    -

    Get a string source and evaluate the values using the bindings.

    - -

    Examples

    - -
    EEx.eval_string "foo <%= bar %>", [bar: "baz"]
    -#=> "foo baz"
    -
    -
    - Source -
    -
    - - - -
    -

    Macros

    -
    -

    - function_from_file/5 -

    -

    Generates a function definition from the file contents. -The kind (:def or :defp) must be given, the -function name, its arguments and the compilation options.

    - -

    This function is useful in case you have templates but -you want to precompile inside a module for speed.

    - -

    Examples

    - -
    # sample.eex
    -<%= a + b %>
    -
    -# sample.ex
    -defmodule Sample do
    -  require EEx
    -  EEx.function_from_file :def, :sample, "sample.eex", [:a, :b]
    -end
    -
    -# iex
    -Sample.sample(1, 2) #=> "3"
    -
    -
    - Source -
    -

    - function_from_string/5 -

    -

    Generates a function definition from the string. -The kind (:def or :defp) must be given, the -function name, its arguments and the compilation options.

    - -

    Examples

    - -
    defmodule Sample do
    -  require EEx
    -  EEx.function_from_string :def, :sample, "<%= a + b %>", [:a, :b]
    -end
    -
    -Sample.sample(1, 2) #=> "3"
    -
    -
    - Source -
    -
    - -
    - - diff --git a/docs/output/Elixir.Builtin.html b/docs/output/Elixir.Builtin.html deleted file mode 100644 index 0ec967e02..000000000 --- a/docs/output/Elixir.Builtin.html +++ /dev/null @@ -1,1536 +0,0 @@ - - - - Elixir.Builtin - - - - - - - - - - - - -
    -

    - Elixir.Builtin - -

    - - -
    -

    Elixir.Builtin provides the default macros and functions -Elixir imports to your environment. Those macros and functions -can be skipped or cherry-picked via the import function. For -instance, if you want to tell Elixir to not import the case -macro, you can do:

    - -
    import Elixir.Builtin, except: [case: 2]
    -
    - -

    Elixir also has special forms that are always imported and -cannot be skipped. These are described in Elixir.SpecialForms.

    - -
    - - - Source - - - - - - -

    Functions summary

    - - - - -

    Macros summary

    - - - - -
    -

    Functions

    -
    -

    - apply/2 -

    -

    Invokes the given fun with the array of arguments args.

    - -

    Examples

    - -
    apply fn(x) -> x * 2 end, [2]
    -#=> 4
    -
    -
    - Source -
    -

    - apply/3 -

    -

    Invokes the given fun from module with the array of arguments args.

    - -

    Examples

    - -
    apply List, reverse, [[1,2,3]]
    -#=> [3,2,1]
    -
    -
    - Source -
    -

    - raise/1 -

    -

    Raises an error.

    - -

    If the argument is a binary, it raises RuntimeError with the message. -If anything else, becomes a call to raise(argument, []).

    - -

    Examples

    - -
    raise "Given values do not match"
    -
    -try do
    -  1 + :foo
    -rescue: x in [BadargError]
    -  IO.puts "that was expected"
    -  raise x
    -end
    -
    -
    - Source -
    -

    - raise/2 -

    -

    Raises an error.

    - -

    It calls .exception on the given argument passing -the args in order to retrieve the appropriate exception -structure.

    - -

    Any module defined via defexception automatically -defines exception(args) that returns a new instance -of the record and a exception(args, current) that -works as no-op.

    - -

    Examples

    - -
    raise ArgumentError, message: "Sample"
    -
    -
    - Source -
    -
    - - - -
    -

    Macros

    -
    -

    - !/1 -

    -

    Implements the unary operator ! as a macro. It receives any -argument and returns true if it is false or nil. Returns false -otherwise.

    - -

    Examples

    - -

    !1 #=> false - ![1,2,3] #=> false - !false #=> true - !nil #=> true

    -
    - Source -
    -

    - &&/2 -

    -

    Provides a short-circuit operator that executes the second -expression only if the first one evalutes to true (i.e. it is -not nil nor false). Returns the first expression otherwise.

    - -

    Examples

    - -
    true && true         #=> true
    -nil && true          #=> nil
    -true && 1            #=> 1
    -false && error(:bad) #=> false
    -
    - -

    Notice that, differently from Erlang and operator, -this operator accepts any expression as arguments, -not only booleans, however it is not allowed in guards.

    -
    - Source -
    -

    - <>/2 -

    -

    Concatenates two binaries.

    - -

    Examples

    - -
    "foo" <> "bar" #=> "foobar"
    -
    - -

    The <> operator can also be used in guard clauses as -long as the first part is a literal binary:

    - -
    "foo" <> x = "foobar"
    -x #=> "bar"
    -
    -
    - Source -
    -

    - __B__/2 -

    -

    Handles the sigil %B. It simples returns a binary -without escaping characters and without interpolations.

    - -

    Examples

    - -
    %B(foo)      #=> "foo"
    -%B(f#{o}o)  #=> "f\#{o}o"
    -
    -
    - Source -
    -

    - __C__/2 -

    -

    Handles the sigil %C. It simples returns a char list -without escaping characters and without interpolations.

    - -

    Examples

    - -
    %C(foo)      #=> 'foo'
    -%C(f#{o}o)  #=> 'f\#{o}o'
    -
    -
    - Source -
    -

    - __b__/2 -

    -

    Handles the sigil %b. It returns a binary as if it was double quoted -string, unescaping characters and replacing interpolations.

    - -

    Examples

    - -
    %b(foo)       #=> "foo"
    -%b(f#{:o}o)  #=> "foo"
    -
    -
    - Source -
    -

    - __c__/2 -

    -

    Handles the sigil %c. It returns a char list as if it was a single -quoted string, unescaping characters and replacing interpolations.

    - -

    Examples

    - -
    %c(foo)       #=> 'foo'
    -%c(f#{:o}o)  #=> 'foo'
    -
    -
    - Source -
    -

    - __r__/2 -

    -

    handles the sigil %r. It returns a Regex pattern.

    - -

    Examples

    - -
    Regex.match? %r(foo), "foo"  #=> true
    -
    -
    - Source -
    -

    - access/2 -

    -

    Access the given element according the qualifier according -to the Access protocol. Many types implement the access -protocol, so check the protocol documentation for more -information.

    - -

    It is important to notice the access protocol is also -allowed in function signatures when applying to references. -This is useful when working with records to allow to match -against an specific part of a record:

    - -
    def uri_parse(Uri.Config[schema: :http])
    -
    - -

    In the example above, the schema clause will only match if -the config schema is :http. Using the access protocol with -a reference that does not point to a record module will -generate a compilation exception.

    - -

    Examples

    - -
    a = { :a, :b, :c }
    -a[1] #=> :a
    -access a, 1 #=> :a
    -
    -
    - Source -
    -

    - atom_to_binary/1 -

    -

    Returns a binary which corresponds to the text representation -of some_atom in UTF8 encoding.

    - -

    Examples

    - -
    atom_to_binary :my_atom #=> "my_atom"
    -
    -
    - Source -
    -

    - binary_to_atom/1 -

    -

    Returns the atom whose text representation is -some_binary in UTF8 encoding.

    - -

    Examples

    - -
    binary_to_atom "my_atom" #=> :my_atom
    -
    -
    - Source -
    -

    - binary_to_existing_atom/1 -

    -

    Works like binary_to_atom but the atom must exist.

    - -

    Examples

    - -
    :my_atom                          #=> :my_atom
    -binary_to_existing_atom "my_atom" #=> :my_atom
    -
    -
    - Source -
    -

    - case/2 -

    -

    Matches the given condition against the match clauses.

    - -

    Examples

    - -
    case thing do
    -match: { :selector, i, value } when is_integer(i)
    -  value
    -match: value
    -  value
    -end
    -
    - -

    In the example above, we compare thing with each given -match clause and execute the first one that matches. If no -clause matches, an error is raised.

    - -

    Since Elixir variables can be assigned more than once, variables -in a match clause will always be assigned instead of matching with -its previous values. For example:

    - -
    i = 1
    -case 10 do
    -match: i
    -  i * 2
    -end
    -
    - -

    The example above will return 20, because i is assgined to 10 -and then multiplied by 2. If you desire to match the value of i -against the given condition, you need to use the ^ operator:

    - -
    i = 1
    -case 10 do
    -match: ^i
    -  i * 2
    -end
    -
    - -

    The example above will actually fail because 10 does not match 1.

    - -

    Finally, case accepts an else: branch as a fallback if none -of the clauses match:

    - -
    case thing do
    -match: { :selector, i, value } when is_integer(i)
    -  value
    -else:
    -  thing
    -end
    -
    -
    - Source -
    -

    - def/2 -

    -

    Defines a function with the given name and contents.

    - -

    Examples

    - -
    defmodule Foo do
    -  def bar, do: :baz
    -end
    -
    -Foo.bar #=> :baz
    -
    - -

    A function that expects arguments can be defined as follow:

    - -
    defmodule Foo do
    -  def sum(a, b) do
    -    a + b
    -  end
    -end
    -
    - -

    In the example above, we defined a function sum that receives -two arguments and sum them.

    - -

    Dynamic generation with atoms

    - -

    Elixir follows the same rule as Erlang when it comes to -function invocations. Calling a function is the same thing -as "invoking at atom". That said, we could invoke a function -named sum in these two equivalent ways:

    - -
    sum(1, 2)
    -:sum.(1, 2)
    -
    - -

    We can also use the atom format to define functions:

    - -
    defmodule Foo do
    -  def :sum.(a, b) do
    -    a + b
    -  end
    -end
    -
    - -

    In general, a developer never needs to use the format above -except when he wants to dynamically define functions with macros. -In such scenarios, the name needs to be given dynamically via -the unquoting mechanism.

    - -

    Imagine a macro that receives keywords and defines a function -for each entry in the keyword, using the key as function name -and the value as the value returned by the function:

    - -
    defmacro defkv(keywords) do
    -  Enum.map keywords, fn({k,v}) ->
    -    quote do
    -      def unquote(k).() do
    -        unquote(v)
    -      end
    -    end
    -  end
    -end
    -
    - -

    This macro could be invoked as:

    - -
    defkv one: 1, two: 2
    -
    - -

    Notice in the example above, we define the function as def unquote(k).() -because each entry k is a an atom and invoking def unquote(k)() -would be invalid Elixir syntax.

    -
    - Source -
    -

    - def/4 -

    -

    This macro allows a function to be defined more explicitly -by accepting the name, args and guards as different entries.

    - -

    Differently from def/2, the macro arguments are evaluated -and therefore requires quoting.

    - -

    The name must be an atom, the arguments a list where each -element represents another argument and guards a list of -clauses, where each clause is disjunct.

    - -

    Examples

    - -

    The most common mistake when using this macro is to pass the -arguments without quoting:

    - -
    def :some_function, [first_arg, second_arg], is_list(first_arg) do
    -  # ...
    -end
    -
    - -

    However, the example above will fail because it will attempt to -evaluate [first_arg, second_arg] and fail because the variable -first_arg is not defined. Therefore, we need to use quote:

    - -
    name   = :some_function
    -args   = quote(do: [first_arg, second_arg])
    -guards = quote(do: is_list(first_arg))
    -
    -def name, args, guards do
    -  # ...
    -end
    -
    -
    - Source -
    -

    - defdelegate/2 -

    -

    Defines the given functions in the current module that will -delegate to the given target. Functions defined with defdelegate -are public and should be purposedly allowed to be invoked from -external. If you find yourself wishing to define a delegation -as private, you should likely use import instead.

    - -

    Delegation only works with functions, delegating to macros -is not supported.

    - -

    Examples

    - -
    defmodule MyList do
    -  defdelegate [reverse: 1], to: Erlang.lists
    -end
    -
    -MyList.reverse([1,2,3])
    -#=> [3,2,1]
    -
    -
    - Source -
    -

    - defexception/4 -

    -

    Defines an exception. It follows exactly the same API as record. -The defined record must implement message/1 as API, otherwise -an error is raised. Check exception.ex for examples.

    -
    - Source -
    -

    - defimpl/3 -

    -

    Defines an implementation for the given protocol. See -defprotocol/2 for examples.

    -
    - Source -
    -

    - defmodule/2 -

    -

    Defines a module given by name with the given contents.

    - -

    Examples

    - -
    defmodule Foo do
    -  def bar, do: :baz
    -end
    -
    -Foo.bar #=> :baz
    -
    - -

    Nesting

    - -

    Nesting a module inside the other affects its name:

    - -
    defmodule Foo do
    -  defmodule Bar do
    -  end
    -end
    -
    - -

    In the example above, two modules Foo and Foo.Bar. The -second can be accessed as Bar inside Foo in the same -lexical scope. If the module Bar is moved away to another -file, it needs to be referenced via the full name or a -reference need to be set with the help of refer/2.

    - -

    Dynamic names

    - -

    Elixir module names can be dynamically generated. This is very -useful for macros. For instance, one could write:

    - -
    defmodule binary_to_atom("Foo#{1}", :utf8) do
    -  # contents ...
    -end
    -
    - -

    Elixir will accept any module name as long as the expression -returns an atom.

    -
    - Source -
    -

    - defoverridable/1 -

    -

    Makes the given functions in the current module overridable. -An overridable function is lazily defined, allowing a -developer to customize it.

    -
    - Source -
    -

    - defp/2 -

    -

    Defines a function that is private. Private functions -can only be accessible from the same module it is defined.

    - -

    Check def/2 for more information

    - -

    Examples

    - -
    defmodule Foo do
    -  def bar do
    -    sum(1, 2)
    -  end
    -
    -  defp sum(a, b), do: a + b
    -end
    -
    - -

    In the example above, sum is private and accessing it -through Foo.sum will raise an error.

    -
    - Source -
    -

    - defp/4 -

    -

    The same as def/4 but generates a private function.

    -
    - Source -
    -

    - defprotocol/2 -

    -

    Defines the current module as a protocol and specifies the API -that should be implemented.

    - -

    Examples

    - -

    In Elixir, only false and nil are considered falsy values. -Everything else evaluates to true in if clauses. Depending -on the application, it may be important to specify a blank? -protocol that returns a boolean for other data types that should -be considered blank?. For instance, an empty list or an empty -binary could be considered blanks.

    - -

    We could implement this protocol as follow:

    - -
    defprotocol Blank do
    -  @doc "Returns true if data is considered blank/empty"
    -  def blank?(data)
    -end
    -
    - -

    Now that the protocol is defined, we can implement it. We need -to implement the protocol for each Elixir type. For example:

    - -
    # Numbers are never blank
    -defimpl Blank, for: Number do
    -  def blank?(number), do: false
    -end
    -
    -# Just empty list is blank
    -defimpl Blank, for: List do
    -  def blank?([]), do: true
    -  def blank?(_),  do: false
    -end
    -
    -# Just the atoms false and nil are blank
    -defimpl Blank, for: Atom do
    -  def blank?(false), do: true
    -  def blank?(nil),   do: true
    -  def blank?(_),     do: false
    -end
    -
    - -

    And we would have to define the implementation for all types. -The types available are:

    - -
      -
    • Record
    • -
    • Tuple
    • -
    • Atom
    • -
    • List
    • -
    • BitString
    • -
    • Number
    • -
    • Function
    • -
    • PID
    • -
    • Port
    • -
    • Reference
    • -
    • Any
    • -
    - -

    Selecting implementations

    - -

    Implementing the protocol for all default types can be cumbersome. -Even more, if you consider that Number, Function, PID, Port and -Reference are never going to be blank, it would be easier if we -could simply provide a default implementation.

    - -

    This can be achieved with Elixir as follows:

    - -
    defprotocol Blank do
    -  @only [Atom, Tuple, List, BitString, Any]
    -  def blank?(data)
    -end
    -
    - -

    If the protocol is invoked with a data type that is not an Atom, -nor Tuple, nor List, nor BitString, Elixir will now dispatch to -Any. That said, the default behavior could be implemented as:

    - -
    defimpl Blank, for: Any do
    -  def blank?(_), do: false
    -end
    -
    - -

    Now, all data types that we have not specified will be -automatically considered non blank.

    - -

    Protocols + Records

    - -

    The real benefit of protocols comes when mixed with records. For instance, -imagine we have a module called RedBlack that provides an API to create -and manipulate Red-Black trees. This module represents such trees via a -record named RedBlack.Tree and we want this tree to be considered blank -in case it has no items. To achieve this, the developer just needs to -implement the protocol for RedBlack.Tree:

    - -
    defimpl Blank, for: RedBlack.Tree do
    -  def blank?(tree), do: RedBlack.empty?(tree)
    -end
    -
    - -

    In the example above, we have implemented blank? for RedBlack.Tree -that simply delegates to RedBlack.empty? passing the tree as argument. -This implementation doesn't need to be defined inside the RedBlack -tree or inside the record, but anywhere in the code.

    - -

    Finally, since records are simply tuples, one can add a default protocol -implementation to any record by defining a default implementation for tuples.

    -
    - Source -
    -

    - defrecord/4 -

    -

    Define a record given by name and values.

    - -

    Examples

    - -
    defrecord FileInfo, atime: nil, mtime: nil
    -
    - -

    The line above will define a module named FileInfo which -contains a function named new that returns a new record -and other functions to read and set the values in the -record. Therefore, we can do:

    - -
    file_info = FileInfo.new(atime: now())
    -file_info.atime         #=> Returns the value of atime
    -file_info.atime(now())  #=> Updates the value of atime
    -
    - -

    Internally, a record is simply a tuple where the first element is -the record module name. This can be noticed if we print the record:

    - -
    IO.puts FileInfo.new
    -{ FileInfo, nil, nil }
    -
    - -

    Default based functions

    - -

    Depending on the default value, Elixir will define helpers to interact -with the record. For example, ExUnit defines a record which keeps -track of how many tests were executed and the failures that happened -The record definition is similar to:

    - -
    defrecord Config, counter: 0, failures: []
    -
    - -

    Since counter is an integer, Elixir automatically defines a helper -named increment_counter that will increase the counter value:

    - -
    Config.new.increment_counter.counter #=> 1
    -
    - -

    increment_counter also accepts a number of increment as argument:

    - -
    Config.new.increment_counter(10).counter #=> 10
    -
    - -

    Besides, if the default is a list, Elixir will define three helpers:

    - -
      -
    • merge_field - Receives keywords and merge it into the current value;
    • -
    • prepend_field - Receives another list and prepend its values
    • -
    - -

    Documentation

    - -

    By default records are not documented and have @moduledoc set to false. -This can be changed by passing a moduledoc option after values:

    - -
    defrecord Config, [counter: 0, failures: []], moduledoc: "A simple record"
    -
    -
    - Source -
    -

    - destructure/2 -

    -

    Allows you to destructure two lists, assigning each -term in the right to the left. Differently from pattern -matching via =, if the sizes of the left and right -lists don't match,, structuring simply stops instead -of raising an error.

    - -

    Examples

    - -
    destructure [x,y,z], [1,2,3,4,5]
    -x #=> 1
    -y #=> 2
    -z #=> 3
    -
    - -

    Notice in the example above, even though the right -size has more entries than the left, structuring works -fine. If the right size is smaller, the remaining items -are simply assigned to nil:

    - -
    destructure [x,y,z], [1]
    -x #=> 1
    -y #=> nil
    -z #=> nil
    -
    - -

    The left side supports any expression you would use -on the left side of a match:

    - -
    x = 1
    -destructure [^x,y,z], [1,2,3]
    -
    - -

    The example above will only work if x matches -the first value from the right side. Otherwise, -it will raise a CaseClauseError.

    -
    - Source -
    -

    - div/2 -

    -

    Provides an integer division macro according to Erlang semantics. -Raises an error if one of the arguments is not an integer. -Can be used in guard tests.

    - -

    Examples

    - -
    5 div 2 #=> 2
    -
    -
    - Source -
    -

    - elem/2 -

    -

    Define elem to get Tuple element according to Elixir conventions. -We need to implement it as a macro to it can be used in guards.

    - -

    Example

    - -

    tuple = { :foo, :bar, 3 } - elem(tuple, 1) #=> :foo

    -
    - Source -
    -

    - if/2 -

    -

    Provides an if macro. The macro expects the first argument to -be a condition and the rest are keywords arguments.

    - -

    One-liner examples

    - -
    if(foo, do: bar)
    -
    - -

    In the example above, bar will be returned if foo evalutes to -true (i.e. it is not false nor nil). Otherwise, nil will be returned.

    - -

    An else option can be given to specify the opposite:

    - -
    if(foo, do: bar, else: bar)
    -
    - -

    Key-value blocks examples

    - -

    When several expressions must be passed to if, the most appropriate -form is thorugh keywords blocks. The first example above would then -be translated to:

    - -
    if foo do
    -  bar
    -end
    -
    - -

    Notice that do/end becomes delimiters. The value given between -do/end becomes the expression given to as do:. The second example -would then translate do:

    - -
    if foo do
    -  bar
    -else:
    -  baz
    -end
    -
    - -

    Notice that extra keys follows the regular else: form. You can also -add extra elsif: clauses:

    - -
    if foo do
    -  bar
    -elsif: some_condition
    -  bar + baz
    -else:
    -  baz
    -end
    -
    -
    - Source -
    -

    - in/2 -

    -

    Returns true if the element on the left is equal (==) to -any of the items in the right. For now, it only accepts -a list as the right argument. Useful in guard clauses.

    - -

    Examples

    - -
    x = 1
    -x in [1,2,3] #=> true
    -
    - -

    This macro simply translates the expression above to:

    - -
    x == 1 or x == 2 or x == 3
    -
    -
    - Source -
    -

    - inspect/1 -

    -

    Inspect the given arguments according to the Binary.Inspect protocol.

    - -

    Examples

    - -
    inspect(:foo)
    -#=> ":foo"
    -
    -
    - Source -
    -

    - is_exception/1 -

    -

    Check if the given structure is an exception.

    - -

    Examples

    - -
    is_exception(Error.new) #=> true
    -is_exception(1)         #=> false
    -
    -
    - Source -
    -

    - is_record/2 -

    -

    Check if the given structure is a record. It is basically -a convenient macro that checks the structure is a tuple and -the first element matches the given kind.

    - -

    Examples

    - -
    defrecord Config, sample: nil
    -
    -is_record(Config.new, Config) #=> true
    -is_record(Config.new, List)   #=> false
    -
    -
    - Source -
    -

    - is_regex/1 -

    -
    - Source -
    -

    - match?/2 -

    -

    A convenient macro that checks if the right side matches -the left side. The left side is allowed to be a match pattern.

    - -

    Examples

    - -
    match?(1, 1) #=> true
    -match?(1, 2) #=> false
    -match?({1,_}, {1,2}) #=> true
    -
    - -

    Match can also be used to filter or find a value in an enumerable:

    - -
    list = [{:a,1},{:b,2},{:a,3}]
    -Enum.filter list, match?({:a, _}, _)
    -
    - -

    Guard clauses can also be given to the match:

    - -
    list = [{:a,1},{:b,2},{:a,3}]
    -Enum.filter list, match?({:a, x } when x < 2, &1)
    -
    -
    - Source -
    -

    - receive/1 -

    -

    The current process will hang until it receives a message -from other processes that matches the given clauses.

    - -

    Examples

    - -
    receive do
    -match: { :selector, i, value } when is_integer(i)
    -  value
    -match: value when is_atom(value)
    -  value
    -else:
    -  IO.puts :standard_error, "Unexpected message received"
    -end
    -
    - -

    The match clauses above follows the same rules as case/2.

    - -

    An optional after clause can be given in case the message was not -received after the specified period of time:

    - -
    receive do
    -match: { :selector, i, value } when is_integer(i)
    -  value
    -match: value when is_atom(value)
    -  value
    -else:
    -  IO.puts :standard_error, "Unexpected message received"
    -after: 5000
    -  IO.puts :standard_error, "No message in 5 seconds"
    -end
    -
    - -

    The after clause can be specified even if there are no match clauses. -There are two special cases for the timout value given to after:

    - -
      -
    • :infinity - The process should wait indefinitely for a matching -message, this is the same as not using a timeout.

    • -
    • 0 - if there is no matching message in the mailbox, the timeout -will occur immediately.

    • -
    -
    - Source -
    -

    - rem/2 -

    -

    Provides an integer remainder macro according to Erlang semantics. -Raises an error if one of the arguments is not an integer. -Can be used in guard tests.

    - -

    Examples

    - -
    5 rem 2 #=> 1
    -
    -
    - Source -
    -

    - setelem/3 -

    -

    Define setelem to set Tuple element according to Elixir conventions. -We need to implement it as a macro to it can be used in guards.

    - -

    Example

    - -

    tuple = { :foo, :bar, 3 } - setelem(tuple, 1, :baz) #=> { :baz, :bar, 3 }

    -
    - Source -
    -

    - to_binary/1 -

    -

    Convert the argument to a string according to the Binary.Chars protocol. -This is the function invoked when there is string interpolation.

    - -

    Examples

    - -
    to_binary(:foo)
    -#=> "foo"
    -
    -
    - Source -
    -

    - to_char_list/1 -

    -

    Convert the argument to a list according to the List.Chars protocol.

    - -

    Examples

    - -
    to_char_list(:foo)
    -#=> 'foo'
    -
    -
    - Source -
    -

    - try/1 -

    -

    Execute the given expressions and catch any error, exit -or throw that may have happened.

    - -

    Examples

    - -
    try do
    -  do_something_that_may_fail(some_arg)
    -rescue: ArgumentError
    -  IO.puts "Invalid argument given"
    -catch: value
    -  IO.puts "caught #{value}"
    -after:
    -  IO.puts "This is printed regardless if it failed or succeed"
    -end
    -
    - -

    The rescue clause is used to handle errors, while the catch clause -can be used to catch throw values. Both catch and rescue clauses -accepts the same pattern matching rules as match.

    - -

    Note that calls inside try are not tail recursive since the VM -needs to keep the stacktrace in case an exception happens.

    - -

    Rescue clauses

    - -

    Besides accepting the same pattern matching rules as match -clauses, rescue provides some conveniences around exceptions -that allows one to rescue an exception by its name and not by -its internal contents. All the following formats are valid -rescue expressions:

    - -
    try do
    -  UndefinedModule.undefined_function
    -rescue: UndefinedFunctionError
    -end
    -
    -try do
    -  UndefinedModule.undefined_function
    -rescue: [UndefinedFunctionError]
    -end
    -
    -# rescue and assign to x
    -try do
    -  UndefinedModule.undefined_function
    -rescue: x in [UndefinedFunctionError]
    -end
    -
    -# rescue all and assign to x
    -try do
    -  UndefinedModule.undefined_function
    -rescue: x
    -end
    -
    - -

    Variable visibility

    - -

    Since an expression inside try may not have been evaluted -due to an exception, any variable created inside try cannot -be accessed externaly. -For instance:

    - -
    try do
    -  x = 1
    -  do_something_that_may_fail(same_arg)
    -  :ok
    -catch: _, _
    -  :failed
    -end
    -
    -x #=> Cannot access `x`
    -
    - -

    In the example above, x cannot be accessed since it was defined -inside the try clause.

    - -

    Catching exits and Erlang errors

    - -

    The catch clause works exactly the same as in Erlang. Therefore, -one can also handle exits/errors coming from Erlang as below:

    - -
    try do
    -  exit(1)
    -catch: :exit, 1
    -  IO.puts "Exited with 1"
    -end
    -
    -try do
    -  error(:sample)
    -catch: :error, :sample
    -  IO.puts "sample error"
    -end
    -
    - -

    Although the second form should be avoided in favor of raise/rescue -control mechanisms.

    -
    - Source -
    -

    - unless/2 -

    -

    Provides a unless macro that executes the expression -unless a value evalutes to true. Check if for examples -and documentation.

    -
    - Source -
    -

    - use/2 -

    -

    use is a simple mechanism for extending the current module with the -given module.

    - -

    Examples

    - -
    defmodule AssertionTest do
    -  use ExUnit.Case
    -
    -  def test_always_pass do
    -    true = true
    -  end
    -end
    -
    - -

    By calling use, a hook called __using__ will be invoked in -ExUnit.Case which will then do the proper setup. In other words, -use is simply a translation to:

    - -
    defmodule AssertionTest do
    -  require ExUnit.Case
    -  ExUnit.Case.__using__(AssertionTest)
    -
    -  def test_always_pass do
    -    true = true
    -  end
    -end
    -
    -
    - Source -
    -

    - ||/2 -

    -

    Provides a short-circuit operator that executes the second -expression only if the first one does not evalute to true (i.e. it -is not nil nor false). Returns the first expression otherwise.

    - -

    Examples

    - -
    false || false       #=> false
    -nil || true          #=> true
    -false || 1           #=> 1
    -true || error(:bad)  #=> true
    -
    - -

    Notice that, differently from Erlang or operator, -this operator accepts any expression as arguments, -not only booleans, however it is not allowed in guards.

    -
    - Source -
    -
    - -
    - - diff --git a/docs/output/Elixir.ParallelCompiler.html b/docs/output/Elixir.ParallelCompiler.html deleted file mode 100644 index 53d382b62..000000000 --- a/docs/output/Elixir.ParallelCompiler.html +++ /dev/null @@ -1,94 +0,0 @@ - - - - Elixir.ParallelCompiler - - - - - - - - - - - - -
    -

    - Elixir.ParallelCompiler - -

    - - -
    -

    A module responsible for compiling files in parallel.

    - -
    - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - files/2 -

    -

    Compiles the given files.

    - -

    Those files are compiled in parallel and can automatically -detect dependencies between them. Once a dependency is found, -the current file stops being compiled until the dependency is -resolved.

    - -

    A callback that receives every time a file is compiled -with the module names and binaries defined inside it can -be optionally given as argument.

    -
    - Source -
    -

    - files_to_path/3 -

    -

    Compiles the given files to the given path. -Read files/2 for more information.

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/Elixir.SpecialForms.html b/docs/output/Elixir.SpecialForms.html deleted file mode 100644 index ed43890a8..000000000 --- a/docs/output/Elixir.SpecialForms.html +++ /dev/null @@ -1,714 +0,0 @@ - - - - Elixir.SpecialForms - - - - - - - - - - - - -
    -

    - Elixir.SpecialForms - -

    - - -
    -

    In this module we define Elixir special forms. Those are called -special forms because they cannot be overridden by the developer -and sometimes have lexical scope (like refer, require, import, etc).

    - -
    - - - Source - - - - - - - - -

    Macros summary

    - - - - - - -
    -

    Macros

    -
    -

    - <<>>/1 -

    -

    Defines a new bitstring.

    - -

    Examples

    - -
    :<<>>.(1,2,3)
    -<< 1, 2, 3 >>
    -
    -
    - Source -
    -

    - []/1 -

    -

    Defines a new list.

    - -

    Examples

    - -
    :[].(1,2,3)
    -[ 1, 2, 3 ]
    -
    -
    - Source -
    -

    - __FILE__/0 -

    -

    Returns the current file name as a binary.

    -
    - Source -
    -

    - __FUNCTION__/0 -

    -

    Returns the current function as a tuple, -where the first element is the name as an atom -and the second is the arity as an integer.

    -
    - Source -
    -

    - __LINE__/0 -

    -

    Returns the current line number as an integer.

    -
    - Source -
    -

    - __MODULE__/0 -

    -

    Returns the current module name as an atom or nil otherwise.

    -
    - Source -
    -

    - bc/1 -

    -

    Defines a bit comprehension. It follows the same syntax as -a list comprehension but expects each element returned to -be a bitstring. For example, here is how to remove all -spaces from a string:

    - -
    bc <<c>> in " hello world " when c != ? , do: <<c>>
    -"helloworld"
    -
    -
    - Source -
    -

    - fn/1 -

    -

    Returns an anonymous function based on the given arguments.

    - -

    Examples

    - -
    sum = fn(x, y, do: x + y)
    -sum.(1, 2) #=> 3
    -
    - -

    Notice that a function needs to be invoked using the dot between -the function and the arguments.

    - -

    A function could also be defined using the end syntax, although -it is recommend to use it only with the stab operator in order to -avoid ambiguity. For example, consider this case:

    - -
    Enum.map [1,2,3], fn(x) ->
    -  x * 2
    -end
    -
    - -

    The example works fine because -> binds to the closest function call, -which is fn, but if we replace it by do/end, it will fail:

    - -
    Enum.map [1,2,3], fn(x) do
    -  x * 2
    -end
    -
    - -

    The reason it fails is because do/end always bind to the farthest -function call.

    - -

    Function with multiple clauses

    - -

    One may define a function which expects different clauses as long -as all clauses expects the same number of arguments:

    - -
    fun = fn do
    -match: x, y when y < 0
    -  x - y
    -match: x, y
    -  x + y
    -end
    -
    -fun.(10, -10) #=> 20
    -fun.(10, 10)  #=> 20
    -
    -
    - Source -
    -

    - import/2 -

    -

    import allows one to easily access functions or macros from -others modules without using the qualified name.

    - -

    Examples

    - -

    If you want to use the values function from Keyword several times -in your module and you don't want to always type Keyword.values, -you can simply import it:

    - -
    defmodule Math do
    -  import Keyword, only: [values: 1]
    -
    -  def some_function do
    -    # call values(orddict)
    -  end
    -end
    -
    - -

    In this case, we are importing only the function values (with arity 1) -from Keyword. Although only is optional, its usage is recommended. -except could also be given as an option. If no option is given, all -functions and macros are imported.

    - -

    In case you want to import only functions or macros, you can pass a -first argument selecting the scope:

    - -
    import :macros, MyMacros
    -
    - -

    And you can then use only or except to filter the macros being -included.

    - -

    Lexical scope

    - -

    It is important to notice that import is lexical. This means you -can import specific macros inside specific functions:

    - -
    defmodule Math do
    -  def some_function do
    -    # 1) Disable `if/2` from Elixir.Builtin
    -    import Elixir.Builtin, except: [if: 2]
    -
    -    # 2) Require the new `if` macro from MyMacros
    -    import MyMacros
    -
    -    # 3) Use the new macro
    -    if do_something, it_works
    -  end
    -end
    -
    - -

    In the example above, we imported macros from MyMacros, replacing -the original if/2 implementation by our own during that -specific function. All other functions in that module will still -be able to use the original one.

    - -

    Refer/Require shortcut

    - -

    All imported modules are also required by default. import -also accepts as: as an option so it automatically sets up -an alias. Please check refer for more information.

    -
    - Source -
    -

    - in_guard/1 -

    -

    Keeps one of the given expressions depending in the context -of evaluation is a guard or not. This is useful when creating -macro that should work both inside and outside guards but -still hold some characteristics.

    - -

    Example

    - -

    A good example is the is_exception/1 macro defined in Elixir:

    - -
     defmacro is_exception(thing) do
    -   quote do
    -     in_guard do
    -       is_tuple(unquote(thing)) and elem(unquote(thing), 2) == :__exception__
    -     else:
    -       result = unquote(thing)
    -       is_tuple(result) and elem(result, 2) == :__exception__
    -     end
    -   end
    - end
    -
    - -

    Notice that if inside a guard, we unquote the same element twice. -This will cause the same element to be evaluted twice, but this is -fine for guards since we cannot assign variables in guards and -we cannot call expressions inside guards. However, when outside -of a guard, evaluating the arguments twice can be harmful and -unexpected, for this reason, we save the result in a variable.

    - -

    In the example above, in_guard is allowing us to customize -the same macro to work inside and outside guards.

    -
    - Source -
    -

    - lc/1 -

    -

    List comprehensions allow you to quickly build a list from another list:

    - -
    lc n in [1,2,3,4], do: n * 2
    -#=> [2,4,6,8]
    -
    - -

    A comprehension accepts many generators and also filters. Filters must be given after the when clause:

    - -
    # A comprehension with a generator and a filter
    -lc n in [1,2,3,4,5,6] when rem(n, 2) == 0, do: n
    -#=> [2,4,6]
    -
    -# A comprehension with two generators
    -lc x in [1,2], y in [2,3], do: x*y
    -#=> [2,3,4,6]
    -
    - -

    Elixir provides generators for both lists and bitstrings:

    - -
    # A list generator:
    -lc n in [1,2,3,4], do: n * 2
    -#=> [2,4,6,8]
    -
    -# A bit string generator:
    -lc <<n>> in <<1,2,3,4>>, do: n * 2
    -#=> [2,4,6,8]
    -
    - -

    Bit string generators are quite useful when you need to organize bit string streams:

    - -
    iex> pixels = <<213,45,132,64,76,32,76,0,0,234,32,15>>
    -iex> lc <<r:8,g:8,b:8>> in pixels, do: {r,g,b}
    -[{213,45,132},{64,76,32},{76,0,0},{234,32,15}]
    -
    - -

    Elixir does its best to hide the differences between list and bit string generators. -However, there is a special case due to Erlang limitation where we need to explicitly -tell Erlang that a list is being given as argument:

    - -
    # This will fail because when Elixir sees that the left side
    -# of the in expression is a bit string, it expects the right side
    -# to be a bit string as well:
    -lc <<n>> in [<<1>>,<<2>>,<<3>>], do: n*2
    -#=> ** (ErlangError) erlang error {:bad_generator,[<<1>>,<<2>>,<<3>>]}
    -
    -# You need to be explicit and use inlist:
    -lc inlist(<<n>>, [<<1>>,<<2>>,<<3>>]), do: n*2
    -#=> [2,4,6]
    -
    -# For consistency, inbin is also available:
    -lc inbin(<<n>>, <<1,2,3>>), do: n*2
    -#=> [2,4,6]
    -
    - -

    Notice that although comprehensions uses when to specify filters, filters are not -guards and therefore accept any expression (they are not limited as guards).

    -
    - Source -
    -

    - loop/1 -

    -

    Handle annonymous recursive loops.

    - -

    Examples

    - -
    list = [1,2,3]
    -
    -loop list, [] do
    -match: [h|t], acc
    -  recur t, [h*2|acc]
    -match: [], acc
    -  acc
    -end
    -#=> [6,4,2]
    -
    - -

    Notice that all match clauses expects the same ammount -of arguments. Guards can also be given.

    - -

    Recursion happens by calling recur with the same number -of arguments of each match clause. recur does not guarantee -that it will be tail recursive.

    -
    - Source -
    -

    - quote/2 -

    -

    Allows you to get the representation of any expression.

    - -

    Examples

    - -
    quote do: sum(1, 2, 3)
    -#=> { :sum, 0, [1, 2, 3] }
    -
    - -

    Homoiconicity

    - -

    Elixir is an homoiconic language. Any Elixir program can be -represented using its own data structures. The building block -of Elixir homoiconicity is a tuple with three elements, for example:

    - -
    { :sum, 1, [1, 2, 3] }
    -
    - -

    The tuple above represents a function call to sum passing 1, 2 and -3 as arguments. The tuple elements are:

    - -
      -
    • The first element of the tuple is always an atom or -another tuple in the same representation;
    • -
    • The second element of the tuple is always an integer -representing the line number;
    • -
    • The third element of the tuple are the arguments for the -function call. The third argument may be an atom, meaning -that it may be a variable.
    • -
    - -

    Macro literals

    - -

    Besides the tuple described above, Elixir has a few literals that -when quoted return themselves. They are:

    - -
    :sum         #=> Atoms
    -1            #=> Integers
    -2.0          #=> Floats
    -[1,2]        #=> Lists
    -"binaries"   #=> Binaries
    -{key, value} #=> Key-value pairs (i.e. a tuple with two elements)
    -
    - -

    Hygiene

    - -

    Elixir macros are hygienic regarding to variables. This means -a variable defined in a macro cannot affect the scope where -the macro is included. Consider the following example:

    - -
    defmodule Hygiene do
    -  defmacro no_interference do
    -    quote do: a = 1
    -  end
    -end
    -
    -require Hygiene
    -
    -a = 10
    -Hygiene.no_interference
    -a # => 10
    -
    - -

    In the example above, a returns 10 even if the macro -is apparently setting it to 1 because the variables defined -in the macro does not affect the context the macro is -executed. If you want to set or get a variable, you can do -it with the help of the var! macro:

    - -
    defmodule NoHygiene do
    -  defmacro interference do
    -    quote do: var!(a) = 1
    -  end
    -end
    -
    -require NoHygiene
    -
    -a = 10
    -NoHygiene.interference
    -a # => 11
    -
    - -

    Notice that references are not hygienic in Elixir unless -you explicitly access it via MAIN to the reference name.

    - -
    quote do
    -  __MAIN__.Foo # => Access the root Foo
    -  Foo   # => Access the Foo reference in the current
    -             module (if any is set), then fallback to root
    -end
    -
    - -

    Options

    - -

    quote also accepts some options as arguments. For example, -hygiene can be turned off via hygiene: false which is useful -when one is generating a code that should be inserted into -some function.

    -
    - Source -
    -

    - recur/1 -

    -

    A function that forces the current loop to recur. See loop/1 -for more information.

    -
    - Source -
    -

    - refer/2 -

    -

    refer is used to setup aliases between modules.

    - -

    Examples

    - -

    refer can be used to setup an alias for any module:

    - -
    defmodule Math do
    -  refer MyKeyword, as: Keyword
    -end
    -
    - -

    In the example above, we have set up MyOrdict to be referenced -as Keyword. So now, any reference to Keyword will be -automatically replaced by MyKeyword.

    - -

    In case one wants to access the original Keyword, it can be done -by accessing MAIN:

    - -
    Keyword.values   #=> uses MyKeyword.values
    -__MAIN__.Keyword.values #=> uses Keyword.values
    -
    - -

    Notice that calling refer without the as: option automatically -sets an alias based on the last part of the module. For example:

    - -
    refer Foo.Bar.Baz
    -
    - -

    Is the same as:

    - -
    refer Foo.Bar.Baz, as: Baz
    -
    - -

    Lexical scope

    - -

    import, require and refer are called directives and all -have lexical scope. This means you can set up aliases inside -specific functions and it won't affect the overall scope.

    -
    - Source -
    -

    - require/2 -

    -

    require is used to require the presence of external -modules so macros can be invoked.

    - -

    Examples

    - -

    Notice that usually modules should not be required before usage, -the only exception is if you want to use the macros from a module. -In such cases, you need to explicitly require them.

    - -

    Let's suppose you created your own if implementation in the module -MyMacros. If you want to invoke it, you need to first explicitly -require the MyMacros:

    - -
    defmodule Math do
    -  require MyMacros
    -  MyMacros.if do_something, it_works
    -end
    -
    - -

    An attempt to call a macro that was not loaded will raise an error.

    - -

    Refer shortcut

    - -

    require also accepts as: as an option so it automatically sets -up an alias. Please check refer for more information.

    -
    - Source -
    -

    - unquote/1 -

    -

    Unquotes the given expression from inside a macro.

    - -

    Examples

    - -

    Imagine the situation you have a variable name and -you want to inject it inside some quote. The first attempt -would be:

    - -
    value = 13
    -quote do: sum(1, value, 3)
    -
    - -

    Which would then return:

    - -
    { :sum, 0, [1, { :value, 0, quoted }, 3] }
    -
    - -

    Which is not the expected result. For this, we use unquote:

    - -
    value = 13
    -quote do: sum(1, unquote(value), 3)
    -#=> { :sum, 0, [1, 13, 3] }
    -
    -
    - Source -
    -

    - unquote_splicing/1 -

    -

    Unquotes the given list expanding its arguments. Similar -to unquote.

    - -

    Examples

    - -
    values = [2,3,4]
    -quote do: sum(1, unquote_splicing(values), 5)
    -#=> { :sum, 0, [1, 2, 3, 4, 5] }
    -
    -
    - Source -
    -

    - {}/1 -

    -

    Defines a new tuple.

    - -

    Examples

    - -
    :{}.(1,2,3)
    -{ 1, 2, 3 }
    -
    -
    - Source -
    -
    - -
    - - diff --git a/docs/output/Enum.Iterator.HashDict.Record.html b/docs/output/Enum.Iterator.HashDict.Record.html deleted file mode 100644 index e4e8337c8..000000000 --- a/docs/output/Enum.Iterator.HashDict.Record.html +++ /dev/null @@ -1,68 +0,0 @@ - - - - Enum.Iterator.HashDict.Record - - - - - - - - - - - - -
    -

    - Enum.Iterator.HashDict.Record - - impl - -

    - - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - iterator/1 -

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/Enum.Iterator.List.html b/docs/output/Enum.Iterator.List.html deleted file mode 100644 index 202d5db11..000000000 --- a/docs/output/Enum.Iterator.List.html +++ /dev/null @@ -1,68 +0,0 @@ - - - - Enum.Iterator.List - - - - - - - - - - - - -
    -

    - Enum.Iterator.List - - impl - -

    - - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - iterator/1 -

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/Enum.Iterator.Orddict.Record.html b/docs/output/Enum.Iterator.Orddict.Record.html deleted file mode 100644 index 658e0f7a9..000000000 --- a/docs/output/Enum.Iterator.Orddict.Record.html +++ /dev/null @@ -1,68 +0,0 @@ - - - - Enum.Iterator.Orddict.Record - - - - - - - - - - - - -
    -

    - Enum.Iterator.Orddict.Record - - impl - -

    - - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - iterator/1 -

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/Enum.Iterator.html b/docs/output/Enum.Iterator.html deleted file mode 100644 index 1ccfd189c..000000000 --- a/docs/output/Enum.Iterator.html +++ /dev/null @@ -1,128 +0,0 @@ - - - - Enum.Iterator - - - - - - - - - - - - -
    -

    - Enum.Iterator - - protocol - -

    - - -
    -

    This is the protocol used by the Enum module. -Usually, when you invoke a function in the module Enum, -the first argument passed to Enum is a collection which -is forwarded to this protocol in order to retrieve information -on how to iterate the collection. That said, when:

    - -
    Enum.map [1,2,3], &1 * 2
    -
    - -

    Is invoked, it invokes Enum.Iterator.iterator([1,2,3]) -which returns all the information required by Enum. -Read each function documentation below for more information.

    - -
    - - - Source - - -

    Implementations

    - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - iterator/1 -

    -

    Iteration in Elixir happens with the help of a iterator -function. Every time this function is called, it must -return a tuple with two elements. The first element -is the next item and the second can be any Elixir term -which the function is going to receive as argument the -next time it is invoked.

    - -

    When there are no more items to be iterated, the function -must return the atom :stop.

    - -

    In order to retrieve this iterator function, Elixir invokes -Enum.Iterator.iterator(collection) which should return a -tuple with two elements: the first element is the iterator -function and the second is the first step of iteration.

    - -

    As an example, here is the implementation of iterator for lists:

    - -
    def iterator(list),   do: { iterate(&1), iterate(list) }
    -defp iterate([h|t]),  do: { h, t }
    -defp iterate([]),     do: :stop
    -
    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/Enum.OrdIterator.List.html b/docs/output/Enum.OrdIterator.List.html deleted file mode 100644 index c9d72dbc0..000000000 --- a/docs/output/Enum.OrdIterator.List.html +++ /dev/null @@ -1,79 +0,0 @@ - - - - Enum.OrdIterator.List - - - - - - - - - - - - -
    -

    - Enum.OrdIterator.List - - impl - -

    - - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - iterator/1 -

    -
    - Source -
    -

    - to_list/2 -

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/Enum.OrdIterator.Orddict.Record.html b/docs/output/Enum.OrdIterator.Orddict.Record.html deleted file mode 100644 index c325e7244..000000000 --- a/docs/output/Enum.OrdIterator.Orddict.Record.html +++ /dev/null @@ -1,79 +0,0 @@ - - - - Enum.OrdIterator.Orddict.Record - - - - - - - - - - - - -
    -

    - Enum.OrdIterator.Orddict.Record - - impl - -

    - - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - iterator/1 -

    -
    - Source -
    -

    - to_list/2 -

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/Enum.OrdIterator.html b/docs/output/Enum.OrdIterator.html deleted file mode 100644 index 227a0832a..000000000 --- a/docs/output/Enum.OrdIterator.html +++ /dev/null @@ -1,121 +0,0 @@ - - - - Enum.OrdIterator - - - - - - - - - - - - -
    -

    - Enum.OrdIterator - - protocol - -

    - - -
    -

    This protocol is invoked by some functions in Enum which -requires an ordered collection to function correctly. For -instance, Enum.split_with/2, Enum.take_while all rely -on this protocol.

    - -

    An ordered collection does not mean the items are ordered -according to the Elixir ordering but simply that any two -distinct instances of the same collection with exactly -the same items always yield the same order when iterated.

    - -
    - - - Source - - -

    Implementations

    - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - iterator/1 -

    -

    Must return a tuple under the same conditions as -Enum.Iterator.iterator.

    -
    - Source -
    -

    - to_list/2 -

    -

    On each step, the iterator function returned by iterator/1 -returns a tuple with two elements. This function receives -those two elements and must return a list back.

    - -

    This is used in order to quicky return a list from any point -during iteration. For example, consider the function Enum.drop. -Enum.drop collection, 3 should drop 3 items and return a list -back. While we could loop over the remaining items to get a list -back, this function is invoked allowing us to get a result -back without a need to loop the remaining items.

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/Enum.html b/docs/output/Enum.html deleted file mode 100644 index b60edc78e..000000000 --- a/docs/output/Enum.html +++ /dev/null @@ -1,566 +0,0 @@ - - - - Enum - - - - - - - - - - - - -
    -

    - Enum - -

    - - -
    -

    Provides a set of algorithms that enumerate over collections according to the -Enum.Iterator protocol. Most of the functions in this module have two -flavours. If a given collection implements the mentioned protocol (like -list, for instance), you can do

    - -
    Enum.map [1,2,3], fn(x, do: x * 2)
    -
    - -

    Depending on the type of the collection, the user-provided function will -accept a certain type of argument. For dicts, the argument is always a -{ key, value } tuple.

    - -
    - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - all?/2 -

    -

    Invokes the given fun for each item in the collection and returns true if -each invocation returns true as well, otherwise it shirt-circuits and returns -false.

    - -

    Examples

    - -
    Enum.all? [2,4,6], fn(x, do: rem(x, 2) == 0)
    -#=> true
    -
    -Enum.all? [2,3,4], fn(x, do: rem(x, 2) == 0)
    -#=> false
    -
    - -

    If no function is given, it defaults to checking if -all items in the collection evaluate to true.

    - -
    Enum.all? [1,2,3]   #=> true
    -Enum.all? [1,nil,3] #=> false
    -
    -
    - Source -
    -

    - any?/2 -

    -

    Invokes the given fun for each item in the collection and returns true if -at least one invocation returns true. Returns false otherwise.

    - -

    Examples

    - -
    Enum.any? [2,4,6], fn(x, do: rem(x, 2) == 1)
    -#=> false
    -
    -Enum.any? [2,3,4], fn(x, do: rem(x, 2) == 1)
    -#=> true
    -
    - -

    If no function is given, it defaults to checking if -at least one item in the collection evaluates to true.

    - -
    Enum.any? [false,false,false] #=> false
    -Enum.any? [false,true,false]  #=> true
    -
    -
    - Source -
    -

    - drop/2 -

    -

    Drops the first count items from the collection. Expects an ordered -collection.

    - -

    Examples

    - -
    Enum.drop [1,2,3], 2  #=> [3]
    -Enum.drop [1,2,3], 10 #=> []
    -Enum.drop [1,2,3], 0  #=> [1,2,3]
    -
    -
    - Source -
    -

    - drop_while/2 -

    -

    Drops items at the beginning of collection while fun returns true. -Expects an ordered collection.

    - -

    Examples

    - -
    Enum.drop_while [1,2,3,4,5], fn(x, do: x < 3)
    -#=> [3,4,5]
    -
    -
    - Source -
    -

    - each/2 -

    -

    Invokes the given fun for each item in the collection. -Returns the collection itself.

    - -

    Examples

    - -
    Enum.each ['some', 'example'], fn(x, do: IO.puts x)
    -
    -
    - Source -
    -

    - empty?/1 -

    -

    Returns true if the collection is empty, otherwise false.

    - -

    Examples

    - -
    Enum.empty? []      #=> true
    -Enum.empty? [1,2,3] #=> false
    -
    -
    - Source -
    -

    - filter/2 -

    -

    Filters the collection, i.e. returns only those elements -for which fun returns true.

    - -

    Examples

    - -
    Enum.filter [1, 2, 3], fn(x, do: rem(x, 2) == 0)
    -#=> [2]
    -
    -
    - Source -
    -

    - filter_map/3 -

    -

    Filters the collection and maps its values in one pass.

    - -

    Examples

    - -
    Enum.filter_map [1, 2, 3], fn(x, do: rem(x, 2) == 0), &1 * 2
    -#=> [4]
    -
    -
    - Source -
    -

    - find/3 -

    -

    Returns the first item for which fun returns a truthy value. If no such -item is found, returns ifnone.

    - -

    Examples

    - -
    Enum.find [2,4,6], fn(x, do: rem(x, 2) == 1)
    -# => nil
    -
    -Enum.find [2,4,6], 0, fn(x, do: rem(x, 2) == 1)
    -# => 0
    -
    -Enum.find [2,3,4], fn(x, do: rem(x, 2) == 1)
    -# => 3
    -
    -
    - Source -
    -

    - find_value/3 -

    -

    Similar to find, but returns the value of the function -invocation instead of the element itself.

    - -

    ## Examples

    - -
      Enum.find_value [2,4,6], fn(x, do: rem(x, 2) == 1)
    -  # => nil
    -
    -  Enum.find_value [2,4,6], 0, fn(x, do: rem(x, 2) == 1)
    -  # => 0
    -
    -  Enum.find_value [2,3,4], fn(x, do: rem(x, 2) == 1)
    -  # => true
    -
    -
    - Source -
    -

    - join/2 -

    -

    Joins the given collection according to joiner. -Joiner can be either a binary or a list and the -result will be of the same type as joiner. If -joiner is not passed at all, it defaults to an -empty binary.

    - -

    All items in the collection must be convertible -to binary, otherwise an error is raised.

    - -

    Examples

    - -
    Enum.join([1,2,3])        #=> "123"
    -Enum.join([1,2,3], " = ") #=> "1 = 2 = 3"
    -Enum.join([1,2,3], ' = ') #=> '1 = 2 = 3'
    -
    -
    - Source -
    -

    - map/2 -

    -

    Returns a new collection, where each item is the result -of invoking fun on each corresponding item of collection. -For dicts, the function accepts a key-value tuple.

    - -

    Examples

    - -
    Enum.map [1, 2, 3], fn(x, do: x * 2)
    -#=> [2, 4, 6]
    -
    -Enum.map [a: 1, b: 2], fn({k, v}, do: { k, -v })
    -#=> [a: -1, b: -2]
    -
    -
    - Source -
    -

    - map_join/3 -

    -

    Maps and joins the given collection in one pass. -Joiner can be either a binary or a list and the -result will be of the same type as joiner. If -joiner is not passed at all, it defaults to an -empty binary.

    - -

    All items in the collection must be convertible -to binary, otherwise an error is raised.

    - -

    Examples

    - -
    Enum.map_join([1,2,3], &1 * 2)        #=> "246"
    -Enum.map_join([1,2,3], &1 * 2, " = ") #=> "2 = 4 = 6"
    -Enum.map_join([1,2,3], &1 * 2, ' = ') #=> '2 = 4 = 6'
    -
    -
    - Source -
    -

    - map_reduce/3 -

    -

    Invokes the given fun for each item in the collection -while also keeping an accumulator. Returns a tuple where -the first element is the mapped collection and the second -one is the final accumulator.

    - -

    For dicts, the first tuple element has to be a { key, value } -tuple itself.

    - -

    Examples

    - -
    Enum.map_reduce [1, 2, 3], 0, fn(x, acc, do: { x * 2, x + acc })
    -#=> { [2, 4, 6], 6 }
    -
    -
    - Source -
    -

    - partition/2 -

    -

    Partitions collection into two where the first one contains elements -for which fun returns a truthy value, and the second one -- for which fun -returns false or nil.

    - -

    Examples

    - -
    Enum.partition [1, 2, 3], fn(x, do: rem(x, 2) == 0)
    -#=> { [2], [1,3] }
    -
    -
    - Source -
    -

    - qsort/1 -

    -

    Sorts the collection according to the quick sort algorithm.

    - -

    Examples

    - -
    Enum.qsort [3,2,1] #=> [1,2,3]
    -
    -
    - Source -
    -

    - reduce/3 -

    -

    Invokes fun for each element in the collection passing the accumulator -acc and the element as arguments. The return value is stored in acc. -Returns the accumulator.

    - -

    Examples

    - -
    Enum.reduce [1, 2, 3], 0, fn(x, acc, do: x + acc)
    -#=> 6
    -
    -
    - Source -
    -

    - split/2 -

    -

    Splits the enumerable into two collections, leaving count elements in the -first one. Expects an ordered collection.

    - -

    Examples

    - -
    Enum.split [1,2,3], 2  #=> { [1,2], [3] }
    -Enum.split [1,2,3], 10 #=> { [1,2,3], [] }
    -Enum.split [1,2,3], 0  #=> { [], [1,2,3] }
    -
    -
    - Source -
    -

    - split_with/2 -

    -

    Splits collection at the first element, for which fun returns true. -Expects an ordered collection.

    - -

    Examples

    - -
    Enum.split_with [1,2,3,4], fn(x) -> x == 2 end
    -#=> { [1], [2, 3, 4] }
    -
    -
    - Source -
    -

    - take/2 -

    -

    Takes the first count items from the collection. Expects an ordered -collection.

    - -

    Examples

    - -
    Enum.take [1,2,3], 2  #=> [1,2]
    -Enum.take [1,2,3], 10 #=> [1,2,3]
    -Enum.take [1,2,3], 0  #=> []
    -
    -
    - Source -
    -

    - take_while/2 -

    -

    Takes the items at the beginning of collection while fun returns true. -Expects an ordered collection.

    - -

    Examples

    - -
    Enum.take_while [1,2,3], fn(x, do: x < 3)
    -#=> [1, 2]
    -
    -
    - Source -
    -

    - times/2 -

    -

    Iterates the given function n times, passing values from 1 -to n.

    - -

    Examples

    - -
    Enum.times 3, fn(x, do: IO.puts x)
    -1
    -2
    -3
    -
    -
    - Source -
    -

    - times/3 -

    -

    Iterates the given function n times, passing values from 1 -to n. Also has an accumulator similar to reduce to store the -value between computations.

    - -

    Examples

    - -
    Enum.times 5, 0, fn(x, acc, do: acc + x)
    -#=> 15
    -
    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/ErlangError.html b/docs/output/ErlangError.html deleted file mode 100644 index 9ad711f5a..000000000 --- a/docs/output/ErlangError.html +++ /dev/null @@ -1,156 +0,0 @@ - - - - ErlangError - - - - - - - - - - - - -
    -

    - ErlangError - - exception - -

    - - - - Source - - - - -

    Fields (and defaults)

    -
      - -
    • - - original: nil - -
    • - -
    - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - exception/1 -

    -
    - Source -
    -

    - exception/2 -

    -
    - Source -
    -

    - message/1 -

    -
    - Source -
    -

    - new/0 -

    -
    - Source -
    -

    - new/1 -

    -
    - Source -
    -

    - original/1 -

    -
    - Source -
    -

    - original/2 -

    -
    - Source -
    -

    - update_original/2 -

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/ExUnit.AssertionError.html b/docs/output/ExUnit.AssertionError.html deleted file mode 100644 index 62aca2f8b..000000000 --- a/docs/output/ExUnit.AssertionError.html +++ /dev/null @@ -1,145 +0,0 @@ - - - - ExUnit.AssertionError - - - - - - - - - - - - -
    -

    - ExUnit.AssertionError - - exception - -

    - - - - Source - - - - -

    Fields (and defaults)

    -
      - -
    • - - message: "assertion failed" - -
    • - -
    - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - exception/1 -

    -
    - Source -
    -

    - exception/2 -

    -
    - Source -
    -

    - message/1 -

    -
    - Source -
    -

    - message/2 -

    -
    - Source -
    -

    - new/0 -

    -
    - Source -
    -

    - new/1 -

    -
    - Source -
    -

    - update_message/2 -

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/ExUnit.Assertions.html b/docs/output/ExUnit.Assertions.html deleted file mode 100644 index a120ab4fd..000000000 --- a/docs/output/ExUnit.Assertions.html +++ /dev/null @@ -1,425 +0,0 @@ - - - - ExUnit.Assertions - - - - - - - - - - - - -
    -

    - ExUnit.Assertions - -

    - - -
    -

    This module contains a set of assertions functions that are -imported by default into your test cases.

    - -

    In general, a developer will want to use the general -assert macro in tests. The macro tries to be smart -and provide good reporting whenever there is a failure. -For example, assert some_fun() == 10 will fail (assuming -some_fun() returns 13):

    - -
    Expected 10 to be equal to 13
    -
    - -

    This module also provides other small convenient functions -like assert_match, assert_member and assert_raise to -easily handle other common cases as, respectively, asserting -if two terms match, asserting if an item belongs to a list or -if a function raises an exception.

    - -
    - - - Source - - - - - - -

    Functions summary

    - - - - -

    Macros summary

    - - - - -
    -

    Functions

    -
    -

    - assert/2 -

    -

    Asserts the expected value is true. -If it fails, raises the given message.

    - -

    Examples

    - -
    assert false, "it will never be true"
    -
    -
    - Source -
    -

    - assert_empty/2 -

    -

    Asserts the enum collection is empty.

    - -

    Examples

    - -
    assert_empty []
    -assert_empty [1, 2]
    -
    -
    - Source -
    -

    - assert_error/2 -

    -

    Asserts the error expected during function execution.

    - -

    Examples

    - -
    assert_error :function_clause, fn ->
    -  List.flatten(1)
    -end
    -
    -
    - Source -
    -

    - assert_exit/2 -

    -

    Asserts the exit expected during function execution.

    - -

    Examples

    - -
    assert_exit 1, fn ->
    -  exit 1
    -end
    -
    -
    - Source -
    -

    - assert_in_delta/4 -

    -

    Asserts the expected and received are within delta.

    - -

    Examples

    - -
    assert_in_delta 1.1, 1.5, 0.2
    -assert_in_delta 10, 15, 4
    -
    -
    - Source -
    -

    - assert_member/3 -

    -

    Asserts the value is a member of the given enumerable. -Used to check if an item belongs to a list.

    - -

    Examples

    - -
    assert_member "foo", ["foo", "bar"]
    -
    -
    - Source -
    -

    - assert_nil/2 -

    -

    Asserts the value is nil.

    -
    - Source -
    -

    - assert_raise/2 -

    -

    Asserts the exception is raised during function execution.

    - -

    Examples

    - -
    assert_raise ArithmeticError, fn ->
    -  1 + "test"
    -end
    -
    -
    - Source -
    -

    - assert_raise/3 -

    -

    Asserts the exception is raised during function execution with the expected message.

    - -

    Examples

    - -
    assert_raise ArithmeticError, "bad argument in arithmetic expression", fn ->
    -  1 + "test"
    -end
    -
    -
    - Source -
    -

    - assert_throw/2 -

    -

    Asserts the throw expected during function execution.

    - -

    Examples

    - -
    assert_throw 1, fn ->
    -  throw 1
    -end
    -
    -
    - Source -
    -

    - flunk/1 -

    -

    Fails with a message.

    - -

    Examples

    - -
    flunk "This should raise an error"
    -
    -
    - Source -
    -

    - refute/2 -

    -

    Asserts the not_expected value is false.

    - -

    Examples

    - -
    refute false
    -
    -
    - Source -
    -

    - refute_empty/2 -

    -

    Asserts the enum collection is not empty.

    - -

    Examples

    - -
    refute_empty []
    -refute_empty [1, 2]
    -
    -
    - Source -
    -

    - refute_in_delta/4 -

    -

    Asserts the expected and received are not within delta.

    - -

    Examples

    - -
    refute_in_delta 1.1, 1.2, 0.2
    -refute_in_delta 10, 11, 2
    -
    -
    - Source -
    -

    - refute_member/3 -

    -

    Asserts the value is not a member of the given enumerable. -Used to check if an item belongs to a list.

    - -

    Examples

    - -
    refute_member "baz", ["foo", "bar"]
    -
    -
    - Source -
    -

    - refute_nil/2 -

    -

    Asserts the value is not nil.

    -
    - Source -
    -
    - - - -
    -

    Macros

    -
    -

    - assert/1 -

    -

    Asserts the expected value is true.

    - -

    assert in general tries to be smart and provide a good -reporting whenever there is a failure. For example, -assert 10 > 15 is going to fail with a message:

    - -
    Expected 10 to be more than 15
    -
    - -

    Examples

    - -
    assert true
    -
    -
    - Source -
    -

    - assert_match/2 -

    -

    Asserts the expected value matches received. This relies -on Elixir's pattern match instead of simply comparing terms.

    - -

    Examples

    - -
    assert_match { 1, _, 3 }, { 1, 2, 3 }
    -
    -
    - Source -
    -

    - refute_match/2 -

    -

    Assets the expected value does not match received. This uses -Elixir's pattern matching instead of simply comparing terms.

    - -

    Examples

    - -
    refute_match { 1, _, 3 }, { 1, 2, 3 }
    -
    -
    - Source -
    -
    - -
    - - diff --git a/docs/output/ExUnit.Case.html b/docs/output/ExUnit.Case.html deleted file mode 100644 index ac2080932..000000000 --- a/docs/output/ExUnit.Case.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - ExUnit.Case - - - - - - - - - - - - -
    -

    - ExUnit.Case - -

    - - -
    -

    This module is meant to be used in other modules -as a way to configure and prepare them for testing.

    - -

    When used, it allows the following options:

    - -
      -
    • :sync - by default, ExUnit run test cases in parallel -to each other. If this test case needs to run in sync, -set sync to true.
    • -
    - -

    Callbacks

    - -

    This module defines two callbacks. setup_all and teardown_all -which are executed before and after all tests respectively. -Those callbacks needs to return :ok, otherwise we assume -tests should not be run.

    - -

    Examples

    - -
    defmodule AssertionTest do
    -  use ExUnit.Case
    -
    -  def test_always_pass
    -    assert true
    -  end
    -end
    -
    - -
    - - - Source - - - - - - - - -

    Macros summary

    - - - - - - -
    -

    Macros

    -
    -

    - test/2 -

    -

    Provides a convenient macro that allows a test to be -defined with a string. This macro automatically inserts -the atom :ok as the last line of the test. That said, -a passing test always returns :ok, but, more important, -it forces Elixir to not tail call optimize the test and -therefore avoiding hiding lines from the backtrace.

    - -

    Examples

    - -
    test "true is equal to true" do
    -  assert true == true
    -end
    -
    -
    - Source -
    -
    - -
    - - diff --git a/docs/output/ExUnit.html b/docs/output/ExUnit.html deleted file mode 100644 index a31780bf0..000000000 --- a/docs/output/ExUnit.html +++ /dev/null @@ -1,139 +0,0 @@ - - - - ExUnit - - - - - - - - - - - - -
    -

    - ExUnit - -

    - - -
    -

    Basic unit test structure for Elixir.

    - -

    Example

    - -

    A basic setup for ExUnit is shown below:

    - -
    # File: assertion_test.exs
    -
    -# 1) Start ExUnit. You can pass some options as argument (list below)
    -ExUnit.start
    -
    -# 2) Next we create a new TestCase and use ExUnit.Case
    -defmodule AssertionTest do
    -  use ExUnit.Case
    -
    -  # 3) A test is a method which name finishes with _test
    -  def test_always_pass
    -    assert true
    -  end
    -end
    -
    - -

    To run the test above, all you need to to is to run the file -using elixir from command line. Assuming you named your file -assertion_test.exs, you can run it as:

    - -
    bin/elixir assertion_test.exs
    -
    - -

    Assertions

    - -

    Check ExUnit.Assertions for assertions documentation.

    - -
    - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - configure/1 -

    -

    Configure ExUnit.

    - -

    Options

    - -

    ExUnit supports the following options given to start:

    - -
      -
    • :formatter - The formatter that will print results
    • -
    • :max_cases - Maximum number of cases to run in parallel
    • -
    -
    - Source -
    -

    - run/0 -

    -

    API used to run the tests. A developer does not -need to call it directly.

    -
    - Source -
    -

    - start/1 -

    -

    Start ExUnit. Required to be invoked before loading -any file that uses ExUnit.Case. Check configure/1 -to see the supported options.

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/Exception.html b/docs/output/Exception.html deleted file mode 100644 index d37a73aeb..000000000 --- a/docs/output/Exception.html +++ /dev/null @@ -1,112 +0,0 @@ - - - - Exception - - - - - - - - - - - - -
    -

    - Exception - -

    - - -
    -

    Several convenience functions to work and pretty print -exceptions and backtraces.

    - -
    - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - format_file_line/1 -

    -

    Formats file and line information present in stacktraces. -Expect them to be given in a keywords list.

    -
    - Source -
    -

    - format_file_line/2 -

    -

    Formats the given file and line.

    -
    - Source -
    -

    - format_module_fun_arity/3 -

    -

    Receives a module, fun and arity and returns a string -representing such invocation. Arity may also be a list -of arguments. It follows the same syntax as in stacktraces.

    -
    - Source -
    -

    - format_stacktrace/1 -

    -

    Formats each line in the stacktrace.

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/File.Error.html b/docs/output/File.Error.html deleted file mode 100644 index d52901aae..000000000 --- a/docs/output/File.Error.html +++ /dev/null @@ -1,234 +0,0 @@ - - - - File.Error - - - - - - - - - - - - -
    -

    - File.Error - - exception - -

    - - - - Source - - - - -

    Fields (and defaults)

    -
      - -
    • - - action: "" - -
    • - -
    • - - path: nil - -
    • - -
    • - - reason: nil - -
    • - -
    - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - action/1 -

    -
    - Source -
    -

    - action/2 -

    -
    - Source -
    -

    - exception/1 -

    -
    - Source -
    -

    - exception/2 -

    -
    - Source -
    -

    - message/1 -

    -
    - Source -
    -

    - new/0 -

    -
    - Source -
    -

    - new/1 -

    -
    - Source -
    -

    - path/1 -

    -
    - Source -
    -

    - path/2 -

    -
    - Source -
    -

    - reason/1 -

    -
    - Source -
    -

    - reason/2 -

    -
    - Source -
    -

    - update_action/2 -

    -
    - Source -
    -

    - update_path/2 -

    -
    - Source -
    -

    - update_reason/2 -

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/File.Info.html b/docs/output/File.Info.html deleted file mode 100644 index 2f08aa3ef..000000000 --- a/docs/output/File.Info.html +++ /dev/null @@ -1,625 +0,0 @@ - - - - File.Info - - - - - - - - - - - - -
    -

    - File.Info - - record - -

    - - -
    -

    A record responsible to hold file information. Its fields are:

    - -
      -
    • size - Size of file in bytes.
    • -
    • type - :device, :directory, :regular, :other. The type of the file.
    • -
    • access - :read, :write, :read_write, :none. The current system access to - the file.
    • -
    • atime - The last time the file was read.
    • -
    • mtime - The last time the file was written.
    • -
    • ctime - The interpretation of this time field depends on the operating - system. On Unix, it is the last time the file or the inode was - changed. In Windows, it is the create time.
    • -
    • mode - The file permissions.
    • -
    • links - The number of links to this file. This is always 1 for file - systems which have no concept of links.
    • -
    • major_device - Identifies the file system where the file is located. - In windows, the number indicates a drive as follows: - 0 means A:, 1 means B:, and so on.
    • -
    • minor_device - Only valid for character devices on Unix. In all other - cases, this field is zero.
    • -
    • inode - Gives the inode number. On non-Unix file systems, this field - will be zero.
    • -
    • uid - Indicates the owner of the file.
    • -
    • gid - Gives the group that the owner of the file belongs to. Will be - zero for non-Unix file systems.
    • -
    - -

    The time type returned in atime, mtime, and ctime is dependent on the -time type set in options. {:time, type} where type can be :local, -:universal, or :posix. Default is :local.

    - -
    - - - Source - - - - -

    Fields (and defaults)

    -
      - -
    • - - size: nil - -
    • - -
    • - - type: nil - -
    • - -
    • - - access: nil - -
    • - -
    • - - atime: nil - -
    • - -
    • - - mtime: nil - -
    • - -
    • - - ctime: nil - -
    • - -
    • - - mode: nil - -
    • - -
    • - - links: nil - -
    • - -
    • - - major_device: nil - -
    • - -
    • - - minor_device: nil - -
    • - -
    • - - inode: nil - -
    • - -
    • - - uid: nil - -
    • - -
    • - - gid: nil - -
    • - -
    - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - access/1 -

    -
    - Source -
    -

    - access/2 -

    -
    - Source -
    -

    - atime/1 -

    -
    - Source -
    -

    - atime/2 -

    -
    - Source -
    -

    - ctime/1 -

    -
    - Source -
    -

    - ctime/2 -

    -
    - Source -
    -

    - gid/1 -

    -
    - Source -
    -

    - gid/2 -

    -
    - Source -
    -

    - inode/1 -

    -
    - Source -
    -

    - inode/2 -

    -
    - Source -
    -

    - links/1 -

    -
    - Source -
    -

    - links/2 -

    -
    - Source -
    -

    - major_device/1 -

    -
    - Source -
    -

    - major_device/2 -

    -
    - Source -
    -

    - minor_device/1 -

    -
    - Source -
    -

    - minor_device/2 -

    -
    - Source -
    -

    - mode/1 -

    -
    - Source -
    -

    - mode/2 -

    -
    - Source -
    -

    - mtime/1 -

    -
    - Source -
    -

    - mtime/2 -

    -
    - Source -
    -

    - new/0 -

    -
    - Source -
    -

    - new/1 -

    -
    - Source -
    -

    - size/1 -

    -
    - Source -
    -

    - size/2 -

    -
    - Source -
    -

    - type/1 -

    -
    - Source -
    -

    - type/2 -

    -
    - Source -
    -

    - uid/1 -

    -
    - Source -
    -

    - uid/2 -

    -
    - Source -
    -

    - update_access/2 -

    -
    - Source -
    -

    - update_atime/2 -

    -
    - Source -
    -

    - update_ctime/2 -

    -
    - Source -
    -

    - update_gid/2 -

    -
    - Source -
    -

    - update_inode/2 -

    -
    - Source -
    -

    - update_links/2 -

    -
    - Source -
    -

    - update_major_device/2 -

    -
    - Source -
    -

    - update_minor_device/2 -

    -
    - Source -
    -

    - update_mode/2 -

    -
    - Source -
    -

    - update_mtime/2 -

    -
    - Source -
    -

    - update_size/2 -

    -
    - Source -
    -

    - update_type/2 -

    -
    - Source -
    -

    - update_uid/2 -

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/File.html b/docs/output/File.html deleted file mode 100644 index a1517208f..000000000 --- a/docs/output/File.html +++ /dev/null @@ -1,370 +0,0 @@ - - - - File - - - - - - - - - - - - -
    -

    - File - -

    - - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - basename/1 -

    -

    Returns the last component of the path or the path -itself if it does not contain any directory separators.

    - -

    Examples

    - -
    File.basename("foo")
    -#=> "foo"
    -
    -File.basename("foo/bar")
    -#=> "bar"
    -
    -File.basename("/")
    -#=> ""
    -
    -
    - Source -
    -

    - basename/2 -

    -

    Returns the last component of path with the extension -stripped. This function should be used to remove a specific -extension which might, or might not, be there.

    - -

    Examples

    - -
    File.basename("~/foo/bar.ex", ".ex")
    -#=> "bar"
    -File.basename("~/foo/bar.exs", ".ex")
    -#=> "bar.exs"
    -File.basename("~/foo/bar.old.ex", ".ex")
    -#=> "bar.old"
    -
    -
    - Source -
    -

    - dir?/1 -

    -

    Returns true if the path is a directory.

    -
    - Source -
    -

    - exists?/1 -

    -

    Returns true if the given argument exists. -It can be regular file, directory, socket, -symbolic link, named pipe or device file.

    - -

    Examples

    - -

    File.exists?("test/") - #=> true

    - -

    File.exists?("missing.txt") - #=> false

    - -

    File.exists?("/dev/null") - #=> true

    -
    - Source -
    -

    - expand_path/1 -

    -

    Expands the path by returning its absolute name and expanding -any . and .. characters.

    - -

    Examples

    - -

    File.expand_path("/foo/bar/../bar") == "/foo/bar"

    -
    - Source -
    -

    - expand_path/2 -

    -

    Expands the path to the relative location and expanding -any . and .. characters. If the path is already an -absolute path, the relative location is ignored.

    - -

    Examples

    - -

    File.expandpath("foo/bar/../bar", "/baz") == "/baz/foo/bar" - File.expandpath("/foo/bar/../bar", "/baz") == "/foo/bar"

    -
    - Source -
    -

    - join/1 -

    -

    Returns a string with one or more paths components joint by the path separator. -This function should be used to convert a list of strings in a path.

    - -

    Examples

    - -
    File.join(["~", "foo"])
    -#=> "~/foo"
    -File.join(["foo"])
    -#=> "foo"
    -File.join(["/", "foo", "bar"])
    -#=> "/foo/bar"
    -
    -
    - Source -
    -

    - join/2 -

    -

    Join two paths.

    - -

    Examples

    - -
    File.join("foo", "bar")
    -#=> "foo/bar"
    -
    -
    - Source -
    -

    - read/1 -

    -

    Returns {:ok, binary}, where binary is a binary data object that contains the contents -of filename, or {:error, reason} if an error occurs.

    - -

    Typical error reasons:

    - -
      -
    • :enoent - The file does not exist.
    • -
    • :eacces - Missing permission for reading the file, - or for searching one of the parent directories.
    • -
    • :eisdir - The named file is a directory.
    • -
    • :enotdir - A component of the file name is not a directory. - On some platforms, enoent is returned instead.
    • -
    • :enomem - There is not enough memory for the contents of the file.
    • -
    - -

    You can use Erlang.file.format_error(reason) to get a descriptive string of the error.

    -
    - Source -
    -

    - read!/1 -

    -

    Returns binary with the contents of the given filename or raises -File.Error if an error occurs.

    -
    - Source -
    -

    - read_info/2 -

    -

    Returns information about a file. If the file exists, it -returns a { :ok, info } tuple, where info is as a -File.Info record. Retuns { :error, reason } with -the same reasons as File.read if a failure occurs.

    -
    - Source -
    -

    - read_info!/2 -

    -

    Same as read_info but returns the File.Info directly and -throws File.Error if an error is returned.

    -
    - Source -
    -

    - regular?/1 -

    -

    Returns true if the path is a regular file.

    - -

    Examples

    - -
    File.regular? __FILE__ #=> true
    -
    -
    - Source -
    -

    - split/1 -

    -

    Returns a list with the path splitted by the path separator. -If an empty string is given, then it returns the root path.

    - -

    Examples

    - -

    File.split("") - #=> ["/"] - File.split("foo") - #=> ["foo"] - File.split("/foo/bar") - #=> ["/", "foo", "bar"]

    -
    - Source -
    -

    - wildcard/1 -

    -

    Traverses files and directories according to the given glob expression.

    - -

    The wildcard string looks like an ordinary filename, except that certain -"wildcard characters" are interpreted in a special way. The following -characters are special:

    - -
      -
    • ? - Matches one character.
    • -
    • * - Matches any number of characters up to the end of - the filename, the next dot, or the next slash.
    • -
    • ** - Two adjacent *'s used as a single pattern will - match all files and zero or more directories and subdirectories.
    • -
    • [char1,char2,...] - Matches any of the characters listed. Two characters - separated by a hyphen will match a range of characters.
    • -
    • {item1,item2,...} - Matches one of the alternatives.
    • -
    - -

    Other characters represent themselves. Only filenames that have exactly -the same character in the same position will match. Note that matching -is case-sensitive; i.e. "a" will not match "A".

    - -

    Examples

    - -

    Imagine you have a directory called projects with three Elixir projects -inside of it: elixir, exdoc and dynamo. You can find all .beam files -inside their ebin directories all projects as follows:

    - -
    File.wildcard("projects/*/ebin/**/*.beam")
    -
    - -

    If you want to search for both .beam and .app files, you could do:

    - -
    File.wildcard("projects/*/ebin/**/*.{beam,app}")
    -
    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/FunctionClauseError.html b/docs/output/FunctionClauseError.html deleted file mode 100644 index 65f762a3b..000000000 --- a/docs/output/FunctionClauseError.html +++ /dev/null @@ -1,234 +0,0 @@ - - - - FunctionClauseError - - - - - - - - - - - - -
    -

    - FunctionClauseError - - exception - -

    - - - - Source - - - - -

    Fields (and defaults)

    -
      - -
    • - - arity: nil - -
    • - -
    • - - function: nil - -
    • - -
    • - - module: nil - -
    • - -
    - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - arity/1 -

    -
    - Source -
    -

    - arity/2 -

    -
    - Source -
    -

    - exception/1 -

    -
    - Source -
    -

    - exception/2 -

    -
    - Source -
    -

    - function/1 -

    -
    - Source -
    -

    - function/2 -

    -
    - Source -
    -

    - message/1 -

    -
    - Source -
    -

    - module/1 -

    -
    - Source -
    -

    - module/2 -

    -
    - Source -
    -

    - new/0 -

    -
    - Source -
    -

    - new/1 -

    -
    - Source -
    -

    - update_arity/2 -

    -
    - Source -
    -

    - update_function/2 -

    -
    - Source -
    -

    - update_module/2 -

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/GenServer.Behavior.html b/docs/output/GenServer.Behavior.html deleted file mode 100644 index bc2fc799c..000000000 --- a/docs/output/GenServer.Behavior.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - GenServer.Behavior - - - - - - - - - - - - -
    -

    - GenServer.Behavior - -

    - - - - Source - - - - - - - - -

    Macros summary

    - - - - - - -
    -

    Macros

    -
    -

    - __using__/2 -

    -

    By using this module, you get default GenServer callbacks -for handle_call, handle_info, handle_cast, terminate -and code_change. init still needs to be implemented by the -developer. Since these functions are defined as overridable, -they can be partially customized and have a global clause -that simply invokes super. See ExUnit.Server for some -code examples.

    - -

    This module also tags the behavior as :genserver. For more -information on genserver, please refer to the Erlang -documentation:

    - -

    http://www.erlang.org/doc/man/genserver.html -http://www.erlang.org/doc/designprinciples/genserverconcepts.html

    -
    - Source -
    -
    - -
    - - diff --git a/docs/output/HashDict.html b/docs/output/HashDict.html deleted file mode 100644 index ebeadcb38..000000000 --- a/docs/output/HashDict.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - HashDict - - - - - - - - - - - - -
    -

    - HashDict - -

    - - -
    -

    This module implements a dictionary based on hashing of the keys. -It is a simple wrapper around Erlang's dict module -and exposed via the Dict protocol.

    - -
    - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - new/0 -

    -

    Creates a new empty dict.

    -
    - Source -
    -

    - new/1 -

    -

    Creates a new dict from a list of pairs.

    - -

    Examples

    - -
    Dict.Common.new [{:b,1},{:a,2}]
    -#=> [a: 1, b: 2]
    -
    -
    - Source -
    -

    - new/2 -

    -

    Creates a new dict from a list of elements with the -help of the transformation function.

    - -

    Examples

    - -
    Dict.Common.new ["a", "b"], fn(x) -> {x, x} end
    -#=> ["a": "a", "b": "b"]
    -
    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/IO.html b/docs/output/IO.html deleted file mode 100644 index 7a9a30e20..000000000 --- a/docs/output/IO.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - IO - - - - - - - - - - - - -
    -

    - IO - -

    - - -
    -

    Module responsible for doing IO. -It is incomplete now. More functions will be -added in upcoming releases.

    - -
    - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - inspect/2 -

    -

    Prints the given argument to the device -but inspects it before.

    -
    - Source -
    -

    - print/2 -

    -

    Prints the given argument to the given device. -By default the device is the standard output. -The argument is converted to binary before -printing.

    - -

    It returns :ok if it succeeds.

    - -

    Examples

    - -
    IO.print :sample
    -#=> "sample"
    -
    -IO.print :standard_error, "error"
    -#=> "error"
    -
    -
    - Source -
    -

    - puts/2 -

    -

    Prints the given argument to the device, -similarly to print but adds a new line -at the end.

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/Keyword.html b/docs/output/Keyword.html deleted file mode 100644 index 6fcf14683..000000000 --- a/docs/output/Keyword.html +++ /dev/null @@ -1,322 +0,0 @@ - - - - Keyword - - - - - - - - - - - - -
    -

    - Keyword - -

    - - -
    -

    A keyword is a list of tuples where the first element -of the tuple is an atom and the second element can be -any value. The list is sorted by the first element of -each tuple.

    - -

    A keyword may have duplicated keys, so it is not strictly -a dictionary. However most of the functions in this module -allows it to behave exactly as a dictionary. For example, -Keyword.get will get the first entry matching the given -key, regardless if duplicated entries exist. Similarly, -Keyword.put and Keyword.delete ensure all duplicated -entries for a given key are removed when invoked.

    - -

    This module uses == as operator to check if two keys -are equal or not.

    - -
    - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - delete/2 -

    -

    Deletes all entries in the keywords list for a specific key. -If the key does not exist, returns the keywords list unchanged. -Use delete_first to delete just the first entry in case of -duplicated keys.

    - -

    Examples

    - -
    Keyword.delete [a: 1, b: 2], :a   #=> [b: 2]
    -Keyword.delete [b: 2], :a         #=> [b: 2]
    -
    -
    - Source -
    -

    - from_enum/1 -

    -

    Creates a Keyword from enum. Differently from Keyword.new -that behaves as a dict, Keyword.from_enum do not remove -duplicated entries.

    -
    - Source -
    -

    - get/3 -

    -

    Gets the value for specific key.

    - -

    If key not exist return default value (nil if no default value) -exists.

    - -

    If duplicated entries exist, the first one is returned. -Use get_values/2 to retrieve all entries.

    - -

    Examples

    - -
    Keyword.get [a: 1], :a      #=> 1
    -Keyword.get [a: 1], :b      #=> nil
    -Keyword.get [a: 1], :b, 3   #=> 3
    -
    -
    - Source -
    -

    - get_values/2 -

    -

    Gets all values for a specific key.

    - -

    Examples

    - -
    Keyword.get_values [a: 1, a: 2], :a
    -#=> [1,2]
    -
    -
    - Source -
    -

    - key?/2 -

    -

    Returns whether a given key exists in the given keywords.

    - -

    Examples

    - -
    Keyword.key?([a: 1], :a)
    -#=> true
    -Keyword.key?([a: 1], :b)
    -#=> false
    -
    -
    - Source -
    -

    - keys/1 -

    -

    Returns all keys from the keywords list. Duplicated -keys appear duplicated in the final list of keys.

    - -

    Examples

    - -
    Keyword.keys [a: 1, b: 2] #=> [:a,:b]
    -
    -
    - Source -
    -

    - merge/2 -

    -

    Merges two keywords lists into one. If they have duplicated -entries, the one given as second argument wins.

    - -

    Examples

    - -
    Keyword.merge [a: 1, b: 2], [a: 3, d: 4]
    -#=> [a:3, b:2, d: 4]
    -
    -
    - Source -
    -

    - merge/3 -

    -

    Merges two keywords lists into one. If they have duplicated -entries, the given function is invoked to solve conflicts.

    - -

    Examples

    - -
    Keyword.merge [a: 1, b: 2], [a: 3, d: 4], fn(_k, v1, v2) ->
    -  v1 + v2
    -end
    -#=> [a:4, b:2, d: 4]
    -
    -
    - Source -
    -

    - new/0 -

    -

    Returns an empty keywords list, i.e. an empty list.

    -
    - Source -
    -

    - new/1 -

    -

    Creates a Keyword from an enumerable. Similarly to dicts, -duplicated entries are removed, the latest one prevails.

    - -

    Examples

    - -
    Keyword.new [{:b,1},{:a,2}]
    -#=> [a: 2, b: 1]
    -
    -
    - Source -
    -

    - new/2 -

    -

    Creates a Keyword from an enumerable with the -help of the transformation function. Duplicated -entries are removed, the latest one prevails.

    - -

    Examples

    - -
    Keyword.new [:a, :b], fn(x) -> {x,x} end
    -#=> [a: :a, b: :b]
    -
    -
    - Source -
    -

    - put/3 -

    -

    Sets the given value under key.

    - -

    If a previous value is already stored, all entries are -removed and the value is overriden.

    - -

    Use put_other/3 to add a new value for an existing key -without removing previous ones.

    - -

    Examples

    - -
    Keyword.put [a: 1, b: 2], :a, 3
    -#=> [a: 3, b: 2]
    -
    -
    - Source -
    -

    - values/1 -

    -

    Returns all values.

    - -

    Examples

    - -
    Keyword.values [a: 1, b: 2] #=> [1,2]
    -
    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/List.Chars.Atom.html b/docs/output/List.Chars.Atom.html deleted file mode 100644 index 399c5fe76..000000000 --- a/docs/output/List.Chars.Atom.html +++ /dev/null @@ -1,68 +0,0 @@ - - - - List.Chars.Atom - - - - - - - - - - - - -
    -

    - List.Chars.Atom - - impl - -

    - - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - to_char_list/1 -

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/List.Chars.BitString.html b/docs/output/List.Chars.BitString.html deleted file mode 100644 index 728d91363..000000000 --- a/docs/output/List.Chars.BitString.html +++ /dev/null @@ -1,68 +0,0 @@ - - - - List.Chars.BitString - - - - - - - - - - - - -
    -

    - List.Chars.BitString - - impl - -

    - - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - to_char_list/1 -

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/List.Chars.List.html b/docs/output/List.Chars.List.html deleted file mode 100644 index 1af4f246c..000000000 --- a/docs/output/List.Chars.List.html +++ /dev/null @@ -1,68 +0,0 @@ - - - - List.Chars.List - - - - - - - - - - - - -
    -

    - List.Chars.List - - impl - -

    - - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - to_char_list/1 -

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/List.Chars.Number.html b/docs/output/List.Chars.Number.html deleted file mode 100644 index 4289bc97f..000000000 --- a/docs/output/List.Chars.Number.html +++ /dev/null @@ -1,68 +0,0 @@ - - - - List.Chars.Number - - - - - - - - - - - - -
    -

    - List.Chars.Number - - impl - -

    - - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - to_char_list/1 -

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/List.Chars.html b/docs/output/List.Chars.html deleted file mode 100644 index 3c25e4db8..000000000 --- a/docs/output/List.Chars.html +++ /dev/null @@ -1,108 +0,0 @@ - - - - List.Chars - - - - - - - - - - - - -
    -

    - List.Chars - - protocol - -

    - - -
    -

    The List.Chars protocol is responsible for -converting a structure to a list (only if applicable). -The only function required to be implemented is -to_char_list which does the conversion.

    - -

    The to_char_list function automatically imported -by Elixir.Builtin invokes this protocol.

    - -
    - - - Source - - -

    Implementations

    - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - to_char_list/1 -

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/List.html b/docs/output/List.html deleted file mode 100644 index 874e7e3ed..000000000 --- a/docs/output/List.html +++ /dev/null @@ -1,566 +0,0 @@ - - - - List - - - - - - - - - - - - -
    -

    - List - -

    - - -
    -

    Implements functions that only make sense for lists -and cannot be part of the Enum protocol. In general, -favor using the Enum API instead of List.

    - -

    A decision was taken to delegate most functions to -Erlang's standard lib but following Elixir's convention -of receiving the target (in this case, a list) as the -first argument.

    - -
    - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - access/2 -

    -

    Simply invokes the Access protocol for the given list. -Check Access.List for more information.

    -
    - Source -
    -

    - concat/1 -

    -

    Given a list of lists, concatenates the sublists into a single list.

    - -

    Examples

    - -
    List.concat [[1,[2],3], [4], [5,6]]
    -#=> [1,[2],3,4,5,6]
    -
    -
    - Source -
    -

    - concat/2 -

    -

    Concatenates the list on the right with the list on the left.

    - -

    This function produces the same result the ++ operator. The only difference -is a minor optimization: when the first list contains only one element, we -simply add it as a head to the second list.

    - -

    Examples

    - -
    List.concat [1,2,3], [4,5,6]
    -#=> [1,2,3,4,5,6]
    -
    -
    - Source -
    -

    - delete/2 -

    -

    Deletes the given item from the list. Returns a list without the item. -If the item occurs more than once in the list, just the first occurrence -is removed.

    - -

    Examples

    - -
    List.delete([1,2,3], 1)
    -#=> [2,3]
    -
    -
    - Source -
    -

    - duplicate/2 -

    -

    Duplicates the given element n times in a list.

    - -

    Examples

    - -
    List.duplicate "hello", 3
    -#=> ["hello","hello","hello"]
    -
    -List.duplicate [1,2], 2
    -#=> [[1,2],[1,2]]
    -
    -
    - Source -
    -

    - find_index/2 -

    -

    Looks for a term in a list and returns its position. -If term is found in the first position, return 1. -If no terms not found in list, the return value is nil.

    - -

    Examples

    - -
    List.find_index ['a'], 'b'
    -#=> nil
    -List.find_index ['a'], 'a'
    -#=> 1
    -
    -
    - Source -
    -

    - flatten/1 -

    -

    Flattens the given list of nested lists. An optional -tail can be given that will be added at the end of -the flattened list.

    - -

    Examples

    - -
    List.flatten [1,[[2],3]]
    -# => [1,2,3]
    -
    -List.flatten [1,[[2],3]], [4,5]
    -# => [1,2,3,4,5]
    -
    -
    - Source -
    -

    - flatten/2 -

    -
    - Source -
    -

    - foldl/3 -

    -

    Folds (reduces) the given list to the left with -a function. Requires an accumulator.

    - -

    Examples

    - -
    List.foldl [5,5], 10, fn(x, acc) -> x + acc end
    -#=> 20
    -
    -List.foldl [1,2,3,4], 0, fn(x, acc) -> x - acc end
    -#=> 2
    -
    -
    - Source -
    -

    - foldr/3 -

    -

    Folds (reduces) the given list to the right with -a function. Requires an accumulator.

    - -

    Examples

    - -
    List.foldr [1,2,3,4], 0, fn(x, acc) -> x - acc end
    -#=> -2
    -
    -
    - Source -
    -

    - keydelete/3 -

    -

    Receives a list of tuples and deletes the first tuple -where the item at position posistion matches with the -given item. Returns the new tuple.

    - -

    Examples

    - -
    List.keydelete([a: 1, b: 2], :a, 1)
    -#=> [{ :b, 2 }]
    -
    -List.keydelete([a: 1, b: 2], 2, 2)
    -#=> [{ :a, 1 }]
    -
    -List.keydelete([a: 1, b: 2], :c, 1)
    -#=> [{ :a, 1 }, { :b, 2 }]
    -
    -
    - Source -
    -

    - keyfind/4 -

    -

    Receives a list of tuples and returns the first tuple -where the item at position posistion matches with the -given item.

    - -

    Examples

    - -
    List.keyfind([a: 1, b: 2], :a, 1)
    -#=> { :a, 1 }
    -
    -List.keyfind([a: 1, b: 2], 2, 2)
    -#=> { :b, 2 }
    -
    -List.keyfind([a: 1, b: 2], :c, 1)
    -#=> nil
    -
    -
    - Source -
    -

    - keymember?/3 -

    -

    Receives a list of tuples and returns true if there is -a tuple where the item at position posistion matches -with the given item.

    - -

    Examples

    - -
    List.keymember?([a: 1, b: 2], :a, 1)
    -#=> true
    -
    -List.keymember?([a: 1, b: 2], 2, 2)
    -#=> true
    -
    -List.keymember?([a: 1, b: 2], :c, 1)
    -#=> false
    -
    -
    - Source -
    -

    - last/1 -

    -

    Returns the last element in list or nil if the list is empty.

    - -

    Examples

    - -
    List.last []
    -#=> nil
    -List.last [1]
    -#=> 1
    -List.last [1, 2, 3]
    -#=> 3
    -
    -
    - Source -
    -

    - member?/2 -

    -

    Checks if the given term is included in the list. -This function simply delegates to lists:member -which is implemented in C for performance.

    - -

    Examples

    - -
    List.member? [1,2,3], 1
    -#=> true
    -
    -List.member? [1,2,3], 0
    -#=> false
    -
    -
    - Source -
    -

    - range/3 -

    -

    Returns a list of integers in the given range (both ends included when -possible). An optional step can be provided as well (defaults to 1).

    - -

    If first > last and no step is provided, the numbers will be in descending -order.

    - -

    Examples

    - -
    List.range 1, 3     #=> [1,2,3]
    -List.range 1, 8, 2  #=> [1,3,5,7]
    -List.range 1, 0     #=> []
    -List.range 3, 1     #=> [3,2,1]
    -List.range 5, 1, -2 #=> [5, 3, 1]
    -
    -
    - Source -
    -

    - reverse/1 -

    -

    Reverses the given list. This function simply delegates -to lists:reverse which is implemented in C for performance.

    - -

    Examples

    - -
    List.reverse [1,2,3]
    -#=> [3,2,1]
    -
    -
    - Source -
    -

    - sort/1 -

    -

    Sorts the list by comparing each term. For an alternative -sorting algorithm, check Enum.qsort.

    - -

    Examples

    - -
    List.sort [3, 4, 2, 1, 7]
    -#=> [1, 2, 3, 4, 7]
    -
    -
    - Source -
    -

    - sort/2 -

    -

    Sorts the list according to an ordering function. fun(a, b) should -return true if a compares less than or equal to b, false otherwise.

    - -

    Examples

    - -
    List.sort [3, 4, 2, 1, 7], fn(a, b) -> b <= a end
    -#=> [7, 4, 3, 2, 1]
    -
    -
    - Source -
    -

    - uniq/1 -

    -

    Returns a list without duplicated items.

    - -

    Examples

    - -
    List.uniq [1,2,3,2,1]
    -#=> [1,2,3]
    -
    -
    - Source -
    -

    - unzip/1 -

    -

    Unzips the given list of lists or tuples into separate lists and returns a -list of lists.

    - -

    Examples

    - -
    List.unzip [{1, 2}, {3, 4}]
    -#=> [[1, 3], [2, 4]]
    -
    -List.unzip [{1, :a, "apple"}, {2, :b, "banana"}, {3, :c}]
    -#=> [[1, 2, 3], [:a, :b, :c]]
    -
    -
    - Source -
    -

    - wrap/1 -

    -

    Wraps the argument in a list. -If the argument is already a list, returns the list. -If the argument is nil, returns an empty list.

    - -

    Examples

    - -
    List.wrap [1,2,3] #=> [1,2,3]
    -
    -
    - Source -
    -

    - zip/1 -

    -

    Zips corresponding elements from each list in list_of_lists.

    - -

    Examples

    - -
    List.zip [[1, 2], [3, 4], [5, 6]]
    -#=> [{1, 3, 5}, {2, 4, 6}]
    -
    -List.zip [[1, 2], [3], [5, 6]]
    -#=> [{1, 3, 5}]
    -
    -
    - Source -
    -

    - zip/2 -

    -

    Zips corresponding elements from two lists (or tuples) into one list of tuples. The -number of elements in the resulting list is equal to the length of the -shortest list among the given ones.

    - -

    Examples

    - -
    List.zip [1, 2, 3], [4, 5, 6]
    -#=> [{1, 4}, {2, 5}, {3, 6}]
    -
    -List.zip [1, 2], [4, 5, 6]
    -#=> [{1, 4}, {2, 5}]
    -
    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/Macro.html b/docs/output/Macro.html deleted file mode 100644 index 2038b6ce6..000000000 --- a/docs/output/Macro.html +++ /dev/null @@ -1,83 +0,0 @@ - - - - Macro - - - - - - - - - - - - -
    -

    - Macro - -

    - - -
    -

    This module provides conveniences for working with macros.

    - -
    - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - escape/1 -

    -

    Recursively escapes the given value so it can be inserted -into a syntax tree. Structures that are valid syntax nodes -(like atoms, integers, binaries) are represented by themselves.

    - -

    Examples

    - -
    Macro.escape(:foo)
    -#=> :foo
    -
    -Macro.escape({ :a, :b, :c })
    -#=> { :{}, 0, [:a, :b, :c] }
    -
    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/MatchError.html b/docs/output/MatchError.html deleted file mode 100644 index 58ecba564..000000000 --- a/docs/output/MatchError.html +++ /dev/null @@ -1,156 +0,0 @@ - - - - MatchError - - - - - - - - - - - - -
    -

    - MatchError - - exception - -

    - - - - Source - - - - -

    Fields (and defaults)

    -
      - -
    • - - actual: nil - -
    • - -
    - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - actual/1 -

    -
    - Source -
    -

    - actual/2 -

    -
    - Source -
    -

    - exception/1 -

    -
    - Source -
    -

    - exception/2 -

    -
    - Source -
    -

    - message/1 -

    -
    - Source -
    -

    - new/0 -

    -
    - Source -
    -

    - new/1 -

    -
    - Source -
    -

    - update_actual/2 -

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/Module.html b/docs/output/Module.html deleted file mode 100644 index 4e714a2a6..000000000 --- a/docs/output/Module.html +++ /dev/null @@ -1,502 +0,0 @@ - - - - Module - - - - - - - - - - - - -
    -

    - Module - -

    - - -
    -

    This module provides many functions to deal with modules during -compilation time. It allows a developer to dynamically attach -documentation, merge data, register attributes and so forth.

    - -

    After the module is compiled, using many of the functions in -this module will raise errors, since it is out of their purpose -to inspect runtime data. Most of the runtime data can be inspected -via the __info__(attr) function attached to each compiled module.

    - -
    - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - add_attribute/3 -

    -

    Adds an Erlang attribute to the given module with the given -key and value. The same attribute can be added more than once.

    - -

    Examples

    - -
    defmodule MyModule do
    -  Module.add_attribute __MODULE__, :custom_threshold_for_lib, 10
    -end
    -
    -
    - Source -
    -

    - add_compile_callback/3 -

    -

    Adds a compilation callback hook that is invoked -exactly before the module is compiled.

    - -

    This callback is useful, for example, when used with use -as a mechanism to clean up any internal data in the module -before it is compiled.

    - -

    Examples

    - -

    Imagine you are creating a module/library that is meant for -external usage called MyLib. It could be defined as:

    - -
    defmodule MyLib do
    -  def __using__(target) do
    -    Module.merge_data target, some_data: nil
    -    Module.add_compile_callback(target, __MODULE__, :__callback__)
    -  end
    -
    -  defmacro __callback__(target) do
    -    value = Module.read_data(target, :some_data)
    -    quote do: (def my_lib_value, do: unquote(value))
    -  end
    -end
    -
    - -

    And a module could use MyLib with:

    - -
    defmodule App do
    -  use ModuleTest.ToBeUsed
    -  @some_data :new_value
    -end
    -
    - -

    In the example above, MyLib defines a data on the target. -This data can be updated throughout the module definition -and therefore, the final value of the data can only be retrieved -via the compilation callback.

    - -

    In this example, the compilation callback reads the value and -compile it to a function.

    -
    - Source -
    -

    - add_doc/5 -

    -

    Attaches documentation to a given function. It expects -the module the function belongs to, the line (a non negative -integer), the kind (def or defmacro), a tuple representing -the function and its arity and the documentation, which should -be either a binary or a boolean.

    - -

    Examples

    - -
    defmodule MyModule do
    -  Module.add_doc(__MODULE__, __LINE__ + 1, :def, { :version, 0 }, "Manually added docs")
    -  def version, do: 1
    -end
    -
    -
    - Source -
    -

    - compiled?/1 -

    -

    Checks if the module is compiled or not.

    - -

    Examples

    - -
    defmodule Foo do
    -  Module.compiled?(__MODULE__) #=> false
    -end
    -
    -Module.compiled?(Foo) #=> true
    -
    -
    - Source -
    -

    - concat/1 -

    -

    Concatenates the list of arguments and returns the module name. -It handles char lists, binaries and atoms.

    - -

    Examples

    - -
    Module.concat [Foo, Bar]    #=> Foo.Bar
    -Module.concat [Foo, "Bar"]  #=> Foo.Bar
    -Module.concat [Foo, 'Bar']  #=> Foo.Bar
    -
    -
    - Source -
    -

    - concat/2 -

    -

    Concatenates two arguments and returns the module name. -It handles char lists, binaries and atoms.

    - -

    Examples

    - -
    Module.concat Foo, Bar    #=> Foo.Bar
    -Module.concat Foo, "Bar"  #=> Foo.Bar
    -Module.concat Foo, 'Bar'  #=> Foo.Bar
    -
    -
    - Source -
    -

    - defined_functions/1 -

    -

    Return all functions defined in the given module.

    - -

    Examples

    - -
    defmodule Example do
    -  def version, do: 1
    -  Module.defined_functions __MODULE__ #=> [{:version,1}]
    -end
    -
    -
    - Source -
    -

    - defined_functions/2 -

    -

    Returns all functions defined in te given module according -to its kind.

    - -

    Examples

    - -
    defmodule Example do
    -  def version, do: 1
    -  Module.defined_functions __MODULE__, :def  #=> [{:version,1}]
    -  Module.defined_functions __MODULE__, :defp #=> []
    -end
    -
    -
    - Source -
    -

    - delete_attribute/2 -

    -

    Deletes all attributes that matches the given key.

    - -

    Examples

    - -
    defmodule MyModule do
    -  Module.add_attribute __MODULE__, :custom_threshold_for_lib, 10
    -  Module.delete_attribute __MODULE__, :custom_threshold_for_lib
    -end
    -
    -
    - Source -
    -

    - eval_quoted/4 -

    -

    Evalutes the quotes contents in the given module context. -Raises an error if the module was already compiled.

    - -

    Examples

    - -
    defmodule Foo do
    -  contents = quote do: (def sum(a, b), do: a + b)
    -  Module.eval_quoted __MODULE__, contents, [], file: __FILE__, line: __LINE__
    -end
    -
    -Foo.sum(1, 2) #=> 3
    -
    -
    - Source -
    -

    - function_defined?/2 -

    -

    Checks if a function was defined, regardless if it is -a macro or a private function. Use function_defined?/3 -to assert for an specific type.

    - -

    Examples

    - -
    defmodule Example do
    -  Module.function_defined? __MODULE__, { :version, 0 } #=> false
    -  def version, do: 1
    -  Module.function_defined? __MODULE__, { :version, 0 } #=> true
    -end
    -
    -
    - Source -
    -

    - function_defined?/3 -

    -

    Checks if a function was defined and also for its kind. -kind can be either :def, :defp or :defmacro.

    - -

    Examples

    - -
    defmodule Example do
    -  Module.function_defined? __MODULE__, { :version, 0 }, :defp #=> false
    -  def version, do: 1
    -  Module.function_defined? __MODULE__, { :version, 0 }, :defp #=> false
    -end
    -
    -
    - Source -
    -

    - make_overridable/2 -

    -

    Makes the given functions in the given module overridable. -An overridable function is lazily defined, allowing a -developer to customize it.

    -
    - Source -
    -

    - merge_data/2 -

    -

    Merge the given data into the module, overriding any -previous one.

    - -

    If any of the given data is a registered attribute, it is -automatically added to the attribute set, instead of marking -it as data. See registerattribute/2 and addattribute/3 for -more info.

    - -

    Examples

    - -
    defmodule Foo do
    -  Module.merge_data __MODULE__, value: 1
    -end
    -
    -Foo.__info__(:data) #=> [value: 1]
    -
    -
    - Source -
    -

    - read_data/1 -

    -

    Reads the data for the given module. This is used -to read data of uncompiled modules. If the module -was already compiled, you shoul access the data -directly by invoking __info__(:data) in that module.

    - -

    Examples

    - -
    defmodule Foo do
    -  Module.merge_data __MODULE__, value: 1
    -  Module.read_data __MODULE__ #=> [value: 1]
    -end
    -
    -
    - Source -
    -

    - read_data/2 -

    -

    Reads the data from module at the given key at.

    - -

    Examples

    - -
    defmodule Foo do
    -  Module.merge_data __MODULE__, value: 1
    -  Module.read_data __MODULE__, :value #=> 1
    -end
    -
    -
    - Source -
    -

    - register_attribute/2 -

    -

    Registers an attribute. This allows a developer to use the data API -but Elixir will register the data as an attribute automatically. -By default, vsn, behavior and other Erlang attributes are -automatically registered.

    - -

    Examples

    - -
    defmodule MyModule do
    -  Module.register_attribute __MODULE__, :custom_threshold_for_lib
    -  @custom_threshold_for_lib 10
    -end
    -
    -
    - Source -
    -

    - safe_concat/1 -

    -

    Concatenates the list arguments and returns the module -name only if the module was already referenced. -If the module was not referenced yet, fails with ArgumentError. -It handles char lists, binaries and atoms.

    - -

    Examples

    - -
    Module.safe_concat [Unknown, Module]
    -#=> ArgumentError
    -
    -
    - Source -
    -

    - safe_concat/2 -

    -

    Concatenates two arguments and returns the module -name only if the module was already referenced. -If the module was not referenced yet, fails with ArgumentError. -It handles char lists, binaries and atoms.

    - -

    Examples

    - -
    Module.safe_concat Unknown, Module
    -#=> ArgumentError
    -
    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/Node.html b/docs/output/Node.html deleted file mode 100644 index 7cca2916c..000000000 --- a/docs/output/Node.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - Node - - - - - - - - - - - - -
    -

    - Node - -

    - - -
    -

    Functions related to Erlang nodes.

    - -
    - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - alive?/0 -

    -

    Returns true if the local node is alive; that is, if the node can be -part of a distributed system. Otherwise, it returns false.

    -
    - Source -
    -

    - disconnect/1 -

    -

    Forces the disconnection of a node. This will appear to the node as if -the local node has crashed. This BIF is mainly used in the Erlang network -authentication protocols. Returns true if disconnection succeeds, otherwise -false. If the local node is not alive, the function returns ignored.

    - -

    See http://www.erlang.org/doc/man/erlang.html#disconnect_node-1 for more info.

    -
    - Source -
    -

    - list/0 -

    -

    Returns a list of all visible nodes in the system, excluding -the local node. Same as list(visible).

    -
    - Source -
    -

    - list/1 -

    -

    Returns a list of nodes according to argument given. The result -returned when the argument is a list, is the list of nodes -satisfying the disjunction(s) of the list elements.

    - -

    See http://www.erlang.org/doc/man/erlang.html#nodes-1 for more info.

    -
    - Source -
    -

    - monitor/2 -

    -

    Monitors the status of the node. If flag is true, monitoring is -turned on. If flag is false, monitoring is turned off.

    - -

    See http://www.erlang.org/doc/man/erlang.html#monitor_node-2 for more info.

    -
    - Source -
    -

    - monitor/3 -

    -

    Behaves as monitornode/2 except that it allows an extra -option to be given, namely :allowpassive_connect.

    - -

    See http://www.erlang.org/doc/man/erlang.html#monitor_node-3 for more info.

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/OptionParser.Simple.html b/docs/output/OptionParser.Simple.html deleted file mode 100644 index 25f7c9a2e..000000000 --- a/docs/output/OptionParser.Simple.html +++ /dev/null @@ -1,86 +0,0 @@ - - - - OptionParser.Simple - - - - - - - - - - - - -
    -

    - OptionParser.Simple - -

    - - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - parse/2 -

    -

    Parses the argv and returns one tuple with parsed options -and the arguments.

    - -

    Example

    - -
    OptionParser.Simple.parse(["--debug"])
    -#=> { [debug: true], [] }
    -
    -OptionParser.Simple.parse(["--source", "lib"])
    -#=> { [source: "lib"], [] }
    -
    -OptionParser.Simple.parse(["--source", "lib", "test/enum_test.exs"])
    -#=> { [source: "lib"], ["test/enum_test.exs"] }
    -
    - -

    A set of aliases can be given as second argument:

    - -
    OptionParser.Simple.parse(["-d"], [d: :debug])
    -#=> { [debug: true], [] }
    -
    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/Orddict.html b/docs/output/Orddict.html deleted file mode 100644 index 31bc677de..000000000 --- a/docs/output/Orddict.html +++ /dev/null @@ -1,112 +0,0 @@ - - - - Orddict - - - - - - - - - - - - -
    -

    - Orddict - -

    - - -
    -

    This module implements a dictionary based that stores items -as a list of tuples. It is a simple wrapper around -Erlang's orddict module -and exposed via the Dict protocol.

    - -
    - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - new/0 -

    -

    Creates a new empty dict.

    -
    - Source -
    -

    - new/1 -

    -

    Creates a new dict from a list of pairs.

    - -

    Examples

    - -
    Dict.Common.new [{:b,1},{:a,2}]
    -#=> [a: 1, b: 2]
    -
    -
    - Source -
    -

    - new/2 -

    -

    Creates a new dict from a list of elements with the -help of the transformation function.

    - -

    Examples

    - -
    Dict.Common.new ["a", "b"], fn(x) -> {x, x} end
    -#=> ["a": "a", "b": "b"]
    -
    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/Port.html b/docs/output/Port.html deleted file mode 100644 index fa284868d..000000000 --- a/docs/output/Port.html +++ /dev/null @@ -1,168 +0,0 @@ - - - - Port - - - - - - - - - - - - -
    -

    - Port - -

    - - -
    -

    Functions related to Erlang ports.

    - -
    - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - call/3 -

    -

    See http://www.erlang.org/doc/man/erlang.html#port_call-3.

    -
    - Source -
    -

    - close/1 -

    -

    See http://www.erlang.org/doc/man/erlang.html#port_close-1.

    -
    - Source -
    -

    - command/3 -

    -

    See http://www.erlang.org/doc/man/erlang.html#port_command-2.

    -
    - Source -
    -

    - connect/2 -

    -

    See http://www.erlang.org/doc/man/erlang.html#port_connect-2.

    -
    - Source -
    -

    - control/3 -

    -

    See http://www.erlang.org/doc/man/erlang.html#port_control-3.

    -
    - Source -
    -

    - info/1 -

    -

    See http://www.erlang.org/doc/man/erlang.html#port_info-1.

    -
    - Source -
    -

    - info/2 -

    -

    See http://www.erlang.org/doc/man/erlang.html#port_info-2.

    -
    - Source -
    -

    - list/0 -

    -

    See http://www.erlang.org/doc/man/erlang.html#ports-0.

    -
    - Source -
    -

    - open/2 -

    -

    See http://www.erlang.org/doc/man/erlang.html#open_port-2.

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/Process.html b/docs/output/Process.html deleted file mode 100644 index 60d62cc20..000000000 --- a/docs/output/Process.html +++ /dev/null @@ -1,467 +0,0 @@ - - - - Process - - - - - - - - - - - - -
    -

    - Process - -

    - - -
    -

    This module provides convenience functions around processes and -the process dictionary. In Erlang, most of these functions are -auto-imported, but in Elixir they are grouped in a module for -convenience. Notice that these functions, different from Erlang's, -always return nil instead of undefined. You can use their Erlang -version if you want the undefined value.

    - -
    - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - alive?/1 -

    -

    Returns true if the process exists and is alive, that is, -is not exiting and has not exited. Otherwise, returns false.

    - -

    pid must refer to a process at the local node.

    -
    - Source -
    -

    - delete/0 -

    -

    Deletes all items in the dictionary.

    -
    - Source -
    -

    - delete/1 -

    -

    Deletes the given key from the dictionary.

    -
    - Source -
    -

    - demonitor/2 -

    -

    If monitor_ref is a reference which the calling process -obtained by calling monitor/1, this monitoring is turned off. -If the monitoring is already turned off, nothing happens.

    - -

    See http://www.erlang.org/doc/man/erlang.html#demonitor-2 for more info.

    -
    - Source -
    -

    - flag/2 -

    -

    Sets certain flags for the process which calls this function. -Returns the old value of the flag.

    - -

    See http://www.erlang.org/doc/man/erlang.html#process_flag-2 for more info.

    -
    - Source -
    -

    - flag/3 -

    -

    Sets certain flags for the process Pid, in the same manner as flag/2. -Returns the old value of the flag. The allowed values for Flag are -only a subset of those allowed in flag/2, namely: save_calls.

    - -

    See http://www.erlang.org/doc/man/erlang.html#process_flag-3 for more info.

    -
    - Source -
    -

    - get/0 -

    -

    Returns all key-values in the dictionary -with no specific ordering (i.e. they are -not a keywords list).

    -
    - Source -
    -

    - get/2 -

    -

    Returns the value for the given key.

    -
    - Source -
    -

    - get_keys/1 -

    -

    Returns all keys that have the given value.

    -
    - Source -
    -

    - info/2 -

    -

    Returns information about the process identified by pid -or undefined if the process is not alive.

    - -

    See http://www.erlang.org/doc/man/erlang.html#process_info-2 for more info.

    -
    - Source -
    -

    - link/1 -

    -

    Creates a link between the calling process and another process -(or port) pid, if there is not such a link already.

    - -

    See http://www.erlang.org/doc/man/erlang.html#link-1 for more info.

    -
    - Source -
    -

    - list/0 -

    -

    Returns a list of process identifiers corresponding to all the -processes currently existing on the local node.

    - -

    Note that a process that is exiting, exists but is not alive, i.e., -alive?/1 will return false for a process that is exiting, -but its process identifier will be part of the result returned.

    - -

    See http://www.erlang.org/doc/man/erlang.html#processes-0 for more info.

    -
    - Source -
    -

    - monitor/1 -

    -

    The calling process starts monitoring the item given. -It returns the monitor reference.

    - -

    See http://www.erlang.org/doc/man/erlang.html#monitor-2 for more info.

    -
    - Source -
    -

    - put/2 -

    -

    Stores the given key-value in the process dictionary.

    -
    - Source -
    -

    - register/2 -

    -

    Associates the name with a pid or a port identifier. name, which must -be an atom, can be used instead of the pid / port identifier in the -send operator (name <- message).

    - -

    See http://www.erlang.org/doc/man/erlang.html#register-2 for more info.

    -
    - Source -
    -

    - registered/0 -

    -

    Returns a list of names which have been registered using register/2.

    -
    - Source -
    -

    - self/0 -

    -

    Returns the current process.

    -
    - Source -
    -

    - spawn/1 -

    -

    Returns the pid of a new process started by the application of fun to the -empty list []. Otherwise works like spawn/3.

    -
    - Source -
    -

    - spawn/2 -

    -

    Returns the pid of a new process started by the application of fun to the -empty list [] on node. If node does not exist, a useless pid is returned. -Otherwise works like spawn/3.

    -
    - Source -
    -

    - spawn/3 -

    -

    Returns the pid of a new process started by the application of -module.function to args. The new process created will be placed in the system -scheduler queue and be run some time later.

    - -

    See http://www.erlang.org/doc/man/erlang.html#spawn-3 for more info.

    -
    - Source -
    -

    - spawn/4 -

    -

    Returns the pid of a new process started by the application of -module.function to args on node. If node does not exists, a useless -pid is returned. Otherwise works like spawn/3.

    -
    - Source -
    -

    - spawn_link/1 -

    -

    Returns the pid of a new process started by the application of fun to the -empty list []. A link is created between the calling process and the new -process, atomically. Otherwise works like spawn/3.

    -
    - Source -
    -

    - spawn_link/2 -

    -

    Returns the pid of a new process started by the application of fun to the -empty list [] on node. A link is created between the calling process and the -new process, atomically. If node does not exist, a useless pid is returned -(and due to the link, an exit signal with exit reason :noconnection will be -received). Otherwise works like spawn/3.

    -
    - Source -
    -

    - spawn_link/3 -

    -

    Returns the pid of a new process started by the application of -module.function to args. A link is created between the calling process -and the new process, atomically. Otherwise works like spawn/3.

    -
    - Source -
    -

    - spawn_link/4 -

    -

    Returns the pid of a new process started by the application of -module.function to args on node. A link is created between the calling -process and the new process, atomically. If node does not exist, a useless -pid is returned (and due to the link, an exit signal with exit reason -:noconnection will be received). Otherwise works like spawn/3.

    -
    - Source -
    -

    - unlink/1 -

    -

    Removes the link, if there is one, between the calling process and -the process or port referred to by pid. Returns true and does not -fail, even if there is no link or id does not exist

    - -

    See http://www.erlang.org/doc/man/erlang.html#unlink-1 for more info.

    -
    - Source -
    -

    - unregister/1 -

    -

    Removes the registered name, associated with a pid or a port identifier.

    - -

    See http://www.erlang.org/doc/man/erlang.html#unregister-1 for more info.

    -
    - Source -
    -

    - whereis/1 -

    -

    Returns the pid or port identifier with the registered name. -Returns undefined if the name is not registered.

    - -

    See http://www.erlang.org/doc/man/erlang.html#whereis-1 for more info.

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/Protocol.UndefinedError.html b/docs/output/Protocol.UndefinedError.html deleted file mode 100644 index b9909fc4b..000000000 --- a/docs/output/Protocol.UndefinedError.html +++ /dev/null @@ -1,195 +0,0 @@ - - - - Protocol.UndefinedError - - - - - - - - - - - - -
    -

    - Protocol.UndefinedError - - exception - -

    - - - - Source - - - - -

    Fields (and defaults)

    -
      - -
    • - - protocol: nil - -
    • - -
    • - - structure: nil - -
    • - -
    - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - exception/1 -

    -
    - Source -
    -

    - exception/2 -

    -
    - Source -
    -

    - message/1 -

    -
    - Source -
    -

    - new/0 -

    -
    - Source -
    -

    - new/1 -

    -
    - Source -
    -

    - protocol/1 -

    -
    - Source -
    -

    - protocol/2 -

    -
    - Source -
    -

    - structure/1 -

    -
    - Source -
    -

    - structure/2 -

    -
    - Source -
    -

    - update_protocol/2 -

    -
    - Source -
    -

    - update_structure/2 -

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/Record.html b/docs/output/Record.html deleted file mode 100644 index e60e27bf8..000000000 --- a/docs/output/Record.html +++ /dev/null @@ -1,92 +0,0 @@ - - - - Record - - - - - - - - - - - - -
    -

    - Record - -

    - - -
    -

    Functions to define and interact with Erlang records

    - -
    - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - defrecord/3 -

    -

    Main entry point for records definition. -This is invoked directly by Elixir.Builtin.defrecord. -Returns the quoted expression of a module given by name.

    -
    - Source -
    -

    - extract/2 -

    -

    Extract record information from an Erlang file and -return the fields as a list of tuples.

    - -

    Examples

    - -
    defrecord FileInfo, Record.extract(:file_info, from_lib: "kernel/include/file.hrl")
    -
    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/Regex.html b/docs/output/Regex.html deleted file mode 100644 index 2862a2fe5..000000000 --- a/docs/output/Regex.html +++ /dev/null @@ -1,306 +0,0 @@ - - - - Regex - - - - - - - - - - - - -
    -

    - Regex - -

    - - -
    -

    Regular expressions for Elixir built on top of the re module -in the Erlang Standard Library. More information can be found -on re documentation: http://www.erlang.org/doc/man/re.html

    - -

    Regular expressions in Elixir can be created using Regex.compile -or using the special form with %r:

    - -
    # A simple regular expressions that matches foo anywhere in the string
    -%r/foo/
    -
    -# A regular expression with case insensitive options and handle unicode chars
    -%r/foo/iu
    -
    - -

    The re module provides several options, some of them are not -available in Elixir while others are enabled by default. The -ones enabled by default are:

    - -
      -
    • multiline - the given string is always considered to be multiline, so -^ and $ marks the beginning and end of each line. You need to use -\A and \z to match the end or beginning of the string
    • -
    - -

    The available options, followed by their shortcut in parenthesis, are:

    - -
      -
    • unicode (u) - used when you want to match against specific unicode characters
    • -
    • caseless (i) - add case insensitivity
    • -
    • dotall (m) - causes dot to match newlines and also set newline to anycrlf. -The new line setting can be overwritten by setting (*CR) or (*LF) or -(*CRLF) or (*ANY) according to re documentation
    • -
    • extended (x) - whitespace characters are ignored except when escaped and -allow # to delimit comments
    • -
    • firstline (f) - forces the unanchored pattern to match before or at the first -newline, though the matched text may continue over the newline
    • -
    • ungreedy (r) - invert the "greediness" of the regexp
    • -
    - -

    The options not available are:

    - -
      -
    • anchored - not available, use ^ or \A instead
    • -
    • dollar_endonly - not available, use \z instead
    • -
    • noautocapture - not available, use ?: instead
    • -
    • newline - not available, use (*CR) or (*LF) or (*CRLF) or (*ANYCRLF) -or (*ANY) at the beginning of the regexp according to the re documentation
    • -
    - -

    Most of the functions in this module accept either a binary or a char list -as string subject. The result is based on the argument (a binary will return -a binary, a char list will return a char list).

    - -
    - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - compile/2 -

    -

    Compile the regular expression according to the given options. -The result returned is a record named :re_pattern and its -length can be modified in future releases.

    - -

    Check the module documentation for more information -about the options supported by compile.

    -
    - Source -
    -

    - indexes/2 -

    -

    Returns a list with the match indexes in the given string. -The matches are tuples where the first element is the index -(zero indexed) the match happened and the second is the length -of the match.

    - -

    Examples

    - -
    Regex.run %r/c(d)/, "abcd"  #=> [{2,2},{3,1}]
    -Regex.run %r/e/, "abcd"     #=> nil
    -
    -
    - Source -
    -

    - match?/2 -

    -

    Returns a boolean if there was a match or not.

    - -

    Examples

    - -
    Regex.match? %r/foo/, "foo" #=> true
    -Regex.match? %r/foo/, "bar" #=> false
    -
    -
    - Source -
    -

    - opts/1 -

    -

    Returns the regex options as a list.

    - -

    Examples

    - -
    Regex.opts %r(foo)m #=> 'm'
    -
    -
    - Source -
    -

    - re_pattern/1 -

    -

    Returns the underlying re_pattern in the regular expression.

    -
    - Source -
    -

    - replace/3 -

    -

    Receives a string and a replacement and returns a string where the -first match of the regular expressions is replaced by replacement. -Inside the replacement, you can either give "&" to access the whole -regular expression or \N, where N is in integer to access an specific -matching parens.

    - -

    Examples

    - -
    Regex.replace(%r/d/, "abc", "d")       #=> "abc"
    -Regex.replace(%r/b/, "abc", "d")       #=> "adc"
    -Regex.replace(%r/b/, "abc", "[&]")     #=> "a[b]c"
    -Regex.replace(%r/b/, "abc", "[\\&]")   #=> "a[&]c"
    -Regex.replace(%r/(b)/, "abc", "[\\1]") #=> "a[b]c"
    -
    -
    - Source -
    -

    - replace_all/3 -

    -

    The same as replace, but replaces all parts where the regular -expressions matches in the string. Please read replace/3 for -documentation and examples.

    -
    - Source -
    -

    - run/2 -

    -

    Runs the regular expression against the given string. -It returns a list with all matches or nil if no match ocurred.

    - -

    Examples

    - -
    Regex.run %r/c(d)/, "abcd"  #=> ["cd", "d"]
    -Regex.run %r/e/, "abcd"     #=> nil
    -
    -
    - Source -
    -

    - scan/2 -

    -

    Same as run, but scans the target several times collecting all matches of -the regular expression. A list is returned with each match. If the item in -the list is a binary, it means there were no captures. If the item is another -list, each element in this secondary list is a capture.

    - -

    Examples

    - -
    Regex.scan %r/c(d|e)/, "abcd abce"   #=> [["d"], ["e"]]
    -Regex.scan %r/c(?:d|e)/, "abcd abce" #=> ["cd", "ce"]
    -Regex.scan %r/e/, "abcd"             #=> []
    -
    -
    - Source -
    -

    - source/1 -

    -

    Returns the regex source as binary.

    - -

    Examples

    - -
    Regex.source %r(foo) #=> "foo"
    -
    -
    - Source -
    -

    - split/3 -

    -

    Split the given target in the number of parts specified. If no ammount -of parts is given, it defaults to :infinity.

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/RuntimeError.html b/docs/output/RuntimeError.html deleted file mode 100644 index d5c04605a..000000000 --- a/docs/output/RuntimeError.html +++ /dev/null @@ -1,145 +0,0 @@ - - - - RuntimeError - - - - - - - - - - - - -
    -

    - RuntimeError - - exception - -

    - - - - Source - - - - -

    Fields (and defaults)

    -
      - -
    • - - message: "runtime error" - -
    • - -
    - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - exception/1 -

    -
    - Source -
    -

    - exception/2 -

    -
    - Source -
    -

    - message/1 -

    -
    - Source -
    -

    - message/2 -

    -
    - Source -
    -

    - new/0 -

    -
    - Source -
    -

    - new/1 -

    -
    - Source -
    -

    - update_message/2 -

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/SyntaxError.html b/docs/output/SyntaxError.html deleted file mode 100644 index d2f9acb93..000000000 --- a/docs/output/SyntaxError.html +++ /dev/null @@ -1,234 +0,0 @@ - - - - SyntaxError - - - - - - - - - - - - -
    -

    - SyntaxError - - exception - -

    - - - - Source - - - - -

    Fields (and defaults)

    -
      - -
    • - - description: "syntax error" - -
    • - -
    • - - file: nil - -
    • - -
    • - - line: nil - -
    • - -
    - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - description/1 -

    -
    - Source -
    -

    - description/2 -

    -
    - Source -
    -

    - exception/1 -

    -
    - Source -
    -

    - exception/2 -

    -
    - Source -
    -

    - file/1 -

    -
    - Source -
    -

    - file/2 -

    -
    - Source -
    -

    - line/1 -

    -
    - Source -
    -

    - line/2 -

    -
    - Source -
    -

    - message/1 -

    -
    - Source -
    -

    - new/0 -

    -
    - Source -
    -

    - new/1 -

    -
    - Source -
    -

    - update_description/2 -

    -
    - Source -
    -

    - update_file/2 -

    -
    - Source -
    -

    - update_line/2 -

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/System.html b/docs/output/System.html deleted file mode 100644 index 8bf5765ed..000000000 --- a/docs/output/System.html +++ /dev/null @@ -1,212 +0,0 @@ - - - - System - - - - - - - - - - - - -
    -

    - System - -

    - - -
    -

    The System module provides access to some variables used or -maintained by the VM and to functions that interact strongly -with the VM or the host system.

    - -
    - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - argv/0 -

    -

    Returns the list of command-line arguments passed to the program.

    -
    - Source -
    -

    - at_exit/1 -

    -

    Registers a function that will be invoked -at the end of program execution. Useful for -invoking a hook on scripted mode.

    - -

    The function must expect the exit status code -as argument.

    -
    - Source -
    -

    - build_info/0 -

    -

    Returns a tuple { Elixir version, commit sha-1, build date }.

    - -

    The format of the return value may change in a future release. Please -make sure your code doesn't depend on it.

    -
    - Source -
    -

    - cmd/1 -

    -

    Executes command in a command shell of the target OS, -captures the standard output of the command and returns -the result as a binary.

    -
    - Source -
    -

    - get_env/0 -

    -

    Returns a list of all environment variables. Each environment variable is -given as a single string of the format "VarName=Value", where VarName is the -name of the variable and Value its value.

    -
    - Source -
    -

    - get_env/1 -

    -

    Returns the value of the environment variable -varname as a binary, or nil if the environment -variable is undefined.

    -
    - Source -
    -

    - get_pid/0 -

    -

    Returns the process identifier of the current Erlang emulator -in the format most commonly used by the operating system environment.

    - -

    See http://www.erlang.org/doc/man/os.html#getpid-0 for more info.

    -
    - Source -
    -

    - put_env/1 -

    -

    Sets a new value for each environment variable corresponding -to each key in dict.

    -
    - Source -
    -

    - put_env/2 -

    -

    Sets a new value for the environment variable varname.

    -
    - Source -
    -

    - stacktrace/0 -

    -

    Get the stacktrace.

    -
    - Source -
    -

    - version/0 -

    -

    Returns Elixir's version as binary.

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/SystemLimitError.html b/docs/output/SystemLimitError.html deleted file mode 100644 index 4da9e541c..000000000 --- a/docs/output/SystemLimitError.html +++ /dev/null @@ -1,145 +0,0 @@ - - - - SystemLimitError - - - - - - - - - - - - -
    -

    - SystemLimitError - - exception - -

    - - - - Source - - - - -

    Fields (and defaults)

    -
      - -
    • - - message: "a system limit has been reached" - -
    • - -
    - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - exception/1 -

    -
    - Source -
    -

    - exception/2 -

    -
    - Source -
    -

    - message/1 -

    -
    - Source -
    -

    - message/2 -

    -
    - Source -
    -

    - new/0 -

    -
    - Source -
    -

    - new/1 -

    -
    - Source -
    -

    - update_message/2 -

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/TokenMissingError.html b/docs/output/TokenMissingError.html deleted file mode 100644 index 87010013b..000000000 --- a/docs/output/TokenMissingError.html +++ /dev/null @@ -1,234 +0,0 @@ - - - - TokenMissingError - - - - - - - - - - - - -
    -

    - TokenMissingError - - exception - -

    - - - - Source - - - - -

    Fields (and defaults)

    -
      - -
    • - - description: "expression is incomplete" - -
    • - -
    • - - file: nil - -
    • - -
    • - - line: nil - -
    • - -
    - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - description/1 -

    -
    - Source -
    -

    - description/2 -

    -
    - Source -
    -

    - exception/1 -

    -
    - Source -
    -

    - exception/2 -

    -
    - Source -
    -

    - file/1 -

    -
    - Source -
    -

    - file/2 -

    -
    - Source -
    -

    - line/1 -

    -
    - Source -
    -

    - line/2 -

    -
    - Source -
    -

    - message/1 -

    -
    - Source -
    -

    - new/0 -

    -
    - Source -
    -

    - new/1 -

    -
    - Source -
    -

    - update_description/2 -

    -
    - Source -
    -

    - update_file/2 -

    -
    - Source -
    -

    - update_line/2 -

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/Tuple.html b/docs/output/Tuple.html deleted file mode 100644 index 5ddc053c7..000000000 --- a/docs/output/Tuple.html +++ /dev/null @@ -1,68 +0,0 @@ - - - - Tuple - - - - - - - - - - - - -
    -

    - Tuple - -

    - - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - access/2 -

    -

    Simply invokes the Access protocol for the given tuple. -Check Access.Tuple for more information.

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/URI.FTP.html b/docs/output/URI.FTP.html deleted file mode 100644 index 7779101f1..000000000 --- a/docs/output/URI.FTP.html +++ /dev/null @@ -1,77 +0,0 @@ - - - - URI.FTP - - - - - - - - - - - - -
    -

    - URI.FTP - -

    - - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - default_port/0 -

    -
    - Source -
    -

    - parse/1 -

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/URI.HTTP.html b/docs/output/URI.HTTP.html deleted file mode 100644 index 604bbd044..000000000 --- a/docs/output/URI.HTTP.html +++ /dev/null @@ -1,77 +0,0 @@ - - - - URI.HTTP - - - - - - - - - - - - -
    -

    - URI.HTTP - -

    - - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - default_port/0 -

    -
    - Source -
    -

    - parse/1 -

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/URI.HTTPS.html b/docs/output/URI.HTTPS.html deleted file mode 100644 index 6ed5f4e30..000000000 --- a/docs/output/URI.HTTPS.html +++ /dev/null @@ -1,77 +0,0 @@ - - - - URI.HTTPS - - - - - - - - - - - - -
    -

    - URI.HTTPS - -

    - - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - default_port/0 -

    -
    - Source -
    -

    - parse/1 -

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/URI.LDAP.html b/docs/output/URI.LDAP.html deleted file mode 100644 index 50ae0cd61..000000000 --- a/docs/output/URI.LDAP.html +++ /dev/null @@ -1,77 +0,0 @@ - - - - URI.LDAP - - - - - - - - - - - - -
    -

    - URI.LDAP - -

    - - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - default_port/0 -

    -
    - Source -
    -

    - parse/1 -

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/URI.Parser.html b/docs/output/URI.Parser.html deleted file mode 100644 index 7d21b1d19..000000000 --- a/docs/output/URI.Parser.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - URI.Parser - - - - - - - - - - - - -
    -

    - URI.Parser - -

    - - -
    -

    Defines the behavior for each URI.Parser. -Check URI.HTTP for a possible implementation.

    - -
    - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - behaviour_info/1 -

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/URI.SFTP.html b/docs/output/URI.SFTP.html deleted file mode 100644 index 5370eea27..000000000 --- a/docs/output/URI.SFTP.html +++ /dev/null @@ -1,77 +0,0 @@ - - - - URI.SFTP - - - - - - - - - - - - -
    -

    - URI.SFTP - -

    - - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - default_port/0 -

    -
    - Source -
    -

    - parse/1 -

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/URI.TFTP.html b/docs/output/URI.TFTP.html deleted file mode 100644 index a871a4b97..000000000 --- a/docs/output/URI.TFTP.html +++ /dev/null @@ -1,77 +0,0 @@ - - - - URI.TFTP - - - - - - - - - - - - -
    -

    - URI.TFTP - -

    - - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - default_port/0 -

    -
    - Source -
    -

    - parse/1 -

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/URI.html b/docs/output/URI.html deleted file mode 100644 index cca33af49..000000000 --- a/docs/output/URI.html +++ /dev/null @@ -1,143 +0,0 @@ - - - - URI - - - - - - - - - - - - -
    -

    - URI - -

    - - -
    -

    Utilities for working with and creating URIs.

    - -
    - - - Source - - - - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - decode/1 -

    -

    Unpercent (URL) decodes a URI.

    -
    - Source -
    -

    - decode_query/2 -

    -

    Given a query string of the form "key1=value1&key=value2...", produces an -orddict with one entry for each key-value pair. Each key and value will be a -binary. It also does percent-unescaping of both keys and values.

    - -

    Returns nil if the query string is malformed.

    -
    - Source -
    -

    - encode/1 -

    -

    Percent (URL) encodes a URI.

    -
    - Source -
    -

    - encode_query/1 -

    -

    Takes an enumerable (containing a sequence of two-item tuples) -and returns a string of k=v&k2=v2... where keys and values are -URL encoded as per encode. Keys and values can be any term -that implements the Binary.Chars protocol (i.e. can be converted -to binary).

    -
    - Source -
    -

    - parse/1 -

    -

    Parses a URI into components.

    - -

    URIs have portions that are handled specially for the -particular scheme of the URI. For example, http and https -have different default ports. Sometimes the parsing -of portions themselves are different. This parser -is extensible via behavior modules. If you have a -module named URI.MYSCHEME with a function called -'parse' that takes a single argument, the generically -parsed URI, that function will be called when this -parse function is passed a URI of that scheme. This -allows you to build on top of what the URI library -currently offers. You also need to define default_port -which takes 0 arguments and returns the default port -for that particular scheme. Take a look at URI.HTTPS for an -example of one of these extension modules.

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/UndefinedFunctionError.html b/docs/output/UndefinedFunctionError.html deleted file mode 100644 index 5c910e281..000000000 --- a/docs/output/UndefinedFunctionError.html +++ /dev/null @@ -1,234 +0,0 @@ - - - - UndefinedFunctionError - - - - - - - - - - - - -
    -

    - UndefinedFunctionError - - exception - -

    - - - - Source - - - - -

    Fields (and defaults)

    -
      - -
    • - - arity: nil - -
    • - -
    • - - function: nil - -
    • - -
    • - - module: nil - -
    • - -
    - - - -

    Functions summary

    - - - - - - -
    -

    Functions

    -
    -

    - arity/1 -

    -
    - Source -
    -

    - arity/2 -

    -
    - Source -
    -

    - exception/1 -

    -
    - Source -
    -

    - exception/2 -

    -
    - Source -
    -

    - function/1 -

    -
    - Source -
    -

    - function/2 -

    -
    - Source -
    -

    - message/1 -

    -
    - Source -
    -

    - module/1 -

    -
    - Source -
    -

    - module/2 -

    -
    - Source -
    -

    - new/0 -

    -
    - Source -
    -

    - new/1 -

    -
    - Source -
    -

    - update_arity/2 -

    -
    - Source -
    -

    - update_function/2 -

    -
    - Source -
    -

    - update_module/2 -

    -
    - Source -
    -
    - - - -
    - - diff --git a/docs/output/css/full_list.css b/docs/output/css/full_list.css deleted file mode 100644 index d504c4bed..000000000 --- a/docs/output/css/full_list.css +++ /dev/null @@ -1,57 +0,0 @@ -body { - margin: 0; - font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif; - font-size: 13px; - height: 101%; - overflow-x: hidden; -} - -h1 { padding: 12px 10px; padding-bottom: 0; margin: 0; font-size: 1.4em; } -.clear { clear: both; } -#search { position: absolute; right: 5px; top: 9px; padding-left: 24px; } -#content.insearch #search, #content.insearch #noresults { background: url(data:image/gif;base64,R0lGODlhEAAQAPYAAP///wAAAPr6+pKSkoiIiO7u7sjIyNjY2J6engAAAI6OjsbGxjIyMlJSUuzs7KamppSUlPLy8oKCghwcHLKysqSkpJqamvT09Pj4+KioqM7OzkRERAwMDGBgYN7e3ujo6Ly8vCoqKjY2NkZGRtTU1MTExDw8PE5OTj4+PkhISNDQ0MrKylpaWrS0tOrq6nBwcKysrLi4uLq6ul5eXlxcXGJiYoaGhuDg4H5+fvz8/KKiohgYGCwsLFZWVgQEBFBQUMzMzDg4OFhYWBoaGvDw8NbW1pycnOLi4ubm5kBAQKqqqiQkJCAgIK6urnJyckpKSjQ0NGpqatLS0sDAwCYmJnx8fEJCQlRUVAoKCggICLCwsOTk5ExMTPb29ra2tmZmZmhoaNzc3KCgoBISEiIiIgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCAAAACwAAAAAEAAQAAAHaIAAgoMgIiYlg4kACxIaACEJCSiKggYMCRselwkpghGJBJEcFgsjJyoAGBmfggcNEx0flBiKDhQFlIoCCA+5lAORFb4AJIihCRbDxQAFChAXw9HSqb60iREZ1omqrIPdJCTe0SWI09GBACH5BAkIAAAALAAAAAAQABAAAAdrgACCgwc0NTeDiYozCQkvOTo9GTmDKy8aFy+NOBA7CTswgywJDTIuEjYFIY0JNYMtKTEFiRU8Pjwygy4ws4owPyCKwsMAJSTEgiQlgsbIAMrO0dKDGMTViREZ14kYGRGK38nHguHEJcvTyIEAIfkECQgAAAAsAAAAABAAEAAAB2iAAIKDAggPg4iJAAMJCRUAJRIqiRGCBI0WQEEJJkWDERkYAAUKEBc4Po1GiKKJHkJDNEeKig4URLS0ICImJZAkuQAhjSi/wQyNKcGDCyMnk8u5rYrTgqDVghgZlYjcACTA1sslvtHRgQAh+QQJCAAAACwAAAAAEAAQAAAHZ4AAgoOEhYaCJSWHgxGDJCQARAtOUoQRGRiFD0kJUYWZhUhKT1OLhR8wBaaFBzQ1NwAlkIszCQkvsbOHL7Y4q4IuEjaqq0ZQD5+GEEsJTDCMmIUhtgk1lo6QFUwJVDKLiYJNUd6/hoEAIfkECQgAAAAsAAAAABAAEAAAB2iAAIKDhIWGgiUlh4MRgyQkjIURGRiGGBmNhJWHm4uen4ICCA+IkIsDCQkVACWmhwSpFqAABQoQF6ALTkWFnYMrVlhWvIKTlSAiJiVVPqlGhJkhqShHV1lCW4cMqSkAR1ofiwsjJyqGgQAh+QQJCAAAACwAAAAAEAAQAAAHZ4AAgoOEhYaCJSWHgxGDJCSMhREZGIYYGY2ElYebi56fhyWQniSKAKKfpaCLFlAPhl0gXYNGEwkhGYREUywag1wJwSkHNDU3D0kJYIMZQwk8MjPBLx9eXwuETVEyAC/BOKsuEjYFhoEAIfkECQgAAAAsAAAAABAAEAAAB2eAAIKDhIWGgiUlh4MRgyQkjIURGRiGGBmNhJWHm4ueICImip6CIQkJKJ4kigynKaqKCyMnKqSEK05StgAGQRxPYZaENqccFgIID4KXmQBhXFkzDgOnFYLNgltaSAAEpxa7BQoQF4aBACH5BAkIAAAALAAAAAAQABAAAAdogACCg4SFggJiPUqCJSWGgkZjCUwZACQkgxGEXAmdT4UYGZqCGWQ+IjKGGIUwPzGPhAc0NTewhDOdL7Ykji+dOLuOLhI2BbaFETICx4MlQitdqoUsCQ2vhKGjglNfU0SWmILaj43M5oEAOwAAAAAAAAAAAA==) no-repeat center left; } -#full_list { padding: 0; list-style: none; margin-left: 0; } -#full_list ul { padding: 0; } -#full_list li { padding: 5px; padding-left: 12px; margin: 0; font-size: 1.1em; list-style: none; } -#noresults { padding: 7px 12px; } -#content.insearch #noresults { margin-left: 7px; } -ul.collapsed ul, ul.collapsed li { display: none; } -ul.collapsed.search_uncollapsed { display: block; } -ul.collapsed.search_uncollapsed li { display: list-item; } -li a.toggle { cursor: default; position: relative; left: -5px; top: 4px; text-indent: -999px; width: 10px; height: 9px; margin-left: -10px; display: block; float: left; background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAASCAYAAABb0P4QAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAK8AAACvABQqw0mAAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTM5jWRgMAAAAVdEVYdENyZWF0aW9uIFRpbWUAMy8xNC8wOeNZPpQAAAE2SURBVDiNrZTBccIwEEXfelIAHUA6CZ24BGaWO+FuzZAK4k6gg5QAdGAq+Bxs2Yqx7BzyL7Llp/VfzZeQhCTc/ezuGzKKnKSzpCxXJM8fwNXda3df5RZETlIt6YUzSQDs93sl8w3wBZxCCE10GM1OcWbWjB2mWgEH4Mfdyxm3PSepBHibgQE2wLe7r4HjEidpnXMYdQPKEMJcsZ4zs2POYQOcaPfwMVOo58zsAdMt18BuoVDPxUJRacELbXv3hUIX2vYmOUvi8C8ydz/ThjXrqKqqLbDIAdsCKBd+Wo7GWa7o9qzOQHVVVXeAbs+yHHCH4aTsaCOQqunmUy1yBUAXkdMIfMlgF5EXLo2OpV/c/Up7jG4hhHcYLgWzAZXUc2b2ixsfvc/RmNNfOXD3Q/oeL9axJE1yT9IOoUu6MGUkAAAAAElFTkSuQmCC) no-repeat bottom left; } -li.collapsed a.toggle { opacity: 0.5; cursor: default; background-position: top left; } -li { color: #888; cursor: pointer; } -li.deprecated { text-decoration: line-through; font-style: italic; } -li.r1 { background: #f0f0f0; } -li.r2 { background: #fafafa; } -li:hover { background: #ddd; } -li small:before { content: "("; } -li small:after { content: ")"; } -li small.search_info { display: none; } -a:link, a:visited { text-decoration: none; color: #05a; } -li.clicked { background: #05a; color: #ccc; } -li.clicked a:link, li.clicked a:visited { color: #eee; } -li.clicked a.toggle { opacity: 0.5; background-position: bottom right; } -li.collapsed.clicked a.toggle { background-position: top right; } -#nav { margin: 5px 0 10px 5px; font-size: 0.9em; display: none; color: #aaa; } -#nav a:link, #nav a:visited { color: #358; } -#nav a:hover { background: transparent; color: #5af; } -#nav span { border-left: 1px solid #ccc; padding: 0 5px; display: block; float: left } -#nav span:first-child { border-left: 0; border-radius: 3px; } -#nav span.selected { text-decoration: underline; } - -.frames #content h1 { margin-top: 0; } -.frames li { white-space: nowrap; cursor: normal; } -.frames li small { display: block; font-size: 0.8em; } -.frames li small:before { content: ""; } -.frames li small:after { content: ""; } -.frames li small.search_info { display: none; } -.frames #search { width: 170px; position: static; margin: 3px; margin-left: 10px; font-size: 0.9em; color: #888; padding-left: 0; padding-right: 24px; } -.frames #content.insearch #search { background-position: center right; } -.frames #search input { width: 110px; } -.frames #nav { display: block; } - -#full_list.insearch li { display: none; } -#full_list.insearch li.found { display: list-item; padding-left: 10px; } -#full_list.insearch li a.toggle { display: none; } -#full_list.insearch li small.search_info { display: block; } diff --git a/docs/output/css/style.css b/docs/output/css/style.css deleted file mode 100644 index 1a845c355..000000000 --- a/docs/output/css/style.css +++ /dev/null @@ -1,131 +0,0 @@ -body { - padding: 0 20px; - font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif; - font-size: 13px; -} - -body.frames { padding: 0 5px; } - -h1 { font-size: 25px; border-top: 0px; margin-top: 0; padding-top: 4px; } -h1 small { color: #888; font-size: 18px } - -h2 { - padding: 0; - padding-bottom: 3px; - border-bottom: 1px #aaa solid; - font-size: 1.4em; - margin: 1.8em 0 0.5em; -} - -.clear { clear: both; } - -li.r1 { background: #f0f0f0; } -li.r2 { background: #fafafa; } - -div.docstring, p.docstring { margin-right: 6em; } -.docstring h1, .docstring h2, .docstring h3, .docstring h4 { padding: 0; border: 0; border-bottom: 0; } -.docstring h1 { font-size: 1.2em; } -.docstring h2 { font-size: 1.1em; } -.docstring h3, .docstring h4 { font-size: 1em; padding-top: 10px; } -.docstring pre { - padding: 0.5em; - border: #ffe0bb dotted 1px; - background: #fffde8; -} - -p.signature { - font-size: 1.1em; font-weight: normal; font-family: Monaco, Consolas, Courier, monospace; - padding: 6px 10px; margin-top: 18px; - background: #e5e8ff; border: 1px solid #d8d8e5; -moz-border-radius: 3px; -webkit-border-radius: 3px; -} - -a:link, a:visited { text-decoration: none; color: #05a; } -a:hover { color: #27c; } - -.detail { border-top: 1px dotted #aaa; margin-top: 15px; padding-top: 0; } -.detail:nth-child(2) { border: 0; } - -/* Summary */ -ul.summary { - list-style: none; - font-family: monospace; - font-size: 1em; - line-height: 1.5em; - margin: 0; - padding: 0; -} -ul.summary li { display: inline-block; margin: 0px 5px 0px 0px; line-height: 2.6em;} -ul.summary a:link, ul.summary a:visited { - text-decoration: none; font-size: 1.1em; -} -ul.summary .summary_signature { - padding: 5px 7px; padding-right: 4px; - background: #eaeaff; border: 1px solid #dfdfe5; - -moz-border-radius: 3px; -webkit-border-radius: 3px; -} -ul.summary .summary_signature:hover { background: #eeeeff; cursor: pointer; } - -/* File contents */ -#filecontents li > p, .docstring li > p { margin: 0px; } -#filecontents ul, .docstring ul { padding-left: 20px; } - -#filecontents dl, .docstring dl { border: 1px solid #ccc; } -#filecontents dt, .docstring dt { background: #ddd; font-weight: bold; padding: 3px 5px; } -#filecontents dd, .docstring dd { padding: 5px 0px; margin-left: 18px; } -#filecontents dd > p, .docstring dd > p { margin: 0px; } -#filecontents dl.box, dl.box { - border: 0; - width: 520px; - font-size: 1em; -} -#filecontents dl.box dt, dl.box dt { - float: left; - display: block; - width: 100px; - margin: 0; - text-align: right; - font-weight: bold; - background: transparent; - border: 1px solid #aaa; - border-width: 1px 0px 0px 1px; - padding: 6px 0; - padding-right: 10px; -} -#filecontents dl.box dd, dl.box dd { - float: left; - display: block; - width: 380px; - margin: 0; - padding: 6px 0; - padding-right: 20px; - border: 1px solid #aaa; - border-width: 1px 1px 0 0; -} -#filecontents dl.box .last, dl.box .last { - border-bottom: 1px solid #aaa; -} -#filecontents dl.box .r1, dl.box .r1 { background: #eee; } - -/* Footer */ -#footer { margin-top: 15px; border-top: 1px solid #ccc; text-align: center; padding: 7px 0; color: #999; } - -/* TOC */ -#toc { - padding: 20px; padding-right: 30px; border: 1px solid #ddd; float: right; background: #fff; margin-left: 20px; margin-bottom: 20px; - max-width: 300px; - -webkit-box-shadow: -2px 2px 6px #bbb; - -moz-box-shadow: -2px 2px 6px #bbb; - z-index: 5000; - position: relative; -} -#toc.nofloat { float: none; max-width: none; border: none; padding: 0; margin: 20px 0; -webkit-box-shadow: none; -moz-box-shadow: none; } -#toc.nofloat.hidden { padding: 0; background: 0; margin-bottom: 5px; } -#toc .title { margin: 0; } -#toc ol { padding-left: 1.8em; } -#toc li { font-size: 1.1em; line-height: 1.7em; } -#toc > ol > li { font-size: 1.1em; font-weight: bold; } -#toc ol > ol { font-size: 0.9em; } -#toc ol ol > ol { padding-left: 2.3em; } -#toc ol + li { margin-top: 0.3em; } -#toc.hidden { padding: 10px; background: #f6f6f6; -webkit-box-shadow: none; -moz-box-shadow: none; } -#filecontents h1 + #toc.nofloat { margin-top: 0; } \ No newline at end of file diff --git a/docs/output/index.html b/docs/output/index.html deleted file mode 100644 index f8249b1aa..000000000 --- a/docs/output/index.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - Documentation - - - - - - \ No newline at end of file diff --git a/docs/output/js/app.js b/docs/output/js/app.js deleted file mode 100644 index adfc739f7..000000000 --- a/docs/output/js/app.js +++ /dev/null @@ -1,61 +0,0 @@ -function fixOutsideWorldLinks() { - $('a').each(function() { - if (window.location.host != this.host) this.target = '_parent'; - }); -} - -function generateTOC() { - if ($('#filecontents').length === 0) return; - var _toc = $('
      '); - var show = false; - var toc = _toc; - var counter = 0; - var tags = ['h2', 'h3', 'h4', 'h5', 'h6']; - var i; - if ($('#filecontents h1').length > 1) tags.unshift('h1'); - for (i = 0; i < tags.length; i++) { tags[i] = '#filecontents ' + tags[i]; } - var lastTag = parseInt(tags[0][1], 10); - $(tags.join(', ')).each(function() { - if (this.id == "filecontents") return; - show = true; - var thisTag = parseInt(this.tagName[1], 10); - if (this.id.length === 0) { - var proposedId = $(this).text().replace(/[^a-z0-9-]/ig, '_'); - if ($('#' + proposedId).length > 0) { proposedId += counter; counter++; } - this.id = proposedId; - } - if (thisTag > lastTag) { - for (i = 0; i < thisTag - lastTag; i++) { - var tmp = $('
        '); toc.append(tmp); toc = tmp; - } - } - if (thisTag < lastTag) { - for (i = 0; i < lastTag - thisTag; i++) toc = toc.parent(); - } - toc.append('
      1. ' + $(this).text() + '
      2. '); - lastTag = thisTag; - }); - if (!show) return; - html = ''; - $('#content').prepend(html); - $('#toc').append(_toc); - $('#toc .hide_toc').toggle(function() { - $('#toc .top').slideUp('fast'); - $('#toc').toggleClass('hidden'); - $('#toc .title small').toggle(); - }, function() { - $('#toc .top').slideDown('fast'); - $('#toc').toggleClass('hidden'); - $('#toc .title small').toggle(); - }); - $('#toc .float_toc').toggle(function() { - $(this).text('float'); - $('#toc').toggleClass('nofloat'); - }, function() { - $(this).text('left'); - $('#toc').toggleClass('nofloat'); - }); -} - -$(fixOutsideWorldLinks); -$(generateTOC); \ No newline at end of file diff --git a/docs/output/js/full_list.js b/docs/output/js/full_list.js deleted file mode 100644 index 786876676..000000000 --- a/docs/output/js/full_list.js +++ /dev/null @@ -1,172 +0,0 @@ -var inSearch = null; -var searchIndex = 0; -var searchCache = []; -var searchString = ''; -var regexSearchString = ''; -var caseSensitiveMatch = false; -var ignoreKeyCodeMin = 8; -var ignoreKeyCodeMax = 46; -var commandKey = 91; - -RegExp.escape = function(text) { - return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); -} - -function fullListSearch() { - // generate cache - searchCache = []; - $('#full_list li').each(function() { - var link = $(this).find('.object_link a'); - var fullName = link.attr('title').split(' ')[0]; - searchCache.push({name:link.text(), fullName:fullName, node:$(this), link:link}); - }); - - $('#search input').keyup(function() { - if ((event.keyCode > ignoreKeyCodeMin && event.keyCode < ignoreKeyCodeMax) - || event.keyCode == commandKey) - return; - searchString = this.value; - caseSensitiveMatch = searchString.match(/[A-Z]/) != null; - regexSearchString = RegExp.escape(searchString); - if (caseSensitiveMatch) { - regexSearchString += "|" + - $.map(searchString.split(''), function(e) { return RegExp.escape(e); }). - join('.+?'); - } - if (searchString === "") { - clearTimeout(inSearch); - inSearch = null; - $('ul .search_uncollapsed').removeClass('search_uncollapsed'); - $('#full_list, #content').removeClass('insearch'); - $('#full_list li').removeClass('found').each(function() { - var link = $(this).find('.object_link a'); - link.text(link.text()); - }); - if (clicked) { - clicked.parents('ul').each(function() { - $(this).removeClass('collapsed').prev().removeClass('collapsed'); - }); - } - highlight(); - } - else { - if (inSearch) clearTimeout(inSearch); - searchIndex = 0; - lastRowClass = ''; - $('#full_list, #content').addClass('insearch'); - $('#noresults').text(''); - searchItem(); - } - }); - - $('#search input').focus(); - $('#full_list').after("
        "); -} - -var lastRowClass = ''; -function searchItem() { - for (var i = 0; i < searchCache.length / 50; i++) { - var item = searchCache[searchIndex]; - var searchName = (searchString.indexOf('::') != -1 ? item.fullName : item.name); - var matchString = regexSearchString; - var matchRegexp = new RegExp(matchString, caseSensitiveMatch ? "" : "i"); - if (searchName.match(matchRegexp) == null) { - item.node.removeClass('found'); - } - else { - item.node.css('padding-left', '10px').addClass('found'); - item.node.parents().addClass('search_uncollapsed'); - item.node.removeClass(lastRowClass).addClass(lastRowClass == 'r1' ? 'r2' : 'r1'); - lastRowClass = item.node.hasClass('r1') ? 'r1' : 'r2'; - item.link.html(item.name.replace(matchRegexp, "$&")); - } - - if (searchCache.length === searchIndex + 1) { - searchDone(); - return; - } - else { - searchIndex++; - } - } - inSearch = setTimeout('searchItem()', 0); -} - -function searchDone() { - highlight(true); - if ($('#full_list li:visible').size() === 0) { - $('#noresults').text('No results were found.').hide().fadeIn(); - } - else { - $('#noresults').text(''); - } - $('#content').removeClass('insearch'); - clearTimeout(inSearch); - inSearch = null; -} - -clicked = null; -function linkList() { - $('#full_list li, #full_list li a:last').click(function(evt) { - if ($(this).hasClass('toggle')) return true; - if (this.tagName.toLowerCase() == "li") { - var toggle = $(this).children('a.toggle'); - if (toggle.size() > 0 && evt.pageX < toggle.offset().left) { - toggle.click(); - return false; - } - } - if (clicked) clicked.removeClass('clicked'); - var win = window.top.frames.main ? window.top.frames.main : window.parent; - if (this.tagName.toLowerCase() == "a") { - clicked = $(this).parent('li').addClass('clicked'); - win.location = this.href; - } - else { - clicked = $(this).addClass('clicked'); - win.location = $(this).find('a:last').attr('href'); - } - return false; - }); -} - -function collapse() { - if (!$('#full_list').hasClass('class')) return; - $('#full_list.class a.toggle').click(function() { - $(this).parent().toggleClass('collapsed').next().toggleClass('collapsed'); - highlight(); - return false; - }); - $('#full_list.class ul').each(function() { - $(this).addClass('collapsed').prev().addClass('collapsed'); - }); - // $('#full_list.class').children().removeClass('collapsed'); - highlight(); -} - -function highlight(no_padding) { - var n = 1; - $('#full_list li:visible').each(function() { - var next = n == 1 ? 2 : 1; - $(this).removeClass("r" + next).addClass("r" + n); - if (!no_padding && $('#full_list').hasClass('class')) { - $(this).css('padding-left', (10 + $(this).parents('ul').size() * 15) + 'px'); - } - n = next; - }); -} - -function escapeShortcut() { - $(document).keydown(function(evt) { - if (evt.which == 27) { - $('#search_frame', window.top.document).slideUp(100); - $('#search a', window.top.document).removeClass('active inactive'); - $(window.top).focus(); - } - }); -} - -$(escapeShortcut); -$(fullListSearch); -$(linkList); -$(collapse); diff --git a/docs/output/js/jquery.js b/docs/output/js/jquery.js deleted file mode 100644 index f78f96a12..000000000 --- a/docs/output/js/jquery.js +++ /dev/null @@ -1,16 +0,0 @@ -/*! - * jQuery JavaScript Library v1.5.2 - * http://jquery.com/ - * - * Copyright 2011, John Resig - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * Includes Sizzle.js - * http://sizzlejs.com/ - * Copyright 2011, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * - * Date: Thu Mar 31 15:28:23 2011 -0400 - */ -(function(a,b){function ci(a){return d.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cf(a){if(!b_[a]){var b=d("<"+a+">").appendTo("body"),c=b.css("display");b.remove();if(c==="none"||c==="")c="block";b_[a]=c}return b_[a]}function ce(a,b){var c={};d.each(cd.concat.apply([],cd.slice(0,b)),function(){c[this]=a});return c}function b$(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function bZ(){try{return new a.XMLHttpRequest}catch(b){}}function bY(){d(a).unload(function(){for(var a in bW)bW[a](0,1)})}function bS(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var e=a.dataTypes,f={},g,h,i=e.length,j,k=e[0],l,m,n,o,p;for(g=1;g=0===c})}function P(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function H(a,b){return(a&&a!=="*"?a+".":"")+b.replace(t,"`").replace(u,"&")}function G(a){var b,c,e,f,g,h,i,j,k,l,m,n,o,p=[],q=[],s=d._data(this,"events");if(a.liveFired!==this&&s&&s.live&&!a.target.disabled&&(!a.button||a.type!=="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var t=s.live.slice(0);for(i=0;ic)break;a.currentTarget=f.elem,a.data=f.handleObj.data,a.handleObj=f.handleObj,o=f.handleObj.origHandler.apply(f.elem,arguments);if(o===!1||a.isPropagationStopped()){c=f.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function E(a,c,e){var f=d.extend({},e[0]);f.type=a,f.originalEvent={},f.liveFired=b,d.event.handle.call(c,f),f.isDefaultPrevented()&&e[0].preventDefault()}function y(){return!0}function x(){return!1}function i(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function h(a,c,e){if(e===b&&a.nodeType===1){e=a.getAttribute("data-"+c);if(typeof e==="string"){try{e=e==="true"?!0:e==="false"?!1:e==="null"?null:d.isNaN(e)?g.test(e)?d.parseJSON(e):e:parseFloat(e)}catch(f){}d.data(a,c,e)}else e=b}return e}var c=a.document,d=function(){function G(){if(!d.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(G,1);return}d.ready()}}var d=function(a,b){return new d.fn.init(a,b,g)},e=a.jQuery,f=a.$,g,h=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,i=/\S/,j=/^\s+/,k=/\s+$/,l=/\d/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=navigator.userAgent,w,x,y,z=Object.prototype.toString,A=Object.prototype.hasOwnProperty,B=Array.prototype.push,C=Array.prototype.slice,D=String.prototype.trim,E=Array.prototype.indexOf,F={};d.fn=d.prototype={constructor:d,init:function(a,e,f){var g,i,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!e&&c.body){this.context=c,this[0]=c.body,this.selector="body",this.length=1;return this}if(typeof a==="string"){g=h.exec(a);if(!g||!g[1]&&e)return!e||e.jquery?(e||f).find(a):this.constructor(e).find(a);if(g[1]){e=e instanceof d?e[0]:e,k=e?e.ownerDocument||e:c,j=m.exec(a),j?d.isPlainObject(e)?(a=[c.createElement(j[1])],d.fn.attr.call(a,e,!0)):a=[k.createElement(j[1])]:(j=d.buildFragment([g[1]],[k]),a=(j.cacheable?d.clone(j.fragment):j.fragment).childNodes);return d.merge(this,a)}i=c.getElementById(g[2]);if(i&&i.parentNode){if(i.id!==g[2])return f.find(a);this.length=1,this[0]=i}this.context=c,this.selector=a;return this}if(d.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return d.makeArray(a,this)},selector:"",jquery:"1.5.2",length:0,size:function(){return this.length},toArray:function(){return C.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var e=this.constructor();d.isArray(a)?B.apply(e,a):d.merge(e,a),e.prevObject=this,e.context=this.context,b==="find"?e.selector=this.selector+(this.selector?" ":"")+c:b&&(e.selector=this.selector+"."+b+"("+c+")");return e},each:function(a,b){return d.each(this,a,b)},ready:function(a){d.bindReady(),x.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(C.apply(this,arguments),"slice",C.call(arguments).join(","))},map:function(a){return this.pushStack(d.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:B,sort:[].sort,splice:[].splice},d.fn.init.prototype=d.fn,d.extend=d.fn.extend=function(){var a,c,e,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i==="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!=="object"&&!d.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;x.resolveWith(c,[d]),d.fn.trigger&&d(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!x){x=d._Deferred();if(c.readyState==="complete")return setTimeout(d.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",y,!1),a.addEventListener("load",d.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",y),a.attachEvent("onload",d.ready);var b=!1;try{b=a.frameElement==null}catch(e){}c.documentElement.doScroll&&b&&G()}}},isFunction:function(a){return d.type(a)==="function"},isArray:Array.isArray||function(a){return d.type(a)==="array"},isWindow:function(a){return a&&typeof a==="object"&&"setInterval"in a},isNaN:function(a){return a==null||!l.test(a)||isNaN(a)},type:function(a){return a==null?String(a):F[z.call(a)]||"object"},isPlainObject:function(a){if(!a||d.type(a)!=="object"||a.nodeType||d.isWindow(a))return!1;if(a.constructor&&!A.call(a,"constructor")&&!A.call(a.constructor.prototype,"isPrototypeOf"))return!1;var c;for(c in a){}return c===b||A.call(a,c)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!=="string"||!b)return null;b=d.trim(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return a.JSON&&a.JSON.parse?a.JSON.parse(b):(new Function("return "+b))();d.error("Invalid JSON: "+b)},parseXML:function(b,c,e){a.DOMParser?(e=new DOMParser,c=e.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b)),e=c.documentElement,(!e||!e.nodeName||e.nodeName==="parsererror")&&d.error("Invalid XML: "+b);return c},noop:function(){},globalEval:function(a){if(a&&i.test(a)){var b=c.head||c.getElementsByTagName("head")[0]||c.documentElement,e=c.createElement("script");d.support.scriptEval()?e.appendChild(c.createTextNode(a)):e.text=a,b.insertBefore(e,b.firstChild),b.removeChild(e)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,e){var f,g=0,h=a.length,i=h===b||d.isFunction(a);if(e){if(i){for(f in a)if(c.apply(a[f],e)===!1)break}else for(;g1?f.call(arguments,0):c,--g||h.resolveWith(h,f.call(b,0))}}var b=arguments,c=0,e=b.length,g=e,h=e<=1&&a&&d.isFunction(a.promise)?a:d.Deferred();if(e>1){for(;c
        a";var e=b.getElementsByTagName("*"),f=b.getElementsByTagName("a")[0],g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=b.getElementsByTagName("input")[0];if(e&&e.length&&f){d.support={leadingWhitespace:b.firstChild.nodeType===3,tbody:!b.getElementsByTagName("tbody").length,htmlSerialize:!!b.getElementsByTagName("link").length,style:/red/.test(f.getAttribute("style")),hrefNormalized:f.getAttribute("href")==="/a",opacity:/^0.55$/.test(f.style.opacity),cssFloat:!!f.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,deleteExpando:!0,optDisabled:!1,checkClone:!1,noCloneEvent:!0,noCloneChecked:!0,boxModel:null,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableHiddenOffsets:!0,reliableMarginRight:!0},i.checked=!0,d.support.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,d.support.optDisabled=!h.disabled;var j=null;d.support.scriptEval=function(){if(j===null){var b=c.documentElement,e=c.createElement("script"),f="script"+d.now();try{e.appendChild(c.createTextNode("window."+f+"=1;"))}catch(g){}b.insertBefore(e,b.firstChild),a[f]?(j=!0,delete a[f]):j=!1,b.removeChild(e)}return j};try{delete b.test}catch(k){d.support.deleteExpando=!1}!b.addEventListener&&b.attachEvent&&b.fireEvent&&(b.attachEvent("onclick",function l(){d.support.noCloneEvent=!1,b.detachEvent("onclick",l)}),b.cloneNode(!0).fireEvent("onclick")),b=c.createElement("div"),b.innerHTML="";var m=c.createDocumentFragment();m.appendChild(b.firstChild),d.support.checkClone=m.cloneNode(!0).cloneNode(!0).lastChild.checked,d(function(){var a=c.createElement("div"),b=c.getElementsByTagName("body")[0];if(b){a.style.width=a.style.paddingLeft="1px",b.appendChild(a),d.boxModel=d.support.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,d.support.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="
        ",d.support.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="
        t
        ";var e=a.getElementsByTagName("td");d.support.reliableHiddenOffsets=e[0].offsetHeight===0,e[0].style.display="",e[1].style.display="none",d.support.reliableHiddenOffsets=d.support.reliableHiddenOffsets&&e[0].offsetHeight===0,a.innerHTML="",c.defaultView&&c.defaultView.getComputedStyle&&(a.style.width="1px",a.style.marginRight="0",d.support.reliableMarginRight=(parseInt(c.defaultView.getComputedStyle(a,null).marginRight,10)||0)===0),b.removeChild(a).style.display="none",a=e=null}});var n=function(a){var b=c.createElement("div");a="on"+a;if(!b.attachEvent)return!0;var d=a in b;d||(b.setAttribute(a,"return;"),d=typeof b[a]==="function");return d};d.support.submitBubbles=n("submit"),d.support.changeBubbles=n("change"),b=e=f=null}}();var g=/^(?:\{.*\}|\[.*\])$/;d.extend({cache:{},uuid:0,expando:"jQuery"+(d.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?d.cache[a[d.expando]]:a[d.expando];return!!a&&!i(a)},data:function(a,c,e,f){if(d.acceptData(a)){var g=d.expando,h=typeof c==="string",i,j=a.nodeType,k=j?d.cache:a,l=j?a[d.expando]:a[d.expando]&&d.expando;if((!l||f&&l&&!k[l][g])&&h&&e===b)return;l||(j?a[d.expando]=l=++d.uuid:l=d.expando),k[l]||(k[l]={},j||(k[l].toJSON=d.noop));if(typeof c==="object"||typeof c==="function")f?k[l][g]=d.extend(k[l][g],c):k[l]=d.extend(k[l],c);i=k[l],f&&(i[g]||(i[g]={}),i=i[g]),e!==b&&(i[c]=e);if(c==="events"&&!i[c])return i[g]&&i[g].events;return h?i[c]:i}},removeData:function(b,c,e){if(d.acceptData(b)){var f=d.expando,g=b.nodeType,h=g?d.cache:b,j=g?b[d.expando]:d.expando;if(!h[j])return;if(c){var k=e?h[j][f]:h[j];if(k){delete k[c];if(!i(k))return}}if(e){delete h[j][f];if(!i(h[j]))return}var l=h[j][f];d.support.deleteExpando||h!=a?delete h[j]:h[j]=null,l?(h[j]={},g||(h[j].toJSON=d.noop),h[j][f]=l):g&&(d.support.deleteExpando?delete b[d.expando]:b.removeAttribute?b.removeAttribute(d.expando):b[d.expando]=null)}},_data:function(a,b,c){return d.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=d.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),d.fn.extend({data:function(a,c){var e=null;if(typeof a==="undefined"){if(this.length){e=d.data(this[0]);if(this[0].nodeType===1){var f=this[0].attributes,g;for(var i=0,j=f.length;i-1)return!0;return!1},val:function(a){if(!arguments.length){var c=this[0];if(c){if(d.nodeName(c,"option")){var e=c.attributes.value;return!e||e.specified?c.value:c.text}if(d.nodeName(c,"select")){var f=c.selectedIndex,g=[],h=c.options,i=c.type==="select-one";if(f<0)return null;for(var j=i?f:0,k=i?f+1:h.length;j=0;else if(d.nodeName(this,"select")){var f=d.makeArray(e);d("option",this).each(function(){this.selected=d.inArray(d(this).val(),f)>=0}),f.length||(this.selectedIndex=-1)}else this.value=e}})}}),d.extend({attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,e,f){if(!a||a.nodeType===3||a.nodeType===8||a.nodeType===2)return b;if(f&&c in d.attrFn)return d(a)[c](e);var g=a.nodeType!==1||!d.isXMLDoc(a),h=e!==b;c=g&&d.props[c]||c;if(a.nodeType===1){var i=m.test(c);if(c==="selected"&&!d.support.optSelected){var j=a.parentNode;j&&(j.selectedIndex,j.parentNode&&j.parentNode.selectedIndex)}if((c in a||a[c]!==b)&&g&&!i){h&&(c==="type"&&n.test(a.nodeName)&&a.parentNode&&d.error("type property can't be changed"),e===null?a.nodeType===1&&a.removeAttribute(c):a[c]=e);if(d.nodeName(a,"form")&&a.getAttributeNode(c))return a.getAttributeNode(c).nodeValue;if(c==="tabIndex"){var k=a.getAttributeNode("tabIndex");return k&&k.specified?k.value:o.test(a.nodeName)||p.test(a.nodeName)&&a.href?0:b}return a[c]}if(!d.support.style&&g&&c==="style"){h&&(a.style.cssText=""+e);return a.style.cssText}h&&a.setAttribute(c,""+e);if(!a.attributes[c]&&(a.hasAttribute&&!a.hasAttribute(c)))return b;var l=!d.support.hrefNormalized&&g&&i?a.getAttribute(c,2):a.getAttribute(c);return l===null?b:l}h&&(a[c]=e);return a[c]}});var r=/\.(.*)$/,s=/^(?:textarea|input|select)$/i,t=/\./g,u=/ /g,v=/[^\w\s.|`]/g,w=function(a){return a.replace(v,"\\$&")};d.event={add:function(c,e,f,g){if(c.nodeType!==3&&c.nodeType!==8){try{d.isWindow(c)&&(c!==a&&!c.frameElement)&&(c=a)}catch(h){}if(f===!1)f=x;else if(!f)return;var i,j;f.handler&&(i=f,f=i.handler),f.guid||(f.guid=d.guid++);var k=d._data(c);if(!k)return;var l=k.events,m=k.handle;l||(k.events=l={}),m||(k.handle=m=function(a){return typeof d!=="undefined"&&d.event.triggered!==a.type?d.event.handle.apply(m.elem,arguments):b}),m.elem=c,e=e.split(" ");var n,o=0,p;while(n=e[o++]){j=i?d.extend({},i):{handler:f,data:g},n.indexOf(".")>-1?(p=n.split("."),n=p.shift(),j.namespace=p.slice(0).sort().join(".")):(p=[],j.namespace=""),j.type=n,j.guid||(j.guid=f.guid);var q=l[n],r=d.event.special[n]||{};if(!q){q=l[n]=[];if(!r.setup||r.setup.call(c,g,p,m)===!1)c.addEventListener?c.addEventListener(n,m,!1):c.attachEvent&&c.attachEvent("on"+n,m)}r.add&&(r.add.call(c,j),j.handler.guid||(j.handler.guid=f.guid)),q.push(j),d.event.global[n]=!0}c=null}},global:{},remove:function(a,c,e,f){if(a.nodeType!==3&&a.nodeType!==8){e===!1&&(e=x);var g,h,i,j,k=0,l,m,n,o,p,q,r,s=d.hasData(a)&&d._data(a),t=s&&s.events;if(!s||!t)return;c&&c.type&&(e=c.handler,c=c.type);if(!c||typeof c==="string"&&c.charAt(0)==="."){c=c||"";for(h in t)d.event.remove(a,h+c);return}c=c.split(" ");while(h=c[k++]){r=h,q=null,l=h.indexOf(".")<0,m=[],l||(m=h.split("."),h=m.shift(),n=new RegExp("(^|\\.)"+d.map(m.slice(0).sort(),w).join("\\.(?:.*\\.)?")+"(\\.|$)")),p=t[h];if(!p)continue;if(!e){for(j=0;j=0&&(a.type=f=f.slice(0,-1),a.exclusive=!0),e||(a.stopPropagation(),d.event.global[f]&&d.each(d.cache,function(){var b=d.expando,e=this[b];e&&e.events&&e.events[f]&&d.event.trigger(a,c,e.handle.elem)}));if(!e||e.nodeType===3||e.nodeType===8)return b;a.result=b,a.target=e,c=d.makeArray(c),c.unshift(a)}a.currentTarget=e;var h=d._data(e,"handle");h&&h.apply(e,c);var i=e.parentNode||e.ownerDocument;try{e&&e.nodeName&&d.noData[e.nodeName.toLowerCase()]||e["on"+f]&&e["on"+f].apply(e,c)===!1&&(a.result=!1,a.preventDefault())}catch(j){}if(!a.isPropagationStopped()&&i)d.event.trigger(a,c,i,!0);else if(!a.isDefaultPrevented()){var k,l=a.target,m=f.replace(r,""),n=d.nodeName(l,"a")&&m==="click",o=d.event.special[m]||{};if((!o._default||o._default.call(e,a)===!1)&&!n&&!(l&&l.nodeName&&d.noData[l.nodeName.toLowerCase()])){try{l[m]&&(k=l["on"+m],k&&(l["on"+m]=null),d.event.triggered=a.type,l[m]())}catch(p){}k&&(l["on"+m]=k),d.event.triggered=b}}},handle:function(c){var e,f,g,h,i,j=[],k=d.makeArray(arguments);c=k[0]=d.event.fix(c||a.event),c.currentTarget=this,e=c.type.indexOf(".")<0&&!c.exclusive,e||(g=c.type.split("."),c.type=g.shift(),j=g.slice(0).sort(),h=new RegExp("(^|\\.)"+j.join("\\.(?:.*\\.)?")+"(\\.|$)")),c.namespace=c.namespace||j.join("."),i=d._data(this,"events"),f=(i||{})[c.type];if(i&&f){f=f.slice(0);for(var l=0,m=f.length;l-1?d.map(a.options,function(a){return a.selected}).join("-"):"":a.nodeName.toLowerCase()==="select"&&(c=a.selectedIndex);return c},D=function D(a){var c=a.target,e,f;if(s.test(c.nodeName)&&!c.readOnly){e=d._data(c,"_change_data"),f=C(c),(a.type!=="focusout"||c.type!=="radio")&&d._data(c,"_change_data",f);if(e===b||f===e)return;if(e!=null||f)a.type="change",a.liveFired=b,d.event.trigger(a,arguments[1],c)}};d.event.special.change={filters:{focusout:D,beforedeactivate:D,click:function(a){var b=a.target,c=b.type;(c==="radio"||c==="checkbox"||b.nodeName.toLowerCase()==="select")&&D.call(this,a)},keydown:function(a){var b=a.target,c=b.type;(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(c==="checkbox"||c==="radio")||c==="select-multiple")&&D.call(this,a)},beforeactivate:function(a){var b=a.target;d._data(b,"_change_data",C(b))}},setup:function(a,b){if(this.type==="file")return!1;for(var c in B)d.event.add(this,c+".specialChange",B[c]);return s.test(this.nodeName)},teardown:function(a){d.event.remove(this,".specialChange");return s.test(this.nodeName)}},B=d.event.special.change.filters,B.focus=B.beforeactivate}c.addEventListener&&d.each({focus:"focusin",blur:"focusout"},function(a,b){function f(a){var c=d.event.fix(a);c.type=b,c.originalEvent={},d.event.trigger(c,null,c.target),c.isDefaultPrevented()&&a.preventDefault()}var e=0;d.event.special[b]={setup:function(){e++===0&&c.addEventListener(a,f,!0)},teardown:function(){--e===0&&c.removeEventListener(a,f,!0)}}}),d.each(["bind","one"],function(a,c){d.fn[c]=function(a,e,f){if(typeof a==="object"){for(var g in a)this[c](g,e,a[g],f);return this}if(d.isFunction(e)||e===!1)f=e,e=b;var h=c==="one"?d.proxy(f,function(a){d(this).unbind(a,h);return f.apply(this,arguments)}):f;if(a==="unload"&&c!=="one")this.one(a,e,f);else for(var i=0,j=this.length;i0?this.bind(b,a,c):this.trigger(b)},d.attrFn&&(d.attrFn[b]=!0)}),function(){function u(a,b,c,d,e,f){for(var g=0,h=d.length;g0){j=i;break}}i=i[a]}d[g]=j}}}function t(a,b,c,d,e,f){for(var g=0,h=d.length;g+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,f=Object.prototype.toString,g=!1,h=!0,i=/\\/g,j=/\W/;[0,0].sort(function(){h=!1;return 0});var k=function(b,d,e,g){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!=="string")return e;var i,j,n,o,q,r,s,t,u=!0,w=k.isXML(d),x=[],y=b;do{a.exec(""),i=a.exec(y);if(i){y=i[3],x.push(i[1]);if(i[2]){o=i[3];break}}}while(i);if(x.length>1&&m.exec(b))if(x.length===2&&l.relative[x[0]])j=v(x[0]+x[1],d);else{j=l.relative[x[0]]?[d]:k(x.shift(),d);while(x.length)b=x.shift(),l.relative[b]&&(b+=x.shift()),j=v(b,j)}else{!g&&x.length>1&&d.nodeType===9&&!w&&l.match.ID.test(x[0])&&!l.match.ID.test(x[x.length-1])&&(q=k.find(x.shift(),d,w),d=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]);if(d){q=g?{expr:x.pop(),set:p(g)}:k.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&d.parentNode?d.parentNode:d,w),j=q.expr?k.filter(q.expr,q.set):q.set,x.length>0?n=p(j):u=!1;while(x.length)r=x.pop(),s=r,l.relative[r]?s=x.pop():r="",s==null&&(s=d),l.relative[r](n,s,w)}else n=x=[]}n||(n=j),n||k.error(r||b);if(f.call(n)==="[object Array]")if(u)if(d&&d.nodeType===1)for(t=0;n[t]!=null;t++)n[t]&&(n[t]===!0||n[t].nodeType===1&&k.contains(d,n[t]))&&e.push(j[t]);else for(t=0;n[t]!=null;t++)n[t]&&n[t].nodeType===1&&e.push(j[t]);else e.push.apply(e,n);else p(n,e);o&&(k(o,h,e,g),k.uniqueSort(e));return e};k.uniqueSort=function(a){if(r){g=h,a.sort(r);if(g)for(var b=1;b0},k.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=l.order.length;e":function(a,b){var c,d=typeof b==="string",e=0,f=a.length;if(d&&!j.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(i,"")},TAG:function(a,b){return a[1].replace(i,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||k.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&k.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(i,"");!f&&l.attrMap[g]&&(a[1]=l.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(i,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=k(b[3],null,null,c);else{var g=k.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(l.match.POS.test(b[0])||l.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!k(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return"text"===c&&(b===c||b===null)},radio:function(a){return"radio"===a.type},checkbox:function(a){return"checkbox"===a.type},file:function(a){return"file"===a.type},password:function(a){return"password"===a.type},submit:function(a){return"submit"===a.type},image:function(a){return"image"===a.type},reset:function(a){return"reset"===a.type},button:function(a){return"button"===a.type||a.nodeName.toLowerCase()==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=l.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||k.getText([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=l.attrHandle[c]?l.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=l.setFilters[e];if(f)return f(a,c,b,d)}}},m=l.match.POS,n=function(a,b){return"\\"+(b-0+1)};for(var o in l.match)l.match[o]=new RegExp(l.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source),l.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+l.match[o].source.replace(/\\(\d+)/g,n));var p=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(q){p=function(a,b){var c=0,d=b||[];if(f.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length==="number")for(var e=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(l.find.ID=function(a,c,d){if(typeof c.getElementById!=="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!=="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},l.filter.ID=function(a,b){var c=typeof a.getAttributeNode!=="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(l.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!=="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(l.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=k,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

        ";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){k=function(b,e,f,g){e=e||c;if(!g&&!k.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return p(e.getElementsByTagName(b),f);if(h[2]&&l.find.CLASS&&e.getElementsByClassName)return p(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return p([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return p([],f);if(i.id===h[3])return p([i],f)}try{return p(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var m=e,n=e.getAttribute("id"),o=n||d,q=e.parentNode,r=/^\s*[+~]/.test(b);n?o=o.replace(/'/g,"\\$&"):e.setAttribute("id",o),r&&q&&(e=e.parentNode);try{if(!r||q)return p(e.querySelectorAll("[id='"+o+"'] "+b),f)}catch(s){}finally{n||m.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)k[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}k.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(a))try{if(e||!l.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return k(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="
        ";if(a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;l.order.splice(1,0,"CLASS"),l.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!=="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?k.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?k.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:k.contains=function(){return!1},k.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var v=function(a,b){var c,d=[],e="",f=b.nodeType?[b]:b;while(c=l.match.PSEUDO.exec(a))e+=c[0],a=a.replace(l.match.PSEUDO,"");a=l.relative[a]?a+"*":a;for(var g=0,h=f.length;g0)for(var g=c;g0},closest:function(a,b){var c=[],e,f,g=this[0];if(d.isArray(a)){var h,i,j={},k=1;if(g&&a.length){for(e=0,f=a.length;e-1:d(g).is(h))&&c.push({selector:i,elem:g,level:k});g=g.parentNode,k++}}return c}var l=N.test(a)?d(a,b||this.context):null;for(e=0,f=this.length;e-1:d.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b)break}}c=c.length>1?d.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a||typeof a==="string")return d.inArray(this[0],a?d(a):this.parent().children());return d.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a==="string"?d(a,b):d.makeArray(a),e=d.merge(this.get(),c);return this.pushStack(P(c[0])||P(e[0])?e:d.unique(e))},andSelf:function(){return this.add(this.prevObject)}}),d.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return d.dir(a,"parentNode")},parentsUntil:function(a,b,c){return d.dir(a,"parentNode",c)},next:function(a){return d.nth(a,2,"nextSibling")},prev:function(a){return d.nth(a,2,"previousSibling")},nextAll:function(a){return d.dir(a,"nextSibling")},prevAll:function(a){return d.dir(a,"previousSibling")},nextUntil:function(a,b,c){return d.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return d.dir(a,"previousSibling",c)},siblings:function(a){return d.sibling(a.parentNode.firstChild,a)},children:function(a){return d.sibling(a.firstChild)},contents:function(a){return d.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:d.makeArray(a.childNodes)}},function(a,b){d.fn[a]=function(c,e){var f=d.map(this,b,c),g=M.call(arguments);I.test(a)||(e=c),e&&typeof e==="string"&&(f=d.filter(e,f)),f=this.length>1&&!O[a]?d.unique(f):f,(this.length>1||K.test(e))&&J.test(a)&&(f=f.reverse());return this.pushStack(f,a,g.join(","))}}),d.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?d.find.matchesSelector(b[0],a)?[b[0]]:[]:d.find.matches(a,b)},dir:function(a,c,e){var f=[],g=a[c];while(g&&g.nodeType!==9&&(e===b||g.nodeType!==1||!d(g).is(e)))g.nodeType===1&&f.push(g),g=g[c];return f},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var R=/ jQuery\d+="(?:\d+|null)"/g,S=/^\s+/,T=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,U=/<([\w:]+)/,V=/",""],legend:[1,"
        ","
        "],thead:[1,"","
        "],tr:[2,"","
        "],td:[3,"","
        "],col:[2,"","
        "],area:[1,"",""],_default:[0,"",""]};Z.optgroup=Z.option,Z.tbody=Z.tfoot=Z.colgroup=Z.caption=Z.thead,Z.th=Z.td,d.support.htmlSerialize||(Z._default=[1,"div
        ","
        "]),d.fn.extend({text:function(a){if(d.isFunction(a))return this.each(function(b){var c=d(this);c.text(a.call(this,b,c.text()))});if(typeof a!=="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return d.text(this)},wrapAll:function(a){if(d.isFunction(a))return this.each(function(b){d(this).wrapAll(a.call(this,b))});if(this[0]){var b=d(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(d.isFunction(a))return this.each(function(b){d(this).wrapInner(a.call(this,b))});return this.each(function(){var b=d(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){d(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){d.nodeName(this,"body")||d(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=d(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,d(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,e;(e=this[c])!=null;c++)if(!a||d.filter(a,[e]).length)!b&&e.nodeType===1&&(d.cleanData(e.getElementsByTagName("*")),d.cleanData([e])),e.parentNode&&e.parentNode.removeChild(e);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&d.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return d.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(R,""):null;if(typeof a!=="string"||X.test(a)||!d.support.leadingWhitespace&&S.test(a)||Z[(U.exec(a)||["",""])[1].toLowerCase()])d.isFunction(a)?this.each(function(b){var c=d(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);else{a=a.replace(T,"<$1>");try{for(var c=0,e=this.length;c1&&l0?this.clone(!0):this).get();d(f[h])[b](j),e=e.concat(j)}return this.pushStack(e,a,f.selector)}}),d.extend({clone:function(a,b,c){var e=a.cloneNode(!0),f,g,h;if((!d.support.noCloneEvent||!d.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!d.isXMLDoc(a)){ba(a,e),f=bb(a),g=bb(e);for(h=0;f[h];++h)ba(f[h],g[h])}if(b){_(a,e);if(c){f=bb(a),g=bb(e);for(h=0;f[h];++h)_(f[h],g[h])}}return e},clean:function(a,b,e,f){b=b||c,typeof b.createElement==="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var g=[];for(var h=0,i;(i=a[h])!=null;h++){typeof i==="number"&&(i+="");if(!i)continue;if(typeof i!=="string"||W.test(i)){if(typeof i==="string"){i=i.replace(T,"<$1>");var j=(U.exec(i)||["",""])[1].toLowerCase(),k=Z[j]||Z._default,l=k[0],m=b.createElement("div");m.innerHTML=k[1]+i+k[2];while(l--)m=m.lastChild;if(!d.support.tbody){var n=V.test(i),o=j==="table"&&!n?m.firstChild&&m.firstChild.childNodes:k[1]===""&&!n?m.childNodes:[];for(var p=o.length-1;p>=0;--p)d.nodeName(o[p],"tbody")&&!o[p].childNodes.length&&o[p].parentNode.removeChild(o[p])}!d.support.leadingWhitespace&&S.test(i)&&m.insertBefore(b.createTextNode(S.exec(i)[0]),m.firstChild),i=m.childNodes}}else i=b.createTextNode(i);i.nodeType?g.push(i):g=d.merge(g,i)}if(e)for(h=0;g[h];h++)!f||!d.nodeName(g[h],"script")||g[h].type&&g[h].type.toLowerCase()!=="text/javascript"?(g[h].nodeType===1&&g.splice.apply(g,[h+1,0].concat(d.makeArray(g[h].getElementsByTagName("script")))),e.appendChild(g[h])):f.push(g[h].parentNode?g[h].parentNode.removeChild(g[h]):g[h]);return g},cleanData:function(a){var b,c,e=d.cache,f=d.expando,g=d.event.special,h=d.support.deleteExpando;for(var i=0,j;(j=a[i])!=null;i++){if(j.nodeName&&d.noData[j.nodeName.toLowerCase()])continue;c=j[d.expando];if(c){b=e[c]&&e[c][f];if(b&&b.events){for(var k in b.events)g[k]?d.event.remove(j,k):d.removeEvent(j,k,b.handle);b.handle&&(b.handle.elem=null)}h?delete j[d.expando]:j.removeAttribute&&j.removeAttribute(d.expando),delete e[c]}}}});var bd=/alpha\([^)]*\)/i,be=/opacity=([^)]*)/,bf=/-([a-z])/ig,bg=/([A-Z]|^ms)/g,bh=/^-?\d+(?:px)?$/i,bi=/^-?\d/,bj={position:"absolute",visibility:"hidden",display:"block"},bk=["Left","Right"],bl=["Top","Bottom"],bm,bn,bo,bp=function(a,b){return b.toUpperCase()};d.fn.css=function(a,c){if(arguments.length===2&&c===b)return this;return d.access(this,a,c,!0,function(a,c,e){return e!==b?d.style(a,c,e):d.css(a,c)})},d.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bm(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{zIndex:!0,fontWeight:!0,opacity:!0,zoom:!0,lineHeight:!0},cssProps:{"float":d.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,e,f){if(a&&a.nodeType!==3&&a.nodeType!==8&&a.style){var g,h=d.camelCase(c),i=a.style,j=d.cssHooks[h];c=d.cssProps[h]||h;if(e===b){if(j&&"get"in j&&(g=j.get(a,!1,f))!==b)return g;return i[c]}if(typeof e==="number"&&isNaN(e)||e==null)return;typeof e==="number"&&!d.cssNumber[h]&&(e+="px");if(!j||!("set"in j)||(e=j.set(a,e))!==b)try{i[c]=e}catch(k){}}},css:function(a,c,e){var f,g=d.camelCase(c),h=d.cssHooks[g];c=d.cssProps[g]||g;if(h&&"get"in h&&(f=h.get(a,!0,e))!==b)return f;if(bm)return bm(a,c,g)},swap:function(a,b,c){var d={};for(var e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]},camelCase:function(a){return a.replace(bf,bp)}}),d.curCSS=d.css,d.each(["height","width"],function(a,b){d.cssHooks[b]={get:function(a,c,e){var f;if(c){a.offsetWidth!==0?f=bq(a,b,e):d.swap(a,bj,function(){f=bq(a,b,e)});if(f<=0){f=bm(a,b,b),f==="0px"&&bo&&(f=bo(a,b,b));if(f!=null)return f===""||f==="auto"?"0px":f}if(f<0||f==null){f=a.style[b];return f===""||f==="auto"?"0px":f}return typeof f==="string"?f:f+"px"}},set:function(a,b){if(!bh.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),d.support.opacity||(d.cssHooks.opacity={get:function(a,b){return be.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style;c.zoom=1;var e=d.isNaN(b)?"":"alpha(opacity="+b*100+")",f=c.filter||"";c.filter=bd.test(f)?f.replace(bd,e):c.filter+" "+e}}),d(function(){d.support.reliableMarginRight||(d.cssHooks.marginRight={get:function(a,b){var c;d.swap(a,{display:"inline-block"},function(){b?c=bm(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bn=function(a,c,e){var f,g,h;e=e.replace(bg,"-$1").toLowerCase();if(!(g=a.ownerDocument.defaultView))return b;if(h=g.getComputedStyle(a,null))f=h.getPropertyValue(e),f===""&&!d.contains(a.ownerDocument.documentElement,a)&&(f=d.style(a,e));return f}),c.documentElement.currentStyle&&(bo=function(a,b){var c,d=a.currentStyle&&a.currentStyle[b],e=a.runtimeStyle&&a.runtimeStyle[b],f=a.style;!bh.test(d)&&bi.test(d)&&(c=f.left,e&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":d||0,d=f.pixelLeft+"px",f.left=c,e&&(a.runtimeStyle.left=e));return d===""?"auto":d}),bm=bn||bo,d.expr&&d.expr.filters&&(d.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!d.support.reliableHiddenOffsets&&(a.style.display||d.css(a,"display"))==="none"},d.expr.filters.visible=function(a){return!d.expr.filters.hidden(a)});var br=/%20/g,bs=/\[\]$/,bt=/\r?\n/g,bu=/#.*$/,bv=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bw=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bx=/^(?:about|app|app\-storage|.+\-extension|file|widget):$/,by=/^(?:GET|HEAD)$/,bz=/^\/\//,bA=/\?/,bB=/)<[^<]*)*<\/script>/gi,bC=/^(?:select|textarea)/i,bD=/\s+/,bE=/([?&])_=[^&]*/,bF=/(^|\-)([a-z])/g,bG=function(a,b,c){return b+c.toUpperCase()},bH=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bI=d.fn.load,bJ={},bK={},bL,bM;try{bL=c.location.href}catch(bN){bL=c.createElement("a"),bL.href="",bL=bL.href}bM=bH.exec(bL.toLowerCase())||[],d.fn.extend({load:function(a,c,e){if(typeof a!=="string"&&bI)return bI.apply(this,arguments);if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var g=a.slice(f,a.length);a=a.slice(0,f)}var h="GET";c&&(d.isFunction(c)?(e=c,c=b):typeof c==="object"&&(c=d.param(c,d.ajaxSettings.traditional),h="POST"));var i=this;d.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?d("
        ").append(c.replace(bB,"")).find(g):c)),e&&i.each(e,[c,b,a])}});return this},serialize:function(){return d.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?d.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bC.test(this.nodeName)||bw.test(this.type))}).map(function(a,b){var c=d(this).val();return c==null?null:d.isArray(c)?d.map(c,function(a,c){return{name:b.name,value:a.replace(bt,"\r\n")}}):{name:b.name,value:c.replace(bt,"\r\n")}}).get()}}),d.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){d.fn[b]=function(a){return this.bind(b,a)}}),d.each(["get","post"],function(a,c){d[c]=function(a,e,f,g){d.isFunction(e)&&(g=g||f,f=e,e=b);return d.ajax({type:c,url:a,data:e,success:f,dataType:g})}}),d.extend({getScript:function(a,c){return d.get(a,b,c,"script")},getJSON:function(a,b,c){return d.get(a,b,c,"json")},ajaxSetup:function(a,b){b?d.extend(!0,a,d.ajaxSettings,b):(b=a,a=d.extend(!0,d.ajaxSettings,b));for(var c in {context:1,url:1})c in b?a[c]=b[c]:c in d.ajaxSettings&&(a[c]=d.ajaxSettings[c]);return a},ajaxSettings:{url:bL,isLocal:bx.test(bM[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":"*/*"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":d.parseJSON,"text xml":d.parseXML}},ajaxPrefilter:bO(bJ),ajaxTransport:bO(bK),ajax:function(a,c){function v(a,c,l,n){if(r!==2){r=2,p&&clearTimeout(p),o=b,m=n||"",u.readyState=a?4:0;var q,t,v,w=l?bR(e,u,l):b,x,y;if(a>=200&&a<300||a===304){if(e.ifModified){if(x=u.getResponseHeader("Last-Modified"))d.lastModified[k]=x;if(y=u.getResponseHeader("Etag"))d.etag[k]=y}if(a===304)c="notmodified",q=!0;else try{t=bS(e,w),c="success",q=!0}catch(z){c="parsererror",v=z}}else{v=c;if(!c||a)c="error",a<0&&(a=0)}u.status=a,u.statusText=c,q?h.resolveWith(f,[t,c,u]):h.rejectWith(f,[u,c,v]),u.statusCode(j),j=b,s&&g.trigger("ajax"+(q?"Success":"Error"),[u,e,q?t:v]),i.resolveWith(f,[u,c]),s&&(g.trigger("ajaxComplete",[u,e]),--d.active||d.event.trigger("ajaxStop"))}}typeof a==="object"&&(c=a,a=b),c=c||{};var e=d.ajaxSetup({},c),f=e.context||e,g=f!==e&&(f.nodeType||f instanceof d)?d(f):d.event,h=d.Deferred(),i=d._Deferred(),j=e.statusCode||{},k,l={},m,n,o,p,q,r=0,s,t,u={readyState:0,setRequestHeader:function(a,b){r||(l[a.toLowerCase().replace(bF,bG)]=b);return this},getAllResponseHeaders:function(){return r===2?m:null},getResponseHeader:function(a){var c;if(r===2){if(!n){n={};while(c=bv.exec(m))n[c[1].toLowerCase()]=c[2]}c=n[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){r||(e.mimeType=a);return this},abort:function(a){a=a||"abort",o&&o.abort(a),v(0,a);return this}};h.promise(u),u.success=u.done,u.error=u.fail,u.complete=i.done,u.statusCode=function(a){if(a){var b;if(r<2)for(b in a)j[b]=[j[b],a[b]];else b=a[u.status],u.then(b,b)}return this},e.url=((a||e.url)+"").replace(bu,"").replace(bz,bM[1]+"//"),e.dataTypes=d.trim(e.dataType||"*").toLowerCase().split(bD),e.crossDomain==null&&(q=bH.exec(e.url.toLowerCase()),e.crossDomain=q&&(q[1]!=bM[1]||q[2]!=bM[2]||(q[3]||(q[1]==="http:"?80:443))!=(bM[3]||(bM[1]==="http:"?80:443)))),e.data&&e.processData&&typeof e.data!=="string"&&(e.data=d.param(e.data,e.traditional)),bP(bJ,e,c,u);if(r===2)return!1;s=e.global,e.type=e.type.toUpperCase(),e.hasContent=!by.test(e.type),s&&d.active++===0&&d.event.trigger("ajaxStart");if(!e.hasContent){e.data&&(e.url+=(bA.test(e.url)?"&":"?")+e.data),k=e.url;if(e.cache===!1){var w=d.now(),x=e.url.replace(bE,"$1_="+w);e.url=x+(x===e.url?(bA.test(e.url)?"&":"?")+"_="+w:"")}}if(e.data&&e.hasContent&&e.contentType!==!1||c.contentType)l["Content-Type"]=e.contentType;e.ifModified&&(k=k||e.url,d.lastModified[k]&&(l["If-Modified-Since"]=d.lastModified[k]),d.etag[k]&&(l["If-None-Match"]=d.etag[k])),l.Accept=e.dataTypes[0]&&e.accepts[e.dataTypes[0]]?e.accepts[e.dataTypes[0]]+(e.dataTypes[0]!=="*"?", */*; q=0.01":""):e.accepts["*"];for(t in e.headers)u.setRequestHeader(t,e.headers[t]);if(e.beforeSend&&(e.beforeSend.call(f,u,e)===!1||r===2)){u.abort();return!1}for(t in {success:1,error:1,complete:1})u[t](e[t]);o=bP(bK,e,c,u);if(o){u.readyState=1,s&&g.trigger("ajaxSend",[u,e]),e.async&&e.timeout>0&&(p=setTimeout(function(){u.abort("timeout")},e.timeout));try{r=1,o.send(l,v)}catch(y){status<2?v(-1,y):d.error(y)}}else v(-1,"No Transport");return u},param:function(a,c){var e=[],f=function(a,b){b=d.isFunction(b)?b():b,e[e.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=d.ajaxSettings.traditional);if(d.isArray(a)||a.jquery&&!d.isPlainObject(a))d.each(a,function(){f(this.name,this.value)});else for(var g in a)bQ(g,a[g],c,f);return e.join("&").replace(br,"+")}}),d.extend({active:0,lastModified:{},etag:{}});var bT=d.now(),bU=/(\=)\?(&|$)|\?\?/i;d.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return d.expando+"_"+bT++}}),d.ajaxPrefilter("json jsonp",function(b,c,e){var f=typeof b.data==="string";if(b.dataTypes[0]==="jsonp"||c.jsonpCallback||c.jsonp!=null||b.jsonp!==!1&&(bU.test(b.url)||f&&bU.test(b.data))){var g,h=b.jsonpCallback=d.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2",m=function(){a[h]=i,g&&d.isFunction(i)&&a[h](g[0])};b.jsonp!==!1&&(j=j.replace(bU,l),b.url===j&&(f&&(k=k.replace(bU,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},e.then(m,m),b.converters["script json"]=function(){g||d.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),d.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){d.globalEval(a);return a}}}),d.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),d.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var bV=d.now(),bW,bX;d.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&bZ()||b$()}:bZ,bX=d.ajaxSettings.xhr(),d.support.ajax=!!bX,d.support.cors=bX&&"withCredentials"in bX,bX=b,d.support.ajax&&d.ajaxTransport(function(a){if(!a.crossDomain||d.support.cors){var c;return{send:function(e,f){var g=a.xhr(),h,i;a.username?g.open(a.type,a.url,a.async,a.username,a.password):g.open(a.type,a.url,a.async);if(a.xhrFields)for(i in a.xhrFields)g[i]=a.xhrFields[i];a.mimeType&&g.overrideMimeType&&g.overrideMimeType(a.mimeType),!a.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(i in e)g.setRequestHeader(i,e[i])}catch(j){}g.send(a.hasContent&&a.data||null),c=function(e,i){var j,k,l,m,n;try{if(c&&(i||g.readyState===4)){c=b,h&&(g.onreadystatechange=d.noop,delete bW[h]);if(i)g.readyState!==4&&g.abort();else{j=g.status,l=g.getAllResponseHeaders(),m={},n=g.responseXML,n&&n.documentElement&&(m.xml=n),m.text=g.responseText;try{k=g.statusText}catch(o){k=""}j||!a.isLocal||a.crossDomain?j===1223&&(j=204):j=m.text?200:404}}}catch(p){i||f(-1,p)}m&&f(j,k,m,l)},a.async&&g.readyState!==4?(bW||(bW={},bY()),h=bV++,g.onreadystatechange=bW[h]=c):c()},abort:function(){c&&c(0,1)}}}});var b_={},ca=/^(?:toggle|show|hide)$/,cb=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cc,cd=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];d.fn.extend({show:function(a,b,c){var e,f;if(a||a===0)return this.animate(ce("show",3),a,b,c);for(var g=0,h=this.length;g=0;a--)c[a].elem===this&&(b&&c[a](!0),c.splice(a,1))}),b||this.dequeue();return this}}),d.each({slideDown:ce("show",1),slideUp:ce("hide",1),slideToggle:ce("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){d.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),d.extend({speed:function(a,b,c){var e=a&&typeof a==="object"?d.extend({},a):{complete:c||!c&&b||d.isFunction(a)&&a,duration:a,easing:c&&b||b&&!d.isFunction(b)&&b};e.duration=d.fx.off?0:typeof e.duration==="number"?e.duration:e.duration in d.fx.speeds?d.fx.speeds[e.duration]:d.fx.speeds._default,e.old=e.complete,e.complete=function(){e.queue!==!1&&d(this).dequeue(),d.isFunction(e.old)&&e.old.call(this)};return e},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig||(b.orig={})}}),d.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(d.fx.step[this.prop]||d.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=d.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,b,c){function g(a){return e.step(a)}var e=this,f=d.fx;this.startTime=d.now(),this.start=a,this.end=b,this.unit=c||this.unit||(d.cssNumber[this.prop]?"":"px"),this.now=this.start,this.pos=this.state=0,g.elem=this.elem,g()&&d.timers.push(g)&&!cc&&(cc=setInterval(f.tick,f.interval))},show:function(){this.options.orig[this.prop]=d.style(this.elem,this.prop),this.options.show=!0,this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),d(this.elem).show()},hide:function(){this.options.orig[this.prop]=d.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b=d.now(),c=!0;if(a||b>=this.options.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),this.options.curAnim[this.prop]=!0;for(var e in this.options.curAnim)this.options.curAnim[e]!==!0&&(c=!1);if(c){if(this.options.overflow!=null&&!d.support.shrinkWrapBlocks){var f=this.elem,g=this.options;d.each(["","X","Y"],function(a,b){f.style["overflow"+b]=g.overflow[a]})}this.options.hide&&d(this.elem).hide();if(this.options.hide||this.options.show)for(var h in this.options.curAnim)d.style(this.elem,h,this.options.orig[h]);this.options.complete.call(this.elem)}return!1}var i=b-this.startTime;this.state=i/this.options.duration;var j=this.options.specialEasing&&this.options.specialEasing[this.prop],k=this.options.easing||(d.easing.swing?"swing":"linear");this.pos=d.easing[j||k](this.state,i,0,1,this.options.duration),this.now=this.start+(this.end-this.start)*this.pos,this.update();return!0}},d.extend(d.fx,{tick:function(){var a=d.timers;for(var b=0;b
        ";d.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"}),b.innerHTML=j,a.insertBefore(b,a.firstChild),e=b.firstChild,f=e.firstChild,h=e.nextSibling.firstChild.firstChild,this.doesNotAddBorder=f.offsetTop!==5,this.doesAddBorderForTableAndCells=h.offsetTop===5,f.style.position="fixed",f.style.top="20px",this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15,f.style.position=f.style.top="",e.style.overflow="hidden",e.style.position="relative",this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5,this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i,a.removeChild(b),d.offset.initialize=d.noop},bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;d.offset.initialize(),d.offset.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(d.css(a,"marginTop"))||0,c+=parseFloat(d.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var e=d.css(a,"position");e==="static"&&(a.style.position="relative");var f=d(a),g=f.offset(),h=d.css(a,"top"),i=d.css(a,"left"),j=(e==="absolute"||e==="fixed")&&d.inArray("auto",[h,i])>-1,k={},l={},m,n;j&&(l=f.position()),m=j?l.top:parseInt(h,10)||0,n=j?l.left:parseInt(i,10)||0,d.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):f.css(k)}},d.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),e=ch.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(d.css(a,"marginTop"))||0,c.left-=parseFloat(d.css(a,"marginLeft"))||0,e.top+=parseFloat(d.css(b[0],"borderTopWidth"))||0,e.left+=parseFloat(d.css(b[0],"borderLeftWidth"))||0;return{top:c.top-e.top,left:c.left-e.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&(!ch.test(a.nodeName)&&d.css(a,"position")==="static"))a=a.offsetParent;return a})}}),d.each(["Left","Top"],function(a,c){var e="scroll"+c;d.fn[e]=function(c){var f=this[0],g;if(!f)return null;if(c!==b)return this.each(function(){g=ci(this),g?g.scrollTo(a?d(g).scrollLeft():c,a?c:d(g).scrollTop()):this[e]=c});g=ci(f);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:d.support.boxModel&&g.document.documentElement[e]||g.document.body[e]:f[e]}}),d.each(["Height","Width"],function(a,c){var e=c.toLowerCase();d.fn["inner"+c]=function(){return this[0]?parseFloat(d.css(this[0],e,"padding")):null},d.fn["outer"+c]=function(a){return this[0]?parseFloat(d.css(this[0],e,a?"margin":"border")):null},d.fn[e]=function(a){var f=this[0];if(!f)return a==null?null:this;if(d.isFunction(a))return this.each(function(b){var c=d(this);c[e](a.call(this,b,c[e]()))});if(d.isWindow(f)){var g=f.document.documentElement["client"+c];return f.document.compatMode==="CSS1Compat"&&g||f.document.body["client"+c]||g}if(f.nodeType===9)return Math.max(f.documentElement["client"+c],f.body["scroll"+c],f.documentElement["scroll"+c],f.body["offset"+c],f.documentElement["offset"+c]);if(a===b){var h=d.css(f,e),i=parseFloat(h);return d.isNaN(i)?h:i}return this.css(e,typeof a==="string"?a:a+"px")}}),a.jQuery=a.$=d})(window); \ No newline at end of file diff --git a/docs/output/modules_list.html b/docs/output/modules_list.html deleted file mode 100644 index b54886a4f..000000000 --- a/docs/output/modules_list.html +++ /dev/null @@ -1,2798 +0,0 @@ - - - - - - - - - - - -
        -

        - Elixir v0.5.0.dev -

        - - - - -
        - - \ No newline at end of file diff --git a/docs/output/protocols_list.html b/docs/output/protocols_list.html deleted file mode 100644 index 01c3d19a7..000000000 --- a/docs/output/protocols_list.html +++ /dev/null @@ -1,973 +0,0 @@ - - - - - - - - - - - -
        -

        - Elixir v0.5.0.dev -

        - - - - -
        - - \ No newline at end of file diff --git a/docs/output/records_list.html b/docs/output/records_list.html deleted file mode 100644 index 477d2f021..000000000 --- a/docs/output/records_list.html +++ /dev/null @@ -1,1815 +0,0 @@ - - - - - - - - - - - -
        -

        - Elixir v0.5.0.dev -

        - - - - -
        - - \ No newline at end of file From 87e62b953764039b912b03d3b880afc7c3ff4e56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Tue, 8 May 2012 17:25:38 +0200 Subject: [PATCH 136/437] Escape proper characters --- docs/Elixir.Builtin.html | 42 +++++++++++++++++------------------ docs/Elixir.SpecialForms.html | 6 ++--- docs/modules_list.html | 16 ++++++------- 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/docs/Elixir.Builtin.html b/docs/Elixir.Builtin.html index e5c9ca0ce..bbdecc91b 100644 --- a/docs/Elixir.Builtin.html +++ b/docs/Elixir.Builtin.html @@ -430,7 +430,7 @@

        Macros summary

      3. - &&/2 + &&/2
      4. @@ -465,22 +465,22 @@

        Macros summary

      5. - + </2
      6. - <-/2 + <-/2
      7. - <=/2 + <=/2
      8. - <>/2 + <>/2
      9. @@ -495,12 +495,12 @@

        Macros summary

      10. - >/2 + >/2
      11. - >=/2 + >=/2
      12. @@ -1657,8 +1657,8 @@

        Examples

        Source
        -

        - &&/2 +

        + &&/2

        Provides a short-circuit operator that executes the second expression only if the first one evalutes to true (i.e. it is @@ -1762,8 +1762,8 @@

        Examples

        Source
        -

        - +

        + </2

        Return true if left is less than right. As Erlang, Elixir can compare any term. Allowed in guard clauses.

        @@ -1776,8 +1776,8 @@

        Examples

        Source
        -

        - <-/2 +

        + <-/2

        Sends a message to the process identified on the left. A process can be identified bu its PID or, if it is registered, @@ -1791,8 +1791,8 @@

        Examples

        Source
        -

        - <=/2 +

        + <=/2

        Return true if left is less than or equal to right. As Erlang, Elixir can compare any term. Allowed in guard clauses.

        @@ -1805,8 +1805,8 @@

        Examples

        Source
        -

        - <>/2 +

        + <>/2

        Concatenates two binaries. Allowed in guard clauses.

        @@ -1862,8 +1862,8 @@

        Examples

        Source
        -

        - >/2 +

        + >/2

        Return true if left is more than right. As Erlang, Elixir can compare any term. Allowed in guard clauses.

        @@ -1876,8 +1876,8 @@

        Examples

        Source
        -

        - >=/2 +

        + >=/2

        Return true if left is more than or equal to right. As Erlang, Elixir can compare any term. Allowed in guard clauses.

        diff --git a/docs/Elixir.SpecialForms.html b/docs/Elixir.SpecialForms.html index ed43890a8..55be023a9 100644 --- a/docs/Elixir.SpecialForms.html +++ b/docs/Elixir.SpecialForms.html @@ -47,7 +47,7 @@

        Macros summary

        • - <<>>/1 + <<>>/1
        • @@ -150,8 +150,8 @@

          Macros summary

          Macros

          -

          - <<>>/1 +

          + <<>>/1

          Defines a new bitstring.

          diff --git a/docs/modules_list.html b/docs/modules_list.html index 57d753022..963699f18 100644 --- a/docs/modules_list.html +++ b/docs/modules_list.html @@ -421,7 +421,7 @@

        • - &&/2 + &&/2 Elixir.Builtin
        • @@ -470,28 +470,28 @@

        • - + </2 Elixir.Builtin
        • - <-/2 + <-/2 Elixir.Builtin
        • - <=/2 + <=/2 Elixir.Builtin
        • - <>/2 + <>/2 Elixir.Builtin
        • @@ -512,14 +512,14 @@

        • - >/2 + >/2 Elixir.Builtin
        • - >=/2 + >=/2 Elixir.Builtin
        • @@ -1369,7 +1369,7 @@

        • - <<>>/1 + <<>>/1 Elixir.SpecialForms
        • From ff3be0ce56904b5574681ae300596c92a0e8f07b Mon Sep 17 00:00:00 2001 From: Ezekiel Templin Date: Thu, 10 May 2012 08:36:02 -0300 Subject: [PATCH 137/437] Fix documentation link --- getting_started/7.markdown | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/getting_started/7.markdown b/getting_started/7.markdown index 439619af8..78963076b 100644 --- a/getting_started/7.markdown +++ b/getting_started/7.markdown @@ -34,7 +34,7 @@ So, in order to write a real application with Elixir, familiarity with Erlang's ## 7.3 Reference Manual -[You can also check the source code of Elixir itself](https://github.com/elixir-lang/elixir/tree/master/lib), which is mainly written in Elixir, or [explore Elixir's documentation](http://elixir-lang/docs). +[You can also check the source code of Elixir itself](https://github.com/elixir-lang/elixir/tree/master/lib), which is mainly written in Elixir, or [explore Elixir's documentation][8]. ## 7.4 Join The Community @@ -47,3 +47,4 @@ Remember that in case of any difficulties, you can always visit the **#elixir-la [5]: http://learnyousomeerlang.com/the-hitchhikers-guide-to-concurrency [6]: http://groups.google.com/group/elixir-lang-core [7]: https://github.com/elixir-lang/elixir/tree/master/lib + [8]: http://elixir-lang.org/docs/ From 032e190cf6d31e524453378013d4de1a4c941814 Mon Sep 17 00:00:00 2001 From: Alexei Sholik Date: Sun, 13 May 2012 13:46:14 +0300 Subject: [PATCH 138/437] New post: What's New in Elixir #4 --- ...2012-05-13-what-s-new-in-elixir-4.markdown | 146 ++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 _posts/2012-05-13-what-s-new-in-elixir-4.markdown diff --git a/_posts/2012-05-13-what-s-new-in-elixir-4.markdown b/_posts/2012-05-13-what-s-new-in-elixir-4.markdown new file mode 100644 index 000000000..ee1a2053f --- /dev/null +++ b/_posts/2012-05-13-what-s-new-in-elixir-4.markdown @@ -0,0 +1,146 @@ +--- +layout: post +title: What's New in Elixir #4 +author: Alexei Sholik +category: "What's New in Elixir" +excerpt: Welcome to the new edition of our biweekly series. Elixir development has been progressing at a steady pace and there are quite a few new things we're going to have a look at today. +--- +Welcome to the new edition of our biweekly series. Elixir development has been progressing at a steady pace and there are quite a few new things we're going to have a look at today. + +As always, I'm using the latest master (`d28d716de0f2892e31b4bcc9f87549b125075fa5`) to compile and run the code snippets in this post. + +## Highlights ## + +The [online docs][1] are finally up! This means easier navigation and integrated search. The docs are generated directly from the source, so it's very easy for you to contribute. Simply hit the _Source_ link, author your patch and send a pull request to the main Elixir repo. With GitHub you can do this all without leaving the browser. Any changes improving the documentation are welcome. + + [1]: http://elixir-lang.org/docs/ + + +## API Changes ## + +### Overridable ### + +Overridable is no longer a data attribute, but a macro. This makes it more straightforward to define an overridable function that has multiple clauses of the same arity. + + defmodule DefaultMod do + defmacro __using__(_module, _opts) do + quote do + def test(:x) do + IO.puts "This is X" + end + + def test(:y) do + IO.puts "This is Y" + end + + defoverridable [test: 1] + end + end + end + + defmodule InheritMod do + use DefaultMod + + def test(:z) do + IO.puts "This is Z" + end + end + + ### + + InheritMod.test :x + #=> ** (FunctionClauseError) no function clause matching: InheritMod.test(:x) + + InheritMod.test :y + #=> ** (FunctionClauseError) no function clause matching: InheritMod.test(:y) + + InheritMod.test :z + #=> This is Z + +As you can see, all clauses are being overriden with one new clause. If you wanted to keep the default clauses, you would do away with the `defoverridable` line. This would then result in the following: + + OverMod.test :x + #=> This is X + + OverMod.test :y + #=> This is Y + + OverMod.test :z + #=> This is Z + + +## Misc. Stuff ## + +* The new `in` keyword has been added to simplify some common patterns. For instance, if you wanted to check for a falsey value, you had to write + + case val do + match: nil + # code + match: false + # code + match: other + # other_code + end + + # or + + case val do + match: x when x == nil or x == false + # code + match: other + # other_code + end + + Now you can write + + case val do + match: x in [nil, false] + # code + match: other + # other_code + end + + This new syntax can be used in guards, ordinary conditions, and pattern matching. + +* The new [File.exists?][2] function allows you to check if a file object exists in the file system. It can be a regular file, a directory, a socket, etc. If want to check for existence of a regular file, use [File.regular?][3] instead. + + [2]: http://elixir-lang.org/docs/File.html#exists?/1 + [3]: http://elixir-lang.org/docs/File.html#regular?/1 + +* The [URI][4] module has got a new function for URL query parsing: [decode_query][5]. + + URI.decode_query "key=value&login=password" + #=> {Orddict.Record,[{"key","value"},{"login","password"}]} + + Orddict is used by default. You can also pass your own dict + + d = URI.decode_query "key=value&login=password", HashDict.new + Dict.get d, "login" + #=> "password" + + This function also does percent-decoding for you + + d = URI.decode_query "find=a%20place%20to%20live" + Dict.get d, "find" + #=> "a place to live" + + [4]: http://elixir-lang.org/docs/URI.html + [5]: http://elixir-lang.org/docs/URI.html#decode_query/2 + +* [OptionParser][6] now supports argument aliases: + + OptionParser.Simple.parse(["-d"], [d: :debug]) + #=> { [debug: true], [] } + + [6]: http://elixir-lang.org/docs/OptionParser.Simple.html + +* Node names are now valid atoms: + + iex> :foo@bar + :"foo@bar" + +--- + +That's it for this edition. Don't forget to go [read the docs][1] and help us improve them :) + +Thank you all and see you next time! From 17eac120d616f6ff776dc82cc1531fbd67257d59 Mon Sep 17 00:00:00 2001 From: Alexei Sholik Date: Sun, 13 May 2012 13:49:32 +0300 Subject: [PATCH 139/437] Mention exdoc --- _posts/2012-05-13-what-s-new-in-elixir-4.markdown | 3 +++ 1 file changed, 3 insertions(+) diff --git a/_posts/2012-05-13-what-s-new-in-elixir-4.markdown b/_posts/2012-05-13-what-s-new-in-elixir-4.markdown index ee1a2053f..33b4576a6 100644 --- a/_posts/2012-05-13-what-s-new-in-elixir-4.markdown +++ b/_posts/2012-05-13-what-s-new-in-elixir-4.markdown @@ -13,6 +13,9 @@ As always, I'm using the latest master (`d28d716de0f2892e31b4bcc9f87549b125075fa The [online docs][1] are finally up! This means easier navigation and integrated search. The docs are generated directly from the source, so it's very easy for you to contribute. Simply hit the _Source_ link, author your patch and send a pull request to the main Elixir repo. With GitHub you can do this all without leaving the browser. Any changes improving the documentation are welcome. +The docs are generated with the help of the [exdoc][0] utility which is itself written in Elixir. + + [0]: https://github.com/elixir-lang/exdoc [1]: http://elixir-lang.org/docs/ From f6e175adbc3c4cc2ba0a4d9bc75ce84ec345fdec Mon Sep 17 00:00:00 2001 From: Alexei Sholik Date: Sun, 13 May 2012 14:47:54 +0300 Subject: [PATCH 140/437] OverMod -> InheritMod --- _posts/2012-05-13-what-s-new-in-elixir-4.markdown | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/_posts/2012-05-13-what-s-new-in-elixir-4.markdown b/_posts/2012-05-13-what-s-new-in-elixir-4.markdown index 33b4576a6..c6f5a3c3a 100644 --- a/_posts/2012-05-13-what-s-new-in-elixir-4.markdown +++ b/_posts/2012-05-13-what-s-new-in-elixir-4.markdown @@ -62,13 +62,13 @@ Overridable is no longer a data attribute, but a macro. This makes it more strai As you can see, all clauses are being overriden with one new clause. If you wanted to keep the default clauses, you would do away with the `defoverridable` line. This would then result in the following: - OverMod.test :x + InheritMod.test :x #=> This is X - OverMod.test :y + InheritMod.test :y #=> This is Y - OverMod.test :z + InheritMod.test :z #=> This is Z From fee1f59bee21ec84a5bd96b1312f911b1e126c31 Mon Sep 17 00:00:00 2001 From: Alexei Sholik Date: Sun, 13 May 2012 15:10:45 +0300 Subject: [PATCH 141/437] Add an example of `super` usage --- _posts/2012-05-13-what-s-new-in-elixir-4.markdown | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/_posts/2012-05-13-what-s-new-in-elixir-4.markdown b/_posts/2012-05-13-what-s-new-in-elixir-4.markdown index c6f5a3c3a..095678b46 100644 --- a/_posts/2012-05-13-what-s-new-in-elixir-4.markdown +++ b/_posts/2012-05-13-what-s-new-in-elixir-4.markdown @@ -60,7 +60,13 @@ Overridable is no longer a data attribute, but a macro. This makes it more strai InheritMod.test :z #=> This is Z -As you can see, all clauses are being overriden with one new clause. If you wanted to keep the default clauses, you would do away with the `defoverridable` line. This would then result in the following: +As you can see, all clauses are being overriden with one new clause. If you want to keep the default clauses, you can use the `super` keyword that is available inside an overriden function definition. So, if we add the following definition + + def test(_) do + super + end + +at the end of `InheritMod`, it would result in the following: InheritMod.test :x #=> This is X @@ -71,6 +77,7 @@ As you can see, all clauses are being overriden with one new clause. If you want InheritMod.test :z #=> This is Z +Alternatively, if you wanted to keep your function extensible but not overridable, you would do away with the `defoverridable` line altogether. In this case, any new clause defined in `InheritMod` would be just that -- a new clause for the function that already has some number of clauses defined. ## Misc. Stuff ## From 1cccb7035a77d02edb2efa338b8650027b7dafde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Fri, 18 May 2012 16:57:05 +0200 Subject: [PATCH 142/437] Update getting started and blog to the new syntax --- _posts/2012-04-21-hello-macros.markdown | 6 +- ...inside-elixir-s-parallel-compiler.markdown | 50 ++--- _posts/2012-05-06-web-framework-2.markdown | 101 ++++----- ...2012-05-13-what-s-new-in-elixir-4.markdown | 21 +- getting_started/2.markdown | 212 ++++++++---------- getting_started/4.markdown | 10 +- 6 files changed, 180 insertions(+), 220 deletions(-) diff --git a/_posts/2012-04-21-hello-macros.markdown b/_posts/2012-04-21-hello-macros.markdown index 9382a3405..8c1815310 100644 --- a/_posts/2012-04-21-hello-macros.markdown +++ b/_posts/2012-04-21-hello-macros.markdown @@ -142,10 +142,8 @@ By using this macro we're letting the framework know that we want to send the co def handle(:get, unquote(path), _data) do full_path = File.join([static_root(), unquote(bin)]) case File.read(full_path) do - match: { :ok, data } - { :ok, data } - else: - { :error, "404 Not Found" } + { :ok, data } -> { :ok, data } + _ -> { :error, "404 Not Found" } end end end diff --git a/_posts/2012-04-24-a-peek-inside-elixir-s-parallel-compiler.markdown b/_posts/2012-04-24-a-peek-inside-elixir-s-parallel-compiler.markdown index 192e5653d..b168e14d2 100644 --- a/_posts/2012-04-24-a-peek-inside-elixir-s-parallel-compiler.markdown +++ b/_posts/2012-04-24-a-peek-inside-elixir-s-parallel-compiler.markdown @@ -21,10 +21,10 @@ In Elixir, we could write this code as follows: parent <- { :compiled, Process.self() } end) receive do - match: { :compiled, ^child } - spawn_compilers(files, output) - match: { :EXIT, ^child, { reason, where } } - Erlang.erlang.raise(:error, reason, where) + { :compiled, ^child } -> + spawn_compilers(files, output) + { :EXIT, ^child, { reason, where } } -> + Erlang.erlang.raise(:error, reason, where) end end @@ -91,15 +91,14 @@ As discussed in the previous section, we want to extend the error handler to act defp ensure_loaded(module) do case Code.ensure_loaded(module) do - match: { :module, _ } - [] - match: { :error, _ } - parent = Process.get(:elixir_parent_compiler) - parent <- { :waiting, Process.self, module } - receive do - match: { :release, ^parent } - ensure_loaded(module) - end + { :module, _ } -> + [] + { :error, _ } -> + parent = Process.get(:elixir_parent_compiler) + parent <- { :waiting, Process.self, module } + receive do + { :release, ^parent } -> ensure_loaded(module) + end end end end @@ -145,18 +144,19 @@ Notice we added an extra clause to `spawn_compilers` so we can properly handle t defp wait_for_messages(files, output, stack) do receive do - match: { :compiled, child } - new_stack = List.delete(stack, child) - Enum.each new_stack, fn(pid) -> - pid <- { :release, Process.self } - end - spawn_compilers(files, output, new_stack) - match: { :waiting, _child, _module } - spawn_compilers(files, output, stack) - match: { :EXIT, _child, { reason, where } } - Erlang.erlang.raise(:error, reason, where) - after: 10_000 - raise "dependency on unexesting module or possible deadlock" + { :compiled, child } -> + new_stack = List.delete(stack, child) + Enum.each new_stack, fn(pid) -> + pid <- { :release, Process.self } + end + spawn_compilers(files, output, new_stack) + { :waiting, _child, _module } -> + spawn_compilers(files, output, stack) + { :EXIT, _child, { reason, where } } -> + Erlang.erlang.raise(:error, reason, where) + after + 10_000 -> + raise "dependency on unexesting module or possible deadlock" end end diff --git a/_posts/2012-05-06-web-framework-2.markdown b/_posts/2012-05-06-web-framework-2.markdown index ecd3bbddc..0582f19d1 100644 --- a/_posts/2012-05-06-web-framework-2.markdown +++ b/_posts/2012-05-06-web-framework-2.markdown @@ -42,20 +42,20 @@ In this post we're going to fix a couple of rough edges and further extend our w ## New stuff below this line ## multi_handle "/kvstore" do - post: - IO.puts "Got a POST request with data: #{inspect _data}" - :ok + :post -> + IO.puts "Got a POST request with data: #{inspect _data}" + :ok - get: - IO.puts "Got a GET request with query: #{inspect _query}" - :ok + :get -> + IO.puts "Got a GET request with query: #{inspect _query}" + :ok end get "/search", query do search = Dict.get query, "q" if search do { :ok, "No items found for the query '#{search}'" } - else: + else { :ok, "No query" } end end @@ -80,19 +80,16 @@ To avoid this, we'll add a catch-all default handler to _feb.ex_: quote do def handle(method, path, data // "") def handle(method, path, data) do - # Allow only the listed methods - if not (method in [:get, :post]) do - format_error(400) - - # Path should always start with a slash (/) - elsif: not match?("/" <> _, path) - format_error(400) - - # Otherwise, the request is assumed to be valid but the requested - # resource cannot be found - else: - format_error(404) - end + cond do + # Allow only the listed methods + not (method in [:get, :post]) -> format_error(400) + + # Path should always start with a slash (/) + not match?("/" <> _, path) -> format_error(400) + + # Otherwise, the request is assumed to be valid but the requested + # resource cannot be found + _ -> format_error(404) end end end @@ -102,12 +99,9 @@ I'll explain the ignored argument to this macro shortly. I've also introduced a # Return a { :error, } tuple with error description def format_error(code) do { :error, case code do - match: 400 - "400 Bad Request" - match: 404 - "404 Not Found" - else: - "503 Internal Server Error" + 400 -> "400 Bad Request" + 404 -> "404 Not Found" + _ -> "503 Internal Server Error" end } end @@ -149,47 +143,42 @@ That's better. Let's add one more piece of sugar to our framework by allowing the users to write one function that will handle several HTTP methods, useful for defining various interactions with a single path spec. For instance: multi_handle "/kvstore" do - post: - IO.puts "Got a POST request with data: #{_data}" - :ok - - get: - IO.puts "Got a GET request with query: #{_query}" - :ok + :post -> + IO.puts "Got a POST request with data: #{_data}" + :ok + :get -> + IO.puts "Got a GET request with query: #{_query}" + :ok end You can see how this approach allows us to express the fact that "/kvstore" provides some kind of service with support for multiple methods. This skeleton could be used to build a REST API, for example. This time around we'll be using implicit variables for POST data and GET query. Let's think for a moment what the `multi_handle` macro should expand to. So far we've been expanding our `post` and `get` macros into one `handle` function that uses pattern-matching to dispatch to the appropriate handler based on the incoming request. There's no reason not to use the same approach for `multi_handle`. So here's what its implementation looks like: - defmacro multi_handle(path, blocks) do - # Remove the entry for `:do` which is nil in this case - blocks = Keyword.delete blocks, :do - - # Iterate over each block in `blocks` and produce a separate `handle` - # clause for it - Enum.map blocks, fn -> - match: {:get, code} - quote hygiene: false do - def handle(:get, unquote(path), _query) do - unquote(code) + defmacro multi_handle(path, { :"->", _line, blocks }) do + # Iterate over each block in `blocks` and + # produce a separate `handle` clause for it + Enum.map blocks, (fn do + { [:get], code } -> + quote hygiene: false do + def handle(:get, unquote(path), _query) do + unquote(code) + end end - end - - match: {:post, code} - quote hygiene: false do - def handle(:post, unquote(path), _data) do - unquote(code) + { [:post], code } -> + quote hygiene: false do + def handle(:post, unquote(path), _data) do + unquote(code) + end end - end - end + end) end -When this macro is called, it'll get a list of the following form as its `blocks` argument: +When the macro is called, we receive all clauses with the verb and their implementation inside the syntax node -> in the order they are specified. Each clause is a tuple with two elements, the first one is a list of parameters given on the left side and the second one is the implementation, for example: - [{:do, nil}, {:get, }, {:post, }] + { :"=>", line, [{[:get], }, {[:post], }] } -Because the `get:` block immediately follows the `do`, the latter gets no code and we can safely discard it. This is what we do at the beginning of our `multi_handle` macro. Next, we pick each code block in turn and emit a function definition with corresponding arguments. The code for each of the code blocks is similar to the GET and POST handlers we have defined earlier. +In our `multo_handle` macro signature, we pattern match against the expression above and get all blocks of code, which then we emit a function definition with the corresponding arguments. The code for each of the code blocks is similar to the GET and POST handlers we have defined earlier. Finally, let's test it in `iex`: @@ -258,7 +247,7 @@ With this new clause in place we can add another `get` request definition in the search = Dict.get query, "q" if search do { :ok, "No items found for the query '#{search}'" } - else: + else { :ok, "No query" } end end diff --git a/_posts/2012-05-13-what-s-new-in-elixir-4.markdown b/_posts/2012-05-13-what-s-new-in-elixir-4.markdown index 095678b46..07c112168 100644 --- a/_posts/2012-05-13-what-s-new-in-elixir-4.markdown +++ b/_posts/2012-05-13-what-s-new-in-elixir-4.markdown @@ -84,30 +84,23 @@ Alternatively, if you wanted to keep your function extensible but not overridabl * The new `in` keyword has been added to simplify some common patterns. For instance, if you wanted to check for a falsey value, you had to write case val do - match: nil - # code - match: false - # code - match: other - # other_code + nil -> # code + false -> # code + other -> # other_code end # or case val do - match: x when x == nil or x == false - # code - match: other - # other_code + x when x == nil or x == false -> # code + other -> # other_code end Now you can write case val do - match: x in [nil, false] - # code - match: other - # other_code + x in [nil, false] -> # code + other -> # other_code end This new syntax can be used in guards, ordinary conditions, and pattern matching. diff --git a/getting_started/2.markdown b/getting_started/2.markdown index 3c544820b..f7d501e18 100644 --- a/getting_started/2.markdown +++ b/getting_started/2.markdown @@ -76,16 +76,14 @@ The [`Keyword` module](http://elixir-lang.org/docs/Keyword.html) contains severa iex> Keyword.get_values keywords, :foo [1,3] -Finally, keywords lists implement the so-called access protocol, which allows a developer to quickly access an entry: +Since keywords lists are very frequently passed as arguments, they do not require brackets when given as last argument in a function call. For instance, all the examples below are valid and equivalent: - iex> x = [a: 1, b: 2] - [{:a, 1}, {:b, 2}] - iex> x[:a] - 1 - iex> x[:b] - 2 - -But don't worry about protocols for now, we are going to discuss them with more details on chapter 4. + iex> if(2 + 2 == 4, [do: "OK"]) + "OK" + iex> if(2 + 2 == 4, do: "OK") + "OK" + iex> if 2 + 2 == 4, do: "OK" + "OK" ## 2.3 Char lists and binaries @@ -234,9 +232,9 @@ Although pattern matching allows us to build powerful constructs, its usage is l iex> Erlang.lists.flatten([1,[2],3]) = [1,2,3] ** (ErlangError) erlang error :illegal_pattern -## 2.6 Keywords arguments +## 2.6 Blocks -One of the first control flow constructs we usually learn is the conditional `if`. In Elixir, we can write `if` in these two equivalent ways: +One of the first control flow constructs we usually learn is the conditional `if`. In Elixir, we can write `if` in these two ways: iex> if true, do: 1 + 2 3 @@ -245,45 +243,23 @@ One of the first control flow constructs we usually learn is the conditional `if ...> end 3 -In both examples, we are invoking the function `if` passing keywords lists as arguments. Since the keywords are the last argument, the brackets are optional. These are all equivalent: - - iex> if true, do: 1 + 2 - 3 - iex> if true, [do: 1 + 2] - 3 - iex> if(true, [do: 1 + 2]) - 3 - -Besides, we can also pass an `else` option to `if`: - - iex> if false, do: 1 + 2, else: 10 + 3 - 13 - -However, most of the times `if` clauses are longer than the examples above. In such cases, we usually use the block format: - - iex> if true do - ...> 1 + 2 - ...> end - -Internally, this is converted to the same keywords arguments as above. This feature is called keywords blocks. Notice how the `do:` option is replaced by the delimiters `do/end`, allowing us to pass `else:` as option as well: +The second example uses the block syntax. We can also use `else` in the block syntax: if false do 1 + 2 - else: + else 10 + 3 end -Parenthesis can be added to keywords blocks as follows: +Elixir blocks work similarly to Ruby blocks. For example, a developer could add parenthesis as follow: if(false) do 1 + 2 - else: + else 10 + 3 end -Keywords blocks are an important feature that allow developers to create their own control structures as if they were part of the language itself. For instance, none of the control structures we are going to see in the next section are special cased in Elixir parser. They are all implemented using keywords blocks. - -Elixir supports two syntaxes for keywords blocks: `do`/`end` and `->`/`end`. The first one always binds to the farthest function call, while the latter to the closest. For example, the following expression: +It is also important to notice that `do`/`end` always binds to the farthest function call. For example, the following expression: Enum.map [1,2,3], fn(x) do x * 2 @@ -295,7 +271,7 @@ Would be parsed as: x * 2 end -Which is not what we want since `do` is binding to the farthest function call, in this case: `Enum.map`. We can fix this by using `->`, forcing the keyword block to bind to the `fn`: +Which is not what we want since `do` is binding to the farthest function call, in this case: `Enum.map`. For this reason, we always use the `->` syntax for functions and reserve `do/end` to the remaining control structures: Enum.map [1,2,3], fn(x) -> x * 2 @@ -307,46 +283,40 @@ Which is then parsed as: x * 2 end) -A good rule of thumb is: always use `->/end` when defining functions with `fn`, use `do/end` for all other structures. If we follow this rule, everything works transparently. - ## 2.7 Control flow structures In this section we are going to describe Elixir main control structures. ### 2.7.1 If -Refreshing from the section above, all these calls are equivalent: +Refreshing from the section above, all these calls behave the same: if false, do: 1 + 2, else: 10 + 3 if false do 1 + 2 - else: + else 10 + 3 end - # Although this is valid, its usage is discouraged. - if(false) -> - 1 + 2 - else: - 10 + 3 - end +In Elixir, all values except `false` and `nil` evaluate to `true`. Therefore there is no need to explicit convert the if argument a boolean. In case you want to check if one of many conditions are true, you can use the `cond` macro. -`if` also accepts many `elsif:` clauses: +### 2.7.2 Cond - if 1 + 1 == 3 do - IO.puts "Impossible" - elsif: 1 + 1 == 2 - IO.puts "This will match" - elsif: true - IO.puts "This won't because the one above matched" - else: - IO.puts "This won't" +`cond` allows you to check many expressions and executes the first one that evaluates to true: + + cond do + 2 + 2 == 5 -> + "This will never match" + 2 * 2 == 3 -> + "Nor this" + 1 + 1 == 2 -> + "But this will" end -In Elixir, all values except `false` and `nil` evaluate to true. So there is no need to convert them to boolean. +If none of the expressions above return true, an error would be raised. -### 2.7.2 Other boolean operators +### 2.7.3 Other boolean operators In the previous chapter, we discussed the boolean operators `and`, `or` and `not`. Those operators are strict in the sense they only accept booleans as first arguments. @@ -374,38 +344,36 @@ Elixir provides three operators with similar functionality but that accept argum As a rule of thumb, use `and`, `or` and `not` when both arguments are expected to booleans, as in guard clauses. If any of the arguments are non-booleans, use `&&`, `||` and `!`. -### 2.7.3 Case +### 2.7.4 Case -In this section we have introduced pattern matching via the `=` operator. Sometimes however it is convenient to match an expression against several expressions until we find a matching one. For such cases, we use `case`: +In section 2.5, we have introduced pattern matching via the `=` operator. Sometimes however it is convenient to compare an expression against several expressions until we find a matching one. In such scenario, we use `case`: case { 1, 2, 3 } do - match: { 4, 5, 6 } - IO.puts "This won't match" - match: { 1, x, 3 } - IO.puts "This will match and assign x" - else: - IO.puts "No match" + { 4, 5, 6 } -> + "This won't match" + { 1, x, 3 } -> + "This will match and assign x to 2" + _ -> + "This is a match any clause" end As in the `=` operator, any assigned variable will be overridden in the match clause. In case you want to pattern match against a variable, you need to use the `^` operator: x = 1 case 10 do - match: ^x - IO.puts "Won't match" - else: - IO.puts "Will match" + ^x -> "Won't match" + _ -> "Will match" end -Each match clause also supports special conditions to be given via guards: +Each match clause also supports special conditions to be specified via guards: case { 1, 2, 3 } do - match: { 4, 5, 6 } - IO.puts "This won't match" - match: { 1, x, 3 } when x > 0 - IO.puts "This will match and assign x" - else: - IO.puts "No match" + { 4, 5, 6 } -> + "This won't match" + { 1, x, 3 } when x > 0 -> + "This will match and assign x" + _ -> + "No match" end In the example above, the second clause will only match when x is positive. The Erlang VM only allows few expressions as guards, they are: @@ -469,27 +437,29 @@ However, the example above will always fail because, if the argument is a list, In such cases, if there is an error in one of the guards, it won't affect the next one. -### 2.7.4 Functions +### 2.7.5 Functions -Throughout this guide, we have created many functions in examples. The syntax for creating functions is: +In Elixir, creating a function is similar to the `case` mechanism we have just seen. It allows us to define a function with many clauses: - fn(a, b) -> a + b end + function = fn do + x, y when x > 0 -> x + y + x, y -> x * y + end -But it could also be written as (the previous example is preferred though): + function.(1, 3) #=> 4 + function.(-1, 3) #=> -3 - fn(a, b, do: a + b) +A function with one clause can be define with a shortcut syntax as follow: - fn(a, b) do - a + b - end + function = fn x, y -> x + y end -As an immutable language, the binding of the function is also immutable. This means that setting a variable inside the function does not affect its outer scope: +As Elixir is an immutable language, the binding of the function is also immutable. This means that setting a variable inside the function does not affect its outer scope: x = 1 (fn -> x = 2 end).() x #=> 1 -### 2.7.5 Loops +### 2.7.6 Loops Due to data structure immutability, loops in Elixir (and in functional programming languages) are written differently from conventional imperative languages. For example, in an imperative language, one would write: @@ -500,10 +470,10 @@ Due to data structure immutability, loops in Elixir (and in functional programmi In the example above, we are mutating the array which is not possible in Elixir. Therefore, in functional languages recursion happens by calling an anonymous or a named function recursively, until we reach a condition. Consider the example below that manually sums all the items in the list: iex> loop [1,2,3], 0 do - ...> match: [h|t], acc - ...> recur(t, h + acc) - ...> match: [], acc - ...> acc + ...> [h|t], acc -> + ...> recur(t, h + acc) + ...> [], acc -> + ...> acc ...> end 6 @@ -518,14 +488,14 @@ Then, we add the head of the list to the accumulator `h + acc` and call the loop > Note: `loop/recur` is also a Clojure idiom, although differently from Clojure, `recur` in Elixir does not ensure a tail call was made. -### 2.7.6 Try +### 2.7.7 Try The next control-flow mechanism is `try/catch/after`: iex> try do ...> throw 13 - ...> catch: number - ...> number + ...> catch + ...> number -> number ...> end 13 @@ -533,9 +503,9 @@ The next control-flow mechanism is `try/catch/after`: iex> try do ...> throw 13 - ...> catch: nan when not is_number(nan) - ...> nan - ...> after: + ...> catch + ...> nan when not is_number(nan) -> nan + ...> after ...> IO.puts "Didn't catch" ...> end Didn't catch @@ -546,8 +516,8 @@ There is one particularity that applies to `try/catch/after` when compared to ot iex> try do ...> new_var = 1 - ...> catch: value - ...> value + ...> catch + ...> value -> value ...> end 1 iex> new_var @@ -559,48 +529,49 @@ The common strategy then is to make explicit all arguments that are required aft x = calculate_some_value() y = some_other_value() { x, y } - catch: _ - { nil, nil } + catch + _ -> { nil, nil } end x #=> returns the value of x or nil for failures -### 2.7.7 Rescue +### 2.7.8 Rescue For catching exceptions in Elixir, we can use `rescue` instead of `catch`. Besides allowing the same pattern matching rules as `catch`, `rescue` also allows a developer to easily rescue an exception by its name and not by its internal contents. Consider the following examples: # rescue only runtime error try do raise "some error" - rescue: RuntimeError - "rescued" + rescue + RuntimeError -> "rescued" end # rescue runtime and argument errors try do raise "some error" - rescue: [RuntimeError, ArgumentError] - "rescued" + rescue + [RuntimeError, ArgumentError] -> "rescued" end # rescue and assign to x try do raise "some error" - rescue: x in [RuntimeError] - # all exceptions respond to message - x.message + rescue + x in [RuntimeError] -> + # all exceptions respond to message + x.message end # rescue all (discouraged) and assign to x try do raise ArgumentError, message: "unexpected argument" - rescue: x - x.message + rescue + x -> x.message end Custom exceptions can be defined using the `defexception` macro. You can check a list of defined exceptions in [our documentations page](http://elixir-lang.org/docs/), by clicking "Records" in the upper left corner. -### 2.7.8 Receive +### 2.7.9 Receive The last control-flow mechanism we are going to discuss is essential to Elixir's and Erlang's actor mechanism. In Elixir, the code is run in separate processes that exchange messages between them. Those processes are not Operating System processes (they are actually quite light-weight) but are called so since they do not share state with each other. @@ -615,18 +586,19 @@ In order to exchange messages, each process has a mailbox where the received mes # Collect the message iex> receive do - ...> match: { :hello, pid } - ...> IO.puts "Hello from #{inspect(pid)}" + ...> { :hello, pid } -> + ...> IO.puts "Hello from #{inspect(pid)}" ...> end Hello from <0.36.0> You may not see exactly `<0.36.0>` back, but something similar. If there are no messages in the mailbox, the current process will hang until a matching message arrives, unless an after clause is given: iex> receive do - ...> match: :waiting - ...> IO.puts "This may never come" - ...> after: 1000 # 1 second - ...> IO.puts "Too late" + ...> :waiting -> + ...> IO.puts "This may never come" + ...> after + ...> 1000 -> # 1 second + ...> IO.puts "Too late" ...> end Too late diff --git a/getting_started/4.markdown b/getting_started/4.markdown index b738b5b99..4b748eb79 100644 --- a/getting_started/4.markdown +++ b/getting_started/4.markdown @@ -160,7 +160,15 @@ Finally, since records are simply tuples, one can add a default protocol impleme Elixir ships with three built-in protocols, they are: -* Access - specifies how to access an element. This is the protocol that empowers bracket access in Elixir, for example `list[1]`; +* Access - specifies how to access an element. This is the protocol that empowers bracket access in Elixir, for example: + + iex> x = [a: 1, b: 2] + [{:a, 1}, {:b, 2}] + iex> x[:a] + 1 + iex> x[:b] + 2 + * Enum.Iterator - specifies an iteration contract for any data structure. Exposed via the `Enum` module; * List.Chars - specifies how to convert a data structures with characters to lists. Exposed via the `to_char_list` function; * Binary.Chars - specifies how to convert a data structure with characters to binary. Exposed via the `to_binary` function. For instance, interpolation calls `to_binary` in the interpolated content before adding it to the binary; From 893efd4ebc2d48466856289d4bc1b6c5ad1f5c39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Fri, 18 May 2012 17:31:47 +0200 Subject: [PATCH 143/437] Copy edit --- _posts/2012-05-06-web-framework-2.markdown | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/_posts/2012-05-06-web-framework-2.markdown b/_posts/2012-05-06-web-framework-2.markdown index 0582f19d1..048daca35 100644 --- a/_posts/2012-05-06-web-framework-2.markdown +++ b/_posts/2012-05-06-web-framework-2.markdown @@ -155,7 +155,7 @@ You can see how this approach allows us to express the fact that "/kvstore" prov Let's think for a moment what the `multi_handle` macro should expand to. So far we've been expanding our `post` and `get` macros into one `handle` function that uses pattern-matching to dispatch to the appropriate handler based on the incoming request. There's no reason not to use the same approach for `multi_handle`. So here's what its implementation looks like: - defmacro multi_handle(path, { :"->", _line, blocks }) do + defmacro multi_handle(path, [do: { :"->", _line, blocks }]) do # Iterate over each block in `blocks` and # produce a separate `handle` clause for it Enum.map blocks, (fn do @@ -174,9 +174,9 @@ Let's think for a moment what the `multi_handle` macro should expand to. So far end) end -When the macro is called, we receive all clauses with the verb and their implementation inside the syntax node -> in the order they are specified. Each clause is a tuple with two elements, the first one is a list of parameters given on the left side and the second one is the implementation, for example: +When the macro is called, we receive all clauses under the `do` key with each HTTP verb and its implementation inside the syntax node `->`, in the order they are specified. Each clause is a tuple with two elements, the first one is a list of parameters given on the left side and the second one is the implementation, for example: - { :"=>", line, [{[:get], }, {[:post], }] } + { :"->", line, [{[:get], }, {[:post], }] } In our `multo_handle` macro signature, we pattern match against the expression above and get all blocks of code, which then we emit a function definition with the corresponding arguments. The code for each of the code blocks is similar to the GET and POST handlers we have defined earlier. From fa99d1f21b93ddb2260d88af2bf6f7279f8c780f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Fri, 18 May 2012 18:21:28 +0200 Subject: [PATCH 144/437] Update docs --- docs/Access.Atom.html | 4 +- docs/Access.BitString.html | 4 +- docs/Access.Function.html | 4 +- docs/Binary.Inspect.Any.html | 4 +- docs/Binary.Inspect.BitString.html | 4 +- docs/Binary.Inspect.List.html | 6 +- docs/Binary.Inspect.Number.html | 4 +- docs/Binary.Inspect.Regex.html | 4 +- docs/Binary.Inspect.Tuple.html | 4 +- docs/Binary.html | 2 +- docs/Code.html | 12 +- docs/Dict.html | 6 +- docs/EEx.html | 28 ++- docs/Elixir.Builtin.html | 277 ++++++++++++---------- docs/Elixir.SpecialForms.html | 34 +-- docs/Enum.Iterator.HashDict.Record.html | 4 +- docs/Enum.Iterator.List.html | 4 +- docs/Enum.Iterator.Orddict.Record.html | 4 +- docs/Enum.OrdIterator.List.html | 6 +- docs/Enum.OrdIterator.Orddict.Record.html | 6 +- docs/Enum.html | 60 ++--- docs/ExUnit.Assertions.html | 34 +-- docs/HashDict.html | 2 +- docs/Keyword.html | 4 +- docs/List.html | 20 +- docs/Orddict.html | 2 +- docs/Regex.html | 6 +- docs/System.html | 8 +- docs/modules_list.html | 7 + 29 files changed, 300 insertions(+), 264 deletions(-) diff --git a/docs/Access.Atom.html b/docs/Access.Atom.html index 3f59c2519..34a37ac32 100644 --- a/docs/Access.Atom.html +++ b/docs/Access.Atom.html @@ -29,7 +29,7 @@

          - Source + Source @@ -98,7 +98,7 @@

          Examples

          All fields not specified on creation defaults to their default value.

          - Source + Source
          diff --git a/docs/Access.BitString.html b/docs/Access.BitString.html index 45b119d40..323af34c4 100644 --- a/docs/Access.BitString.html +++ b/docs/Access.BitString.html @@ -29,7 +29,7 @@

          - Source + Source @@ -67,7 +67,7 @@

          Examples

          Binary.access binary, %r(a) #=> "a"
        - Source + Source
        diff --git a/docs/Access.Function.html b/docs/Access.Function.html index 75cb82ab6..6ce378ad5 100644 --- a/docs/Access.Function.html +++ b/docs/Access.Function.html @@ -29,7 +29,7 @@

        - Source + Source @@ -61,7 +61,7 @@

        Functions

        is useful because it allows a function to be passed as argument in places a dict would also fit.

        - Source + Source diff --git a/docs/Binary.Inspect.Any.html b/docs/Binary.Inspect.Any.html index b8ad0b677..dcb605e58 100644 --- a/docs/Binary.Inspect.Any.html +++ b/docs/Binary.Inspect.Any.html @@ -29,7 +29,7 @@

        - Source + Source @@ -64,7 +64,7 @@

        Examples

        inspect Process.self #=> "<0.35.0>"
         
        - Source + Source diff --git a/docs/Binary.Inspect.BitString.html b/docs/Binary.Inspect.BitString.html index da1fe0685..2100ee1e1 100644 --- a/docs/Binary.Inspect.BitString.html +++ b/docs/Binary.Inspect.BitString.html @@ -29,7 +29,7 @@

        - Source + Source @@ -65,7 +65,7 @@

        Examples

        inspect("f\"oo") #=> "f\"oo" - Source + Source diff --git a/docs/Binary.Inspect.List.html b/docs/Binary.Inspect.List.html index 3dc06c2b8..a524cd407 100644 --- a/docs/Binary.Inspect.List.html +++ b/docs/Binary.Inspect.List.html @@ -29,7 +29,7 @@

        - Source + Source @@ -62,7 +62,7 @@

        Functions

        container_join/3

        - Source + Source

        inspect/1 @@ -78,7 +78,7 @@

        Examples

        inspect([:foo,:bar]) #=> "[:foo, :bar]"
        - Source + Source diff --git a/docs/Binary.Inspect.Number.html b/docs/Binary.Inspect.Number.html index 52c57f848..e1e15b40f 100644 --- a/docs/Binary.Inspect.Number.html +++ b/docs/Binary.Inspect.Number.html @@ -29,7 +29,7 @@

        - Source + Source @@ -63,7 +63,7 @@

        Examples

        inspect(1) #=> "1"
         
        - Source + Source diff --git a/docs/Binary.Inspect.Regex.html b/docs/Binary.Inspect.Regex.html index 27179e40a..a631e22f8 100644 --- a/docs/Binary.Inspect.Regex.html +++ b/docs/Binary.Inspect.Regex.html @@ -29,7 +29,7 @@

        - Source + Source @@ -63,7 +63,7 @@

        Examples

        inspect(%r/foo/m) #=> "%r\"foo\"m"
         
        - Source + Source diff --git a/docs/Binary.Inspect.Tuple.html b/docs/Binary.Inspect.Tuple.html index 6821b2867..d816a14e1 100644 --- a/docs/Binary.Inspect.Tuple.html +++ b/docs/Binary.Inspect.Tuple.html @@ -29,7 +29,7 @@

        - Source + Source @@ -65,7 +65,7 @@

        Examples

        inspect(ArgumentError.new) #=> ArgumentError[message: "argument error"] - Source + Source diff --git a/docs/Binary.html b/docs/Binary.html index 8e1ccc89d..ca487bc5f 100644 --- a/docs/Binary.html +++ b/docs/Binary.html @@ -136,7 +136,7 @@

        Examples

        Examples

        Binary.unescape "example\\n"
        -# => "example\n"
        +#=> "example\n"
         

        In the example above, we pass a string with \n escaped diff --git a/docs/Code.html b/docs/Code.html index d2d55757b..615d4e858 100644 --- a/docs/Code.html +++ b/docs/Code.html @@ -123,7 +123,7 @@

        Functions

        For compiling many files at once, check Elixir.ParallelCompiler.

        - Source + Source

        compiler_options/0 @@ -131,7 +131,7 @@

        Functions

        Loads the compilation options from the code server. Check compiler_options/1 for more information.

        - Source + Source

        compiler_options/1 @@ -148,7 +148,7 @@

        Functions

      13. ignoremoduleconflict - when true, override modules that were already defined;
      14. - Source + Source

        ensure_loaded/1 @@ -159,7 +159,7 @@

        Functions

        If it succeeds loading the module anyhow, it returns { :module, module }. If not, returns { :error, reason } with the error reason.

        - Source + Source

        eval/3 @@ -178,7 +178,7 @@

        Functions

        Examples

        Code.eval "a + b", [a: 1, b: 2], file: __FILE__, line: __LINE__
        -# => { 3, [ {:a, 1}, {:b, 2} ] }
        +#=> { 3, [ {:a, 1}, {:b, 2} ] }
         
        Source @@ -192,7 +192,7 @@

        Examples

        contents = quote hygiene: false, do: a + b
         Code.eval_quoted contents, [a: 1, b: 2], file: __FILE__, line: __LINE__
        -# => { 3, [ {:a, 1}, {:b, 2} ] }
        +#=> { 3, [ {:a, 1}, {:b, 2} ] }
         
        Source diff --git a/docs/Dict.html b/docs/Dict.html index e3fc24399..8cae3e052 100644 --- a/docs/Dict.html +++ b/docs/Dict.html @@ -233,7 +233,7 @@

        Examples

        Examples

        -
        Dict.merge [a: 1, b: 2], [a: 3, d: 4], fn(_k, v1, v2) ->
        +
        Dict.merge [a: 1, b: 2], [a: 3, d: 4], fn _k, v1, v2 ->
           v1 + v2
         end
         #=> [a: 4, b: 2, d: 4]
        @@ -283,7 +283,7 @@ 

        Examples

        Examples

        -
        Dict.update [a: 1, b: 2], :a, fn(val) -> -val end
        +
        Dict.update [a: 1, b: 2], :a, fn val -> -val end
         #=> [a: -1, b: 2]
         
        @@ -298,7 +298,7 @@

        Examples

        Examples

        -
        Dict.update [a: 1, b: 2], :c, 3, fn(val) -> -val end
        +
        Dict.update [a: 1, b: 2], :c, 3, fn val -> -val end
         #=> [a: 1, b: 2, c: 3]
         
        diff --git a/docs/EEx.html b/docs/EEx.html index a25fc922b..c3dc89b20 100644 --- a/docs/EEx.html +++ b/docs/EEx.html @@ -65,6 +65,7 @@

        Tags

        EEx.SmartEngine supports the following tags:

        <% Elixir expression - inline with output %>
        +<& Elxir matching expression - not printed &>
         <%= Elixir expression - replace with result %>
         
        @@ -77,11 +78,20 @@

        Tags

        <%= if true do %>
           It is obviously true
        -<% else: %>
        +<% else %>
           This will never appear
         <% end %>
         
        +

        The <& ... &> expression is only used in matching clauses. +For example, the cond macro would be written as:

        + +
        <%= cond do %>
        +  <& false -> &> Never printed
        +  <& true  -> &> always printed
        +<% end %>
        +
        +

        Notice that different engines may have different rules for each tag. Other tags may be added in future versions.

        @@ -92,13 +102,13 @@

        Macros

        loop a variable:

        EEx.eval_string "<%= for x in [1,2,3] do %><%= x %>\n<% end %>", []
        -# => "1\n2\n3\n"
        +#=> "1\n2\n3\n"
         

        It also adds defines a macro named @ that allows easy access:

        EEx.eval_string "<%= @foo %>", assigns: [foo: 1]
        -# => 1
        +#=> 1
         

        In other words, <%= @foo %> is simply translated to:

        @@ -172,7 +182,7 @@

        Functions

        Get a filename and generate a quoted expression that can be evaluated by Elixir or compiled to a function.

        - Source + Source

        compile_string/2 @@ -180,7 +190,7 @@

        Functions

        Get a string source and generate a quoted expression that can be evaluated by Elixir or compiled to a function.

        - Source + Source

        eval_file/3 @@ -197,7 +207,7 @@

        Examples

        #=> "foo baz"
        - Source + Source

        eval_string/3 @@ -210,7 +220,7 @@

        Examples

        #=> "foo baz"
        - Source + Source @@ -244,7 +254,7 @@

        Examples

        Sample.sample(1, 2) #=> "3"
        - Source + Source

        function_from_string/5 @@ -263,7 +273,7 @@

        Examples

        Sample.sample(1, 2) #=> "3"
        - Source + Source diff --git a/docs/Elixir.Builtin.html b/docs/Elixir.Builtin.html index bbdecc91b..ac01b9b1b 100644 --- a/docs/Elixir.Builtin.html +++ b/docs/Elixir.Builtin.html @@ -558,6 +558,11 @@

        Macros summary

        case/2 +
      15. + + cond/1 + +
      16. def/2 @@ -758,11 +763,11 @@

        Examples

        Examples

        -
        apply fn(x) -> x * 2 end, [2]
        +
        apply fn x -> x * 2 end, [2]
         #=> 4
         
        - Source + Source

        apply/3 @@ -775,7 +780,7 @@

        Examples

        #=> [3,2,1]
        - Source + Source

        atom_to_binary/2 @@ -1408,13 +1413,14 @@

        Examples

        try do 1 + :foo -rescue: x in [BadargError] - IO.puts "that was expected" - raise x +rescue + x in [BadargError] -> + IO.puts "that was expected" + raise x end
        - Source + Source

        raise/2 @@ -1435,7 +1441,7 @@

        Examples

        raise ArgumentError, message: "Sample"
         
        - Source + Source

        round/1 @@ -1471,12 +1477,11 @@

        Examples

        child = spawn(fn -> current <- { Process.self, 1 + 2 } end) receive -match: { ^child, 3 } - IO.puts "Received 3 back" + { ^child, 3 } -> IO.puts "Received 3 back" end
        - Source + Source

        spawn/3 @@ -1492,7 +1497,7 @@

        Examples

        spawn(SomeModule, :function, [1,2,3])
         
        - Source + Source

        spawn_link/1 @@ -1507,12 +1512,12 @@

        Examples

        child = spawn_link(fn -> current <- { Process.self, 1 + 2 } end) receive -match: { ^child, 3 } - IO.puts "Received 3 back" + { ^child, 3 } -> + IO.puts "Received 3 back" end
        - Source + Source

        spawn_link/3 @@ -1528,7 +1533,7 @@

        Examples

        spawn_link(SomeModule, :function, [1,2,3])
         
        - Source + Source

        term_to_binary/1 @@ -1540,7 +1545,7 @@

        Examples

        to a file in an efficient way, or sending an Erlang term to some type of communications channel not supported by distributed Erlang.

        - Source + Source

        term_to_binary/2 @@ -1554,21 +1559,21 @@

        Examples

        for more details
      17. - Source + Source

        throw/1

        A non-local return from a function. Check try/2 for more information.

        - Source + Source

        tl/1

        Returns the tail of a list. Raises ArgumentError if the list is empty.

        - Source + Source

        trunc/1 @@ -1581,21 +1586,21 @@

        Examples

        trunc(5.5) #=> 5
         
        - Source + Source

        tuple_size/1

        Returns the size of a tuple.

        - Source + Source

        tuple_to_list/1

        Converts a tuple to a list.

        - Source + Source
        @@ -1618,7 +1623,7 @@

        Examples

        !false #=> true !nil #=> true

        - Source + Source

        !=/2 @@ -1676,7 +1681,7 @@

        Examples

        this operator accepts any expression as arguments, not only booleans, however it is not allowed in guards.

        - Source + Source

        */2 @@ -1822,7 +1827,7 @@

        Examples

        x #=> "bar"
        - Source + Source

        ==/2 @@ -1902,7 +1907,7 @@

        Examples

        %B(f#{o}o) #=> "f\#{o}o"
        - Source + Source

        __C__/2 @@ -1916,7 +1921,7 @@

        Examples

        %C(f#{o}o) #=> 'f\#{o}o'
        - Source + Source

        __b__/2 @@ -1930,7 +1935,7 @@

        Examples

        %b(f#{:o}o) #=> "foo"
        - Source + Source

        __c__/2 @@ -1944,7 +1949,7 @@

        Examples

        %c(f#{:o}o) #=> 'foo'
        - Source + Source

        __r__/2 @@ -1956,7 +1961,7 @@

        Examples

        Regex.match? %r(foo), "foo"  #=> true
         
        - Source + Source

        access/2 @@ -1986,7 +1991,7 @@

        Examples

        access a, 1 #=> :a
        - Source + Source

        and/2 @@ -2013,7 +2018,7 @@

        Examples

        atom_to_binary :my_atom #=> "my_atom"
         
        - Source + Source

        binary_to_atom/1 @@ -2027,7 +2032,7 @@

        Examples

        binary_to_atom "my_atom" #=> :my_atom
         
        - Source + Source

        binary_to_existing_atom/1 @@ -2041,7 +2046,7 @@

        Examples

        binary_to_existing_atom "my_atom" #=> :my_atom
        - Source + Source

        case/2 @@ -2051,10 +2056,9 @@

        Examples

        Examples

        case thing do
        -match: { :selector, i, value } when is_integer(i)
        -  value
        -match: value
        -  value
        +  { :selector, i, value } when is_integer(i) ->
        +    value
        +  value -> value
         end
         
        @@ -2068,8 +2072,7 @@

        Examples

        i = 1
         case 10 do
        -match: i
        -  i * 2
        +  i -> i * 2
         end
         
        @@ -2079,8 +2082,7 @@

        Examples

        i = 1
         case 10 do
        -match: ^i
        -  i * 2
        +  ^i -> i * 2
         end
         
        @@ -2090,14 +2092,34 @@

        Examples

        of the clauses match:

        case thing do
        -match: { :selector, i, value } when is_integer(i)
        -  value
        -else:
        -  thing
        +  { :selector, i, value } when is_integer(i) ->
        +    value
        +  _ ->
        +    thing
        +end
        +
        +
        + Source +
        +

        + cond/1 +

        +

        Execute the first clause where the condition returns true, +raises an error otherwise.

        + +

        Examples

        + +
        cond do
        +  1 + 1 == 2 ->
        +    "This will never match"
        +  2 * 2 != 4 ->
        +    "Nor this"
        +  true ->
        +    "This will"
         end
         
        - Source + Source

        def/2 @@ -2155,7 +2177,7 @@

        Dynamic generation with atoms

        and the value as the value returned by the function:

        defmacro defkv(keywords) do
        -  Enum.map keywords, fn({k,v}) ->
        +  Enum.map keywords, fn {k,v} ->
             quote do
               def unquote(k).() do
                 unquote(v)
        @@ -2174,7 +2196,7 @@ 

        Dynamic generation with atoms

        because each entry k is a an atom and invoking def unquote(k)() would be invalid Elixir syntax.

        - Source + Source

        def/4 @@ -2212,7 +2234,7 @@

        Examples

        end
        - Source + Source

        defdelegate/2 @@ -2236,7 +2258,7 @@

        Examples

        #=> [3,2,1]
        - Source + Source

        defexception/4 @@ -2245,7 +2267,7 @@

        Examples

        The defined record must implement message/1 as API, otherwise an error is raised. Check exception.ex for examples.

        - Source + Source

        defimpl/3 @@ -2253,7 +2275,7 @@

        Examples

        Defines an implementation for the given protocol. See defprotocol/2 for examples.

        - Source + Source

        defmodule/2 @@ -2298,7 +2320,7 @@

        Dynamic names

        Elixir will accept any module name as long as the expression returns an atom.

        - Source + Source

        defoverridable/1 @@ -2307,7 +2329,7 @@

        Dynamic names

        An overridable function is lazily defined, allowing a developer to customize it.

        - Source + Source

        defp/2 @@ -2331,14 +2353,14 @@

        Examples

        In the example above, sum is private and accessing it through Foo.sum will raise an error.

        - Source + Source

        defp/4

        The same as def/4 but generates a private function.

        - Source + Source

        defprotocol/2 @@ -2451,7 +2473,7 @@

        Protocols + Records

        Finally, since records are simply tuples, one can add a default protocol implementation to any record by defining a default implementation for tuples.

        - Source + Source

        defrecord/4 @@ -2516,7 +2538,7 @@

        Documentation

        defrecord Config, [counter: 0, failures: []], moduledoc: "A simple record"
         
        - Source + Source

        destructure/2 @@ -2557,7 +2579,7 @@

        Examples

        the first value from the right side. Otherwise, it will raise a CaseClauseError.

        - Source + Source

        div/2 @@ -2571,7 +2593,7 @@

        Examples

        5 div 2 #=> 2
         
        - Source + Source

        elem/2 @@ -2584,12 +2606,12 @@

        Example

        tuple = { :foo, :bar, 3 } elem(tuple, 1) #=> :foo

        - Source + Source

        if/2

        -

        Provides an if macro. The macro expects the first argument to +

        Provides an if macro. This macro expects the first argument to be a condition and the rest are keywords arguments.

        One-liner examples

        @@ -2605,41 +2627,30 @@

        One-liner examples

        if(foo, do: bar, else: bar)
         
        -

        Key-value blocks examples

        +

        Blocks examples

        -

        When several expressions must be passed to if, the most appropriate -form is thorugh keywords blocks. The first example above would then -be translated to:

        +

        Elixir also allows you to pass a block to the if macro. The first +example above would be translated to:

        if foo do
           bar
         end
         
        -

        Notice that do/end becomes delimiters. The value given between -do/end becomes the expression given to as do:. The second example -would then translate do:

        +

        Notice that do/end becomes delimiters. The second example would +then translate do:

        if foo do
           bar
        -else:
        +else
           baz
         end
         
        -

        Notice that extra keys follows the regular else: form. You can also -add extra elsif: clauses:

        - -
        if foo do
        -  bar
        -elsif: some_condition
        -  bar + baz
        -else:
        -  baz
        -end
        -
        +

        If you want to compare more than two clauses, you can use the cond/1 +macro.

        - Source + Source

        in/2 @@ -2659,7 +2670,7 @@

        Examples

        x == 1 or x == 2 or x == 3
         
        - Source + Source

        inspect/1 @@ -2672,7 +2683,7 @@

        Examples

        #=> ":foo"
        - Source + Source

        is_exception/1 @@ -2685,7 +2696,7 @@

        Examples

        is_exception(1) #=> false
        - Source + Source

        is_record/2 @@ -2702,14 +2713,14 @@

        Examples

        is_record(Config.new, List) #=> false
        - Source + Source

        is_regex/1

        Check if the given argument is a regex.

        - Source + Source

        match?/2 @@ -2736,7 +2747,7 @@

        Examples

        Enum.filter list, match?({:a, x } when x < 2, &1)
        - Source + Source

        not/1 @@ -2775,12 +2786,12 @@

        Examples

        Examples

        receive do
        -match: { :selector, i, value } when is_integer(i)
        -  value
        -match: value when is_atom(value)
        -  value
        -else:
        -  IO.puts :standard_error, "Unexpected message received"
        +  { :selector, i, value } when is_integer(i) ->
        +    value
        +  value when is_atom(value) ->
        +    value
        +  _ ->
        +    IO.puts :standard_error, "Unexpected message received"
         end
         
        @@ -2790,19 +2801,20 @@

        Examples

        received after the specified period of time:

        receive do
        -match: { :selector, i, value } when is_integer(i)
        -  value
        -match: value when is_atom(value)
        -  value
        -else:
        -  IO.puts :standard_error, "Unexpected message received"
        -after: 5000
        -  IO.puts :standard_error, "No message in 5 seconds"
        +  { :selector, i, value } when is_integer(i) ->
        +    value
        +  value when is_atom(value) ->
        +    value
        +  _ ->
        +    IO.puts :standard_error, "Unexpected message received"
        +after
        +  5000 ->
        +    IO.puts :standard_error, "No message in 5 seconds"
         end
         

        The after clause can be specified even if there are no match clauses. -There are two special cases for the timout value given to after:

        +There are two special cases for the timout value given to after

        • :infinity - The process should wait indefinitely for a matching @@ -2811,7 +2823,7 @@

          Examples

          will occur immediately.

        - Source + Source

        rem/2 @@ -2825,7 +2837,7 @@

        Examples

        5 rem 2 #=> 1
         
        - Source + Source

        setelem/3 @@ -2838,7 +2850,7 @@

        Example

        tuple = { :foo, :bar, 3 } setelem(tuple, 1, :baz) #=> { :baz, :bar, 3 }

        - Source + Source

        to_binary/1 @@ -2852,7 +2864,7 @@

        Examples

        #=> "foo"
        - Source + Source

        to_char_list/1 @@ -2865,7 +2877,7 @@

        Examples

        #=> 'foo'
        - Source + Source

        try/1 @@ -2877,11 +2889,13 @@

        Examples

        try do
           do_something_that_may_fail(some_arg)
        -rescue: ArgumentError
        -  IO.puts "Invalid argument given"
        -catch: value
        -  IO.puts "caught #{value}"
        -after:
        +rescue
        +  ArgumentError ->
        +    IO.puts "Invalid argument given"
        +catch
        +  value ->
        +    IO.puts "caught #{value}"
        +after
           IO.puts "This is printed regardless if it failed or succeed"
         end
         
        @@ -2903,24 +2917,28 @@

        Rescue clauses

        try do
           UndefinedModule.undefined_function
        -rescue: UndefinedFunctionError
        +rescue
        +  UndefinedFunctionError -> nil
         end
         
         try do
           UndefinedModule.undefined_function
        -rescue: [UndefinedFunctionError]
        +rescue
        +  [UndefinedFunctionError] -> nil
         end
         
         # rescue and assign to x
         try do
           UndefinedModule.undefined_function
        -rescue: x in [UndefinedFunctionError]
        +rescue
        +  x in [UndefinedFunctionError] -> nil
         end
         
         # rescue all and assign to x
         try do
           UndefinedModule.undefined_function
        -rescue: x
        +rescue
        +  x -> nil
         end
         
        @@ -2935,8 +2953,8 @@

        Variable visibility

        x = 1 do_something_that_may_fail(same_arg) :ok -catch: _, _ - :failed +catch + _ | _ -> :failed end x #=> Cannot access `x` @@ -2952,21 +2970,22 @@

        Catching exits and Erlang errors

        try do
           exit(1)
        -catch: :exit, 1
        -  IO.puts "Exited with 1"
        +catch
        +  :exit, 1 -> IO.puts "Exited with 1"
         end
         
         try do
           error(:sample)
        -catch: :error, :sample
        -  IO.puts "sample error"
        +catch
        +  :error, :sample ->
        +    IO.puts "sample error"
         end
         

        Although the second form should be avoided in favor of raise/rescue control mechanisms.

        - Source + Source

        unless/2 @@ -2975,7 +2994,7 @@

        Catching exits and Erlang errors

        unless a value evalutes to true. Check if for examples and documentation.

        - Source + Source

        use/2 @@ -3008,7 +3027,7 @@

        Examples

        end
        - Source + Source

        var!/1 @@ -3052,7 +3071,7 @@

        Examples

        this operator accepts any expression as arguments, not only booleans, however it is not allowed in guards.

        - Source + Source diff --git a/docs/Elixir.SpecialForms.html b/docs/Elixir.SpecialForms.html index 55be023a9..5c165b99d 100644 --- a/docs/Elixir.SpecialForms.html +++ b/docs/Elixir.SpecialForms.html @@ -227,7 +227,7 @@

        Examples

        Examples

        -
        sum = fn(x, y, do: x + y)
        +
        sum = fn(x, y) -> x + y end
         sum.(1, 2) #=> 3
         
        @@ -238,7 +238,7 @@

        Examples

        it is recommend to use it only with the stab operator in order to avoid ambiguity. For example, consider this case:

        -
        Enum.map [1,2,3], fn(x) ->
        +
        Enum.map [1,2,3], fn x ->
           x * 2
         end
         
        @@ -260,10 +260,10 @@

        Function with multiple clauses

        as all clauses expects the same number of arguments:

        fun = fn do
        -match: x, y when y < 0
        -  x - y
        -match: x, y
        -  x + y
        +  x, y when y < 0 ->
        +    x - y
        +  x, y ->
        +    x + y
         end
         
         fun.(10, -10) #=> 20
        @@ -353,9 +353,9 @@ 

        Example

         defmacro is_exception(thing) do
            quote do
        -     in_guard do
        +     quote do
                is_tuple(unquote(thing)) and elem(unquote(thing), 2) == :__exception__
        -     else:
        +     else
                result = unquote(thing)
                is_tuple(result) and elem(result, 2) == :__exception__
              end
        @@ -447,10 +447,10 @@ 

        Examples

        list = [1,2,3]
         
         loop list, [] do
        -match: [h|t], acc
        -  recur t, [h*2|acc]
        -match: [], acc
        -  acc
        +  [h|t], acc ->
        +    recur t, [h*2|acc]
        +  [], acc ->
        +    acc
         end
         #=> [6,4,2]
         
        @@ -507,7 +507,7 @@

        Macro literals

        2.0 #=> Floats [1,2] #=> Lists "binaries" #=> Binaries -{key, value} #=> Key-value pairs (i.e. a tuple with two elements) +{key, value} #=> Tuple with two elements

        Hygiene

        @@ -526,7 +526,7 @@

        Hygiene

        a = 10 Hygiene.no_interference -a # => 10 +a #=> 10

        In the example above, a returns 10 even if the macro @@ -545,15 +545,15 @@

        Hygiene

        a = 10 NoHygiene.interference -a # => 11 +a #=> 11

        Notice that references are not hygienic in Elixir unless you explicitly access it via MAIN to the reference name.

        quote do
        -  __MAIN__.Foo # => Access the root Foo
        -  Foo   # => Access the Foo reference in the current
        +  __MAIN__.Foo #=> Access the root Foo
        +  Foo   #=> Access the Foo reference in the current
                      module (if any is set), then fallback to root
         end
         
        diff --git a/docs/Enum.Iterator.HashDict.Record.html b/docs/Enum.Iterator.HashDict.Record.html index e4e8337c8..2be1f424f 100644 --- a/docs/Enum.Iterator.HashDict.Record.html +++ b/docs/Enum.Iterator.HashDict.Record.html @@ -29,7 +29,7 @@

        - Source + Source @@ -57,7 +57,7 @@

        Functions

        iterator/1

        - Source + Source diff --git a/docs/Enum.Iterator.List.html b/docs/Enum.Iterator.List.html index 202d5db11..dd842b6da 100644 --- a/docs/Enum.Iterator.List.html +++ b/docs/Enum.Iterator.List.html @@ -29,7 +29,7 @@

        - Source + Source @@ -57,7 +57,7 @@

        Functions

        iterator/1

        - Source + Source diff --git a/docs/Enum.Iterator.Orddict.Record.html b/docs/Enum.Iterator.Orddict.Record.html index 658e0f7a9..44ef38382 100644 --- a/docs/Enum.Iterator.Orddict.Record.html +++ b/docs/Enum.Iterator.Orddict.Record.html @@ -29,7 +29,7 @@

        - Source + Source @@ -57,7 +57,7 @@

        Functions

        iterator/1

        - Source + Source diff --git a/docs/Enum.OrdIterator.List.html b/docs/Enum.OrdIterator.List.html index c9d72dbc0..a77fe873f 100644 --- a/docs/Enum.OrdIterator.List.html +++ b/docs/Enum.OrdIterator.List.html @@ -29,7 +29,7 @@

        - Source + Source @@ -62,13 +62,13 @@

        Functions

        iterator/1

        - Source + Source

        to_list/2

        - Source + Source
        diff --git a/docs/Enum.OrdIterator.Orddict.Record.html b/docs/Enum.OrdIterator.Orddict.Record.html index c325e7244..c7ae76601 100644 --- a/docs/Enum.OrdIterator.Orddict.Record.html +++ b/docs/Enum.OrdIterator.Orddict.Record.html @@ -29,7 +29,7 @@

        - Source + Source @@ -62,13 +62,13 @@

        Functions

        iterator/1

        - Source + Source

        to_list/2

        - Source + Source
        diff --git a/docs/Enum.html b/docs/Enum.html index b60edc78e..f550aecf9 100644 --- a/docs/Enum.html +++ b/docs/Enum.html @@ -32,7 +32,7 @@

        flavours. If a given collection implements the mentioned protocol (like list, for instance), you can do

        -
        Enum.map [1,2,3], fn(x, do: x * 2)
        +
        Enum.map [1,2,3], fn(x) -> x * 2 end
         

        Depending on the type of the collection, the user-provided function will @@ -185,10 +185,10 @@

        Functions

        Examples

        -
        Enum.all? [2,4,6], fn(x, do: rem(x, 2) == 0)
        +
        Enum.all? [2,4,6], fn(x) -> rem(x, 2) == 0 end
         #=> true
         
        -Enum.all? [2,3,4], fn(x, do: rem(x, 2) == 0)
        +Enum.all? [2,3,4], fn(x) -> rem(x, 2) == 0 end
         #=> false
         
        @@ -209,10 +209,10 @@

        Examples

        Examples

        -
        Enum.any? [2,4,6], fn(x, do: rem(x, 2) == 1)
        +
        Enum.any? [2,4,6], fn(x) -> rem(x, 2) == 1 end
         #=> false
         
        -Enum.any? [2,3,4], fn(x, do: rem(x, 2) == 1)
        +Enum.any? [2,3,4], fn(x) -> rem(x, 2) == 1 end
         #=> true
         
        @@ -248,7 +248,7 @@

        Examples

        Examples

        -
        Enum.drop_while [1,2,3,4,5], fn(x, do: x < 3)
        +
        Enum.drop_while [1,2,3,4,5], fn(x) -> x < 3 end
         #=> [3,4,5]
         
        @@ -262,7 +262,7 @@

        Examples

        Examples

        -
        Enum.each ['some', 'example'], fn(x, do: IO.puts x)
        +
        Enum.each ['some', 'example'], fn(x) -> IO.puts x end
         
        Source @@ -288,7 +288,7 @@

        Examples

        Examples

        -
        Enum.filter [1, 2, 3], fn(x, do: rem(x, 2) == 0)
        +
        Enum.filter [1, 2, 3], fn(x) -> rem(x, 2) == 0 end
         #=> [2]
         
        @@ -301,7 +301,7 @@

        Examples

        Examples

        -
        Enum.filter_map [1, 2, 3], fn(x, do: rem(x, 2) == 0), &1 * 2
        +
        Enum.filter_map [1, 2, 3], fn(x) -> rem(x, 2) == 0 end, &1 * 2
         #=> [4]
         
        @@ -315,14 +315,14 @@

        Examples

        Examples

        -
        Enum.find [2,4,6], fn(x, do: rem(x, 2) == 1)
        -# => nil
        +
        Enum.find [2,4,6], fn(x) -> rem(x, 2) == 1 end
        +#=> nil
         
        -Enum.find [2,4,6], 0, fn(x, do: rem(x, 2) == 1)
        -# => 0
        +Enum.find [2,4,6], 0, fn(x) -> rem(x, 2) == 1 end
        +#=> 0
         
        -Enum.find [2,3,4], fn(x, do: rem(x, 2) == 1)
        -# => 3
        +Enum.find [2,3,4], fn(x) -> rem(x, 2) == 1 end
        +#=> 3
         
        Source @@ -335,14 +335,14 @@

        Examples

        ## Examples

        -
          Enum.find_value [2,4,6], fn(x, do: rem(x, 2) == 1)
        -  # => nil
        +
          Enum.find_value [2,4,6], fn(x) -> rem(x, 2) == 1 end
        +  #=> nil
         
        -  Enum.find_value [2,4,6], 0, fn(x, do: rem(x, 2) == 1)
        -  # => 0
        +  Enum.find_value [2,4,6], 0, fn(x) -> rem(x, 2) == 1 end
        +  #=> 0
         
        -  Enum.find_value [2,3,4], fn(x, do: rem(x, 2) == 1)
        -  # => true
        +  Enum.find_value [2,3,4], fn(x) -> rem(x, 2) == 1 end
        +  #=> true
         
        Source @@ -377,10 +377,10 @@

        Examples

        Examples

        -
        Enum.map [1, 2, 3], fn(x, do: x * 2)
        +
        Enum.map [1, 2, 3], fn(x) -> x * 2 end
         #=> [2, 4, 6]
         
        -Enum.map [a: 1, b: 2], fn({k, v}, do: { k, -v })
        +Enum.map [a: 1, b: 2], fn({k, v}) -> { k, -v } end
         #=> [a: -1, b: -2]
         
        @@ -420,7 +420,7 @@

        Examples

        Examples

        -
        Enum.map_reduce [1, 2, 3], 0, fn(x, acc, do: { x * 2, x + acc })
        +
        Enum.map_reduce [1, 2, 3], 0, fn(x, acc) -> { x * 2, x + acc } end
         #=> { [2, 4, 6], 6 }
         
        @@ -435,7 +435,7 @@

        Examples

        Examples

        -
        Enum.partition [1, 2, 3], fn(x, do: rem(x, 2) == 0)
        +
        Enum.partition [1, 2, 3], fn(x) -> rem(x, 2) == 0 end
         #=> { [2], [1,3] }
         
        @@ -462,7 +462,7 @@

        Examples

        Examples

        -
        Enum.reduce [1, 2, 3], 0, fn(x, acc, do: x + acc)
        +
        Enum.reduce [1, 2, 3], 0, fn(x, acc) -> x + acc end
         #=> 6
         
        @@ -491,7 +491,7 @@

        Examples

        Examples

        -
        Enum.split_with [1,2,3,4], fn(x) -> x == 2 end
        +
        Enum.split_with [1,2,3,4], fn x -> x == 2 end
         #=> { [1], [2, 3, 4] }
         
        @@ -520,7 +520,7 @@

        Examples

        Examples

        -
        Enum.take_while [1,2,3], fn(x, do: x < 3)
        +
        Enum.take_while [1,2,3], fn(x) -> x < 3 end
         #=> [1, 2]
         
        @@ -534,7 +534,7 @@

        Examples

        Examples

        -
        Enum.times 3, fn(x, do: IO.puts x)
        +
        Enum.times 3, fn(x) -> IO.puts x end
         1
         2
         3
        @@ -551,7 +551,7 @@ 

        Examples

        Examples

        -
        Enum.times 5, 0, fn(x, acc, do: acc + x)
        +
        Enum.times 5, 0, fn(x, acc) -> acc + x end
         #=> 15
         
        diff --git a/docs/ExUnit.Assertions.html b/docs/ExUnit.Assertions.html index a120ab4fd..12a635699 100644 --- a/docs/ExUnit.Assertions.html +++ b/docs/ExUnit.Assertions.html @@ -191,7 +191,7 @@

        Examples

        assert_empty [1, 2]
        - Source + Source

        assert_error/2 @@ -205,7 +205,7 @@

        Examples

        end
        - Source + Source

        assert_exit/2 @@ -219,7 +219,7 @@

        Examples

        end
        - Source + Source

        assert_in_delta/4 @@ -232,7 +232,7 @@

        Examples

        assert_in_delta 10, 15, 4
        - Source + Source

        assert_member/3 @@ -245,14 +245,14 @@

        Examples

        assert_member "foo", ["foo", "bar"]
         
        - Source + Source

        assert_nil/2

        Asserts the value is nil.

        - Source + Source

        assert_raise/2 @@ -266,7 +266,7 @@

        Examples

        end
        - Source + Source

        assert_raise/3 @@ -280,7 +280,7 @@

        Examples

        end
        - Source + Source

        assert_throw/2 @@ -294,7 +294,7 @@

        Examples

        end
        - Source + Source

        flunk/1 @@ -306,7 +306,7 @@

        Examples

        flunk "This should raise an error"
         
        - Source + Source

        refute/2 @@ -318,7 +318,7 @@

        Examples

        refute false
         
        - Source + Source

        refute_empty/2 @@ -331,7 +331,7 @@

        Examples

        refute_empty [1, 2]
        - Source + Source

        refute_in_delta/4 @@ -344,7 +344,7 @@

        Examples

        refute_in_delta 10, 11, 2
        - Source + Source

        refute_member/3 @@ -357,14 +357,14 @@

        Examples

        refute_member "baz", ["foo", "bar"]
         
        - Source + Source

        refute_nil/2

        Asserts the value is not nil.

        - Source + Source
        @@ -403,7 +403,7 @@

        Examples

        assert_match { 1, _, 3 }, { 1, 2, 3 }
         
        - Source + Source

        refute_match/2 @@ -416,7 +416,7 @@

        Examples

        refute_match { 1, _, 3 }, { 1, 2, 3 }
         
        - Source + Source diff --git a/docs/HashDict.html b/docs/HashDict.html index ebeadcb38..14c4d4bd0 100644 --- a/docs/HashDict.html +++ b/docs/HashDict.html @@ -96,7 +96,7 @@

        Examples

        Examples

        -
        Dict.Common.new ["a", "b"], fn(x) -> {x, x} end
        +
        Dict.Common.new ["a", "b"], fn x -> {x, x} end
         #=> ["a": "a", "b": "b"]
         
        diff --git a/docs/Keyword.html b/docs/Keyword.html index 6fcf14683..83a1ef8ec 100644 --- a/docs/Keyword.html +++ b/docs/Keyword.html @@ -238,7 +238,7 @@

        Examples

        Examples

        -
        Keyword.merge [a: 1, b: 2], [a: 3, d: 4], fn(_k, v1, v2) ->
        +
        Keyword.merge [a: 1, b: 2], [a: 3, d: 4], fn _k, v1, v2 ->
           v1 + v2
         end
         #=> [a:4, b:2, d: 4]
        @@ -276,7 +276,7 @@ 

        Examples

        Examples

        -
        Keyword.new [:a, :b], fn(x) -> {x,x} end
        +
        Keyword.new [:a, :b], fn x -> {x,x} end
         #=> [a: :a, b: :b]
         
        diff --git a/docs/List.html b/docs/List.html index 874e7e3ed..33abcc599 100644 --- a/docs/List.html +++ b/docs/List.html @@ -274,10 +274,10 @@

        Examples

        Examples

        List.flatten [1,[[2],3]]
        -# => [1,2,3]
        +#=> [1,2,3]
         
         List.flatten [1,[[2],3]], [4,5]
        -# => [1,2,3,4,5]
        +#=> [1,2,3,4,5]
         
        Source @@ -296,10 +296,10 @@

        Examples

        Examples

        -
        List.foldl [5,5], 10, fn(x, acc) -> x + acc end
        +
        List.foldl [5,5], 10, fn x, acc -> x + acc end
         #=> 20
         
        -List.foldl [1,2,3,4], 0, fn(x, acc) -> x - acc end
        +List.foldl [1,2,3,4], 0, fn x, acc -> x - acc end
         #=> 2
         
        @@ -313,7 +313,7 @@

        Examples

        Examples

        -
        List.foldr [1,2,3,4], 0, fn(x, acc) -> x - acc end
        +
        List.foldr [1,2,3,4], 0, fn x, acc -> x - acc end
         #=> -2
         
        @@ -473,7 +473,7 @@

        Examples

        Examples

        -
        List.sort [3, 4, 2, 1, 7], fn(a, b) -> b <= a end
        +
        List.sort [3, 4, 2, 1, 7], fn a, b -> b <= a end
         #=> [7, 4, 3, 2, 1]
         
        @@ -507,7 +507,7 @@

        Examples

        #=> [[1, 2, 3], [:a, :b, :c]]
        - Source + Source

        wrap/1 @@ -521,7 +521,7 @@

        Examples

        List.wrap [1,2,3] #=> [1,2,3]
         
        - Source + Source

        zip/1 @@ -537,7 +537,7 @@

        Examples

        #=> [{1, 3, 5}]
        - Source + Source

        zip/2 @@ -555,7 +555,7 @@

        Examples

        #=> [{1, 4}, {2, 5}]
        - Source + Source diff --git a/docs/Orddict.html b/docs/Orddict.html index 31bc677de..d22b23243 100644 --- a/docs/Orddict.html +++ b/docs/Orddict.html @@ -97,7 +97,7 @@

        Examples

        Examples

        -
        Dict.Common.new ["a", "b"], fn(x) -> {x, x} end
        +
        Dict.Common.new ["a", "b"], fn x -> {x, x} end
         #=> ["a": "a", "b": "b"]
         
        diff --git a/docs/Regex.html b/docs/Regex.html index 2862a2fe5..ae217c3d0 100644 --- a/docs/Regex.html +++ b/docs/Regex.html @@ -235,7 +235,7 @@

        Examples

        Regex.replace(%r/(b)/, "abc", "[\\1]") #=> "a[b]c"
        - Source + Source

        replace_all/3 @@ -244,7 +244,7 @@

        Examples

        expressions matches in the string. Please read replace/3 for documentation and examples.

        - Source + Source

        run/2 @@ -295,7 +295,7 @@

        Examples

        Split the given target in the number of parts specified. If no ammount of parts is given, it defaults to :infinity.

        - Source + Source
        diff --git a/docs/System.html b/docs/System.html index 8bf5765ed..01a799629 100644 --- a/docs/System.html +++ b/docs/System.html @@ -172,7 +172,7 @@

        Functions

        See http://www.erlang.org/doc/man/os.html#getpid-0 for more info.

        - Source + Source

        put_env/1 @@ -180,21 +180,21 @@

        Functions

        Sets a new value for each environment variable corresponding to each key in dict.

        - Source + Source

        put_env/2

        Sets a new value for the environment variable varname.

        - Source + Source

        stacktrace/0

        Get the stacktrace.

        - Source + Source

        version/0 diff --git a/docs/modules_list.html b/docs/modules_list.html index 963699f18..c4b10dcac 100644 --- a/docs/modules_list.html +++ b/docs/modules_list.html @@ -699,6 +699,13 @@

        Elixir.Builtin +
      18. + + cond/1 + + Elixir.Builtin +
      19. +
      20. def/2 From cc46329eadc7ccfe6711c1b53bcfeadd5b181977 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Fri, 18 May 2012 19:53:08 +0200 Subject: [PATCH 145/437] Fix typo --- _posts/2012-05-06-web-framework-2.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_posts/2012-05-06-web-framework-2.markdown b/_posts/2012-05-06-web-framework-2.markdown index 048daca35..2450a646e 100644 --- a/_posts/2012-05-06-web-framework-2.markdown +++ b/_posts/2012-05-06-web-framework-2.markdown @@ -178,7 +178,7 @@ When the macro is called, we receive all clauses under the `do` key with each HT { :"->", line, [{[:get], }, {[:post], }] } -In our `multo_handle` macro signature, we pattern match against the expression above and get all blocks of code, which then we emit a function definition with the corresponding arguments. The code for each of the code blocks is similar to the GET and POST handlers we have defined earlier. +In our `multi_handle` macro signature, we pattern match against the expression above and get a list with the blocks of code. Then we loop through this list emitting a function definition with the corresponding arguments. The code for each of the code blocks is similar to the GET and POST handlers we have defined earlier. Finally, let's test it in `iex`: From 1ada57af738cb9d1f551a7233401270f0c71480b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sun, 20 May 2012 22:33:30 +0200 Subject: [PATCH 146/437] Add a section about record pattern matching --- getting_started/4.markdown | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/getting_started/4.markdown b/getting_started/4.markdown index 4b748eb79..3735cfbb1 100644 --- a/getting_started/4.markdown +++ b/getting_started/4.markdown @@ -32,7 +32,24 @@ Internally, a record is simply a tuple where the first element is always the rec iex> FileInfo.new {FileInfo, nil, nil} -### 4.1.1 Default based functions +### 4.1.1 Pattern matching + +Elixir also allows one to pattern match against records. For example, imagine we want to check if a file was accessed or not based on the `File.Info` record above, we could implement is as follow: + + def was_accessed?(File.Info[accesses: 0]), do: true + def was_accessed?(File.Info[]), do: false + +The first clause will only match if a `File.Info` record is given and the `accesses` field is equal to zero. If instead we would like to assign the value of `accesses` to a variable, we could write: + + def was_accessed?(File.Info[accesses: accesses]), do: accesses == 0 + +This syntax can also be used to create new records: + + file_info = File.Info[accesses: 0] + +As we are going to see in the next section (4.2), this "brackets syntax" is powered by the access protocol and, in the records case, it is handled at compilation time which provides faster access and creation times compared to `file_info.accesses` and `File.Info.new`. + +### 4.1.2 Default based functions Depending on the default value, Elixir will define helpers to interact with the record. For example, the test framework that ships with Elixir, called ExUnit, defines a record which keeps track of how many tests were executed and the failures that happened. The record definition is similar to: From b47d2b47f8310a314c47908f3dcb64aa0f948ae5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Wed, 23 May 2012 09:31:27 +0200 Subject: [PATCH 147/437] Add info about @file --- getting_started/3.markdown | 1 + 1 file changed, 1 insertion(+) diff --git a/getting_started/3.markdown b/getting_started/3.markdown index 49e51df2f..5511c63af 100644 --- a/getting_started/3.markdown +++ b/getting_started/3.markdown @@ -258,6 +258,7 @@ Elixir has a handful of reserved data attributes. The following are currently fu * `@compile` - provides options for the module compilation; * `@moduledoc` - provides documentation for the current module; * `@doc` - provides documentation for the function that follows it; +* `@file` - changes the filename that the next defined function will appear in stacktraces; * `@on_load` - provides a function, with arity 0, that will be invoked whenever the module is loaded. The function has to return `:ok`, otherwise the loading of the module is aborted; The following ones are also reserved by Elixir (as they have special semantics to the Erlang VM) but not currently supported (if you need support for any of these in your current projects, please open a ticket on the issue tracker): From aa51b130a302caf0cb0da07b509e212e05e6cf2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Thu, 24 May 2012 19:44:58 +0200 Subject: [PATCH 148/437] Improve installation instructions --- docs/ExUnit.html | 2 +- getting_started/1.markdown | 36 +++++++++++++++++++++++------------- getting_started/3.markdown | 12 ++++++------ getting_started/4.markdown | 2 +- 4 files changed, 31 insertions(+), 21 deletions(-) diff --git a/docs/ExUnit.html b/docs/ExUnit.html index a31780bf0..df55f25d1 100644 --- a/docs/ExUnit.html +++ b/docs/ExUnit.html @@ -53,7 +53,7 @@

        Example

        using elixir from command line. Assuming you named your file assertion_test.exs, you can run it as:

        -
        bin/elixir assertion_test.exs
        +
        elixir assertion_test.exs
         

        Assertions

        diff --git a/getting_started/1.markdown b/getting_started/1.markdown index 08a766844..8c6a547a5 100644 --- a/getting_started/1.markdown +++ b/getting_started/1.markdown @@ -12,11 +12,17 @@ Keep in mind that Elixir is still in development and sometimes you may get poorl ## 1.1 Installation -The only pre-requisite for Elixir is Erlang, version R15B later. You can check your Erlang version by calling `erl` in the command line. You will see some information as follow: +The only pre-requisite for Elixir is Erlang, version R15B later. You can find the source code for [Erlang here](http://www.erlang.org/download.html) or use one of the [precompiled packages](http://www.erlang-solutions.com/section/132/erlang-otp-packages). + +For Windows developers, we recommend the precompiled package. Those on the UNIX platform can probably get Erlang installed via one of the many package management tools. + +After Erlang is installed, you should be able to open up the command line (or command prompt) and check the Erlang version by typing `erl`. You will see some information as follow: Erlang R15B (erts-5.8.4) [source] [64-bit] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false] -After getting Erlang in your machine, you can install Elixir via distributions or manually. +Notice that depending on how you installed Erlang, it will not add Erlang binaries to your environment. Be sure to have Erlang binaries in your [PATH](http://en.wikipedia.org/wiki/Environment_variable), otherwise Elixir won't work! + +After Erlang is up and running, it is time to install Elixir. You can do that via Distributions, Precompiled package or Compiling from Source. ### 1.1.1 Distributions @@ -24,9 +30,19 @@ Elixir is available in some distributions, they are: * [Homebrew for Mac OS X via this gist](https://gist.github.com/1955470) -If you don't use any of the distributions above, don't worry! Continue reading for manual install steps. +If you don't use any of the distributions above, don't worry! We also provide a precompiled package! + +### 1.1.2 Precompiled package + +Elixir provides a package file with its compiled source for every release. You can grab the latest in the downloads page: + +https://github.com/elixir-lang/elixir/downloads -### 1.1.2 Manual install +After unzip-ing the package, you are ready to run the `elixir` and `iex` commands from the `bin` directory. It is recommended that you also add Elixir's bin path to your PATH environment variable to ease development. In a UNIX system, that can be achieved with: + + export PATH="$PATH:/path/to/elixir/bin" + +### 1.1.3 Compiling from source You can download and compile Elixir in few steps: @@ -34,19 +50,13 @@ You can download and compile Elixir in few steps: $ cd elixir $ make test - $ bin/elixir -v - Elixir 0.5.0.dev - If tests pass, you are ready to go. Otherwise, feel free to open an issue [in the issues tracker on Github](https://github.com/elixir-lang/elixir). -> Note: if you are planning to develop projects with Elixir and manually installed it, we recommend adding the bin directory in Elixir git repository to your PATH for easier access to binaries. -> -> export PATH="$PATH:/path/to/elixir/bin" -> - ## 1.2 Interactive mode -We can start Elixir interactive mode by running `bin/iex` in the same directory you compiled Elixir or by simply running `iex` if you installed it from a distribution. In interactive mode, we can type any Elixir expression. Let's warm up with some basic arithmetic expressions: +When you install Elixir, you will have three new executables: `iex`, `elixir` and `elixirc`. If you compiled Elixir from source or you are using a packaged version, can find these inside the `bin` directory. + +For now, let's start by running `iex` which stands for Interactive Elixir. In interactive mode, we can type any Elixir expression and get its result straight away. Let's warm up with some basic arithmetic expressions: iex> 1 + 1 2 diff --git a/getting_started/3.markdown b/getting_started/3.markdown index 5511c63af..05d5e998a 100644 --- a/getting_started/3.markdown +++ b/getting_started/3.markdown @@ -34,11 +34,11 @@ Most of the times it is convenient to write modules into files so they can be co end end -This file can be compiled using `bin/elixirc` (or simply `elixirc` if you installed Elixir via a distribution): +This file can be compiled using `elixirc` (remember, if you installed Elixir from a packaged or compiled it, `elixirc` will be inside the bin directory): - bin/elixirc math.ex + elixirc math.ex -Which will then generate a file named `Math.beam` containing the bytecode for the defined module. Now, if we start `bin/iex` again, our module definition will be available (considering `bin/iex` is being started in the same directory the bytecode file is): +Which will then generate a file named `Math.beam` containing the bytecode for the defined module. Now, if we start `iex` again, our module definition will be available (considering `iex` is being started in the same directory the bytecode file is): iex> Math.sum(1, 2) 3 @@ -51,9 +51,9 @@ Elixir projects are usually organized into three directories: In many cases, since the bytecode is in `ebin`, you need to explicitly tell Elixir to lookup for code in the `ebin` directory: - bin/iex -pa ebin + iex -pa ebin -Where `-pa` stands for `path append`. The same option can also be passed to `elixir` and `elixirc` executables. You can execute `bin/elixir` and `bin/elixirc` without arguments to get a list with all options. +Where `-pa` stands for `path append`. The same option can also be passed to `elixir` and `elixirc` executables. You can execute `elixir` and `elixirc` without arguments to get a list with all options. ## 3.2 Scripted mode @@ -69,7 +69,7 @@ Besides the Elixir file `.ex`, Elixir also supports `.exs` files for scripting. And execute it as: - bin/elixir math.exs + elixir math.exs The file will be compiled in memory and executed, printing 3 as result. No bytecode file will be created. diff --git a/getting_started/4.markdown b/getting_started/4.markdown index 3735cfbb1..569bcf8e5 100644 --- a/getting_started/4.markdown +++ b/getting_started/4.markdown @@ -26,7 +26,7 @@ Elixir will also define an `update_#{field}` function that accepts a function of file_info = file_info.update_accesses(fn(x) -> x + 1 end) file_info.accesses #=> 11 -Internally, a record is simply a tuple where the first element is always the record module name. We can check this by creating and printing a record in Interactive Elixir (`bin/iex`): +Internally, a record is simply a tuple where the first element is always the record module name. We can check this by creating and printing a record in Interactive Elixir (`iex`): iex> defrecord FileInfo, atime: nil, mtime: nil iex> FileInfo.new From d28f2fc88b18dea91767f9ed94c01acf94e36d44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Thu, 24 May 2012 21:10:08 +0200 Subject: [PATCH 149/437] Add crash course (based on @also's amazing work) --- crash-course.markdown | 772 +++++++++++++++++++++++++++++++++++++ getting_started/7.markdown | 4 +- 2 files changed, 774 insertions(+), 2 deletions(-) create mode 100644 crash-course.markdown diff --git a/crash-course.markdown b/crash-course.markdown new file mode 100644 index 000000000..713c1badb --- /dev/null +++ b/crash-course.markdown @@ -0,0 +1,772 @@ +--- +section: home +layout: default +--- + +# Erlang/Elixir Syntax: A Crash Course + +This is a quick introduction to the Elixir syntax for Erlang developers and vice-versa. It is the absolute minimum amount of knowledge you need in order to understand Erlang code, read the docs, sample code, etc. + +## Running Erlang code + +The fastest way to run some code is to launch the Erlang shell -- `erl`. Many code snippets on this page can be pasted directly into the shell. However, when you want to define a named function, Erlang expects it to be inside of a module, and modules have to be compiled. Here's a skeleton for a module: + +{% highlight erlang %} +-module(module_name). % you may use some other name +-compile(export_all). + +hello() -> + io:format("~s~n", ["Hello world!"]). +{% endhighlight %} + +Add your functions to it, save it to disk, run `erl` from the same directory and execute the `compile` command: + +{% highlight erlang %} +Eshell V5.9 (abort with ^G) +1> c(module_name). +ok +1> module_name:hello(). +Hello world! +ok +{% endhighlight %} + +You may keep the shell running while you're editing the file. Just don't forget to execute `c(module_name)` to load the latest changes. Note that the filename has to be the same as the one declared in the `-module()` directive, plus an extension `.erl`. + +## Running Elixir code + +Elixir too has an interactive shell called `iex`. Compiling Elixir code can be done with `elixirc` (which is similar to Erlang's `erlc`). Elixir also provides an executable named `elixir` to run Elixir code. The module defined above can be written in Elixir as: + +{% highlight elixir %} +# module_name.ex +defmodule ModuleName do + def hello do + IO.puts "Hello World" + end +end +{% endhighlight %} + +And compiled from `iex`: + +{% highlight iex %} +Interactive Elixir +iex> c("module_name.ex") +[ModuleName] +iex> ModuleName.hello +Hello world! +:ok +{% endhighlight %} + +## Notable differences + +This section goes over some of the syntactic differences between the two languages. + +### Operator Names + +Some operators are spelled differently. + + | Erlang | Elixir | Meaning | + ----------------------------------------------------------------------------- + | and | NOT AVAILABLE | Logical 'and', evaluates both arguments | + | andalso | and | Logical 'and', short-circuits | + | or | NOT AVAILABLE | Logical 'or', evaluates both arguments | + | orelse | or | Logical 'or', shirt-circuits | + | =:= | === | A match operator | + | =/= | !== | A negative match | + | /= | != | Not equals | + | =< | <= | Less than or equals | + | ! | <- | Send. See section _Processes_ below | + + +### Delimiters + +Erlang expressions are terminated with a dot `.` and comma `,` is used to evaluates multiple expressions within one context (in a function definition, for instance). In Elixir, expressions are delimited by a line break or a colon-comma `;`. + +**Erlang** + +{% highlight erlang %} +X = 2, Y = 3. +X + Y. +{% endhighlight %} + +**Elixir** + +{% highlight elixir %} +x = 2; y = 3 +x + y +{% endhighlight %} + +### Variable Names + +Variables in Erlang can only be assigned once. The Erlang shell provides a special command `f` that allows you to erase the binding of a variable or all variables at once. Elixir does not have this limitation. + +**Erlang** + +{% highlight erlang %} +Eshell V5.9 (abort with ^G) +1> X = 10. +10 +2> X = X + 1. +** exception error: no match of right hand side value 11 +3> X1 = X + 1. +11 +4> f(X). +ok +5> X = X1 * X1. +121 +6> f(). +ok +7> X. +* 1: variable 'X' is unbound +8> X1. +* 1: variable 'X1' is unbound +{% endhighlight %} + +**Elixir** + +{% highlight iex %} +iex> a = 1 +1 +iex> a = 2 +2 +{% endhighlight %} + +### Calling Functions + +Elixir allows you to omit parentheses in function calls, Erlang does not. + + | Erlang | Elixir | + -------------------------------------- + | some_function(). | some_function | + | sum(a, b) | sum a, b | + +### Module References + +Invoking a function from a module uses different syntax. In Erlang, you would write + +{% highlight erlang %} +orddict:new(). +{% endhighlight %} + +to invoke the `new` function from the `orddict` module. In Elixir, use the dot `.` in place of the colon `:` + +{% highlight elixir %} +Process.self +{% endhighlight %} + +**Note**. You may invoke Erlang functions in Elixir in one of two ways: + +{% highlight elixir %} +Erlang.lists.sort [3, 2, 1] +:lists.sort [3, 2,1] +{% endhighlight %} + +All of the Erlang's modules can be accessed in this manner. All of the Erlang built-ins reside in the `Erlang.erlang` (or `:erlang`) module. + + +## Data Types + +Erlang and Elixir have the same data types for the most part, but there is a number of differences. + +### Atoms + +In Erlang, an `atom` is any identifier that starts with a small letter, e.g. `ok`, `tuple`, `donut`. Identifiers that start with a capital letters are always treated as variable names. Elixir, on the other hand, uses the former for naming variables, and the latter are treated as module references. Atoms in Elixir always start with a colon `:`. + +**Erlang** + +{% highlight erlang %} +im_an_atom. +me_too. + +Im_a_var. +X = 10. +{% endhighlight %} + +**Elixir** + +{% highlight elixir %} +:im_an_atom +:me_too + +im_a_var +x = 10 + +Module # this is called a ref; Erlang does not have those +{% endhighlight %} + +It is also possible to create atoms that start with a character other than a lowercase letter. The syntax is different between the two languages: + +**Erlang** + +{% highlight erlang %} +is_atom(ok). %=> true +is_atom('0_ok'). %=> true +is_atom('Multiple words'). %=> true +is_atom(''). %=> true +{% endhighlight %} + +**Elixir** + +{% highlight elixir %} +is_atom :ok #=> true +is_atom :'ok' #=> true +is_atom :"Multiple words" #=> true +{% endhighlight %} + +### Binaries + +Elixir has a shortcut syntax for binaries. + +**Erlang** + +{% highlight erlang %} +is_list('Hello'). %=> false +is_list("Hello"). %=> true +is_binary(<<"Hello">>). %=> true +{% endhighlight %} + +**Elixir** +{% highlight elixir %} +is_list 'Hello' #=> true +is_binary "Hello" #=> true +is_binary <<"Hello">> #=> true +<<"Hello">> === "Hello" #=> true +{% endhighlight %} + +### Orddicts + +Orddicts in Erlang are created using either `orddict:new/0` or `orddict:from_list/1`. Elixir has a special syntax for this purpose: + +**Erlang** + +{% highlight erlang %} +Dict = orddict:new(), +Dict1 = orddict:store(key, 10, Dict), +Dict2 = orddict:store(another_key, 20, Dict1). +%=> [{another_key,20},{key,10}] + +Dict = orddict:from_list([{key, 10}, {another_key, 20}]). +%=> [{another_key,20},{key,10}] +{% endhighlight %} + +**Elixir** + +{% highlight elixir %} +dict = [key: 10, another_key: 20] +#=> [{:another_key,20},{:key,10}] +{% endhighlight %} + +### Records + +The syntax for records differs significantly between Erlang and Elixir. Please refer to [this section][0] in the Erlang book to read a detailed introduction to records in Erlang. And [this chapter][1] from Elixir's Getting Started guide provides a description of records in Elixir. + +[0]: http://learnyousomeerlang.com/a-short-visit-to-common-data-structures#records +[1]: http://elixir-lang.org/getting_started/4.html + +## Modules + +Each Erlang module lives in its own file which has the following structure: + +{% highlight erlang %} +-module(hello_module). +-export([fun/0, fun/1]). + +% A "Hello world" function +fun() -> + io:format('~s~n', ['Hello world!']). + +% This one works only with lists +fun(list) when is_list(list) -> + io:format('~s~n', list). + +% A private function +priv() -> + secret_info. +{% endhighlight %} + +Here we create a module named ``hello_module``. In it we define three functions, the first two of which are made available for other modules to call via the ``export`` directive at the top. It contains a list of functions, each of which is written in the format ``/``. Arity stands for the number of arguments. + +An equivalent code in Elixir: + +{% highlight elixir %} +defmodule HelloModule do + # A "Hello world" function + def fun do + IO.puts "Hello world!" + end + + # This one works only with lists + def fun(list) when is_list(list) do + IO.inspect list + end + + # A private function + defp priv do + :secret_info + end +end +{% endhighlight %} + +In Elixir, it is also possible to have multiple modules in one file, as well as nested modules: + +{% highlight elixir %} +defmodule HelloModule do + defmodule Utils do + def util do + IO.puts "Utilize" + end + + defp priv do + :cant_touch_this + end + end + + # More on this in the Records section + defrecord State, ponies: [:sally] + + def dummy do + :ok + end +end + +defmodule ByeModule do +end + +HelloModule.dummy +#=> :ok + +HelloModule.Utils.util +#=> "Utilize" + +HelloModule.Utils.priv +#=> ** (UndefinedFunctionError) undefined function: HelloModule.Utils.priv/0 + +HelloModule.State.new +#=> { HelloModule.State, [:sally] } +{% endhighlight %} + +## Function Syntax + +[This chapter][0] from the Erlang book provides a detailed description of pattern matching and function syntax in Erlang. Here, I'm briefly covering the main points and provide sample code both in Erlang and Elixir. + +[0]: http://learnyousomeerlang.com/syntax-in-functions + +### Pattern Matching + +Pattern matching in Elixir is based on Erlang implementation and in general very similar: + +**Erlang** + +{% highlight erlang %} +loop_through([h|t]) -> + io:format '~p~n', [h], + loop_through(t); + +loop_through([]) -> + ok. +{% endhighlight %} + +**Elixir** + +{% highlight elixir %} +def loop_through([h|t]) do + IO.inspect h + loop_through t +end + +def loop_through([]) do + :ok +end +{% endhighlight %} + +When defining a function with the same name multiple times, each such definition is called a **clause**. In Erlang, clauses always go side by side, separated by a semi-colon ``;``, the last clause is terminated by a dot ``.``. + +Elixir doesn't require punctuation to separate clause, each one looks like a standalone definition in Elixir. + +### Function Overloading + +Functions in Erlang and Elixir can be overloaded based on arity and guard expressions. + +**Erlang** + +{% highlight erlang %} +sum() -> 0; +sum(a) -> a; +sum(a, b) -> a + b; +sum(a, b, c) -> a + b + c. +{% endhighlight %} + +**Elixir** + +{% highlight elixir %} +def sum, do: 0 +def sum(a), do: a +def sum(a, b), do: a + b +def sum(a, b, c), do : a + b + c +{% endhighlight %} + +Guard expressions provide a concise way to define functions the accept a limited set of values based on some condition. + +**Erlang** + +{% highlight erlang %} +sum(A, B) when is_integer(A), is_integer(B) -> + A + B; + +sum(A, B) when is_list(A), is_list(B) -> + A ++ B; + +sum(A, B) when is_binary(A), is_binary(B) -> + <>. + +sum(1, 2). +%=> 3 + +sum([1], [2]). +%=> [1,2] + +sum("a", "b"). +%=> "ab" +{% endhighlight %} + +**Elixir** + +{% highlight elixir %} +def sum(a, b) when is_integer(a) and is_integer(b) do + a + b +end + +def sum(a, b) when is_list(a) and is_list(b) do + a ++ b +end + +def sum(a, b) when is_binary(a) and is_binary(b) do + a <> b +end + +sum 1, 2 +#=> 3 + +sum [1], [2] +#=> [1,2] + +sum "a", "b" +#=> "ab" +{% endhighlight %} + +In addition, Elixir provides default values for arguments whereas Erlang does not. + +{% highlight elixir %} +def mul_by(x, n // 2) do + x * n +end + +mul_by 4, 3 #=> 12 +mul_by 4 #=> 8 +{% endhighlight %} + +### Anonymous Functions + +Anonymous functions are defined in the following way: + +**Erlang** + +{% highlight erlang %} +Sum = fun(a, b) -> a + b end. +Sum(4, 3). +%=> 7 + +Square = fun(x) -> x * x end. +lists:map(Square, [1, 2, 3, 4]). +%=> [1, 4, 9, 16] +{% endhighlight %} + +**Elixir** + +{% highlight elixir %} +sum = fn(a, b) -> a + b end +sum 4, 3 +#=> 7 + +square = fn(x) -> x * x end +Enum.map [1, 2, 3, 4], square +#=> [1, 4, 9, 16] +{% endhighlight %} + +Is is possible to use pattern matching when defining anonymous functions too. + +**Erlang** + +{% highlight erlang %} +F = fun(Tuple = {a, b}) -> + io:format("All your ~p are belong to us~n", [Tuple]); + ([]) -> + "Empty" + end. + +F([]). +%=> "Empty" + +F({a, b}). +%=> "All your {a,b} are belong to us" +{% endhighlight %} + +**Elixir** + +{% highlight elixir %} +f = fn do + {:a, :b} = tuple -> + IO.puts "All your #{inspect tuple} are belong to us" + [] -> + "Empty" + end + +f.([]) +#=> "Empty" + +f.({:a, :b}) +#=> "All your {:a,:b} are belong to us" +{% endhighlight %} + +### First-Class Functions + +Anonymous functions are simply variables, so they can be passed as arguments to +other functions and also can serve as a return value. There is a special syntax to allow named functions be treated in the same manner. + +**Erlang** + +{% highlight erlang %} +square(x) -> x * x. + +lists:map(fun square/1, [1, 2, 3]). +%=> [1, 4, 9] +{% endhighlight %} + +**Elixir** + +{% highlight elixir %} +def square(x) do + x * x +end + +Enum.map [1,2,3], fn(:square, 1) +{% endhighlight %} + +### Partials in Elixir + +Elixir supports partial application of functions which can be used to define anonymous functions in a concise way: + +{% highlight elixir %} +Enum.map [1, 2, 3, 4], &1 * 2 +#=> [2, 4, 6, 8] + +List.foldl [1, 2, 3, 4], 0, &1 + &2 +#=> 10 +{% endhighlight %} + +Partials also allow us to pass named functions as arguments. + +{% highlight elixir %} +def square(x) do + x * x +end + +Enum.map [1, 2, 3], square &1 +#=> [1, 4, 9] +{% endhighlight %} + +## Control Flow + +The constructs `if` and `case` are actually expressions in both Erlang and Elixir, but may be used for control flow like in imperative languages. + +### If + +**Erlang** + +{% highlight erlang %} +Test_fun = fun (X) -> + if X > 10 -> + greater_than_ten; + X < 10, X > 0 -> + less_than_ten_positive; + X < 0; X =:= 0 -> + zero_or_negative; + true -> + exactly_ten + end +end. + +Test_fun(11). +%=> greater_than_ten + +Test_fun(-2). +%=> zero_or_negative + +Test_fun(10). +%=> exactly_ten +{% endhighlight %} + +**Elixir** + +{% highlight elixir %} +test_fun = fn(x) -> + cond do + x > 10 -> + :greater_than_ten + x < 10 and x > 0 -> + :less_than_ten_positive + x < 0 or x === 0 -> + :zero_or_negative + _ -> + :exactly_ten + end +end + +test_fun.(44) +#=> :greater_than_ten + +test_fun.(0) +#=> :zero_or_negative + +test_fun.(10) +#=> :exactly_ten +{% endhighlight %} + +Elixir also provides a `if` function that resembles more imperative languages and is useful when you need to check if one clause is true or false: + +{% highlight elixir %} +if x > 10 do + :greater_than_ten +else + :not_greater_than_ten +end +{% endhighlight %} + +### Case + +The ``case`` construct provides flow control based purely on pattern matching. + +**Erlang** + +{% highlight erlang %} +case { X, Y } of +{ a, b } -> ok; +{ b, c } -> good; +Else -> Else +end +{% endhighlight %} + +**Elixir** + +{% highlight elixir %} +case { x, y } do + { :a, :b } -> :ok + { :b, :c } -> :good + other -> other +end +{% endhighlight %} + +### Loop + +Elixir provides a convenient construct for loops which Erlang does not have. In +general, it is better to use one of the function provided by the ``Enum`` module +or a list comprehension. + +{% highlight elixir %} +loop [1, 2, 3, 4, 5], [] do + [h|t], acc -> + recur t, [h*h|acc] + [], acc -> + List.reverse acc +end +#=> [1, 4, 9, 16, 25] + +Enum.map [1, 2, 3, 4, 5], &1 * &1 +#=> [1, 4, 9, 16, 25] + +lc x in [1, 2, 3, 4, 5], do: x * x +#=> [1, 4, 9, 16, 25] +{% endhighlight %} + +### Sending and Receiving Messages + +The syntax for sending and receiving differs only slightly between Erlang and Elixir. + +**Erlang** + +{% highlight erlang %} +Pid = self(). + +Pid ! { hello }. + +receive + { hello } -> ok; + Other -> Other +after + 10 -> timeout +end. +{% endhighlight %} + +**Elixir** + +{% highlight elixir %} +pid = Process.self + +pid <- { :hello } + +receive do + { :hello } -> :ok + other -> other +after + 10 -> :timeout +end +{% endhighlight %} + +## A Few Notes On Interoperability + +Elixir compiles directly into BEAM byte code. This means that Elixir code can be called from Erlang and vice versa, without the need to write any bindings. What follows is a number of observations with regard to the syntax in both cases. + +**Erlang** + +{% highlight erlang %} +% Suppose we have compiled the module written in Elixir below. + +% Elixir modules live in the __MAIN__ namespace. We can save typing +% by assigning the module name to a variable or defining a macro. +-module(erlang_contrived). +-export([prettify/1]). +-define(ExContrived, __MAIN__.Contrived). + +pretiffy(bin) -> + ?ExContrived:pretty_binary(bin). + +uglify(bin) -> + Contrived = '__MAIN__.Contrived', + Contrived:ugly_binary(bin). +{% endhighlight %} + +**Elixir** + +{% highlight elixir %} +defmodule Contrived do + def pretty_binary(bin) do + "Pretty " <> bin + end + + def ugly_binary(bin) do + "Ugly " <> bin + end +end +{% endhighlight %} + +An example of calling Erlang code from Elixir is shown in the Notable Differences section above. + +## Further Reading + +Erlang's official documentation site has a nice [collection][0] of programming examples. It can be a good exercise to translate them into Elixir. [Erlang cookbook][1] offers even more useful code examples. + +Elixir also provides a [Getting Started Guide][2] and has [documentation available online][3]. + +[0]: http://www.erlang.org/doc/programming_examples/users_guide.html +[1]: http://schemecookbook.org/Erlang/TOC +[2]: http://elixir-lang.org/getting_started/1.html +[3]: http://elixir-lang.org/docs \ No newline at end of file diff --git a/getting_started/7.markdown b/getting_started/7.markdown index 78963076b..fc50c9805 100644 --- a/getting_started/7.markdown +++ b/getting_started/7.markdown @@ -10,7 +10,7 @@ guide: 7 Elixir has more features to offer than what has been described so far, but you should already be comfortable enough to start coding. Here is a bunch of links that'll help you get started: -* This small and simple [chat application](https://gist.github.com/2221616) shows the basics of working with processes. +* This small and simple [chat application](https://gist.github.com/2783092) shows the basics of working with processes. * [ExReminder](https://github.com/alco/ExReminder). This is a more sophisticated application based on a chapter from the _Learn You Some Erlang_ book. @@ -40,7 +40,7 @@ So, in order to write a real application with Elixir, familiarity with Erlang's Remember that in case of any difficulties, you can always visit the **#elixir-lang** channel on **irc.freenode.net** or send a message to the [mailing list][6]. You can be sure that there will be someone willing to help. - [1]: https://github.com/alco/elixir/wiki/Erlang-Syntax:-A-Crash-Course + [1]: http://elixir-lang.org/crash-course.html [2]: http://www.erlang.org/course/concurrent_programming.html [3]: http://www.erlang.org/doc/getting_started/users_guide.html [4]: http://learnyousomeerlang.com/ From 1b31a9305c17be2eb6029b74899eac710e94066f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Thu, 24 May 2012 21:17:05 +0200 Subject: [PATCH 150/437] Add more links to the home page, use ruby highlighting for now --- _includes/important-links.html | 1 + crash-course.markdown | 54 +++++++++++++++++----------------- index.html | 2 +- 3 files changed, 29 insertions(+), 28 deletions(-) diff --git a/_includes/important-links.html b/_includes/important-links.html index bb2fac0de..dd20a8a4e 100644 --- a/_includes/important-links.html +++ b/_includes/important-links.html @@ -7,5 +7,6 @@

        Important Links

      21. Issues Tracker
      22. Textmate Bundle
      23. Vim Elixir
      24. +
      25. Crash Course for Erlang developers
      26. diff --git a/crash-course.markdown b/crash-course.markdown index 713c1badb..70f9aa372 100644 --- a/crash-course.markdown +++ b/crash-course.markdown @@ -36,7 +36,7 @@ You may keep the shell running while you're editing the file. Just don't forget Elixir too has an interactive shell called `iex`. Compiling Elixir code can be done with `elixirc` (which is similar to Erlang's `erlc`). Elixir also provides an executable named `elixir` to run Elixir code. The module defined above can be written in Elixir as: -{% highlight elixir %} +{% highlight ruby %} # module_name.ex defmodule ModuleName do def hello do @@ -47,7 +47,7 @@ end And compiled from `iex`: -{% highlight iex %} +{% highlight ruby %} Interactive Elixir iex> c("module_name.ex") [ModuleName] @@ -90,7 +90,7 @@ X + Y. **Elixir** -{% highlight elixir %} +{% highlight ruby %} x = 2; y = 3 x + y {% endhighlight %} @@ -123,7 +123,7 @@ ok **Elixir** -{% highlight iex %} +{% highlight ruby %} iex> a = 1 1 iex> a = 2 @@ -149,13 +149,13 @@ orddict:new(). to invoke the `new` function from the `orddict` module. In Elixir, use the dot `.` in place of the colon `:` -{% highlight elixir %} +{% highlight ruby %} Process.self {% endhighlight %} **Note**. You may invoke Erlang functions in Elixir in one of two ways: -{% highlight elixir %} +{% highlight ruby %} Erlang.lists.sort [3, 2, 1] :lists.sort [3, 2,1] {% endhighlight %} @@ -183,7 +183,7 @@ X = 10. **Elixir** -{% highlight elixir %} +{% highlight ruby %} :im_an_atom :me_too @@ -206,7 +206,7 @@ is_atom(''). %=> true **Elixir** -{% highlight elixir %} +{% highlight ruby %} is_atom :ok #=> true is_atom :'ok' #=> true is_atom :"Multiple words" #=> true @@ -225,7 +225,7 @@ is_binary(<<"Hello">>). %=> true {% endhighlight %} **Elixir** -{% highlight elixir %} +{% highlight ruby %} is_list 'Hello' #=> true is_binary "Hello" #=> true is_binary <<"Hello">> #=> true @@ -250,7 +250,7 @@ Dict = orddict:from_list([{key, 10}, {another_key, 20}]). **Elixir** -{% highlight elixir %} +{% highlight ruby %} dict = [key: 10, another_key: 20] #=> [{:another_key,20},{:key,10}] {% endhighlight %} @@ -287,7 +287,7 @@ Here we create a module named ``hello_module``. In it we define three functions, An equivalent code in Elixir: -{% highlight elixir %} +{% highlight ruby %} defmodule HelloModule do # A "Hello world" function def fun do @@ -308,7 +308,7 @@ end In Elixir, it is also possible to have multiple modules in one file, as well as nested modules: -{% highlight elixir %} +{% highlight ruby %} defmodule HelloModule do defmodule Utils do def util do @@ -367,7 +367,7 @@ loop_through([]) -> **Elixir** -{% highlight elixir %} +{% highlight ruby %} def loop_through([h|t]) do IO.inspect h loop_through t @@ -397,7 +397,7 @@ sum(a, b, c) -> a + b + c. **Elixir** -{% highlight elixir %} +{% highlight ruby %} def sum, do: 0 def sum(a), do: a def sum(a, b), do: a + b @@ -430,7 +430,7 @@ sum("a", "b"). **Elixir** -{% highlight elixir %} +{% highlight ruby %} def sum(a, b) when is_integer(a) and is_integer(b) do a + b end @@ -455,7 +455,7 @@ sum "a", "b" In addition, Elixir provides default values for arguments whereas Erlang does not. -{% highlight elixir %} +{% highlight ruby %} def mul_by(x, n // 2) do x * n end @@ -482,7 +482,7 @@ lists:map(Square, [1, 2, 3, 4]). **Elixir** -{% highlight elixir %} +{% highlight ruby %} sum = fn(a, b) -> a + b end sum 4, 3 #=> 7 @@ -512,7 +512,7 @@ F({a, b}). **Elixir** -{% highlight elixir %} +{% highlight ruby %} f = fn do {:a, :b} = tuple -> IO.puts "All your #{inspect tuple} are belong to us" @@ -543,7 +543,7 @@ lists:map(fun square/1, [1, 2, 3]). **Elixir** -{% highlight elixir %} +{% highlight ruby %} def square(x) do x * x end @@ -555,7 +555,7 @@ Enum.map [1,2,3], fn(:square, 1) Elixir supports partial application of functions which can be used to define anonymous functions in a concise way: -{% highlight elixir %} +{% highlight ruby %} Enum.map [1, 2, 3, 4], &1 * 2 #=> [2, 4, 6, 8] @@ -565,7 +565,7 @@ List.foldl [1, 2, 3, 4], 0, &1 + &2 Partials also allow us to pass named functions as arguments. -{% highlight elixir %} +{% highlight ruby %} def square(x) do x * x end @@ -607,7 +607,7 @@ Test_fun(10). **Elixir** -{% highlight elixir %} +{% highlight ruby %} test_fun = fn(x) -> cond do x > 10 -> @@ -633,7 +633,7 @@ test_fun.(10) Elixir also provides a `if` function that resembles more imperative languages and is useful when you need to check if one clause is true or false: -{% highlight elixir %} +{% highlight ruby %} if x > 10 do :greater_than_ten else @@ -657,7 +657,7 @@ end **Elixir** -{% highlight elixir %} +{% highlight ruby %} case { x, y } do { :a, :b } -> :ok { :b, :c } -> :good @@ -671,7 +671,7 @@ Elixir provides a convenient construct for loops which Erlang does not have. In general, it is better to use one of the function provided by the ``Enum`` module or a list comprehension. -{% highlight elixir %} +{% highlight ruby %} loop [1, 2, 3, 4, 5], [] do [h|t], acc -> recur t, [h*h|acc] @@ -708,7 +708,7 @@ end. **Elixir** -{% highlight elixir %} +{% highlight ruby %} pid = Process.self pid <- { :hello } @@ -746,7 +746,7 @@ uglify(bin) -> **Elixir** -{% highlight elixir %} +{% highlight ruby %} defmodule Contrived do def pretty_binary(bin) do "Pretty " <> bin diff --git a/index.html b/index.html index a64b34024..649ab4e14 100644 --- a/index.html +++ b/index.html @@ -15,7 +15,7 @@

        What is Elixir?

        Elixir is a programming language built on top of the Erlang VM. As Erlang, it is a functional language built to support distributed, fault-tolerant, non-stop applications with hot code swapping.

        Elixir is also dynamic typed but, differently from Erlang, it is also homoiconic, allowing meta-programming via macros. Elixir also supports polymorphism via protocols (similar to Clojure's), dynamic records and provides a reference mechanism.

        Finally, Elixir and Erlang share the same bytecode and data types. This means you can invoke Erlang code from Elixir (and vice-versa) without any conversion or performance hit. This allows a developer to mix the expressiveness of Elixir with the robustness and performance of Erlang.

        -

        If you want to install Elixir or learn more about it, check our getting started guide.

        +

        If you want to install Elixir or learn more about it, check our getting started guide. We also have online documentation available and a Crash Course for Erlang developers.

        From 8da11ac00d23453278046a8b6317b11ad99f8ac5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Thu, 24 May 2012 21:41:37 +0200 Subject: [PATCH 151/437] Release new docs --- docs/modules_list.html | 2 +- docs/protocols_list.html | 2 +- docs/records_list.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/modules_list.html b/docs/modules_list.html index c4b10dcac..6b0137e6c 100644 --- a/docs/modules_list.html +++ b/docs/modules_list.html @@ -16,7 +16,7 @@

        - Elixir v0.5.0.dev + Elixir v0.5.0

        - Source + Source

        Implementations

        @@ -52,12 +53,6 @@

        Implementations

        -
      27. - - BitString - -
      28. -
      29. Function @@ -70,12 +65,6 @@

        Implementations

      30. -
      31. - - Tuple - -
      32. - @@ -104,7 +93,7 @@

        Functions

        Receives the element being accessed and the access item.

        - Source + Source
        diff --git a/docs/master/ArgumentError.html b/docs/master/ArgumentError.html index 43af1d0c8..71447cc04 100644 --- a/docs/master/ArgumentError.html +++ b/docs/master/ArgumentError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -103,49 +103,49 @@

        Functions

        exception(args)

        - Source + Source

        exception(args, self)

        - Source + Source

        message(record)

        - Source + Source

        message(value, record)

        - Source + Source

        new()

        - Source + Source

        new(opts)

        - Source + Source

        to_keywords(record)

        - Source + Source

        update_message(function, record)

        - Source + Source
        diff --git a/docs/master/ArithmeticError.html b/docs/master/ArithmeticError.html index 8fdca4be0..f03e2535a 100644 --- a/docs/master/ArithmeticError.html +++ b/docs/master/ArithmeticError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -103,49 +103,49 @@

        Functions

        exception(args)

        - Source + Source

        exception(args, self)

        - Source + Source

        message(record)

        - Source + Source

        message(value, record)

        - Source + Source

        new()

        - Source + Source

        new(opts)

        - Source + Source

        to_keywords(record)

        - Source + Source

        update_message(function, record)

        - Source + Source
        diff --git a/docs/master/BadArityError.html b/docs/master/BadArityError.html index 5ed4bc702..231034cf0 100644 --- a/docs/master/BadArityError.html +++ b/docs/master/BadArityError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -129,73 +129,73 @@

        Functions

        args(record)

        - Source + Source

        args(value, record)

        - Source + Source

        exception(args)

        - Source + Source

        exception(args, self)

        - Source + Source

        function(record)

        - Source + Source

        function(value, record)

        - Source + Source

        message(exception)

        - Source + Source

        new()

        - Source + Source

        new(opts)

        - Source + Source

        to_keywords(record)

        - Source + Source

        update_args(function, record)

        - Source + Source

        update_function(function, record)

        - Source + Source
        diff --git a/docs/master/BadFunctionError.html b/docs/master/BadFunctionError.html index 536bf3297..6bdbf5909 100644 --- a/docs/master/BadFunctionError.html +++ b/docs/master/BadFunctionError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -108,55 +108,55 @@

        Functions

        actual(record)

        - Source + Source

        actual(value, record)

        - Source + Source

        exception(args)

        - Source + Source

        exception(args, self)

        - Source + Source

        message(exception)

        - Source + Source

        new()

        - Source + Source

        new(opts)

        - Source + Source

        to_keywords(record)

        - Source + Source

        update_actual(function, record)

        - Source + Source
        diff --git a/docs/master/Binary.Chars.Atom.html b/docs/master/Binary.Chars.Atom.html index 2c0ead3ad..b394c9311 100644 --- a/docs/master/Binary.Chars.Atom.html +++ b/docs/master/Binary.Chars.Atom.html @@ -29,7 +29,7 @@

        - Source + Source @@ -59,7 +59,7 @@

        Functions

        Convert the atom literally to a binary, except nil which is converted to an empty string.

        - Source + Source diff --git a/docs/master/Binary.Chars.BitString.html b/docs/master/Binary.Chars.BitString.html index 6379c2787..8d4b3a8b3 100644 --- a/docs/master/Binary.Chars.BitString.html +++ b/docs/master/Binary.Chars.BitString.html @@ -29,7 +29,7 @@

        - Source + Source @@ -58,7 +58,7 @@

        Functions

        Simply returns the binary itself.

        - Source + Source diff --git a/docs/master/Binary.Chars.List.html b/docs/master/Binary.Chars.List.html index eeb2c7545..b480a7b3e 100644 --- a/docs/master/Binary.Chars.List.html +++ b/docs/master/Binary.Chars.List.html @@ -29,7 +29,7 @@

        - Source + Source @@ -67,7 +67,7 @@

        Examples

        to_binary ["foo", 'bar'] #=> "foobar"
        - Source + Source diff --git a/docs/master/Binary.Chars.Number.html b/docs/master/Binary.Chars.Number.html index 22b008132..9d4b24298 100644 --- a/docs/master/Binary.Chars.Number.html +++ b/docs/master/Binary.Chars.Number.html @@ -29,7 +29,7 @@

        - Source + Source @@ -58,7 +58,7 @@

        Functions

        Simply converts the number (integer or a float) to a binary.

        - Source + Source diff --git a/docs/master/Binary.Chars.html b/docs/master/Binary.Chars.html index dba3d3134..f150953dc 100644 --- a/docs/master/Binary.Chars.html +++ b/docs/master/Binary.Chars.html @@ -43,7 +43,7 @@

        - Source + Source

        Implementations

        @@ -100,7 +100,7 @@

        Functions

        to_binary(xA)

        - Source + Source diff --git a/docs/master/Binary.Inspect.Any.html b/docs/master/Binary.Inspect.Any.html index 6f2d86514..8bd40dd40 100644 --- a/docs/master/Binary.Inspect.Any.html +++ b/docs/master/Binary.Inspect.Any.html @@ -29,7 +29,7 @@

        - Source + Source @@ -64,7 +64,7 @@

        Examples

        inspect Process.self #=> "<0.35.0>"
         
        - Source + Source diff --git a/docs/master/Binary.Inspect.Atom.html b/docs/master/Binary.Inspect.Atom.html index 8c9f2aaed..1e80c80b7 100644 --- a/docs/master/Binary.Inspect.Atom.html +++ b/docs/master/Binary.Inspect.Atom.html @@ -29,7 +29,7 @@

        - Source + Source @@ -61,9 +61,7 @@

        Functions

        as modules using the dot notation.

        Notice that in Elixir, all operators can be represented using -literal atoms (:+, :-, etc) with the exception of the -operators .. and ... which need to be wrapped in quotes -(:".." and :"...").

        +literal atoms (:+, :-, etc).

        Examples

        @@ -72,7 +70,7 @@

        Examples

        inspect(Foo.Bar) #=> "Foo.Bar"
        - Source + Source diff --git a/docs/master/Binary.Inspect.BitString.html b/docs/master/Binary.Inspect.BitString.html index 6ca26bfa7..a6eac79a4 100644 --- a/docs/master/Binary.Inspect.BitString.html +++ b/docs/master/Binary.Inspect.BitString.html @@ -29,7 +29,7 @@

        - Source + Source @@ -65,7 +65,7 @@

        Examples

        inspect("f\"oo") #=> "f\"oo"
        - Source + Source diff --git a/docs/master/Binary.Inspect.List.html b/docs/master/Binary.Inspect.List.html index ad54f4301..99c68909e 100644 --- a/docs/master/Binary.Inspect.List.html +++ b/docs/master/Binary.Inspect.List.html @@ -29,7 +29,7 @@

        - Source + Source @@ -62,7 +62,7 @@

        Functions

        container_join(list1, acc, last)

        - Source + Source

        inspect(thing) @@ -84,7 +84,7 @@

        Examples

        inspect([:foo,:bar]) #=> "[:foo, :bar]"
        - Source + Source diff --git a/docs/master/Binary.Inspect.Number.html b/docs/master/Binary.Inspect.Number.html index 5375dfc2e..4b3591776 100644 --- a/docs/master/Binary.Inspect.Number.html +++ b/docs/master/Binary.Inspect.Number.html @@ -29,7 +29,7 @@

        - Source + Source @@ -63,7 +63,7 @@

        Examples

        inspect(1) #=> "1"
         
        - Source + Source diff --git a/docs/master/Binary.Inspect.Regex.html b/docs/master/Binary.Inspect.Regex.html index fcbfdb769..009614b88 100644 --- a/docs/master/Binary.Inspect.Regex.html +++ b/docs/master/Binary.Inspect.Regex.html @@ -29,7 +29,7 @@

        - Source + Source @@ -63,7 +63,7 @@

        Examples

        inspect(%r/foo/m) #=> "%r\"foo\"m"
         
        - Source + Source diff --git a/docs/master/Binary.Inspect.Tuple.html b/docs/master/Binary.Inspect.Tuple.html index d435c3664..34afbca29 100644 --- a/docs/master/Binary.Inspect.Tuple.html +++ b/docs/master/Binary.Inspect.Tuple.html @@ -29,7 +29,7 @@

        - Source + Source @@ -65,7 +65,7 @@

        Examples

        inspect(ArgumentError.new) #=> ArgumentError[message: "argument error"]
        - Source + Source diff --git a/docs/master/Binary.Inspect.html b/docs/master/Binary.Inspect.html index 8c9ff7349..c83349a8c 100644 --- a/docs/master/Binary.Inspect.html +++ b/docs/master/Binary.Inspect.html @@ -39,7 +39,7 @@

        - Source + Source

        Implementations

        @@ -114,7 +114,7 @@

        Functions

        inspect(xA)

        - Source + Source diff --git a/docs/master/Binary.html b/docs/master/Binary.html index 02a729d48..630bc8c5f 100644 --- a/docs/master/Binary.html +++ b/docs/master/Binary.html @@ -32,7 +32,7 @@

        - Source + Source @@ -42,11 +42,6 @@

        Functions summary

        • - - access/2 - -
        • -
        • escape/2 @@ -86,14 +81,6 @@

          Functions summary

          Functions

          -

          - access(binary, access) -

          -

          Simply invokes the Access protocol for the given binary. -Check Access.BitString for more information.

          -
          - Source -

          escape(other, char)

          @@ -107,7 +94,7 @@

          Examples

          #=> "'foo'"
        - Source + Source

        printable?(arg1) @@ -120,7 +107,7 @@

        Examples

        Binary.printable?("abc") #=> true
         
        - Source + Source

        unescape(chars) @@ -142,7 +129,7 @@

        Examples

        In the example above, we pass a string with \n escaped and we return a version with it unescaped.

        - Source + Source

        unescape(chars, map) @@ -179,7 +166,7 @@

        Examples

        Binary.unescape "example\\n", unescape_map(&1)
         
        - Source + Source

        unescape_tokens(tokens) @@ -191,7 +178,7 @@

        Examples

        when implementing your own sigils. Check the implementation of Elixir.Builtin.__b__ for examples.

        - Source + Source

        unescape_tokens(tokens, map) @@ -199,7 +186,7 @@

        Examples

        Unescape the given tokens according to the given map. Check unescape_tokens/1 and unescaped/2 for more information.

        - Source + Source
        diff --git a/docs/master/Bitwise.html b/docs/master/Bitwise.html index ea6d89201..5a8664906 100644 --- a/docs/master/Bitwise.html +++ b/docs/master/Bitwise.html @@ -27,22 +27,28 @@

        -

        This module provide macros for bitwise operators -provided by Erlang. These macros can be used in guards.

        +

        This module provide macros and operators for bitwise operators. +These macros can be used in guards.

        The easiest way to use is to simply import them into your module:

        -
        import Bitwise
        +
        use Bitwise
         
        -bnot 1      # -2
        -band(1, 1) #=> 1
        +bnot 1   #=> -2
        +1 &&& 1  #=> 1
        +
        + +

        You can select to include only or skip operators by passing options:

        + +
        use Bitwise, only_operators: true
        +1 &&& 1 #=> 1
         
        - Source + Source @@ -54,6 +60,31 @@

        Macros summary

        @@ -93,47 +134,102 @@

        Macros summary

        Macros

        +

        + &&&(left, right) +

        +

        Bitwise and as operator.

        +
        + Source +
        +

        + <<<(left, right) +

        +

        Arithmetic bitshift left as operator.

        +
        + Source +
        +

        + >>>(left, right) +

        +

        Arithmetic bitshift right as operator.

        +
        + Source +
        +

        + ^^^(left, right) +

        +

        Bitwise xor as operator.

        +
        + Source +
        +

        + __using__(options) +

        +

        Allow a developer to use this module in their programs with +the following options:

        + +
          +
        • :only_operators - Include only operators;
        • +
        • :skip_operators - Skip operators;
        • +
        +
        + Source +

        band(left, right)

        Bitwise and.

        - Source + Source

        bnot(expr)

        Bitwise not.

        - Source + Source

        bor(left, right)

        Bitwise or.

        - Source + Source

        bsl(left, right)

        Arithmetic bitshift left.

        - Source + Source

        bsr(left, right)

        Arithmetic bitshift right.

        - Source + Source

        bxor(left, right)

        Bitwise xor.

        - Source + Source +
        +

        + |||(left, right) +

        +

        Bitwise or as operator.

        +
        + Source +
        +

        + ~~~(expr) +

        +

        Bitwise not as operator.

        +
        + Source
        diff --git a/docs/master/CaseClauseError.html b/docs/master/CaseClauseError.html index 002a28f75..05b402b86 100644 --- a/docs/master/CaseClauseError.html +++ b/docs/master/CaseClauseError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -108,55 +108,55 @@

        Functions

        actual(record)

        - Source + Source

        actual(value, record)

        - Source + Source

        exception(args)

        - Source + Source

        exception(args, self)

        - Source + Source

        message(exception)

        - Source + Source

        new()

        - Source + Source

        new(opts)

        - Source + Source

        to_keywords(record)

        - Source + Source

        update_actual(function, record)

        - Source + Source
        diff --git a/docs/master/Code.html b/docs/master/Code.html index a6194cd2c..9335445cb 100644 --- a/docs/master/Code.html +++ b/docs/master/Code.html @@ -33,7 +33,7 @@

        - Source + Source @@ -97,6 +97,16 @@

        Functions summary

        require_file/2 +
      33. + + string_to_ast/2 + +
      34. +
      35. + + string_to_ast!/2 + +
      36. @@ -112,7 +122,7 @@

        Functions

        Appends a path to Erlang VM code path.

        - Source + Source

        compile_string(string, file // "nofile") @@ -123,7 +133,7 @@

        Functions

        For compiling many files at once, check Elixir.ParallelCompiler.

        - Source + Source

        compiler_options() @@ -131,7 +141,7 @@

        Functions

        Loads the compilation options from the code server. Check compiler_options/1 for more information.

        - Source + Source

        compiler_options(opts) @@ -148,7 +158,7 @@

        Functions

      37. ignoremoduleconflict - when true, override modules that were already defined;
      38. - Source + Source

        ensure_loaded(module) @@ -159,7 +169,7 @@

        Functions

        If it succeeds loading the module anyhow, it returns { :module, module }. If not, returns { :error, reason } with the error reason.

        - Source + Source

        eval(string, binding // [], opts // []) @@ -188,7 +198,7 @@

        Examples

        #=> { 3, [ {:a, 1}, {:b, 2} ] }

        - Source + Source

        eval_quoted(quoted, binding // [], opts // []) @@ -221,7 +231,7 @@

        Examples

        #=> { 3, [ {:a, 1}, {:b, 2} ] }
        - Source + Source

        load_file(file, relative_to // nil) @@ -233,21 +243,21 @@

        Examples

        When loading a file, you may skip passing .exs as extension as Elixir automatically adds it for you.

        - Source + Source

        loaded_files()

        Returns all the loaded files.

        - Source + Source

        prepend_path(path)

        Prepends a path to Erlang VM code path.

        - Source + Source

        require_file(file, relative_to // nil) @@ -259,7 +269,41 @@

        Examples

        When requiring a file, you may skip passing .exs as extension as Elixir automatically adds it for you.

        - Source + Source +
        +

        + string_to_ast(string, opts // []) +

        +

        Converts the given string to AST. It returns { :ok, ast } +if it succeeds, { :error, { line, error, token } } otherwise.

        + +

        Options

        + +
          +
        • :file - The filename to be used in stacktraces +and the file reported in the ENV variable.

        • +
        • :line - The line reported in the ENV variable.

        • +
        +
        + Source +
        +

        + string_to_ast!(string, opts // []) +

        +

        Converts the given string to AST. It returns the ast if it succeeds, +raises an exception otherwise. The exception is a TokenMissingError +in case a token is missing (usually because the expression is incomplete), +SyntaxError otherwise.

        + +

        Options

        + +
          +
        • :file - The filename to be used in stacktraces +and the file reported in the ENV variable.

        • +
        • :line - The line reported in the ENV variable.

        • +
        +
        + Source
        diff --git a/docs/master/CompileError.html b/docs/master/CompileError.html index f5ef4f30d..77b74bcbc 100644 --- a/docs/master/CompileError.html +++ b/docs/master/CompileError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -150,91 +150,91 @@

        Functions

        description(record)

        - Source + Source

        description(value, record)

        - Source + Source

        exception(args)

        - Source + Source

        exception(args, self)

        - Source + Source

        file(record)

        - Source + Source

        file(value, record)

        - Source + Source

        line(record)

        - Source + Source

        line(value, record)

        - Source + Source

        message(exception)

        - Source + Source

        new()

        - Source + Source

        new(opts)

        - Source + Source

        to_keywords(record)

        - Source + Source

        update_description(function, record)

        - Source + Source

        update_file(function, record)

        - Source + Source

        update_line(function, record)

        - Source + Source
        diff --git a/docs/master/Dict.HashDict.Record.html b/docs/master/Dict.HashDict.Record.html index 69b898108..1e3e56fd8 100644 --- a/docs/master/Dict.HashDict.Record.html +++ b/docs/master/Dict.HashDict.Record.html @@ -29,7 +29,7 @@

        - Source + Source @@ -117,79 +117,79 @@

        Functions

        delete(arg1, key)

        - Source + Source

        - empty() + empty(arg1)

        - Source + Source

        get(arg1, key, default // nil)

        - Source + Source

        has_key?(arg1, key)

        - Source + Source

        keys(arg1)

        - Source + Source

        merge(arg1, arg2)

        - Source + Source

        merge(arg1, arg2, fun)

        - Source + Source

        put(arg1, key, value)

        - Source + Source

        size(arg1)

        - Source + Source

        to_list(arg1)

        - Source + Source

        update(arg1, key, fun)

        - Source + Source

        update(arg1, key, initial, fun)

        - Source + Source

        values(arg1)

        - Source + Source
        diff --git a/docs/master/Dict.Orddict.Record.html b/docs/master/Dict.Orddict.Record.html index 445fae903..d4430b59c 100644 --- a/docs/master/Dict.Orddict.Record.html +++ b/docs/master/Dict.Orddict.Record.html @@ -29,7 +29,7 @@

        - Source + Source @@ -117,79 +117,79 @@

        Functions

        delete(arg1, key)

        - Source + Source

        - empty() + empty(arg1)

        - Source + Source

        get(arg1, key, default // nil)

        - Source + Source

        has_key?(arg1, key)

        - Source + Source

        keys(arg1)

        - Source + Source

        merge(arg1, arg2)

        - Source + Source

        merge(arg1, arg2, fun)

        - Source + Source

        put(arg1, key, value)

        - Source + Source

        size(arg1)

        - Source + Source

        to_list(arg1)

        - Source + Source

        update(arg1, key, fun)

        - Source + Source

        update(arg1, key, initial, fun)

        - Source + Source

        values(arg1)

        - Source + Source
        diff --git a/docs/master/Dict.html b/docs/master/Dict.html index 787f28a6a..da296f58b 100644 --- a/docs/master/Dict.html +++ b/docs/master/Dict.html @@ -36,7 +36,7 @@

        - Source + Source

        Implementations

        @@ -154,14 +154,14 @@

        Examples

        Dict.delete [b: 2], :a #=> [b: 2]
        - Source + Source

        empty(xA)

        Returns an empty dict of the same type as dict.

        - Source + Source

        get(xA, xB) @@ -176,13 +176,13 @@

        Examples

        Dict.get [a: 1], :b, 3 #=> 3
        - Source + Source

        get(xA, xB, xC)

        - Source + Source

        has_key?(xA, xB) @@ -195,7 +195,7 @@

        Examples

        Dict.has_key?([a: 1], :b) #=> false
        - Source + Source

        keys(xA) @@ -209,7 +209,7 @@

        Examples

        Dict.keys [a: 1, b: 2]  #=> [:a,:b]
         
        - Source + Source

        merge(xA, xB) @@ -223,7 +223,7 @@

        Examples

        #=> [a:3, b:2, d: 4]
        - Source + Source

        merge(xA, xB, xC) @@ -239,7 +239,7 @@

        Examples

        #=> [a: 4, b: 2, d: 4]
        - Source + Source

        put(xA, xB, xC) @@ -253,7 +253,7 @@

        Examples

        #=> [a: 3, b: 2]

        - Source + Source

        size(xA) @@ -265,7 +265,7 @@

        Examples

        Dict.size [a: 1, b: 2]  #=> 2
         
        - Source + Source

        to_list(xA) @@ -273,7 +273,7 @@

        Examples

        Returns a list of key-value pairs stored in dict. No particular order is enforced.

        - Source + Source

        update(xA, xB, xC) @@ -287,7 +287,7 @@

        Examples

        #=> [a: -1, b: 2]
        - Source + Source

        update(xA, xB, xC, xD) @@ -302,7 +302,7 @@

        Examples

        #=> [a: 1, b: 2, c: 3]
        - Source + Source

        values(xA) @@ -314,7 +314,7 @@

        Examples

        Dict.values [a: 1, b: 2]  #=> [1,2]
         
        - Source + Source diff --git a/docs/master/EEx.AssignsEngine.html b/docs/master/EEx.AssignsEngine.html index 1a8e207ad..3e98b63fb 100644 --- a/docs/master/EEx.AssignsEngine.html +++ b/docs/master/EEx.AssignsEngine.html @@ -53,7 +53,7 @@

        Examples

        - Source + Source diff --git a/docs/master/EEx.Engine.html b/docs/master/EEx.Engine.html index e1fe556f5..d5fe1e0ec 100644 --- a/docs/master/EEx.Engine.html +++ b/docs/master/EEx.Engine.html @@ -52,7 +52,7 @@

        - Source + Source @@ -90,7 +90,7 @@

        Functions

        behaviour_info(atom1)

        - Source + Source

        handle_expr(buffer, list2, expr) @@ -103,14 +103,14 @@

        Functions

        All other markers are not implemented by this engine.

        - Source + Source

        handle_text(buffer, text)

        The default implementation simply concatenates text to the buffer.

        - Source + Source
        diff --git a/docs/master/EEx.ForEngine.html b/docs/master/EEx.ForEngine.html index 18c2e9155..95096676e 100644 --- a/docs/master/EEx.ForEngine.html +++ b/docs/master/EEx.ForEngine.html @@ -47,7 +47,7 @@

        Examples

        - Source + Source diff --git a/docs/master/EEx.SmartEngine.html b/docs/master/EEx.SmartEngine.html index ba7b06ca4..1646b5873 100644 --- a/docs/master/EEx.SmartEngine.html +++ b/docs/master/EEx.SmartEngine.html @@ -36,7 +36,7 @@

        - Source + Source @@ -69,13 +69,13 @@

        Functions

        handle_expr(buffer, mark, expr)

        - Source + Source

        handle_text(buffer, text)

        - Source + Source
        diff --git a/docs/master/EEx.SyntaxError.html b/docs/master/EEx.SyntaxError.html index 1ccbb869d..d03b26618 100644 --- a/docs/master/EEx.SyntaxError.html +++ b/docs/master/EEx.SyntaxError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -103,49 +103,49 @@

        Functions

        exception(args)

        - Source + Source

        exception(args, self)

        - Source + Source

        message(record)

        - Source + Source

        message(value, record)

        - Source + Source

        new()

        - Source + Source

        new(opts)

        - Source + Source

        to_keywords(record)

        - Source + Source

        update_message(function, record)

        - Source + Source
        diff --git a/docs/master/EEx.TransformerEngine.html b/docs/master/EEx.TransformerEngine.html index e5929b133..3325e82c5 100644 --- a/docs/master/EEx.TransformerEngine.html +++ b/docs/master/EEx.TransformerEngine.html @@ -39,7 +39,7 @@

        - Source + Source diff --git a/docs/master/EEx.html b/docs/master/EEx.html index a056831fd..bb3a1d137 100644 --- a/docs/master/EEx.html +++ b/docs/master/EEx.html @@ -123,7 +123,7 @@

        Macros

        - Source + Source @@ -183,7 +183,7 @@

        Functions

        Get a filename and generate a quoted expression that can be evaluated by Elixir or compiled to a function.

        - Source + Source

        compile_string(source, options // []) @@ -191,7 +191,7 @@

        Functions

        Get a string source and generate a quoted expression that can be evaluated by Elixir or compiled to a function.

        - Source + Source

        eval_file(filename, bindings // [], options // []) @@ -208,7 +208,7 @@

        Examples

        #=> "foo baz"
        - Source + Source

        eval_string(source, bindings // [], options // []) @@ -221,7 +221,7 @@

        Examples

        #=> "foo baz"
        - Source + Source @@ -255,7 +255,7 @@

        Examples

        Sample.sample(1, 2) #=> "3" - Source + Source

        function_from_string(kind, name, source, args // [], options // []) @@ -274,7 +274,7 @@

        Examples

        Sample.sample(1, 2) #=> "3"
        - Source + Source diff --git a/docs/master/Elixir.Builtin.html b/docs/master/Elixir.Builtin.html index 1682f5be2..50dfe0d70 100644 --- a/docs/master/Elixir.Builtin.html +++ b/docs/master/Elixir.Builtin.html @@ -47,7 +47,7 @@

        - Source + Source @@ -66,11 +66,6 @@

        Functions summary

        apply/2 -
      39. - - apply/3 - -
      40. atom_to_binary/2 @@ -468,6 +463,11 @@

        Macros summary

        //2
      41. +
      42. + + />/2 + +
      43. </2 @@ -498,6 +498,11 @@

        Macros summary

        ===/2
      44. +
      45. + + =~/2 + +
      46. >/2 @@ -553,6 +558,11 @@

        Macros summary

        and/2
      47. +
      48. + + apply/3 + +
      49. atom_to_binary/1 @@ -769,7 +779,7 @@

        Examples

        abs(-3) #=> 3 - Source + Source

        apply(fun, args) @@ -782,20 +792,7 @@

        Examples

        #=> 4
        - Source -
        -

        - apply(module, fun, args) -

        -

        Invokes the given fun from module with the array of arguments args.

        - -

        Examples

        - -
        apply List, reverse, [[1,2,3]]
        -#=> [3,2,1]
        -
        -
        - Source + Source

        atom_to_binary(atom, encoding) @@ -811,7 +808,7 @@

        Examples

        atom_to_binary(:elixir, utf8) #=> "elixir"
         
        - Source + Source

        atom_to_list(atom) @@ -823,7 +820,7 @@

        Examples

        atom_to_list(:elixir) #=> 'elixir'
         
        - Source + Source

        binary_to_atom(binary, encoding) @@ -838,21 +835,21 @@

        Examples

        binary_to_atom("elixir", :utf8) #=> :elixir
         
        - Source + Source

        binary_to_existing_atom(binary, encoding)

        Works like binary_to_atom/2, but the atom must already exist.

        - Source + Source

        binary_to_list(binary)

        Returns a list of integers which correspond to the bytes of binary.

        - Source + Source

        binary_to_list(binary, start, stop) @@ -861,7 +858,7 @@

        Examples

        from position start to position stop in binary. Positions in the binary are numbered starting from 1.

        - Source + Source

        binary_to_term(binary) @@ -872,10 +869,10 @@

        Examples

        Examples

        -
        binary_to_term(term_to_binary("foo")) #=> true
        +
        binary_to_term(term_to_binary("foo")) #=> "foo"
         
        - Source + Source

        binary_to_term(binary, options) @@ -898,7 +895,7 @@

        Examples

        binary_to_term(term_to_binary("foo"), [:safe])
         
        - Source + Source

        bit_size(bitstring) @@ -913,7 +910,7 @@

        Examples

        bit_size(<<1,2,3>>) #=> 24
        - Source + Source

        bitstring_to_list(bitstring) @@ -922,7 +919,7 @@

        Examples

        number of bits in the binary is not divisible by 8, the last element of the list will be a bitstring containing the remaining bits (1 up to 7 bits).

        - Source + Source

        byte_size(bitstring) @@ -939,7 +936,7 @@

        Examples

        byte_size(<<1,2,3>>) #=> 3
        - Source + Source

        exit(reason) @@ -954,14 +951,14 @@

        Examples

        exit(:seems_bad)
        - Source + Source

        float(number)

        Converts the given number to a float. Allowed in guard clauses.

        - Source + Source

        float_to_list(number) @@ -974,21 +971,21 @@

        Examples

        #=> '7.00000000000000000000e+00'
        - Source + Source

        halt()

        The same as halt(0, []).

        - Source + Source

        halt(status)

        The same as halt(status, []).

        - Source + Source

        halt(status, options) @@ -1019,14 +1016,14 @@

        Examples

        halt(:abort)
        - Source + Source

        hd(list)

        Returns the head of a list, raises badarg if the list is empty.

        - Source + Source

        integer_to_list(number) @@ -1039,7 +1036,7 @@

        Examples

        #=> '7'
        - Source + Source

        integer_to_list(number, base) @@ -1053,7 +1050,7 @@

        Examples

        #=> "3FF"
        - Source + Source

        iolist_size(item) @@ -1066,7 +1063,7 @@

        Examples

        #=> 4
        - Source + Source

        iolist_to_binary(item) @@ -1083,7 +1080,7 @@

        Examples

        #=> <<1,2,3,1,2,3,4,5,4,6>>
        - Source + Source

        is_atom(term) @@ -1092,7 +1089,7 @@

        Examples

        Allowed in guard tests.

        - Source + Source

        is_binary(term) @@ -1103,7 +1100,7 @@

        Examples

        Allowed in guard tests.

        - Source + Source

        is_bitstring(term) @@ -1112,7 +1109,7 @@

        Examples

        Allowed in guard tests.

        - Source + Source

        is_boolean(term) @@ -1122,7 +1119,7 @@

        Examples

        Allowed in guard tests.

        - Source + Source

        is_float(term) @@ -1131,7 +1128,7 @@

        Examples

        Allowed in guard tests.

        - Source + Source

        is_function(term) @@ -1140,7 +1137,7 @@

        Examples

        Allowed in guard tests.

        - Source + Source

        is_function(term, arity) @@ -1150,7 +1147,7 @@

        Examples

        Allowed in guard tests.

        - Source + Source

        is_integer(term) @@ -1159,7 +1156,7 @@

        Examples

        Allowed in guard tests.

        - Source + Source

        is_list(term) @@ -1168,7 +1165,7 @@

        Examples

        Allowed in guard tests.

        - Source + Source

        is_number(term) @@ -1178,7 +1175,7 @@

        Examples

        Allowed in guard tests.

        - Source + Source

        is_pid(term) @@ -1187,7 +1184,7 @@

        Examples

        Allowed in guard tests.

        - Source + Source

        is_port(term) @@ -1196,7 +1193,7 @@

        Examples

        Allowed in guard tests.

        - Source + Source

        is_reference(term) @@ -1205,7 +1202,7 @@

        Examples

        Allowed in guard tests.

        - Source + Source

        is_tuple(term) @@ -1214,7 +1211,7 @@

        Examples

        Allowed in guard tests.

        - Source + Source

        length(list) @@ -1228,7 +1225,7 @@

        Examples

        length([1,2,3,4,5,6,7,8,9]) #=> 9
         
        - Source + Source

        list_to_atom(char_list) @@ -1240,7 +1237,7 @@

        Examples

        list_to_atom('elixir') #=> :elixir
         
        - Source + Source

        list_to_binary(char_list) @@ -1252,7 +1249,7 @@

        Examples

        list_to_binary('Elixir') #=> "Elixir"
         
        - Source + Source

        list_to_bitstring(bitstring_list) @@ -1266,11 +1263,11 @@

        Examples

        bin2 = <<4,5>> bin3 = <<6,7|4>> -list_to_binary([bin1,1,[2,3,bin2],4|bin3]) +list_to_bitstring([bin1,1,[2,3,bin2],4|bin3]) #=> <<1,2,3,1,2,3,4,5,4,6,7|4>>
        - Source + Source

        list_to_existing_atom(char_list) @@ -1278,7 +1275,7 @@

        Examples

        Returns the atom whose text representation is char_list, but only if there already exists such atom.

        - Source + Source

        list_to_float(char_list) @@ -1290,7 +1287,7 @@

        Examples

        list_to_float('2.2017764e+0') #=> 2.2017764
         
        - Source + Source

        list_to_integer(char_list) @@ -1302,7 +1299,7 @@

        Examples

        list_to_integer('123') #=> 123
         
        - Source + Source

        list_to_integer(char_list, base) @@ -1314,19 +1311,26 @@

        Examples

        > list_to_integer('3FF', 16) #=> 1023
         
        - Source + Source

        list_to_pid(char_list)

        Returns a pid whose text representation is char_list.

        +

        Warning:

        + +

        This function is intended for debugging and for use in the Erlang +operating system.

        + +

        It should not be used in application programs.

        +

        Examples

        list_to_pid('<0.41>') #=> <0.4.1>
         
        - Source + Source

        list_to_tuple(list) @@ -1338,7 +1342,7 @@

        Examples

        list_to_tuple([share, [:elixir, 163]]). #=> {share, [:elixir, 163]}
         
        - Source + Source

        make_ref() @@ -1354,7 +1358,7 @@

        Examples

        #=> #Ref<0.0.0.135>
        - Source + Source

        max(first, second) @@ -1368,7 +1372,7 @@

        Examples

        max(1, 2) #=> 2
         
        - Source + Source

        min(first, second) @@ -1382,7 +1386,7 @@

        Examples

        min(1, 2) #=> 1
         
        - Source + Source

        node() @@ -1392,7 +1396,7 @@

        Examples

        Allowed in guard tests.

        - Source + Source

        node(arg) @@ -1403,7 +1407,7 @@

        Examples

        Allowed in guard tests.

        - Source + Source

        pid_to_list(pid) @@ -1411,8 +1415,15 @@

        Examples

        Returns a char list which corresponds to the text representation of pid. This function is intended for debugging and for use in the Erlang operating system. It should not be used in application programs.

        + +

        Warning:

        + +

        This function is intended for debugging and for use in the Erlang +operating system.

        + +

        It should not be used in application programs.

        - Source + Source

        raise(msg) @@ -1435,7 +1446,7 @@

        Examples

        end
        - Source + Source

        raise(exception, args) @@ -1456,7 +1467,7 @@

        Examples

        raise ArgumentError, message: "Sample"
         
        - Source + Source

        round(number) @@ -1469,7 +1480,7 @@

        Examples

        round(5.5) #=> 6
         
        - Source + Source

        size(arg) @@ -1477,7 +1488,7 @@

        Examples

        Returns the size of the given argument, which must be a tuple or a binary. If possible, please use tuplesize or binarysize.

        - Source + Source

        spawn(fun) @@ -1496,10 +1507,10 @@

        Examples

        end
        - Source + Source

        - spawn(module, args, fun) + spawn(module, fun, args)

        Spawns the given module and function passing the given args and returns its pid.

        @@ -1512,7 +1523,7 @@

        Examples

        spawn(SomeModule, :function, [1,2,3])
         
        - Source + Source

        spawn_link(fun) @@ -1532,10 +1543,10 @@

        Examples

        end
        - Source + Source

        - spawn_link(module, args, fun) + spawn_link(module, fun, args)

        Spawns the given module and function passing the given args, links it to the current process and returns its pid.

        @@ -1548,7 +1559,7 @@

        Examples

        spawn_link(SomeModule, :function, [1,2,3])
         
        - Source + Source

        term_to_binary(term) @@ -1560,7 +1571,7 @@

        Examples

        to a file in an efficient way, or sending an Erlang term to some type of communications channel not supported by distributed Erlang.

        - Source + Source

        term_to_binary(term, opts) @@ -1574,21 +1585,21 @@

        Examples

        for more details
      50. - Source + Source

        throw(term)

        A non-local return from a function. Check try/2 for more information.

        - Source + Source

        tl(list)

        Returns the tail of a list. Raises ArgumentError if the list is empty.

        - Source + Source

        trunc(number) @@ -1601,21 +1612,21 @@

        Examples

        trunc(5.5) #=> 5
         
        - Source + Source

        tuple_size(tuple)

        Returns the size of a tuple.

        - Source + Source

        tuple_to_list(tuple)

        Converts a tuple to a list.

        - Source + Source
        @@ -1638,7 +1649,7 @@

        Examples

        !false #=> true !nil #=> true

        - Source + Source

        !=(left, right) @@ -1658,7 +1669,7 @@

        Examples

        #=> false
        - Source + Source

        !==(left, right) @@ -1675,7 +1686,7 @@

        Examples

        #=> true
        - Source + Source

        &&(left, right) @@ -1696,7 +1707,7 @@

        Examples

        this operator accepts any expression as arguments, not only booleans, however it is not allowed in guards.

        - Source + Source

        *(left, right) @@ -1708,7 +1719,7 @@

        Examples

        1 * 2 #=> 2
         
        - Source + Source

        +(left, right) @@ -1720,7 +1731,7 @@

        Examples

        1 + 2 #=> 3
         
        - Source + Source

        ++(left, right) @@ -1736,7 +1747,7 @@

        Examples

        #=> 'foobar'
        - Source + Source

        -(left, right) @@ -1748,7 +1759,7 @@

        Examples

        1 - 2 #=> -1
         
        - Source + Source

        --(left, right) @@ -1765,7 +1776,7 @@

        Examples

        #=> [3,1]
        - Source + Source

        ..(first, last) @@ -1781,7 +1792,7 @@

        Examples

        3 in 1..3 #=> true
        - Source + Source

        /(left, right) @@ -1796,7 +1807,28 @@

        Examples

        2 / 1 #=> 2.0
        - Source + Source +
        +

        + />(left, right) +

        +

        /> is called the pipeline operator as it is useful +to write pipeline style expressions. This operator +tntroduces the expression on the left as the first +argument to the expression on the right.

        + +

        Examples

        + +
        [1,[2],3] /> List.flatten /> Enum.map(&1 * 2)
        +#=> [2,4,6]
        +
        + +

        The expression above is simply translated to:

        + +
        Enum.map(List.flatten([1,[2],3]), &1 * 2)
        +
        +
        + Source

        <(left, right) @@ -1810,7 +1842,7 @@

        Examples

        #=> true
        - Source + Source

        <-(left, right) @@ -1825,7 +1857,7 @@

        Examples

        process <- { :ok, "Sending myself a message" }
        - Source + Source

        <=(left, right) @@ -1839,7 +1871,7 @@

        Examples

        #=> true
        - Source + Source

        <>(left, right) @@ -1858,7 +1890,7 @@

        Examples

        x #=> "bar"
        - Source + Source

        ==(left, right) @@ -1879,7 +1911,7 @@

        Examples

        #=> true
        - Source + Source

        ===(left, right) @@ -1896,7 +1928,22 @@

        Examples

        #=> false
        - Source + Source +
        +

        + =~(left, right) +

        +

        Matches the term on the left against the regular expression +on the right. It returns nil if not match happened or the +first match otherwise.

        + +

        Examples

        + +
        "abcd" =~ %r/c(d)/  #=> "cd"
        +"abcd" =~ %r/e/     #=> nil
        +
        +
        + Source

        >(left, right) @@ -1910,7 +1957,7 @@

        Examples

        #=> false
        - Source + Source

        >=(left, right) @@ -1924,7 +1971,7 @@

        Examples

        #=> false
        - Source + Source

        @(expr) @@ -1972,7 +2019,7 @@

        Examples

        time and not at runtime. Check the module Module for other functions to manipulate module attributes.

        - Source + Source

        __B__(string, list2) @@ -1986,7 +2033,7 @@

        Examples

        %B(f#{o}o) #=> "f\#{o}o"
        - Source + Source

        __C__(arg1, list2) @@ -2000,7 +2047,7 @@

        Examples

        %C(f#{o}o) #=> 'f\#{o}o'
        - Source + Source

        __R__(arg1, options) @@ -2013,7 +2060,7 @@

        Examples

        Regex.match? %R(f#{1,3}o), "f#o"  #=> true
         
        - Source + Source

        __b__(arg1, list2) @@ -2027,7 +2074,7 @@

        Examples

        %b(f#{:o}o) #=> "foo"
        - Source + Source

        __c__(arg1, list2) @@ -2041,7 +2088,7 @@

        Examples

        %c(f#{:o}o) #=> 'foo'
        - Source + Source

        __r__(arg1, options) @@ -2053,37 +2100,35 @@

        Examples

        Regex.match? %r(foo), "foo"  #=> true
         
        - Source + Source

        - access(element, keyword) + access(element, args)

        Access the given element using the qualifier according to the Access protocol. All calls in the form foo[bar] are translated to access(foo, bar).

        -

        A common usage of this protocol is to access a key in a -keywords list:

        +

        The usage of this protocol is to access a raw value in a +keywords list.

        sample = [a: 1, b: 2, c: 3]
         sample[:b] #=> 2
         
        -

        Many types implement this protocol, so check the protocol -implementations for more information.

        - -

        Records

        +

        Atoms

        -

        The access protocol has a compilation time feature that -which allows us to match against an specific part of a -record:

        +

        Whenever invoked on an atom, the access protocol is expanded +at compilation time rather than on runtime. This feature is used +by records to allow a developer to match against an specific part +of a record:

        def increment(State[counter: counter, other: 13] = state) do
           state.counter(counter + 1)
         end
         
        -

        In the example above, we use the Access protocol to match the +

        In the example above, we use the Access protocol to match the counter field in the record State. Considering the record definition is as follows:

        @@ -2104,26 +2149,23 @@

        Records

        end -

        The example above is slightly faster than -State.new(counter: :counter) because the record is -expanded at compilation time and not at runtime. If a field -is not specified on creation, it will have its default value.

        +

        The example above is slightly faster than State.new(counter: :counter) +because the record is expanded at compilation time and not at runtime. +If a field is not specified on creation, it will have its default value.

        -

        Finally, as in Erlang, Elixir also allows the following -syntax:

        +

        Finally, as in Erlang, Elixir also allows the following syntax:

        new_uri = State[_: 1]
         
        -

        In this example, all fields will be set to 1. Notice -that, as in Erlang, in case an expression is given, it will -be evaluated multiple times:

        +

        In this case all fields will be set to 1. Notice that, +as in Erlang, in case an expression is given, it will be +evaluated multiple times:

        -
        new_uri = Uri.Config[_: IO.puts "Hello"]
        +
        new_uri = State[_: IO.puts "Hello"]
         
        -

        If Uri.Config has many fields, "Hello" will be printed -many times.

        +

        In this case, "Hello" will be printed twice (one per each field).

        Examples

        @@ -2132,7 +2174,7 @@

        Examples

        access a, 1 #=> :a
        - Source + Source

        and(left, right) @@ -2146,7 +2188,20 @@

        Examples

        #=> false
        - Source + Source +
        +

        + apply(module, fun, args) +

        +

        Invokes the given fun from module with the array of arguments args.

        + +

        Examples

        + +
        apply List, reverse, [[1,2,3]]
        +#=> [3,2,1]
        +
        +
        + Source

        atom_to_binary(some_atom) @@ -2159,7 +2214,7 @@

        Examples

        atom_to_binary :my_atom #=> "my_atom"
         
        - Source + Source

        binary_to_atom(some_binary) @@ -2173,7 +2228,7 @@

        Examples

        binary_to_atom "my_atom" #=> :my_atom
         
        - Source + Source

        binary_to_existing_atom(some_binary) @@ -2187,7 +2242,7 @@

        Examples

        binary_to_existing_atom "my_atom" #=> :my_atom
        - Source + Source

        case(condition, blocks) @@ -2240,7 +2295,7 @@

        Examples

        end
        - Source + Source

        cond(list1) @@ -2260,7 +2315,7 @@

        Examples

        end
        - Source + Source

        def(name, list2) @@ -2337,7 +2392,7 @@

        Dynamic generation with atoms

        because each entry k is a an atom and invoking def unquote(k)() would be invalid Elixir syntax.

        - Source + Source

        def(name, args, guards, list4) @@ -2375,7 +2430,7 @@

        Examples

        end
        - Source + Source

        defdelegate(tuples, opts) @@ -2421,7 +2476,7 @@

        Examples

        #=> [3,2,1]
        - Source + Source

        defexception(name, values, opts // [], do_block // []) @@ -2430,7 +2485,7 @@

        Examples

        The defined record must implement message/1 as API, otherwise an error is raised. Check exception.ex for examples.

        - Source + Source

        defimpl(name, opts, do_block // []) @@ -2438,7 +2493,7 @@

        Examples

        Defines an implementation for the given protocol. See defprotocol/2 for examples.

        - Source + Source

        defmodule(name, list2) @@ -2483,7 +2538,7 @@

        Dynamic names

        Elixir will accept any module name as long as the expression returns an atom.

        - Source + Source

        defoverridable(tuples) @@ -2492,7 +2547,7 @@

        Dynamic names

        An overridable function is lazily defined, allowing a developer to customize it.

        - Source + Source

        defp(name, list2) @@ -2516,14 +2571,14 @@

        Examples

        In the example above, sum is private and accessing it through Foo.sum will raise an error.

        - Source + Source

        defp(name, args, guards, list4)

        The same as def/4 but generates a private function.

        - Source + Source

        defprotocol(name, list2) @@ -2636,7 +2691,7 @@

        Protocols + Records

        Finally, since records are simply tuples, one can add a default protocol implementation to any record by defining a default implementation for tuples.

        - Source + Source

        defrecord(name, values, opts // [], do_block // []) @@ -2701,7 +2756,7 @@

        Documentation

        defrecord Config, [counter: 0, failures: []], moduledoc: "A simple record"
         
        - Source + Source

        destructure(left, right) @@ -2742,7 +2797,7 @@

        Examples

        the first value from the right side. Otherwise, it will raise a CaseClauseError.

        - Source + Source

        div(left, right) @@ -2756,7 +2811,7 @@

        Examples

        5 div 2 #=> 2
         
        - Source + Source

        elem(tuple, index) @@ -2769,7 +2824,7 @@

        Example

        tuple = { :foo, :bar, 3 } elem(tuple, 1) #=> :foo

        - Source + Source

        if(condition, list2) @@ -2813,7 +2868,7 @@

        Blocks examples

        If you want to compare more than two clauses, you can use the cond/1 macro.

        - Source + Source

        in(left, right) @@ -2855,7 +2910,7 @@

        Clauses

        In this case, Elixir will automatically expand it and define the variable for us.

        - Source + Source

        inspect(arg) @@ -2868,7 +2923,7 @@

        Examples

        #=> ":foo"
        - Source + Source

        is_exception(thing) @@ -2881,7 +2936,7 @@

        Examples

        is_exception(1) #=> false
        - Source + Source

        is_record(thing, kind) @@ -2898,14 +2953,14 @@

        Examples

        is_record(Config.new, List) #=> false
        - Source + Source

        is_regex(thing)

        Check if the given argument is a regex.

        - Source + Source

        match?(left, right) @@ -2932,7 +2987,7 @@

        Examples

        Enum.filter list, match?({:a, x } when x < 2, &1)
        - Source + Source

        not(arg) @@ -2946,7 +3001,7 @@

        Examples

        #=> true
        - Source + Source

        or(left, right) @@ -2960,7 +3015,7 @@

        Examples

        #=> true
        - Source + Source

        receive(args) @@ -3008,7 +3063,7 @@

        Examples

        will occur immediately.

        - Source + Source

        rem(left, right) @@ -3022,7 +3077,7 @@

        Examples

        5 rem 2 #=> 1
         
        - Source + Source

        setelem(tuple, index, value) @@ -3035,7 +3090,7 @@

        Example

        tuple = { :foo, :bar, 3 } setelem(tuple, 1, :baz) #=> { :baz, :bar, 3 }

        - Source + Source

        to_binary(arg) @@ -3049,7 +3104,7 @@

        Examples

        #=> "foo"
        - Source + Source

        to_char_list(arg) @@ -3062,7 +3117,7 @@

        Examples

        #=> 'foo'
        - Source + Source

        try(args) @@ -3170,7 +3225,7 @@

        Catching exits and Erlang errors

        Although the second form should be avoided in favor of raise/rescue control mechanisms.

        - Source + Source

        unless(clause, options) @@ -3179,7 +3234,7 @@

        Catching exits and Erlang errors

        unless a value evalutes to true. Check if for examples and documentation.

        - Source + Source

        use(module, args // []) @@ -3212,7 +3267,7 @@

        Examples

        end
        - Source + Source

        var!(var) @@ -3221,7 +3276,7 @@

        Examples

        be hygienezed. Check Elixir.SpecialForms.quote/1 for more information.

        - Source + Source

        xor(left, right) @@ -3235,7 +3290,7 @@

        Examples

        #=> true
        - Source + Source

        ||(left, right) @@ -3256,7 +3311,7 @@

        Examples

        this operator accepts any expression as arguments, not only booleans, however it is not allowed in guards.

        - Source + Source diff --git a/docs/master/Elixir.ParallelCompiler.html b/docs/master/Elixir.ParallelCompiler.html index 5ec34231c..2cca65857 100644 --- a/docs/master/Elixir.ParallelCompiler.html +++ b/docs/master/Elixir.ParallelCompiler.html @@ -32,7 +32,7 @@

        - Source + Source @@ -75,7 +75,7 @@

        Functions

        with the module names and binaries defined inside it can be optionally given as argument.

        - Source + Source

        files_to_path(files, path, callback // default_callback) @@ -83,7 +83,7 @@

        Functions

        Compiles the given files to the given path. Read files/2 for more information.

        - Source + Source
        diff --git a/docs/master/Elixir.SpecialForms.html b/docs/master/Elixir.SpecialForms.html index a54098b7c..3781d97ea 100644 --- a/docs/master/Elixir.SpecialForms.html +++ b/docs/master/Elixir.SpecialForms.html @@ -34,7 +34,7 @@

        - Source + Source @@ -95,21 +95,11 @@

        Macros summary

        lc/1 -
      51. - - loop/1 - -
      52. quote/2
      53. -
      54. - - recur/1 - -
      55. require/2 @@ -151,7 +141,7 @@

        Examples

        << 1, 2, 3 >> - Source + Source

        [](args) @@ -164,7 +154,7 @@

        Examples

        [ 1, 2, 3 ]
        - Source + Source

        __ENV__() @@ -173,7 +163,7 @@

        Examples

        record. In the environment you can access the current filename, line numbers, set up aliases, the current function and others.

        - Source + Source

        __FILE__() @@ -182,7 +172,7 @@

        Examples

        Although the file can be accessed in the ENV, this macro is a convenient shortcut.

        - Source + Source

        __MODULE__() @@ -191,7 +181,7 @@

        Examples

        Although the module can be accessed in the ENV, this macro is a convenient shortcut.

        - Source + Source

        alias(module, opts) @@ -235,7 +225,7 @@

        Lexical scope

        have lexical scope. This means you can set up aliases inside specific functions and it won't affect the overall scope.

        - Source + Source

        bc(args) @@ -249,7 +239,7 @@

        Lexical scope

        "helloworld"
        - Source + Source

        fn(args) @@ -301,7 +291,7 @@

        Function with multiple clauses

        fun.(10, 10) #=> 20
        - Source + Source

        import(module, opts) @@ -368,7 +358,7 @@

        Alias/Require shortcut

        also accepts as: as an option so it automatically sets up an alias. Please check alias for more information.

        - Source + Source

        lc(args) @@ -416,34 +406,7 @@

        Alias/Require shortcut

        [{213,45,132},{64,76,32},{76,0,0},{234,32,15}]
        - Source -
        -

        - loop(args) -

        -

        Handle annonymous recursive loops.

        - -

        Examples

        - -
        list = [1,2,3]
        -
        -loop list, [] do
        -  [h|t], acc ->
        -    recur t, [h*2|acc]
        -  [], acc ->
        -    acc
        -end
        -#=> [6,4,2]
        -
        - -

        Notice that all match clauses expects the same ammount -of arguments. Guards can also be given.

        - -

        Recursion happens by calling recur with the same number -of arguments of each match clause. recur does not guarantee -that it will be tail recursive.

        -
        - Source + Source

        quote(opts, list2) @@ -545,22 +508,45 @@

        Options

      56. :hygiene - When false, disables hygiene;
      57. :unquote - When false, disables unquoting. Useful when you have a quote inside another quote and want to control which quote is able to unquote;
      58. -
      59. :line - The line to be returned in each quoted expression. By default, - this is set to 0, so Elixir is able to differentiate the quoted - expressions from the expressions that were injected via unquote. - You can set it to any integer or to the atom :keep in order - to keep the current values.
      60. +
      61. :location - When set to :keep, keeps the current line and file on quotes. + Read the Stacktrace information section below for more information;
      62. + +

        Stacktrace information

        + +

        One of Elixir goals is to provide proper stacktrace whenever there is an +exception. In order to work properly with macros, the default behavior +in quote is to set the line to 0. When a macro is invoked and the quoted +expressions is expanded, 0 is replaced by the line of the call site.

        + +

        This is a good behavior for the majority of the cases, except if the macro +is defining new functions. Consider this example:

        + +
        defmodule MyServer do
        +  use GenServer.Behavior
        +end
        +
        + +

        GenServer.Behavior defines new functions in our MyServer module. +However, if there is an exception in any of these functions, we want +the stacktrace to point to the GenServer.Behavior and not the line +that calls use GenServer.Behavior. For this reason, there is an +option called :location that when set to :keep keeps these proper +semantics:

        + +
        quote location: :keep do
        +  def handle_call(request, _from, state) do
        +    { :reply, :undef, state }
        +  end
        +end
        +
        + +

        It is important to warn though that location: :keep evaluates the +code as if it was defined inside GenServer.Behavior file, in +particular, the macro __FILE__ will always point to +GenServer.Behavior file.

        - Source -
        -

        - recur(args) -

        -

        A function that forces the current loop to recur. See loop/1 -for more information.

        -
        - Source + Source

        require(module, opts) @@ -591,7 +577,7 @@

        Alias shortcut

        require also accepts as: as an option so it automatically sets up an alias. Please check alias for more information.

        - Source + Source

        unquote(expr) @@ -620,7 +606,7 @@

        Examples

        #=> { :sum, 0, [1, 13, 3] }
        - Source + Source

        unquote_splicing(expr) @@ -635,7 +621,7 @@

        Examples

        #=> { :sum, 0, [1, 2, 3, 4, 5] }
        - Source + Source

        {}(args) @@ -648,7 +634,7 @@

        Examples

        { 1, 2, 3 }
        - Source + Source diff --git a/docs/master/Elixir.Typespec.html b/docs/master/Elixir.Typespec.html index 79cd58c3d..c81524d75 100644 --- a/docs/master/Elixir.Typespec.html +++ b/docs/master/Elixir.Typespec.html @@ -35,7 +35,7 @@

        - Source + Source @@ -97,7 +97,7 @@

        Functions

        was already compiled, you need to loop its attributes to get such information.

        - Source + Source

        get_types(module) @@ -107,7 +107,7 @@

        Functions

        was already compiled, you need to loop its attributes to get such information.

        - Source + Source @@ -120,25 +120,25 @@

        Macros

        defcallback(spec, block)

        - Source + Source

        defspec(spec, block)

        - Source + Source

        deftype(name, options // [])

        - Source + Source

        deftypep(name)

        - Source + Source
        diff --git a/docs/master/Enum.Iterator.HashDict.Record.html b/docs/master/Enum.Iterator.HashDict.Record.html index 9dc49f4f1..6658757db 100644 --- a/docs/master/Enum.Iterator.HashDict.Record.html +++ b/docs/master/Enum.Iterator.HashDict.Record.html @@ -29,7 +29,7 @@

        - Source + Source @@ -62,13 +62,13 @@

        Functions

        count(arg1)

        - Source + Source

        iterator(arg1)

        - Source + Source
        diff --git a/docs/master/Enum.Iterator.List.html b/docs/master/Enum.Iterator.List.html index 71c9f0d73..c2d6245d7 100644 --- a/docs/master/Enum.Iterator.List.html +++ b/docs/master/Enum.Iterator.List.html @@ -29,7 +29,7 @@

        - Source + Source @@ -62,13 +62,13 @@

        Functions

        count(list)

        - Source + Source

        iterator(list)

        - Source + Source
        diff --git a/docs/master/Enum.Iterator.Orddict.Record.html b/docs/master/Enum.Iterator.Orddict.Record.html index c83efd6cf..91853a5bb 100644 --- a/docs/master/Enum.Iterator.Orddict.Record.html +++ b/docs/master/Enum.Iterator.Orddict.Record.html @@ -29,7 +29,7 @@

        - Source + Source @@ -62,13 +62,13 @@

        Functions

        count(arg1)

        - Source + Source

        iterator(arg1)

        - Source + Source
        diff --git a/docs/master/Enum.Iterator.Range.html b/docs/master/Enum.Iterator.Range.html index 02c7d9ae3..8b757bfe7 100644 --- a/docs/master/Enum.Iterator.Range.html +++ b/docs/master/Enum.Iterator.Range.html @@ -29,7 +29,7 @@

        - Source + Source @@ -62,13 +62,13 @@

        Functions

        count(range)

        - Source + Source

        iterator(range)

        - Source + Source
        diff --git a/docs/master/Enum.Iterator.html b/docs/master/Enum.Iterator.html index c7f07baa6..0ae7062e3 100644 --- a/docs/master/Enum.Iterator.html +++ b/docs/master/Enum.Iterator.html @@ -45,7 +45,7 @@

        - Source + Source

        Implementations

        @@ -108,7 +108,7 @@

        Functions

        The function used to retrieve the collection size.

        - Source + Source

        iterator(xA) @@ -142,7 +142,7 @@

        Iterating lists

        list and the Enum module will be able to take over the list and retrieve the proper iterator function.

        - Source + Source diff --git a/docs/master/Enum.OrdIterator.List.html b/docs/master/Enum.OrdIterator.List.html index c093c98d7..de14965ce 100644 --- a/docs/master/Enum.OrdIterator.List.html +++ b/docs/master/Enum.OrdIterator.List.html @@ -29,7 +29,7 @@

        - Source + Source @@ -62,13 +62,13 @@

        Functions

        iterator(list)

        - Source + Source

        - to_list(arg1, ) + to_list(arg1, arg2)

        - Source + Source
        diff --git a/docs/master/Enum.OrdIterator.Orddict.Record.html b/docs/master/Enum.OrdIterator.Orddict.Record.html index d1716f931..dfd440a10 100644 --- a/docs/master/Enum.OrdIterator.Orddict.Record.html +++ b/docs/master/Enum.OrdIterator.Orddict.Record.html @@ -29,7 +29,7 @@

        - Source + Source @@ -62,13 +62,13 @@

        Functions

        iterator(arg1)

        - Source + Source

        - to_list(arg1, ) + to_list(arg1, arg2)

        - Source + Source
        diff --git a/docs/master/Enum.OrdIterator.Range.html b/docs/master/Enum.OrdIterator.Range.html index 022a88302..c59ad03e1 100644 --- a/docs/master/Enum.OrdIterator.Range.html +++ b/docs/master/Enum.OrdIterator.Range.html @@ -29,7 +29,7 @@

        - Source + Source @@ -62,13 +62,13 @@

        Functions

        iterator(range)

        - Source + Source

        to_list(arg1, iterator)

        - Source + Source
        diff --git a/docs/master/Enum.OrdIterator.html b/docs/master/Enum.OrdIterator.html index 0baa20376..6752d4620 100644 --- a/docs/master/Enum.OrdIterator.html +++ b/docs/master/Enum.OrdIterator.html @@ -42,7 +42,7 @@

        - Source + Source

        Implementations

        @@ -100,7 +100,7 @@

        Functions

        Must return a tuple under the same conditions as Enum.Iterator.iterator.

        - Source + Source

        to_list(xA, xB) @@ -116,7 +116,7 @@

        Functions

        back, this function is invoked allowing us to get a result back without a need to loop the remaining items.

        - Source + Source diff --git a/docs/master/Enum.html b/docs/master/Enum.html index b69496b22..8b12f94ac 100644 --- a/docs/master/Enum.html +++ b/docs/master/Enum.html @@ -42,7 +42,7 @@

        - Source + Source @@ -111,6 +111,11 @@

        Functions summary

        find_value/3 +
      63. + + first/1 + +
      64. join/2 @@ -131,6 +136,11 @@

        Functions summary

        map_reduce/3
      65. +
      66. + + nth/2 + +
      67. partition/2 @@ -211,7 +221,7 @@

        Examples

        Enum.all? [1,nil,3] #=> false - Source + Source

        any?(collection, fun // fn(x) do @@ -237,7 +247,7 @@

        Examples

        Enum.any? [false,true,false] #=> true
        - Source + Source

        count(collection) @@ -249,7 +259,7 @@

        Examples

        Enum.count [1,2,3] #=> 3
         
        - Source + Source

        drop(collection, count) @@ -264,7 +274,7 @@

        Examples

        Enum.drop [1,2,3], 0 #=> [1,2,3]
        - Source + Source

        drop_while(collection, fun) @@ -278,7 +288,7 @@

        Examples

        #=> [3,4,5]
        - Source + Source

        each(collection, fun) @@ -291,7 +301,7 @@

        Examples

        Enum.each ['some', 'example'], fn(x) -> IO.puts x end
         
        - Source + Source

        empty?(collection) @@ -304,7 +314,7 @@

        Examples

        Enum.empty? [1,2,3] #=> false
        - Source + Source

        filter(collection, fun) @@ -318,7 +328,7 @@

        Examples

        #=> [2]
        - Source + Source

        filter_map(collection, filter, mapper) @@ -331,7 +341,7 @@

        Examples

        #=> [4]
        - Source + Source

        find(collection, ifnone // nil, fun) @@ -351,7 +361,7 @@

        Examples

        #=> 3
        - Source + Source

        find_index(collection, fun) @@ -366,11 +376,11 @@

        Examples

          Enum.find_index [2,4,6], fn(x) -> rem(x, 2) == 1 end
           #=> nil
         
        -  Enum.find_value [2,3,4], fn(x) -> rem(x, 2) == 1 end
        +  Enum.find_index [2,3,4], fn(x) -> rem(x, 2) == 1 end
           #=> 2
         
        - Source + Source

        find_value(collection, ifnone // nil, fun) @@ -387,7 +397,20 @@

        Examples

        #=> true
        - Source + Source +
        +

        + first(collection) +

        +

        Returns the first item in the collection or nil otherwise.

        + +

        Examples

        + +
        Enum.first []      #=> nil
        +Enum.first [1,2,3] #=> 1
        +
        +
        + Source

        join(collection, joiner // "") @@ -408,7 +431,7 @@

        Examples

        Enum.join([1,2,3], ' = ') #=> '1 = 2 = 3'
        - Source + Source

        map(collection, fun) @@ -426,7 +449,7 @@

        Examples

        #=> [a: -1, b: -2]
        - Source + Source

        map_join(collection, joiner // "", mapper) @@ -447,7 +470,7 @@

        Examples

        Enum.map_join([1,2,3], &1 * 2, ' = ') #=> '2 = 4 = 6'
        - Source + Source

        map_reduce(collection, acc, f) @@ -466,7 +489,24 @@

        Examples

        #=> { [2, 4, 6], 6 }
        - Source + Source +
        +

        + nth(collection, n) +

        +

        Finds the element at the nth index. Returns nil in case +the given index is outside the range of the collection.

        + +

        Expects an ordered collection.

        + +

        ## Examples

        + +
          Enum.nth [2,4,6], 1 #=> 2
        +  Enum.nth [2,4,6], 3 #=> 6
        +  Enum.nth [2,4,6], 5 #=> nil
        +
        +
        + Source

        partition(collection, fun) @@ -481,7 +521,7 @@

        Examples

        #=> { [2], [1,3] }
        - Source + Source

        qsort(collection) @@ -493,7 +533,7 @@

        Examples

        Enum.qsort [3,2,1] #=> [1,2,3]
         
        - Source + Source

        reduce(collection, acc, fun) @@ -508,7 +548,7 @@

        Examples

        #=> 6
        - Source + Source

        split(collection, count) @@ -523,7 +563,7 @@

        Examples

        Enum.split [1,2,3], 0 #=> { [], [1,2,3] }
        - Source + Source

        split_with(collection, fun) @@ -537,7 +577,7 @@

        Examples

        #=> { [1], [2, 3, 4] }
        - Source + Source

        take(collection, count) @@ -552,7 +592,7 @@

        Examples

        Enum.take [1,2,3], 0 #=> []
        - Source + Source

        take_while(collection, fun) @@ -566,7 +606,7 @@

        Examples

        #=> [1, 2]
        - Source + Source

        times(times, function) @@ -582,7 +622,7 @@

        Examples

        3
        - Source + Source

        times(times, acc, function) @@ -597,7 +637,7 @@

        Examples

        #=> 15
        - Source + Source diff --git a/docs/master/ErlangError.html b/docs/master/ErlangError.html index 27e7755ca..ac3396f02 100644 --- a/docs/master/ErlangError.html +++ b/docs/master/ErlangError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -108,55 +108,55 @@

        Functions

        exception(args)

        - Source + Source

        exception(args, self)

        - Source + Source

        message(exception)

        - Source + Source

        new()

        - Source + Source

        new(opts)

        - Source + Source

        original(record)

        - Source + Source

        original(value, record)

        - Source + Source

        to_keywords(record)

        - Source + Source

        update_original(function, record)

        - Source + Source
        diff --git a/docs/master/ExUnit.AssertionError.html b/docs/master/ExUnit.AssertionError.html index 4856fda04..da50116b6 100644 --- a/docs/master/ExUnit.AssertionError.html +++ b/docs/master/ExUnit.AssertionError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -103,49 +103,49 @@

        Functions

        exception(args)

        - Source + Source

        exception(args, self)

        - Source + Source

        message(record)

        - Source + Source

        message(value, record)

        - Source + Source

        new()

        - Source + Source

        new(opts)

        - Source + Source

        to_keywords(record)

        - Source + Source

        update_message(function, record)

        - Source + Source
        diff --git a/docs/master/ExUnit.Assertions.html b/docs/master/ExUnit.Assertions.html index 553f4a565..1833cf6eb 100644 --- a/docs/master/ExUnit.Assertions.html +++ b/docs/master/ExUnit.Assertions.html @@ -47,7 +47,7 @@

        - Source + Source @@ -182,7 +182,7 @@

        Examples

        assert false, "it will never be true"
         
        - Source + Source

        assert_empty(enum, message // nil) @@ -195,7 +195,7 @@

        Examples

        assert_empty [1, 2]
        - Source + Source

        assert_error(expected, function) @@ -209,7 +209,7 @@

        Examples

        end
        - Source + Source

        assert_exit(expected, function) @@ -223,7 +223,7 @@

        Examples

        end
        - Source + Source

        assert_in_delta(expected, received, delta, message // nil) @@ -236,20 +236,20 @@

        Examples

        assert_in_delta 10, 15, 4
        - Source + Source

        assert_member(base, container, message // nil)

        - Source + Source

        assert_nil(value, message // nil)

        Asserts the value is nil.

        - Source + Source

        assert_raise(exception, function) @@ -263,7 +263,7 @@

        Examples

        end
        - Source + Source

        assert_raise(exception, expected_message, function) @@ -277,7 +277,7 @@

        Examples

        end
        - Source + Source

        assert_throw(expected, function) @@ -291,7 +291,7 @@

        Examples

        end
        - Source + Source

        flunk(message // "Epic Fail!") @@ -303,7 +303,7 @@

        Examples

        flunk "This should raise an error"
         
        - Source + Source

        refute(not_expected, message) @@ -316,7 +316,7 @@

        Examples

        refute true, "This will obviously fail"
         
        - Source + Source

        refute_empty(enum, message // nil) @@ -329,7 +329,7 @@

        Examples

        refute_empty [1, 2]
        - Source + Source

        refute_in_delta(expected, received, delta, message // nil) @@ -342,20 +342,20 @@

        Examples

        refute_in_delta 10, 11, 2
        - Source + Source

        refute_member(base, container, message // nil)

        - Source + Source

        refute_nil(value, message // nil)

        Asserts the value is not nil.

        - Source + Source
        @@ -381,13 +381,13 @@

        Examples

        assert true
         
        - Source + Source

        assert_match(expected, received)

        - Source + Source

        refute(expected) @@ -402,13 +402,13 @@

        Examples

        refute false
         
        - Source + Source

        refute_match(expected, received)

        - Source + Source
        diff --git a/docs/master/ExUnit.Case.html b/docs/master/ExUnit.Case.html index 50e7f686b..9376c7029 100644 --- a/docs/master/ExUnit.Case.html +++ b/docs/master/ExUnit.Case.html @@ -59,7 +59,7 @@

        Examples

        - Source + Source @@ -102,7 +102,7 @@

        Examples

        end - Source + Source diff --git a/docs/master/ExUnit.html b/docs/master/ExUnit.html index ff24148e1..5d89466dd 100644 --- a/docs/master/ExUnit.html +++ b/docs/master/ExUnit.html @@ -63,7 +63,7 @@

        Assertions

        - Source + Source @@ -111,7 +111,7 @@

        Options

      68. :max_cases - Maximum number of cases to run in parallel
      69. - Source + Source

        run() @@ -119,7 +119,7 @@

        Options

        API used to run the tests. A developer does not need to call it directly.

        - Source + Source

        start(options // []) @@ -128,7 +128,7 @@

        Options

        any file that uses ExUnit.Case. Check configure/1 to see the supported options.

        - Source + Source diff --git a/docs/master/Exception.html b/docs/master/Exception.html index 913292c79..cb89ed42f 100644 --- a/docs/master/Exception.html +++ b/docs/master/Exception.html @@ -33,7 +33,7 @@

        - Source + Source @@ -78,14 +78,14 @@

        Functions

        Formats file and line information present in stacktraces. Expect them to be given in a keywords list.

        - Source + Source

        format_file_line(file, line)

        Formats the given file and line.

        - Source + Source

        format_module_fun_arity(module, fun, arity) @@ -94,14 +94,14 @@

        Functions

        representing such invocation. Arity may also be a list of arguments. It follows the same syntax as in stacktraces.

        - Source + Source

        format_stacktrace(arg1)

        Formats each line in the stacktrace.

        - Source + Source
        diff --git a/docs/master/File.Error.html b/docs/master/File.Error.html index df2e878ca..a5125e1f1 100644 --- a/docs/master/File.Error.html +++ b/docs/master/File.Error.html @@ -29,7 +29,7 @@

        - Source + Source @@ -150,91 +150,91 @@

        Functions

        action(record)

        - Source + Source

        action(value, record)

        - Source + Source

        exception(args)

        - Source + Source

        exception(args, self)

        - Source + Source

        message(exception)

        - Source + Source

        new()

        - Source + Source

        new(opts)

        - Source + Source

        path(record)

        - Source + Source

        path(value, record)

        - Source + Source

        reason(record)

        - Source + Source

        reason(value, record)

        - Source + Source

        to_keywords(record)

        - Source + Source

        update_action(function, record)

        - Source + Source

        update_path(function, record)

        - Source + Source

        update_reason(function, record)

        - Source + Source
        diff --git a/docs/master/File.Stat.html b/docs/master/File.Stat.html index 9263eebeb..803518799 100644 --- a/docs/master/File.Stat.html +++ b/docs/master/File.Stat.html @@ -63,7 +63,7 @@

        - Source + Source @@ -379,253 +379,253 @@

        Functions

        access(record)

        - Source + Source

        access(value, record)

        - Source + Source

        atime(record)

        - Source + Source

        atime(value, record)

        - Source + Source

        ctime(record)

        - Source + Source

        ctime(value, record)

        - Source + Source

        gid(record)

        - Source + Source

        gid(value, record)

        - Source + Source

        inode(record)

        - Source + Source

        inode(value, record)

        - Source + Source

        links(record)

        - Source + Source

        links(value, record)

        - Source + Source

        major_device(record)

        - Source + Source

        major_device(value, record)

        - Source + Source

        minor_device(record)

        - Source + Source

        minor_device(value, record)

        - Source + Source

        mode(record)

        - Source + Source

        mode(value, record)

        - Source + Source

        mtime(record)

        - Source + Source

        mtime(value, record)

        - Source + Source

        new()

        - Source + Source

        new(opts)

        - Source + Source

        size(record)

        - Source + Source

        size(value, record)

        - Source + Source

        to_keywords(record)

        - Source + Source

        type(record)

        - Source + Source

        type(value, record)

        - Source + Source

        uid(record)

        - Source + Source

        uid(value, record)

        - Source + Source

        update_access(function, record)

        - Source + Source

        update_atime(function, record)

        - Source + Source

        update_ctime(function, record)

        - Source + Source

        update_gid(function, record)

        - Source + Source

        update_inode(function, record)

        - Source + Source

        update_links(function, record)

        - Source + Source

        update_major_device(function, record)

        - Source + Source

        update_minor_device(function, record)

        - Source + Source

        update_mode(function, record)

        - Source + Source

        update_mtime(function, record)

        - Source + Source

        update_size(function, record)

        - Source + Source

        update_type(function, record)

        - Source + Source

        update_uid(function, record)

        - Source + Source
        diff --git a/docs/master/File.html b/docs/master/File.html index 2a4a003a8..55c612d83 100644 --- a/docs/master/File.html +++ b/docs/master/File.html @@ -38,7 +38,7 @@

        - Source + Source @@ -210,7 +210,7 @@

        Examples

        #=> "" - Source + Source

        basename(path, extension) @@ -229,7 +229,7 @@

        Examples

        #=> "bar.old"
        - Source + Source

        close(io_device) @@ -241,14 +241,14 @@

        Examples

        close/1 might return an old write error and not even try to close the file. See open/2.

        - Source + Source

        dir?(path)

        Returns true if the path is a directory.

        - Source + Source

        dirname(path) @@ -261,7 +261,7 @@

        Examples

        #=> "foo"
        - Source + Source

        exists?(path) @@ -282,7 +282,7 @@

        Examples

        #=> true
        - Source + Source

        expand_path(path) @@ -295,7 +295,7 @@

        Examples

        File.expand_path("/foo/bar/../bar") == "/foo/bar"
         
        - Source + Source

        expand_path(path, relative_to) @@ -310,7 +310,7 @@

        Examples

        File.expand_path("/foo/bar/../bar", "/baz") == "/foo/bar"
        - Source + Source

        extname(path) @@ -325,7 +325,7 @@

        Examples

        #=> ""
        - Source + Source

        join(paths) @@ -343,7 +343,7 @@

        Examples

        #=> "/foo/bar"
        - Source + Source

        join(left, right) @@ -356,7 +356,7 @@

        Examples

        #=> "foo/bar"
        - Source + Source

        mkdir(path) @@ -375,7 +375,7 @@

        Examples

        On some platforms, :enoent is returned instead.
        - Source + Source

        mkdir_p(path) @@ -392,13 +392,13 @@

        Examples

        On some platforms, :enoent is returned instead.
        - Source + Source

        open(filename, options // [])

        - Source + Source

        read(path) @@ -420,7 +420,7 @@

        Examples

        You can use Erlang.file.format_error(reason) to get a descriptive string of the error.

        - Source + Source

        read!(path) @@ -428,19 +428,19 @@

        Examples

        Returns binary with the contents of the given filename or raises File.Error if an error occurs.

        - Source + Source

        read_info(path, opts // [])

        - Source + Source

        read_info!(path, opts // [])

        - Source + Source

        regular?(path) @@ -452,7 +452,7 @@

        Examples

        File.regular? __FILE__ #=> true
         
        - Source + Source

        rm(filename) @@ -480,7 +480,7 @@

        Examples

        #=> {:error, :eperm}
        - Source + Source

        rootname(path) @@ -495,7 +495,7 @@

        Examples

        #=> "/foo/bar"
        - Source + Source

        rootname(path, extension) @@ -511,7 +511,7 @@

        Examples

        #=> "/foo/bar.erl"
        - Source + Source

        split(path) @@ -529,7 +529,7 @@

        Examples

        #=> ["/", "foo", "bar"]
        - Source + Source

        stat(path, opts // []) @@ -548,7 +548,7 @@

        Options

        Default is local.
        - Source + Source

        stat!(path, opts // []) @@ -556,7 +556,7 @@

        Options

        Same as stat but returns the File.Stat directly and throws File.Error if an error is returned.

        - Source + Source

        wildcard(glob) @@ -596,7 +596,7 @@

        Examples

        File.wildcard("projects/*/ebin/**/*.{beam,app}")
         
        - Source + Source

        write(filename, content, modes // []) @@ -616,7 +616,7 @@

        Examples

      70. :eisdir - The named file is a directory.
      71. - Source + Source diff --git a/docs/master/FunctionClauseError.html b/docs/master/FunctionClauseError.html index e47af2e1f..a580e283a 100644 --- a/docs/master/FunctionClauseError.html +++ b/docs/master/FunctionClauseError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -150,91 +150,91 @@

        Functions

        arity(record)

        - Source + Source

        arity(value, record)

        - Source + Source

        exception(args)

        - Source + Source

        exception(args, self)

        - Source + Source

        function(record)

        - Source + Source

        function(value, record)

        - Source + Source

        message(exception)

        - Source + Source

        module(record)

        - Source + Source

        module(value, record)

        - Source + Source

        new()

        - Source + Source

        new(opts)

        - Source + Source

        to_keywords(record)

        - Source + Source

        update_arity(function, record)

        - Source + Source

        update_function(function, record)

        - Source + Source

        update_module(function, record)

        - Source + Source
        diff --git a/docs/master/GenServer.Behavior.html b/docs/master/GenServer.Behavior.html index 2e313b3a0..d6cfab050 100644 --- a/docs/master/GenServer.Behavior.html +++ b/docs/master/GenServer.Behavior.html @@ -27,7 +27,7 @@

        - Source + Source @@ -54,7 +54,7 @@

        Macros summary

        Macros

        - __using__() + __using__(arg1)

        By using this module, you get default GenServer callbacks for handle_call, handle_info, handle_cast, terminate @@ -71,7 +71,7 @@

        Macros

        http://www.erlang.org/doc/man/gen_server.html http://www.erlang.org/doc/design_principles/gen_server_concepts.html

        - Source + Source
        diff --git a/docs/master/HashDict.html b/docs/master/HashDict.html index e091ba028..e9f02cabe 100644 --- a/docs/master/HashDict.html +++ b/docs/master/HashDict.html @@ -34,7 +34,7 @@

        - Source + Source @@ -73,7 +73,7 @@

        Functions

        Creates a new empty dict.

        - Source + Source

        new(pairs) @@ -86,7 +86,7 @@

        Examples

        #=> [a: 1, b: 2]
        - Source + Source

        new(list, transform) @@ -100,7 +100,7 @@

        Examples

        #=> ["a": "a", "b": "b"]
        - Source + Source diff --git a/docs/master/Elixir.IEx.Helpers.html b/docs/master/IEx.Helpers.html similarity index 64% rename from docs/master/Elixir.IEx.Helpers.html rename to docs/master/IEx.Helpers.html index 1420790fe..06ef6b998 100644 --- a/docs/master/Elixir.IEx.Helpers.html +++ b/docs/master/IEx.Helpers.html @@ -1,7 +1,7 @@ - Elixir.IEx.Helpers + IEx.Helpers @@ -21,7 +21,7 @@

        - Elixir.IEx.Helpers + IEx.Helpers

        @@ -32,7 +32,7 @@

        - Source + Source @@ -46,6 +46,11 @@

        Functions summary

        c/2 +
      72. + + h/0 + +
      73. m/0 @@ -56,6 +61,11 @@

        Functions summary

        m/1
      74. +
      75. + + v/1 + +
      76. @@ -79,21 +89,37 @@

        Examples

        #=> Foo - Source + Source +
        +

        + h() +

        +

        Prints the history

        +
        + Source

        m()

        Returns the name and module of all modules loaded.

        - Source + Source

        m(mod)

        Prints the module information for the given module.

        - Source + Source +
        +

        + v(n) +

        +

        Retrieves nth query's value from the history. Use negative +values to lookup query's value from latest to earliest. +For instance, v(-1) returns the latest result.

        +
        + Source
        diff --git a/docs/master/Elixir.IEx.UnicodeIO.html b/docs/master/IEx.UnicodeIO.html similarity index 82% rename from docs/master/Elixir.IEx.UnicodeIO.html rename to docs/master/IEx.UnicodeIO.html index 2fae39411..b959eda8d 100644 --- a/docs/master/Elixir.IEx.UnicodeIO.html +++ b/docs/master/IEx.UnicodeIO.html @@ -1,7 +1,7 @@ - Elixir.IEx.UnicodeIO + IEx.UnicodeIO @@ -21,7 +21,7 @@

        - Elixir.IEx.UnicodeIO + IEx.UnicodeIO

        @@ -34,7 +34,7 @@

        - Source + Source @@ -50,7 +50,7 @@

        Functions summary

      77. - get/2 + get/1
      78. @@ -74,16 +74,16 @@

        Functions

        Implements the error IO API used by IEx. It prints error messages.

        - Source + Source
        -

        - get(cache, count) +

        + get(config)

        Implements the get IO API used by IEx. It receives the code cache, the instructions counter and needs to return a list with the new characters inserted.

        - Source + Source

        put(result) @@ -91,7 +91,7 @@

        Functions

        Implements the put IO API used by IEx. It receives the result and prints it.

        - Source + Source
        diff --git a/docs/master/Elixir.IEx.html b/docs/master/IEx.html similarity index 58% rename from docs/master/Elixir.IEx.html rename to docs/master/IEx.html index a1e971113..6327e7e4e 100644 --- a/docs/master/Elixir.IEx.html +++ b/docs/master/IEx.html @@ -1,7 +1,7 @@ - Elixir.IEx + IEx @@ -21,26 +21,26 @@

        - Elixir.IEx + IEx

        -

        This module implements interactive Elixir. It provides two -main functions, start and simple_start. start was -meant for systems where tty is available and relies on -it in order to work properly. This makes all control commands +

        This module implements interactive Elixir. It provides a main +function, start which will either delegate to tty or simple. +The former is meant for systems where tty is available and relies +on it in order to work properly. This makes all control commands available in tty available to the developer.

        In case tty is not available (for example, Windows), a -developer may invoke simple_start which starts a stripped +developer may invoke simple which starts a stripped down version.

        - Source + Source @@ -51,7 +51,7 @@

        Functions summary

        @@ -69,21 +74,28 @@

        Functions summary

        Functions

        -

        - simple_start(binding // [], io // Elixir.IEx.UnicodeIO) +

        + simple(binding // [], io // IEx.UnicodeIO)

        Starts IEx simply using stdio. It requires the initial binding an the IO mechanism as argument.

        - Source + Source

        - start(binding // [], io // Elixir.IEx.UnicodeIO) + start(binding // [], io // IEx.UnicodeIO)

        -

        Starts IEx using a tty server. It requires the initial -binding an the IO mechanism as argument.

        +

        Starts IEx checking if tty is available or not. +If so, invoke tty, otherwise go with the simple iex.

        +
        + Source +
        +

        + tty(binding // [], io // IEx.UnicodeIO) +

        +

        Starts IEx using a tty server.

        - Source + Source
        diff --git a/docs/master/IO.html b/docs/master/IO.html index ffe77abfd..9e5192fb1 100644 --- a/docs/master/IO.html +++ b/docs/master/IO.html @@ -45,7 +45,7 @@

        - Source + Source @@ -117,7 +117,7 @@

        Functions

        NFS file system.

      79. - Source + Source

        gets(device // :stdio, prompt) @@ -133,21 +133,21 @@

        Functions

        NFS file system.

        - Source + Source

        inspect(device // :stdio, item)

        Inspects and writes the given argument to the device -followed by a new line.

        +followed by a new line. Returns the item given.

        - Source + Source

        print(device // :stdio, item)

        - Source + Source

        puts(device // :stdio, item) @@ -156,7 +156,7 @@

        Functions

        but adds a new line at the end. The argument is expected to be a chardata.

        - Source + Source

        read(device // :stdio, count) @@ -171,7 +171,7 @@

        Functions

        NFS file system.

        - Source + Source

        readline(device // :stdio) @@ -186,7 +186,7 @@

        Functions

        NFS file system.

        - Source + Source

        write(device // :stdio, item) @@ -207,7 +207,7 @@

        Examples

        #=> "error"
        - Source + Source diff --git a/docs/master/Keyword.KeyError.html b/docs/master/Keyword.KeyError.html index ff5bd14bc..b82af9e04 100644 --- a/docs/master/Keyword.KeyError.html +++ b/docs/master/Keyword.KeyError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -108,55 +108,55 @@

        Functions

        exception(args)

        - Source + Source

        exception(args, self)

        - Source + Source

        key(record)

        - Source + Source

        key(value, record)

        - Source + Source

        message(exception)

        - Source + Source

        new()

        - Source + Source

        new(opts)

        - Source + Source

        to_keywords(record)

        - Source + Source

        update_key(function, record)

        - Source + Source
        diff --git a/docs/master/Keyword.html b/docs/master/Keyword.html index b36645467..af3ca5472 100644 --- a/docs/master/Keyword.html +++ b/docs/master/Keyword.html @@ -46,7 +46,7 @@

        - Source + Source @@ -149,7 +149,7 @@

        Examples

        Keyword.delete [b: 2], :a #=> [b: 2] - Source + Source

        fetch(list1, key) @@ -163,7 +163,7 @@

        Examples

        Keyword.fetch [a: 1], :b #=> raises KeyError[key: :b]
        - Source + Source

        from_enum(enum) @@ -172,7 +172,7 @@

        Examples

        that behaves as a dict, Keyword.from_enum do not remove duplicated entries.

        - Source + Source

        get(keywords, key, default // nil) @@ -192,7 +192,7 @@

        Examples

        Keyword.get [a: 1], :b, 3 #=> 3
        - Source + Source

        get_values(list1, key) @@ -205,7 +205,7 @@

        Examples

        #=> [1,2]
        - Source + Source

        key?(list1, key) @@ -220,7 +220,7 @@

        Examples

        #=> false
        - Source + Source

        keys(keywords) @@ -233,7 +233,7 @@

        Examples

        Keyword.keys [a: 1, b: 2] #=> [:a,:b]
         
        - Source + Source

        merge(d1, d2) @@ -247,7 +247,7 @@

        Examples

        #=> [a:3, b:2, d: 4]
        - Source + Source

        merge(d1, d2, fun) @@ -263,14 +263,14 @@

        Examples

        #=> [a:4, b:2, d: 4]
        - Source + Source

        new()

        Returns an empty keywords list, i.e. an empty list.

        - Source + Source

        new(pairs) @@ -284,7 +284,7 @@

        Examples

        #=> [a: 2, b: 1]
        - Source + Source

        new(pairs, transform) @@ -299,7 +299,7 @@

        Examples

        #=> [a: :a, b: :b]
        - Source + Source

        put(list1, key, value) @@ -318,7 +318,7 @@

        Examples

        #=> [a: 3, b: 2]
        - Source + Source

        values(keywords) @@ -330,7 +330,7 @@

        Examples

        Keyword.values [a: 1, b: 2] #=> [1,2]
         
        - Source + Source diff --git a/docs/master/List.Chars.Atom.html b/docs/master/List.Chars.Atom.html index eb79f8767..6b2c6837d 100644 --- a/docs/master/List.Chars.Atom.html +++ b/docs/master/List.Chars.Atom.html @@ -29,7 +29,7 @@

        - Source + Source @@ -57,7 +57,7 @@

        Functions

        to_char_list(atom)

        - Source + Source diff --git a/docs/master/List.Chars.BitString.html b/docs/master/List.Chars.BitString.html index d6ba9270b..981bf34ee 100644 --- a/docs/master/List.Chars.BitString.html +++ b/docs/master/List.Chars.BitString.html @@ -29,7 +29,7 @@

        - Source + Source @@ -57,7 +57,7 @@

        Functions

        to_char_list(bitstring)

        - Source + Source diff --git a/docs/master/List.Chars.List.html b/docs/master/List.Chars.List.html index b949780e6..5a8b40ce1 100644 --- a/docs/master/List.Chars.List.html +++ b/docs/master/List.Chars.List.html @@ -29,7 +29,7 @@

        - Source + Source @@ -57,7 +57,7 @@

        Functions

        to_char_list(list)

        - Source + Source diff --git a/docs/master/List.Chars.Number.html b/docs/master/List.Chars.Number.html index 2fcb2155c..2edf4d347 100644 --- a/docs/master/List.Chars.Number.html +++ b/docs/master/List.Chars.Number.html @@ -29,7 +29,7 @@

        - Source + Source @@ -57,7 +57,7 @@

        Functions

        to_char_list(integer)

        - Source + Source diff --git a/docs/master/List.Chars.html b/docs/master/List.Chars.html index c870431dc..997b2cf38 100644 --- a/docs/master/List.Chars.html +++ b/docs/master/List.Chars.html @@ -40,7 +40,7 @@

        - Source + Source

        Implementations

        @@ -97,7 +97,7 @@

        Functions

        to_char_list(xA)

        - Source + Source diff --git a/docs/master/List.html b/docs/master/List.html index c4f5fdba9..f2764b247 100644 --- a/docs/master/List.html +++ b/docs/master/List.html @@ -39,7 +39,7 @@

        - Source + Source @@ -49,11 +49,6 @@

        Functions summary

        • - - access/2 - -
        • -
        • concat/1 @@ -73,11 +68,6 @@

          Functions summary

          duplicate/2
        • -
        • - - find_index/2 - -
        • flatten/1 @@ -178,14 +168,6 @@

          Functions summary

          Functions

          -

          - access(list, access) -

          -

          Simply invokes the Access protocol for the given list. -Check Access.List for more information.

          -
          - Source -

          concat(list)

          @@ -197,7 +179,7 @@

          Examples

          #=> [1,[2],3,4,5,6]
          - Source + Source

          concat(list, elements) @@ -214,7 +196,7 @@

          Examples

          #=> [1,2,3,4,5,6]
          - Source + Source

          delete(list, item) @@ -229,7 +211,7 @@

          Examples

          #=> [2,3]
          - Source + Source

          duplicate(elem, n) @@ -245,24 +227,7 @@

          Examples

          #=> [[1,2],[1,2]]
          - Source -
          -

          - find_index(list, term) -

          -

          Looks for a term in a list and returns its position. -If term is found in the first position, return 1. -If no terms not found in list, the return value is nil.

          - -

          Examples

          - -
          List.find_index ['a'], 'b'
          -#=> nil
          -List.find_index ['a'], 'a'
          -#=> 1
          -
          -
          - Source + Source

          flatten(list) @@ -280,13 +245,13 @@

          Examples

          #=> [1,2,3,4,5]
          - Source + Source

          flatten(list, tail)

          - Source + Source

          foldl(list, acc, function) @@ -303,7 +268,7 @@

          Examples

          #=> 2
          - Source + Source

          foldr(list, acc, function) @@ -317,7 +282,7 @@

          Examples

          #=> -2
          - Source + Source

          keydelete(list, item, position) @@ -338,7 +303,7 @@

          Examples

          #=> [{ :a, 1 }, { :b, 2 }]
          - Source + Source

          keyfind(list, item, position, default // nil) @@ -359,7 +324,7 @@

          Examples

          #=> nil
          - Source + Source

          keymember?(list, item, position) @@ -380,7 +345,7 @@

          Examples

          #=> false
          - Source + Source

          last(xA) @@ -397,7 +362,7 @@

          Examples

          #=> 3
          - Source + Source

          member?(list, term) @@ -415,7 +380,7 @@

          Examples

          #=> false
          - Source + Source

          range(first, last, step // nil) @@ -435,7 +400,7 @@

          Examples

          List.range 5, 1, -2 #=> [5, 3, 1]
          - Source + Source

          reverse(xA) @@ -449,7 +414,7 @@

          Examples

          #=> [3,2,1]
          - Source + Source

          sort(list) @@ -463,7 +428,7 @@

          Examples

          #=> [1, 2, 3, 4, 7]
          - Source + Source

          sort(list, fun) @@ -477,7 +442,7 @@

          Examples

          #=> [7, 4, 3, 2, 1]
          - Source + Source

          uniq(list) @@ -490,7 +455,7 @@

          Examples

          #=> [1,2,3]
          - Source + Source

          unzip(list) @@ -507,7 +472,7 @@

          Examples

          #=> [[1, 2, 3], [:a, :b, :c]]
          - Source + Source

          wrap(list) @@ -521,7 +486,7 @@

          Examples

          List.wrap [1,2,3] #=> [1,2,3]
           
          - Source + Source

          zip(list_of_lists) @@ -537,7 +502,7 @@

          Examples

          #=> [{1, 3, 5}]
          - Source + Source

          zip(item1, item2) @@ -555,7 +520,7 @@

          Examples

          #=> [{1, 4}, {2, 5}]
          - Source + Source diff --git a/docs/master/Macro.Env.html b/docs/master/Macro.Env.html index 59bf5c881..3f830967a 100644 --- a/docs/master/Macro.Env.html +++ b/docs/master/Macro.Env.html @@ -29,7 +29,7 @@

          - Source + Source @@ -93,7 +93,7 @@

          Functions summary

          • - __record__/2 + __access__/2
          • @@ -156,13 +156,13 @@

            Functions summary

            Functions

            -

            - __record__(kind, ) +

            + __access__(caller, args)

            A record that contains compile time environment information, It can be accessed at any time by calling ENV.

            - Source + Source

            aliases(record) @@ -170,14 +170,14 @@

            Functions

            Returns a list of two item tuples, where the first item is the aliased name and the second the actual name.

            - Source + Source

            file(record)

            Returns the current file name as a binary.

            - Source + Source

            function(record) @@ -186,7 +186,7 @@

            Functions

            is the function name and the seconds its arity. Returns nil if not inside a function.

            - Source + Source

            in_guard?(record) @@ -194,7 +194,7 @@

            Functions

            Returns wether the compilation environment is currently inside a guard.

            - Source + Source

            in_match?(record) @@ -202,14 +202,14 @@

            Functions

            Returns wether the compilation environment is currently inside a match clause.

            - Source + Source

            line(record)

            Returns the current line as an integer.

            - Source + Source

            location(record) @@ -217,28 +217,28 @@

            Functions

            Returns a keywords list containing the file and line information as keys.

            - Source + Source

            macros(record)

            Returns a list of macros imported from each module.

            - Source + Source

            module(record)

            Returns the current module name.

            - Source + Source

            requires(record)

            Returns the list of required modules.

            - Source + Source
            diff --git a/docs/master/Macro.html b/docs/master/Macro.html index e1f213418..754c605c9 100644 --- a/docs/master/Macro.html +++ b/docs/master/Macro.html @@ -32,7 +32,7 @@

            - Source + Source @@ -97,7 +97,7 @@

            Examples

            #=> { :{}, 0, [:a, :b, :c] } - Source + Source

            expand(aliases, env) @@ -113,6 +113,21 @@

            Examples

            In case the expression cannot be expanded, it returns the expression itself.

            +

            Notice that Macro.expand is not recursive and it does not +expand child expressions. For example, !some_macro will expand as:

            + +
            iex> IO.puts Macro.to_binary Macro.expand(quote(do: !some_macro), __ENV__)
            +case some_macro do
            +  false -> true
            +  nil   -> true
            +  _     -> false
            +end
            +
            + +

            Notice that the ! operator is a macro that expands to a case. +Even though some_macro is also a macro, it is not expanded +because it is a child expression given to ! as argument.

            +

            Examples

            In the example below, we have a macro that generates a module @@ -178,7 +193,7 @@

            Examples

            end
            - Source + Source

            to_binary(tree) @@ -191,7 +206,7 @@

            Examples

            #=> "foo.bar(1, 2, 3)"
            - Source + Source @@ -206,7 +221,7 @@

            Macros

            Returns a list of binary operators. This is available as a macro so it can be used in guard clauses.

            - Source + Source

            unary_ops() @@ -214,7 +229,7 @@

            Macros

            Returns a list of unary operators. This is available as a macro so it can be used in guard clauses.

            - Source + Source
            diff --git a/docs/master/MatchError.html b/docs/master/MatchError.html index 020536304..12f0eddd5 100644 --- a/docs/master/MatchError.html +++ b/docs/master/MatchError.html @@ -29,7 +29,7 @@

            - Source + Source @@ -108,55 +108,55 @@

            Functions

            actual(record)

            - Source + Source

            actual(value, record)

            - Source + Source

            exception(args)

            - Source + Source

            exception(args, self)

            - Source + Source

            message(exception)

            - Source + Source

            new()

            - Source + Source

            new(opts)

            - Source + Source

            to_keywords(record)

            - Source + Source

            update_actual(function, record)

            - Source + Source
            diff --git a/docs/master/Module.html b/docs/master/Module.html index 5f4d0d8b1..5c98eee8f 100644 --- a/docs/master/Module.html +++ b/docs/master/Module.html @@ -39,7 +39,7 @@

            - Source + Source @@ -152,13 +152,13 @@

            Examples

            end - Source + Source

            add_compile_callback(module, target, fun // :__compiling__)

            - Source + Source

            add_doc(module, line, kind, tuple, signature, doc) @@ -177,7 +177,7 @@

            Examples

            end
            - Source + Source

            concat(list) @@ -192,7 +192,7 @@

            Examples

            Module.concat [Foo, 'Bar'] #=> Foo.Bar
            - Source + Source

            concat(left, right) @@ -207,7 +207,7 @@

            Examples

            Module.concat Foo, 'Bar' #=> Foo.Bar
            - Source + Source

            defined_functions(module) @@ -222,7 +222,7 @@

            Examples

            end
            - Source + Source

            defined_functions(module, kind) @@ -239,7 +239,7 @@

            Examples

            end
            - Source + Source

            delete_attribute(module, key) @@ -254,7 +254,7 @@

            Examples

            end
            - Source + Source

            eval_quoted(env, quoted, binding // [], opts // []) @@ -294,7 +294,7 @@

            Examples

            Foo.sum(1, 2) #=> 3
            - Source + Source

            function_defined?(module, tuple) @@ -312,7 +312,7 @@

            Examples

            end
            - Source + Source

            function_defined?(module, tuple, kind) @@ -329,7 +329,7 @@

            Examples

            end
            - Source + Source

            make_overridable(module, tuples) @@ -338,7 +338,7 @@

            Examples

            An overridable function is lazily defined, allowing a developer to customize it.

            - Source + Source

            read_attribute(module, key) @@ -359,7 +359,7 @@

            Examples

            end
            - Source + Source

            register_attribute(module, new, opts // []) @@ -396,7 +396,7 @@

            Examples

            end
            - Source + Source

            safe_concat(list) @@ -415,7 +415,7 @@

            Examples

            #=> List.Chars
            - Source + Source

            safe_concat(left, right) @@ -434,7 +434,7 @@

            Examples

            #=> List.Chars
            - Source + Source diff --git a/docs/master/Node.html b/docs/master/Node.html index 595d330c4..8ce21072d 100644 --- a/docs/master/Node.html +++ b/docs/master/Node.html @@ -32,7 +32,7 @@

            - Source + Source @@ -87,7 +87,7 @@

            Functions

            Returns true if the local node is alive; that is, if the node can be part of a distributed system. Otherwise, it returns false.

            - Source + Source

            disconnect(node) @@ -99,7 +99,7 @@

            Functions

            See http://www.erlang.org/doc/man/erlang.html#disconnect_node-1 for more info.

            - Source + Source

            list() @@ -107,7 +107,7 @@

            Functions

            Returns a list of all visible nodes in the system, excluding the local node. Same as list(visible).

            - Source + Source

            list(args) @@ -118,7 +118,7 @@

            Functions

            See http://www.erlang.org/doc/man/erlang.html#nodes-1 for more info.

            - Source + Source

            monitor(node, flag) @@ -128,7 +128,7 @@

            Functions

            See http://www.erlang.org/doc/man/erlang.html#monitor_node-2 for more info.

            - Source + Source

            monitor(node, flag, options) @@ -138,7 +138,7 @@

            Functions

            See http://www.erlang.org/doc/man/erlang.html#monitor_node-3 for more info.

            - Source + Source diff --git a/docs/master/OptionParser.Simple.html b/docs/master/OptionParser.Simple.html index c490ced9a..9ba941c1f 100644 --- a/docs/master/OptionParser.Simple.html +++ b/docs/master/OptionParser.Simple.html @@ -27,7 +27,7 @@

            - Source + Source @@ -75,7 +75,7 @@

            Example

            #=> { [debug: true], [] } - Source + Source diff --git a/docs/master/Orddict.html b/docs/master/Orddict.html index 6e730c637..2eb20d587 100644 --- a/docs/master/Orddict.html +++ b/docs/master/Orddict.html @@ -35,7 +35,7 @@

            - Source + Source @@ -74,7 +74,7 @@

            Functions

            Creates a new empty dict.

            - Source + Source

            new(pairs) @@ -87,7 +87,7 @@

            Examples

            #=> [a: 1, b: 2]
            - Source + Source

            new(list, transform) @@ -101,7 +101,7 @@

            Examples

            #=> ["a": "a", "b": "b"]
            - Source + Source diff --git a/docs/master/Port.html b/docs/master/Port.html index 301cb1bb1..ccbec0685 100644 --- a/docs/master/Port.html +++ b/docs/master/Port.html @@ -32,7 +32,7 @@

            - Source + Source @@ -101,63 +101,63 @@

            Functions

            - Source + Source

            command(port, data, options // [])

            - Source + Source
            diff --git a/docs/master/Process.html b/docs/master/Process.html index a791ceae6..1cd6831d2 100644 --- a/docs/master/Process.html +++ b/docs/master/Process.html @@ -37,7 +37,7 @@

            - Source + Source @@ -239,21 +239,21 @@

            Functions

            pid must refer to a process at the local node.

            - Source + Source

            delete()

            Deletes all items in the dictionary.

            - Source + Source

            delete(key)

            Deletes the given key from the dictionary.

            - Source + Source

            demonitor(monitor_ref, options // []) @@ -264,7 +264,7 @@

            Functions

            See http://www.erlang.org/doc/man/erlang.html#demonitor-2 for more info.

            - Source + Source

            exit(xA, xB) @@ -291,7 +291,7 @@

            Examples

            Process.exit(other, :kil)
             
            - Source + Source

            flag(flag, value) @@ -301,7 +301,7 @@

            Examples

            See http://www.erlang.org/doc/man/erlang.html#process_flag-2 for more info.

            - Source + Source

            flag(pid, flag, value) @@ -312,7 +312,7 @@

            Examples

            See http://www.erlang.org/doc/man/erlang.html#process_flag-3 for more info.

            - Source + Source

            get() @@ -321,21 +321,21 @@

            Examples

            with no specific ordering (i.e. they are not a keywords list).

            - Source + Source

            get(key, default // nil)

            Returns the value for the given key.

            - Source + Source

            get_keys(xA)

            Returns all keys that have the given value.

            - Source + Source

            info(pid, spec) @@ -345,7 +345,7 @@

            Examples

            See http://www.erlang.org/doc/man/erlang.html#process_info-2 for more info.

            - Source + Source

            link(xA) @@ -355,7 +355,7 @@

            Examples

            See http://www.erlang.org/doc/man/erlang.html#link-1 for more info.

            - Source + Source

            list() @@ -369,7 +369,7 @@

            Examples

            See http://www.erlang.org/doc/man/erlang.html#processes-0 for more info.

            - Source + Source

            monitor(item) @@ -379,14 +379,14 @@

            Examples

            See http://www.erlang.org/doc/man/erlang.html#monitor-2 for more info.

            - Source + Source

            put(key, value)

            Stores the given key-value in the process dictionary.

            - Source + Source

            register(xA, xB) @@ -397,21 +397,21 @@

            Examples

            See http://www.erlang.org/doc/man/erlang.html#register-2 for more info.

            - Source + Source

            registered()

            Returns a list of names which have been registered using register/2.

            - Source + Source

            self()

            Returns the current process.

            - Source + Source

            spawn(xA) @@ -419,7 +419,7 @@

            Examples

            Returns the pid of a new process started by the application of fun. Otherwise works like spawn/3.

            - Source + Source

            spawn(xA, xB) @@ -428,7 +428,7 @@

            Examples

            on node. If node does not exist, a useless pid is returned. Otherwise works like spawn/3.

            - Source + Source

            spawn(xA, xB, xC) @@ -439,7 +439,7 @@

            Examples

            See http://www.erlang.org/doc/man/erlang.html#spawn-3 for more info.

            - Source + Source

            spawn(xA, xB, xC, xD) @@ -448,7 +448,7 @@

            Examples

            module.function(args) on node. If node does not exists, a useless pid is returned. Otherwise works like spawn/3.

            - Source + Source

            spawn_link(xA) @@ -457,7 +457,7 @@

            Examples

            A link is created between the calling process and the new process, atomically. Otherwise works like spawn/3.

            - Source + Source

            spawn_link(xA, xB) @@ -468,7 +468,7 @@

            Examples

            (and due to the link, an exit signal with exit reason :noconnection will be received). Otherwise works like spawn/3.

            - Source + Source

            spawn_link(xA, xB, xC) @@ -477,7 +477,7 @@

            Examples

            module.function(args). A link is created between the calling process and the new process, atomically. Otherwise works like spawn/3.

            - Source + Source

            spawn_link(xA, xB, xC, xD) @@ -488,7 +488,7 @@

            Examples

            pid is returned (and due to the link, an exit signal with exit reason :noconnection will be received). Otherwise works like spawn/3.

            - Source + Source

            spawn_monitor(xA) @@ -497,7 +497,7 @@

            Examples

            and reference for a monitor created to the new process. Otherwise works like spawn/3.

            - Source + Source

            spawn_monitor(xA, xB, xC) @@ -506,7 +506,7 @@

            Examples

            and the process is monitored at the same time. Returns the pid and a reference for the monitor. Otherwise works like spawn/3.

            - Source + Source

            spawn_opt(xA, xB) @@ -515,7 +515,7 @@

            Examples

            Please read http://www.erlang.org/doc/man/erlang.html#spawn_opt-4 for documentation of the options.

            - Source + Source

            spawn_opt(xA, xB, xC) @@ -524,7 +524,7 @@

            Examples

            Please read http://www.erlang.org/doc/man/erlang.html#spawn_opt-4 for documentation of the options.

            - Source + Source

            spawn_opt(xA, xB, xC, xD) @@ -533,7 +533,7 @@

            Examples

            Please read http://www.erlang.org/doc/man/erlang.html#spawn_opt-4 for documentation of the options.

            - Source + Source

            spawn_opt(xA, xB, xC, xD, xE) @@ -542,7 +542,7 @@

            Examples

            Please read http://www.erlang.org/doc/man/erlang.html#spawn_opt-4 for documentation of the options.

            - Source + Source

            unlink(xA) @@ -553,7 +553,7 @@

            Examples

            See http://www.erlang.org/doc/man/erlang.html#unlink-1 for more info.

            - Source + Source

            unregister(xA) @@ -562,7 +562,7 @@

            Examples

            See http://www.erlang.org/doc/man/erlang.html#unregister-1 for more info.

            - Source + Source

            whereis(xA) @@ -572,7 +572,7 @@

            Examples

            See http://www.erlang.org/doc/man/erlang.html#whereis-1 for more info.

            - Source + Source diff --git a/docs/master/Protocol.UndefinedError.html b/docs/master/Protocol.UndefinedError.html index 959c26835..975cc7e8e 100644 --- a/docs/master/Protocol.UndefinedError.html +++ b/docs/master/Protocol.UndefinedError.html @@ -29,7 +29,7 @@

            - Source + Source @@ -129,73 +129,73 @@

            Functions

            exception(args)

            - Source + Source

            exception(args, self)

            - Source + Source

            message(exception)

            - Source + Source

            new()

            - Source + Source

            new(opts)

            - Source + Source

            protocol(record)

            - Source + Source

            protocol(value, record)

            - Source + Source

            structure(record)

            - Source + Source

            structure(value, record)

            - Source + Source

            to_keywords(record)

            - Source + Source

            update_protocol(function, record)

            - Source + Source

            update_structure(function, record)

            - Source + Source
            diff --git a/docs/master/Range.Iterator.Number.html b/docs/master/Range.Iterator.Number.html index 73dddcfd3..7bf6fdb11 100644 --- a/docs/master/Range.Iterator.Number.html +++ b/docs/master/Range.Iterator.Number.html @@ -29,7 +29,7 @@

            - Source + Source @@ -62,13 +62,13 @@

            Functions

            count(first, arg2)

            - Source + Source

            iterator(first, arg2)

            - Source + Source
            diff --git a/docs/master/Range.Iterator.html b/docs/master/Range.Iterator.html index a723b3755..ee8baa9b1 100644 --- a/docs/master/Range.Iterator.html +++ b/docs/master/Range.Iterator.html @@ -29,7 +29,7 @@

            - Source + Source

            Implementations

            @@ -74,7 +74,7 @@

            Functions

            Count how many items are in the range.

            - Source + Source

            iterator(xA, xB) @@ -85,7 +85,7 @@

            Functions

            a tuple with two elements: the given item and the next item in the iteration.

            - Source + Source diff --git a/docs/master/Range.html b/docs/master/Range.html index 4f9dd440f..19576c884 100644 --- a/docs/master/Range.html +++ b/docs/master/Range.html @@ -29,7 +29,7 @@

            - Source + Source @@ -85,14 +85,14 @@

            Functions

            Returns the first item of the range.

            - Source + Source

            last(range)

            Returns the last item of the range.

            - Source + Source

            new(options) @@ -104,7 +104,7 @@

            Examples

            Range.new first: 1, last: 10
             
            - Source + Source diff --git a/docs/master/Record.html b/docs/master/Record.html index eefd974b7..ad1b13b92 100644 --- a/docs/master/Record.html +++ b/docs/master/Record.html @@ -32,7 +32,7 @@

            - Source + Source @@ -42,6 +42,11 @@

            Functions summary

            • + + access/4 + +
            • +
            • defrecord/3 @@ -61,6 +66,15 @@

              Functions summary

              Functions

              +

              + access(caller, atom, fields, keyword) +

              +

              Implements the access macro used by records. +It returns a quoted expression that represents +the access given by the keywords.

              +
              + Source +

              defrecord(name, values, opts)

              @@ -68,7 +82,7 @@

              Functions

              This is invoked directly by Elixir.Builtin.defrecord. Returns the quoted expression of a module given by name.

              - Source + Source

              extract(name, opts) @@ -81,7 +95,7 @@

              Examples

              defrecord FileInfo, Record.extract(:file_info, from_lib: "kernel/include/file.hrl")
               
              - Source + Source diff --git a/docs/master/Regex.html b/docs/master/Regex.html index 8ee3e822f..4bf002226 100644 --- a/docs/master/Regex.html +++ b/docs/master/Regex.html @@ -85,7 +85,7 @@

              - Source + Source @@ -99,6 +99,11 @@

              Functions summary

              compile/2
            • +
            • + + first/2 + +
            • indexes/2 @@ -169,7 +174,21 @@

              Functions

              Check the module documentation for more information about the options supported by compile.

              - Source + Source +
              +

              + first(arg1, string) +

              +

              Runs the regular expression against the given string. +It returns the first match or nil if no match ocurred.

              + +

              Examples

              + +
              Regex.first %r/c(d)/, "abcd"  #=> "cd"
              +Regex.first %r/e/, "abcd"     #=> nil
              +
              +
              + Source

              indexes(arg1, string) @@ -185,7 +204,7 @@

              Examples

              Regex.run %r/e/, "abcd" #=> nil
              - Source + Source

              match?(arg1, string) @@ -198,7 +217,7 @@

              Examples

              Regex.match? %r/foo/, "bar" #=> false
              - Source + Source

              opts(arg1) @@ -210,14 +229,14 @@

              Examples

              Regex.opts %r(foo)m #=> 'm'
               
              - Source + Source

              re_pattern(arg1)

              Returns the underlying re_pattern in the regular expression.

              - Source + Source

              replace(arg1, string, replacement) @@ -237,7 +256,7 @@

              Examples

              Regex.replace(%r/(b)/, "abc", "[\\1]") #=> "a[b]c"
              - Source + Source

              replace_all(arg1, string, replacement) @@ -246,7 +265,7 @@

              Examples

              expressions matches in the string. Please read replace/3 for documentation and examples.

              - Source + Source

              run(arg1, string) @@ -260,7 +279,7 @@

              Examples

              Regex.run %r/e/, "abcd" #=> nil
              - Source + Source

              scan(arg1, string) @@ -277,7 +296,7 @@

              Examples

              Regex.scan %r/e/, "abcd" #=> []
              - Source + Source

              source(arg1) @@ -289,7 +308,7 @@

              Examples

              Regex.source %r(foo) #=> "foo"
               
              - Source + Source

              split(arg1, string, parts // :infinity) @@ -297,7 +316,7 @@

              Examples

              Split the given target in the number of parts specified. If no ammount of parts is given, it defaults to :infinity.

              - Source + Source
              diff --git a/docs/master/RuntimeError.html b/docs/master/RuntimeError.html index eedfaa35c..69e767b2f 100644 --- a/docs/master/RuntimeError.html +++ b/docs/master/RuntimeError.html @@ -29,7 +29,7 @@

              - Source + Source @@ -103,49 +103,49 @@

              Functions

              exception(args)

              - Source + Source

              exception(args, self)

              - Source + Source

              message(record)

              - Source + Source

              message(value, record)

              - Source + Source

              new()

              - Source + Source

              new(opts)

              - Source + Source

              to_keywords(record)

              - Source + Source

              update_message(function, record)

              - Source + Source
              diff --git a/docs/master/SyntaxError.html b/docs/master/SyntaxError.html index c54f52bcd..8cac73e85 100644 --- a/docs/master/SyntaxError.html +++ b/docs/master/SyntaxError.html @@ -29,7 +29,7 @@

              - Source + Source @@ -150,91 +150,91 @@

              Functions

              description(record)

              - Source + Source

              description(value, record)

              - Source + Source

              exception(args)

              - Source + Source

              exception(args, self)

              - Source + Source

              file(record)

              - Source + Source

              file(value, record)

              - Source + Source

              line(record)

              - Source + Source

              line(value, record)

              - Source + Source

              message(exception)

              - Source + Source

              new()

              - Source + Source

              new(opts)

              - Source + Source

              to_keywords(record)

              - Source + Source

              update_description(function, record)

              - Source + Source

              update_file(function, record)

              - Source + Source

              update_line(function, record)

              - Source + Source
              diff --git a/docs/master/System.html b/docs/master/System.html index 9915fab71..90c86407a 100644 --- a/docs/master/System.html +++ b/docs/master/System.html @@ -34,7 +34,7 @@

              - Source + Source @@ -118,7 +118,7 @@

              Functions

              Returns the list of command-line arguments passed to the program.

              - Source + Source

              at_exit(fun) @@ -130,7 +130,7 @@

              Functions

              The function must expect the exit status code as argument.

              - Source + Source

              build_info() @@ -140,7 +140,7 @@

              Functions

              The format of the return value may change in a future release. Please make sure your code doesn't depend on it.

              - Source + Source

              cmd(command) @@ -149,7 +149,7 @@

              Functions

              captures the standard output of the command and returns the result as a binary.

              - Source + Source

              find_executable(command) @@ -158,7 +158,7 @@

              Functions

              its name using the environment variable PATH on Unix and Windows.

              - Source + Source

              get_env() @@ -167,7 +167,7 @@

              Functions

              given as a single string of the format "VarName=Value", where VarName is the name of the variable and Value its value.

              - Source + Source

              get_env(varname) @@ -176,7 +176,7 @@

              Functions

              varname as a binary, or nil if the environment variable is undefined.

              - Source + Source

              get_pid() @@ -186,7 +186,7 @@

              Functions

              See http://www.erlang.org/doc/man/os.html#getpid-0 for more info.

              - Source + Source

              put_env(dict) @@ -194,28 +194,28 @@

              Functions

              Sets a new value for each environment variable corresponding to each key in dict.

              - Source + Source

              put_env(varname, value)

              Sets a new value for the environment variable varname.

              - Source + Source

              stacktrace()

              Get the stacktrace.

              - Source + Source

              version()

              Returns Elixir's version as binary.

              - Source + Source
              diff --git a/docs/master/SystemLimitError.html b/docs/master/SystemLimitError.html index e1cd05f08..72ea413c4 100644 --- a/docs/master/SystemLimitError.html +++ b/docs/master/SystemLimitError.html @@ -29,7 +29,7 @@

              - Source + Source @@ -103,49 +103,49 @@

              Functions

              exception(args)

              - Source + Source

              exception(args, self)

              - Source + Source

              message(record)

              - Source + Source

              message(value, record)

              - Source + Source

              new()

              - Source + Source

              new(opts)

              - Source + Source

              to_keywords(record)

              - Source + Source

              update_message(function, record)

              - Source + Source
              diff --git a/docs/master/TokenMissingError.html b/docs/master/TokenMissingError.html index de8f6ce27..96575b38d 100644 --- a/docs/master/TokenMissingError.html +++ b/docs/master/TokenMissingError.html @@ -29,7 +29,7 @@

              - Source + Source @@ -150,91 +150,91 @@

              Functions

              description(record)

              - Source + Source

              description(value, record)

              - Source + Source

              exception(args)

              - Source + Source

              exception(args, self)

              - Source + Source

              file(record)

              - Source + Source

              file(value, record)

              - Source + Source

              line(record)

              - Source + Source

              line(value, record)

              - Source + Source

              message(exception)

              - Source + Source

              new()

              - Source + Source

              new(opts)

              - Source + Source

              to_keywords(record)

              - Source + Source

              update_description(function, record)

              - Source + Source

              update_file(function, record)

              - Source + Source

              update_line(function, record)

              - Source + Source
              diff --git a/docs/master/Tuple.html b/docs/master/Tuple.html index 14ac629e7..d248ac3e6 100644 --- a/docs/master/Tuple.html +++ b/docs/master/Tuple.html @@ -27,42 +27,19 @@

              - Source + Source -

              Functions summary

              - -
              -

              Functions

              -
              -

              - access(tuple, access) -

              -

              Simply invokes the Access protocol for the given tuple. -Check Access.Tuple for more information.

              -
              - Source -
              -
              - - - diff --git a/docs/master/URI.FTP.html b/docs/master/URI.FTP.html index f62b45e4c..27de39a0c 100644 --- a/docs/master/URI.FTP.html +++ b/docs/master/URI.FTP.html @@ -27,7 +27,7 @@

              - Source + Source @@ -60,13 +60,13 @@

              Functions

              default_port()

              - Source + Source

              parse(info)

              - Source + Source
              diff --git a/docs/master/URI.HTTP.html b/docs/master/URI.HTTP.html index 7b5097541..3b0d4b01d 100644 --- a/docs/master/URI.HTTP.html +++ b/docs/master/URI.HTTP.html @@ -27,7 +27,7 @@

              - Source + Source @@ -60,13 +60,13 @@

              Functions

              default_port()

              - Source + Source

              parse(info)

              - Source + Source
              diff --git a/docs/master/URI.HTTPS.html b/docs/master/URI.HTTPS.html index 263c1a2f3..348178ef3 100644 --- a/docs/master/URI.HTTPS.html +++ b/docs/master/URI.HTTPS.html @@ -27,7 +27,7 @@

              - Source + Source @@ -60,13 +60,13 @@

              Functions

              default_port()

              - Source + Source

              parse(info)

              - Source + Source
              diff --git a/docs/master/URI.LDAP.html b/docs/master/URI.LDAP.html index d1553a02d..05e503e68 100644 --- a/docs/master/URI.LDAP.html +++ b/docs/master/URI.LDAP.html @@ -27,7 +27,7 @@

              - Source + Source @@ -60,13 +60,13 @@

              Functions

              default_port()

              - Source + Source

              parse(info)

              - Source + Source
              diff --git a/docs/master/URI.Parser.html b/docs/master/URI.Parser.html index 77555efcd..a415da2e1 100644 --- a/docs/master/URI.Parser.html +++ b/docs/master/URI.Parser.html @@ -33,7 +33,7 @@

              - Source + Source @@ -61,7 +61,7 @@

              Functions

              behaviour_info(atom1)

              - Source + Source diff --git a/docs/master/URI.SFTP.html b/docs/master/URI.SFTP.html index e0be6bca2..0c58261db 100644 --- a/docs/master/URI.SFTP.html +++ b/docs/master/URI.SFTP.html @@ -27,7 +27,7 @@

              - Source + Source @@ -60,13 +60,13 @@

              Functions

              default_port()

              - Source + Source

              parse(info)

              - Source + Source
              diff --git a/docs/master/URI.TFTP.html b/docs/master/URI.TFTP.html index 3f3963e1a..7f95f0af5 100644 --- a/docs/master/URI.TFTP.html +++ b/docs/master/URI.TFTP.html @@ -27,7 +27,7 @@

              - Source + Source @@ -60,13 +60,13 @@

              Functions

              default_port()

              - Source + Source

              parse(info)

              - Source + Source
              diff --git a/docs/master/URI.html b/docs/master/URI.html index cb423a6ff..9ec853acf 100644 --- a/docs/master/URI.html +++ b/docs/master/URI.html @@ -32,7 +32,7 @@

              - Source + Source @@ -81,7 +81,7 @@

              Functions

              Unpercent (URL) decodes a URI.

              - Source + Source

              decode_query(q, dict // Orddict.new()) @@ -92,14 +92,14 @@

              Functions

              Returns nil if the query string is malformed.

              - Source + Source

              encode(s)

              Percent (URL) encodes a URI.

              - Source + Source

              encode_query(l) @@ -110,7 +110,7 @@

              Functions

              that implements the Binary.Chars protocol (i.e. can be converted to binary).

              - Source + Source

              parse(s) @@ -132,7 +132,7 @@

              Functions

              for that particular scheme. Take a look at URI.HTTPS for an example of one of these extension modules.

              - Source + Source diff --git a/docs/master/UndefinedFunctionError.html b/docs/master/UndefinedFunctionError.html index 01365ca33..6b34ce876 100644 --- a/docs/master/UndefinedFunctionError.html +++ b/docs/master/UndefinedFunctionError.html @@ -29,7 +29,7 @@

              - Source + Source @@ -150,91 +150,91 @@

              Functions

              arity(record)

              - Source + Source

              arity(value, record)

              - Source + Source

              exception(args)

              - Source + Source

              exception(args, self)

              - Source + Source

              function(record)

              - Source + Source

              function(value, record)

              - Source + Source

              message(exception)

              - Source + Source

              module(record)

              - Source + Source

              module(value, record)

              - Source + Source

              new()

              - Source + Source

              new(opts)

              - Source + Source

              to_keywords(record)

              - Source + Source

              update_arity(function, record)

              - Source + Source

              update_function(function, record)

              - Source + Source

              update_module(function, record)

              - Source + Source
              diff --git a/docs/master/modules_list.html b/docs/master/modules_list.html index 98e88c053..a241be432 100644 --- a/docs/master/modules_list.html +++ b/docs/master/modules_list.html @@ -45,13 +45,6 @@

            • @@ -475,6 +531,13 @@

              Elixir.Builtin

            • +
            • + + />/2 + + Elixir.Builtin +
            • +
            • </2 @@ -517,6 +580,13 @@

              Elixir.Builtin

            • +
            • + + =~/2 + + Elixir.Builtin +
            • +
            • >/2 @@ -1357,98 +1427,6 @@

              Elixir.Builtin

            • -

          • - - - - Elixir.IEx - - - Elixir.IEx -
          • -
              -
            • - - - - Helpers - - - Elixir.IEx.Helpers -
            • -
                - - -
              • - - c/2 - - Elixir.IEx.Helpers -
              • - -
              • - - m/0 - - Elixir.IEx.Helpers -
              • - -
              • - - m/1 - - Elixir.IEx.Helpers -
              • - -
            • - - - - UnicodeIO - - - Elixir.IEx.UnicodeIO -
            • -
                - - -
              • - - error/1 - - Elixir.IEx.UnicodeIO -
              • - -
              • - - get/2 - - Elixir.IEx.UnicodeIO -
              • - -
              • - - put/1 - - Elixir.IEx.UnicodeIO -
              • - -
              - -
            • - - simple_start/2 - - Elixir.IEx -
            • - -
            • - - start/2 - - Elixir.IEx -
            • -
          • @@ -1557,13 +1535,6 @@

            Elixir.SpecialForms

          • -
          • - - loop/1 - - Elixir.SpecialForms -
          • -
          • quote/2 @@ -1571,13 +1542,6 @@

            Elixir.SpecialForms

          • -
          • - - recur/1 - - Elixir.SpecialForms -
          • -
          • require/2 @@ -1756,6 +1720,13 @@

            Enum

          • +
          • + + first/1 + + Enum +
          • +
          • join/2 @@ -1784,6 +1755,13 @@

            Enum

          • +
          • + + nth/2 + + Enum +
          • +
          • partition/2 @@ -2344,6 +2322,119 @@

            HashDict

          • +
        • + + + + IEx + + + IEx +
        • +
            +
          • + + + + Helpers + + + IEx.Helpers +
          • +
              + + +
            • + + c/2 + + IEx.Helpers +
            • + +
            • + + h/0 + + IEx.Helpers +
            • + +
            • + + m/0 + + IEx.Helpers +
            • + +
            • + + m/1 + + IEx.Helpers +
            • + +
            • + + v/1 + + IEx.Helpers +
            • + +
          • + + + + UnicodeIO + + + IEx.UnicodeIO +
          • +
              + + +
            • + + error/1 + + IEx.UnicodeIO +
            • + +
            • + + get/1 + + IEx.UnicodeIO +
            • + +
            • + + put/1 + + IEx.UnicodeIO +
            • + +
            + +
          • + + simple/2 + + IEx +
          • + +
          • + + start/2 + + IEx +
          • + +
          • + + tty/2 + + IEx +
          • +
        • @@ -2534,13 +2625,6 @@

            -
          • - - access/2 - - List -
          • -
          • concat/1 @@ -2569,13 +2653,6 @@

            List

          • -
          • - - find_index/2 - - List -
          • -
          • flatten/1 @@ -3323,6 +3400,13 @@

              +
            • + + access/4 + + Record +
            • +
            • defrecord/3 @@ -3356,6 +3440,13 @@

              Regex

            • +
            • + + first/2 + + Regex +
            • +
            • indexes/2 @@ -3534,13 +3625,6 @@

            • diff --git a/docs/master/protocols_list.html b/docs/master/protocols_list.html index a7877411a..9e11738d5 100644 --- a/docs/master/protocols_list.html +++ b/docs/master/protocols_list.html @@ -62,25 +62,6 @@

              Access.Atom

            • -

          • - - - - BitString - - - Access.BitString -
          • -
              - - -
            • - - access/2 - - Access.BitString -
            • -
          • @@ -119,25 +100,6 @@

            Access.List

          • -

        • - - - - Tuple - - - Access.Tuple -
        • -
            - - -
          • - - access/2 - - Access.Tuple -
          • -
        • diff --git a/docs/master/records_list.html b/docs/master/records_list.html index 700efae8e..7f02da40f 100644 --- a/docs/master/records_list.html +++ b/docs/master/records_list.html @@ -1372,7 +1372,7 @@

        • - __record__/2 + __access__/2 Macro.Env
        • From af6295954c8f2597938692fbdc1076b907d58ce9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Thu, 12 Jul 2012 11:44:57 +0200 Subject: [PATCH 171/437] Improvements to crash course --- crash-course.markdown | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/crash-course.markdown b/crash-course.markdown index db9cbae5c..6e7a730ac 100644 --- a/crash-course.markdown +++ b/crash-course.markdown @@ -5,7 +5,7 @@ layout: default # Erlang/Elixir Syntax: A Crash Course -This is a quick introduction to the Elixir syntax for Erlang developers and vice-versa. It is the absolute minimum amount of knowledge you need in order to understand Erlang code, read the docs, sample code, etc. +This is a quick introduction to the Elixir syntax for Erlang developers and vice-versa. It is the absolute minimum amount of knowledge you need in order to understand Elixir/Erlang code, read the docs, sample code, etc. ## Running Erlang code @@ -668,28 +668,6 @@ case { x, y } do end {% endhighlight %} -### Loop - -Elixir provides a convenient construct for loops which Erlang does not have. In -general, it is better to use one of the functions provided by the ``Enum`` module -or a list comprehension. - -{% highlight ruby %} -loop [1, 2, 3, 4, 5], [] do - [h|t], acc -> - recur t, [h*h|acc] - [], acc -> - List.reverse acc -end -#=> [1, 4, 9, 16, 25] - -Enum.map [1, 2, 3, 4, 5], &1 * &1 -#=> [1, 4, 9, 16, 25] - -lc x in [1, 2, 3, 4, 5], do: x * x -#=> [1, 4, 9, 16, 25] -{% endhighlight %} - ### Sending and Receiving Messages The syntax for sending and receiving differs only slightly between Erlang and Elixir. From 75d6f21156ac5cce6586e97271edffc6ae7d07dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Thu, 12 Jul 2012 12:29:31 +0200 Subject: [PATCH 172/437] Do not link to master on blog posts --- ...2012-04-24-a-peek-inside-elixir-s-parallel-compiler.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_posts/2012-04-24-a-peek-inside-elixir-s-parallel-compiler.markdown b/_posts/2012-04-24-a-peek-inside-elixir-s-parallel-compiler.markdown index b168e14d2..e8c8594fc 100644 --- a/_posts/2012-04-24-a-peek-inside-elixir-s-parallel-compiler.markdown +++ b/_posts/2012-04-24-a-peek-inside-elixir-s-parallel-compiler.markdown @@ -176,6 +176,6 @@ It is important to notice that this code has room for improvements. First, every Also, if we start storing which module each process is depending on, we are able to know whenever we have a deadlock or a dependency on an nonexistent file, allowing us to get rid of the timeout. -All those improvements and other goodies like callbacks are implemented in Elixir source code and we recommend you take a look at both the [Elixir.ParallelCompiler](https://github.com/elixir-lang/elixir/blob/master/lib/elixir/parallel_compiler.ex) and [Elixir.ErrorHandler](https://github.com/elixir-lang/elixir/blob/master/lib/elixir/error_handler.ex) modules to see all the details firsthand. +All those improvements and other goodies like callbacks are implemented in Elixir source code and we recommend you take a look at both the [Elixir.ParallelCompiler](https://github.com/elixir-lang/elixir/blob/6182602f1205e2d9fc54666e0721270a27226fbc/lib/elixir/parallel_compiler.ex) and [Elixir.ErrorHandler](https://github.com/elixir-lang/elixir/blob/6182602f1205e2d9fc54666e0721270a27226fbc/lib/elixir/error_handler.ex) modules to see all the details firsthand. Happy coding! From d88230a1928f65ae058487b09f8c241d392db60c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Tue, 17 Jul 2012 14:40:51 +0300 Subject: [PATCH 173/437] Update master --- getting_started/2.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/getting_started/2.markdown b/getting_started/2.markdown index 8f707a46a..c633453f6 100644 --- a/getting_started/2.markdown +++ b/getting_started/2.markdown @@ -578,10 +578,10 @@ The last control-flow mechanism we are going to discuss is essential to Elixir's In order to exchange messages, each process has a mailbox where the received messages are stored. The `receive` mechanism allows us to go through this mailbox searching for a message that matches the given pattern. Here is an example that uses the arrow operator `<-` to send a message to the current process and then collects this message from its mailbox: # Get the current process id - iex> current_pid = self() + iex> current_pid = Process.self # Spawn another process that will send a message to current_pid - iex> spawn fn(do: current_pid <- { :hello, self() }) + iex> spawn fn(do: current_pid <- { :hello, Process.self }) <0.36.0> # Collect the message From 8f80d8aabc46f995ada5f6967b96b88c6b75ff1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Wed, 18 Jul 2012 13:01:34 +0200 Subject: [PATCH 174/437] Update docs --- docs/master/Access.Atom.html | 2 +- docs/master/ArgumentError.html | 18 +- docs/master/ArithmeticError.html | 18 +- docs/master/BadArityError.html | 26 +- docs/master/BadFunctionError.html | 20 +- docs/master/Binary.Inspect.Any.html | 4 +- docs/master/Binary.Inspect.Number.html | 4 +- docs/master/Binary.Inspect.Regex.html | 4 +- docs/master/CaseClauseError.html | 20 +- docs/master/Code.html | 17 +- docs/master/CompileError.html | 32 +- docs/master/Dict.HashDict.Record.html | 2 +- docs/master/Dict.Orddict.Record.html | 2 +- docs/master/Elixir.Builtin.html | 314 +++++---- docs/master/Elixir.ParallelCompiler.html | 9 +- docs/master/Elixir.ParallelRequire.html | 75 ++ docs/master/Elixir.SpecialForms.html | 97 ++- docs/master/Enum.Iterator.html | 2 +- docs/master/Enum.OrdIterator.List.html | 2 +- .../Enum.OrdIterator.Orddict.Record.html | 2 +- docs/master/Enum.OutOfBoundsError.html | 156 +++++ docs/master/Enum.html | 12 +- docs/master/ErlangError.html | 20 +- docs/master/ExUnit.Assertions.html | 75 +- docs/master/ExUnit.Case.html | 10 +- docs/master/ExUnit.html | 4 +- docs/master/Exception.html | 8 +- docs/master/File.CopyError.html | 284 ++++++++ docs/master/File.Error.html | 32 +- docs/master/File.Stat.html | 86 +-- docs/master/File.html | 630 +++++++++++++++-- docs/master/FunctionClauseError.html | 32 +- docs/master/GenServer.Behavior.html | 2 +- docs/master/IEx.Helpers.html | 76 +- docs/master/IO.html | 17 +- docs/master/Keyword.KeyError.html | 20 +- docs/master/Keyword.html | 34 +- docs/master/List.html | 40 +- docs/master/MatchError.html | 20 +- docs/master/Mix.Error.html | 156 +++++ docs/master/Mix.InvalidTaskError.html | 167 +++++ docs/master/Mix.NoProjectError.html | 156 +++++ docs/master/Mix.NoTaskError.html | 167 +++++ docs/master/Mix.Project.html | 130 ++++ docs/master/Mix.Shell.Test.html | 104 +++ docs/master/Mix.Shell.html | 97 +++ docs/master/Mix.Task.html | 187 +++++ docs/master/Mix.Tasks.Compile.Elixir.html | 109 +++ docs/master/Mix.Tasks.Compile.html | 92 +++ docs/master/Mix.Tasks.Help.html | 79 +++ docs/master/Mix.Tasks.Iex.html | 74 ++ docs/master/Mix.Tasks.Loadpaths.html | 75 ++ docs/master/Mix.Tasks.Test.html | 86 +++ docs/master/Mix.Utils.html | 139 ++++ docs/master/Mix.html | 96 +++ docs/master/Module.html | 20 +- docs/master/Node.html | 24 +- docs/master/Protocol.UndefinedError.html | 26 +- docs/master/Regex.html | 2 +- docs/master/RuntimeError.html | 18 +- docs/master/SyntaxError.html | 32 +- docs/master/System.html | 32 +- docs/master/SystemLimitError.html | 18 +- docs/master/TokenMissingError.html | 32 +- docs/master/UndefinedFunctionError.html | 32 +- docs/master/modules_list.html | 647 +++++++++++++++++- docs/master/records_list.html | 492 +++++++++++++ 67 files changed, 4894 insertions(+), 623 deletions(-) create mode 100644 docs/master/Elixir.ParallelRequire.html create mode 100644 docs/master/Enum.OutOfBoundsError.html create mode 100644 docs/master/File.CopyError.html create mode 100644 docs/master/Mix.Error.html create mode 100644 docs/master/Mix.InvalidTaskError.html create mode 100644 docs/master/Mix.NoProjectError.html create mode 100644 docs/master/Mix.NoTaskError.html create mode 100644 docs/master/Mix.Project.html create mode 100644 docs/master/Mix.Shell.Test.html create mode 100644 docs/master/Mix.Shell.html create mode 100644 docs/master/Mix.Task.html create mode 100644 docs/master/Mix.Tasks.Compile.Elixir.html create mode 100644 docs/master/Mix.Tasks.Compile.html create mode 100644 docs/master/Mix.Tasks.Help.html create mode 100644 docs/master/Mix.Tasks.Iex.html create mode 100644 docs/master/Mix.Tasks.Loadpaths.html create mode 100644 docs/master/Mix.Tasks.Test.html create mode 100644 docs/master/Mix.Utils.html create mode 100644 docs/master/Mix.html diff --git a/docs/master/Access.Atom.html b/docs/master/Access.Atom.html index 2b3220857..82fec597a 100644 --- a/docs/master/Access.Atom.html +++ b/docs/master/Access.Atom.html @@ -54,7 +54,7 @@

          Functions summary

          Functions

          - access(atom, arg2) + access(atom, _)

          The access protocol can only be accessed by atoms at compilation time. If we reach this, we should raise diff --git a/docs/master/ArgumentError.html b/docs/master/ArgumentError.html index 71447cc04..934d4c77e 100644 --- a/docs/master/ArgumentError.html +++ b/docs/master/ArgumentError.html @@ -29,7 +29,7 @@

          - Source + Source @@ -103,49 +103,49 @@

          Functions

          exception(args)

          - Source + Source

          exception(args, self)

          - Source + Source

          message(record)

          - Source + Source

          message(value, record)

          - Source + Source

          new()

          - Source + Source

          new(opts)

          - Source + Source

          to_keywords(record)

          - Source + Source

          update_message(function, record)

          - Source + Source
          diff --git a/docs/master/ArithmeticError.html b/docs/master/ArithmeticError.html index f03e2535a..b7483a548 100644 --- a/docs/master/ArithmeticError.html +++ b/docs/master/ArithmeticError.html @@ -29,7 +29,7 @@

          - Source + Source @@ -103,49 +103,49 @@

          Functions

          exception(args)

          - Source + Source

          exception(args, self)

          - Source + Source

          message(record)

          - Source + Source

          message(value, record)

          - Source + Source

          new()

          - Source + Source

          new(opts)

          - Source + Source

          to_keywords(record)

          - Source + Source

          update_message(function, record)

          - Source + Source
          diff --git a/docs/master/BadArityError.html b/docs/master/BadArityError.html index 231034cf0..44d289472 100644 --- a/docs/master/BadArityError.html +++ b/docs/master/BadArityError.html @@ -29,7 +29,7 @@

          - Source + Source @@ -129,73 +129,73 @@

          Functions

          args(record)

          - Source + Source

          args(value, record)

          - Source + Source

          exception(args)

          - Source + Source

          exception(args, self)

          - Source + Source

          function(record)

          - Source + Source

          function(value, record)

          - Source + Source

          message(exception)

          - Source + Source

          new()

          - Source + Source

          new(opts)

          - Source + Source

          to_keywords(record)

          - Source + Source

          update_args(function, record)

          - Source + Source

          update_function(function, record)

          - Source + Source
          diff --git a/docs/master/BadFunctionError.html b/docs/master/BadFunctionError.html index 6bdbf5909..c71393de3 100644 --- a/docs/master/BadFunctionError.html +++ b/docs/master/BadFunctionError.html @@ -29,7 +29,7 @@

          - Source + Source @@ -108,55 +108,55 @@

          Functions

          actual(record)

          - Source + Source

          actual(value, record)

          - Source + Source

          exception(args)

          - Source + Source

          exception(args, self)

          - Source + Source

          message(exception)

          - Source + Source

          new()

          - Source + Source

          new(opts)

          - Source + Source

          to_keywords(record)

          - Source + Source

          update_actual(function, record)

          - Source + Source
          diff --git a/docs/master/Binary.Inspect.Any.html b/docs/master/Binary.Inspect.Any.html index 8bd40dd40..a9aa95d0b 100644 --- a/docs/master/Binary.Inspect.Any.html +++ b/docs/master/Binary.Inspect.Any.html @@ -29,7 +29,7 @@

          - Source + Source @@ -64,7 +64,7 @@

          Examples

          inspect Process.self #=> "<0.35.0>"
           
          - Source + Source diff --git a/docs/master/Binary.Inspect.Number.html b/docs/master/Binary.Inspect.Number.html index 4b3591776..36239311c 100644 --- a/docs/master/Binary.Inspect.Number.html +++ b/docs/master/Binary.Inspect.Number.html @@ -29,7 +29,7 @@

          - Source + Source @@ -63,7 +63,7 @@

          Examples

          inspect(1) #=> "1"
           
          - Source + Source diff --git a/docs/master/Binary.Inspect.Regex.html b/docs/master/Binary.Inspect.Regex.html index 009614b88..869a63710 100644 --- a/docs/master/Binary.Inspect.Regex.html +++ b/docs/master/Binary.Inspect.Regex.html @@ -29,7 +29,7 @@

          - Source + Source @@ -63,7 +63,7 @@

          Examples

          inspect(%r/foo/m) #=> "%r\"foo\"m"
           
          - Source + Source diff --git a/docs/master/CaseClauseError.html b/docs/master/CaseClauseError.html index 05b402b86..e2732e8dc 100644 --- a/docs/master/CaseClauseError.html +++ b/docs/master/CaseClauseError.html @@ -29,7 +29,7 @@

          - Source + Source @@ -108,55 +108,55 @@

          Functions

          actual(record)

          - Source + Source

          actual(value, record)

          - Source + Source

          exception(args)

          - Source + Source

          exception(args, self)

          - Source + Source

          message(exception)

          - Source + Source

          new()

          - Source + Source

          new(opts)

          - Source + Source

          to_keywords(record)

          - Source + Source

          update_actual(function, record)

          - Source + Source
          diff --git a/docs/master/Code.html b/docs/master/Code.html index 9335445cb..a80206537 100644 --- a/docs/master/Code.html +++ b/docs/master/Code.html @@ -133,7 +133,7 @@

          Functions

          For compiling many files at once, check Elixir.ParallelCompiler.

          - Source + Source

          compiler_options() @@ -141,7 +141,7 @@

          Functions

          Loads the compilation options from the code server. Check compiler_options/1 for more information.

          - Source + Source

          compiler_options(opts) @@ -152,13 +152,16 @@

          Functions

          Available options are:

            -
          • docs - when true, retain documentation in the compiled module;
          • +
          • docs - when true, retain documentation in the compiled module. + True by default;
          • debug_info - when true, retain debug information in the compiled module. -Notice debug information can be used to reconstruct the source code;
          • -
          • ignoremoduleconflict - when true, override modules that were already defined;
          • + This allows a developer to reconstruct the original source + code, for such reasons, false by default; +
          • ignoremoduleconflict - when true, override modules that were already defined + without raising errors, false by default;
          - Source + Source

          ensure_loaded(module) @@ -169,7 +172,7 @@

          Functions

          If it succeeds loading the module anyhow, it returns { :module, module }. If not, returns { :error, reason } with the error reason.

          - Source + Source

          eval(string, binding // [], opts // []) diff --git a/docs/master/CompileError.html b/docs/master/CompileError.html index 77b74bcbc..2af7d7487 100644 --- a/docs/master/CompileError.html +++ b/docs/master/CompileError.html @@ -29,7 +29,7 @@

          - Source + Source @@ -150,91 +150,91 @@

          Functions

          description(record)

          - Source + Source

          description(value, record)

          - Source + Source

          exception(args)

          - Source + Source

          exception(args, self)

          - Source + Source

          file(record)

          - Source + Source

          file(value, record)

          - Source + Source

          line(record)

          - Source + Source

          line(value, record)

          - Source + Source

          message(exception)

          - Source + Source

          new()

          - Source + Source

          new(opts)

          - Source + Source

          to_keywords(record)

          - Source + Source

          update_description(function, record)

          - Source + Source

          update_file(function, record)

          - Source + Source

          update_line(function, record)

          - Source + Source
          diff --git a/docs/master/Dict.HashDict.Record.html b/docs/master/Dict.HashDict.Record.html index 1e3e56fd8..3a480d354 100644 --- a/docs/master/Dict.HashDict.Record.html +++ b/docs/master/Dict.HashDict.Record.html @@ -120,7 +120,7 @@

          Functions

          Source

          - empty(arg1) + empty(_)

          Source diff --git a/docs/master/Dict.Orddict.Record.html b/docs/master/Dict.Orddict.Record.html index d4430b59c..4ad0795a7 100644 --- a/docs/master/Dict.Orddict.Record.html +++ b/docs/master/Dict.Orddict.Record.html @@ -120,7 +120,7 @@

          Functions

          Source

          - empty(arg1) + empty(_)

          Source diff --git a/docs/master/Elixir.Builtin.html b/docs/master/Elixir.Builtin.html index 50dfe0d70..135accf81 100644 --- a/docs/master/Elixir.Builtin.html +++ b/docs/master/Elixir.Builtin.html @@ -66,6 +66,11 @@

          Functions summary

          apply/2

        • +
        • + + apply/3 + +
        • atom_to_binary/2 @@ -341,6 +346,11 @@

          Functions summary

          round/1
        • +
        • + + self/0 + +
        • size/1 @@ -558,11 +568,6 @@

          Macros summary

          and/2
        • -
        • - - apply/3 - -
        • atom_to_binary/1 @@ -658,6 +663,11 @@

          Macros summary

          elem/2
        • +
        • + + function_exported?/3 + +
        • if/2 @@ -792,7 +802,20 @@

          Examples

          #=> 4 - Source + Source +
          +

          + apply(module, fun, args) +

          +

          Invokes the given fun from module with the array of arguments args.

          + +

          Examples

          + +
          apply List, reverse, [[1,2,3]]
          +#=> [3,2,1]
          +
          +
          + Source

          atom_to_binary(atom, encoding) @@ -808,7 +831,7 @@

          Examples

          atom_to_binary(:elixir, utf8) #=> "elixir"
           
          - Source + Source

          atom_to_list(atom) @@ -820,7 +843,7 @@

          Examples

          atom_to_list(:elixir) #=> 'elixir'
           
          - Source + Source

          binary_to_atom(binary, encoding) @@ -835,21 +858,21 @@

          Examples

          binary_to_atom("elixir", :utf8) #=> :elixir
           
          - Source + Source

          binary_to_existing_atom(binary, encoding)

          Works like binary_to_atom/2, but the atom must already exist.

          - Source + Source

          binary_to_list(binary)

          Returns a list of integers which correspond to the bytes of binary.

          - Source + Source

          binary_to_list(binary, start, stop) @@ -858,7 +881,7 @@

          Examples

          from position start to position stop in binary. Positions in the binary are numbered starting from 1.

          - Source + Source

          binary_to_term(binary) @@ -872,7 +895,7 @@

          Examples

          binary_to_term(term_to_binary("foo")) #=> "foo"
           
          - Source + Source

          binary_to_term(binary, options) @@ -895,7 +918,7 @@

          Examples

          binary_to_term(term_to_binary("foo"), [:safe])
           
          - Source + Source

          bit_size(bitstring) @@ -910,7 +933,7 @@

          Examples

          bit_size(<<1,2,3>>) #=> 24
          - Source + Source

          bitstring_to_list(bitstring) @@ -919,7 +942,7 @@

          Examples

          number of bits in the binary is not divisible by 8, the last element of the list will be a bitstring containing the remaining bits (1 up to 7 bits).

          - Source + Source

          byte_size(bitstring) @@ -936,7 +959,7 @@

          Examples

          byte_size(<<1,2,3>>) #=> 3
          - Source + Source

          exit(reason) @@ -951,14 +974,14 @@

          Examples

          exit(:seems_bad)
          - Source + Source

          float(number)

          Converts the given number to a float. Allowed in guard clauses.

          - Source + Source

          float_to_list(number) @@ -971,21 +994,21 @@

          Examples

          #=> '7.00000000000000000000e+00'
          - Source + Source

          halt()

          The same as halt(0, []).

          - Source + Source

          halt(status)

          The same as halt(status, []).

          - Source + Source

          halt(status, options) @@ -1016,14 +1039,14 @@

          Examples

          halt(:abort)
          - Source + Source

          hd(list)

          Returns the head of a list, raises badarg if the list is empty.

          - Source + Source

          integer_to_list(number) @@ -1036,7 +1059,7 @@

          Examples

          #=> '7'
          - Source + Source

          integer_to_list(number, base) @@ -1050,7 +1073,7 @@

          Examples

          #=> "3FF"
          - Source + Source

          iolist_size(item) @@ -1063,7 +1086,7 @@

          Examples

          #=> 4
          - Source + Source

          iolist_to_binary(item) @@ -1080,7 +1103,7 @@

          Examples

          #=> <<1,2,3,1,2,3,4,5,4,6>>
          - Source + Source

          is_atom(term) @@ -1089,7 +1112,7 @@

          Examples

          Allowed in guard tests.

          - Source + Source

          is_binary(term) @@ -1100,7 +1123,7 @@

          Examples

          Allowed in guard tests.

          - Source + Source

          is_bitstring(term) @@ -1109,7 +1132,7 @@

          Examples

          Allowed in guard tests.

          - Source + Source

          is_boolean(term) @@ -1119,7 +1142,7 @@

          Examples

          Allowed in guard tests.

          - Source + Source

          is_float(term) @@ -1128,7 +1151,7 @@

          Examples

          Allowed in guard tests.

          - Source + Source

          is_function(term) @@ -1137,7 +1160,7 @@

          Examples

          Allowed in guard tests.

          - Source + Source

          is_function(term, arity) @@ -1147,7 +1170,7 @@

          Examples

          Allowed in guard tests.

          - Source + Source

          is_integer(term) @@ -1156,7 +1179,7 @@

          Examples

          Allowed in guard tests.

          - Source + Source

          is_list(term) @@ -1165,7 +1188,7 @@

          Examples

          Allowed in guard tests.

          - Source + Source

          is_number(term) @@ -1175,7 +1198,7 @@

          Examples

          Allowed in guard tests.

          - Source + Source

          is_pid(term) @@ -1184,7 +1207,7 @@

          Examples

          Allowed in guard tests.

          - Source + Source

          is_port(term) @@ -1193,7 +1216,7 @@

          Examples

          Allowed in guard tests.

          - Source + Source

          is_reference(term) @@ -1202,7 +1225,7 @@

          Examples

          Allowed in guard tests.

          - Source + Source

          is_tuple(term) @@ -1211,7 +1234,7 @@

          Examples

          Allowed in guard tests.

          - Source + Source

          length(list) @@ -1225,7 +1248,7 @@

          Examples

          length([1,2,3,4,5,6,7,8,9]) #=> 9
           
          - Source + Source

          list_to_atom(char_list) @@ -1237,7 +1260,7 @@

          Examples

          list_to_atom('elixir') #=> :elixir
           
          - Source + Source

          list_to_binary(char_list) @@ -1249,7 +1272,7 @@

          Examples

          list_to_binary('Elixir') #=> "Elixir"
           
          - Source + Source

          list_to_bitstring(bitstring_list) @@ -1267,7 +1290,7 @@

          Examples

          #=> <<1,2,3,1,2,3,4,5,4,6,7|4>>
          - Source + Source

          list_to_existing_atom(char_list) @@ -1275,7 +1298,7 @@

          Examples

          Returns the atom whose text representation is char_list, but only if there already exists such atom.

          - Source + Source

          list_to_float(char_list) @@ -1287,7 +1310,7 @@

          Examples

          list_to_float('2.2017764e+0') #=> 2.2017764
           
          - Source + Source

          list_to_integer(char_list) @@ -1299,7 +1322,7 @@

          Examples

          list_to_integer('123') #=> 123
           
          - Source + Source

          list_to_integer(char_list, base) @@ -1311,7 +1334,7 @@

          Examples

          > list_to_integer('3FF', 16) #=> 1023
           
          - Source + Source

          list_to_pid(char_list) @@ -1320,7 +1343,7 @@

          Examples

          Warning:

          -

          This function is intended for debugging and for use in the Erlang +

          This function is intended for debugging and for use in the Erlang operating system.

          It should not be used in application programs.

          @@ -1330,7 +1353,7 @@

          Examples

          list_to_pid('<0.41>') #=> <0.4.1>
           
          - Source + Source

          list_to_tuple(list) @@ -1342,7 +1365,7 @@

          Examples

          list_to_tuple([share, [:elixir, 163]]). #=> {share, [:elixir, 163]}
           
          - Source + Source

          make_ref() @@ -1358,7 +1381,7 @@

          Examples

          #=> #Ref<0.0.0.135>
          - Source + Source

          max(first, second) @@ -1372,7 +1395,7 @@

          Examples

          max(1, 2) #=> 2
           
          - Source + Source

          min(first, second) @@ -1386,7 +1409,7 @@

          Examples

          min(1, 2) #=> 1
           
          - Source + Source

          node() @@ -1396,7 +1419,7 @@

          Examples

          Allowed in guard tests.

          - Source + Source

          node(arg) @@ -1407,7 +1430,7 @@

          Examples

          Allowed in guard tests.

          - Source + Source

          pid_to_list(pid) @@ -1418,12 +1441,12 @@

          Examples

          Warning:

          -

          This function is intended for debugging and for use in the Erlang +

          This function is intended for debugging and for use in the Erlang operating system.

          It should not be used in application programs.

          - Source + Source

          raise(msg) @@ -1446,7 +1469,7 @@

          Examples

          end
          - Source + Source

          raise(exception, args) @@ -1467,7 +1490,7 @@

          Examples

          raise ArgumentError, message: "Sample"
           
          - Source + Source

          round(number) @@ -1480,7 +1503,15 @@

          Examples

          round(5.5) #=> 6
           
          - Source + Source +
          +

          + self() +

          +

          Returns the pid (process identifier) of the calling process. +Allowed in guard clauses.

          +
          + Source

          size(arg) @@ -1488,7 +1519,7 @@

          Examples

          Returns the size of the given argument, which must be a tuple or a binary. If possible, please use tuplesize or binarysize.

          - Source + Source

          spawn(fun) @@ -1507,7 +1538,7 @@

          Examples

          end
          - Source + Source

          spawn(module, fun, args) @@ -1523,7 +1554,7 @@

          Examples

          spawn(SomeModule, :function, [1,2,3])
           
          - Source + Source

          spawn_link(fun) @@ -1543,7 +1574,7 @@

          Examples

          end
          - Source + Source

          spawn_link(module, fun, args) @@ -1559,7 +1590,7 @@

          Examples

          spawn_link(SomeModule, :function, [1,2,3])
           
          - Source + Source

          term_to_binary(term) @@ -1571,7 +1602,7 @@

          Examples

          to a file in an efficient way, or sending an Erlang term to some type of communications channel not supported by distributed Erlang.

          - Source + Source

          term_to_binary(term, opts) @@ -1585,21 +1616,21 @@

          Examples

          for more details
        - Source + Source

        throw(term)

        A non-local return from a function. Check try/2 for more information.

        - Source + Source

        tl(list)

        Returns the tail of a list. Raises ArgumentError if the list is empty.

        - Source + Source

        trunc(number) @@ -1612,21 +1643,21 @@

        Examples

        trunc(5.5) #=> 5
         
        - Source + Source

        tuple_size(tuple)

        Returns the size of a tuple.

        - Source + Source

        tuple_to_list(tuple)

        Converts a tuple to a list.

        - Source + Source
        @@ -1649,7 +1680,7 @@

        Examples

        !false #=> true !nil #=> true

        - Source + Source

        !=(left, right) @@ -1707,7 +1738,7 @@

        Examples

        this operator accepts any expression as arguments, not only booleans, however it is not allowed in guards.

        - Source + Source

        *(left, right) @@ -1792,7 +1823,7 @@

        Examples

        3 in 1..3 #=> true
        - Source + Source

        /(left, right) @@ -1828,7 +1859,7 @@

        Examples

        Enum.map(List.flatten([1,[2],3]), &1 * 2)
         
        - Source + Source

        <(left, right) @@ -1890,7 +1921,7 @@

        Examples

        x #=> "bar"
        - Source + Source

        ==(left, right) @@ -1943,7 +1974,7 @@

        Examples

        "abcd" =~ %r/e/ #=> nil
        - Source + Source

        >(left, right) @@ -2019,7 +2050,7 @@

        Examples

        time and not at runtime. Check the module Module for other functions to manipulate module attributes.

        - Source + Source

        __B__(string, list2) @@ -2033,7 +2064,7 @@

        Examples

        %B(f#{o}o) #=> "f\#{o}o"
        - Source + Source

        __C__(arg1, list2) @@ -2047,7 +2078,7 @@

        Examples

        %C(f#{o}o) #=> 'f\#{o}o'
        - Source + Source

        __R__(arg1, options) @@ -2060,7 +2091,7 @@

        Examples

        Regex.match? %R(f#{1,3}o), "f#o"  #=> true
         
        - Source + Source

        __b__(arg1, list2) @@ -2074,7 +2105,7 @@

        Examples

        %b(f#{:o}o) #=> "foo"
        - Source + Source

        __c__(arg1, list2) @@ -2088,7 +2119,7 @@

        Examples

        %c(f#{:o}o) #=> 'foo'
        - Source + Source

        __r__(arg1, options) @@ -2100,7 +2131,7 @@

        Examples

        Regex.match? %r(foo), "foo"  #=> true
         
        - Source + Source

        access(element, args) @@ -2174,7 +2205,7 @@

        Examples

        access a, 1 #=> :a
        - Source + Source

        and(left, right) @@ -2189,19 +2220,6 @@

        Examples

        Source -
        -

        - apply(module, fun, args) -

        -

        Invokes the given fun from module with the array of arguments args.

        - -

        Examples

        - -
        apply List, reverse, [[1,2,3]]
        -#=> [3,2,1]
        -
        -
        - Source

        atom_to_binary(some_atom) @@ -2214,7 +2232,7 @@

        Examples

        atom_to_binary :my_atom #=> "my_atom"
         
        - Source + Source

        binary_to_atom(some_binary) @@ -2228,7 +2246,7 @@

        Examples

        binary_to_atom "my_atom" #=> :my_atom
         
        - Source + Source

        binary_to_existing_atom(some_binary) @@ -2242,7 +2260,7 @@

        Examples

        binary_to_existing_atom "my_atom" #=> :my_atom
        - Source + Source

        case(condition, blocks) @@ -2295,7 +2313,7 @@

        Examples

        end
        - Source + Source

        cond(list1) @@ -2315,7 +2333,7 @@

        Examples

        end
        - Source + Source

        def(name, list2) @@ -2392,7 +2410,7 @@

        Dynamic generation with atoms

        because each entry k is a an atom and invoking def unquote(k)() would be invalid Elixir syntax.

        - Source + Source

        def(name, args, guards, list4) @@ -2430,7 +2448,7 @@

        Examples

        end
        - Source + Source

        defdelegate(tuples, opts) @@ -2476,16 +2494,22 @@

        Examples

        #=> [3,2,1]
        - Source + Source

        defexception(name, values, opts // [], do_block // [])

        -

        Defines an exception. It follows exactly the same API as record. -The defined record must implement message/1 as API, otherwise -an error is raised. Check exception.ex for examples.

        +

        Defines an exception.

        + +

        Exceptions are simply records and therefore defexception/4 has +the same API and similar behavior to defrecord/4 with two notable +differences:

        + +

        1) Differently from records, exceptions are documented by default; +2) Exceptions must implement message/1 as API and return a + binary as result;

        - Source + Source

        defimpl(name, opts, do_block // []) @@ -2493,7 +2517,7 @@

        Examples

        Defines an implementation for the given protocol. See defprotocol/2 for examples.

        - Source + Source

        defmodule(name, list2) @@ -2538,7 +2562,7 @@

        Dynamic names

        Elixir will accept any module name as long as the expression returns an atom.

        - Source + Source

        defoverridable(tuples) @@ -2547,7 +2571,7 @@

        Dynamic names

        An overridable function is lazily defined, allowing a developer to customize it.

        - Source + Source

        defp(name, list2) @@ -2571,14 +2595,14 @@

        Examples

        In the example above, sum is private and accessing it through Foo.sum will raise an error.

        - Source + Source

        defp(name, args, guards, list4)

        The same as def/4 but generates a private function.

        - Source + Source

        defprotocol(name, list2) @@ -2691,7 +2715,7 @@

        Protocols + Records

        Finally, since records are simply tuples, one can add a default protocol implementation to any record by defining a default implementation for tuples.

        - Source + Source

        defrecord(name, values, opts // [], do_block // []) @@ -2756,7 +2780,7 @@

        Documentation

        defrecord Config, [counter: 0, failures: []], moduledoc: "A simple record"
         
        - Source + Source

        destructure(left, right) @@ -2797,7 +2821,7 @@

        Examples

        the first value from the right side. Otherwise, it will raise a CaseClauseError.

        - Source + Source

        div(left, right) @@ -2811,7 +2835,7 @@

        Examples

        5 div 2 #=> 2
         
        - Source + Source

        elem(tuple, index) @@ -2824,7 +2848,15 @@

        Example

        tuple = { :foo, :bar, 3 } elem(tuple, 1) #=> :foo

        - Source + Source +
        +

        + function_exported?(module, function, arity) +

        +

        Returns true if the module is loaded and contains a +public function with the given arity, otherwise false.

        +
        + Source

        if(condition, list2) @@ -2868,7 +2900,7 @@

        Blocks examples

        If you want to compare more than two clauses, you can use the cond/1 macro.

        - Source + Source

        in(left, right) @@ -2910,7 +2942,7 @@

        Clauses

        In this case, Elixir will automatically expand it and define the variable for us.

        - Source + Source

        inspect(arg) @@ -2923,7 +2955,7 @@

        Examples

        #=> ":foo"
        - Source + Source

        is_exception(thing) @@ -2936,7 +2968,7 @@

        Examples

        is_exception(1) #=> false
        - Source + Source

        is_record(thing, kind) @@ -2953,14 +2985,14 @@

        Examples

        is_record(Config.new, List) #=> false
        - Source + Source

        is_regex(thing)

        Check if the given argument is a regex.

        - Source + Source

        match?(left, right) @@ -2987,7 +3019,7 @@

        Examples

        Enum.filter list, match?({:a, x } when x < 2, &1)
        - Source + Source

        not(arg) @@ -3063,7 +3095,7 @@

        Examples

        will occur immediately.

        - Source + Source

        rem(left, right) @@ -3077,7 +3109,7 @@

        Examples

        5 rem 2 #=> 1
         
        - Source + Source

        setelem(tuple, index, value) @@ -3090,7 +3122,7 @@

        Example

        tuple = { :foo, :bar, 3 } setelem(tuple, 1, :baz) #=> { :baz, :bar, 3 }

        - Source + Source

        to_binary(arg) @@ -3104,7 +3136,7 @@

        Examples

        #=> "foo"
        - Source + Source

        to_char_list(arg) @@ -3117,7 +3149,7 @@

        Examples

        #=> 'foo'
        - Source + Source

        try(args) @@ -3225,7 +3257,7 @@

        Catching exits and Erlang errors

        Although the second form should be avoided in favor of raise/rescue control mechanisms.

        - Source + Source

        unless(clause, options) @@ -3234,7 +3266,7 @@

        Catching exits and Erlang errors

        unless a value evalutes to true. Check if for examples and documentation.

        - Source + Source

        use(module, args // []) @@ -3245,7 +3277,7 @@

        Catching exits and Erlang errors

        Examples

        defmodule AssertionTest do
        -  use ExUnit.Case, sync: true
        +  use ExUnit.Case, async: true
         
           def test_always_pass do
             true = true
        @@ -3267,7 +3299,7 @@ 

        Examples

        end
        - Source + Source

        var!(var) @@ -3311,7 +3343,7 @@

        Examples

        this operator accepts any expression as arguments, not only booleans, however it is not allowed in guards.

        - Source + Source diff --git a/docs/master/Elixir.ParallelCompiler.html b/docs/master/Elixir.ParallelCompiler.html index 2cca65857..5477f855c 100644 --- a/docs/master/Elixir.ParallelCompiler.html +++ b/docs/master/Elixir.ParallelCompiler.html @@ -71,11 +71,10 @@

        Functions

        the current file stops being compiled until the dependency is resolved.

        -

        A callback that receives every time a file is compiled -with the module names and binaries defined inside it can -be optionally given as argument.

        +

        A callback that is invoked every time a file is compiled +with its name can be optionally given as argument.

        - Source + Source

        files_to_path(files, path, callback // default_callback) @@ -83,7 +82,7 @@

        Functions

        Compiles the given files to the given path. Read files/2 for more information.

        - Source + Source
        diff --git a/docs/master/Elixir.ParallelRequire.html b/docs/master/Elixir.ParallelRequire.html new file mode 100644 index 000000000..93f5c61a7 --- /dev/null +++ b/docs/master/Elixir.ParallelRequire.html @@ -0,0 +1,75 @@ + + + + Elixir.ParallelRequire + + + + + + + + + + + + +
        +

        + Elixir.ParallelRequire + +

        + + +
        +

        A module responsible for requiring files in parallel.

        + +
        + + + Source + + + + + + +

        Functions summary

        + + + + + + +
        +

        Functions

        +
        +

        + files(files, callback // default_callback) +

        +

        Requires the given files.

        + +

        A callback that is invoked every time a file is required +can be optionally given as argument.

        +
        + Source +
        +
        + + + +
        + + diff --git a/docs/master/Elixir.SpecialForms.html b/docs/master/Elixir.SpecialForms.html index 3781d97ea..715fc28b7 100644 --- a/docs/master/Elixir.SpecialForms.html +++ b/docs/master/Elixir.SpecialForms.html @@ -29,7 +29,16 @@

        In this module we define Elixir special forms. Those are called special forms because they cannot be overridden by the developer -and sometimes have lexical scope (like alias, require, import, etc).

        +and sometimes have lexical scope (like alias, import, etc).

        + +

        This module also documents Elixir's pseudo variable (__MODULE__, +__FILE__, __ENV__ and __CALLER__) which return information +about Elixir's compilation environment.

        + +

        Finally, it also documents 3 special forms (__block__, +__scope__ and __aliases__), which are not intended to be +called directly by the developer but they appear in quoted +contents since they are important for Elixir's functioning.

        @@ -70,6 +79,21 @@

        Macros summary

        __MODULE__/0 +
      80. + + __aliases__/1 + +
      81. +
      82. + + __block__/1 + +
      83. +
      84. + + __scope__/2 + +
      85. alias/2 @@ -141,7 +165,7 @@

        Examples

        << 1, 2, 3 >> - Source + Source

        [](args) @@ -154,7 +178,7 @@

        Examples

        [ 1, 2, 3 ]
        - Source + Source

        __ENV__() @@ -163,7 +187,7 @@

        Examples

        record. In the environment you can access the current filename, line numbers, set up aliases, the current function and others.

        - Source + Source

        __FILE__() @@ -172,7 +196,7 @@

        Examples

        Although the file can be accessed in the ENV, this macro is a convenient shortcut.

        - Source + Source

        __MODULE__() @@ -181,7 +205,48 @@

        Examples

        Although the module can be accessed in the ENV, this macro is a convenient shortcut.

        - Source + Source +
        +

        + __aliases__(args) +

        +

        This is the special form used to hold aliases information. +At compilation time, it is usually compiled to an atom:

        + +
        quote do: Foo.Bar
        +{ :__aliases__, 0, [:Foo,:Bar] }
        +
        +
        + Source +
        +

        + __block__(args) +

        +

        This is the special form used whenever we have a block +of expressions in Elixir. This special form is private +and should not be invoked directly:

        + +
        quote do: (1; 2; 3)
        +#=> { :__block__, 0, [1,2,3] }
        +
        +
        + Source +
        +

        + __scope__(opts, args) +

        +

        This is the special form used whenever we have to temporarily +change the scope information of a block. Used when quote is +invoked with location: :keep to execute a given block as if +it belonged to another file.

        + +
        quote location: :keep, do: 1
        +#=> { :__scope__, 1,[[file: "iex"],[do: 1]] }
        +
        + +

        Check quote/1 for more information.

        +
        + Source

        alias(module, opts) @@ -225,7 +290,7 @@

        Lexical scope

        have lexical scope. This means you can set up aliases inside specific functions and it won't affect the overall scope.

        - Source + Source

        bc(args) @@ -239,7 +304,7 @@

        Lexical scope

        "helloworld"
        - Source + Source

        fn(args) @@ -291,7 +356,7 @@

        Function with multiple clauses

        fun.(10, 10) #=> 20
        - Source + Source

        import(module, opts) @@ -358,7 +423,7 @@

        Alias/Require shortcut

        also accepts as: as an option so it automatically sets up an alias. Please check alias for more information.

        - Source + Source

        lc(args) @@ -406,7 +471,7 @@

        Alias/Require shortcut

        [{213,45,132},{64,76,32},{76,0,0},{234,32,15}]
        - Source + Source

        quote(opts, list2) @@ -546,7 +611,7 @@

        Stacktrace information

        particular, the macro __FILE__ will always point to GenServer.Behavior file.

        - Source + Source

        require(module, opts) @@ -577,7 +642,7 @@

        Alias shortcut

        require also accepts as: as an option so it automatically sets up an alias. Please check alias for more information.

        - Source + Source

        unquote(expr) @@ -606,7 +671,7 @@

        Examples

        #=> { :sum, 0, [1, 13, 3] }
        - Source + Source

        unquote_splicing(expr) @@ -621,7 +686,7 @@

        Examples

        #=> { :sum, 0, [1, 2, 3, 4, 5] }
        - Source + Source

        {}(args) @@ -634,7 +699,7 @@

        Examples

        { 1, 2, 3 }
        - Source + Source diff --git a/docs/master/Enum.Iterator.html b/docs/master/Enum.Iterator.html index 0ae7062e3..73bb4b368 100644 --- a/docs/master/Enum.Iterator.html +++ b/docs/master/Enum.Iterator.html @@ -38,7 +38,7 @@

        Enum.map [1,2,3], &1 * 2
         
        -

        Is invoked, it invokes Enum.Iterator.iterator([1,2,3]) +

        Is invoked, it invokes Enum.Iterator.iterator([1,2,3]) which returns all the information required by Enum. Read each function documentation below for more information.

        diff --git a/docs/master/Enum.OrdIterator.List.html b/docs/master/Enum.OrdIterator.List.html index de14965ce..93c0df261 100644 --- a/docs/master/Enum.OrdIterator.List.html +++ b/docs/master/Enum.OrdIterator.List.html @@ -65,7 +65,7 @@

        Functions

        Source

        - to_list(arg1, arg2) + to_list(arg1, _)

        Source diff --git a/docs/master/Enum.OrdIterator.Orddict.Record.html b/docs/master/Enum.OrdIterator.Orddict.Record.html index dfd440a10..d6e126fc2 100644 --- a/docs/master/Enum.OrdIterator.Orddict.Record.html +++ b/docs/master/Enum.OrdIterator.Orddict.Record.html @@ -65,7 +65,7 @@

        Functions

        Source

        - to_list(arg1, arg2) + to_list(arg1, _)

        Source diff --git a/docs/master/Enum.OutOfBoundsError.html b/docs/master/Enum.OutOfBoundsError.html new file mode 100644 index 000000000..be05279cb --- /dev/null +++ b/docs/master/Enum.OutOfBoundsError.html @@ -0,0 +1,156 @@ + + + + Enum.OutOfBoundsError + + + + + + + + + + + + +
        +

        + Enum.OutOfBoundsError + + exception + +

        + + + + Source + + + + +

        Fields (and defaults)

        +
          + +
        • + + message: "out of bounds error" + +
        • + +
        + + + +

        Functions summary

        + + + + + + +
        +

        Functions

        +
        +

        + exception(args) +

        +
        + Source +
        +

        + exception(args, self) +

        +
        + Source +
        +

        + message(record) +

        +
        + Source +
        +

        + message(value, record) +

        +
        + Source +
        +

        + new() +

        +
        + Source +
        +

        + new(opts) +

        +
        + Source +
        +

        + to_keywords(record) +

        +
        + Source +
        +

        + update_message(function, record) +

        +
        + Source +
        +
        + + + +
        + + diff --git a/docs/master/Enum.html b/docs/master/Enum.html index 8b12f94ac..ccabd49e1 100644 --- a/docs/master/Enum.html +++ b/docs/master/Enum.html @@ -138,7 +138,7 @@

        Functions summary

      86. - nth/2 + nth!/2
      87. @@ -491,8 +491,8 @@

        Examples

        Source
        -

        - nth(collection, n) +

        + nth!(collection, n)

        Finds the element at the nth index. Returns nil in case the given index is outside the range of the collection.

        @@ -501,9 +501,9 @@

        Examples

        ## Examples

        -
          Enum.nth [2,4,6], 1 #=> 2
        -  Enum.nth [2,4,6], 3 #=> 6
        -  Enum.nth [2,4,6], 5 #=> nil
        +
          Enum.nth! [2,4,6], 1 #=> 2
        +  Enum.nth! [2,4,6], 3 #=> 6
        +  Enum.nth! [2,4,6], 5 #=> raises Enum.OutOfBoundsError
         
        Source diff --git a/docs/master/ErlangError.html b/docs/master/ErlangError.html index ac3396f02..6420f55d1 100644 --- a/docs/master/ErlangError.html +++ b/docs/master/ErlangError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -108,55 +108,55 @@

        Functions

        exception(args)

        - Source + Source

        exception(args, self)

        - Source + Source

        message(exception)

        - Source + Source

        new()

        - Source + Source

        new(opts)

        - Source + Source

        original(record)

        - Source + Source

        original(value, record)

        - Source + Source

        to_keywords(record)

        - Source + Source

        update_original(function, record)

        - Source + Source
        diff --git a/docs/master/ExUnit.Assertions.html b/docs/master/ExUnit.Assertions.html index 1833cf6eb..073d28f18 100644 --- a/docs/master/ExUnit.Assertions.html +++ b/docs/master/ExUnit.Assertions.html @@ -81,11 +81,6 @@

        Functions summary

        assert_in_delta/4
      88. -
      89. - - assert_member/3 - -
      90. assert_nil/2 @@ -150,7 +145,7 @@

        Macros summary

      91. - assert_match/2 + assert_received/2
      92. @@ -160,7 +155,7 @@

        Macros summary

      93. - refute_match/2 + refute_received/2
      94. @@ -195,7 +190,7 @@

        Examples

        assert_empty [1, 2]
        - Source + Source

        assert_error(expected, function) @@ -209,7 +204,7 @@

        Examples

        end
        - Source + Source

        assert_exit(expected, function) @@ -223,7 +218,7 @@

        Examples

        end
        - Source + Source

        assert_in_delta(expected, received, delta, message // nil) @@ -236,20 +231,14 @@

        Examples

        assert_in_delta 10, 15, 4
        - Source -
        -

        - assert_member(base, container, message // nil) -

        -
        - Source + Source

        assert_nil(value, message // nil)

        Asserts the value is nil.

        - Source + Source

        assert_raise(exception, function) @@ -263,7 +252,7 @@

        Examples

        end
        - Source + Source

        assert_raise(exception, expected_message, function) @@ -277,7 +266,7 @@

        Examples

        end
        - Source + Source

        assert_throw(expected, function) @@ -291,7 +280,7 @@

        Examples

        end
        - Source + Source

        flunk(message // "Epic Fail!") @@ -303,7 +292,7 @@

        Examples

        flunk "This should raise an error"
         
        - Source + Source

        refute(not_expected, message) @@ -316,7 +305,7 @@

        Examples

        refute true, "This will obviously fail"
         
        - Source + Source

        refute_empty(enum, message // nil) @@ -329,7 +318,7 @@

        Examples

        refute_empty [1, 2]
        - Source + Source

        refute_in_delta(expected, received, delta, message // nil) @@ -342,20 +331,20 @@

        Examples

        refute_in_delta 10, 11, 2
        - Source + Source

        refute_member(base, container, message // nil)

        - Source + Source

        refute_nil(value, message // nil)

        Asserts the value is not nil.

        - Source + Source
        @@ -383,11 +372,19 @@

        Examples

        Source
        -

        - assert_match(expected, received) +

        + assert_received(content, message // nil)

        -
        - Source +

        Assert a message was received and is in the current process mailbox. +Timeout is set to 0, so there is no waiting time.

        + +

        Examples

        + +
        self <- :hello
        +assert_received :hello
        +
        +
        + Source

        refute(expected) @@ -404,11 +401,19 @@

        Examples

        Source
        -

        - refute_match(expected, received) +

        + refute_received(content, message // nil)

        -
        - Source +

        Refutes a message was not received (i.e. it is not in the current process mailbox). +Timeout is set to 0, so there is no waiting time.

        + +

        Examples

        + +
        self <- :hello
        +refute_received :bye
        +
        +
        + Source
        diff --git a/docs/master/ExUnit.Case.html b/docs/master/ExUnit.Case.html index 9376c7029..a7fb67a14 100644 --- a/docs/master/ExUnit.Case.html +++ b/docs/master/ExUnit.Case.html @@ -33,9 +33,9 @@

        When used, it allows the following options:

          -
        • :sync - by default, ExUnit run test cases in parallel -to each other. If this test case needs to run in sync, -set sync to true.
        • +
        • :async - configure Elixir to run that specific test case + in parallel with others. Must be used for performance + when your test cases do not change any global state;

        Callbacks

        @@ -48,7 +48,7 @@

        Callbacks

        Examples

        defmodule AssertionTest do
        -  use ExUnit.Case
        +  use ExUnit.Case, async: true
         
           def test_always_pass
             assert true
        @@ -102,7 +102,7 @@ 

        Examples

        end
        - Source + Source diff --git a/docs/master/ExUnit.html b/docs/master/ExUnit.html index 5d89466dd..1b2628cb8 100644 --- a/docs/master/ExUnit.html +++ b/docs/master/ExUnit.html @@ -38,9 +38,9 @@

        Example

        # 1) Start ExUnit. You can pass some options as argument (list below) ExUnit.start -# 2) Next we create a new TestCase and use ExUnit.Case +# 2) Next we create a new TestCase and use ExUnit.Case, async: true defmodule AssertionTest do - use ExUnit.Case + use ExUnit.Case, async: true # 3) A test is a method which name finishes with _test def test_always_pass do diff --git a/docs/master/Exception.html b/docs/master/Exception.html index cb89ed42f..c95850d2d 100644 --- a/docs/master/Exception.html +++ b/docs/master/Exception.html @@ -78,14 +78,14 @@

        Functions

        Formats file and line information present in stacktraces. Expect them to be given in a keywords list.

        - Source + Source

        format_file_line(file, line)

        Formats the given file and line.

        - Source + Source

        format_module_fun_arity(module, fun, arity) @@ -94,14 +94,14 @@

        Functions

        representing such invocation. Arity may also be a list of arguments. It follows the same syntax as in stacktraces.

        - Source + Source

        format_stacktrace(arg1)

        Formats each line in the stacktrace.

        - Source + Source
        diff --git a/docs/master/File.CopyError.html b/docs/master/File.CopyError.html new file mode 100644 index 000000000..c495764e5 --- /dev/null +++ b/docs/master/File.CopyError.html @@ -0,0 +1,284 @@ + + + + File.CopyError + + + + + + + + + + + + +
        +

        + File.CopyError + + exception + +

        + + + + Source + + + + +

        Fields (and defaults)

        +
          + +
        • + + action: "" + +
        • + +
        • + + destination: nil + +
        • + +
        • + + reason: nil + +
        • + +
        • + + source: nil + +
        • + +
        + + + +

        Functions summary

        + + + + + + +
        +

        Functions

        +
        +

        + action(record) +

        +
        + Source +
        +

        + action(value, record) +

        +
        + Source +
        +

        + destination(record) +

        +
        + Source +
        +

        + destination(value, record) +

        +
        + Source +
        +

        + exception(args) +

        +
        + Source +
        +

        + exception(args, self) +

        +
        + Source +
        +

        + message(exception) +

        +
        + Source +
        +

        + new() +

        +
        + Source +
        +

        + new(opts) +

        +
        + Source +
        +

        + reason(record) +

        +
        + Source +
        +

        + reason(value, record) +

        +
        + Source +
        +

        + source(record) +

        +
        + Source +
        +

        + source(value, record) +

        +
        + Source +
        +

        + to_keywords(record) +

        +
        + Source +
        +

        + update_action(function, record) +

        +
        + Source +
        +

        + update_destination(function, record) +

        +
        + Source +
        +

        + update_reason(function, record) +

        +
        + Source +
        +

        + update_source(function, record) +

        +
        + Source +
        +
        + + + +
        + + diff --git a/docs/master/File.Error.html b/docs/master/File.Error.html index a5125e1f1..b0cd6526b 100644 --- a/docs/master/File.Error.html +++ b/docs/master/File.Error.html @@ -29,7 +29,7 @@

        - Source + Source @@ -150,91 +150,91 @@

        Functions

        action(record)

        - Source + Source

        action(value, record)

        - Source + Source

        exception(args)

        - Source + Source

        exception(args, self)

        - Source + Source

        message(exception)

        - Source + Source

        new()

        - Source + Source

        new(opts)

        - Source + Source

        path(record)

        - Source + Source

        path(value, record)

        - Source + Source

        reason(record)

        - Source + Source

        reason(value, record)

        - Source + Source

        to_keywords(record)

        - Source + Source

        update_action(function, record)

        - Source + Source

        update_path(function, record)

        - Source + Source

        update_reason(function, record)

        - Source + Source
        diff --git a/docs/master/File.Stat.html b/docs/master/File.Stat.html index 803518799..4a2162c50 100644 --- a/docs/master/File.Stat.html +++ b/docs/master/File.Stat.html @@ -63,7 +63,7 @@

        - Source + Source @@ -379,253 +379,253 @@

        Functions

        access(record)

        - Source + Source

        access(value, record)

        - Source + Source

        atime(record)

        - Source + Source

        atime(value, record)

        - Source + Source

        ctime(record)

        - Source + Source

        ctime(value, record)

        - Source + Source

        gid(record)

        - Source + Source

        gid(value, record)

        - Source + Source

        inode(record)

        - Source + Source

        inode(value, record)

        - Source + Source

        links(record)

        - Source + Source

        links(value, record)

        - Source + Source

        major_device(record)

        - Source + Source

        major_device(value, record)

        - Source + Source

        minor_device(record)

        - Source + Source

        minor_device(value, record)

        - Source + Source

        mode(record)

        - Source + Source

        mode(value, record)

        - Source + Source

        mtime(record)

        - Source + Source

        mtime(value, record)

        - Source + Source

        new()

        - Source + Source

        new(opts)

        - Source + Source

        size(record)

        - Source + Source

        size(value, record)

        - Source + Source

        to_keywords(record)

        - Source + Source

        type(record)

        - Source + Source

        type(value, record)

        - Source + Source

        uid(record)

        - Source + Source

        uid(value, record)

        - Source + Source

        update_access(function, record)

        - Source + Source

        update_atime(function, record)

        - Source + Source

        update_ctime(function, record)

        - Source + Source

        update_gid(function, record)

        - Source + Source

        update_inode(function, record)

        - Source + Source

        update_links(function, record)

        - Source + Source

        update_major_device(function, record)

        - Source + Source

        update_minor_device(function, record)

        - Source + Source

        update_mode(function, record)

        - Source + Source

        update_mtime(function, record)

        - Source + Source

        update_size(function, record)

        - Source + Source

        update_type(function, record)

        - Source + Source

        update_uid(function, record)

        - Source + Source
        diff --git a/docs/master/File.html b/docs/master/File.html index 55c612d83..c0c0145c8 100644 --- a/docs/master/File.html +++ b/docs/master/File.html @@ -35,10 +35,37 @@

        File.stat. If you want to read or write to a file in chunks, check the IO module.

        +

        Most of the functions in this module return :ok +or { :ok, result } in case of success, { :error, reason } +otherwise. Those function are also followed by +a variant that ends with ! which returns the +result (without the { :ok, result } tuple) in +case of success or raises an exception in case it +fails. For example:

        + +
        File.read("hello.txt")
        +#=> { :ok, "World" }
        +
        +File.read("invalid.txt")
        +#=> { :error, :enoent }
        +
        +File.read!("hello.txt")
        +#=> "World"
        +
        +File.read!("invalid.txt")
        +#=> raises File.Error
        +
        + +

        In general, a developer should use the former in case +he wants to react in the fie does not exist. The latter +should be used when the developer expects his software +to fail in case the file cannot be read (i.e. it is +literally an exception).

        + - Source + Source @@ -57,11 +84,66 @@

        Functions summary

        basename/2 +
      95. + + cd/1 + +
      96. +
      97. + + cd!/1 + +
      98. +
      99. + + cd!/2 + +
      100. close/1
      101. +
      102. + + copy/3 + +
      103. +
      104. + + copy!/3 + +
      105. +
      106. + + cp/3 + +
      107. +
      108. + + cp!/3 + +
      109. +
      110. + + cp_r/3 + +
      111. +
      112. + + cp_r!/3 + +
      113. +
      114. + + cwd/0 + +
      115. +
      116. + + cwd!/0 + +
      117. dir?/1 @@ -107,16 +189,41 @@

        Functions summary

        mkdir/1
      118. +
      119. + + mkdir!/1 + +
      120. mkdir_p/1
      121. +
      122. + + mkdir_p!/1 + +
      123. open/2
      124. +
      125. + + open/3 + +
      126. +
      127. + + open!/2 + +
      128. +
      129. + + open!/3 + +
      130. read/1 @@ -147,6 +254,31 @@

        Functions summary

        rm/1
      131. +
      132. + + rm!/1 + +
      133. +
      134. + + rm_rf/1 + +
      135. +
      136. + + rm_rf!/1 + +
      137. +
      138. + + rmdir/1 + +
      139. +
      140. + + rmdir!/1 + +
      141. rootname/1 @@ -172,6 +304,16 @@

        Functions summary

        stat!/2
      142. +
      143. + + touch/1 + +
      144. +
      145. + + touch!/1 + +
      146. wildcard/1 @@ -182,6 +324,21 @@

        Functions summary

        write/3
      147. +
      148. + + write!/3 + +
      149. +
      150. + + write_stat/3 + +
      151. +
      152. + + write_stat!/3 + +
      153. @@ -198,6 +355,9 @@

        Functions

        Returns the last component of the path or the path itself if it does not contain any directory separators.

        +

        If the given path is a char list, returns a char list. +Otherwise returns a binary.

        +

        Examples

        File.basename("foo")
        @@ -210,7 +370,7 @@ 

        Examples

        #=> ""
        - Source + Source

        basename(path, extension) @@ -219,6 +379,9 @@

        Examples

        stripped. This function should be used to remove a specific extension which might, or might not, be there.

        +

        If the given path is a char list, returns a char list. +Otherwise returns a binary.

        +

        Examples

        File.basename("~/foo/bar.ex", ".ex")
        @@ -229,39 +392,210 @@ 

        Examples

        #=> "bar.old"
        - Source + Source +
        +

        + cd(path) +

        +

        Sets the current working directory. Returns :ok if successful, +{ :error, reason } otherwise.

        +
        + Source +
        +

        + cd!(path) +

        +

        The same as cd/0, but raises an exception if it fails.

        +
        + Source +
        +

        + cd!(path, function) +

        +

        Changes the current directory to the given path, +executes the given function and then revert back +to the previous path regardless if there is an exception.

        + +

        Raises an error if retrieving or changing the current +directory fails.

        +
        + Source

        close(io_device)

        -

        Closes the file referenced by io_device. It mostly returns :ok, expect +

        Closes the file referenced by io_device. It mostly returns :ok, except for some severe errors such as out of memory.

        Note that if the option :delayed_write was used when opening the file, close/1 might return an old write error and not even try to close the file. See open/2.

        - Source + Source +
        +

        + copy(source, destination, bytes_count // :infinity) +

        +

        Copies the contents of source to destination. Both +parameters can be a filename or an io device opened with File.open. +bytes_count specifies the number of bytes to count, the default +being :infinity.

        + +

        If file destination already exists, it is overriden +by the contents in source.

        + +

        Returns { :ok, bytes_copied } if successful, +{ :error, reason } otherwise.

        + +

        Typical error reasons are the same as in open/2, +read/1 and write/2.

        +
        + Source +
        +

        + copy!(source, destination, bytes_count // :infinity) +

        +

        The same as copy/3 but raises an File.CopyError if it fails. +Returns the bytes_copied otherwise.

        +
        + Source +
        +

        + cp(source, destination, callback // fn(_, _) do + true +end) +

        +

        Copies the contents in source to destination. +Similar to the command cp -r in Unix systems, +this function behaves differently depending +if source and destination are a file or a directory.

        + +

        If both are files, it simply copies source to +destination. However, if destination is a directory, +it copies the contents of source to destination/source +recursively.

        + +

        If a file already exists in the destination, +it invokes a callback which should return +true if the existing file should be overriden, +false otherwise. It defaults to return true.

        + +

        It returns :ok in case of success, returns +{ :error, reason } otherwise.

        +
        + Source +
        +

        + cp!(source, destination, callback // fn(_, _) do + true +end) +

        +

        The same as cp/3, but raises File.CopyError if it fails. +Returns the list of copied files otherwise.

        +
        + Source +
        +

        + cp_r(source, destination, callback // fn(_, _) do + true +end) +

        +

        Copies the contents in source to destination. +Similar to the command cp -r in Unix systems, +this function behaves differently depending +if source and destination are a file or a directory.

        + +

        If both are files, it simply copies source to +destination. However, if destination is a directory, +it copies the contents of source to destination/source +recursively.

        + +

        If a file already exists in the destination, +it invokes a callback which should return +true if the existing file should be overriden, +false otherwise. It defaults to return true.

        + +

        If a directory already exists in the destination +where a file is meant to be (or otherwise), this +function will fail.

        + +

        This function may fail while copying files, +in such cases, it will leave the destination +directory in a dirty state, where already +copied files won't be removed.

        + +

        It returns { :ok, files_and_directories } in case of +success with all files and directories copied in no +specific order, { :error, reason } otherwise.

        + +

        Examples

        + +
        # Copies "a.txt" to "tmp/a.txt"
        +File.cp_r "a.txt", "tmp"
        +
        +# Copies all files in "samples" to "tmp/samples"
        +File.cp_r "samples", "tmp"
        +
        +# Copies all files in "samples" to "tmp"
        +File.cp_r "samples/.", "tmp"
        +
        +# Same as before, but asks the user how to proceed in case of conflicts
        +File.cp_r "samples/.", "tmp", fn(source, destination) ->
        +  IO.gets("Overriding #{destination} by #{source}. Type y to confirm.") == "y"
        +end
        +
        +
        + Source +
        +

        + cp_r!(source, destination, callback // fn(_, _) do + true +end) +

        +

        The same as cp_r/3, but raises File.CopyError if it fails. +Returns the list of copied files otherwise.

        +
        + Source +
        +

        + cwd() +

        +

        Gets the current working directory. In rare circumstances, this function can +fail on Unix. It may happen if read permission does not exist for the parent +directories of the current directory. For this reason, returns { :ok, cwd } +in case of success, { :error, reason } otherwise.

        +
        + Source +
        +

        + cwd!() +

        +

        The same as cwd/0, but raises an exception if it fails.

        +
        + Source

        dir?(path)

        Returns true if the path is a directory.

        - Source + Source

        dirname(path)

        Return the directory component of path.

        +

        If the given path is a char list, returns a char list. +Otherwise returns a binary.

        +

        Examples

        File.dirname("/foo/bar.ex")
         #=> "foo"
         
        - Source + Source

        exists?(path) @@ -282,7 +616,7 @@

        Examples

        #=> true
        - Source + Source

        expand_path(path) @@ -290,12 +624,15 @@

        Examples

        Expands the path by returning its absolute name and expanding any . and .. characters.

        +

        If the given path is a char list, returns a char list. +Otherwise returns a binary.

        +

        Examples

        File.expand_path("/foo/bar/../bar") == "/foo/bar"
         
        - Source + Source

        expand_path(path, relative_to) @@ -304,19 +641,25 @@

        Examples

        any . and .. characters. If the path is already an absolute path, the relative location is ignored.

        +

        If the given path is a char list, returns a char list. +Otherwise returns a binary.

        +

        Examples

        File.expand_path("foo/bar/../bar", "/baz") == "/baz/foo/bar"
         File.expand_path("/foo/bar/../bar", "/baz") == "/foo/bar"
         
        - Source + Source

        extname(path)

        Return the extension of the last component of path.

        +

        If the given path is a char list, returns a char list. +Otherwise returns a binary.

        +

        Examples

        File.extname("foo.erl")
        @@ -325,7 +668,7 @@ 

        Examples

        #=> ""
        - Source + Source

        join(paths) @@ -333,6 +676,9 @@

        Examples

        Returns a string with one or more paths components joint by the path separator. This function should be used to convert a list of strings in a path.

        +

        If the given paths are a char list, returns a char list. +Otherwise returns a binary.

        +

        Examples

        File.join(["~", "foo"])
        @@ -343,20 +689,23 @@ 

        Examples

        #=> "/foo/bar"
        - Source + Source

        join(left, right)

        Join two paths.

        +

        If the given paths are a char list, returns a char list. +Otherwise returns a binary.

        +

        Examples

        File.join("foo", "bar")
         #=> "foo/bar"
         
        - Source + Source

        mkdir(path) @@ -375,7 +724,14 @@

        Examples

        On some platforms, :enoent is returned instead.
        - Source + Source +
        +

        + mkdir!(path) +

        +

        Same as mkdir, but raises an exception in case of failure. Otherwise :ok.

        +
        + Source

        mkdir_p(path) @@ -388,17 +744,107 @@

        Examples

        • :eacces - Missing search or write permissions for the parent directories of path.
        • :enospc - There is a no space left on the device.
        • -
        • :enotdir - A component of path is not a directory - On some platforms, :enoent is returned instead.
        • +
        • :enotdir - A component of path is not a directory.
        - Source + Source +
        +

        + mkdir_p!(path) +

        +

        Same as mkdir_p, but raises an exception in case of failure. Otherwise :ok.

        +
        + Source

        - open(filename, options // []) + open(path, modes // [])

        -
        - Source +

        Opens the given path according to the given list of modes.

        + +

        By default, the file is opened in read mode, as a binary with utf8 encoding.

        + +

        The allowed modes:

        + +
          +
        • :read - The file, which must exist, is opened for reading.

        • +
        • :write - The file is opened for writing. It is created if it does not exist. + If the file exists, and if write is not combined with read, the file will be truncated.

        • +
        • :append - The file will be opened for writing, and it will be created if it does not exist. + Every write operation to a file opened with append will take place at the end of the file.

        • +
        • :exclusive - The file, when opened for writing, is created if it does not exist. + If the file exists, open will return { :error, :eexist }.

        • +
        • :charlist - When this term is given, read operations on the file will return char lists rather than binaries;

        • +
        • :compressed - Makes it possible to read or write gzip compressed files. + The compressed option must be combined with either read or write, but not both. + Note that the file size obtained with stat/1 will most probably not + match the number of bytes that can be read from a compressed file.

        • +
        + +

        If a function is given to modes (instead of a list), it dispatches to open/3.

        + +

        Check http://www.erlang.org/doc/man/file.html#open-2 for more information about +other options as read_ahead and delayed_write.

        + +

        This function returns:

        + +
          +
        • { :ok, iodevice } - The file has been opened in the requested mode. + io_device is actually the pid of the process which handles the file. + This process is linked to the process which originally opened the file. + If any process to which the iodevice is linked terminates, the file will + be closed and the process itself will be terminated. An io_device returned + from this call can be used as an argument to the IO module functions.

        • +
        • { :error, reason } - The file could not be opened.

        • +
        + +

        Examples

        + +
        { :ok, file } = File.open("foo.tar.gz", [:read, :compressed])
        +IO.readline(file)
        +File.close(file)
        +
        +
        + Source +
        +

        + open(path, modes, function) +

        +

        Similar to open/2 but expects a function as last argument.

        + +

        The file is opened, given to the function as argument and +automatically closed after the function returns, regardless +if there was an error or not.

        + +

        It returns { :ok, function_result } in case of success, +{ :error, reason } otherwise.

        + +

        Do not use this function with :delayed_write option +since automatically closing the file may fail +(as writes are delayed).

        + +

        Examples

        + +

        File.open!("foo.txt", [:read, :write], fn(file) -> + IO.readline(file) + end)

        +
        + Source +
        +

        + open!(path, modes // []) +

        +

        Same as open/2 but raises an error if file could not be opened. +Returns the io_device otherwise.

        +
        + Source +
        +

        + open!(path, modes, function) +

        +

        Same as open/3 but raises an error if file could not be opened. +Returns the function result otherwise.

        +
        + Source

        read(path) @@ -420,7 +866,7 @@

        Examples

        You can use Erlang.file.format_error(reason) to get a descriptive string of the error.

        - Source + Source

        read!(path) @@ -428,19 +874,19 @@

        Examples

        Returns binary with the contents of the given filename or raises File.Error if an error occurs.

        - Source + Source

        read_info(path, opts // [])

        - Source + Source

        read_info!(path, opts // [])

        - Source + Source

        regular?(path) @@ -452,12 +898,12 @@

        Examples

        File.regular? __FILE__ #=> true
         
        - Source + Source

        - rm(filename) + rm(path)

        -

        Tries to delete the file filename. +

        Tries to delete the file path. Returns :ok if successful, or {:error, reason} if an error occurs.

        Typical error reasons are:

        @@ -480,13 +926,77 @@

        Examples

        #=> {:error, :eperm}
        - Source + Source +
        +

        + rm!(path) +

        +

        Same as rm, but raises an exception in case of failure. Otherwise :ok.

        +
        + Source +
        +

        + rm_rf(path) +

        +

        Remove files and directories recursively at the given path. +Symlinks are not followed but simply removed, non existing +files are simply ignored (i.e. doesn't make this function fail).

        + +

        Returns { :ok, files_and_directories } with all files and +directories removed in no specific order, { :error, reason } +otherwise.

        + +

        Examples

        + +
        File.rm_rf "samples"
        +#=> { :ok, ["samples", "samples/1.txt"] }
        +
        +File.rm_rf "unknown"
        +#=> { :ok, [] }
        +
        +
        + Source +
        +

        + rm_rf!(path) +

        +

        Same as rm_rf/1 but raises File.Error in case of failures, +otherwise the list of files or directories removed.

        +
        + Source +
        +

        + rmdir(path) +

        +

        Tries to delete the dir at path. +Returns :ok if successful, or {:error, reason} if an error occurs.

        + +

        Examples

        + +
        File.rddir('tmp_dir')
        +#=> :ok
        +
        +File.rmdir('foo.txt')
        +#=> {:error, :enotdir}
        +
        +
        + Source +
        +

        + rmdir!(path) +

        +

        Same as rmdir/1, but raises an exception in case of failure. Otherwise :ok.

        +
        + Source

        rootname(path)

        Returns the path with the extension stripped.

        +

        If the given path is a char list, returns a char list. +Otherwise returns a binary.

        +

        Examples

        File.rootname("/foo/bar")
        @@ -495,7 +1005,7 @@ 

        Examples

        #=> "/foo/bar"
        - Source + Source

        rootname(path, extension) @@ -503,6 +1013,9 @@

        Examples

        Returns the path with the extension stripped. This function should be used to remove a specific extension which might, or might not, be there.

        +

        If the given path is a char list, returns a char list. +Otherwise returns a binary.

        +

        Examples

        File.rootname("/foo/bar.erl", ".erl")
        @@ -511,7 +1024,7 @@ 

        Examples

        #=> "/foo/bar.erl"
        - Source + Source

        split(path) @@ -529,12 +1042,12 @@

        Examples

        #=> ["/", "foo", "bar"]
        - Source + Source

        stat(path, opts // [])

        -

        Returns information about a file. If the file exists, it +

        Returns information about the path. If it exists, it returns a { :ok, info } tuple, where info is as a File.Info record. Retuns { :error, reason } with the same reasons as File.read if a failure occurs.

        @@ -548,7 +1061,7 @@

        Options

        Default is local.
        - Source + Source

        stat!(path, opts // []) @@ -556,12 +1069,28 @@

        Options

        Same as stat but returns the File.Stat directly and throws File.Error if an error is returned.

        - Source + Source +
        +

        + touch(path) +

        +

        Updates modification time (mtime) and access time (atime) of +the given file. File is created if it doesn’t exist.

        +
        + Source +
        +

        + touch!(path) +

        +

        Same as touch/1 but raises an exception if it fails. +Returns :ok otherwise.

        +
        + Source

        wildcard(glob)

        -

        Traverses files and directories according to the given glob expression.

        +

        Traverses files and directories according to the given glob expression.

        The wildcard string looks like an ordinary filename, except that certain "wildcard characters" are interpreted in a special way. The following @@ -596,12 +1125,12 @@

        Examples

        File.wildcard("projects/*/ebin/**/*.{beam,app}")
         
        - Source + Source

        - write(filename, content, modes // []) + write(path, content, modes // [])

        -

        Tries to write content to the file filename. The file is created if it +

        Writes content to the file path. The file is created if it does not exist. If it exists, the previous contents are overwritten. Returns :ok if successful, or {:error, reason} if an error occurs.

        @@ -616,7 +1145,30 @@

        Examples

      154. :eisdir - The named file is a directory.
      155. - Source + Source +
        +

        + write!(path, content, modes // []) +

        +

        Same as write/3 but raises an exception if it fails, returns :ok otherwise.

        +
        + Source +
        +

        + write_stat(path, stat, opts // []) +

        +

        Writes the given File.Stat back to the filesystem at the given +path. Returns :ok or { :error, reason }.

        +
        + Source +
        +

        + write_stat!(path, stat, opts // []) +

        +

        Same as write_stat/3 but raises an exception if it fails. +Returns :ok otherwise.

        +
        + Source
        diff --git a/docs/master/FunctionClauseError.html b/docs/master/FunctionClauseError.html index a580e283a..65884f6c5 100644 --- a/docs/master/FunctionClauseError.html +++ b/docs/master/FunctionClauseError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -150,91 +150,91 @@

        Functions

        arity(record)

        - Source + Source

        arity(value, record)

        - Source + Source

        exception(args)

        - Source + Source

        exception(args, self)

        - Source + Source

        function(record)

        - Source + Source

        function(value, record)

        - Source + Source

        message(exception)

        - Source + Source

        module(record)

        - Source + Source

        module(value, record)

        - Source + Source

        new()

        - Source + Source

        new(opts)

        - Source + Source

        to_keywords(record)

        - Source + Source

        update_arity(function, record)

        - Source + Source

        update_function(function, record)

        - Source + Source

        update_module(function, record)

        - Source + Source
        diff --git a/docs/master/GenServer.Behavior.html b/docs/master/GenServer.Behavior.html index d6cfab050..4db52d446 100644 --- a/docs/master/GenServer.Behavior.html +++ b/docs/master/GenServer.Behavior.html @@ -54,7 +54,7 @@

        Macros summary

        Macros

        - __using__(arg1) + __using__(_)

        By using this module, you get default GenServer callbacks for handle_call, handle_info, handle_cast, terminate diff --git a/docs/master/IEx.Helpers.html b/docs/master/IEx.Helpers.html index 06ef6b998..5008d85b4 100644 --- a/docs/master/IEx.Helpers.html +++ b/docs/master/IEx.Helpers.html @@ -27,7 +27,16 @@

        -

        A bunch of helpers available in IEx console.

        +

        A bunch of helpers available in IEx.

        + +

        Documentation for functions in this module can be +consulted directly from the command line, example:

        + +
        d(:c, 2)
        +
        + +

        Will print the documentation for the function c +in this module with arity 2.

        @@ -46,6 +55,21 @@

        Functions summary

        c/2 +
      156. + + d/1 + +
      157. +
      158. + + d/2 + +
      159. +
      160. + + d/3 + +
      161. h/0 @@ -89,28 +113,66 @@

        Examples

        #=> Foo
      162. - Source + Source +
        +

        + d(module // IEx.Helpers) +

        +

        Shows the documentation for the given module. +Defaults to print documentation for IEx.Helpers.

        + +

        Examples

        + +
        d(Enum)
        +#=> Prints documentation for Enum
        +
        +
        + Source +
        +

        + d(function, arity) +

        +

        Prints the documentation for the given function and arity.

        + +

        The function may either be a function defined inside IEx.Helpers +or in Elixir.Builtin. To see functions from other module, use +d/3 instead.

        + +

        Examples

        + +
        d(:d, 2)
        +#=> Prints documentation for this function
        +
        +
        + Source +
        +

        + d(module, function, arity) +

        +

        Shows the documentation for the function/arity in module.

        +
        + Source

        h()

        -

        Prints the history

        +

        Prints commands history and their result.

        - Source + Source

        m()

        Returns the name and module of all modules loaded.

        - Source + Source

        m(mod)

        Prints the module information for the given module.

        - Source + Source

        v(n) @@ -119,7 +181,7 @@

        Examples

        values to lookup query's value from latest to earliest. For instance, v(-1) returns the latest result.

        - Source + Source
        diff --git a/docs/master/IO.html b/docs/master/IO.html index 9e5192fb1..cd4b850cf 100644 --- a/docs/master/IO.html +++ b/docs/master/IO.html @@ -117,7 +117,7 @@

        Functions

        NFS file system.

        - Source + Source

        gets(device // :stdio, prompt) @@ -133,7 +133,7 @@

        Functions

        NFS file system.

        - Source + Source

        inspect(device // :stdio, item) @@ -141,13 +141,13 @@

        Functions

        Inspects and writes the given argument to the device followed by a new line. Returns the item given.

        - Source + Source

        print(device // :stdio, item)

        - Source + Source

        puts(device // :stdio, item) @@ -156,7 +156,7 @@

        Functions

        but adds a new line at the end. The argument is expected to be a chardata.

        - Source + Source

        read(device // :stdio, count) @@ -185,8 +185,11 @@

        Functions

        for instance {:error, :estale} if reading from an NFS file system.

        + +

        This function does the same as gets/2, +except the prompt is not required as argument.

        - Source + Source

        write(device // :stdio, item) @@ -207,7 +210,7 @@

        Examples

        #=> "error"
        - Source + Source diff --git a/docs/master/Keyword.KeyError.html b/docs/master/Keyword.KeyError.html index b82af9e04..bb74ca1f6 100644 --- a/docs/master/Keyword.KeyError.html +++ b/docs/master/Keyword.KeyError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -108,55 +108,55 @@

        Functions

        exception(args)

        - Source + Source

        exception(args, self)

        - Source + Source

        key(record)

        - Source + Source

        key(value, record)

        - Source + Source

        message(exception)

        - Source + Source

        new()

        - Source + Source

        new(opts)

        - Source + Source

        to_keywords(record)

        - Source + Source

        update_key(function, record)

        - Source + Source
        diff --git a/docs/master/Keyword.html b/docs/master/Keyword.html index af3ca5472..6f1b1bdcc 100644 --- a/docs/master/Keyword.html +++ b/docs/master/Keyword.html @@ -62,17 +62,17 @@

        Functions summary

      163. - fetch/2 + from_enum/1
      164. - from_enum/1 + get/3
      165. - get/3 + get!/2
      166. @@ -150,20 +150,6 @@

        Examples

        Source -
        -

        - fetch(list1, key) -

        -

        Gets the value for specific key. If key does not exist, -an error is raised.

        - -

        Examples

        - -
        Keyword.fetch [a: 1], :a      #=> 1
        -Keyword.fetch [a: 1], :b      #=> raises KeyError[key: :b]
        -
        -
        - Source

        from_enum(enum) @@ -193,6 +179,20 @@

        Examples

        Source +
        +

        + get!(list1, key) +

        +

        Gets the value for specific key. If key does not exist, +an error is raised.

        + +

        Examples

        + +
        Keyword.get! [a: 1], :a      #=> 1
        +Keyword.get! [a: 1], :b      #=> raises KeyError[key: :b]
        +
        +
        + Source

        get_values(list1, key) diff --git a/docs/master/List.html b/docs/master/List.html index f2764b247..d9ddbecb4 100644 --- a/docs/master/List.html +++ b/docs/master/List.html @@ -211,7 +211,7 @@

        Examples

        #=> [2,3]
        - Source + Source

        duplicate(elem, n) @@ -227,7 +227,7 @@

        Examples

        #=> [[1,2],[1,2]]
        - Source + Source

        flatten(list) @@ -245,13 +245,13 @@

        Examples

        #=> [1,2,3,4,5]
        - Source + Source

        flatten(list, tail)

        - Source + Source

        foldl(list, acc, function) @@ -268,7 +268,7 @@

        Examples

        #=> 2
        - Source + Source

        foldr(list, acc, function) @@ -282,7 +282,7 @@

        Examples

        #=> -2
        - Source + Source

        keydelete(list, item, position) @@ -303,7 +303,7 @@

        Examples

        #=> [{ :a, 1 }, { :b, 2 }]
        - Source + Source

        keyfind(list, item, position, default // nil) @@ -324,7 +324,7 @@

        Examples

        #=> nil
        - Source + Source

        keymember?(list, item, position) @@ -345,7 +345,7 @@

        Examples

        #=> false
        - Source + Source

        last(xA) @@ -362,7 +362,7 @@

        Examples

        #=> 3
        - Source + Source

        member?(list, term) @@ -380,7 +380,7 @@

        Examples

        #=> false
        - Source + Source

        range(first, last, step // nil) @@ -400,7 +400,7 @@

        Examples

        List.range 5, 1, -2 #=> [5, 3, 1]
        - Source + Source

        reverse(xA) @@ -414,7 +414,7 @@

        Examples

        #=> [3,2,1]
        - Source + Source

        sort(list) @@ -428,7 +428,7 @@

        Examples

        #=> [1, 2, 3, 4, 7]
        - Source + Source

        sort(list, fun) @@ -442,7 +442,7 @@

        Examples

        #=> [7, 4, 3, 2, 1]
        - Source + Source

        uniq(list) @@ -455,7 +455,7 @@

        Examples

        #=> [1,2,3]
        - Source + Source

        unzip(list) @@ -472,7 +472,7 @@

        Examples

        #=> [[1, 2, 3], [:a, :b, :c]]
        - Source + Source

        wrap(list) @@ -486,7 +486,7 @@

        Examples

        List.wrap [1,2,3] #=> [1,2,3]
         
        - Source + Source

        zip(list_of_lists) @@ -502,7 +502,7 @@

        Examples

        #=> [{1, 3, 5}]
        - Source + Source

        zip(item1, item2) @@ -520,7 +520,7 @@

        Examples

        #=> [{1, 4}, {2, 5}]
        - Source + Source diff --git a/docs/master/MatchError.html b/docs/master/MatchError.html index 12f0eddd5..a1aa5f729 100644 --- a/docs/master/MatchError.html +++ b/docs/master/MatchError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -108,55 +108,55 @@

        Functions

        actual(record)

        - Source + Source

        actual(value, record)

        - Source + Source

        exception(args)

        - Source + Source

        exception(args, self)

        - Source + Source

        message(exception)

        - Source + Source

        new()

        - Source + Source

        new(opts)

        - Source + Source

        to_keywords(record)

        - Source + Source

        update_actual(function, record)

        - Source + Source
        diff --git a/docs/master/Mix.Error.html b/docs/master/Mix.Error.html new file mode 100644 index 000000000..8e248a5dd --- /dev/null +++ b/docs/master/Mix.Error.html @@ -0,0 +1,156 @@ + + + + Mix.Error + + + + + + + + + + + + +
        +

        + Mix.Error + + exception + +

        + + + + Source + + + + +

        Fields (and defaults)

        +
          + +
        • + + message: nil + +
        • + +
        + + + +

        Functions summary

        + + + + + + +
        +

        Functions

        +
        +

        + exception(args) +

        +
        + Source +
        +

        + exception(args, self) +

        +
        + Source +
        +

        + message(record) +

        +
        + Source +
        +

        + message(value, record) +

        +
        + Source +
        +

        + new() +

        +
        + Source +
        +

        + new(opts) +

        +
        + Source +
        +

        + to_keywords(record) +

        +
        + Source +
        +

        + update_message(function, record) +

        +
        + Source +
        +
        + + + +
        + + diff --git a/docs/master/Mix.InvalidTaskError.html b/docs/master/Mix.InvalidTaskError.html new file mode 100644 index 000000000..753eacc94 --- /dev/null +++ b/docs/master/Mix.InvalidTaskError.html @@ -0,0 +1,167 @@ + + + + Mix.InvalidTaskError + + + + + + + + + + + + +
        +

        + Mix.InvalidTaskError + + exception + +

        + + + + Source + + + + +

        Fields (and defaults)

        +
          + +
        • + + task: nil + +
        • + +
        + + + +

        Functions summary

        + + + + + + +
        +

        Functions

        +
        +

        + exception(args) +

        +
        + Source +
        +

        + exception(args, self) +

        +
        + Source +
        +

        + message(exception) +

        +
        + Source +
        +

        + new() +

        +
        + Source +
        +

        + new(opts) +

        +
        + Source +
        +

        + task(record) +

        +
        + Source +
        +

        + task(value, record) +

        +
        + Source +
        +

        + to_keywords(record) +

        +
        + Source +
        +

        + update_task(function, record) +

        +
        + Source +
        +
        + + + +
        + + diff --git a/docs/master/Mix.NoProjectError.html b/docs/master/Mix.NoProjectError.html new file mode 100644 index 000000000..918ab3ecf --- /dev/null +++ b/docs/master/Mix.NoProjectError.html @@ -0,0 +1,156 @@ + + + + Mix.NoProjectError + + + + + + + + + + + + +
        +

        + Mix.NoProjectError + + exception + +

        + + + + Source + + + + +

        Fields (and defaults)

        +
          + +
        • + + message: "Could not find a Mix.Project" + +
        • + +
        + + + +

        Functions summary

        + + + + + + +
        +

        Functions

        +
        +

        + exception(args) +

        +
        + Source +
        +

        + exception(args, self) +

        +
        + Source +
        +

        + message(record) +

        +
        + Source +
        +

        + message(value, record) +

        +
        + Source +
        +

        + new() +

        +
        + Source +
        +

        + new(opts) +

        +
        + Source +
        +

        + to_keywords(record) +

        +
        + Source +
        +

        + update_message(function, record) +

        +
        + Source +
        +
        + + + +
        + + diff --git a/docs/master/Mix.NoTaskError.html b/docs/master/Mix.NoTaskError.html new file mode 100644 index 000000000..9b9a65b2a --- /dev/null +++ b/docs/master/Mix.NoTaskError.html @@ -0,0 +1,167 @@ + + + + Mix.NoTaskError + + + + + + + + + + + + +
        +

        + Mix.NoTaskError + + exception + +

        + + + + Source + + + + +

        Fields (and defaults)

        +
          + +
        • + + task: nil + +
        • + +
        + + + +

        Functions summary

        + + + + + + +
        +

        Functions

        +
        +

        + exception(args) +

        +
        + Source +
        +

        + exception(args, self) +

        +
        + Source +
        +

        + message(exception) +

        +
        + Source +
        +

        + new() +

        +
        + Source +
        +

        + new(opts) +

        +
        + Source +
        +

        + task(record) +

        +
        + Source +
        +

        + task(value, record) +

        +
        + Source +
        +

        + to_keywords(record) +

        +
        + Source +
        +

        + update_task(function, record) +

        +
        + Source +
        +
        + + + +
        + + diff --git a/docs/master/Mix.Project.html b/docs/master/Mix.Project.html new file mode 100644 index 000000000..16b4dc92b --- /dev/null +++ b/docs/master/Mix.Project.html @@ -0,0 +1,130 @@ + + + + Mix.Project + + + + + + + + + + + + +
        +

        + Mix.Project + +

        + + +
        +

        A module that provides conveniences for defining and working +with projects.

        + +

        Examples

        + +

        In order to configure Mix, a developer needs to use +Mix.Project in a module and define a function named +project that returns a keywords list with configuration.

        + +
        defmodule MyApp do
        +  use Mix.Project
        +
        +  def project do
        +    [
        +      app: "my_app",
        +      vsn: "0.6.0"
        +    ]
        +  end
        +end
        +
        + +

        After defined, the configuration for this project can be read +as Mix.Project.config/0. Notice that config won't fail if a +project is not defined, this allows many of mix tasks to work +even without a project.

        + +

        In case the developer needs a project or want to access a special +function in the project, he can access Mix.Project.current/0 +which fails with Mix.NoProjectError in case a project is not +defined.

        + +
        + + + Source + + + + + + +

        Functions summary

        + + + + + + +
        +

        Functions

        +
        +

        + config() +

        +

        Retrieves the current project configuration. If there +isn't a project defined, this function will simply +return a keywords list with default values. This allows +many mix functions to work without a need for an +underlying project.

        +
        + Source +
        +

        + current() +

        +

        Retrieves the current project, raises an error +if there is no project set.

        +
        + Source +
        +

        + defined?() +

        +

        Returns true if a current project is defined.

        +
        + Source +
        +
        + + + +
        + + diff --git a/docs/master/Mix.Shell.Test.html b/docs/master/Mix.Shell.Test.html new file mode 100644 index 000000000..74a44384f --- /dev/null +++ b/docs/master/Mix.Shell.Test.html @@ -0,0 +1,104 @@ + + + + Mix.Shell.Test + + + + + + + + + + + + +
        +

        + Mix.Shell.Test + +

        + + +
        +

        This is Mix's test shell. +It simply sends the received calls to +the current process queue, so they can be read later.

        + +
        + + + Source + + + + + + +

        Functions summary

        + + + + + + +
        +

        Functions

        +
        +

        + error(message) +

        +
        + Source +
        +

        + flush(callback // fn(x) do + x +end) +

        +

        Flush all :mix_shell messages from the current process. +If a callback is given, it is invoked for each received message.

        + +

        Examples

        + +
        flush IO.inspect(&1)
        +
        +
        + Source +
        +

        + info(message) +

        +
        + Source +
        +
        + + + +
        + + diff --git a/docs/master/Mix.Shell.html b/docs/master/Mix.Shell.html new file mode 100644 index 000000000..b6caef203 --- /dev/null +++ b/docs/master/Mix.Shell.html @@ -0,0 +1,97 @@ + + + + Mix.Shell + + + + + + + + + + + + +
        +

        + Mix.Shell + +

        + + +
        +

        This is Mix's default shell. +It simply prints messages to stdio and stderr.

        + +
        + + + Source + + + + + + +

        Functions summary

        + + + + + + +
        +

        Functions

        +
        +

        + behaviour_info(atom1) +

        +

        Define Mix.Shell callbacks.

        +
        + Source +
        +

        + error(message) +

        +

        Writes an error message to the shell followed by new line.

        +
        + Source +
        +

        + info(message) +

        +

        Writes a message to the shell followed by new line.

        +
        + Source +
        +
        + + + +
        + + diff --git a/docs/master/Mix.Task.html b/docs/master/Mix.Task.html new file mode 100644 index 000000000..d2d0c6f18 --- /dev/null +++ b/docs/master/Mix.Task.html @@ -0,0 +1,187 @@ + + + + Mix.Task + + + + + + + + + + + + +
        +

        + Mix.Task + +

        + + +
        +

        A simple module that provides conveniences for creating tasks.

        + +
        + + + Source + + + + + + +

        Functions summary

        + + + + + + +
        +

        Functions

        +
        +

        + all_modules() +

        +

        Returns all loaded modules. Modules that were not yet loaded +won't show up. Check load_all/0 if you want to preload all tasks.

        +
        + Source +
        +

        + clear() +

        +

        Clears all invoked tasks, allowing them to be reinvoked. +Returns an ordset with all the tasks invoked thus far.

        +
        + Source +
        +

        + get(task) +

        +

        Receives a task name and retrives the task module.

        + +

        Exceptions

        + +
          +
        • Mix.NoTaskError - raised if the task could not be found;
        • +
        • Mix.InvalidTaskError - raised if the task is not a valid Mix.Task
        • +
        +
        + Source +
        +

        + load_all() +

        +

        Loads all tasks in all code paths.

        +
        + Source +
        +

        + moduledoc(module) +

        +

        Gets the moduledoc for the given module. +Returns the moduledoc or nil.

        +
        + Source +
        +

        + reenable(task) +

        +

        Reenables a given task so it can be executed again down the stack.

        +
        + Source +
        +

        + run(task, args // []) +

        +

        Runs a task with the given args.

        + +

        If the task was not yet invoked, it returns :ok.

        + +

        If the task was already invoked, it does not run the task +again and simply aborts with :noop.

        + +

        It may raise an exception if the task was not found +or it is invalid. Check get/2 for more information.

        +
        + Source +
        +

        + shortdoc(module) +

        +

        Gets the shortdoc for the given module. +Returns the shortdoc or nil.

        +
        + Source +
        +

        + task_name(module) +

        +

        Returns the task name for the given module.

        +
        + Source +
        +
        + + + +
        + + diff --git a/docs/master/Mix.Tasks.Compile.Elixir.html b/docs/master/Mix.Tasks.Compile.Elixir.html new file mode 100644 index 000000000..8ac322438 --- /dev/null +++ b/docs/master/Mix.Tasks.Compile.Elixir.html @@ -0,0 +1,109 @@ + + + + Mix.Tasks.Compile.Elixir + + + + + + + + + + + + +
        +

        + Mix.Tasks.Compile.Elixir + +

        + + +
        +

        A task to compile Elixir source files.

        + +

        When this task runs, it will first check the mod times of +all of the files to be compiled and if they haven't been +changed since the last compilation, it will not compile +them at all. If any one of them has changed, it compiles +everything.

        + +

        For this reason, this task touches your :compile_path +directory and sets the modification time to the current +time and date at the end of each compilation. You can +force compilation regardless of mod times by passing +the --force option.

        + +

        Configuration

        + +
          +
        • :source_paths - directories to find source files. +Defaults to ["lib"], can be configured as:

          + +

          [source_paths: ["lib", "other"]]

        • +
        • :compile_path - directory to output compiled files. +Defaults to "ebin", can be configured as:

          + +

          [compile_path: "ebin"]

        • +
        • :compile_first - which files need to be compiled first. +Defaults to an empty list, can be configured as:

          + +

          [compile_first: ["lib/foo.ex" "lib/bar.ex"]]

        • +
        • :elixirc_options - compilation options that applies +to Elixir's compiler, they are: :ignore_module_conflict, +:docs and :debug_info. They all default to false.

        • +
        + +

        Command line options

        + +
          +
        • --force forces compilation regardless of mod times;
        • +
        + +
        + + + Source + + + + + + +

        Functions summary

        + + + + + + +
        +

        Functions

        +
        +

        + run(args) +

        +
        + Source +
        +
        + + + +
        + + diff --git a/docs/master/Mix.Tasks.Compile.html b/docs/master/Mix.Tasks.Compile.html new file mode 100644 index 000000000..0f438c0db --- /dev/null +++ b/docs/master/Mix.Tasks.Compile.html @@ -0,0 +1,92 @@ + + + + Mix.Tasks.Compile + + + + + + + + + + + + +
        +

        + Mix.Tasks.Compile + +

        + + +
        +

        A meta task that compile source files. It simply runs the +compilers registered in your project.

        + +

        Configuration

        + +
          +
        • :compilers - compilers to be run, defaults to:

          + +

          [:elixir, :app]

        • +
        + +

        Can be configured in your projects as:

        + +
        [compilers: [:elixir, :erlang, :app]]
        +
        + +

        Command line options

        + +
          +
        • --list List all enabled compilers. + mix help should give you the full list.
        • +
        + +
        + + + Source + + + + + + +

        Functions summary

        + + + + + + +
        +

        Functions

        +
        +

        + run(args) +

        +
        + Source +
        +
        + + + +
        + + diff --git a/docs/master/Mix.Tasks.Help.html b/docs/master/Mix.Tasks.Help.html new file mode 100644 index 000000000..9d19d553f --- /dev/null +++ b/docs/master/Mix.Tasks.Help.html @@ -0,0 +1,79 @@ + + + + Mix.Tasks.Help + + + + + + + + + + + + +
        +

        + Mix.Tasks.Help + +

        + + +
        +

        If given a task name, prints the documentation for that task. +If no task name is given, prints the short form documentation +for all tasks.

        + +

        Arguments

        + +
        mix help      - prints all tasks and their shortdoc
        +mix help TASK - prints full docs for the given task
        +
        + +
        + + + Source + + + + + + +

        Functions summary

        + + + + + + +
        +

        Functions

        +
        +

        + run(list1) +

        +
        + Source +
        +
        + + + +
        + + diff --git a/docs/master/Mix.Tasks.Iex.html b/docs/master/Mix.Tasks.Iex.html new file mode 100644 index 000000000..4b8b928c9 --- /dev/null +++ b/docs/master/Mix.Tasks.Iex.html @@ -0,0 +1,74 @@ + + + + Mix.Tasks.Iex + + + + + + + + + + + + +
        +

        + Mix.Tasks.Iex + +

        + + +
        +

        Starts an iex repl with your project settings.

        + +

        Elixir ensures your code is compiled and loaded +before starting IEx.

        + +
        + + + Source + + + + + + +

        Functions summary

        + + + + + + +
        +

        Functions

        +
        +

        + run(_) +

        +
        + Source +
        +
        + + + +
        + + diff --git a/docs/master/Mix.Tasks.Loadpaths.html b/docs/master/Mix.Tasks.Loadpaths.html new file mode 100644 index 000000000..3f3520cd6 --- /dev/null +++ b/docs/master/Mix.Tasks.Loadpaths.html @@ -0,0 +1,75 @@ + + + + Mix.Tasks.Loadpaths + + + + + + + + + + + + +
        +

        + Mix.Tasks.Loadpaths + +

        + + +
        +

        Loads the application paths.

        + +

        This task is does not appear when mix help is invoked +since it is hidden (it does not contain a shortdoc), +however it can be freely invoked from other tasks.

        + +
        + + + Source + + + + + + +

        Functions summary

        + + + + + + +
        +

        Functions

        +
        +

        + run(_) +

        +
        + Source +
        +
        + + + +
        + + diff --git a/docs/master/Mix.Tasks.Test.html b/docs/master/Mix.Tasks.Test.html new file mode 100644 index 000000000..3d822553c --- /dev/null +++ b/docs/master/Mix.Tasks.Test.html @@ -0,0 +1,86 @@ + + + + Mix.Tasks.Test + + + + + + + + + + + + +
        +

        + Mix.Tasks.Test + +

        + + +
        +

        Run the tests for a project.

        + +

        This task will preload the test/test_helper.exs which +should do all testing setup and then require all files +that matches the given test_pattern in parallel.

        + +

        It ensures the project is compiled before executing.

        + +

        Configuration

        + +
          +
        • :test_pattern - a pattern to load test files. +Defaults to test/**/*_test.exs.

        • +
        • :test_helper - a file that sets up whatever is necessary +for testing. Defaults to test/test_helper.exs.

        • +
        + +
        + + + Source + + + + + + +

        Functions summary

        + + + + + + +
        +

        Functions

        +
        +

        + run(_) +

        +
        + Source +
        +
        + + + +
        + + diff --git a/docs/master/Mix.Utils.html b/docs/master/Mix.Utils.html new file mode 100644 index 000000000..e66d56b2c --- /dev/null +++ b/docs/master/Mix.Utils.html @@ -0,0 +1,139 @@ + + + + Mix.Utils + + + + + + + + + + + + +
        +

        + Mix.Utils + +

        + + +
        +

        Utilities used throughout Mix and tasks.

        + +

        Command names and module names

        + +

        Throughout this module (and Mix), we use two main terms:

        + +
          +
        • command names: are names as given from the command line; +usually all items are in lowercase and uses dashes instead +of underscores;

        • +
        • module names: valid module names according to Elixir;

        • +
        + +

        Some tasks in this module works exactly with converting +from one to the other. See command_to_module_name/2, +module_name_to_command/2, get_module/2.

        + +
        + + + Source + + + + + + +

        Functions summary

        + + + + + + +
        +

        Functions

        +
        +

        + command_to_module_name(s) +

        +

        Takes a command and converts it to a module name format.

        + +

        Examples

        + +
        command_to_module_name("compile.elixir")
        +#=> "Compile.Elixir"
        +
        +
        + Source +
        +

        + get_module(command, at // __MAIN__) +

        +

        Takes a command name and try to load a module +with the command name converted to a module name +in the given at scope.

        + +

        Returns { :module, module } in case a module +exists and is loaded, { :error, reason } otherwise.

        + +

        Examples

        + +
        Mix.Utils.get_module("compile", Mix.Tasks)
        +#=> { :module, Mix.Tasks.Compile }
        +
        +
        + Source +
        +

        + module_name_to_command(module, nesting // 0) +

        +

        Takes a module and converts it to a command. The nesting +argument can be given in order to remove the nesting of +module.

        + +

        Examples

        + +
        module_name_to_command(Mix.Tasks.Compile, 2)
        +#=> "compile"
        +
        +module_name_to_command("Mix.Tasks.Compile.Elixir", 2)
        +#=> "compile.elixir"
        +
        +
        + Source +
        +
        + + + +
        + + diff --git a/docs/master/Mix.html b/docs/master/Mix.html new file mode 100644 index 000000000..8ac4c0dfa --- /dev/null +++ b/docs/master/Mix.html @@ -0,0 +1,96 @@ + + + + Mix + + + + + + + + + + + + +
        +

        + Mix + +

        + + + + Source + + + + + + +

        Functions summary

        + + + + + + +
        +

        Functions

        +
        +

        + shell() +

        +

        The shell is a wrapper for doing IO.

        + +

        It contains conveniences for asking the user information, +printing status and so forth. The fact it is also swappable +allow developers to use a test shell, that simply sends the +messages to the current process.

        +
        + Source +
        +

        + shell(shell) +

        +

        Sets the current shell.

        +
        + Source +
        +

        + start() +

        +

        Starts the mix application and its dependencies.

        +
        + Source +
        +
        + + + +
        + + diff --git a/docs/master/Module.html b/docs/master/Module.html index 5c98eee8f..22586d798 100644 --- a/docs/master/Module.html +++ b/docs/master/Module.html @@ -152,13 +152,13 @@

        Examples

        end - Source + Source

        add_compile_callback(module, target, fun // :__compiling__)

        - Source + Source

        add_doc(module, line, kind, tuple, signature, doc) @@ -222,7 +222,7 @@

        Examples

        end
        - Source + Source

        defined_functions(module, kind) @@ -239,7 +239,7 @@

        Examples

        end
        - Source + Source

        delete_attribute(module, key) @@ -254,7 +254,7 @@

        Examples

        end
        - Source + Source

        eval_quoted(env, quoted, binding // [], opts // []) @@ -312,7 +312,7 @@

        Examples

        end
        - Source + Source

        function_defined?(module, tuple, kind) @@ -329,7 +329,7 @@

        Examples

        end
        - Source + Source

        make_overridable(module, tuples) @@ -338,7 +338,7 @@

        Examples

        An overridable function is lazily defined, allowing a developer to customize it.

        - Source + Source

        read_attribute(module, key) @@ -359,7 +359,7 @@

        Examples

        end
        - Source + Source

        register_attribute(module, new, opts // []) @@ -396,7 +396,7 @@

        Examples

        end
        - Source + Source

        safe_concat(list) diff --git a/docs/master/Node.html b/docs/master/Node.html index 8ce21072d..52656c0ff 100644 --- a/docs/master/Node.html +++ b/docs/master/Node.html @@ -71,6 +71,11 @@

        Functions summary

        monitor/3
      167. +
      168. + + self/0 + +
      169. @@ -87,7 +92,7 @@

        Functions

        Returns true if the local node is alive; that is, if the node can be part of a distributed system. Otherwise, it returns false.

        - Source + Source

        disconnect(node) @@ -99,7 +104,7 @@

        Functions

        See http://www.erlang.org/doc/man/erlang.html#disconnect_node-1 for more info.

        - Source + Source

        list() @@ -107,7 +112,7 @@

        Functions

        Returns a list of all visible nodes in the system, excluding the local node. Same as list(visible).

        - Source + Source

        list(args) @@ -118,7 +123,7 @@

        Functions

        See http://www.erlang.org/doc/man/erlang.html#nodes-1 for more info.

        - Source + Source

        monitor(node, flag) @@ -128,7 +133,7 @@

        Functions

        See http://www.erlang.org/doc/man/erlang.html#monitor_node-2 for more info.

        - Source + Source

        monitor(node, flag, options) @@ -138,7 +143,14 @@

        Functions

        See http://www.erlang.org/doc/man/erlang.html#monitor_node-3 for more info.

        - Source + Source +
        +

        + self() +

        +

        Returns the current node. It returns the same as the built-in node().

        +
        + Source
        diff --git a/docs/master/Protocol.UndefinedError.html b/docs/master/Protocol.UndefinedError.html index 975cc7e8e..98e455500 100644 --- a/docs/master/Protocol.UndefinedError.html +++ b/docs/master/Protocol.UndefinedError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -129,73 +129,73 @@

        Functions

        exception(args)

        - Source + Source

        exception(args, self)

        - Source + Source

        message(exception)

        - Source + Source

        new()

        - Source + Source

        new(opts)

        - Source + Source

        protocol(record)

        - Source + Source

        protocol(value, record)

        - Source + Source

        structure(record)

        - Source + Source

        structure(value, record)

        - Source + Source

        to_keywords(record)

        - Source + Source

        update_protocol(function, record)

        - Source + Source

        update_structure(function, record)

        - Source + Source
        diff --git a/docs/master/Regex.html b/docs/master/Regex.html index 4bf002226..0bda025f9 100644 --- a/docs/master/Regex.html +++ b/docs/master/Regex.html @@ -79,7 +79,7 @@

        Most of the functions in this module accept either a binary or a char list -as string subject. The result is based on the argument (a binary will return +as subject. The result is based on the argument (a binary will return a binary, a char list will return a char list).

        diff --git a/docs/master/RuntimeError.html b/docs/master/RuntimeError.html index 69e767b2f..46064cdce 100644 --- a/docs/master/RuntimeError.html +++ b/docs/master/RuntimeError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -103,49 +103,49 @@

        Functions

        exception(args)

        - Source + Source

        exception(args, self)

        - Source + Source

        message(record)

        - Source + Source

        message(value, record)

        - Source + Source

        new()

        - Source + Source

        new(opts)

        - Source + Source

        to_keywords(record)

        - Source + Source

        update_message(function, record)

        - Source + Source
        diff --git a/docs/master/SyntaxError.html b/docs/master/SyntaxError.html index 8cac73e85..8d1925949 100644 --- a/docs/master/SyntaxError.html +++ b/docs/master/SyntaxError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -150,91 +150,91 @@

        Functions

        description(record)

        - Source + Source

        description(value, record)

        - Source + Source

        exception(args)

        - Source + Source

        exception(args, self)

        - Source + Source

        file(record)

        - Source + Source

        file(value, record)

        - Source + Source

        line(record)

        - Source + Source

        line(value, record)

        - Source + Source

        message(exception)

        - Source + Source

        new()

        - Source + Source

        new(opts)

        - Source + Source

        to_keywords(record)

        - Source + Source

        update_description(function, record)

        - Source + Source

        update_file(function, record)

        - Source + Source

        update_line(function, record)

        - Source + Source
        diff --git a/docs/master/System.html b/docs/master/System.html index 90c86407a..5e3e1a499 100644 --- a/docs/master/System.html +++ b/docs/master/System.html @@ -34,7 +34,7 @@

        - Source + Source @@ -118,7 +118,7 @@

        Functions

        Returns the list of command-line arguments passed to the program.

        - Source + Source

        at_exit(fun) @@ -130,7 +130,7 @@

        Functions

        The function must expect the exit status code as argument.

        - Source + Source

        build_info() @@ -140,7 +140,7 @@

        Functions

        The format of the return value may change in a future release. Please make sure your code doesn't depend on it.

        - Source + Source

        cmd(command) @@ -148,8 +148,11 @@

        Functions

        Executes command in a command shell of the target OS, captures the standard output of the command and returns the result as a binary.

        + +

        If command is a char list, a char list is returned. +Returns a binary otherwise.

        - Source + Source

        find_executable(command) @@ -157,8 +160,11 @@

        Functions

        This functions looks up an executable program given its name using the environment variable PATH on Unix and Windows.

        + +

        If command is a char list, a char list is returned. +Returns a binary otherwise.

        - Source + Source

        get_env() @@ -167,7 +173,7 @@

        Functions

        given as a single string of the format "VarName=Value", where VarName is the name of the variable and Value its value.

        - Source + Source

        get_env(varname) @@ -176,7 +182,7 @@

        Functions

        varname as a binary, or nil if the environment variable is undefined.

        - Source + Source

        get_pid() @@ -186,7 +192,7 @@

        Functions

        See http://www.erlang.org/doc/man/os.html#getpid-0 for more info.

        - Source + Source

        put_env(dict) @@ -194,28 +200,28 @@

        Functions

        Sets a new value for each environment variable corresponding to each key in dict.

        - Source + Source

        put_env(varname, value)

        Sets a new value for the environment variable varname.

        - Source + Source

        stacktrace()

        Get the stacktrace.

        - Source + Source

        version()

        Returns Elixir's version as binary.

        - Source + Source
        diff --git a/docs/master/SystemLimitError.html b/docs/master/SystemLimitError.html index 72ea413c4..44838f29c 100644 --- a/docs/master/SystemLimitError.html +++ b/docs/master/SystemLimitError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -103,49 +103,49 @@

        Functions

        exception(args)

        - Source + Source

        exception(args, self)

        - Source + Source

        message(record)

        - Source + Source

        message(value, record)

        - Source + Source

        new()

        - Source + Source

        new(opts)

        - Source + Source

        to_keywords(record)

        - Source + Source

        update_message(function, record)

        - Source + Source
        diff --git a/docs/master/TokenMissingError.html b/docs/master/TokenMissingError.html index 96575b38d..1d9ef120e 100644 --- a/docs/master/TokenMissingError.html +++ b/docs/master/TokenMissingError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -150,91 +150,91 @@

        Functions

        description(record)

        - Source + Source

        description(value, record)

        - Source + Source

        exception(args)

        - Source + Source

        exception(args, self)

        - Source + Source

        file(record)

        - Source + Source

        file(value, record)

        - Source + Source

        line(record)

        - Source + Source

        line(value, record)

        - Source + Source

        message(exception)

        - Source + Source

        new()

        - Source + Source

        new(opts)

        - Source + Source

        to_keywords(record)

        - Source + Source

        update_description(function, record)

        - Source + Source

        update_file(function, record)

        - Source + Source

        update_line(function, record)

        - Source + Source
        diff --git a/docs/master/UndefinedFunctionError.html b/docs/master/UndefinedFunctionError.html index 6b34ce876..fff6816a5 100644 --- a/docs/master/UndefinedFunctionError.html +++ b/docs/master/UndefinedFunctionError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -150,91 +150,91 @@

        Functions

        arity(record)

        - Source + Source

        arity(value, record)

        - Source + Source

        exception(args)

        - Source + Source

        exception(args, self)

        - Source + Source

        function(record)

        - Source + Source

        function(value, record)

        - Source + Source

        message(exception)

        - Source + Source

        module(record)

        - Source + Source

        module(value, record)

        - Source + Source

        new()

        - Source + Source

        new(opts)

        - Source + Source

        to_keywords(record)

        - Source + Source

        update_arity(function, record)

        - Source + Source

        update_function(function, record)

        - Source + Source

        update_module(function, record)

        - Source + Source
        diff --git a/docs/master/modules_list.html b/docs/master/modules_list.html index a241be432..cc61d939d 100644 --- a/docs/master/modules_list.html +++ b/docs/master/modules_list.html @@ -916,6 +916,13 @@

        Elixir.Builtin +
      170. + + function_exported?/3 + + Elixir.Builtin +
      171. +
      172. halt/0 @@ -1280,6 +1287,13 @@

        Elixir.Builtin

      173. +
      174. + + self/0 + + Elixir.Builtin +
      175. +
      176. setelem/3 @@ -1453,6 +1467,25 @@

        Elixir.ParallelCompiler

      177. +
      178. + + + + Elixir.ParallelRequire + + + Elixir.ParallelRequire +
      179. +
          + + +
        • + + files/2 + + Elixir.ParallelRequire +
        • +
      180. @@ -1500,6 +1533,27 @@

        Elixir.SpecialForms

      181. +
      182. + + __aliases__/1 + + Elixir.SpecialForms +
      183. + +
      184. + + __block__/1 + + Elixir.SpecialForms +
      185. + +
      186. + + __scope__/2 + + Elixir.SpecialForms +
      187. +
      188. alias/2 @@ -1757,7 +1811,7 @@

      189. - nth/2 + nth!/2 Enum
      190. @@ -1891,35 +1945,28 @@

      191. - assert_match/2 - - ExUnit.Assertions -
      192. - -
      193. - - assert_member/3 + assert_nil/2 ExUnit.Assertions
      194. - assert_nil/2 + assert_raise/2 ExUnit.Assertions
      195. - assert_raise/2 + assert_raise/3 ExUnit.Assertions
      196. - assert_raise/3 + assert_received/2 ExUnit.Assertions
      197. @@ -1968,21 +2015,21 @@

      198. - refute_match/2 + refute_member/3 ExUnit.Assertions
      199. - refute_member/3 + refute_nil/2 ExUnit.Assertions
      200. - refute_nil/2 + refute_received/2 ExUnit.Assertions
      201. @@ -2095,6 +2142,27 @@

        File

      202. +
      203. + + cd/1 + + File +
      204. + +
      205. + + cd!/1 + + File +
      206. + +
      207. + + cd!/2 + + File +
      208. +
      209. close/1 @@ -2102,6 +2170,62 @@

        File

      210. +
      211. + + copy/3 + + File +
      212. + +
      213. + + copy!/3 + + File +
      214. + +
      215. + + cp/3 + + File +
      216. + +
      217. + + cp!/3 + + File +
      218. + +
      219. + + cp_r/3 + + File +
      220. + +
      221. + + cp_r!/3 + + File +
      222. + +
      223. + + cwd/0 + + File +
      224. + +
      225. + + cwd!/0 + + File +
      226. +
      227. dir?/1 @@ -2165,6 +2289,13 @@

        File

      228. +
      229. + + mkdir!/1 + + File +
      230. +
      231. mkdir_p/1 @@ -2172,6 +2303,13 @@

        File

      232. +
      233. + + mkdir_p!/1 + + File +
      234. +
      235. open/2 @@ -2179,6 +2317,27 @@

        File

      236. +
      237. + + open/3 + + File +
      238. + +
      239. + + open!/2 + + File +
      240. + +
      241. + + open!/3 + + File +
      242. +
      243. read/1 @@ -2221,6 +2380,41 @@

        File

      244. +
      245. + + rm!/1 + + File +
      246. + +
      247. + + rm_rf/1 + + File +
      248. + +
      249. + + rm_rf!/1 + + File +
      250. + +
      251. + + rmdir/1 + + File +
      252. + +
      253. + + rmdir!/1 + + File +
      254. +
      255. rootname/1 @@ -2256,6 +2450,20 @@

        File

      256. +
      257. + + touch/1 + + File +
      258. + +
      259. + + touch!/1 + + File +
      260. +
      261. wildcard/1 @@ -2270,6 +2478,27 @@

        File

      262. +
      263. + + write!/3 + + File +
      264. + +
      265. + + write_stat/3 + + File +
      266. + +
      267. + + write_stat!/3 + + File +
      268. +
      269. @@ -2351,6 +2580,27 @@

        IEx.Helpers

      270. +
      271. + + d/1 + + IEx.Helpers +
      272. + +
      273. + + d/2 + + IEx.Helpers +
      274. + +
      275. + + d/3 + + IEx.Helpers +
      276. +
      277. h/0 @@ -2524,21 +2774,21 @@

      278. - fetch/2 + from_enum/1 Keyword
      279. - from_enum/1 + get/3 Keyword
      280. - get/3 + get!/2 Keyword
      281. @@ -2826,6 +3076,360 @@

        Macro

      282. +
      283. + + + + Mix + + + Mix +
      284. +
      285. @@ -3004,6 +3608,13 @@

        Node

      286. +
      287. + + self/0 + + Node +
      288. +
      289. diff --git a/docs/master/records_list.html b/docs/master/records_list.html index 7f02da40f..8a3ff6896 100644 --- a/docs/master/records_list.html +++ b/docs/master/records_list.html @@ -600,6 +600,74 @@

        EEx.SyntaxError

      290. +
      291. + + + + Enum.OutOfBoundsError + + + Enum.OutOfBoundsError +
      292. +
      293. @@ -743,6 +811,144 @@

        ExUnit.AssertionError

      294. +
      295. + + + + File.CopyError + + + File.CopyError +
      296. +
      297. @@ -1522,6 +1728,292 @@

        MatchError

      298. +
      299. + + + + Mix.Error + + + Mix.Error +
      300. +
      301. + + + + Mix.InvalidTaskError + + + Mix.InvalidTaskError +
      302. +
          + + +
        • + + exception/1 + + Mix.InvalidTaskError +
        • + +
        • + + exception/2 + + Mix.InvalidTaskError +
        • + +
        • + + message/1 + + Mix.InvalidTaskError +
        • + +
        • + + new/0 + + Mix.InvalidTaskError +
        • + +
        • + + new/1 + + Mix.InvalidTaskError +
        • + +
        • + + task/1 + + Mix.InvalidTaskError +
        • + +
        • + + task/2 + + Mix.InvalidTaskError +
        • + +
        • + + to_keywords/1 + + Mix.InvalidTaskError +
        • + +
        • + + update_task/2 + + Mix.InvalidTaskError +
        • + +
      303. + + + + Mix.NoProjectError + + + Mix.NoProjectError +
      304. +
      305. + + + + Mix.NoTaskError + + + Mix.NoTaskError +
      306. +
      307. From df2266c7f2e09f1c57531bc6c0bcf38e9725725d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Fri, 20 Jul 2012 20:31:12 +0200 Subject: [PATCH 175/437] File.iterator returns { :ok, file } --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index d513897b2..a34fe3442 100644 --- a/index.html +++ b/index.html @@ -81,7 +81,7 @@

        Polymorphism via protocols

        Since the Enum module is built on top of protocols, it is not only limited to the data types that ships with Elixir. A developer can use his own collections with Enum as long as it implements the Enum.Iterator protocol. For example, a developer can use all the convenience of the Enum module to easily manipulate a file, line by line:

        {% highlight ruby %} -file = File.iterator("README.md") +{ :ok, file } = File.iterator("README.md") lines = Enum.map(file, fn(line) -> Regex.replace_all(%r/"/, line, "'") end) File.write("README.md", lines) {% endhighlight %} From ef12635d1c5983836ee108d1d6f270e8b84bd2a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sun, 29 Jul 2012 14:03:59 +0200 Subject: [PATCH 176/437] Improvements to spawn and processes section --- _posts/2012-05-06-web-framework-2.markdown | 4 ++-- getting_started/2.markdown | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/_posts/2012-05-06-web-framework-2.markdown b/_posts/2012-05-06-web-framework-2.markdown index 2450a646e..0b50b6429 100644 --- a/_posts/2012-05-06-web-framework-2.markdown +++ b/_posts/2012-05-06-web-framework-2.markdown @@ -158,7 +158,7 @@ Let's think for a moment what the `multi_handle` macro should expand to. So far defmacro multi_handle(path, [do: { :"->", _line, blocks }]) do # Iterate over each block in `blocks` and # produce a separate `handle` clause for it - Enum.map blocks, (fn do + Enum.map blocks, fn -> { [:get], code } -> quote hygiene: false do def handle(:get, unquote(path), _query) do @@ -171,7 +171,7 @@ Let's think for a moment what the `multi_handle` macro should expand to. So far unquote(code) end end - end) + end end When the macro is called, we receive all clauses under the `do` key with each HTTP verb and its implementation inside the syntax node `->`, in the order they are specified. Each clause is a tuple with two elements, the first one is a list of parameters given on the left side and the second one is the implementation, for example: diff --git a/getting_started/2.markdown b/getting_started/2.markdown index c633453f6..038b5a714 100644 --- a/getting_started/2.markdown +++ b/getting_started/2.markdown @@ -581,7 +581,9 @@ In order to exchange messages, each process has a mailbox where the received mes iex> current_pid = Process.self # Spawn another process that will send a message to current_pid - iex> spawn fn(do: current_pid <- { :hello, Process.self }) + iex> spawn fn -> + current_pid <- { :hello, Process.self } + end <0.36.0> # Collect the message @@ -602,10 +604,10 @@ You may not see exactly `<0.36.0>` back, but something similar. If there are no ...> end Too late -In most cases, we don't send messages directly with `<-` nor write `receive` control expressions. Instead, we use many of the abstractions provided by OTP which will be discussed later. +Notice we spawned a new function using the `spawn` function passing another function as argument. Elixir also supports `spawn_link`, which spawns a child process but keeps the parent and child connected. This way, if the child dies unexpectedly, the parent receives a notification. [`Process`](/docs/latest/Process.html) and [`Node`](/docs/latest/Node.html) modules contains many functions to manage processes, including spawning and get information about processes running in other nodes in the network. ## 2.8 Built-in functions -Elixir ships with many built-in functions automatically available in the current scope. Besides all the control flow expressions seen above, Elixir also adds: `elem` and `setelem` to read and set values in tuples, `inspect` that returns the representation of a given data type as string and many others. All these functions imported by default are available in `Elixir.Builtin`](http://elixir-lang.org/docs/latest/Elixir.Builtin.html) and [Elixir special forms are available in `Elixir.SpecialForms`](http://elixir-lang.org/docs/latest/Elixir.SpecialForms.html). +Elixir ships with many built-in functions automatically available in the current scope. Besides all the control flow expressions seen above, Elixir also adds: `elem` and `setelem` to read and set values in tuples, `inspect` that returns the representation of a given data type as string and many others. All these functions imported by default are available in [`Elixir.Builtin`](http://elixir-lang.org/docs/latest/Elixir.Builtin.html) and [Elixir special forms are available in `Elixir.SpecialForms`](http://elixir-lang.org/docs/latest/Elixir.SpecialForms.html). All those functions and control flow expressions are essential for building Elixir programs. The next chapter will discuss how to organize our code into modules, so it can be easily re-used between different components. \ No newline at end of file From d5b21ba45b3922eed5ee21ae00bd0c5571353db1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Mon, 28 May 2012 14:38:49 +0200 Subject: [PATCH 177/437] Update to latest elixir --- crash-course.markdown | 4 +--- getting_started/3.markdown | 40 +++++++++++++++++++------------------- getting_started/6.markdown | 10 +++++----- 3 files changed, 26 insertions(+), 28 deletions(-) diff --git a/crash-course.markdown b/crash-course.markdown index 6e7a730ac..c6d8b6ea5 100644 --- a/crash-course.markdown +++ b/crash-course.markdown @@ -143,8 +143,6 @@ Elixir allows you to omit parentheses in function calls, Erlang does not. | some_function(). | some_function | | sum(a, b) | sum a, b | -### Module References - Invoking a function from a module uses different syntax. In Erlang, you would write {% highlight erlang %} @@ -173,7 +171,7 @@ Erlang and Elixir have the same data types for the most part, but there is a num ### Atoms -In Erlang, an `atom` is any identifier that starts with a small letter, e.g. `ok`, `tuple`, `donut`. Identifiers that start with a capital letters are always treated as variable names. Elixir, on the other hand, uses the former for naming variables, and the latter are treated as module references. Atoms in Elixir always start with a colon `:`. +In Erlang, an `atom` is any identifier that starts with a small letter, e.g. `ok`, `tuple`, `donut`. Identifiers that start with a capital letters are always treated as variable names. Elixir, on the other hand, uses the former for naming variables, and the latter are treated as atom aliases. Atoms in Elixir always start with a colon `:`. **Erlang** diff --git a/getting_started/3.markdown b/getting_started/3.markdown index 05d5e998a..5491a4018 100644 --- a/getting_started/3.markdown +++ b/getting_started/3.markdown @@ -156,12 +156,12 @@ The compiler is telling us that invoking the `join` function with two arguments In order to support software-reuse, Elixir supports three directives. As we are going to see below, they are called directives because they are the only functions in Elixir that have **lexical scope**. -### 3.4.1 refer +### 3.4.1 alias -`refer` allows you to setup references to a given module. For instance, one can do: +`alias` allows you to setup aliases for any given module name. For instance, one can do: defmodule Math do - refer MyList, as: List + alias MyList, as: List end And now, any reference to `List` will be automatically replaced by `MyList`. In case one wants to access the original `List`, it can be done by accessing the module directly via `__MAIN__`: @@ -169,19 +169,19 @@ And now, any reference to `List` will be automatically replaced by `MyList`. In List.values #=> uses MyList.values __MAIN__.List.values #=> uses List.values -Calling `refer` without an `as` option sets the reference automatically to the last part of the module name, for example: +Calling `alias` without an `as` option sets the alias automatically to the last part of the module name, for example: - refer Foo.Bar.Baz + alias Foo.Bar.Baz Is the same as: - refer Foo.Bar.Baz, as: Baz + alias Foo.Bar.Baz, as: Baz -Notice that `refer` is **lexically scoped**, which allows you to set references inside specific functions: +Notice that `alias` is **lexically scoped**, which allows you to set aliases inside specific functions: defmodule Math do def add(a, b) do - refer MyList, as: List + alias MyList, as: List # ... end @@ -190,7 +190,7 @@ Notice that `refer` is **lexically scoped**, which allows you to set references end end -In the example above, since we are invoking `refer` inside the function `add`, the reference will just be valid inside the function `add`. `minus` won't be affected at all. +In the example above, since we are invoking `alias` inside the function `add`, the alias will just be valid inside the function `add`. `minus` won't be affected at all. ### 3.4.2 require @@ -201,7 +201,7 @@ In general, a module does not need to be required before usage, except if we wan MyMacros.my_if do_something, it_works end -An attempt to call a macro that was not loaded will raise an error. Note that, as the `refer` directive, `require` is also lexically scoped. +An attempt to call a macro that was not loaded will raise an error. Note that, as the `alias` directive, `require` is also lexically scoped. ### 3.4.3 import @@ -232,7 +232,7 @@ And then we can use `only` or `except` to filter the macros being included. Fina In the example above, the imported `List.duplicate` is only visible within that specific function. `duplicate` won't be available in any other function in that module (or any other module for that matter). -Note that importing a module automatically requires it. Furthermore, `import` also accept `as:` as option which is automatically passed to `refer` in order to create a reference. +Note that importing a module automatically requires it. Furthermore, `import` also accepts `as:` as option which is automatically passed to `alias` in order to create an alias. ## 3.5 Module data @@ -294,9 +294,9 @@ In Elixir, nesting a module inside the other affects its name: end end -The example above will define two modules `Foo` and `Foo.Bar`. The second can be accessed as `Bar` inside `Foo` in the same lexical scope. If the nested module `Bar` is moved to another file, it needs to be referenced via the full name (`Foo.Bar`) or a reference need to be set using the `refer` directive discussed above. +The example above will define two modules `Foo` and `Foo.Bar`. The second can be accessed as `Bar` inside `Foo` in the same lexical scope. If the nested module `Bar` is moved to another file, it needs to be referenced via the full name (`Foo.Bar`) or an alias need to be set using the `alias` directive discussed above. -## 3.7 References +## 3.7 Aliases In Erlang (and consequently in the Erlang VM), modules and functions are represented by atoms. For instance, this is valid Erlang code: @@ -308,23 +308,23 @@ In the example above, we store the atom `lists` in the variable `Mod` and then i iex> :lists.flatten([1,[2],3]) [1,2,3] -This mechanism is exactly what empowers Elixir references. A reference in Elixir is a capitalized identifier (like `List`, `Keyword`, etc) which is converted to an atom representing a module during compilation. For instance, by default `List` translates to the atom `__MAIN__.List`: +This mechanism is exactly what empowers Elixir aliases. An alias in Elixir is a capitalized identifier (like `List`, `Keyword`, etc) which is converted to an atom representing a module during compilation. For instance, by default `List` translates to the atom `__MAIN__.List`: iex> is_atom(List) true iex> to_binary(List) "__MAIN__.List" -References are powerful when used with the `refer` directive discussed above. For instance, let's imagine that our Math module relies heavily on the `List` module. If, at some point, we find out most algorithms in `List` could be implemented in a much faster way, we could implement `FastList` and use it as a drop-in replacement: +Aliases are powerful when used with the `alias` directive discussed above. For instance, let's imagine that our `Math` module relies heavily on the `HashDict` module. If, at some point, we find out most algorithms in `HashDict` could be implemented in a much faster way, we could implement `FastHashDict` and use it as a drop-in replacement: defmodule Math do - refer FastList, as: List + alias FastHashDict, as: HashDict # ... end -Now any reference to `List` will be automatically replaced by `FastList`. In case one wants to access the original `List`, it can be done by accessing the module name via `__MAIN__`: +Now any reference to `HashDict` will be automatically replaced by `FastHashDict`. In case one wants to access the original `FastHashDict`, it can be done by accessing the module name via `__MAIN__`: - List.values #=> uses FastList.values - __MAIN__.List.values #=> uses List.values + HashDict.values #=> uses FastHashDict.values + __MAIN__.HashDict.values #=> uses HashDict.values -> Note: a reference does not actually ensure the referenced module really exists. For instance, `Foo.Bar.Baz` will return an atom regardless if a `Foo.Bar.Baz` module is defined or not. +> Note: an alias does not actually ensure the aliased module really exists. For instance, `Foo.Bar.Baz` will return an atom regardless if a `Foo.Bar.Baz` module is defined or not. diff --git a/getting_started/6.markdown b/getting_started/6.markdown index cbba085dd..826301fa6 100644 --- a/getting_started/6.markdown +++ b/getting_started/6.markdown @@ -80,18 +80,18 @@ All functions can be partially applied, except [Elixir's special forms](http://e `use` is a macro that provides a common API for module extension. For instance, in order to use the `ExUnit` test framework that ships with Elixir, you simply need to use `ExUnit.Case` in your module: defmodule AssertionTest do - use ExUnit.Case + use ExUnit.Case, sync: true def test_always_pass do true = true end end -By calling `use`, a hook called `__using__` will be invoked in `ExUnit.Case` which will then do the proper setup. In general, `use` is simply a translation to: +By calling `use`, a hook called `__using__` will be invoked in `ExUnit.Case` which will then do the proper setup. The `use` call above is simply a translation to: defmodule AssertionTest do require ExUnit.Case - ExUnit.Case.__using__(AssertionTest) + ExUnit.Case.__using__(sync: true) def test_always_pass do true = true @@ -167,9 +167,9 @@ Notice that although comprehensions uses `when` to specify filters, filters are Elixir provides a set of pseudo-variables. Those variables can only be read and never assigned to. They are: * `__MODULE__` - Returns an atom representing the current module or nil; -* `__FUNCTION__` - Returns a tuple representing the current function by name and arity or nil; -* `__LINE__` - Returns an integer representing the current line; * `__FILE__` - Returns a string representing the current file; +* `__ENV__` - Returns a [Macro.Env](http://elixir-lang.org/docs/Macro.Env.html) record with information about the compilation environment. Here we can access the current module, function, line, file and others; +* `__CALLER__` - Also returns a [Macro.Env](http://elixir-lang.org/docs/Macro.Env.html) record but with information of the calling site. `__CALLER__` is available only inside macros; * `__MAIN__` - The main namespace where modules are stored. A module `List` can also be accessed as `__MAIN__.List`; ## 6.6 Native compilation From 39778aa6b8f5b10192e0ef9e46ed8bd0e53a96cc Mon Sep 17 00:00:00 2001 From: Ricky Elrod Date: Mon, 4 Jun 2012 12:22:37 -0300 Subject: [PATCH 178/437] Elixir is now in Fedora 17 updates! --- getting_started/1.markdown | 1 + 1 file changed, 1 insertion(+) diff --git a/getting_started/1.markdown b/getting_started/1.markdown index 9130f6ab5..831e137db 100644 --- a/getting_started/1.markdown +++ b/getting_started/1.markdown @@ -29,6 +29,7 @@ After Erlang is up and running, it is time to install Elixir. You can do that vi Elixir is available in some distributions, they are: * [Homebrew for Mac OS X via this gist](https://gist.github.com/1955470) +* Fedora 17+ and Fedora Rawhide: `sudo yum -y install elixir` If you don't use any of the distributions above, don't worry! We also provide a precompiled package! From e35a4833ea5727d421916a918d710e55fc253f08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Tue, 5 Jun 2012 14:29:58 +0200 Subject: [PATCH 179/437] Rework data/attribute section --- getting_started/3.markdown | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/getting_started/3.markdown b/getting_started/3.markdown index 5491a4018..9e800d33a 100644 --- a/getting_started/3.markdown +++ b/getting_started/3.markdown @@ -234,16 +234,16 @@ In the example above, the imported `List.duplicate` is only visible within that Note that importing a module automatically requires it. Furthermore, `import` also accepts `as:` as option which is automatically passed to `alias` in order to create an alias. -## 3.5 Module data +## 3.5 Module attributes -Elixir also allows modules to store their own data. The canonical example for such data is annotating that a module implements the OTP behavior called `gen_server`: +Elixir brings the concept of module attributes from Erlang. The canonical example for attributes is annotating that a module implements the OTP behavior called `gen_server`: defmodule MyServer do @behavior :gen_server # ... callbacks ... end -Now if the module above does not implement any of the callbacks required by `gen_server`, a warning will be raised. Another data used internally by Elixir is is the `@vsn`: +Now if the module above does not implement any of the callbacks required by `:gen_server`, a warning will be raised. Another attribute used internally by Elixir is `@vsn`: defmodule MyServer do @vsn 2 @@ -251,7 +251,7 @@ Now if the module above does not implement any of the callbacks required by `gen `@vsn` refers to the version and is used by the code reloading mechanism to check if a module has been updated or not. If no version is specified, the version is set to the MD5 checksum of the module functions. -Elixir has a handful of reserved data attributes. The following are currently functional in Elixir: +Elixir has a handful of reserved attributes. The following are currently functional in Elixir: * `@behaviour` and `@behavior` - used for specifying an OTP or user-defined behavior; * `@vsn` - used for specifying the module version; @@ -268,22 +268,14 @@ The following ones are also reserved by Elixir (as they have special semantics t * `@type` - provides a type to be used in @spec; * `@export_type` - provides a type to be used in @spec that can be accessed from external specs; -Besides the built-in data attributes outlined above, any developer can also add custom data: +Besides the built-in attributes outlined above, any developer can also add custom attributes: defmodule MyServer do @my_data 13 IO.inspect @my_data #=> 13 end -After the module is compiled, the stored custom data can be accessed via `__info__(:data)` and it will return a keywords list: - - MyServer.__info__(:data) #=> [my_data: 13] - -> Note: Erlang developers may be wondering why Elixir provides its own data abstraction instead of using Erlang attributes. Erlang attributes are simple lists and therefore also allow duplicated entries. For Elixir, since the same data may be read and updated several times during compilation, it makes more sense to have a dictionary structure instead of a list. Erlang developers wishing to have the attributes functionality have two options: -> -> 1) Manually add Erlang attributes via the `Module.add_attribute(module, attribute, value)` API; -> -> 2) Register a name as an attribute via the `Module.register_attribute(module, attr)` API; For instance, `@behavior` seen above is registered as Erlang attribute, allowing it to be added more than once to the same module; +Differently from Erlang, such attributes are not stored in the module by default since it is common in Elixir to use such attributes to store temporary data. A developer can configure an attribute to behave closer to Erlang by calling [`Module.register_attribute/2`](http://elixir-lang.org/docs/Module.html#register_attribute/2). ## 3.6 Module nesting From aacb234623d87a7627256f1149a5e53af2f3f7cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Tue, 5 Jun 2012 17:29:54 +0200 Subject: [PATCH 180/437] Add a note about reading attributes inside functions --- getting_started/3.markdown | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/getting_started/3.markdown b/getting_started/3.markdown index 9e800d33a..fef15c6f9 100644 --- a/getting_started/3.markdown +++ b/getting_started/3.markdown @@ -236,7 +236,7 @@ Note that importing a module automatically requires it. Furthermore, `import` al ## 3.5 Module attributes -Elixir brings the concept of module attributes from Erlang. The canonical example for attributes is annotating that a module implements the OTP behavior called `gen_server`: +Elixir brings the concept of module attributes from Erlang with some differences. The canonical example for attributes is annotating that a module implements the OTP behavior called `gen_server`: defmodule MyServer do @behavior :gen_server @@ -277,6 +277,20 @@ Besides the built-in attributes outlined above, any developer can also add custo Differently from Erlang, such attributes are not stored in the module by default since it is common in Elixir to use such attributes to store temporary data. A developer can configure an attribute to behave closer to Erlang by calling [`Module.register_attribute/2`](http://elixir-lang.org/docs/Module.html#register_attribute/2). +Finally notice that attributes can also be read inside functions: + + defmodule MyServer do + @my_data 11 + def first_data, do: @my_data + @my_data 13 + def second_data, do: @my_data + end + + MyServer.first_data #=> 11 + MyServer.second_data #=> 13 + +It is important to note that reading an attribute takes a snapshot of its current value. In other words, the value is read at compilation time and not at runtime. Check [the documentation for the module `Module` documentation](http://elixir-lang.org/docs/Module.html) for other functions to manipulate module attributes. + ## 3.6 Module nesting In Elixir, nesting a module inside the other affects its name: From b43a92897e38bc6dcfcc2e131d28401336d0b81a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Wed, 6 Jun 2012 12:30:48 +0200 Subject: [PATCH 181/437] Update information about comprehensions --- getting_started/6.markdown | 38 ++++++++++---------------------------- 1 file changed, 10 insertions(+), 28 deletions(-) diff --git a/getting_started/6.markdown b/getting_started/6.markdown index 826301fa6..cb34ff6c9 100644 --- a/getting_started/6.markdown +++ b/getting_started/6.markdown @@ -104,64 +104,46 @@ In general, we recommend APIs to expose a `__using__` hook in case they want to Elixir also provides list and bit comprehensions. List comprehensions allow you to quickly build a list from another list: - iex> lc n in [1,2,3,4], do: n * 2 + iex> lc n inlist [1,2,3,4], do: n * 2 [2,4,6,8] Or, using keywords blocks: - lc n in [1,2,3,4] do + lc n inlist [1,2,3,4] do n * 2 end -A comprehension accepts many generators and also filters. Filters must be given after the when clause: +A comprehension accepts many generators (given by `inlist` or `inbits` operators) and also filters: # A comprehension with a generator and a filter - iex> lc n in [1,2,3,4,5,6] when rem(n, 2) == 0, do: n + iex> lc n inlist [1,2,3,4,5,6], rem(n, 2) == 0, do: n [2,4,6] # A comprehension with two generators - iex> lc x in [1,2], y in [2,3], do: x*y + iex> lc x inlist [1,2], y inlist [2,3], do: x*y [2,3,4,6] Elixir provides generators for both lists and bitstrings: # A list generator: - iex> lc n in [1,2,3,4], do: n * 2 + iex> lc n inlist [1,2,3,4], do: n * 2 [2,4,6,8] # A bit string generator: - iex> lc <> in <<1,2,3,4>>, do: n * 2 + iex> lc <> inbits <<1,2,3,4>>, do: n * 2 [2,4,6,8] -Bit string generators are quite useful when you need to organize bit string streams: +Bit string generators are quite useful when you need to organize streams: iex> pixels = <<213,45,132,64,76,32,76,0,0,234,32,15>> - iex> lc <> in pixels, do: {r,g,b} + iex> lc <> inbits pixels, do: {r,g,b} [{213,45,132},{64,76,32},{76,0,0},{234,32,15}] Remember, as strings are binaries and a binary is a bitstring, we can also use strings in comprehensions. For instance, the example below removes all white space characters from a string via bit comprehensions: - iex> bc <> in " hello world " when c != ?\s, do: <> + iex> bc <> inbits " hello world ", c != ?\s, do: <> "helloworld" -Elixir does its best to hide the differences between list and bit string generators. However, there is a special case due to Erlang limitation where we need to explicitly tell Erlang that a list is being given as argument: - - # This will fail because when Elixir sees that the left side - # of the in expression is a bit string, it expects the right side - # to be a bit string as well: - iex> lc <> in [<<1>>,<<2>>,<<3>>], do: n*2 - ** (ErlangError) erlang error {:bad_generator,[<<1>>,<<2>>,<<3>>]} - - # You need to be explicit and use inlist: - iex> lc inlist(<>, [<<1>>,<<2>>,<<3>>]), do: n*2 - [2,4,6] - - # For consistency, inbin is also available: - iex> lc inbin(<>, <<1,2,3>>), do: n*2 - [2,4,6] - -Notice that although comprehensions uses `when` to specify filters, filters are not guards and therefore accept any expression (they are not limited as guards). - ## 6.5 Pseudo variables Elixir provides a set of pseudo-variables. Those variables can only be read and never assigned to. They are: From c7cc04b69d5c634f9a054073433caf1a8d2281a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Thu, 7 Jun 2012 09:02:20 +0200 Subject: [PATCH 182/437] No need to quote --- getting_started/5.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/getting_started/5.markdown b/getting_started/5.markdown index 2df2f801f..cfe573c30 100644 --- a/getting_started/5.markdown +++ b/getting_started/5.markdown @@ -30,12 +30,12 @@ You can get the representation of any expression by using the quote macro: Everything in Elixir is a function call and can be represented by such tuples. For example, operators are represented as such: iex> quote do: 1 + 2 - { :"+", 0, [1, 2] } + { :+, 0, [1, 2] } Even a tuple is represented as a call to `{}`: iex> quote do: { 1, 2, 3 } - { :"{}", 0, [1, 2, 3] } + { :{}, 0, [1, 2, 3] } The only exception to this rule are the five Elixir literals below. Literals are data types that when quoted return themselves. They are: From 4b60b168599e0ad9891493b0bd6a888077b74ddf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Fri, 8 Jun 2012 17:54:58 +0300 Subject: [PATCH 183/437] Update next --- getting_started/1.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/getting_started/1.markdown b/getting_started/1.markdown index 831e137db..5c878764c 100644 --- a/getting_started/1.markdown +++ b/getting_started/1.markdown @@ -35,7 +35,7 @@ If you don't use any of the distributions above, don't worry! We also provide a ### 1.1.2 Precompiled package -Elixir provides a package file with its compiled source for every release. You can grab the latest [in the downloads page](https://github.com/elixir-lang/elixir/downloads). +Elixir provides a package file with its compiled source for every release. You can grab the latest [in the downloads page](https://github.com/elixir-lang/elixir/downloads) (make sure to download one of the versioned packages under the "Download packages" section and not the "Download as zip/tar.gz" buttons which will rather download Elixir's master). After unzip-ing the package, you are ready to run the `elixir` and `iex` commands from the `bin` directory. It is recommended that you also add Elixir's bin path to your PATH environment variable to ease development. In a UNIX system, that can be achieved with: From 7f8c8d628138989394a658025f8c113f176f7c20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sat, 9 Jun 2012 19:34:46 +0200 Subject: [PATCH 184/437] Add a section about heredocs and sigils --- getting_started/6.markdown | 63 ++++++++++++++++++++++++++++++++------ getting_started/7.markdown | 2 +- 2 files changed, 54 insertions(+), 11 deletions(-) diff --git a/getting_started/6.markdown b/getting_started/6.markdown index cb34ff6c9..283e52217 100644 --- a/getting_started/6.markdown +++ b/getting_started/6.markdown @@ -6,9 +6,52 @@ guide: 6 # 6 Other topics -## 6.1 Documentation +## 6.1 String sigils -Elixir uses the module data described in chapter 3 to drive its documentation system. For instance, consider the following example: +Elixir provides string sigils via the token `%`: + + %b(Binary with escaping an interpolation) + %B(Binary without escaping \n and without #{interpolation}) + +Sigils starting with uppercase letter never escaper characters nor interpret interpolations. Notice the separators are not necessarily parenthesis, but any non-alphanumeric character: + + %b-another binary- + +Internally, `%b` is translated as a function call to `__b__`. For instance, the docs for `%b` are available [in the function `__b__/1` defined in Elixir.Builtin module](http://elixir-lang.org/docs/Elixir.Builtin.html#__b__/1). + +The sigils defined in Elixir by default are: + +* `%b` and `%B` - Returns a binary; +* `%c` and `%C` - Returns a char list; +* `%r` and `%R` - Returns a regular expression; + +## 6.2 Heredocs + +Elixir supports heredocs as a way to define long strings. Heredocs are delimited by triple double-quotes for binaries or triple single-quotes for char lists: + + """ + Binary heredoc + """ + + ''' + Charlist heredoc + ''' + +The heredoc ending must be in a line on its own, otherwise it is part of the heredoc: + + """ + Binary heredocs in Elixir use """ + """ + +Notice the sigils discussed in the previous section are also available as heredocs: + + %B""" + A heredoc without escaping or interpolation + """ + +## 6.3 Documentation + +Elixir uses module attributes described in chapter 3 to drive its documentation system. For instance, consider the following example: defmodule MyModule do @moduledoc "It does X" @@ -50,9 +93,9 @@ In case `--docs` was not provided during compilation, both calls would return ni """ def add_doc(module, line, kind, tuple, doc) -In the example, we use heredocs to allow the documentation to span over several lines and markdown to style the documentation. +In the example, we use heredocs to allow the documentation to span over several lines and use markdown to style the documentation. -## 6.2 Partial application +## 6.4 Partial application Elixir also supports partial application. Let's suppose we have a list of strings and we want to calculate the size for each of them. We could do it in the following way: @@ -75,9 +118,9 @@ Since operators are also function calls they can also be partially applied: All functions can be partially applied, except [Elixir's special forms](http://elixir-lang.org/docs/latest/Elixir.SpecialForms.html). -## 6.3 Use +## 6.5 Use -`use` is a macro that provides a common API for module extension. For instance, in order to use the `ExUnit` test framework that ships with Elixir, you simply need to use `ExUnit.Case` in your module: +`use` is a macro that provides a common API for extension. For instance, in order to use the `ExUnit` test framework that ships with Elixir, you simply need to use `ExUnit.Case` in your module: defmodule AssertionTest do use ExUnit.Case, sync: true @@ -98,9 +141,9 @@ By calling `use`, a hook called `__using__` will be invoked in `ExUnit.Case` whi end end -In general, we recommend APIs to expose a `__using__` hook in case they want to expose functionality to developers. +In general, we recommend APIs to provide a `__using__` hook in case they want to expose functionality to developers. -## 6.4 Comprehensions +## 6.6 Comprehensions Elixir also provides list and bit comprehensions. List comprehensions allow you to quickly build a list from another list: @@ -144,7 +187,7 @@ Remember, as strings are binaries and a binary is a bitstring, we can also use s iex> bc <> inbits " hello world ", c != ?\s, do: <> "helloworld" -## 6.5 Pseudo variables +## 6.7 Pseudo variables Elixir provides a set of pseudo-variables. Those variables can only be read and never assigned to. They are: @@ -154,7 +197,7 @@ Elixir provides a set of pseudo-variables. Those variables can only be read and * `__CALLER__` - Also returns a [Macro.Env](http://elixir-lang.org/docs/Macro.Env.html) record but with information of the calling site. `__CALLER__` is available only inside macros; * `__MAIN__` - The main namespace where modules are stored. A module `List` can also be accessed as `__MAIN__.List`; -## 6.6 Native compilation +## 6.8 Native compilation Elixir can compile to native code using the Hipe compiler. All you need to do is export the following environment variable before running your code: diff --git a/getting_started/7.markdown b/getting_started/7.markdown index fc50c9805..e3fbb3a94 100644 --- a/getting_started/7.markdown +++ b/getting_started/7.markdown @@ -18,7 +18,7 @@ Elixir has more features to offer than what has been described so far, but you s ## 7.2 A Byte of Erlang -As the main page of this site puts it, +As the main page of this site puts it: > Elixir is a programming language built on top of the Erlang VM. From c90f7025330fa824c0d0df78178823b9e1f000e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Mon, 11 Jun 2012 12:44:16 +0200 Subject: [PATCH 185/437] Update attributes lists and docs --- getting_started/3.markdown | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/getting_started/3.markdown b/getting_started/3.markdown index fef15c6f9..c7aea5274 100644 --- a/getting_started/3.markdown +++ b/getting_started/3.markdown @@ -259,14 +259,17 @@ Elixir has a handful of reserved attributes. The following are currently functio * `@moduledoc` - provides documentation for the current module; * `@doc` - provides documentation for the function that follows it; * `@file` - changes the filename that the next defined function will appear in stacktraces; -* `@on_load` - provides a function, with arity 0, that will be invoked whenever the module is loaded. The function has to return `:ok`, otherwise the loading of the module is aborted; +* `@on_load` - expects a function name that will be invoked whenever the module is loaded. The function must have arity 0 and has to return `:ok`, otherwise the loading of the module is aborted; +* `@before_compile` - expects a `{ module, function }` that will be invoked with the module name before the module is compiled. The function may be a macro, allowing you to inject functions inside the module exactly before compilation; +* `@after_compile` - expects a `{ module, function }` that will be invoked with the module name and its object code right after the module is compiled and loaded; -The following ones are also reserved by Elixir (as they have special semantics to the Erlang VM) but not currently supported (if you need support for any of these in your current projects, please open a ticket on the issue tracker): +The following attributes are part of [typespecs](http://www.erlang.org/doc/reference_manual/typespec.html) and are also supported by Elixir: -* `@spec` - provides a specification for the function following it; +* `@spec` - provides a specification for a function; * `@callback` - provides a specification for the behavior callback; -* `@type` - provides a type to be used in @spec; -* `@export_type` - provides a type to be used in @spec that can be accessed from external specs; +* `@type` - defines a type to be used in @spec; +* `@export_type` - informs which types can be exported; +* `@opaque` - defines an opaque type to be used in @spec; Besides the built-in attributes outlined above, any developer can also add custom attributes: From 57bc4fdc63bafda8f4770066cf897f37ebb628f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Mon, 18 Jun 2012 12:36:33 +0200 Subject: [PATCH 186/437] Update note about __MAIN__-List --- crash-course.markdown | 39 ++++++++++++++++++-------------------- getting_started/3.markdown | 6 ++++-- 2 files changed, 22 insertions(+), 23 deletions(-) diff --git a/crash-course.markdown b/crash-course.markdown index c6d8b6ea5..2d70f60b1 100644 --- a/crash-course.markdown +++ b/crash-course.markdown @@ -702,28 +702,9 @@ end ## A Few Notes On Interoperability -Elixir compiles directly into BEAM byte code. This means that Elixir code can be called from Erlang and vice versa, without the need to write any bindings. What follows is a number of observations with regard to the syntax in both cases. +Elixir compiles directly into BEAM byte code. This means that Elixir code can be called from Erlang and vice versa, without the need to write any bindings. In order to avoid conflicts with Erlang, Elixir modules are prefixed by the word `__MAIN__` and separated using `-` instead of `.`. -**Erlang** - -{% highlight erlang %} -% Suppose we have compiled the module written in Elixir below. - -% Elixir modules live in the __MAIN__ namespace. We can save typing -% by assigning the module name to a variable or defining a macro. --module(erlang_contrived). --export([prettify/1]). --define(ExContrived, __MAIN__.Contrived). - -pretiffy(bin) -> - ?ExContrived:pretty_binary(bin). - -uglify(bin) -> - Contrived = '__MAIN__.Contrived', - Contrived:ugly_binary(bin). -{% endhighlight %} - -**Elixir** +Consider the following module in Elixir: {% highlight ruby %} defmodule Contrived do @@ -737,6 +718,22 @@ defmodule Contrived do end {% endhighlight %} +It can be called from Erlang as follow: + +{% highlight erlang %} +-module(erlang_contrived). +-compile(export_all). + +uglify(bin) -> + '__MAIN__-Contrived':ugly_binary(bin). + +-define(Contrived, '__MAIN__-Contrived'). + +%% Wrapping the module name in a macro is often convenient +pretiffy(bin) -> + ?Contrived:pretty_binary(bin). +{% endhighlight %} + An example of calling Erlang code from Elixir is shown in the Notable Differences section above. ## Further Reading diff --git a/getting_started/3.markdown b/getting_started/3.markdown index c7aea5274..8511d435d 100644 --- a/getting_started/3.markdown +++ b/getting_started/3.markdown @@ -317,12 +317,12 @@ In the example above, we store the atom `lists` in the variable `Mod` and then i iex> :lists.flatten([1,[2],3]) [1,2,3] -This mechanism is exactly what empowers Elixir aliases. An alias in Elixir is a capitalized identifier (like `List`, `Keyword`, etc) which is converted to an atom representing a module during compilation. For instance, by default `List` translates to the atom `__MAIN__.List`: +This mechanism is exactly what empowers Elixir aliases. An alias in Elixir is a capitalized identifier (like `List`, `Keyword`, etc) which is converted to an atom representing a module during compilation. For instance, by default `List` translates to the atom `__MAIN__-List`: iex> is_atom(List) true iex> to_binary(List) - "__MAIN__.List" + "__MAIN__-List" Aliases are powerful when used with the `alias` directive discussed above. For instance, let's imagine that our `Math` module relies heavily on the `HashDict` module. If, at some point, we find out most algorithms in `HashDict` could be implemented in a much faster way, we could implement `FastHashDict` and use it as a drop-in replacement: @@ -337,3 +337,5 @@ Now any reference to `HashDict` will be automatically replaced by `FastHashDict` __MAIN__.HashDict.values #=> uses HashDict.values > Note: an alias does not actually ensure the aliased module really exists. For instance, `Foo.Bar.Baz` will return an atom regardless if a `Foo.Bar.Baz` module is defined or not. + +> Note: preferably, the alias List would be convert to the atom `__MAIN__.List` instead of `__MAIN__-List`, however there is currently a limitation in Erlang that does not allow us to use such atoms. \ No newline at end of file From 86f2d0f19397b06d38d5375b8aa7e40e3b95e091 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Tue, 3 Jul 2012 00:54:11 +0300 Subject: [PATCH 187/437] Update next --- _includes/top.html | 3 --- 1 file changed, 3 deletions(-) diff --git a/_includes/top.html b/_includes/top.html index 4ccc3ddca..5572be7cf 100644 --- a/_includes/top.html +++ b/_includes/top.html @@ -48,9 +48,6 @@

        -
        From e9b4bae9e20566e05070256bd3214466b9174586 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Tue, 10 Jul 2012 15:56:46 +0200 Subject: [PATCH 188/437] Get rid of loop in chapter 2, add a recursion section --- getting_started/2.markdown | 35 ++--------------- getting_started/3.markdown | 80 ++++++++++++++++++++++++++------------ 2 files changed, 58 insertions(+), 57 deletions(-) diff --git a/getting_started/2.markdown b/getting_started/2.markdown index 038b5a714..e6ea6ea30 100644 --- a/getting_started/2.markdown +++ b/getting_started/2.markdown @@ -459,36 +459,7 @@ As Elixir is an immutable language, the binding of the function is also immutabl (fn -> x = 2 end).() x #=> 1 -### 2.7.6 Loops - -Due to data structure immutability, loops in Elixir (and in functional programming languages) are written differently from conventional imperative languages. For example, in an imperative language, one would write: - - for(i = 0; i < array.length; i++) { - array[i] = array[i] * 2 - } - -In the example above, we are mutating the array which is not possible in Elixir. Therefore, in functional languages recursion happens by calling an anonymous or a named function recursively, until we reach a condition. Consider the example below that manually sums all the items in the list: - - iex> loop [1,2,3], 0 do - ...> [h|t], acc -> - ...> recur(t, h + acc) - ...> [], acc -> - ...> acc - ...> end - 6 - -In the example above, we pass a list `[1,2,3]` and the initial value `0` as arguments to loop. The list `[1,2,3]` is then matched against `[h|t]` which assigns `h = 1` and `t = [2,3]` and 0 is assigned to `acc`. - -Then, we add the head of the list to the accumulator `h + acc` and call the loop again using the `recur` function, passing the tail of the list as argument. The tail will once again match the `[h|t]` until the list is empty, matching the final clause which returns the final result of `6`. In other words, the loop is called 4 times until the list is empty and the recursion stops: - - loop [1,2,3], 0 - loop [2,3], 1 - loop [3], 3 - loop [], 6 - -> Note: `loop/recur` is also a Clojure idiom, although differently from Clojure, `recur` in Elixir does not ensure a tail call was made. - -### 2.7.7 Try +### 2.7.6 Try The next control-flow mechanism is `try/catch/after`: @@ -535,7 +506,7 @@ The common strategy then is to make explicit all arguments that are required aft x #=> returns the value of x or nil for failures -### 2.7.8 Rescue +### 2.7.7 Rescue For catching exceptions in Elixir, we can use `rescue` instead of `catch`. Besides allowing the same pattern matching rules as `catch`, `rescue` also allows a developer to easily rescue an exception by its name and not by its internal contents. Consider the following examples: @@ -571,7 +542,7 @@ For catching exceptions in Elixir, we can use `rescue` instead of `catch`. Besid Custom exceptions can be defined using the `defexception` macro. You can check a list of defined exceptions in [our documentations page](http://elixir-lang.org/docs/latest/), by clicking "Records" in the upper left corner. -### 2.7.9 Receive +### 2.7.8 Receive The last control-flow mechanism we are going to discuss is essential to Elixir's and Erlang's actor mechanism. In Elixir, the code is run in separate processes that exchange messages between them. Those processes are not Operating System processes (they are actually quite light-weight) but are called so since they do not share state with each other. diff --git a/getting_started/3.markdown b/getting_started/3.markdown index 8511d435d..7b2c84668 100644 --- a/getting_started/3.markdown +++ b/getting_started/3.markdown @@ -90,7 +90,7 @@ Inside a module, we can define functions with `def` and private functions with ` Math.sum(1, 2) #=> 3 Math.do_sum(1, 2) #=> ** (UndefinedFunctionError) -Function declarations also support guards and multiple clauses. If a function has several clauses, Elixir will try each clause until it finds one that matches. For example, here is the implementation for a function that checks if the given number is zero or not: +Function declarations also support guards and multiple clauses. If a function has several clauses, Elixir will try each clause until it finds one that matches. Here is the implementation of a function that checks if the given number is zero or not: defmodule Math do def zero?(0) do @@ -108,7 +108,7 @@ Function declarations also support guards and multiple clauses. If a function ha Math.zero?([1,2,3]) #=> ** (FunctionClauseError) -Notice that giving an argument that does not match any of the clauses raises an error. +Giving an argument that does not match any of the clauses raises an error. Named functions also support default arguments: @@ -151,12 +151,48 @@ The compiler is telling us that invoking the `join` function with two arguments ***Second join 'Hello world' +### 3.4 Recursion -## 3.4 Directives +Due to data structure immutability, loops in Elixir (and in functional programming languages) are written differently from conventional imperative languages. For example, in an imperative language, one would write: -In order to support software-reuse, Elixir supports three directives. As we are going to see below, they are called directives because they are the only functions in Elixir that have **lexical scope**. + for(i = 0; i < array.length; i++) { + array[i] = array[i] * 2 + } -### 3.4.1 alias +In the example above, we are mutating the array which is not possible here. Therefore, in functional languages recursion happens by calling a function recursively until we reach a condition. Consider the example below that manually sums all the items in the list: + + defmodule Math do + def sum_list([h|t], acc) do + sum_list(t, h + acc) + end + + def sum_list([], acc) do + acc + end + end + + Math.sum_list([1,2,3], 0) #=> 6 + +In the example above, we invoke `sum_list` giving a list `[1,2,3]` and the initial value `0` as arguments. As we saw in the previous section, when a function has many clauses, we will try each clause until find one that matches according to the pattern matching rules. In this case, the list `[1,2,3]` matches against `[h|t]` which assigns `h = 1` and `t = [2,3]` while `acc` is set to 0. + +Then, we add the head of the list to the accumulator `h + acc` and call `sum_list` again, recursively, passing the tail of the list as argument. The tail will once again match `[h|t]` until the list is empty, as seen below: + + sum_list [1,2,3], 0 + sum_list [2,3], 1 + sum_list [3], 3 + sum_list [], 6 + +When the list is empty, it will match the final clause which returns the final result of `6`. In imperative languages, such implementation would usually fail for large lists because the stacktrace (a stack which keeps our execution path) would grown until it reaches a limit. Erlang however does last call optimization in which the stack does not grow when a function exits by calling another function. + +Recursion and last call optimization are an important part of Erlang and are commonly used to create loops, specially in cases where a process needs to wait and respond to messages (using the `receive` macro we saw in the previous chapter). However, recursion as above is rarely used to manipulate lists, since [the `Enum` module](http://elixir-lang.org/docs/latest/Enum.html) already abstracts such use cases. For instance, the example above could be simply written as: + + Enum.reduce([1,2,3], 0, fn(x, acc) -> x + acc end) + +## 3.5 Directives + +In order to facilitate software-reuse, Elixir supports three directives. As we are going to see below, they are called directives because they are the only functions in Elixir that have **lexical scope**. + +### 3.5.1 alias `alias` allows you to setup aliases for any given module name. For instance, one can do: @@ -192,7 +228,7 @@ Notice that `alias` is **lexically scoped**, which allows you to set aliases ins In the example above, since we are invoking `alias` inside the function `add`, the alias will just be valid inside the function `add`. `minus` won't be affected at all. -### 3.4.2 require +### 3.5.2 require In general, a module does not need to be required before usage, except if we want to use the macros available in that module. For instance, suppose we created our own `my_if` implementation in a module named `MyMacros`. If we want to invoke it, we need to first explicitly require `MyMacros`: @@ -203,7 +239,7 @@ In general, a module does not need to be required before usage, except if we wan An attempt to call a macro that was not loaded will raise an error. Note that, as the `alias` directive, `require` is also lexically scoped. -### 3.4.3 import +### 3.5.3 import We use `import` whenever we want to easily access functions or macros from others modules without using the qualified name. For instance, if we want to use the `duplicate` function from `List` several times in a module and we don't want to always type `List.duplicate`, we can simply import it: @@ -234,22 +270,22 @@ In the example above, the imported `List.duplicate` is only visible within that Note that importing a module automatically requires it. Furthermore, `import` also accepts `as:` as option which is automatically passed to `alias` in order to create an alias. -## 3.5 Module attributes +## 3.6 Module attributes -Elixir brings the concept of module attributes from Erlang with some differences. The canonical example for attributes is annotating that a module implements the OTP behavior called `gen_server`: +Elixir brings the concept of module attributes from Erlang with some differences. The canonical example for attributes is annotating that a module implements an OTP behavior, for example `gen_server`: defmodule MyServer do @behavior :gen_server # ... callbacks ... end -Now if the module above does not implement any of the callbacks required by `:gen_server`, a warning will be raised. Another attribute used internally by Elixir is `@vsn`: +Now if the module above does not implement any of the callbacks required by the `:gen_server` behavior, a warning will be raised. Another attribute used internally by Elixir is `@vsn`: defmodule MyServer do @vsn 2 end -`@vsn` refers to the version and is used by the code reloading mechanism to check if a module has been updated or not. If no version is specified, the version is set to the MD5 checksum of the module functions. +`@vsn` refers to the module version and is used by the code reloading mechanism to check if a module has been updated or not. If no version is specified, the version is set to the MD5 checksum of the module functions. Elixir has a handful of reserved attributes. The following are currently functional in Elixir: @@ -278,7 +314,7 @@ Besides the built-in attributes outlined above, any developer can also add custo IO.inspect @my_data #=> 13 end -Differently from Erlang, such attributes are not stored in the module by default since it is common in Elixir to use such attributes to store temporary data. A developer can configure an attribute to behave closer to Erlang by calling [`Module.register_attribute/2`](http://elixir-lang.org/docs/Module.html#register_attribute/2). +Differently from Erlang, user defined attributes are not stored in the module by default since it is common in Elixir to use such attributes to store temporary data. A developer can configure an attribute to behave closer to Erlang by calling [`Module.register_attribute/2`](http://elixir-lang.org/docs/Module.html#register_attribute/2). Finally notice that attributes can also be read inside functions: @@ -292,18 +328,18 @@ Finally notice that attributes can also be read inside functions: MyServer.first_data #=> 11 MyServer.second_data #=> 13 -It is important to note that reading an attribute takes a snapshot of its current value. In other words, the value is read at compilation time and not at runtime. Check [the documentation for the module `Module` documentation](http://elixir-lang.org/docs/Module.html) for other functions to manipulate module attributes. +From the example above we can notice that reading an attribute inside a function takes a snapshot of its current value. In other words, the value is read at compilation time and not at runtime. Check [the documentation for the module `Module` documentation](http://elixir-lang.org/docs/Module.html) for other functions to manipulate module attributes. -## 3.6 Module nesting +## 3.7 Nesting -In Elixir, nesting a module inside the other affects its name: +Modules in Elixir can be nested too: defmodule Foo do defmodule Bar do end end -The example above will define two modules `Foo` and `Foo.Bar`. The second can be accessed as `Bar` inside `Foo` in the same lexical scope. If the nested module `Bar` is moved to another file, it needs to be referenced via the full name (`Foo.Bar`) or an alias need to be set using the `alias` directive discussed above. +The example above will define two modules `Foo` and `Foo.Bar`. The second can be accessed as `Bar` inside `Foo` as long as they are in the same scope. If later the developer decides to move `Bar` to another file, it needs to be referenced by its full name (`Foo.Bar`) or an alias need to be set using the `alias` directive discussed above. ## 3.7 Aliases @@ -324,17 +360,11 @@ This mechanism is exactly what empowers Elixir aliases. An alias in Elixir is a iex> to_binary(List) "__MAIN__-List" -Aliases are powerful when used with the `alias` directive discussed above. For instance, let's imagine that our `Math` module relies heavily on the `HashDict` module. If, at some point, we find out most algorithms in `HashDict` could be implemented in a much faster way, we could implement `FastHashDict` and use it as a drop-in replacement: - - defmodule Math do - alias FastHashDict, as: HashDict - # ... - end +Given a scope, aliases can also be set using the `alias` directive discussed above. For instance, it is particularly useful when interacting with Erlang code: -Now any reference to `HashDict` will be automatically replaced by `FastHashDict`. In case one wants to access the original `FastHashDict`, it can be done by accessing the module name via `__MAIN__`: + alias Erlang.application, as: Application - HashDict.values #=> uses FastHashDict.values - __MAIN__.HashDict.values #=> uses HashDict.values +This allows you to write code transparently without using the Erlang notation to access the `application` module. > Note: an alias does not actually ensure the aliased module really exists. For instance, `Foo.Bar.Baz` will return an atom regardless if a `Foo.Bar.Baz` module is defined or not. From 733d858d52d7430238e86d084c076b126a686676 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Thu, 12 Jul 2012 12:16:52 +0200 Subject: [PATCH 189/437] Improvements to the crash course interop section --- crash-course.markdown | 153 +++++++++++++++++++++++++++++------------- index.html | 2 +- 2 files changed, 108 insertions(+), 47 deletions(-) diff --git a/crash-course.markdown b/crash-course.markdown index 2d70f60b1..182d94316 100644 --- a/crash-course.markdown +++ b/crash-course.markdown @@ -5,9 +5,24 @@ layout: default # Erlang/Elixir Syntax: A Crash Course -This is a quick introduction to the Elixir syntax for Erlang developers and vice-versa. It is the absolute minimum amount of knowledge you need in order to understand Elixir/Erlang code, read the docs, sample code, etc. +This is a quick introduction to the Elixir syntax for Erlang developers and vice-versa. It is the absolute minimum amount of knowledge you need in order to understand Elixir/Erlang code, support interoperability, read the docs, sample code, etc. -## Running Erlang code +This page is divided into sections: + +1. [Running Code](#running_code) +2. [Notable Differences](#notable_differences) +3. [Data Types](#data_types) +4. [Modules](#modules) +5. [Function Syntax](#function_syntax) +6. [Control Flow](#control_flow) +7. [Adding Elixir to existing Erlang programs](#interop) +8. [Further reading](#further_reading) + +
        + +## 1 Running Code + +### Erlang The fastest way to run some code is to launch the Erlang shell -- `erl`. Many code snippets on this page can be pasted directly into the shell. However, when you want to define a named function, Erlang expects it to be inside of a module, and modules have to be compiled. Here's a skeleton for a module: @@ -32,7 +47,7 @@ ok You may keep the shell running while you're editing the file. Just don't forget to execute `c(module_name)` to load the latest changes. Note that the filename has to be the same as the one declared in the `-module()` directive, plus an extension `.erl`. -## Running Elixir code +### Elixir Elixir too has an interactive shell called `iex`. Compiling Elixir code can be done with `elixirc` (which is similar to Erlang's `erlc`). Elixir also provides an executable named `elixir` to run Elixir code. The module defined above can be written in Elixir as: @@ -56,7 +71,9 @@ Hello world! :ok {% endhighlight %} -## Notable differences +
        + +## 2 Notable Differences This section goes over some of the syntactic differences between the two languages. @@ -74,7 +91,7 @@ Some operators are spelled differently. | =/= | !== | A negative match | | /= | != | Not equals | | =< | <= | Less than or equals | - | ! | <- | Send. See section _Processes_ below | + | ! | <- | Send messages | ### Delimiters @@ -165,7 +182,9 @@ Erlang.lists.sort [3, 2, 1] All of the Erlang's modules can be accessed in this manner. All of the Erlang built-ins reside in the `Erlang.erlang` (or `:erlang`) module. -## Data Types +
        + +## 3 Data Types Erlang and Elixir have the same data types for the most part, but there is a number of differences. @@ -192,7 +211,7 @@ X = 10. im_a_var x = 10 -Module # this is called an atom alias; it expands to :'__MAIN__.Module' +Module # this is called an atom alias; it expands to :'__MAIN__-Module' {% endhighlight %} It is also possible to create atoms that start with a character other than a lowercase letter. The syntax is different between the two languages: @@ -214,7 +233,7 @@ is_atom :'ok' #=> true is_atom :"Multiple words" #=> true {% endhighlight %} -### Binaries +### Lists and Binaries Elixir has a shortcut syntax for binaries. @@ -236,7 +255,7 @@ is_binary <<"Hello">> #=> true ### Orddicts -Orddicts in Erlang are created using either `orddict:new/0` or `orddict:from_list/1`. Elixir has a special syntax for this purpose: +Orddicts in Erlang are created using either `orddict:new/0` or `orddict:from_list/1` while Elixir offers a literal syntax: **Erlang** @@ -264,7 +283,9 @@ The syntax for records differs significantly between Erlang and Elixir. Please r [1]: http://learnyousomeerlang.com/a-short-visit-to-common-data-structures#records [2]: http://elixir-lang.org/getting_started/4.html -## Modules +
        + +## 4 Modules Each Erlang module lives in its own file which has the following structure: @@ -280,7 +301,7 @@ fun() -> fun(list) when is_list(list) -> io:format('~s~n', list). -% A private function +% Non-exported functions are private priv() -> secret_info. {% endhighlight %} @@ -346,7 +367,9 @@ HelloModule.State.new #=> { HelloModule.State, [:sally] } {% endhighlight %} -## Function Syntax +
        + +## 5 Function Syntax [This chapter][3] from the Erlang book provides a detailed description of pattern matching and function syntax in Erlang. Here, I'm briefly covering the main points and provide sample code both in Erlang and Elixir. @@ -382,11 +405,11 @@ end When defining a function with the same name multiple times, each such definition is called a **clause**. In Erlang, clauses always go side by side, separated by a semi-colon ``;``, the last clause is terminated by a dot ``.``. -Elixir doesn't require punctuation to separate clause, each one looks like a standalone definition in Elixir. +Elixir doesn't require punctuation to separate clause, although the must be grouped together. ### Function Overloading -Functions in Erlang and Elixir can be overloaded based on arity and guard expressions. +In both Erlang and Elixir, a function is not identified only by its name, but by its name and arity. In both examples above, we are defining four different functions (all named `sum`, but with different arity): **Erlang** @@ -575,10 +598,36 @@ Enum.map [1, 2, 3], square &1 #=> [1, 4, 9] {% endhighlight %} -## Control Flow +
        + +## 6 Control Flow The constructs `if` and `case` are actually expressions in both Erlang and Elixir, but may be used for control flow like in imperative languages. +### Case + +The ``case`` construct provides control flow based purely on pattern matching. + +**Erlang** + +{% highlight erlang %} +case { X, Y } of +{ a, b } -> ok; +{ b, c } -> good; +Else -> Else +end +{% endhighlight %} + +**Elixir** + +{% highlight ruby %} +case { x, y } do + { :a, :b } -> :ok + { :b, :c } -> :good + other -> other +end +{% endhighlight %} + ### If **Erlang** @@ -632,6 +681,12 @@ test_fun.(10) #=> :exactly_ten {% endhighlight %} +There are two important differences between Elixir's `cond` and Erlang's `if`: + +1) `cond` allows any expression on the left side while Erlang allow only the subset valid in guard clauses; + +2) `cond` uses Elixir's concepts of truthy and falsy values (everything is truthy except `nil` and `false`), Erlang's `if` expects strictly a boolean; + Elixir also provides a `if` function that resembles more imperative languages and is useful when you need to check if one clause is true or false: {% highlight ruby %} @@ -642,30 +697,6 @@ else end {% endhighlight %} -### Case - -The ``case`` construct provides control flow based purely on pattern matching. - -**Erlang** - -{% highlight erlang %} -case { X, Y } of -{ a, b } -> ok; -{ b, c } -> good; -Else -> Else -end -{% endhighlight %} - -**Elixir** - -{% highlight ruby %} -case { x, y } do - { :a, :b } -> :ok - { :b, :c } -> :good - other -> other -end -{% endhighlight %} - ### Sending and Receiving Messages The syntax for sending and receiving differs only slightly between Erlang and Elixir. @@ -700,9 +731,13 @@ after end {% endhighlight %} -## A Few Notes On Interoperability +
        + +## 7 Adding Elixir to existing Erlang programs + +### Parse transform -Elixir compiles directly into BEAM byte code. This means that Elixir code can be called from Erlang and vice versa, without the need to write any bindings. In order to avoid conflicts with Erlang, Elixir modules are prefixed by the word `__MAIN__` and separated using `-` instead of `.`. +Elixir compiles directly into BEAM byte code. This means that Elixir code can be called from Erlang and vice versa, without the need to write any bindings. In order to avoid conflicts with Erlang, Elixir modules are prefixed by the word `__MAIN__` and separated using `-`: Consider the following module in Elixir: @@ -726,17 +761,43 @@ It can be called from Erlang as follow: uglify(bin) -> '__MAIN__-Contrived':ugly_binary(bin). +{% endhighlight %} --define(Contrived, '__MAIN__-Contrived'). +However this syntax is suboptimal. For this reason, Elixir ships with a parse transform that allows you to write the module names in a more convenient way: + +{% highlight erlang %} +-module(erlang_improved). +-compile(export_all). +-compile({parse_transform, elixir_transform}). -%% Wrapping the module name in a macro is often convenient pretiffy(bin) -> - ?Contrived:pretty_binary(bin). + 'Elixir.Contrived':pretty_binary(bin). {% endhighlight %} -An example of calling Erlang code from Elixir is shown in the Notable Differences section above. +### Rebar integration + +If you are using rebar, you should be able to include Elixir git repository as a dependency: + + https://github.com/elixir-lang/elixir.git + +Elixir is structured similarly to Erlang's OTP. It is divided into applications that are placed inside the `lib` directory, as seen on the [source code repository](https://github.com/elixir-lang/elixir). Since rebar is not familiar with such structure, you will to tell explicitly which Elixir apps you want to load, for example, you may add the following to your `rebar.config`: + +{% highlight erlang %} +{lib_dirs, [ + "deps/elixir/lib/elixir/ebin", + "deps/elixir/lib/ex_unit/ebin" +]}. +{% endhighlight %} + +This should be enough to invoke Elixir functions straight from your Erlang code. If you are also going to write Elixir code, you can [install Elixir's rebar plugin for automatic compilation](https://github.com/yrashk/rebar_elixir_plugin). + +### Manual integration + +If you are not using rebar, the easiest approach to use Elixir in your existing Erlang software is to install Elixir using one of the different ways specified in the [Getting Started guide](http://elixir-lang.org/getting_started/1.html) and add the `lib` directory in your checkout to `ERL_LIBS`. + +
        -## Further Reading +## 8 Further Reading Erlang's official documentation site has a nice [collection][4] of programming examples. It can be a good exercise to translate them into Elixir. [Erlang cookbook][5] offers even more useful code examples. diff --git a/index.html b/index.html index a34fe3442..e054f8650 100644 --- a/index.html +++ b/index.html @@ -125,7 +125,7 @@

        Erlang all the way down

        :lists.flatten([1,[2],3]) #=> [1,2,3] {% endhighlight %} -

        Since Elixir generates the same bytecode, Elixir is fully OTP compliant and doesn't try to break any of those battle-field tested techniques Erlang is familiar for. Erlang type specifications, behaviors and module attributes are also supported. And rebar too!

        +

        Since Elixir generates the same bytecode, Elixir is fully OTP compliant and doesn't try to break any of those battle-field tested techniques Erlang is familiar for. Erlang type specifications, behaviors and module attributes are also supported. It is easy to add Elixir to your existing Erlang programs too (including rebar support)!

        To install Elixir or learn more about it, check our getting started guide. We also have online documentation available and a Crash Course for Erlang developers.

        From db87f58081d43532acf5d9d4ce1bc4744afca537 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sat, 14 Jul 2012 12:26:29 +0200 Subject: [PATCH 190/437] copy edit --- crash-course.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crash-course.markdown b/crash-course.markdown index 182d94316..6cc42930c 100644 --- a/crash-course.markdown +++ b/crash-course.markdown @@ -780,7 +780,7 @@ If you are using rebar, you should be able to include Elixir git repository as a https://github.com/elixir-lang/elixir.git -Elixir is structured similarly to Erlang's OTP. It is divided into applications that are placed inside the `lib` directory, as seen on the [source code repository](https://github.com/elixir-lang/elixir). Since rebar is not familiar with such structure, you will to tell explicitly which Elixir apps you want to load, for example, you may add the following to your `rebar.config`: +Elixir is structured similarly to Erlang's OTP. It is divided into applications that are placed inside the `lib` directory, as seen in its [source code repository](https://github.com/elixir-lang/elixir). Since rebar does not recognize such structure, we need to explicitly add to our `rebar.config` which Elixir apps we want to use, for example: {% highlight erlang %} {lib_dirs, [ From b57a421c05c19fd3945f952631e42bf5d73be57d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Mon, 16 Jul 2012 10:49:13 +0200 Subject: [PATCH 191/437] Talk about console helpers --- getting_started/6.markdown | 97 +++++++++++++++++++++++++++----------- 1 file changed, 70 insertions(+), 27 deletions(-) diff --git a/getting_started/6.markdown b/getting_started/6.markdown index 283e52217..ef1015b6d 100644 --- a/getting_started/6.markdown +++ b/getting_started/6.markdown @@ -60,42 +60,85 @@ Elixir uses module attributes described in chapter 3 to drive its documentation def version, do: 1 end -In the example above, we are adding a module documentation to MyModule via `@moduledoc` and using `@doc` to document each function. When compiled with the `--docs` option, we will be able to inspect the documentation attributes in runtime (remember to start iex in the same directory you compiled the module in): +In the example above, we are adding a module documentation to `MyModule` via `@moduledoc` and using `@doc` to document each function. When compiled, we are able to inspect the documentation attributes in runtime (remember to start iex in the same directory you compiled the module in): - $ elixirc my_module.ex --docs + $ elixirc my_module.ex $ iex iex> MyModule.__info__(:docs) - [{ { :version, 0 }, 5, :def, "Returns the version" }] + [{ { :version, 0 }, 5, :def, [], "Returns the version" }] iex> MyModule.__info__(:moduledoc) {1,"It does X"} -`__info__(:docs)` returns a list of tuples where each tuple contains a function/arity pair, the line the function was defined on, the kind of the function (`def` or `defmacro`, docs applied to `defp` are always ignored) and the comments. The comment should be either a binary or a boolean. +`__info__(:docs)` returns a list of tuples where each tuple contains a function/arity pair, the line the function was defined on, the kind of the function (`def` or `defmacro`, private functions cannot be documented), the function arguments and its documentation. The comment will be either a binary or `nil` (not given) or `false` (explicit no doc). -Similarly, `__info__(:moduledoc)` returns a tuple with the line the module was defined on and its comments. +Similarly, `__info__(:moduledoc)` returns a tuple with the line the module was defined on and its documentation. -In case `--docs` was not provided during compilation, both calls would return nil. Elixir promotes the use of markdown in documentation, since it is a widely available format. Consider, for example, the documentation for `Module.add_doc` which allows us to dynamically add documentation to a function: +Elixir promotes the use of markdown with heredocs to write readable documentation: - @doc """ - Attaches documentation to a given function. It expects - the module the function belongs to, the line (a non negative - integer), the kind (`:def` or `:defmacro`), a tuple representing - the function and its arity and the documentation, which should - be either a binary or a boolean. + defmodule Math do + @moduledoc """ + This module provides mathematical functions + as sin, cos and constants like pi. + + ## Examples + + Math.pi + #=> 3.1415... + + """ + end + +## 6.4 IEx Helpers + +Elixir's interactive console (IEx) ships with many functions to make developers life easier. One of these functions is called `d`, which shows documentation directly in the command line: + + iex> d() + # IEx.Helpers + + A bunch of helpers available in IEx. + + ## Functions and Macros + + * def c(files, path // ".") + * def d(module // IEx.Helpers, print_functions // true) + * def d(module, function, arity) + * def h() + * def m() + * def m(mod) + * def v(n) + :ok + +As you can see, invoking `d()` prints the documentation of `IEx.Helpers`, from there, we can navigate to any of the other helpers by giving its name and arity to get more information: + + iex> d(:c, 2) + * def c(files, path // ".") + + Expects a list of files to compile and a path + to write their object code to. It returns the name + of the compiled modules. ## Examples - defmodule MyModule do - Module.add_doc(__MODULE__, __LINE__ + 1, - :def, { :version, 0}, "Manually added docs") - def version, do: 1 - end + c ["foo.ex"], "ebin" + #=> Foo - """ - def add_doc(module, line, kind, tuple, doc) +Now, we got the documentation for the `c/2` helper which can be used to compile files from IEx. + +This functionality can also be used to print the documentation for any Elixir module in the system: + + iex> d(Enum) + ... + iex> d(Enum, :each, 2) + ... + +The documentation for built-in functions can also be accessed directly or directly in the built-in module: -In the example, we use heredocs to allow the documentation to span over several lines and use markdown to style the documentation. + iex> d(:is_atom, 1) + ... + iex> d(Elixir.Builtin, :is_atom, 1) + ... -## 6.4 Partial application +## 6.5 Partial application Elixir also supports partial application. Let's suppose we have a list of strings and we want to calculate the size for each of them. We could do it in the following way: @@ -118,12 +161,12 @@ Since operators are also function calls they can also be partially applied: All functions can be partially applied, except [Elixir's special forms](http://elixir-lang.org/docs/latest/Elixir.SpecialForms.html). -## 6.5 Use +## 6.6 Use `use` is a macro that provides a common API for extension. For instance, in order to use the `ExUnit` test framework that ships with Elixir, you simply need to use `ExUnit.Case` in your module: defmodule AssertionTest do - use ExUnit.Case, sync: true + use ExUnit.Case, async: true def test_always_pass do true = true @@ -134,7 +177,7 @@ By calling `use`, a hook called `__using__` will be invoked in `ExUnit.Case` whi defmodule AssertionTest do require ExUnit.Case - ExUnit.Case.__using__(sync: true) + ExUnit.Case.__using__(async: true) def test_always_pass do true = true @@ -143,7 +186,7 @@ By calling `use`, a hook called `__using__` will be invoked in `ExUnit.Case` whi In general, we recommend APIs to provide a `__using__` hook in case they want to expose functionality to developers. -## 6.6 Comprehensions +## 6.7 Comprehensions Elixir also provides list and bit comprehensions. List comprehensions allow you to quickly build a list from another list: @@ -187,7 +230,7 @@ Remember, as strings are binaries and a binary is a bitstring, we can also use s iex> bc <> inbits " hello world ", c != ?\s, do: <> "helloworld" -## 6.7 Pseudo variables +## 6.8 Pseudo variables Elixir provides a set of pseudo-variables. Those variables can only be read and never assigned to. They are: @@ -197,7 +240,7 @@ Elixir provides a set of pseudo-variables. Those variables can only be read and * `__CALLER__` - Also returns a [Macro.Env](http://elixir-lang.org/docs/Macro.Env.html) record but with information of the calling site. `__CALLER__` is available only inside macros; * `__MAIN__` - The main namespace where modules are stored. A module `List` can also be accessed as `__MAIN__.List`; -## 6.8 Native compilation +## 6.9 Native compilation Elixir can compile to native code using the Hipe compiler. All you need to do is export the following environment variable before running your code: From 283e0ecdd07ca2f41ade4cae9855de7c701918b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Mon, 16 Jul 2012 12:45:07 +0200 Subject: [PATCH 192/437] Improvements to the home page, add a section about docs --- index.html | 42 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index e054f8650..7665c2189 100644 --- a/index.html +++ b/index.html @@ -88,6 +88,40 @@

        Polymorphism via protocols

        +
        +

        Documentation as first-class citizen

        + +
        +

        Documentation is written in markdown using Elixir data structures for accessibility:

        + +{% highlight ruby %} +defmodule MyModule do + @moduledoc """ + Documentation for my module + """ + + @doc "Hello" + def world do + "World" + end +end +{% endhighlight %} + +

        Different tools can easily access the documentation. For instance, IEx (Elixir's interactive shell) can show the documentation for any module or function with the help of the function d:

        + +{% highlight text %} +iex> d(MyModule) +# MyModule + +Documentation for my module + +## Functions and macros + +* def world() +{% endhighlight %} +
        +
        +

        Pattern matching

        @@ -102,15 +136,15 @@

        Pattern matching

        {% highlight ruby %} def serve_drinks({ User, name, age }) when age < 21 do - raise "No way!" + raise "No way #{name}!" end def serve_drinks({ User, name, age }) do # Code that serves drinks! end -serve_drinks User.get("John Doe") -#=> Raises No way! if John is under 21 +serve_drinks User.get("John") +#=> Raises "No way John!" if John is under 21 {% endhighlight %}
        @@ -125,7 +159,7 @@

        Erlang all the way down

        :lists.flatten([1,[2],3]) #=> [1,2,3] {% endhighlight %} -

        Since Elixir generates the same bytecode, Elixir is fully OTP compliant and doesn't try to break any of those battle-field tested techniques Erlang is familiar for. Erlang type specifications, behaviors and module attributes are also supported. It is easy to add Elixir to your existing Erlang programs too (including rebar support)! +

        Since Elixir generates the same bytecode, Elixir is fully OTP compliant and doesn't try to break any of those battle-field tested techniques Erlang is familiar for. Erlang type specifications, behaviors and module attributes are all supported. It is easy to add Elixir to your existing Erlang programs too (including rebar support)!

        To install Elixir or learn more about it, check our getting started guide. We also have online documentation available and a Crash Course for Erlang developers.

        From d9a59708c584bd7103f080dd9c66026b3427a972 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Fri, 20 Jul 2012 17:52:20 +0200 Subject: [PATCH 193/437] Update list of allowed in guards --- getting_started/2.markdown | 3 +++ 1 file changed, 3 insertions(+) diff --git a/getting_started/2.markdown b/getting_started/2.markdown index e6ea6ea30..36093fb7c 100644 --- a/getting_started/2.markdown +++ b/getting_started/2.markdown @@ -407,18 +407,21 @@ In the example above, the second clause will only match when x is positive. The * abs(Number) * bit_size(Bitstring) * byte_size(Bitstring) + * div(Number, Number) * elem(Tuple, n) * float(Term) * hd(List) * length(List) * node() * node(Pid|Ref|Port) + * rem(Number, Number) * round(Number) * self() * size(Tuple|Bitstring) * tl(List) * trunc(Number) * tuple_size(Tuple) + * super? Many independent guard clauses can also be given at the same time. For example, consider a function that checks if the first element of a tuple or a list is zero. It could be written as: From c28766f8c71d7011a51c5d58728d9c983c84d48a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sat, 21 Jul 2012 13:44:40 +0200 Subject: [PATCH 194/437] Update to latest fn style --- getting_started/2.markdown | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/getting_started/2.markdown b/getting_started/2.markdown index 36093fb7c..3dad39266 100644 --- a/getting_started/2.markdown +++ b/getting_started/2.markdown @@ -421,7 +421,6 @@ In the example above, the second clause will only match when x is positive. The * tl(List) * trunc(Number) * tuple_size(Tuple) - * super? Many independent guard clauses can also be given at the same time. For example, consider a function that checks if the first element of a tuple or a list is zero. It could be written as: @@ -444,18 +443,20 @@ In such cases, if there is an error in one of the guards, it won't affect the ne In Elixir, creating a function is similar to the `case` mechanism we have just seen. It allows us to define a function with many clauses: - function = fn do + f = function do x, y when x > 0 -> x + y x, y -> x * y end - function.(1, 3) #=> 4 - function.(-1, 3) #=> -3 + f.(1, 3) #=> 4 + f.(-1, 3) #=> -3 -A function with one clause can be define with a shortcut syntax as follow: +A function with one clause can be defined with a (preferred) shortcut syntax as follow: function = fn x, y -> x + y end +This is the syntax that's going to be used throughout this guide. + As Elixir is an immutable language, the binding of the function is also immutable. This means that setting a variable inside the function does not affect its outer scope: x = 1 From cf2384d41e3c835c8382dd0657e18341ab7dcd5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sun, 22 Jul 2012 13:00:51 +0200 Subject: [PATCH 195/437] Update information about __MAIN__ --- crash-course.markdown | 6 +++--- getting_started/3.markdown | 12 ++++++------ getting_started/6.markdown | 1 - 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/crash-course.markdown b/crash-course.markdown index 6cc42930c..fa5849212 100644 --- a/crash-course.markdown +++ b/crash-course.markdown @@ -211,7 +211,7 @@ X = 10. im_a_var x = 10 -Module # this is called an atom alias; it expands to :'__MAIN__-Module' +Module # this is called an atom alias; it expands to :'Elixir-Module' {% endhighlight %} It is also possible to create atoms that start with a character other than a lowercase letter. The syntax is different between the two languages: @@ -737,7 +737,7 @@ end ### Parse transform -Elixir compiles directly into BEAM byte code. This means that Elixir code can be called from Erlang and vice versa, without the need to write any bindings. In order to avoid conflicts with Erlang, Elixir modules are prefixed by the word `__MAIN__` and separated using `-`: +Elixir compiles directly into BEAM byte code. This means that Elixir code can be called from Erlang and vice versa, without the need to write any bindings. In order to avoid conflicts with Erlang, Elixir modules are prefixed by the word `Elixir` and separated using `-`: Consider the following module in Elixir: @@ -760,7 +760,7 @@ It can be called from Erlang as follow: -compile(export_all). uglify(bin) -> - '__MAIN__-Contrived':ugly_binary(bin). + 'Elixir-Contrived':ugly_binary(bin). {% endhighlight %} However this syntax is suboptimal. For this reason, Elixir ships with a parse transform that allows you to write the module names in a more convenient way: diff --git a/getting_started/3.markdown b/getting_started/3.markdown index 7b2c84668..a35f8e301 100644 --- a/getting_started/3.markdown +++ b/getting_started/3.markdown @@ -200,10 +200,10 @@ In order to facilitate software-reuse, Elixir supports three directives. As we a alias MyList, as: List end -And now, any reference to `List` will be automatically replaced by `MyList`. In case one wants to access the original `List`, it can be done by accessing the module directly via `__MAIN__`: +And now, any reference to `List` will be automatically replaced by `MyList`. In case one wants to access the original `List`, it can be done by accessing the module directly via `Elixir`: - List.values #=> uses MyList.values - __MAIN__.List.values #=> uses List.values + List.values #=> uses MyList.values + Elixir.List.values #=> uses List.values Calling `alias` without an `as` option sets the alias automatically to the last part of the module name, for example: @@ -353,12 +353,12 @@ In the example above, we store the atom `lists` in the variable `Mod` and then i iex> :lists.flatten([1,[2],3]) [1,2,3] -This mechanism is exactly what empowers Elixir aliases. An alias in Elixir is a capitalized identifier (like `List`, `Keyword`, etc) which is converted to an atom representing a module during compilation. For instance, by default `List` translates to the atom `__MAIN__-List`: +This mechanism is exactly what empowers Elixir aliases. An alias in Elixir is a capitalized identifier (like `List`, `Keyword`, etc) which is converted to an atom representing a module during compilation. For instance, by default `List` translates to the atom `Elixir-List`: iex> is_atom(List) true iex> to_binary(List) - "__MAIN__-List" + "Elixir-List" Given a scope, aliases can also be set using the `alias` directive discussed above. For instance, it is particularly useful when interacting with Erlang code: @@ -368,4 +368,4 @@ This allows you to write code transparently without using the Erlang notation to > Note: an alias does not actually ensure the aliased module really exists. For instance, `Foo.Bar.Baz` will return an atom regardless if a `Foo.Bar.Baz` module is defined or not. -> Note: preferably, the alias List would be convert to the atom `__MAIN__.List` instead of `__MAIN__-List`, however there is currently a limitation in Erlang that does not allow us to use such atoms. \ No newline at end of file +> Note: preferably, the alias `List` would be convert to the atom `Elixir.List` instead of `Elixir-List`, however there is currently a limitation in Erlang that does not allow us to use such atoms. \ No newline at end of file diff --git a/getting_started/6.markdown b/getting_started/6.markdown index ef1015b6d..c81ff50ad 100644 --- a/getting_started/6.markdown +++ b/getting_started/6.markdown @@ -238,7 +238,6 @@ Elixir provides a set of pseudo-variables. Those variables can only be read and * `__FILE__` - Returns a string representing the current file; * `__ENV__` - Returns a [Macro.Env](http://elixir-lang.org/docs/Macro.Env.html) record with information about the compilation environment. Here we can access the current module, function, line, file and others; * `__CALLER__` - Also returns a [Macro.Env](http://elixir-lang.org/docs/Macro.Env.html) record but with information of the calling site. `__CALLER__` is available only inside macros; -* `__MAIN__` - The main namespace where modules are stored. A module `List` can also be accessed as `__MAIN__.List`; ## 6.9 Native compilation From 4cd8db631212411a10494d3d053363bcba1e01f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sun, 22 Jul 2012 13:02:48 +0200 Subject: [PATCH 196/437] Elixir.Builtin -> Kernel --- getting_started/2.markdown | 2 +- getting_started/6.markdown | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/getting_started/2.markdown b/getting_started/2.markdown index 3dad39266..b58763326 100644 --- a/getting_started/2.markdown +++ b/getting_started/2.markdown @@ -583,6 +583,6 @@ Notice we spawned a new function using the `spawn` function passing another func ## 2.8 Built-in functions -Elixir ships with many built-in functions automatically available in the current scope. Besides all the control flow expressions seen above, Elixir also adds: `elem` and `setelem` to read and set values in tuples, `inspect` that returns the representation of a given data type as string and many others. All these functions imported by default are available in [`Elixir.Builtin`](http://elixir-lang.org/docs/latest/Elixir.Builtin.html) and [Elixir special forms are available in `Elixir.SpecialForms`](http://elixir-lang.org/docs/latest/Elixir.SpecialForms.html). +Elixir ships with many built-in functions automatically available in the current scope. Besides all the control flow expressions seen above, Elixir also adds: `elem` and `setelem` to read and set values in tuples, `inspect` that returns the representation of a given data type as string and many others. All these functions imported by default are available in `Kernel`](http://elixir-lang.org/docs/latest/Kernel.html) and [Elixir special forms are available in `Kernel.SpecialForms`](http://elixir-lang.org/docs/latest/Kernel.SpecialForms.html). All those functions and control flow expressions are essential for building Elixir programs. The next chapter will discuss how to organize our code into modules, so it can be easily re-used between different components. \ No newline at end of file diff --git a/getting_started/6.markdown b/getting_started/6.markdown index c81ff50ad..f1cd5e677 100644 --- a/getting_started/6.markdown +++ b/getting_started/6.markdown @@ -17,7 +17,7 @@ Sigils starting with uppercase letter never escaper characters nor interpret int %b-another binary- -Internally, `%b` is translated as a function call to `__b__`. For instance, the docs for `%b` are available [in the function `__b__/1` defined in Elixir.Builtin module](http://elixir-lang.org/docs/Elixir.Builtin.html#__b__/1). +Internally, `%b` is translated as a function call to `__b__`. For instance, the docs for `%b` are available [in the function `__b__/1` defined in `Kernel` module](http://elixir-lang.org/docs/Kernel.html#__b__/1). The sigils defined in Elixir by default are: @@ -135,7 +135,7 @@ The documentation for built-in functions can also be accessed directly or direct iex> d(:is_atom, 1) ... - iex> d(Elixir.Builtin, :is_atom, 1) + iex> d(Kernel, :is_atom, 1) ... ## 6.5 Partial application @@ -159,7 +159,7 @@ Since operators are also function calls they can also be partially applied: iex> Enum.map [1,2,3], &1 * 2 [2,4,6] -All functions can be partially applied, except [Elixir's special forms](http://elixir-lang.org/docs/latest/Elixir.SpecialForms.html). +All functions can be partially applied, except [Elixir's special forms](http://elixir-lang.org/docs/latest/Kernel.SpecialForms.html). ## 6.6 Use From 2163a9581b118d82457fd28436b35137992212c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Tue, 24 Jul 2012 15:16:53 +0200 Subject: [PATCH 197/437] Initial work on applications chapters, starting with mix --- _layouts/getting_started.html | 9 ++ getting_started/1.markdown | 4 +- getting_started/2.markdown | 2 +- getting_started/3.markdown | 2 +- getting_started/4.markdown | 4 +- getting_started/5.markdown | 2 +- getting_started/6.markdown | 2 + getting_started/7.markdown | 19 +++- getting_started/mix.markdown | 202 ++++++++++++++++++++++++++++++++++ 9 files changed, 235 insertions(+), 11 deletions(-) create mode 100644 getting_started/mix.markdown diff --git a/_layouts/getting_started.html b/_layouts/getting_started.html index 1de6a80d3..cf802e6f2 100644 --- a/_layouts/getting_started.html +++ b/_layouts/getting_started.html @@ -19,6 +19,13 @@

        Index

      308. Where to go next
      +
      @@ -26,6 +33,7 @@

      Index

      {{ content }} + {% if page.guide %} + {% endif %}
      {% include bottom.html %} diff --git a/getting_started/1.markdown b/getting_started/1.markdown index 5c878764c..f724dcb95 100644 --- a/getting_started/1.markdown +++ b/getting_started/1.markdown @@ -6,9 +6,9 @@ guide: 1 # 1 Introduction -Welcome! In this tutorial we are going to show you how to get started with Elixir. In later sections, we are even going to discuss more advanced subjects as macros, protocols and other features provided by Elixir. +Welcome! In this tutorial we are going to show you how to get started with Elixir. We will start with how to install Elixir, how to use its interactive shell, basic data types and operators. In later chapters, we are even going to discuss more advanced subjects as macros, protocols and other features provided by Elixir. -Keep in mind that Elixir is still in development and sometimes you may get poorly written error messages. If, at any point, you receive an error message and you are not sure on how to proceed, [please let us know in the issues tracker](https://github.com/elixir-lang/elixir/issues). Having explanative and consistent error messages is one of the many features we aim for Elixir. +Keep in mind that Elixir is still in development so if at any point you receive an error message and you are not sure on how to proceed, [please let us know in the issues tracker](https://github.com/elixir-lang/elixir/issues). Having explanative and consistent error messages is one of the many features we aim for Elixir. ## 1.1 Installation diff --git a/getting_started/2.markdown b/getting_started/2.markdown index b58763326..eb99f604d 100644 --- a/getting_started/2.markdown +++ b/getting_started/2.markdown @@ -6,7 +6,7 @@ guide: 2 # 2 Diving in -In this section we are going a bit deeper into the basic data-types, learn some control flow mechanisms and basic functions. +In this chapter we are going a bit deeper into the basic data-types, learn some control flow mechanisms and how to create and invoke anonymous functions. ## 2.1 Lists and tuples diff --git a/getting_started/3.markdown b/getting_started/3.markdown index a35f8e301..af8f2f88f 100644 --- a/getting_started/3.markdown +++ b/getting_started/3.markdown @@ -173,7 +173,7 @@ In the example above, we are mutating the array which is not possible here. Ther Math.sum_list([1,2,3], 0) #=> 6 -In the example above, we invoke `sum_list` giving a list `[1,2,3]` and the initial value `0` as arguments. As we saw in the previous section, when a function has many clauses, we will try each clause until find one that matches according to the pattern matching rules. In this case, the list `[1,2,3]` matches against `[h|t]` which assigns `h = 1` and `t = [2,3]` while `acc` is set to 0. +In the example above, we invoke `sum_list` giving a list `[1,2,3]` and the initial value `0` as arguments. As we saw in the previous chapter, when a function has many clauses, we will try each clause until find one that matches according to the pattern matching rules. In this case, the list `[1,2,3]` matches against `[h|t]` which assigns `h = 1` and `t = [2,3]` while `acc` is set to 0. Then, we add the head of the list to the accumulator `h + acc` and call `sum_list` again, recursively, passing the tail of the list as argument. The tail will once again match `[h|t]` until the list is empty, as seen below: diff --git a/getting_started/4.markdown b/getting_started/4.markdown index 569bcf8e5..be99d06af 100644 --- a/getting_started/4.markdown +++ b/getting_started/4.markdown @@ -6,7 +6,7 @@ guide: 4 # 4 Records & Protocols -Elixir provides both protocols and records. This section will outline the main features on both and provide some examples. More specifically, we will learn how to use `defrecord`, `defprotocol` and `defimpl`. +Elixir provides both protocols and records. This chapter will outline the main features on both and provide some examples. More specifically, we will learn how to use `defrecord`, `defprotocol` and `defimpl`. ## 4.1 Records @@ -191,4 +191,4 @@ Elixir ships with three built-in protocols, they are: * Binary.Chars - specifies how to convert a data structure with characters to binary. Exposed via the `to_binary` function. For instance, interpolation calls `to_binary` in the interpolated content before adding it to the binary; * Binary.Inspect - specifies how to convert any data structure to a string for inspection. Exposed via the `inspect` function; -You can check the source code for those protocols for more information about how each one is used and how to implement your own. With this, we have finally finished this section which has described `defrecord`, `defprotocol` and `defimpl`. Next, we are going to build some macros using `defmacro` and `defmacrop`! +You can check the source code for those protocols for more information about how each one is used and how to implement your own. With this, we have finally finished this chapter which has described `defrecord`, `defprotocol` and `defimpl`. Next, we are going to build some macros using `defmacro` and `defmacrop`! diff --git a/getting_started/5.markdown b/getting_started/5.markdown index cfe573c30..afea79bc0 100644 --- a/getting_started/5.markdown +++ b/getting_started/5.markdown @@ -6,7 +6,7 @@ guide: 5 # 5 Macros -Elixir is an homoiconic language. Any Elixir program can be represented using its own data structures. This section describes the Elixir language specification for such data structures. +Elixir is an homoiconic language. Any Elixir program can be represented using its own data structures. This chapter will describe how those structures look like and how to manipulate them to create your own macros. ## 5.1 Building blocks of homoiconicity diff --git a/getting_started/6.markdown b/getting_started/6.markdown index f1cd5e677..0e0fead1e 100644 --- a/getting_started/6.markdown +++ b/getting_started/6.markdown @@ -6,6 +6,8 @@ guide: 6 # 6 Other topics +This chapter holds different small topics that are part of Elixir's day to day work. We will learn about writing documentation, list and binary comprehensions, partial function application and others! + ## 6.1 String sigils Elixir provides string sigils via the token `%`: diff --git a/getting_started/7.markdown b/getting_started/7.markdown index e3fbb3a94..b6a456483 100644 --- a/getting_started/7.markdown +++ b/getting_started/7.markdown @@ -6,7 +6,18 @@ guide: 7 # 7 Where To Go Next -## 7.1 Sample Code +## 7.1 Applications + +Elixir has more features to offer than what has been described so far, but you should already be comfortable enough to start coding. In order to get your first project started, Elixir ships with a build tool called [`Mix`](/getting_started/mix.html). You can get your new project start by simply running: + + mix new path/to/new/project + +You can learn more about Elixir and other applications in the links below: + +* [Mix - a build tool for Elixir](/getting_started/mix.html) +* [ExUnit - an unit test framework](/getting_started/ex_unit.html) + +## 7.2 Sample Code Elixir has more features to offer than what has been described so far, but you should already be comfortable enough to start coding. Here is a bunch of links that'll help you get started: @@ -16,7 +27,7 @@ Elixir has more features to offer than what has been described so far, but you s * [WebSocket Server](https://github.com/alco/ws-elixir) demonstrates an approach to building a web server that supports custom protocols communicating via WebSockets. -## 7.2 A Byte of Erlang +## 7.3 A Byte of Erlang As the main page of this site puts it: @@ -32,11 +43,11 @@ So, in order to write a real application with Elixir, familiarity with Erlang's * [Learn You Some Erlang for Great Good!][4] is an excellent introduction to Erlang, its design principles, standard library, best practices and much more. If you are serious about Elixir, you'll want to get a solid understanding of the principles Erlang based upon. Once you have read through the crash course mentioned above, you'll be able to safely skip the first couple of chapters in the book that mostly deal with the syntax. When you reach [The Hitchhiker's Guide to Concurrency][5] chapter, that's where the real fun starts. -## 7.3 Reference Manual +## 7.4 Reference Manual [You can also check the source code of Elixir itself](https://github.com/elixir-lang/elixir/tree/master/lib), which is mainly written in Elixir, or [explore Elixir's documentation][8]. -## 7.4 Join The Community +## 7.5 Join The Community Remember that in case of any difficulties, you can always visit the **#elixir-lang** channel on **irc.freenode.net** or send a message to the [mailing list][6]. You can be sure that there will be someone willing to help. diff --git a/getting_started/mix.markdown b/getting_started/mix.markdown new file mode 100644 index 000000000..d22f54348 --- /dev/null +++ b/getting_started/mix.markdown @@ -0,0 +1,202 @@ +--- +layout: getting_started +title: Mix +--- + +# Mix + +Elixir ships with a few applications to make building and deploying projects with Elixir easier and Mix is certainly their backbone. + +Mix is a build tool that provides tasks for creating, compiling, testing (and soon deploying) Elixir projects. Mix is inspired by the [Leiningen](https://github.com/technomancy/leiningen) build tool for Clojure and was written by one of its contributors. + +In this chapter, you will learn how to create projects using `mix`, install dependencies and create your own tasks. + +## 1 Getting started + +In order to start your first project, simply use the `mix new` command passing the path to your project. For now, we will create an application called `my_project` in the current directory: + + mix new ./my_project + +Mix will create a directory named `my_project` with few files in it: + + .gitignore + README.md + mix.exs + lib/my_project.ex + test/test_helper.exs + test/my_project_test.exs + +Let's take a brief look at some of these. + +### 1.1 mix.exs + +This is the file with your projects configuration. It looks like this: + +{% highlight ruby %} +defmodule MyProject.MixFile do + use Mix.Project + + def project do + [ + app: :my_project, + version: "0.0.1" + ] + end + + # Configuration for the OTP application + def application do + [] + end +end +{% endhighlight %} + +Our `mix.exs` is quite straight-forward. It defines two functions, `project` which should return the project configuration, for example, where to find the source files, the application name and version. And another function named `application` which allow us to generate an application according to the Open Telecom Platform (OTP) that ships with Erlang. We will talk more about these later. + +### 1.2 lib/my_project.ex + +This file simply contains the definition of our project main module with a `start` function: + +{% highlight ruby %} +defmodule MyProject do + def start do + :ok = :application.start(:my_project) + end +end +{% endhighlight %} + + +The `start` function invokes the erlang module `application` and tells it to start our application. + +### 1.3 test/my_project_test.exs + +This file contains a stub test case for our project: + +{% highlight ruby %} +Code.require_file "../test_helper", __FILE__ + +defmodule MyProjectTest do + use ExUnit.Case + + test "the truth" do + assert true + end +end +{% endhighlight %} + +It is important to note a couple things: + +1) Notice the file is an Elixir script file (`.exs`). This is convenient because we don't need to compile test files before running them; + +2) The first line in our test is simply requiring the `test_helper` file in the same directory as the current file. As we are going to see, the `test/test_helper.exs` file is responsible for starting the test framework; + +3) Then we define a test module named `MyProjectTest`, using `ExUnit.Case` to inject default behavior and define a simple test. You can learn more about the test framework in the [ExUnit](/getting_started/ex_unit.html) chapter; + +Since this file is a script file (`.exs`) and it also requires `test_helper.exs`, responsible for setting up the test framework, we can execute this file directly from the command line, which is very useful when you want to run a specific test and not the whole test suite, try it: + + $ elixir test/my_project_test.exs + +### 1.4 test/test_helper.exs + +The last file we are going to check is the `test_helper.exs`, which simply loads our application and sets up the test framework: + +{% highlight ruby %} +MyProject.start +ExUnit.start +{% endhighlight %} + +And that is it, with our project created. We are ready to move on! + +## 2 Exploring + +Now that we created our new project, what can we do with it? In order to check the commands available to us, just run the task `help`: + + $ mix help + +It will print all the tasks available. You can get further information by invoking `mix help TASK`. + +Play around with the available tasks, like `mix compile` and `mix test`, and execute them in your project to check how they work. + +## 3 Compilation + +Mix can compile our project for us. The default configurations uses `lib/` for source files and `ebin/` for compiled beam files, you don't even have to provide any compilation-specific setup but if you must, some options are available. For instance, if you want to put your compiled files in another directory besides `ebin`, simply set in `:compile_path` in your `mix.exs` file: + +{% highlight ruby %} +def project do + [compile_path: "ebin"] +end +{% endhighlight %} + +In general, Mix tries to be smart and compile only when necessary. + +You can also note that, after you compile for the first time, Mix generates an `my_project.app` file inside your `ebin` directory. This file specifies an Erlang application and it holds information about your application, for example, what are its dependencies, which modules it defines and so forth. In our `MyProject.start` function, when we call `:application.start(:my_project)`, Erlang will load the `my_project.app` file and process it. For instance, if there are any dependencies missing, it will let us now. + +## 4 Tasks + +In Mix, a task is simply an Elixir module named with a `Mix.Tasks` prefix and a `run/1` function. For example, the `compile` task is a module named `Mix.Tasks.Compile`. + +Here is a simple example task: + +{% highlight ruby %} +defmodule Mix.Tasks.Hello do + use Mix.Task + + @shortdoc "This is short documentation, see" + + @moduledoc """ + A test task. + """ + def run(_) do + IO.puts "Hello, World!" + end +end +{% endhighlight %} + +This defines a task called `hello`. In order to make it a task, it defines a `run` function that takes a single argument that will be a list of binary strings which are the arguments that were passed to the task on the command line or from another task calling this one. + +When you invoke `mix hello`, this task will run and print `Hello, World!`. Mix uses its first argument to lookup the task module and execute its `run` function. + +You're probably wondering why we have a `@moduledoc` and `@shortdoc`. Both are used by the `help` task for listing tasks and providing documentation of them. The former is used when `mix help TASK` is invoked, the latter in the general listing with `mix help`. + +Besides those two, there is also `@hidden` that, when set to true, marks the task as hidden so it does not show up on `mix help Task`. Any task without `@shortdoc` also won't show up. + +### 4.1 Common API + +When writing tasks, there are some common mix functionality we would like to access. There is a gist: + +* `Mix.project` - Returns the project configuration under the function `project`; Notice this function returns an empty configuration if no `mix.exs` file exists in the current directory, this allows many mix functions to work even if a `mix.exs` project is not defined; + +* `Mix.Project.current` - Access the module for the current project, this is useful in case you want to access special functions in the project. It raises an exception if no project is defined; + +* `Mix.shell` - The shell is a simple abstraction for doing IO in Mix. Such abstractions make it easy to test existing mix tasks. In the future, the shell will provide conveniences for colored output and getting user input; + +* `Mix.Task.run(task, args)` - This is how you invoke a task from another task in Mix; Notice that if the task was already invoked, it works as no-op; + +There is more to the Mix API, so feel free to [check the documentation](/docs/latest/Mix.html), with special attention to [`Mix.Task`](/docs/latest/Mix.Task.html) and [`Mix.Project`](/docs/latest/Mix.Project.html). + +### 4.2 Namespaced Tasks + +While tasks are simple, they can be used to accomplish complex things. Since they are just Elixir code, anything you can do in normal Elixir you can do in Mix tasks. You can distribute tasks however you want just like normal libraries and thus they can be reused in many projects. + +So, what do you do when you have a whole bunch of related tasks? If you name them all like `foo`, `bar`, `baz`, etc, eventually you'll end up with conflicts with other people's tasks. To prevent this, Mix allows you to namespace tasks. + +Let's assume you have a bunch of tasks for working with Riak. + +{% highlight ruby %} +defmodule Mix.Tasks.Riak do + defmodule Dostuff do + ... + end + + defmodule Dootherstuff do + ... + end +end +{% endhighlight %} + +Now you'll have two different tasks under the modules `Mix.Tasks.Riak.Dostuff` and `Mix.Tasks.Riak.Dootherstuff` respectively. You can invoke these tasks like so: `mix mongodb.dostuff` and `mix mongodb.dootherstuff`. Pretty cool, huh? + +You should use this feature when you have a bunch of related tasks that would be unwieldly if named completely independently of each other. If you have a few unrelated tasks, go ahead and name them however you like. + +## 5 Lots To Do + +Mix is still very much a work in progress. Feel free to visit [our issues tracker](https://github.com/elixir-lang/elixir/issues) to add issues for anything you'd like to see in Mix and feel free to contribute. \ No newline at end of file From c127a1d5729ae1f42378f28275531ac2097610a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Tue, 24 Jul 2012 17:26:33 +0200 Subject: [PATCH 198/437] Talk about dependencies, locals and do --- getting_started/mix.markdown | 72 +++++++++++++++++++++++++++++++++++- 1 file changed, 71 insertions(+), 1 deletion(-) diff --git a/getting_started/mix.markdown b/getting_started/mix.markdown index d22f54348..8cd7c5570 100644 --- a/getting_started/mix.markdown +++ b/getting_started/mix.markdown @@ -197,6 +197,76 @@ Now you'll have two different tasks under the modules `Mix.Tasks.Riak.Dostuff` a You should use this feature when you have a bunch of related tasks that would be unwieldly if named completely independently of each other. If you have a few unrelated tasks, go ahead and name them however you like. -## 5 Lots To Do +## 5 Dependencies + +Mix is also able to manage git (so far) dependencies. Dependencies should be listed in project settings, as follow: + +{% highlight ruby %} +def project do + [ + deps: [ + { :some_project, "0.3.0", git: "https://github.com/some_project/other.git" } + ] + ] +end +{% endhighlight %} + +Besides `:git`, it accepts two other options: + +* `:ref` - the reference (a commit, branch or tag) to checkout in the repository; +* `:compile` - how to compile the dependency. If the project contains a `mix.exs` file, or `rebar.config` or a `Makefile`, Elixir will invoke one of them. If not, you can specify a command directly: + + compile: "./configure && make" + + You could also pass an atom to `:compile`, in such cases, a function with the name of the atom will be invoked in your current project passing the app name, allowing you to further customize its compilation: + + def project do + [ + deps: [ + { :some_project, "0.3.0", + git: "https://github.com/some_project/other.git", compile: :using_foo } + ] + ] + end + + def using_foo(app) do + # ... + end + + Finally, if `:noop` is given to `:compile` nothing is done. + +Finally, Elixir has many tasks to manage such dependencies: + +* `mix deps` - List all dependencies and their status; +* `mix deps.get` - Get all unavailable dependencies; +* `mix deps.compile` - Compile dependencies; +* `mix deps.update` - Update dependencies; +* `mix deps.clean` - Remove dependencies + +Use `mix help` to get more information. + +## 6 Local tasks + +Elixir also ships with the ability of providing local tasks. Local tasks can be install from any URL and are available from anywhere within Elixir: + + $ mix local.install http://elixir-lang/hello.beam + +If everything works as expected, the task will be installed on your machine and you can then successfully invoke it: + + $ mix hello + +You can use `mix local` to show all available local tasks and their path. Removing a task is as easy as: + + $ mix local.uninstall hello + +## 7 Do + +In some situations, it is desired to execute more than one task at once. For this purpose, Elixir also ships with a `do` task that simply executes all the given commands separated by comma: + + $ mix do help compile, compile --list + +For instance, the command above will show help information for the compile task and then print the list of available compilers. + +## 8 Lots To Do Mix is still very much a work in progress. Feel free to visit [our issues tracker](https://github.com/elixir-lang/elixir/issues) to add issues for anything you'd like to see in Mix and feel free to contribute. \ No newline at end of file From 8176051113990f540e8a4c9aec8f5b983c6d8845 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Wed, 25 Jul 2012 20:53:13 +0200 Subject: [PATCH 199/437] mix updates --- getting_started/mix.markdown | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/getting_started/mix.markdown b/getting_started/mix.markdown index 8cd7c5570..22c23a294 100644 --- a/getting_started/mix.markdown +++ b/getting_started/mix.markdown @@ -39,7 +39,11 @@ defmodule MyProject.MixFile do def project do [ app: :my_project, - version: "0.0.1" + version: "0.0.1", + deps: [ + # Add dependencies here + # { :foo_bar, "0.1", git: "https://github.com/foo/bar.git" } + ] ] end @@ -93,7 +97,7 @@ It is important to note a couple things: Since this file is a script file (`.exs`) and it also requires `test_helper.exs`, responsible for setting up the test framework, we can execute this file directly from the command line, which is very useful when you want to run a specific test and not the whole test suite, try it: - $ elixir test/my_project_test.exs + $ elixir -pa ebin test/my_project_test.exs ### 1.4 test/test_helper.exs From 6d71a0c54ec5d95000a5e4b834023316cc6f1531 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Thu, 26 Jul 2012 13:13:21 +0200 Subject: [PATCH 200/437] Add ExUnit chapter --- getting_started/ex_unit.markdown | 123 +++++++++++++++++++++++++++++++ getting_started/mix.markdown | 2 +- 2 files changed, 124 insertions(+), 1 deletion(-) create mode 100644 getting_started/ex_unit.markdown diff --git a/getting_started/ex_unit.markdown b/getting_started/ex_unit.markdown new file mode 100644 index 000000000..5af621f9a --- /dev/null +++ b/getting_started/ex_unit.markdown @@ -0,0 +1,123 @@ +--- +layout: getting_started +title: ExUnit +--- + +# ExUnit + +ExUnit is an unit test framework that ships with Elixir. + +## 1 Getting started + +Using ExUnit is quite easy, here is a file with the minimum required: + +{% highlight ruby %} +ExUnit.start + +defmodule MyTest do + use ExUnit.Case + + test "the truth" do + assert true + end +end +{% endhighlight %} + +In general, we just need to invoke `ExUnit.start`, define a test case using `ExUnit.Case` and our batch of tests. Assuming we saved this file as `assertion_test.exs`, we can run it directly: + + bin/elixir assertion_test.exs + +In this chapter, we will discuss the most common features available in ExUnit and how to customize it further. + +## 2 ExUnit + +ExUnit is started using `ExUnit.start`. This function accepts a couple options, so [check its documentation](http://elixir-lang.org/docs/latest/ExUnit.html) for more details. For now, we will just detail the most common ones: + +* `:formatter` - When you run tests with ExUnit, all the IO is done by [the formatter](https://github.com/elixir-lang/elixir/blob/master/lib/ex_unit/lib/ex_unit/formatter.ex). Developers can define their own formatters and this is the configuration that tells ExUnit to use a custom formatter; + +* `:max_cases` - As we are going to see soon, ExUnit allows you to easily run tests in parallel. This is very useful to speed up your tests that have no side affects. This option allows us to configure the maximum number of cases ExUnit runs in parallel. + +## 3 ExUnit.Case + +After ExUnit is started, we can define our own test cases. This is done by using `ExUnit.Case` in our module: + +{% highlight ruby %} +use ExUnit.Case +{% endhighlight %} + +`ExUnit.Case` provides some features, so let's take a look at them. + +### 3.1 Async + +The first feature worth commenting in ExUnit is the ability to run test cases in parallel. All you need to do is pass the `:async` option set to true: + +{% highlight ruby %} +use ExUnit.Case, async: true +{% endhighlight %} + +This will run this test case in parallel with other test cases which are async too. The tests inside a particular case is still run in parallel. + +### 3.2 The test macro + +`ExUnit.Case` runs all functions starting with `test`. As a convenience to define such functions, `ExUnit.Case` provides a test macro, so instead of writing: + +{% highlight ruby %} +def test_the_truth do + assert true +end +{% endhighlight %} + +A developer can write: + +{% highlight ruby %} +test "the truth" do + assert true +end +{% endhighlight %} + +Which is more legible. The test macro accepts either a binary or an atom as name. + +### 3.3 Assertions + +Another convenience provided by `ExUnit.Case` is to automatically import a set of assertion macros and functions, available in [`ExUnit.Assertions`](http://elixir-lang.org/docs/latest/ExUnit.Assertions.html). + +In the majority of tests, the only assertion macros you will need to use are `assert` and `refute`: + +{% highlight ruby %} +assert 1 + 1 == 2 +refute 1 + 3 == 3 +{% endhighlight %} + +ExUnit automatically breaks those expressions apart and attempt to provide detailed information in case the assertion fails. For example, the failing assertion: + +{% highlight ruby %} +assert 1 + 1 == 3 +{% endhighlight %} + +Will fail as: + + Expected 2 to be equal to (==) 3 + +However, some extra assertions are convenient to make testing easier for some specific cases, a good example is the `assert_raise` macro: + +{% highlight ruby %} +assert_raise ArithmeticError, "bad argument in arithmetic expression", fn -> + 1 + "test" +end +{% endhighlight %} + +So don't forget to check [`ExUnit.Assertions`' documentation](http://elixir-lang.org/docs/latest/ExUnit.Assertions.html) for more examples. + +### 3.4 Callbacks + +`ExUnit.Case` defines four callbacks: + +* `setup_all()` and `teardown_all()` which are executed before and after all tests respectively; +* `setup(test)` and `teardown(test)` which are executed before and after each test, receiving +the test name as argument; + +Such callbacks are useful to clean up any side-effect a test may cause, as for example, state in genservers, data on filesystem, or entries in a database. + +## 4 Lots To Do + +ExUnit is still a work in progress. Feel free to visit [our issues tracker](https://github.com/elixir-lang/elixir/issues) to add issues for anything you'd like to see in ExUnit and feel free to contribute. \ No newline at end of file diff --git a/getting_started/mix.markdown b/getting_started/mix.markdown index 22c23a294..f8b6dd98f 100644 --- a/getting_started/mix.markdown +++ b/getting_started/mix.markdown @@ -273,4 +273,4 @@ For instance, the command above will show help information for the compile task ## 8 Lots To Do -Mix is still very much a work in progress. Feel free to visit [our issues tracker](https://github.com/elixir-lang/elixir/issues) to add issues for anything you'd like to see in Mix and feel free to contribute. \ No newline at end of file +Mix is still a work in progress. Feel free to visit [our issues tracker](https://github.com/elixir-lang/elixir/issues) to add issues for anything you'd like to see in Mix and feel free to contribute. \ No newline at end of file From b3d863f23dfeb9701c5270745e125d4ea809d096 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Thu, 26 Jul 2012 13:14:37 +0200 Subject: [PATCH 201/437] an unit -> a unit --- _layouts/getting_started.html | 2 +- getting_started/7.markdown | 2 +- getting_started/ex_unit.markdown | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/_layouts/getting_started.html b/_layouts/getting_started.html index cf802e6f2..fa0695e59 100644 --- a/_layouts/getting_started.html +++ b/_layouts/getting_started.html @@ -23,7 +23,7 @@

      Index

      Applications

      diff --git a/getting_started/7.markdown b/getting_started/7.markdown index b6a456483..2d32f6ffa 100644 --- a/getting_started/7.markdown +++ b/getting_started/7.markdown @@ -15,7 +15,7 @@ Elixir has more features to offer than what has been described so far, but you s You can learn more about Elixir and other applications in the links below: * [Mix - a build tool for Elixir](/getting_started/mix.html) -* [ExUnit - an unit test framework](/getting_started/ex_unit.html) +* [ExUnit - a unit test framework](/getting_started/ex_unit.html) ## 7.2 Sample Code diff --git a/getting_started/ex_unit.markdown b/getting_started/ex_unit.markdown index 5af621f9a..503c2b882 100644 --- a/getting_started/ex_unit.markdown +++ b/getting_started/ex_unit.markdown @@ -5,7 +5,7 @@ title: ExUnit # ExUnit -ExUnit is an unit test framework that ships with Elixir. +ExUnit is a unit test framework that ships with Elixir. ## 1 Getting started From 3e78a22f70363a70ded50d4a1818a40309699484 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sat, 28 Jul 2012 14:49:26 +0200 Subject: [PATCH 202/437] Update mix info --- getting_started/mix.markdown | 45 +++++++++++++++++++++++++----------- 1 file changed, 31 insertions(+), 14 deletions(-) diff --git a/getting_started/mix.markdown b/getting_started/mix.markdown index f8b6dd98f..47b94b3b6 100644 --- a/getting_started/mix.markdown +++ b/getting_started/mix.markdown @@ -37,20 +37,21 @@ defmodule MyProject.MixFile do use Mix.Project def project do - [ - app: :my_project, + [ app: :my_project, version: "0.0.1", - deps: [ - # Add dependencies here - # { :foo_bar, "0.1", git: "https://github.com/foo/bar.git" } - ] - ] + deps: deps ] end # Configuration for the OTP application def application do [] end + + # Returns the list of dependencies in the format: + # { :foobar, "0.1", git: "https://github.com/elixir-lang/foobar.git" } + defp deps do + [] + end end {% endhighlight %} @@ -207,14 +208,19 @@ Mix is also able to manage git (so far) dependencies. Dependencies should be lis {% highlight ruby %} def project do - [ - deps: [ - { :some_project, "0.3.0", git: "https://github.com/some_project/other.git" } - ] - ] + [ app: :my_project, + version: "0.0.1", + deps: deps ] +end + +defp deps do + [ { :some_project, "0.3.0", git: "https://github.com/some_project/other.git" }, + { :another_project, "1.0.2", git: "https://github.com/another/main.git" } ] end {% endhighlight %} +**Note:** Although not required, it is common to split dependencies into their own function; + Besides `:git`, it accepts two other options: * `:ref` - the reference (a commit, branch or tag) to checkout in the repository; @@ -239,13 +245,24 @@ Besides `:git`, it accepts two other options: Finally, if `:noop` is given to `:compile` nothing is done. -Finally, Elixir has many tasks to manage such dependencies: +### 5.1 Repeatability + +An important feature in any dependency management tool is repeatability. For this reason, when you first get your dependencies, Mix will create a file called `mix.lock`, which contains information about in which reference each dependency is checked out. + +When another developer gets a copy of the same project, Mix will checkout exactly the same references, ensuring other developers can "repeat" the same setup. + +Locks is automatically updated when `deps.update` is called and can be removed when `deps.unlock` is called. + +### 5.2 Tasks + +Elixir has many tasks to manage such dependencies: * `mix deps` - List all dependencies and their status; * `mix deps.get` - Get all unavailable dependencies; * `mix deps.compile` - Compile dependencies; * `mix deps.update` - Update dependencies; -* `mix deps.clean` - Remove dependencies +* `mix deps.clean` - Remove dependencies files; +* `mix deps.unlock` - Remove all or specific locks; Use `mix help` to get more information. From bbf42b76e367d572bdf7c926aa89704f4e69dab3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sat, 28 Jul 2012 16:53:18 +0200 Subject: [PATCH 203/437] Grammar fixes --- getting_started/mix.markdown | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/getting_started/mix.markdown b/getting_started/mix.markdown index 47b94b3b6..7200b46e6 100644 --- a/getting_started/mix.markdown +++ b/getting_started/mix.markdown @@ -247,11 +247,11 @@ Besides `:git`, it accepts two other options: ### 5.1 Repeatability -An important feature in any dependency management tool is repeatability. For this reason, when you first get your dependencies, Mix will create a file called `mix.lock`, which contains information about in which reference each dependency is checked out. +An important feature in any dependency management tool is repeatability. For this reason when you first get your dependencies, Mix will create a file called `mix.lock` that contains in which reference each dependency is checked out. When another developer gets a copy of the same project, Mix will checkout exactly the same references, ensuring other developers can "repeat" the same setup. -Locks is automatically updated when `deps.update` is called and can be removed when `deps.unlock` is called. +Locks are automatically updated when `deps.update` is called and can be removed with `deps.unlock`. ### 5.2 Tasks @@ -262,7 +262,7 @@ Elixir has many tasks to manage such dependencies: * `mix deps.compile` - Compile dependencies; * `mix deps.update` - Update dependencies; * `mix deps.clean` - Remove dependencies files; -* `mix deps.unlock` - Remove all or specific locks; +* `mix deps.unlock` - Remove specific locks; Use `mix help` to get more information. From 022f94282e9384da49244cf26f110c277ac20acc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sat, 28 Jul 2012 19:19:15 +0200 Subject: [PATCH 204/437] Update available flags --- getting_started/mix.markdown | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/getting_started/mix.markdown b/getting_started/mix.markdown index 7200b46e6..5461b3920 100644 --- a/getting_started/mix.markdown +++ b/getting_started/mix.markdown @@ -221,9 +221,12 @@ end **Note:** Although not required, it is common to split dependencies into their own function; -Besides `:git`, it accepts two other options: +Besides `:git`, it accepts other options: -* `:ref` - the reference (a commit, branch or tag) to checkout in the repository; +* `:ref` - an optional reference (a commit) to checkout the git repository; +* `:tag` - an optional tag to checkout the git repository; +* `:branch` - an optional branch to checkout the git repository; +* `:submodules` - when true, initializes submodules recursively in the dependency; * `:compile` - how to compile the dependency. If the project contains a `mix.exs` file, or `rebar.config` or a `Makefile`, Elixir will invoke one of them. If not, you can specify a command directly: compile: "./configure && make" From 2408a84dfb1e4abe2f5da7cab6e924c5b74d851f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sat, 28 Jul 2012 21:00:13 +0200 Subject: [PATCH 205/437] Talk about the option parser in mix --- getting_started/mix.markdown | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/getting_started/mix.markdown b/getting_started/mix.markdown index 5461b3920..606a21f91 100644 --- a/getting_started/mix.markdown +++ b/getting_started/mix.markdown @@ -35,7 +35,7 @@ This is the file with your projects configuration. It looks like this: {% highlight ruby %} defmodule MyProject.MixFile do use Mix.Project - + def project do [ app: :my_project, version: "0.0.1", @@ -81,7 +81,7 @@ Code.require_file "../test_helper", __FILE__ defmodule MyProjectTest do use ExUnit.Case - + test "the truth" do assert true end @@ -137,7 +137,7 @@ You can also note that, after you compile for the first time, Mix generates an ` ## 4 Tasks -In Mix, a task is simply an Elixir module named with a `Mix.Tasks` prefix and a `run/1` function. For example, the `compile` task is a module named `Mix.Tasks.Compile`. +In Mix, a task is simply an Elixir module inside the `Mix.Tasks` namespace and a `run/1` function. For example, the `compile` task is a module named `Mix.Tasks.Compile`. Here is a simple example task: @@ -162,7 +162,7 @@ When you invoke `mix hello`, this task will run and print `Hello, World!`. Mix u You're probably wondering why we have a `@moduledoc` and `@shortdoc`. Both are used by the `help` task for listing tasks and providing documentation of them. The former is used when `mix help TASK` is invoked, the latter in the general listing with `mix help`. -Besides those two, there is also `@hidden` that, when set to true, marks the task as hidden so it does not show up on `mix help Task`. Any task without `@shortdoc` also won't show up. +Besides those two, there is also `@hidden` attribute that, when set to true, marks the task as hidden so it does not show up on `mix help Task`. Any task without `@shortdoc` also won't show up. ### 4.1 Common API @@ -265,7 +265,7 @@ Elixir has many tasks to manage such dependencies: * `mix deps.compile` - Compile dependencies; * `mix deps.update` - Update dependencies; * `mix deps.clean` - Remove dependencies files; -* `mix deps.unlock` - Remove specific locks; +* `mix deps.unlock` - Unlock the given dependencies; Use `mix help` to get more information. @@ -291,6 +291,22 @@ In some situations, it is desired to execute more than one task at once. For thi For instance, the command above will show help information for the compile task and then print the list of available compilers. -## 8 Lots To Do +## 8 OptionParser + +Although not a Mix feature, Elixir ships with an `OptionParser` which is quite useful when creating mix tasks that accepts options. The `OptionParser` receives the argv and returns a tuple with parsed options and the remaining arguments: + + + OptionParser.parse(["--debug"]) + #=> { [debug: true], [] } + + OptionParser.parse(["--source", "lib"]) + #=> { [source: "lib"], [] } + + OptionParser.parse(["--source", "lib", "test/enum_test.exs", "--verbose"]) + #=> { [source: "lib", verbose: true], ["test/enum_test.exs"] } + +Check [`OptionParser`](/docs/latest/OptionParser.html) documentation for more information. + +## 9 Lots To Do Mix is still a work in progress. Feel free to visit [our issues tracker](https://github.com/elixir-lang/elixir/issues) to add issues for anything you'd like to see in Mix and feel free to contribute. \ No newline at end of file From eca5827a2329507748df709cbcc814b01a3bd114 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sun, 29 Jul 2012 14:12:02 +0200 Subject: [PATCH 206/437] Shorted links, improve style --- getting_started/2.markdown | 8 ++++---- getting_started/3.markdown | 6 +++--- getting_started/5.markdown | 2 +- getting_started/6.markdown | 8 ++++---- getting_started/ex_unit.markdown | 6 +++--- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/getting_started/2.markdown b/getting_started/2.markdown index eb99f604d..a5d1d17c9 100644 --- a/getting_started/2.markdown +++ b/getting_started/2.markdown @@ -44,7 +44,7 @@ Since updating a tuple is expensive, when we want to add or remove elements, we iex> length [head | tail] 3 -In the example above, we have assigned the head of the list to the variable `head` and the tail of the list to the variable `tail`. The [`Enum` module](http://elixir-lang.org/docs/latest/Enum.html) provides several helpers to manipulate lists (and other enumerables in general) while the [`List` module](http://elixir-lang.org/docs/latest/List.html) provides several helpers specific to lists: +In the example above, we have assigned the head of the list to the variable `head` and the tail of the list to the variable `tail`. The [`Enum` module](/docs/latest/Enum.html) provides several helpers to manipulate lists (and other enumerables in general) while the [`List` module](/docs/latest/List.html) provides several helpers specific to lists: iex> Enum.map [1,2,3], fn(x) -> x * 2 end [2,4,6] @@ -68,7 +68,7 @@ The reason for such ordering is faster access. Differently from dictionaries, ke iex> [foo: 1, bar: 2, foo: 3] [{:bar,2},{:foo,1},{:foo,3}] -The [`Keyword` module](http://elixir-lang.org/docs/latest/Keyword.html) contains several functions that allows a developer to manipulate a keywords list ignoring such duplicated entries or not. For example: +The [`Keyword` module](/docs/latest/Keyword.html) contains several functions that allows a developer to manipulate a keywords list ignoring such duplicated entries or not. For example: iex> keywords = [foo: 1, bar: 2, foo: 3] iex> Keyword.get keywords, :foo @@ -544,7 +544,7 @@ For catching exceptions in Elixir, we can use `rescue` instead of `catch`. Besid x -> x.message end -Custom exceptions can be defined using the `defexception` macro. You can check a list of defined exceptions in [our documentations page](http://elixir-lang.org/docs/latest/), by clicking "Records" in the upper left corner. +Custom exceptions can be defined using the `defexception` macro. You can check a list of defined exceptions in [our documentations page](/docs/latest/), by clicking "Records" in the upper left corner. ### 2.7.8 Receive @@ -583,6 +583,6 @@ Notice we spawned a new function using the `spawn` function passing another func ## 2.8 Built-in functions -Elixir ships with many built-in functions automatically available in the current scope. Besides all the control flow expressions seen above, Elixir also adds: `elem` and `setelem` to read and set values in tuples, `inspect` that returns the representation of a given data type as string and many others. All these functions imported by default are available in `Kernel`](http://elixir-lang.org/docs/latest/Kernel.html) and [Elixir special forms are available in `Kernel.SpecialForms`](http://elixir-lang.org/docs/latest/Kernel.SpecialForms.html). +Elixir ships with many built-in functions automatically available in the current scope. Besides all the control flow expressions seen above, Elixir also adds: `elem` and `setelem` to read and set values in tuples, `inspect` that returns the representation of a given data type as string and many others. All these functions imported by default are available in [`Kernel`](/docs/latest/Kernel.html) and [Elixir special forms are available in `Kernel.SpecialForms`](/docs/latest/Kernel.SpecialForms.html). All those functions and control flow expressions are essential for building Elixir programs. The next chapter will discuss how to organize our code into modules, so it can be easily re-used between different components. \ No newline at end of file diff --git a/getting_started/3.markdown b/getting_started/3.markdown index af8f2f88f..446828187 100644 --- a/getting_started/3.markdown +++ b/getting_started/3.markdown @@ -184,7 +184,7 @@ Then, we add the head of the list to the accumulator `h + acc` and call `sum_lis When the list is empty, it will match the final clause which returns the final result of `6`. In imperative languages, such implementation would usually fail for large lists because the stacktrace (a stack which keeps our execution path) would grown until it reaches a limit. Erlang however does last call optimization in which the stack does not grow when a function exits by calling another function. -Recursion and last call optimization are an important part of Erlang and are commonly used to create loops, specially in cases where a process needs to wait and respond to messages (using the `receive` macro we saw in the previous chapter). However, recursion as above is rarely used to manipulate lists, since [the `Enum` module](http://elixir-lang.org/docs/latest/Enum.html) already abstracts such use cases. For instance, the example above could be simply written as: +Recursion and last call optimization are an important part of Erlang and are commonly used to create loops, specially in cases where a process needs to wait and respond to messages (using the `receive` macro we saw in the previous chapter). However, recursion as above is rarely used to manipulate lists, since [the `Enum` module](/docs/latest/Enum.html) already abstracts such use cases. For instance, the example above could be simply written as: Enum.reduce([1,2,3], 0, fn(x, acc) -> x + acc end) @@ -314,7 +314,7 @@ Besides the built-in attributes outlined above, any developer can also add custo IO.inspect @my_data #=> 13 end -Differently from Erlang, user defined attributes are not stored in the module by default since it is common in Elixir to use such attributes to store temporary data. A developer can configure an attribute to behave closer to Erlang by calling [`Module.register_attribute/2`](http://elixir-lang.org/docs/Module.html#register_attribute/2). +Differently from Erlang, user defined attributes are not stored in the module by default since it is common in Elixir to use such attributes to store temporary data. A developer can configure an attribute to behave closer to Erlang by calling [`Module.register_attribute/2`](/docs/Module.html#register_attribute/2). Finally notice that attributes can also be read inside functions: @@ -328,7 +328,7 @@ Finally notice that attributes can also be read inside functions: MyServer.first_data #=> 11 MyServer.second_data #=> 13 -From the example above we can notice that reading an attribute inside a function takes a snapshot of its current value. In other words, the value is read at compilation time and not at runtime. Check [the documentation for the module `Module` documentation](http://elixir-lang.org/docs/Module.html) for other functions to manipulate module attributes. +From the example above we can notice that reading an attribute inside a function takes a snapshot of its current value. In other words, the value is read at compilation time and not at runtime. Check [the documentation for the module `Module` documentation](/docs/Module.html) for other functions to manipulate module attributes. ## 3.7 Nesting diff --git a/getting_started/5.markdown b/getting_started/5.markdown index afea79bc0..a74ec8535 100644 --- a/getting_started/5.markdown +++ b/getting_started/5.markdown @@ -94,7 +94,7 @@ Which would fail because the clause and options variables are not defined in the In other words, unquote is a mechanism to inject expressions into the tree being quoted and it is an essential tool for meta-programming. Elixir also provides `unquote_splicing` allowing us to inject many expressions at once. -We can define any macro we want, including ones that override the built-in macros provided by Elixir. For instance, you can redefine `case`, `receive`, `+`, etc. The only exceptions are Elixir special forms that cannot be overridden, [the full list of special forms is available in `Elixir.SpecialForms`](http://elixir-lang.org/docs/latest/Elixir.SpecialForms.html). +We can define any macro we want, including ones that override the built-in macros provided by Elixir. For instance, you can redefine `case`, `receive`, `+`, etc. The only exceptions are Elixir special forms that cannot be overridden, [the full list of special forms is available in `Elixir.SpecialForms`](/docs/latest/Elixir.SpecialForms.html). ## 5.3 Macros hygiene diff --git a/getting_started/6.markdown b/getting_started/6.markdown index 0e0fead1e..3f5b50782 100644 --- a/getting_started/6.markdown +++ b/getting_started/6.markdown @@ -19,7 +19,7 @@ Sigils starting with uppercase letter never escaper characters nor interpret int %b-another binary- -Internally, `%b` is translated as a function call to `__b__`. For instance, the docs for `%b` are available [in the function `__b__/1` defined in `Kernel` module](http://elixir-lang.org/docs/Kernel.html#__b__/1). +Internally, `%b` is translated as a function call to `__b__`. For instance, the docs for `%b` are available [in the function `__b__/1` defined in `Kernel` module](/docs/Kernel.html#__b__/1). The sigils defined in Elixir by default are: @@ -161,7 +161,7 @@ Since operators are also function calls they can also be partially applied: iex> Enum.map [1,2,3], &1 * 2 [2,4,6] -All functions can be partially applied, except [Elixir's special forms](http://elixir-lang.org/docs/latest/Kernel.SpecialForms.html). +All functions can be partially applied, except [Elixir's special forms](/docs/latest/Kernel.SpecialForms.html). ## 6.6 Use @@ -238,8 +238,8 @@ Elixir provides a set of pseudo-variables. Those variables can only be read and * `__MODULE__` - Returns an atom representing the current module or nil; * `__FILE__` - Returns a string representing the current file; -* `__ENV__` - Returns a [Macro.Env](http://elixir-lang.org/docs/Macro.Env.html) record with information about the compilation environment. Here we can access the current module, function, line, file and others; -* `__CALLER__` - Also returns a [Macro.Env](http://elixir-lang.org/docs/Macro.Env.html) record but with information of the calling site. `__CALLER__` is available only inside macros; +* `__ENV__` - Returns a [Macro.Env](/docs/Macro.Env.html) record with information about the compilation environment. Here we can access the current module, function, line, file and others; +* `__CALLER__` - Also returns a [Macro.Env](/docs/Macro.Env.html) record but with information of the calling site. `__CALLER__` is available only inside macros; ## 6.9 Native compilation diff --git a/getting_started/ex_unit.markdown b/getting_started/ex_unit.markdown index 503c2b882..583b784f2 100644 --- a/getting_started/ex_unit.markdown +++ b/getting_started/ex_unit.markdown @@ -31,7 +31,7 @@ In this chapter, we will discuss the most common features available in ExUnit an ## 2 ExUnit -ExUnit is started using `ExUnit.start`. This function accepts a couple options, so [check its documentation](http://elixir-lang.org/docs/latest/ExUnit.html) for more details. For now, we will just detail the most common ones: +ExUnit is started using `ExUnit.start`. This function accepts a couple options, so [check its documentation](/docs/latest/ExUnit.html) for more details. For now, we will just detail the most common ones: * `:formatter` - When you run tests with ExUnit, all the IO is done by [the formatter](https://github.com/elixir-lang/elixir/blob/master/lib/ex_unit/lib/ex_unit/formatter.ex). Developers can define their own formatters and this is the configuration that tells ExUnit to use a custom formatter; @@ -79,7 +79,7 @@ Which is more legible. The test macro accepts either a binary or an atom as name ### 3.3 Assertions -Another convenience provided by `ExUnit.Case` is to automatically import a set of assertion macros and functions, available in [`ExUnit.Assertions`](http://elixir-lang.org/docs/latest/ExUnit.Assertions.html). +Another convenience provided by `ExUnit.Case` is to automatically import a set of assertion macros and functions, available in [`ExUnit.Assertions`](/docs/latest/ExUnit.Assertions.html). In the majority of tests, the only assertion macros you will need to use are `assert` and `refute`: @@ -106,7 +106,7 @@ assert_raise ArithmeticError, "bad argument in arithmetic expression", fn -> end {% endhighlight %} -So don't forget to check [`ExUnit.Assertions`' documentation](http://elixir-lang.org/docs/latest/ExUnit.Assertions.html) for more examples. +So don't forget to check [`ExUnit.Assertions`' documentation](/docs/latest/ExUnit.Assertions.html) for more examples. ### 3.4 Callbacks From f0bba133e557cd16ea2ef18fc79d7de298779f50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Mon, 30 Jul 2012 10:41:06 +0200 Subject: [PATCH 207/437] Update mix docs, add a hello.beam --- getting_started/mix.markdown | 31 ++++++++++++++++++++++++------- hello.beam | Bin 0 -> 1060 bytes hello.ex | 7 +++++++ 3 files changed, 31 insertions(+), 7 deletions(-) create mode 100644 hello.beam create mode 100644 hello.ex diff --git a/getting_started/mix.markdown b/getting_started/mix.markdown index 606a21f91..ce601e992 100644 --- a/getting_started/mix.markdown +++ b/getting_started/mix.markdown @@ -221,17 +221,34 @@ end **Note:** Although not required, it is common to split dependencies into their own function; -Besides `:git`, it accepts other options: +### 5.1 Source Code Management (SCM) + +In the example above, we have used `git` to specify our dependency. Mix was designed in a way it can support multiple SCM tools, by default it ships with `:git` and `:raw`. The most common options are: + +* `:git` - the dependency is a git repository that is retrieved and updated by Mix; +* `:raw` - the dependency is simply a raw path in the filesystem; +* `:compile` - how to compile the dependency, more information in the next section; + +Each SCM may support custom options. `:git` supports the following: * `:ref` - an optional reference (a commit) to checkout the git repository; * `:tag` - an optional tag to checkout the git repository; * `:branch` - an optional branch to checkout the git repository; * `:submodules` - when true, initializes submodules recursively in the dependency; -* `:compile` - how to compile the dependency. If the project contains a `mix.exs` file, or `rebar.config` or a `Makefile`, Elixir will invoke one of them. If not, you can specify a command directly: + +### 5.2 Compiling dependencies + +In order to compile a dependency, Mix looks into the repository for the best way to proceed. If the dependency contains one of the files below, it will proceed as follows: + +1. `mix.exs` - compiles the dependency directly with Mix; +2. `rebar.config` or `rebar.config.script` - compiles using `rebar compile deps_dir=DEPS`, where `DEPS` is the directory where Mix install by default the project dependencies; +3. `Makefile` - simply invokes `make` + +If the dependency does not contain any of the above, you can specify a command directly with the `:compile` option compile: "./configure && make" - You could also pass an atom to `:compile`, in such cases, a function with the name of the atom will be invoked in your current project passing the app name, allowing you to further customize its compilation: +You could also pass an atom to `:compile` and, in such cases, a function with the name of the atom will be invoked in your current project with the app name as argument, allowing you to customize its compilation: def project do [ @@ -246,9 +263,9 @@ Besides `:git`, it accepts other options: # ... end - Finally, if `:noop` is given to `:compile` nothing is done. +Finally, if `:noop` is given to `:compile`, nothing is done. -### 5.1 Repeatability +### 5.3 Repeatability An important feature in any dependency management tool is repeatability. For this reason when you first get your dependencies, Mix will create a file called `mix.lock` that contains in which reference each dependency is checked out. @@ -256,7 +273,7 @@ When another developer gets a copy of the same project, Mix will checkout exactl Locks are automatically updated when `deps.update` is called and can be removed with `deps.unlock`. -### 5.2 Tasks +### 5.4 Tasks Elixir has many tasks to manage such dependencies: @@ -271,7 +288,7 @@ Use `mix help` to get more information. ## 6 Local tasks -Elixir also ships with the ability of providing local tasks. Local tasks can be install from any URL and are available from anywhere within Elixir: +Elixir also ships with the ability to manage local tasks. Local tasks can be installed from any URL and are available from anywhere within Elixir: $ mix local.install http://elixir-lang/hello.beam diff --git a/hello.beam b/hello.beam new file mode 100644 index 0000000000000000000000000000000000000000..c1824473a5a35f84cb6df14b862d9d3a87895f87 GIT binary patch literal 1060 zcmbVL-Afcv6u&dG?yhDzu4X|YOJ5k`&aNm4zRW7ChHm8-R#5Bg?p=4**}3b?tZft( zeLQGEidak(hLJub85KeF;!9vYge6%)W%LJxDLzHixua1&)`8zWXU@In{LUSIx9(tz z4GvF zqUza65=|=@k~SSHF?&*qXhe5JNHQfWc+*<5Mtt%F(W2QgjU+=@O(!`mt>*k;%F^RN zVxtTjRvTJucC0Cq+LhOZjnH3dR7;{5W_=9c0n|(Yjcp8X@~mqI&$zwATs1emWvaZg zCeYFz##;LPCB`e(Bd&lE#d;pxA+g>Ku2Xcuni5%9&*dT{p65*7#;=&X6M8ZOc7BDq zZMs?4L!Nm6`=-}{c#$g*zw8w2y`1Uo;Sn=sBG$Epm|19Mq655}`D|r)W|1DXl5Q{8 zYG`eA;Qh%I^%ZnxKsF!;zyN>&Z3IxGcghFQ{O_0zWY*Q@t?g4!L5*|nH$ zk`2mx8E`LiGjJuC!}@aT=3eGHkB=6M$ND-Ji+0a0_~vS=xv!^sTA!ts2TuzE@^Vv; z^2eQx1NJd(S7Ft1bYfd)x!ag5I{WTuM{MuwnWi6Y@1GCN`<_lz_Wv9?qpSYWt(zvV zKI!=sx>i!!u{72@K{mI39Gt%K>PY{{;rka~ENI`Z3rb&U18O1>Iurd5$Zr@LxZni^ zRyNK?5!b7$^n+1(H2?ihZR6cr{M(YDLix>1FhLJE!#FPW%0#nHMN!@#VObJRB%r!> zzZwHKZS}R$G6zXn61J*n!mg9F7Qx+UpU|#jO&1bG$3h3ux`i&;h^NB>UVR%>l%Ca; z2b3;Q@e&WtSkpLqp%k7*H_EE;RC#=~v(1o`IBpLk!W*V;<)e#3^T>1Xy|Go?~_yu0)BBuZV literal 0 HcmV?d00001 diff --git a/hello.ex b/hello.ex new file mode 100644 index 000000000..9ab893d56 --- /dev/null +++ b/hello.ex @@ -0,0 +1,7 @@ +defmodule Mix.Tasks.Hello do + use Mix.Task + + def run(_) do + Mix.shell.info "Hello from task installed from elixir-lang.org!" + end +end \ No newline at end of file From 2ab07b802399772ccf65103743446ef30597e74f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Tue, 31 Jul 2012 15:08:08 +0200 Subject: [PATCH 208/437] Add information about running mix --- getting_started/mix.markdown | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/getting_started/mix.markdown b/getting_started/mix.markdown index ce601e992..3c8873e02 100644 --- a/getting_started/mix.markdown +++ b/getting_started/mix.markdown @@ -28,6 +28,16 @@ Mix will create a directory named `my_project` with few files in it: Let's take a brief look at some of these. +> Mix is an Elixir executable. This means that in order to run `mix`, you need to have elixir's executable in your PATH. If not, you can run it by passing the script as argument to elixir: +> +> bin/elixir bin/mix new ./my_project +> +> Note that you can also execute any script in your PATH from Elixir via the -S option: +> +> bin/elixir -S mix new ./my_project +> +> When using -S, elixir finds the script wherever it is in your PATH and executes it. + ### 1.1 mix.exs This is the file with your projects configuration. It looks like this: From c29fc843fde2544c0e2804d478588cbd9d55d7d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Tue, 31 Jul 2012 15:15:17 +0200 Subject: [PATCH 209/437] Update docs --- docs/master/Binary.Chars.html | 2 +- docs/master/Binary.Inspect.Any.html | 4 +- docs/master/Binary.Inspect.BitString.html | 4 +- docs/master/Binary.Inspect.List.html | 6 +- docs/master/Binary.Inspect.Number.html | 4 +- docs/master/Binary.Inspect.Regex.html | 4 +- docs/master/Binary.Inspect.Tuple.html | 4 +- docs/master/Binary.html | 13 +- docs/master/Code.html | 98 +- docs/master/Dict.HashDict.Record.html | 200 - docs/master/Dict.Orddict.Record.html | 200 - docs/master/Dict.html | 4 +- docs/master/EEx.ForEngine.html | 65 - docs/master/EEx.SmartEngine.html | 14 +- docs/master/EEx.TransformerEngine.html | 4 +- docs/master/EEx.html | 38 +- docs/master/Elixir.Builtin.html | 3352 ----------------- docs/master/Elixir.ParallelCompiler.html | 93 - docs/master/Elixir.ParallelRequire.html | 75 - docs/master/Elixir.SpecialForms.html | 708 ---- docs/master/Elixir.Typespec.html | 147 - .../master/Enum.Iterator.HashDict.Record.html | 79 - docs/master/Enum.Iterator.List.html | 6 +- docs/master/Enum.Iterator.Orddict.Record.html | 79 - docs/master/Enum.Iterator.html | 10 +- docs/master/Enum.OrdIterator.List.html | 6 +- .../Enum.OrdIterator.Orddict.Record.html | 79 - docs/master/Enum.OrdIterator.html | 8 +- docs/master/Enum.html | 4 +- docs/master/ExUnit.Assertions.html | 239 +- docs/master/ExUnit.Case.html | 11 +- docs/master/ExUnit.html | 16 +- docs/master/File.html | 184 +- docs/master/HashDict.html | 8 +- docs/master/IEx.Helpers.html | 110 +- docs/master/IEx.UnicodeIO.html | 4 +- docs/master/IEx.html | 41 +- docs/master/List.Chars.html | 2 +- docs/master/List.html | 32 +- docs/master/Macro.html | 2 +- docs/master/Mix.Project.html | 23 +- docs/master/Mix.Shell.Test.html | 104 - docs/master/Mix.Shell.html | 16 +- docs/master/Mix.Task.html | 33 +- docs/master/Mix.Tasks.Compile.Elixir.html | 6 +- docs/master/Mix.Tasks.Compile.html | 13 +- docs/master/Mix.Tasks.Loadpaths.html | 16 +- docs/master/Mix.Utils.html | 131 +- docs/master/Mix.html | 47 +- docs/master/Module.html | 112 +- docs/master/Node.html | 65 + docs/master/OptionParser.Simple.html | 86 - docs/master/Orddict.html | 8 +- docs/master/Process.html | 202 +- docs/master/Record.html | 2 +- docs/master/Regex.html | 79 +- docs/master/modules_list.html | 2742 +++++++++----- docs/master/protocols_list.html | 358 +- docs/master/records_list.html | 437 ++- 59 files changed, 3362 insertions(+), 7077 deletions(-) delete mode 100644 docs/master/Dict.HashDict.Record.html delete mode 100644 docs/master/Dict.Orddict.Record.html delete mode 100644 docs/master/EEx.ForEngine.html delete mode 100644 docs/master/Elixir.Builtin.html delete mode 100644 docs/master/Elixir.ParallelCompiler.html delete mode 100644 docs/master/Elixir.ParallelRequire.html delete mode 100644 docs/master/Elixir.SpecialForms.html delete mode 100644 docs/master/Elixir.Typespec.html delete mode 100644 docs/master/Enum.Iterator.HashDict.Record.html delete mode 100644 docs/master/Enum.Iterator.Orddict.Record.html delete mode 100644 docs/master/Enum.OrdIterator.Orddict.Record.html delete mode 100644 docs/master/Mix.Shell.Test.html delete mode 100644 docs/master/OptionParser.Simple.html diff --git a/docs/master/Binary.Chars.html b/docs/master/Binary.Chars.html index f150953dc..f25f13800 100644 --- a/docs/master/Binary.Chars.html +++ b/docs/master/Binary.Chars.html @@ -35,7 +35,7 @@

      to_binary which does the conversion.

      The to_binary function automatically imported -by Elixir.Builtin invokes this protocol. String +by Kernel invokes this protocol. String interpolation also invokes to_binary in its arguments. For example, "foo#{bar}" is the same as "foo" <> to_binary(bar).

      diff --git a/docs/master/Binary.Inspect.Any.html b/docs/master/Binary.Inspect.Any.html index a9aa95d0b..8bd40dd40 100644 --- a/docs/master/Binary.Inspect.Any.html +++ b/docs/master/Binary.Inspect.Any.html @@ -29,7 +29,7 @@

      - Source + Source @@ -64,7 +64,7 @@

      Examples

      inspect Process.self #=> "<0.35.0>"
       
      - Source + Source diff --git a/docs/master/Binary.Inspect.BitString.html b/docs/master/Binary.Inspect.BitString.html index a6eac79a4..b927a4052 100644 --- a/docs/master/Binary.Inspect.BitString.html +++ b/docs/master/Binary.Inspect.BitString.html @@ -29,7 +29,7 @@

      - Source + Source @@ -65,7 +65,7 @@

      Examples

      inspect("f\"oo") #=> "f\"oo" - Source + Source diff --git a/docs/master/Binary.Inspect.List.html b/docs/master/Binary.Inspect.List.html index 99c68909e..f737fe5bb 100644 --- a/docs/master/Binary.Inspect.List.html +++ b/docs/master/Binary.Inspect.List.html @@ -29,7 +29,7 @@

      - Source + Source @@ -62,7 +62,7 @@

      Functions

      container_join(list1, acc, last)

      - Source + Source

      inspect(thing) @@ -84,7 +84,7 @@

      Examples

      inspect([:foo,:bar]) #=> "[:foo, :bar]"
      - Source + Source diff --git a/docs/master/Binary.Inspect.Number.html b/docs/master/Binary.Inspect.Number.html index 36239311c..4b3591776 100644 --- a/docs/master/Binary.Inspect.Number.html +++ b/docs/master/Binary.Inspect.Number.html @@ -29,7 +29,7 @@

      - Source + Source @@ -63,7 +63,7 @@

      Examples

      inspect(1) #=> "1"
       
      - Source + Source diff --git a/docs/master/Binary.Inspect.Regex.html b/docs/master/Binary.Inspect.Regex.html index 869a63710..009614b88 100644 --- a/docs/master/Binary.Inspect.Regex.html +++ b/docs/master/Binary.Inspect.Regex.html @@ -29,7 +29,7 @@

      - Source + Source @@ -63,7 +63,7 @@

      Examples

      inspect(%r/foo/m) #=> "%r\"foo\"m"
       
      - Source + Source diff --git a/docs/master/Binary.Inspect.Tuple.html b/docs/master/Binary.Inspect.Tuple.html index 34afbca29..19410ccab 100644 --- a/docs/master/Binary.Inspect.Tuple.html +++ b/docs/master/Binary.Inspect.Tuple.html @@ -29,7 +29,7 @@

      - Source + Source @@ -65,7 +65,7 @@

      Examples

      inspect(ArgumentError.new) #=> ArgumentError[message: "argument error"] - Source + Source diff --git a/docs/master/Binary.html b/docs/master/Binary.html index 630bc8c5f..d9925ff26 100644 --- a/docs/master/Binary.html +++ b/docs/master/Binary.html @@ -159,6 +159,11 @@

      Map

      If the unescape_map function returns false. The char is not escaped and \ is kept in the char list.

      +

      Octals

      + +

      Octals will by default be escaped unless the map function +returns false for ?0.

      +

      Examples

      Using the unescape_map defined above is easy:

      @@ -166,7 +171,7 @@

      Examples

      Binary.unescape "example\\n", unescape_map(&1)
       
      - Source + Source

      unescape_tokens(tokens) @@ -176,9 +181,9 @@

      Examples

      about unescaping. Only tokens that are char lists are unescaped, all others are ignored. This method is useful when implementing your own sigils. Check the implementation -of Elixir.Builtin.__b__ for examples.

      +of Kernel.__b__ for examples.

      - Source + Source

      unescape_tokens(tokens, map) @@ -186,7 +191,7 @@

      Examples

      Unescape the given tokens according to the given map. Check unescape_tokens/1 and unescaped/2 for more information.

      - Source + Source
      diff --git a/docs/master/Code.html b/docs/master/Code.html index a80206537..752c40315 100644 --- a/docs/master/Code.html +++ b/docs/master/Code.html @@ -30,6 +30,9 @@

      The Code module is responsible to manage code compilation, code evaluation and code loading.

      +

      It complements (Erlang's code module)1 to add behavior +which is specific to Elixir.

      + @@ -62,6 +65,11 @@

      Functions summary

      compiler_options/1
    1. +
    2. + + ensure_compiled/1 + +
    3. ensure_loaded/1 @@ -120,9 +128,10 @@

      Functions

      append_path(path)

      -

      Appends a path to Erlang VM code path.

      +

      Appends a path to Erlang VM code path. +The path is expanded with File.expand_path before added.

      - Source + Source

      compile_string(string, file // "nofile") @@ -131,9 +140,9 @@

      Functions

      the first element is the module name and the second one is its binary.

      -

      For compiling many files at once, check Elixir.ParallelCompiler.

      +

      For compiling many files at once, check Kernel.ParallelCompiler.

      - Source + Source

      compiler_options() @@ -141,7 +150,7 @@

      Functions

      Loads the compilation options from the code server. Check compiler_options/1 for more information.

      - Source + Source

      compiler_options(opts) @@ -161,18 +170,66 @@

      Functions

      without raising errors, false by default;
    4. - Source + Source +
      +

      + ensure_compiled(module) +

      +

      Ensures the given module is compiled and loaded. If the module +is already loaded, it works as no-op. If the module was not +loaded yet, it checks if it needs to be compiled first and just +then tries to load it.

      + +

      If it succeeds loading the module anyhow, it returns +{ :module, module }. If not, returns { :error, reason } with +the error reason.

      + +

      Check ensure_loaded/1 for more information on module loading +and when to use ensure_loaded/1 or ensure_compiled/1.

      +
      + Source

      ensure_loaded(module)

      -

      Ensure if the given module is loaded. If the module is already loaded, -it works as no-op. If the module was not loaded yet, it tries to load it.

      +

      Ensures the given module is loaded. If the module is already +loaded, it works as no-op. If the module was not loaded yet, +it tries to load it.

      -

      If it succeeds loading the module anyhow, it returns { :module, module }. -If not, returns { :error, reason } with the error reason.

      +

      If it succeeds loading the module anyhow, it returns +{ :module, module }. If not, returns { :error, reason } with +the error reason.

      + +

      Code loading on the Erlang VM

      + +

      Erlang has two modes to load code: interactive and embedded.

      + +

      By default, the Erlang VM runs on interactive mode, where modules +are loaded as needed. In embedded mode the opposite happens, as all +modules need to be loaded upfront or explicitly.

      + +

      Therefore, this function is useful to check if a module is loaded +before using it and react accordingly. For example, the URI module +uses this function to check if a specific parser exists and is for the +given URI scheme.

      + +

      Code.ensure_compiled

      + +

      Elixir also contains an ensure_compiled/1 function that is a +superset of ensure_loaded/1.

      + +

      Since Elixir's compilation happens in parallel, in some situations +you may need to use a module but it was not compiled yet, therefore +it can't even be loaded.

      + +

      ensure_compiled/1 puts a halt in the current process until the +module we are depending on is available.

      + +

      In most of the cases, ensure_loaded is enough. ensure_compiled +must be used just in same rare conditions, usually involving macros +that needs to invoke a module for callback information.

      - Source + Source

      eval(string, binding // [], opts // []) @@ -201,7 +258,7 @@

      Examples

      #=> { 3, [ {:a, 1}, {:b, 2} ] }
      - Source + Source

      eval_quoted(quoted, binding // [], opts // []) @@ -234,7 +291,7 @@

      Examples

      #=> { 3, [ {:a, 1}, {:b, 2} ] }
      - Source + Source

      load_file(file, relative_to // nil) @@ -246,21 +303,22 @@

      Examples

      When loading a file, you may skip passing .exs as extension as Elixir automatically adds it for you.

      - Source + Source

      loaded_files()

      Returns all the loaded files.

      - Source + Source

      prepend_path(path)

      -

      Prepends a path to Erlang VM code path.

      +

      Prepends a path to Erlang VM code path. +The path is expanded with File.expand_path before added.

      - Source + Source

      require_file(file, relative_to // nil) @@ -272,7 +330,7 @@

      Examples

      When requiring a file, you may skip passing .exs as extension as Elixir automatically adds it for you.

      - Source + Source

      string_to_ast(string, opts // []) @@ -288,7 +346,7 @@

      Options

    5. :line - The line reported in the ENV variable.

    6. - Source + Source

      string_to_ast!(string, opts // []) @@ -306,7 +364,7 @@

      Options

    7. :line - The line reported in the ENV variable.

    8. - Source + Source diff --git a/docs/master/Dict.HashDict.Record.html b/docs/master/Dict.HashDict.Record.html deleted file mode 100644 index 3a480d354..000000000 --- a/docs/master/Dict.HashDict.Record.html +++ /dev/null @@ -1,200 +0,0 @@ - - - - Dict.HashDict.Record - - - - - - - - - - - - -
      -

      - Dict.HashDict.Record - - impl - -

      - - - - Source - - - - - - -

      Functions summary

      - - - - - - -
      -

      Functions

      -
      -

      - delete(arg1, key) -

      -
      - Source -
      -

      - empty(_) -

      -
      - Source -
      -

      - get(arg1, key, default // nil) -

      -
      - Source -
      -

      - has_key?(arg1, key) -

      -
      - Source -
      -

      - keys(arg1) -

      -
      - Source -
      -

      - merge(arg1, arg2) -

      -
      - Source -
      -

      - merge(arg1, arg2, fun) -

      -
      - Source -
      -

      - put(arg1, key, value) -

      -
      - Source -
      -

      - size(arg1) -

      -
      - Source -
      -

      - to_list(arg1) -

      -
      - Source -
      -

      - update(arg1, key, fun) -

      -
      - Source -
      -

      - update(arg1, key, initial, fun) -

      -
      - Source -
      -

      - values(arg1) -

      -
      - Source -
      -
      - - - -
      - - diff --git a/docs/master/Dict.Orddict.Record.html b/docs/master/Dict.Orddict.Record.html deleted file mode 100644 index 4ad0795a7..000000000 --- a/docs/master/Dict.Orddict.Record.html +++ /dev/null @@ -1,200 +0,0 @@ - - - - Dict.Orddict.Record - - - - - - - - - - - - -
      -

      - Dict.Orddict.Record - - impl - -

      - - - - Source - - - - - - -

      Functions summary

      - - - - - - -
      -

      Functions

      -
      -

      - delete(arg1, key) -

      -
      - Source -
      -

      - empty(_) -

      -
      - Source -
      -

      - get(arg1, key, default // nil) -

      -
      - Source -
      -

      - has_key?(arg1, key) -

      -
      - Source -
      -

      - keys(arg1) -

      -
      - Source -
      -

      - merge(arg1, arg2) -

      -
      - Source -
      -

      - merge(arg1, arg2, fun) -

      -
      - Source -
      -

      - put(arg1, key, value) -

      -
      - Source -
      -

      - size(arg1) -

      -
      - Source -
      -

      - to_list(arg1) -

      -
      - Source -
      -

      - update(arg1, key, fun) -

      -
      - Source -
      -

      - update(arg1, key, initial, fun) -

      -
      - Source -
      -

      - values(arg1) -

      -
      - Source -
      -
      - - - -
      - - diff --git a/docs/master/Dict.html b/docs/master/Dict.html index da296f58b..ac36c91fe 100644 --- a/docs/master/Dict.html +++ b/docs/master/Dict.html @@ -44,13 +44,13 @@

      Implementations

    9. - HashDict.Record + HashDict
    10. - Orddict.Record + Orddict
    11. diff --git a/docs/master/EEx.ForEngine.html b/docs/master/EEx.ForEngine.html deleted file mode 100644 index 95096676e..000000000 --- a/docs/master/EEx.ForEngine.html +++ /dev/null @@ -1,65 +0,0 @@ - - - - EEx.ForEngine - - - - - - - - - - - - -
      -

      - EEx.ForEngine - -

      - - -
      -

      An abstract engine that, when used with the -TransformerEngine, allows a developer to easily loop -using for.

      - -

      This engine is included by default on the SmartEngine.

      - -

      Examples

      - -
      defmodule MyEngine do
      -  use EEx.TransformerEngine
      -  use EEx.ForEngine
      -end
      -
      -EEx.eval_string("<%= for x in [1,2,3] do %><%= x %>\n<% end %>", assigns: [foo: 1])
      -#=> "1\n2\n3\n"
      -
      - -
      - - - Source - - - - - - - - - - - - -
      - - diff --git a/docs/master/EEx.SmartEngine.html b/docs/master/EEx.SmartEngine.html index 1646b5873..aa28a9bba 100644 --- a/docs/master/EEx.SmartEngine.html +++ b/docs/master/EEx.SmartEngine.html @@ -27,16 +27,14 @@

      -

      An engine meant for end-user usage that includes both -AssignsEngine and ForEngine conveniences. Therefore, -a developer can easily access assigns via @ and loop -using for. Read EEx.AssignsEngine and EEx.ForEngine -for examples.

      +

      An engine meant for end-user usage that includes +AssignsEngine and other conveniences. Read +EEx.AssignsEngine for examples.

      - Source + Source @@ -69,13 +67,13 @@

      Functions

      handle_expr(buffer, mark, expr)

      - Source + Source

      handle_text(buffer, text)

      - Source + Source
      diff --git a/docs/master/EEx.TransformerEngine.html b/docs/master/EEx.TransformerEngine.html index 3325e82c5..c1658e032 100644 --- a/docs/master/EEx.TransformerEngine.html +++ b/docs/master/EEx.TransformerEngine.html @@ -33,8 +33,8 @@

      overridable directive that allows a developer to customize the expression returned by the engine.

      -

      Check EEx.AssignsEngine, EEx.ForEngine and -EEx.SmartEngine for examples of using this module.

      +

      Check EEx.AssignsEngine and EEx.SmartEngine for +examples of using this module.

      diff --git a/docs/master/EEx.html b/docs/master/EEx.html index bb3a1d137..ea71a9af9 100644 --- a/docs/master/EEx.html +++ b/docs/master/EEx.html @@ -66,16 +66,15 @@

      Tags

      EEx.SmartEngine supports the following tags:

      <% Elixir expression - inline with output %>
      -<& Elxir matching expression - not printed &>
       <%= Elixir expression - replace with result %>
       

      All expressions that output something to the template -must use the equals sign (=). Since everything in +must use the equals sign (=). Since everything in Elixir is a macro, there are no exceptions for this rule. For example, while some template languages would special- case if clauses, they are treated the same in EEx and -also requires = in order to have their result printed:

      +also require = in order to have their result printed:

      <%= if true do %>
         It is obviously true
      @@ -84,29 +83,14 @@ 

      Tags

      <% end %>
      -

      The <& ... &> expression is only used in matching clauses. -For example, the cond macro would be written as:

      - -
      <%= cond do %>
      -  <& false -> &> Never printed
      -  <& true  -> &> always printed
      -<% end %>
      -
      -

      Notice that different engines may have different rules for each tag. Other tags may be added in future versions.

      Macros

      -

      EEx.SmartEngine also adds two macros to your template. -The first one is the for macro, which allows you to easily -loop a variable:

      - -
      EEx.eval_string "<%= for x in [1,2,3] do %><%= x %>\n<% end %>", []
      -#=> "1\n2\n3\n"
      -
      - -

      It also adds defines a macro named @ that allows easy access:

      +

      EEx.SmartEngine also adds some macros to your template. +An example is the @ macro which allows easy data access +in a template:

      EEx.eval_string "<%= @foo %>", assigns: [foo: 1]
       #=> 1
      @@ -183,7 +167,7 @@ 

      Functions

      Get a filename and generate a quoted expression that can be evaluated by Elixir or compiled to a function.

      - Source + Source

      compile_string(source, options // []) @@ -191,7 +175,7 @@

      Functions

      Get a string source and generate a quoted expression that can be evaluated by Elixir or compiled to a function.

      - Source + Source

      eval_file(filename, bindings // [], options // []) @@ -208,7 +192,7 @@

      Examples

      #=> "foo baz"
      - Source + Source

      eval_string(source, bindings // [], options // []) @@ -221,7 +205,7 @@

      Examples

      #=> "foo baz"
      - Source + Source @@ -255,7 +239,7 @@

      Examples

      Sample.sample(1, 2) #=> "3" - Source + Source

      function_from_string(kind, name, source, args // [], options // []) @@ -274,7 +258,7 @@

      Examples

      Sample.sample(1, 2) #=> "3"
      - Source + Source diff --git a/docs/master/Elixir.Builtin.html b/docs/master/Elixir.Builtin.html deleted file mode 100644 index 135accf81..000000000 --- a/docs/master/Elixir.Builtin.html +++ /dev/null @@ -1,3352 +0,0 @@ - - - - Elixir.Builtin - - - - - - - - - - - - -
      -

      - Elixir.Builtin - -

      - - -
      -

      Elixir.Builtin provides the default macros and functions -Elixir imports into your environment. Those macros and functions -can be skipped or cherry-picked via the import macro. For -instance, if you want to tell Elixir to not import the case -macro, you can do:

      - -
      import Elixir.Builtin, except: [case: 2]
      -
      - -

      Elixir also has special forms that are always imported and -cannot be skipped. These are described in Elixir.SpecialForms.

      - -

      Some of the functions described in this module are simply -a proxy to its Erlang counterpart. Although they are documented -here for convenience, you can access their original documentation -at http://www.erlang.org/doc/man/erlang.html.

      - -
      - - - Source - - - - - - -

      Functions summary

      - - - - -

      Macros summary

      - - - - -
      -

      Functions

      -
      -

      - abs(number) -

      -

      Returns an integer or float which is the arithmetical absolute value of number.

      - -

      Allowed in guard tests.

      - -

      Examples

      - -
      abs(-3.33) #=> 3.33
      -abs(-3)    #=> 3
      -
      -
      - Source -
      -

      - apply(fun, args) -

      -

      Invokes the given fun with the array of arguments args.

      - -

      Examples

      - -
      apply fn x -> x * 2 end, [2]
      -#=> 4
      -
      -
      - Source -
      -

      - apply(module, fun, args) -

      -

      Invokes the given fun from module with the array of arguments args.

      - -

      Examples

      - -
      apply List, reverse, [[1,2,3]]
      -#=> [3,2,1]
      -
      -
      - Source -
      -

      - atom_to_binary(atom, encoding) -

      -

      Returns a binary which corresponds to the text representation of atom. -If encoding is latin1, there will be one byte for each character in the text -representation. If encoding is utf8 or unicode, the characters will be encoded -using UTF-8 (meaning that characters from 16#80 up to 0xFF will be encoded in -two bytes).

      - -

      Examples

      - -
      atom_to_binary(:elixir, utf8) #=> "elixir"
      -
      -
      - Source -
      -

      - atom_to_list(atom) -

      -

      Returns a string which corresponds to the text representation of atom.

      - -

      Examples

      - -
      atom_to_list(:elixir) #=> 'elixir'
      -
      -
      - Source -
      -

      - binary_to_atom(binary, encoding) -

      -

      Returns the atom whose text representation is binary. If encoding is latin1, -no translation of bytes in the binary is done. If encoding is utf8 or unicode, -the binary must contain valid UTF-8 sequences; furthermore, only Unicode -characters up to 0xFF are allowed.

      - -

      Examples

      - -
      binary_to_atom("elixir", :utf8) #=> :elixir
      -
      -
      - Source -
      -

      - binary_to_existing_atom(binary, encoding) -

      -

      Works like binary_to_atom/2, but the atom must already exist.

      -
      - Source -
      -

      - binary_to_list(binary) -

      -

      Returns a list of integers which correspond to the bytes of binary.

      -
      - Source -
      -

      - binary_to_list(binary, start, stop) -

      -

      As binarytolist/1, but returns a list of integers corresponding to the bytes -from position start to position stop in binary. Positions in the binary -are numbered starting from 1.

      -
      - Source -
      -

      - binary_to_term(binary) -

      -

      Returns an Erlang term which is the result of decoding the binary -object binary, which must be encoded according to the Erlang external -term format.

      - -

      Examples

      - -
      binary_to_term(term_to_binary("foo")) #=> "foo"
      -
      -
      - Source -
      -

      - binary_to_term(binary, options) -

      -

      As binary_to_term/1, but accepts a safe option useful when receiving -binaries from an untrusted source.

      - -

      When enabled, it prevents decoding data that may be used to attack the -Erlang system. In the event of receiving unsafe data, decoding fails -with a badarg error.

      - -

      Currently, this prevents creation of new atoms directly, creation of -new atoms indirectly (as they are embedded in certain structures like pids, -refs, funs, etc), and creation of new external function references. None -of those resources are currently garbage collected, so unchecked creation -of them can exhaust available memory.

      - -

      Examples

      - -
      binary_to_term(term_to_binary("foo"), [:safe])
      -
      -
      - Source -
      -

      - bit_size(bitstring) -

      -

      Returns an integer which is the size in bits of bitstring.

      - -

      Allowed in guard tests.

      - -

      Examples

      - -
      bit_size(<<433|16,3|3>>) #=> 19
      -bit_size(<<1,2,3>>) #=> 24
      -
      -
      - Source -
      -

      - bitstring_to_list(bitstring) -

      -

      Returns a list of integers which correspond to the bytes of bitstring. If the -number of bits in the binary is not divisible by 8, the last element of the list will -be a bitstring containing the remaining bits (1 up to 7 bits).

      -
      - Source -
      -

      - byte_size(bitstring) -

      -

      Returns an integer which is the number of bytes needed to contain bitstring. -(That is, if the number of bits in Bitstring is not divisible by 8, the resulting -number of bytes will be rounded up.)

      - -

      Allowed in guard tests.

      - -

      Examples

      - -
      byte_size(<<433|16,3|3>>) #=> 3
      -byte_size(<<1,2,3>>) #=> 3
      -
      -
      - Source -
      -

      - exit(reason) -

      -

      Stops the execution of the calling process with the given reason. -Since evaluating this function causes the process to terminate, -it has no return value.

      - -

      Examples

      - -
      exit(:normal)
      -exit(:seems_bad)
      -
      -
      - Source -
      -

      - float(number) -

      -

      Converts the given number to a float. Allowed in guard clauses.

      -
      - Source -
      -

      - float_to_list(number) -

      -

      Returns a char list which corresponds to the text representation of the given float.

      - -

      Examples

      - -
      float_to_list(7.0)
      -#=> '7.00000000000000000000e+00'
      -
      -
      - Source -
      -

      - halt() -

      -

      The same as halt(0, []).

      -
      - Source -
      -

      - halt(status) -

      -

      The same as halt(status, []).

      -
      - Source -
      -

      - halt(status, options) -

      -

      Halts the Erlang runtime system where the first argument status must be a -non-negative integer, a char list, or the atom :abort.

      - -
        -
      • If an integer, the runtime system exits with the integer value which -is returned to the Operating System;

      • -
      • If a char list, an erlang crash dump is produced with status as slogan, -and then the runtime system exits with status code 1;

      • -
      • If :abort, the runtime system aborts producing a core dump, if that is -enabled in the operating system.

      • -
      - -

      Note that on many platforms, only the status codes 0-255 are supported -by the operating system.

      - -

      For integer status, Erlang runtime system closes all ports and allows async -threads to finish their operations before exiting. To exit without such -flushing, pass options [flush: false] instead.

      - -

      Examples

      - -
      halt(0)
      -halt(1, flush: false)
      -halt(:abort)
      -
      -
      - Source -
      -

      - hd(list) -

      -

      Returns the head of a list, raises badarg if the list is empty.

      -
      - Source -
      -

      - integer_to_list(number) -

      -

      Returns a char list which corresponds to the text representation of the given integer.

      - -

      Examples

      - -
      integer_to_list(7)
      -#=> '7'
      -
      -
      - Source -
      -

      - integer_to_list(number, base) -

      -

      Returns a char list which corresponds to the text representation of the -given integer in the given case.

      - -

      Examples

      - -
      integer_to_list(1023, 16).
      -#=> "3FF"
      -
      -
      - Source -
      -

      - iolist_size(item) -

      -

      Returns the size of an iolist.

      - -

      Examples

      - -
      iolist_size([1,2|<<3,4>>])
      -#=> 4
      -
      -
      - Source -
      -

      - iolist_to_binary(item) -

      -

      Returns a binary which is made from the integers and binaries in iolist.

      - -

      Examples

      - -
      bin1 = <<1,2,3>>
      -bin2 = <<4,5>>
      -bin3 = <<6>>
      -
      -iolist_to_binary([bin1,1,[2,3,bin2],4|bin3])
      -#=> <<1,2,3,1,2,3,4,5,4,6>>
      -
      -
      - Source -
      -

      - is_atom(term) -

      -

      Returns true if term is an atom; otherwise returns false.

      - -

      Allowed in guard tests.

      -
      - Source -
      -

      - is_binary(term) -

      -

      Returns true if term is a binary; otherwise returns false.

      - -

      A binary always contains a complete number of bytes.

      - -

      Allowed in guard tests.

      -
      - Source -
      -

      - is_bitstring(term) -

      -

      Returns true if term is a bitstring (including a binary); otherwise returns false.

      - -

      Allowed in guard tests.

      -
      - Source -
      -

      - is_boolean(term) -

      -

      Returns true if term is either the atom true or the atom false (i.e. a boolean); -otherwise returns false.

      - -

      Allowed in guard tests.

      -
      - Source -
      -

      - is_float(term) -

      -

      Returns true if term is a floating point number; otherwise returns false.

      - -

      Allowed in guard tests.

      -
      - Source -
      -

      - is_function(term) -

      -

      Returns true if term is a function; otherwise returns false.

      - -

      Allowed in guard tests.

      -
      - Source -
      -

      - is_function(term, arity) -

      -

      Returns true if term is a function that can be applied with arity number of arguments; -otherwise returns false.

      - -

      Allowed in guard tests.

      -
      - Source -
      -

      - is_integer(term) -

      -

      Returns true if term is an integer; otherwise returns false.

      - -

      Allowed in guard tests.

      -
      - Source -
      -

      - is_list(term) -

      -

      Returns true if term is a list with zero or more elements; otherwise returns false.

      - -

      Allowed in guard tests.

      -
      - Source -
      -

      - is_number(term) -

      -

      Returns true if term is either an integer or a floating point number; -otherwise returns false.

      - -

      Allowed in guard tests.

      -
      - Source -
      -

      - is_pid(term) -

      -

      Returns true if term is a pid (process identifier); otherwise returns false.

      - -

      Allowed in guard tests.

      -
      - Source -
      -

      - is_port(term) -

      -

      Returns true if term is a port identifier; otherwise returns false.

      - -

      Allowed in guard tests.

      -
      - Source -
      -

      - is_reference(term) -

      -

      Returns true if term is a reference; otherwise returns false.

      - -

      Allowed in guard tests.

      -
      - Source -
      -

      - is_tuple(term) -

      -

      Returns true if term is a tuple; otherwise returns false.

      - -

      Allowed in guard tests.

      -
      - Source -
      -

      - length(list) -

      -

      Returns the length of list.

      - -

      Allowed in guard tests.

      - -

      Examples

      - -
      length([1,2,3,4,5,6,7,8,9]) #=> 9
      -
      -
      - Source -
      -

      - list_to_atom(char_list) -

      -

      Returns the atom whose text representation is char_list.

      - -

      Examples

      - -
      list_to_atom('elixir') #=> :elixir
      -
      -
      - Source -
      -

      - list_to_binary(char_list) -

      -

      Returns a binary which is made from the content of char_list.

      - -

      Examples

      - -
      list_to_binary('Elixir') #=> "Elixir"
      -
      -
      - Source -
      -

      - list_to_bitstring(bitstring_list) -

      -

      Returns a bitstring which is made from the integers and bitstrings in bitstring_list. -(the last tail in bitstring_list is allowed to be a bitstring.)

      - -

      Examples

      - -
      bin1 = <<1,2,3>>
      -bin2 = <<4,5>>
      -bin3 = <<6,7|4>>
      -
      -list_to_bitstring([bin1,1,[2,3,bin2],4|bin3])
      -#=> <<1,2,3,1,2,3,4,5,4,6,7|4>>
      -
      -
      - Source -
      -

      - list_to_existing_atom(char_list) -

      -

      Returns the atom whose text representation is char_list, but only if there already -exists such atom.

      -
      - Source -
      -

      - list_to_float(char_list) -

      -

      Returns the float whose text representation is char_list.

      - -

      Examples

      - -
      list_to_float('2.2017764e+0') #=> 2.2017764
      -
      -
      - Source -
      -

      - list_to_integer(char_list) -

      -

      Returns an integer whose text representation is char_list.

      - -

      Examples

      - -
      list_to_integer('123') #=> 123
      -
      -
      - Source -
      -

      - list_to_integer(char_list, base) -

      -

      Returns an integer whose text representation in base base is char_list.

      - -

      Examples

      - -
      > list_to_integer('3FF', 16) #=> 1023
      -
      -
      - Source -
      -

      - list_to_pid(char_list) -

      -

      Returns a pid whose text representation is char_list.

      - -

      Warning:

      - -

      This function is intended for debugging and for use in the Erlang -operating system.

      - -

      It should not be used in application programs.

      - -

      Examples

      - -
      list_to_pid('<0.41>') #=> <0.4.1>
      -
      -
      - Source -
      -

      - list_to_tuple(list) -

      -

      Returns a tuple which corresponds to list. list can contain any Erlang terms.

      - -

      Examples

      - -
      list_to_tuple([share, [:elixir, 163]]). #=> {share, [:elixir, 163]}
      -
      -
      - Source -
      -

      - make_ref() -

      -

      Returns an almost unique reference.

      - -

      The returned reference will re-occur after approximately 2^82 calls; -therefore it is unique enough for practical purposes.

      - -

      Examples

      - -
      make_ref()
      -#=> #Ref<0.0.0.135>
      -
      -
      - Source -
      -

      - max(first, second) -

      -

      Return the biggest of the two given terms according to -Erlang's term ordering. If the terms compare equal, the -first one is returned.

      - -

      Examples

      - -
      max(1, 2) #=> 2
      -
      -
      - Source -
      -

      - min(first, second) -

      -

      Return the smallest of the two given terms according to -Erlang's term ordering. If the terms compare equal, the -first one is returned.

      - -

      Examples

      - -
      min(1, 2) #=> 1
      -
      -
      - Source -
      -

      - node() -

      -

      Returns an atom representing the name of the local node. -If the node is not alive, nonode@nohost is returned instead.

      - -

      Allowed in guard tests.

      -
      - Source -
      -

      - node(arg) -

      -

      Returns the node where the given argmuent is located. -The argument can be a pid, a reference, or a port. -If the local node is not alive, nonode@nohost is returned.

      - -

      Allowed in guard tests.

      -
      - Source -
      -

      - pid_to_list(pid) -

      -

      Returns a char list which corresponds to the text representation of pid. -This function is intended for debugging and for use in the Erlang operating -system. It should not be used in application programs.

      - -

      Warning:

      - -

      This function is intended for debugging and for use in the Erlang -operating system.

      - -

      It should not be used in application programs.

      -
      - Source -
      -

      - raise(msg) -

      -

      Raises an error.

      - -

      If the argument is a binary, it raises RuntimeError with the message. -If anything else, becomes a call to raise(argument, []).

      - -

      Examples

      - -
      raise "Given values do not match"
      -
      -try do
      -  1 + :foo
      -rescue
      -  x in [BadargError] ->
      -    IO.puts "that was expected"
      -    raise x
      -end
      -
      -
      - Source -
      -

      - raise(exception, args) -

      -

      Raises an error.

      - -

      It calls .exception on the given argument passing -the args in order to retrieve the appropriate exception -structure.

      - -

      Any module defined via defexception automatically -defines exception(args) that returns a new instance -of the record and a exception(args, current) that -works as no-op.

      - -

      Examples

      - -
      raise ArgumentError, message: "Sample"
      -
      -
      - Source -
      -

      - round(number) -

      -

      Returns an integer by rounding the given number. -Allowed in guard tests.

      - -

      Examples

      - -
      round(5.5) #=> 6
      -
      -
      - Source -
      -

      - self() -

      -

      Returns the pid (process identifier) of the calling process. -Allowed in guard clauses.

      -
      - Source -
      -

      - size(arg) -

      -

      Returns the size of the given argument, which must be a tuple -or a binary. If possible, please use tuplesize or binarysize.

      -
      - Source -
      -

      - spawn(fun) -

      -

      Spawns the given function and returns its pid. -Check the module Process for other functions that handle -process, including spawning functions in nodes.

      - -

      Examples

      - -
      current = Process.self
      -child   = spawn(fn -> current <- { Process.self, 1 + 2 } end)
      -
      -receive
      -  { ^child, 3 } -> IO.puts "Received 3 back"
      -end
      -
      -
      - Source -
      -

      - spawn(module, fun, args) -

      -

      Spawns the given module and function passing the given args -and returns its pid.

      - -

      Check the module Process for other functions that handle -process, including spawning functions in nodes.

      - -

      Examples

      - -
      spawn(SomeModule, :function, [1,2,3])
      -
      -
      - Source -
      -

      - spawn_link(fun) -

      -

      Spawns the given function, links it to the current process and returns its pid. -Check the module Process for other functions that handle -process, including spawning functions in nodes.

      - -

      Examples

      - -
      current = Process.self
      -child   = spawn_link(fn -> current <- { Process.self, 1 + 2 } end)
      -
      -receive
      -  { ^child, 3 } ->
      -    IO.puts "Received 3 back"
      -end
      -
      -
      - Source -
      -

      - spawn_link(module, fun, args) -

      -

      Spawns the given module and function passing the given args, -links it to the current process and returns its pid.

      - -

      Check the module Process for other functions that handle -process, including spawning functions in nodes.

      - -

      Examples

      - -
      spawn_link(SomeModule, :function, [1,2,3])
      -
      -
      - Source -
      -

      - term_to_binary(term) -

      -

      Returns a binary data which is the result of encoding the given term -according to the Erlang external term format.

      - -

      This can be used for a variety of purposes, for example, writing a term -to a file in an efficient way, or sending an Erlang term to some type -of communications channel not supported by distributed Erlang.

      -
      - Source -
      -

      - term_to_binary(term, opts) -

      -

      The same as term_to_binary/1 but also supports two options:

      - - -
      - Source -
      -

      - throw(term) -

      -

      A non-local return from a function. Check try/2 for more information.

      -
      - Source -
      -

      - tl(list) -

      -

      Returns the tail of a list. Raises ArgumentError if the list is empty.

      -
      - Source -
      -

      - trunc(number) -

      -

      Returns an integer by the truncating the given number. -Allowed in guard clauses.

      - -

      Examples

      - -
      trunc(5.5) #=> 5
      -
      -
      - Source -
      -

      - tuple_size(tuple) -

      -

      Returns the size of a tuple.

      -
      - Source -
      -

      - tuple_to_list(tuple) -

      -

      Converts a tuple to a list.

      -
      - Source -
      -
      - - - -
      -

      Macros

      -
      -

      - !(expr) -

      -

      Implements the unary operator ! as a macro. It receives any -argument and returns true if it is false or nil. Returns false -otherwise. Not allowed in guard clauses.

      - -

      Examples

      - -

      !1 #=> false - ![1,2,3] #=> false - !false #=> true - !nil #=> true

      -
      - Source -
      -

      - !=(left, right) -

      -

      Returns true if the two items are not equal.

      - -

      This operator considers 1 and 1.0 to be equal. For strict -comparison, use !== instead.

      - -

      As Erlang, Elixir can compare any term. Allowed in guard clauses.

      - -

      Examples

      - -
      1 != 2
      -#=> true
      -1 != 1.0
      -#=> false
      -
      -
      - Source -
      -

      - !==(left, right) -

      -

      Returns true if the two items are strictly not equal. -As Erlang, Elixir can compare any term. Allowed in guard clauses.

      - -

      Examples

      - -
      1 !== 2
      -#=> true
      -
      -1 !== 1.0
      -#=> true
      -
      -
      - Source -
      -

      - &&(left, right) -

      -

      Provides a short-circuit operator that executes the second -expression only if the first one evalutes to true (i.e. it is -not nil nor false). Returns the first expression otherwise.

      - -

      Examples

      - -
      true && true         #=> true
      -nil && true          #=> nil
      -true && 1            #=> 1
      -false && error(:bad) #=> false
      -
      - -

      Notice that, differently from Erlang and operator, -this operator accepts any expression as arguments, -not only booleans, however it is not allowed in guards.

      -
      - Source -
      -

      - *(left, right) -

      -

      Arithmetic multiplication. Allowed in guard clauses.

      - -

      Examples

      - -
      1 * 2 #=> 2
      -
      -
      - Source -
      -

      - +(left, right) -

      -

      Arithmetic plus. Allowed in guard clauses.

      - -

      Examples

      - -
      1 + 2 #=> 3
      -
      -
      - Source -
      -

      - ++(left, right) -

      -

      Concatenates two lists. Allowed in guard clauses.

      - -

      Examples

      - -
      [1] ++ [2,3]
      -#=> [1,2,3]
      -
      -'foo' ++ 'bar'
      -#=> 'foobar'
      -
      -
      - Source -
      -

      - -(left, right) -

      -

      Arithmetic minus. Allowed in guard clauses.

      - -

      Examples

      - -
      1 - 2 #=> -1
      -
      -
      - Source -
      -

      - --(left, right) -

      -

      Removes the first occorrence of an item on the left -for each item on the right. Allowed in guard clauses.

      - -

      Examples

      - -
      [1,2,3] -- [1,2]
      -#=> [3]
      -
      -[1,2,3,2,1] -- [1,2,2]
      -#=> [3,1]
      -
      -
      - Source -
      -

      - ..(first, last) -

      -

      Returns a range with the specified start and end. -Includes both ends.

      - -

      Examples

      - -
      0 in 1..3 #=> false
      -1 in 1..3 #=> true
      -2 in 1..3 #=> true
      -3 in 1..3 #=> true
      -
      -
      - Source -
      -

      - /(left, right) -

      -

      Arithmetic division. Differently from other languages, -the result is always a float. Use div and rem if you want -a natural division or the remainder. Allowed in guard clauses.

      - -

      Examples

      - -
      1 / 2 #=> 0.5
      -2 / 1 #=> 2.0
      -
      -
      - Source -
      -

      - />(left, right) -

      -

      /> is called the pipeline operator as it is useful -to write pipeline style expressions. This operator -tntroduces the expression on the left as the first -argument to the expression on the right.

      - -

      Examples

      - -
      [1,[2],3] /> List.flatten /> Enum.map(&1 * 2)
      -#=> [2,4,6]
      -
      - -

      The expression above is simply translated to:

      - -
      Enum.map(List.flatten([1,[2],3]), &1 * 2)
      -
      -
      - Source -
      -

      - <(left, right) -

      -

      Return true if left is less than right. -As Erlang, Elixir can compare any term. Allowed in guard clauses.

      - -

      Examples

      - -
      1 < 2
      -#=> true
      -
      -
      - Source -
      -

      - <-(left, right) -

      -

      Sends a message to the process identified on the left. -A process can be identified bu its PID or, if it is registered, -by an atom.

      - -

      Examples

      - -
      process = Process.self
      -process <- { :ok, "Sending myself a message" }
      -
      -
      - Source -
      -

      - <=(left, right) -

      -

      Return true if left is less than or equal to right. -As Erlang, Elixir can compare any term. Allowed in guard clauses.

      - -

      Examples

      - -
      1 <= 2
      -#=> true
      -
      -
      - Source -
      -

      - <>(left, right) -

      -

      Concatenates two binaries. Allowed in guard clauses.

      - -

      Examples

      - -
      "foo" <> "bar" #=> "foobar"
      -
      - -

      The <> operator can also be used in guard clauses as -long as the first part is a literal binary:

      - -
      "foo" <> x = "foobar"
      -x #=> "bar"
      -
      -
      - Source -
      -

      - ==(left, right) -

      -

      Returns true if the two items are equal.

      - -

      This operator considers 1 and 1.0 to be equal. For strict -comparison, use === instead.

      - -

      As Erlang, Elixir can compare any term. Allowed in guard clauses.

      - -

      Examples

      - -
      1 == 2
      -#=> false
      -
      -1 == 1.0
      -#=> true
      -
      -
      - Source -
      -

      - ===(left, right) -

      -

      Returns true if the two items are strictly equal. -As Erlang, Elixir can compare any term. Allowed in guard clauses.

      - -

      Examples

      - -
      1 === 2
      -#=> false
      -
      -1 === 1.0
      -#=> false
      -
      -
      - Source -
      -

      - =~(left, right) -

      -

      Matches the term on the left against the regular expression -on the right. It returns nil if not match happened or the -first match otherwise.

      - -

      Examples

      - -
      "abcd" =~ %r/c(d)/  #=> "cd"
      -"abcd" =~ %r/e/     #=> nil
      -
      -
      - Source -
      -

      - >(left, right) -

      -

      Return true if left is more than right. -As Erlang, Elixir can compare any term. Allowed in guard clauses.

      - -

      Examples

      - -
      1 > 2
      -#=> false
      -
      -
      - Source -
      -

      - >=(left, right) -

      -

      Return true if left is more than or equal to right. -As Erlang, Elixir can compare any term. Allowed in guard clauses.

      - -

      Examples

      - -
      1 >= 2
      -#=> false
      -
      -
      - Source -
      -

      - @(expr) -

      -

      This macro is a shortcut to read and add attributes to the module -being compiled. Elixir module attributes are similar to Erlang's with -some differences. The canonical example for attributes is annotating -that a module implements the OTP behavior called gen_server:

      - -
      defmodule MyServer do
      -  @behavior :gen_server
      -  # ... callbacks ...
      -end
      -
      - -

      Elixir supports by default all Erlang module attributes but any developer -can also add custom attributes:

      - -
      defmodule MyServer do
      -  @my_data 13
      -  IO.inspect @my_data #=> 13
      -end
      -
      - -

      Differently from Erlang, such attributes are not stored in the module by -default since it is common in Elixir to use such attributes to store -temporary data. A developer can configure an attribute to behave closer -to Erlang by calling Module.register_attribute/2.

      - -

      Finally notice that attributes can also be read inside functions:

      - -
      defmodule MyServer do
      -  @my_data 11
      -  def first_data, do: @my_data
      -  @my_data 13
      -  def second_data, do: @my_data
      -end
      -
      -MyServer.first_data #=> 11
      -MyServer.second_data #=> 13
      -
      - -

      It is important to note that reading an attribute takes a snapshot of -its current value. In other words, the value is read at compilation -time and not at runtime. Check the module Module for other functions -to manipulate module attributes.

      -
      - Source -
      -

      - __B__(string, list2) -

      -

      Handles the sigil %B. It simples returns a binary -without escaping characters and without interpolations.

      - -

      Examples

      - -
      %B(foo)      #=> "foo"
      -%B(f#{o}o)  #=> "f\#{o}o"
      -
      -
      - Source -
      -

      - __C__(arg1, list2) -

      -

      Handles the sigil %C. It simples returns a char list -without escaping characters and without interpolations.

      - -

      Examples

      - -
      %C(foo)      #=> 'foo'
      -%C(f#{o}o)  #=> 'f\#{o}o'
      -
      -
      - Source -
      -

      - __R__(arg1, options) -

      -

      Handles the sigil %R. It returns a Regex pattern without escaping -nor interpreating interpolations.

      - -

      Examples

      - -
      Regex.match? %R(f#{1,3}o), "f#o"  #=> true
      -
      -
      - Source -
      -

      - __b__(arg1, list2) -

      -

      Handles the sigil %b. It returns a binary as if it was double quoted -string, unescaping characters and replacing interpolations.

      - -

      Examples

      - -
      %b(foo)       #=> "foo"
      -%b(f#{:o}o)  #=> "foo"
      -
      -
      - Source -
      -

      - __c__(arg1, list2) -

      -

      Handles the sigil %c. It returns a char list as if it was a single -quoted string, unescaping characters and replacing interpolations.

      - -

      Examples

      - -
      %c(foo)       #=> 'foo'
      -%c(f#{:o}o)  #=> 'foo'
      -
      -
      - Source -
      -

      - __r__(arg1, options) -

      -

      Handles the sigil %r. It returns a Regex pattern.

      - -

      Examples

      - -
      Regex.match? %r(foo), "foo"  #=> true
      -
      -
      - Source -
      -

      - access(element, args) -

      -

      Access the given element using the qualifier according -to the Access protocol. All calls in the form foo[bar] -are translated to access(foo, bar).

      - -

      The usage of this protocol is to access a raw value in a -keywords list.

      - -
      sample = [a: 1, b: 2, c: 3]
      -sample[:b] #=> 2
      -
      - -

      Atoms

      - -

      Whenever invoked on an atom, the access protocol is expanded -at compilation time rather than on runtime. This feature is used -by records to allow a developer to match against an specific part -of a record:

      - -
      def increment(State[counter: counter, other: 13] = state) do
      -  state.counter(counter + 1)
      -end
      -
      - -

      In the example above, we use the Access protocol to match the -counter field in the record State. Considering the record -definition is as follows:

      - -
      defrecord State, counter: 0, other: nil
      -
      - -

      The clause above is translated to:

      - -
      def increment({ State, counter, 13 } = state) do
      -  state.counter(counter + 1)
      -end
      -
      - -

      The same pattern can be used to create a new record:

      - -
      def new_state(counter) do
      -  State[counter: counter]
      -end
      -
      - -

      The example above is slightly faster than State.new(counter: :counter) -because the record is expanded at compilation time and not at runtime. -If a field is not specified on creation, it will have its default value.

      - -

      Finally, as in Erlang, Elixir also allows the following syntax:

      - -
      new_uri = State[_: 1]
      -
      - -

      In this case all fields will be set to 1. Notice that, -as in Erlang, in case an expression is given, it will be -evaluated multiple times:

      - -
      new_uri = State[_: IO.puts "Hello"]
      -
      - -

      In this case, "Hello" will be printed twice (one per each field).

      - -

      Examples

      - -
      a = { :a, :b, :c }
      -a[1] #=> :a
      -access a, 1 #=> :a
      -
      -
      - Source -
      -

      - and(left, right) -

      -

      Boolean and. Arguments needs to necessarily be booleans. -Allowed in guard clauses.

      - -

      Examples

      - -
      true and false
      -#=> false
      -
      -
      - Source -
      -

      - atom_to_binary(some_atom) -

      -

      Returns a binary which corresponds to the text representation -of some_atom in UTF8 encoding. Allowed in guard clauses.

      - -

      Examples

      - -
      atom_to_binary :my_atom #=> "my_atom"
      -
      -
      - Source -
      -

      - binary_to_atom(some_binary) -

      -

      Returns the atom whose text representation is -some_binary in UTF8 encoding. -Allowed in guard clauses.

      - -

      Examples

      - -
      binary_to_atom "my_atom" #=> :my_atom
      -
      -
      - Source -
      -

      - binary_to_existing_atom(some_binary) -

      -

      Works like binary_to_atom but the atom must exist. -Allowed in guard clauses.

      - -

      Examples

      - -
      :my_atom                          #=> :my_atom
      -binary_to_existing_atom "my_atom" #=> :my_atom
      -
      -
      - Source -
      -

      - case(condition, blocks) -

      -

      Matches the given condition against the match clauses.

      - -

      Examples

      - -
      case thing do
      -  { :selector, i, value } when is_integer(i) ->
      -    value
      -  value -> value
      -end
      -
      - -

      In the example above, we compare thing with each given -match clause and execute the first one that matches. If no -clause matches, an error is raised.

      - -

      Since Elixir variables can be assigned more than once, variables -in a match clause will always be assigned instead of matching with -its previous values. For example:

      - -
      i = 1
      -case 10 do
      -  i -> i * 2
      -end
      -
      - -

      The example above will return 20, because i is assgined to 10 -and then multiplied by 2. If you desire to match the value of i -against the given condition, you need to use the ^ operator:

      - -
      i = 1
      -case 10 do
      -  ^i -> i * 2
      -end
      -
      - -

      The example above will actually fail because 10 does not match 1.

      - -

      Finally, case accepts an else: branch as a fallback if none -of the clauses match:

      - -
      case thing do
      -  { :selector, i, value } when is_integer(i) ->
      -    value
      -  _ ->
      -    thing
      -end
      -
      -
      - Source -
      -

      - cond(list1) -

      -

      Execute the first clause where the condition returns true, -raises an error otherwise.

      - -

      Examples

      - -
      cond do
      -  1 + 1 == 2 ->
      -    "This will never match"
      -  2 * 2 != 4 ->
      -    "Nor this"
      -  true ->
      -    "This will"
      -end
      -
      -
      - Source -
      -

      - def(name, list2) -

      -

      Defines a function with the given name and contents.

      - -

      Examples

      - -
      defmodule Foo do
      -  def bar, do: :baz
      -end
      -
      -Foo.bar #=> :baz
      -
      - -

      A function that expects arguments can be defined as follow:

      - -
      defmodule Foo do
      -  def sum(a, b) do
      -    a + b
      -  end
      -end
      -
      - -

      In the example above, we defined a function sum that receives -two arguments and sum them.

      - -

      Dynamic generation with atoms

      - -

      Elixir follows the same rule as Erlang when it comes to -function invocations. Calling a function is the same thing -as "invoking at atom". That said, we could invoke a function -named sum in these two equivalent ways:

      - -
      sum(1, 2)
      -:sum.(1, 2)
      -
      - -

      We can also use the atom format to define functions:

      - -
      defmodule Foo do
      -  def :sum.(a, b) do
      -    a + b
      -  end
      -end
      -
      - -

      In general, a developer never needs to use the format above -except when he wants to dynamically define functions with macros. -In such scenarios, the name needs to be given dynamically via -the unquoting mechanism.

      - -

      Imagine a macro that receives keywords and defines a function -for each entry in the keyword, using the key as function name -and the value as the value returned by the function:

      - -
      defmacro defkv(keywords) do
      -  Enum.map keywords, fn {k,v} ->
      -    quote do
      -      def unquote(k).() do
      -        unquote(v)
      -      end
      -    end
      -  end
      -end
      -
      - -

      This macro could be invoked as:

      - -
      defkv one: 1, two: 2
      -
      - -

      Notice in the example above, we define the function as def unquote(k).() -because each entry k is a an atom and invoking def unquote(k)() -would be invalid Elixir syntax.

      -
      - Source -
      -

      - def(name, args, guards, list4) -

      -

      This macro allows a function to be defined more explicitly -by accepting the name, args and guards as different entries.

      - -

      Differently from def/2, the macro arguments are evaluated -and therefore requires quoting.

      - -

      The name must be an atom, the arguments a list where each -element represents another argument and guards a list of -clauses, where each clause is disjunct.

      - -

      Examples

      - -

      The most common mistake when using this macro is to pass the -arguments without quoting:

      - -
      def :some_function, [first_arg, second_arg], is_list(first_arg) do
      -  # ...
      -end
      -
      - -

      However, the example above will fail because it will attempt to -evaluate [first_arg, second_arg] and fail because the variable -first_arg is not defined. Therefore, we need to use quote:

      - -
      name   = :some_function
      -args   = quote(do: [first_arg, second_arg])
      -guards = quote(do: is_list(first_arg))
      -
      -def name, args, guards do
      -  # ...
      -end
      -
      -
      - Source -
      -

      - defdelegate(tuples, opts) -

      -

      Defines the given functions in the current module that will -delegate to the given target. Functions defined with -defdelegate are public and are allowed to be invoked -from external. If you find yourself wishing to define a -delegation as private, you should likely use import -instead.

      - -

      Delegation only works with functions, delegating to macros -is not supported.

      - -

      Options

      - -
        -
      • :to - The expression to delegate to. Any expression -is allowed and its results will be calculated on runtime;

      • -
      • :as - The function to call on the target given in :to. -This parameter is optional and defaults to the name being -delegated.

      • -
      • :append_first - If true, when delegated, first argument -passed to the delegate will be relocated to the end of the -arguments when dispatched to the target. The motivation behind -this is a disparity between conventions used in Elixir and Erlang. -Elixir's convention is to pass the "handle" as a first argument, -while in Erlang the convention is to pass it as the last argument

      • -
      - -

      Examples

      - -
      defmodule MyList do
      -  defdelegate [reverse: 1], to: Erlang.lists
      -  defdelegate [other_reverse: 1], to: Erlang.lists, as: :reverse
      -  defdelegate [map: 2], to: Erlang.lists, append_first: true
      -end
      -
      -MyList.reverse([1,2,3])
      -#=> [3,2,1]
      -
      -MyList.other_reverse([1,2,3])
      -#=> [3,2,1]
      -
      -
      - Source -
      -

      - defexception(name, values, opts // [], do_block // []) -

      -

      Defines an exception.

      - -

      Exceptions are simply records and therefore defexception/4 has -the same API and similar behavior to defrecord/4 with two notable -differences:

      - -

      1) Differently from records, exceptions are documented by default; -2) Exceptions must implement message/1 as API and return a - binary as result;

      -
      - Source -
      -

      - defimpl(name, opts, do_block // []) -

      -

      Defines an implementation for the given protocol. See -defprotocol/2 for examples.

      -
      - Source -
      -

      - defmodule(name, list2) -

      -

      Defines a module given by name with the given contents.

      - -

      Examples

      - -
      defmodule Foo do
      -  def bar, do: :baz
      -end
      -
      -Foo.bar #=> :baz
      -
      - -

      Nesting

      - -

      Nesting a module inside the other affects its name:

      - -
      defmodule Foo do
      -  defmodule Bar do
      -  end
      -end
      -
      - -

      In the example above, two modules Foo and Foo.Bar. The -second can be accessed as Bar inside Foo in the same -lexical scope. If the module Bar is moved away to another -file, it needs to be referenced via the full name or an -alias need to be set with the help of Elixir.SpecialForms.alias/2.

      - -

      Dynamic names

      - -

      Elixir module names can be dynamically generated. This is very -useful for macros. For instance, one could write:

      - -
      defmodule binary_to_atom("Foo#{1}", :utf8) do
      -  # contents ...
      -end
      -
      - -

      Elixir will accept any module name as long as the expression -returns an atom.

      -
      - Source -
      -

      - defoverridable(tuples) -

      -

      Makes the given functions in the current module overridable. -An overridable function is lazily defined, allowing a -developer to customize it.

      -
      - Source -
      -

      - defp(name, list2) -

      -

      Defines a function that is private. Private functions -can only be accessible from the same module it is defined.

      - -

      Check def/2 for more information

      - -

      Examples

      - -
      defmodule Foo do
      -  def bar do
      -    sum(1, 2)
      -  end
      -
      -  defp sum(a, b), do: a + b
      -end
      -
      - -

      In the example above, sum is private and accessing it -through Foo.sum will raise an error.

      -
      - Source -
      -

      - defp(name, args, guards, list4) -

      -

      The same as def/4 but generates a private function.

      -
      - Source -
      -

      - defprotocol(name, list2) -

      -

      Defines the current module as a protocol and specifies the API -that should be implemented.

      - -

      Examples

      - -

      In Elixir, only false and nil are considered falsy values. -Everything else evaluates to true in if clauses. Depending -on the application, it may be important to specify a blank? -protocol that returns a boolean for other data types that should -be considered blank?. For instance, an empty list or an empty -binary could be considered blanks.

      - -

      We could implement this protocol as follow:

      - -
      defprotocol Blank do
      -  @doc "Returns true if data is considered blank/empty"
      -  def blank?(data)
      -end
      -
      - -

      Now that the protocol is defined, we can implement it. We need -to implement the protocol for each Elixir type. For example:

      - -
      # Numbers are never blank
      -defimpl Blank, for: Number do
      -  def blank?(number), do: false
      -end
      -
      -# Just empty list is blank
      -defimpl Blank, for: List do
      -  def blank?([]), do: true
      -  def blank?(_),  do: false
      -end
      -
      -# Just the atoms false and nil are blank
      -defimpl Blank, for: Atom do
      -  def blank?(false), do: true
      -  def blank?(nil),   do: true
      -  def blank?(_),     do: false
      -end
      -
      - -

      And we would have to define the implementation for all types. -The types available are:

      - -
        -
      • Record
      • -
      • Tuple
      • -
      • Atom
      • -
      • List
      • -
      • BitString
      • -
      • Number
      • -
      • Function
      • -
      • PID
      • -
      • Port
      • -
      • Reference
      • -
      • Any
      • -
      - -

      Selecting implementations

      - -

      Implementing the protocol for all default types can be cumbersome. -Even more, if you consider that Number, Function, PID, Port and -Reference are never going to be blank, it would be easier if we -could simply provide a default implementation.

      - -

      This can be achieved with Elixir as follows:

      - -
      defprotocol Blank do
      -  @only [Atom, Tuple, List, BitString, Any]
      -  def blank?(data)
      -end
      -
      - -

      If the protocol is invoked with a data type that is not an Atom, -nor Tuple, nor List, nor BitString, Elixir will now dispatch to -Any. That said, the default behavior could be implemented as:

      - -
      defimpl Blank, for: Any do
      -  def blank?(_), do: false
      -end
      -
      - -

      Now, all data types that we have not specified will be -automatically considered non blank.

      - -

      Protocols + Records

      - -

      The real benefit of protocols comes when mixed with records. For instance, -imagine we have a module called RedBlack that provides an API to create -and manipulate Red-Black trees. This module represents such trees via a -record named RedBlack.Tree and we want this tree to be considered blank -in case it has no items. To achieve this, the developer just needs to -implement the protocol for RedBlack.Tree:

      - -
      defimpl Blank, for: RedBlack.Tree do
      -  def blank?(tree), do: RedBlack.empty?(tree)
      -end
      -
      - -

      In the example above, we have implemented blank? for RedBlack.Tree -that simply delegates to RedBlack.empty? passing the tree as argument. -This implementation doesn't need to be defined inside the RedBlack -tree or inside the record, but anywhere in the code.

      - -

      Finally, since records are simply tuples, one can add a default protocol -implementation to any record by defining a default implementation for tuples.

      -
      - Source -
      -

      - defrecord(name, values, opts // [], do_block // []) -

      -

      Define a record given by name and values.

      - -

      Examples

      - -
      defrecord FileInfo, atime: nil, mtime: nil
      -
      - -

      The line above will define a module named FileInfo which -contains a function named new that returns a new record -and other functions to read and set the values in the -record. Therefore, we can do:

      - -
      file_info = FileInfo.new(atime: now())
      -file_info.atime         #=> Returns the value of atime
      -file_info.atime(now())  #=> Updates the value of atime
      -
      - -

      Internally, a record is simply a tuple where the first element is -the record module name. This can be noticed if we print the record:

      - -
      IO.inspect FileInfo.new
      -{ FileInfo, nil, nil }
      -
      - -

      Default based functions

      - -

      Depending on the default value, Elixir will define helpers to interact -with the record. For example, ExUnit defines a record which keeps -track of how many tests were executed and the failures that happened -The record definition is similar to:

      - -
      defrecord Config, counter: 0, failures: []
      -
      - -

      Since counter is an integer, Elixir automatically defines a helper -named increment_counter that will increase the counter value:

      - -
      Config.new.increment_counter.counter #=> 1
      -
      - -

      increment_counter also accepts a number of increment as argument:

      - -
      Config.new.increment_counter(10).counter #=> 10
      -
      - -

      Besides, if the default is a list, Elixir will define three helpers:

      - -
        -
      • merge_field - Receives keywords and merge it into the current value;
      • -
      • prepend_field - Receives another list and prepend its values
      • -
      - -

      Documentation

      - -

      By default records are not documented and have @moduledoc set to false. -This can be changed by passing a moduledoc option after values:

      - -
      defrecord Config, [counter: 0, failures: []], moduledoc: "A simple record"
      -
      -
      - Source -
      -

      - destructure(left, right) -

      -

      Allows you to destructure two lists, assigning each -term in the right to the left. Differently from pattern -matching via =, if the sizes of the left and right -lists don't match,, structuring simply stops instead -of raising an error.

      - -

      Examples

      - -
      destructure [x,y,z], [1,2,3,4,5]
      -x #=> 1
      -y #=> 2
      -z #=> 3
      -
      - -

      Notice in the example above, even though the right -size has more entries than the left, structuring works -fine. If the right size is smaller, the remaining items -are simply assigned to nil:

      - -
      destructure [x,y,z], [1]
      -x #=> 1
      -y #=> nil
      -z #=> nil
      -
      - -

      The left side supports any expression you would use -on the left side of a match:

      - -
      x = 1
      -destructure [^x,y,z], [1,2,3]
      -
      - -

      The example above will only work if x matches -the first value from the right side. Otherwise, -it will raise a CaseClauseError.

      -
      - Source -
      -

      - div(left, right) -

      -

      Provides an integer division macro according to Erlang semantics. -Raises an error if one of the arguments is not an integer. -Can be used in guard tests.

      - -

      Examples

      - -
      5 div 2 #=> 2
      -
      -
      - Source -
      -

      - elem(tuple, index) -

      -

      Define elem to get Tuple element according to Elixir conventions. -We need to implement it as a macro to it can be used in guards.

      - -

      Example

      - -

      tuple = { :foo, :bar, 3 } - elem(tuple, 1) #=> :foo

      -
      - Source -
      -

      - function_exported?(module, function, arity) -

      -

      Returns true if the module is loaded and contains a -public function with the given arity, otherwise false.

      -
      - Source -
      -

      - if(condition, list2) -

      -

      Provides an if macro. This macro expects the first argument to -be a condition and the rest are keywords arguments.

      - -

      One-liner examples

      - -
      if(foo, do: bar)
      -
      - -

      In the example above, bar will be returned if foo evalutes to -true (i.e. it is not false nor nil). Otherwise, nil will be returned.

      - -

      An else option can be given to specify the opposite:

      - -
      if(foo, do: bar, else: bar)
      -
      - -

      Blocks examples

      - -

      Elixir also allows you to pass a block to the if macro. The first -example above would be translated to:

      - -
      if foo do
      -  bar
      -end
      -
      - -

      Notice that do/end becomes delimiters. The second example would -then translate do:

      - -
      if foo do
      -  bar
      -else
      -  baz
      -end
      -
      - -

      If you want to compare more than two clauses, you can use the cond/1 -macro.

      -
      - Source -
      -

      - in(left, right) -

      -

      Returns true if the element on the left is equal (==) to -any of the items in the right. For now, it only accepts -a list as the right argument.

      - -

      Examples

      - -
      x = 1
      -x in [1,2,3] #=> true
      -
      - -

      This macro simply translates the expression above to:

      - -
      x == 1 or x == 2 or x == 3
      -
      - -

      Clauses

      - -

      Whenever used inside a function or a case clause, you can -optionally omit the variable declaration, for example:

      - -
      case 3 do
      -  x when x in [1,2] -> x * 2
      -  _ -> 0
      -end
      -
      - -

      Could be rewritten as:

      - -
      case 3 do
      -  x in [1,2] -> x * 2
      -  _ -> 0
      -end
      -
      - -

      In this case, Elixir will automatically expand it and define -the variable for us.

      -
      - Source -
      -

      - inspect(arg) -

      -

      Inspect the given arguments according to the Binary.Inspect protocol.

      - -

      Examples

      - -
      inspect(:foo)
      -#=> ":foo"
      -
      -
      - Source -
      -

      - is_exception(thing) -

      -

      Check if the given structure is an exception.

      - -

      Examples

      - -
      is_exception(Error.new) #=> true
      -is_exception(1)         #=> false
      -
      -
      - Source -
      -

      - is_record(thing, kind) -

      -

      Check if the given structure is a record. It is basically -a convenient macro that checks the structure is a tuple and -the first element matches the given kind.

      - -

      Examples

      - -
      defrecord Config, sample: nil
      -
      -is_record(Config.new, Config) #=> true
      -is_record(Config.new, List)   #=> false
      -
      -
      - Source -
      -

      - is_regex(thing) -

      -

      Check if the given argument is a regex.

      -
      - Source -
      -

      - match?(left, right) -

      -

      A convenient macro that checks if the right side matches -the left side. The left side is allowed to be a match pattern.

      - -

      Examples

      - -
      match?(1, 1) #=> true
      -match?(1, 2) #=> false
      -match?({1,_}, {1,2}) #=> true
      -
      - -

      Match can also be used to filter or find a value in an enumerable:

      - -
      list = [{:a,1},{:b,2},{:a,3}]
      -Enum.filter list, match?({:a, _}, _)
      -
      - -

      Guard clauses can also be given to the match:

      - -
      list = [{:a,1},{:b,2},{:a,3}]
      -Enum.filter list, match?({:a, x } when x < 2, &1)
      -
      -
      - Source -
      -

      - not(arg) -

      -

      Boolean not. Argument needs to necessarily be a boolean. -Allowed in guard clauses.

      - -

      Examples

      - -
      not false
      -#=> true
      -
      -
      - Source -
      -

      - or(left, right) -

      -

      Boolean or. Arguments needs to necessarily be booleans. -Allowed in guard clauses.

      - -

      Examples

      - -
      true or false
      -#=> true
      -
      -
      - Source -
      -

      - receive(args) -

      -

      The current process will hang until it receives a message -from other processes that matches the given clauses.

      - -

      Examples

      - -
      receive do
      -  { :selector, i, value } when is_integer(i) ->
      -    value
      -  value when is_atom(value) ->
      -    value
      -  _ ->
      -    IO.puts :standard_error, "Unexpected message received"
      -end
      -
      - -

      The match clauses above follows the same rules as case/2.

      - -

      An optional after clause can be given in case the message was not -received after the specified period of time:

      - -
      receive do
      -  { :selector, i, value } when is_integer(i) ->
      -    value
      -  value when is_atom(value) ->
      -    value
      -  _ ->
      -    IO.puts :standard_error, "Unexpected message received"
      -after
      -  5000 ->
      -    IO.puts :standard_error, "No message in 5 seconds"
      -end
      -
      - -

      The after clause can be specified even if there are no match clauses. -There are two special cases for the timout value given to after

      - -
        -
      • :infinity - The process should wait indefinitely for a matching -message, this is the same as not using a timeout.

      • -
      • 0 - if there is no matching message in the mailbox, the timeout -will occur immediately.

      • -
      -
      - Source -
      -

      - rem(left, right) -

      -

      Provides an integer remainder macro according to Erlang semantics. -Raises an error if one of the arguments is not an integer. -Can be used in guard tests.

      - -

      Examples

      - -
      5 rem 2 #=> 1
      -
      -
      - Source -
      -

      - setelem(tuple, index, value) -

      -

      Define setelem to set Tuple element according to Elixir conventions. -We need to implement it as a macro to it can be used in guards.

      - -

      Example

      - -

      tuple = { :foo, :bar, 3 } - setelem(tuple, 1, :baz) #=> { :baz, :bar, 3 }

      -
      - Source -
      -

      - to_binary(arg) -

      -

      Convert the argument to a string according to the Binary.Chars protocol. -This is the function invoked when there is string interpolation.

      - -

      Examples

      - -
      to_binary(:foo)
      -#=> "foo"
      -
      -
      - Source -
      -

      - to_char_list(arg) -

      -

      Convert the argument to a list according to the List.Chars protocol.

      - -

      Examples

      - -
      to_char_list(:foo)
      -#=> 'foo'
      -
      -
      - Source -
      -

      - try(args) -

      -

      Execute the given expressions and catch any error, exit -or throw that may have happened.

      - -

      Examples

      - -
      try do
      -  do_something_that_may_fail(some_arg)
      -rescue
      -  ArgumentError ->
      -    IO.puts "Invalid argument given"
      -catch
      -  value ->
      -    IO.puts "caught #{value}"
      -after
      -  IO.puts "This is printed regardless if it failed or succeed"
      -end
      -
      - -

      The rescue clause is used to handle errors, while the catch clause -can be used to catch throw values. Both catch and rescue clauses -accepts the same pattern matching rules as match.

      - -

      Note that calls inside try are not tail recursive since the VM -needs to keep the stacktrace in case an exception happens.

      - -

      Rescue clauses

      - -

      Besides accepting the same pattern matching rules as match -clauses, rescue provides some conveniences around exceptions -that allows one to rescue an exception by its name and not by -its internal contents. All the following formats are valid -rescue expressions:

      - -
      try do
      -  UndefinedModule.undefined_function
      -rescue
      -  UndefinedFunctionError -> nil
      -end
      -
      -try do
      -  UndefinedModule.undefined_function
      -rescue
      -  [UndefinedFunctionError] -> nil
      -end
      -
      -# rescue and assign to x
      -try do
      -  UndefinedModule.undefined_function
      -rescue
      -  x in [UndefinedFunctionError] -> nil
      -end
      -
      -# rescue all and assign to x
      -try do
      -  UndefinedModule.undefined_function
      -rescue
      -  x -> nil
      -end
      -
      - -

      Variable visibility

      - -

      Since an expression inside try may not have been evaluted -due to an exception, any variable created inside try cannot -be accessed externaly. -For instance:

      - -
      try do
      -  x = 1
      -  do_something_that_may_fail(same_arg)
      -  :ok
      -catch
      -  _ | _ -> :failed
      -end
      -
      -x #=> Cannot access `x`
      -
      - -

      In the example above, x cannot be accessed since it was defined -inside the try clause.

      - -

      Catching exits and Erlang errors

      - -

      The catch clause works exactly the same as in Erlang. Therefore, -one can also handle exits/errors coming from Erlang as below:

      - -
      try do
      -  exit(1)
      -catch
      -  :exit, 1 -> IO.puts "Exited with 1"
      -end
      -
      -try do
      -  error(:sample)
      -catch
      -  :error, :sample ->
      -    IO.puts "sample error"
      -end
      -
      - -

      Although the second form should be avoided in favor of raise/rescue -control mechanisms.

      -
      - Source -
      -

      - unless(clause, options) -

      -

      Provides a unless macro that executes the expression -unless a value evalutes to true. Check if for examples -and documentation.

      -
      - Source -
      -

      - use(module, args // []) -

      -

      use is a simple mechanism for extending the current module with the -given module.

      - -

      Examples

      - -
      defmodule AssertionTest do
      -  use ExUnit.Case, async: true
      -
      -  def test_always_pass do
      -    true = true
      -  end
      -end
      -
      - -

      By calling use, a hook called __using__ will be invoked in -ExUnit.Case which will then do the proper setup. In other words, -use is simply a translation to:

      - -
      defmodule AssertionTest do
      -  require ExUnit.Case
      -  ExUnit.Case.__using__([sync: true])
      -
      -  def test_always_pass do
      -    true = true
      -  end
      -end
      -
      -
      - Source -
      -

      - var!(var) -

      -

      When used inside quoting, marks that the variable should not -be hygienezed. Check Elixir.SpecialForms.quote/1 for more -information.

      -
      - Source -
      -

      - xor(left, right) -

      -

      Boolean xor. Arguments needs to necessarily be booleans. -Allowed in guard clauses.

      - -

      Examples

      - -
      true xor false
      -#=> true
      -
      -
      - Source -
      -

      - ||(left, right) -

      -

      Provides a short-circuit operator that executes the second -expression only if the first one does not evalute to true (i.e. it -is not nil nor false). Returns the first expression otherwise.

      - -

      Examples

      - -
      false || false       #=> false
      -nil || true          #=> true
      -false || 1           #=> 1
      -true || error(:bad)  #=> true
      -
      - -

      Notice that, differently from Erlang or operator, -this operator accepts any expression as arguments, -not only booleans, however it is not allowed in guards.

      -
      - Source -
      -
      - -
      - - diff --git a/docs/master/Elixir.ParallelCompiler.html b/docs/master/Elixir.ParallelCompiler.html deleted file mode 100644 index 5477f855c..000000000 --- a/docs/master/Elixir.ParallelCompiler.html +++ /dev/null @@ -1,93 +0,0 @@ - - - - Elixir.ParallelCompiler - - - - - - - - - - - - -
      -

      - Elixir.ParallelCompiler - -

      - - -
      -

      A module responsible for compiling files in parallel.

      - -
      - - - Source - - - - - - -

      Functions summary

      - - - - - - -
      -

      Functions

      -
      -

      - files(files, callback // default_callback) -

      -

      Compiles the given files.

      - -

      Those files are compiled in parallel and can automatically -detect dependencies between them. Once a dependency is found, -the current file stops being compiled until the dependency is -resolved.

      - -

      A callback that is invoked every time a file is compiled -with its name can be optionally given as argument.

      -
      - Source -
      -

      - files_to_path(files, path, callback // default_callback) -

      -

      Compiles the given files to the given path. -Read files/2 for more information.

      -
      - Source -
      -
      - - - -
      - - diff --git a/docs/master/Elixir.ParallelRequire.html b/docs/master/Elixir.ParallelRequire.html deleted file mode 100644 index 93f5c61a7..000000000 --- a/docs/master/Elixir.ParallelRequire.html +++ /dev/null @@ -1,75 +0,0 @@ - - - - Elixir.ParallelRequire - - - - - - - - - - - - -
      -

      - Elixir.ParallelRequire - -

      - - -
      -

      A module responsible for requiring files in parallel.

      - -
      - - - Source - - - - - - -

      Functions summary

      - - - - - - -
      -

      Functions

      -
      -

      - files(files, callback // default_callback) -

      -

      Requires the given files.

      - -

      A callback that is invoked every time a file is required -can be optionally given as argument.

      -
      - Source -
      -
      - - - -
      - - diff --git a/docs/master/Elixir.SpecialForms.html b/docs/master/Elixir.SpecialForms.html deleted file mode 100644 index 715fc28b7..000000000 --- a/docs/master/Elixir.SpecialForms.html +++ /dev/null @@ -1,708 +0,0 @@ - - - - Elixir.SpecialForms - - - - - - - - - - - - -
      -

      - Elixir.SpecialForms - -

      - - -
      -

      In this module we define Elixir special forms. Those are called -special forms because they cannot be overridden by the developer -and sometimes have lexical scope (like alias, import, etc).

      - -

      This module also documents Elixir's pseudo variable (__MODULE__, -__FILE__, __ENV__ and __CALLER__) which return information -about Elixir's compilation environment.

      - -

      Finally, it also documents 3 special forms (__block__, -__scope__ and __aliases__), which are not intended to be -called directly by the developer but they appear in quoted -contents since they are important for Elixir's functioning.

      - -
      - - - Source - - - - - - - - -

      Macros summary

      - - - - - - -
      -

      Macros

      -
      -

      - <<>>(args) -

      -

      Defines a new bitstring.

      - -

      Examples

      - -
      :<<>>.(1,2,3)
      -<< 1, 2, 3 >>
      -
      -
      - Source -
      -

      - [](args) -

      -

      Defines a new list.

      - -

      Examples

      - -
      :[].(1,2,3)
      -[ 1, 2, 3 ]
      -
      -
      - Source -
      -

      - __ENV__() -

      -

      Returns the current environment information as a Macro.Env -record. In the environment you can access the current filename, -line numbers, set up aliases, the current function and others.

      -
      - Source -
      -

      - __FILE__() -

      -

      Returns the current file name as a binary. -Although the file can be accessed in the ENV, this macro -is a convenient shortcut.

      -
      - Source -
      -

      - __MODULE__() -

      -

      Returns the current module name as an atom or nil otherwise. -Although the module can be accessed in the ENV, this macro -is a convenient shortcut.

      -
      - Source -
      -

      - __aliases__(args) -

      -

      This is the special form used to hold aliases information. -At compilation time, it is usually compiled to an atom:

      - -
      quote do: Foo.Bar
      -{ :__aliases__, 0, [:Foo,:Bar] }
      -
      -
      - Source -
      -

      - __block__(args) -

      -

      This is the special form used whenever we have a block -of expressions in Elixir. This special form is private -and should not be invoked directly:

      - -
      quote do: (1; 2; 3)
      -#=> { :__block__, 0, [1,2,3] }
      -
      -
      - Source -
      -

      - __scope__(opts, args) -

      -

      This is the special form used whenever we have to temporarily -change the scope information of a block. Used when quote is -invoked with location: :keep to execute a given block as if -it belonged to another file.

      - -
      quote location: :keep, do: 1
      -#=> { :__scope__, 1,[[file: "iex"],[do: 1]] }
      -
      - -

      Check quote/1 for more information.

      -
      - Source -
      -

      - alias(module, opts) -

      -

      alias is used to setup atom aliases, often useful with modules names.

      - -

      Examples

      - -

      alias can be used to setup an alias for any module:

      - -
      defmodule Math do
      -  alias MyKeyword, as: Keyword
      -end
      -
      - -

      In the example above, we have set up MyOrdict to be alias -as Keyword. So now, any reference to Keyword will be -automatically replaced by MyKeyword.

      - -

      In case one wants to access the original Keyword, it can be done -by accessing MAIN:

      - -
      Keyword.values   #=> uses MyKeyword.values
      -__MAIN__.Keyword.values #=> uses Keyword.values
      -
      - -

      Notice that calling alias without the as: option automatically -sets an alias based on the last part of the module. For example:

      - -
      alias Foo.Bar.Baz
      -
      - -

      Is the same as:

      - -
      alias Foo.Bar.Baz, as: Baz
      -
      - -

      Lexical scope

      - -

      import, require and alias are called directives and all -have lexical scope. This means you can set up aliases inside -specific functions and it won't affect the overall scope.

      -
      - Source -
      -

      - bc(args) -

      -

      Defines a bit comprehension. It follows the same syntax as -a list comprehension but expects each element returned to -be a bitstring. For example, here is how to remove all -spaces from a string:

      - -
      bc <<c>> inbits " hello world ", c != ? , do: <<c>>
      -"helloworld"
      -
      -
      - Source -
      -

      - fn(args) -

      -

      Returns an anonymous function based on the given arguments.

      - -

      Examples

      - -
      sum = fn(x, y) -> x + y end
      -sum.(1, 2) #=> 3
      -
      - -

      Notice that a function needs to be invoked using the dot between -the function and the arguments.

      - -

      A function could also be defined using the end syntax, although -it is recommend to use it only with the stab operator in order to -avoid ambiguity. For example, consider this case:

      - -
      Enum.map [1,2,3], fn x ->
      -  x * 2
      -end
      -
      - -

      The example works fine because -> binds to the closest function call, -which is fn, but if we replace it by do/end, it will fail:

      - -
      Enum.map [1,2,3], fn(x) do
      -  x * 2
      -end
      -
      - -

      The reason it fails is because do/end always bind to the farthest -function call.

      - -

      Function with multiple clauses

      - -

      One may define a function which expects different clauses as long -as all clauses expects the same number of arguments:

      - -
      fun = fn do
      -  x, y when y < 0 ->
      -    x - y
      -  x, y ->
      -    x + y
      -end
      -
      -fun.(10, -10) #=> 20
      -fun.(10, 10)  #=> 20
      -
      -
      - Source -
      -

      - import(module, opts) -

      -

      import allows one to easily access functions or macros from -others modules without using the qualified name.

      - -

      Examples

      - -

      If you want to use the values function from Keyword several times -in your module and you don't want to always type Keyword.values, -you can simply import it:

      - -
      defmodule Math do
      -  import Keyword, only: [values: 1]
      -
      -  def some_function do
      -    # call values(orddict)
      -  end
      -end
      -
      - -

      In this case, we are importing only the function values (with arity 1) -from Keyword. Although only is optional, its usage is recommended. -except could also be given as an option. If no option is given, all -functions and macros are imported.

      - -

      In case you want to import only functions or macros, you can pass a -first argument selecting the scope:

      - -
      import :macros, MyMacros
      -
      - -

      And you can then use only or except to filter the macros being -included.

      - -

      Lexical scope

      - -

      It is important to notice that import is lexical. This means you -can import specific macros inside specific functions:

      - -
      defmodule Math do
      -  def some_function do
      -    # 1) Disable `if/2` from Elixir.Builtin
      -    import Elixir.Builtin, except: [if: 2]
      -
      -    # 2) Require the new `if` macro from MyMacros
      -    import MyMacros
      -
      -    # 3) Use the new macro
      -    if do_something, it_works
      -  end
      -end
      -
      - -

      In the example above, we imported macros from MyMacros, replacing -the original if/2 implementation by our own during that -specific function. All other functions in that module will still -be able to use the original one.

      - -

      Alias/Require shortcut

      - -

      All imported modules are also required by default. import -also accepts as: as an option so it automatically sets up -an alias. Please check alias for more information.

      -
      - Source -
      -

      - lc(args) -

      -

      List comprehensions allow you to quickly build a list from another list:

      - -
      lc n inlist [1,2,3,4], do: n * 2
      -#=> [2,4,6,8]
      -
      - -

      A comprehension accepts many generators and also filters. Generators -are defined using both inlist and inbits operators, allowing you -to loop lists and bitstrings:

      - -
      # A list generator:
      -lc n inlist [1,2,3,4], do: n * 2
      -#=> [2,4,6,8]
      -
      -# A bit string generator:
      -lc <<n>> inbits <<1,2,3,4>>, do: n * 2
      -#=> [2,4,6,8]
      -
      -# A generator from a variable:
      -list = [1,2,3,4]
      -lc n inlist list, do: n * 2
      -#=> [2,4,6,8]
      -
      -# A comprehension with two generators
      -lc x inlist [1,2], y inlist [2,3], do: x*y
      -#=> [2,3,4,6]
      -
      - -

      Filters can also be given:

      - -
      # A comprehension with a generator and a filter
      -lc n inlist [1,2,3,4,5,6], rem(n, 2) == 0, do: n
      -#=> [2,4,6]
      -
      - -

      Bit string generators are quite useful when you need to -organize bit string streams:

      - -
      iex> pixels = <<213,45,132,64,76,32,76,0,0,234,32,15>>
      -iex> lc <<r:8,g:8,b:8>> inbits pixels, do: {r,g,b}
      -[{213,45,132},{64,76,32},{76,0,0},{234,32,15}]
      -
      -
      - Source -
      -

      - quote(opts, list2) -

      -

      Allows you to get the representation of any expression.

      - -

      Examples

      - -
      quote do: sum(1, 2, 3)
      -#=> { :sum, 0, [1, 2, 3] }
      -
      - -

      Homoiconicity

      - -

      Elixir is an homoiconic language. Any Elixir program can be -represented using its own data structures. The building block -of Elixir homoiconicity is a tuple with three elements, for example:

      - -
      { :sum, 1, [1, 2, 3] }
      -
      - -

      The tuple above represents a function call to sum passing 1, 2 and -3 as arguments. The tuple elements are:

      - -
        -
      • The first element of the tuple is always an atom or -another tuple in the same representation;
      • -
      • The second element of the tuple is always an integer -representing the line number;
      • -
      • The third element of the tuple are the arguments for the -function call. The third argument may be an atom, meaning -that it may be a variable.
      • -
      - -

      Macro literals

      - -

      Besides the tuple described above, Elixir has a few literals that -when quoted return themselves. They are:

      - -
      :sum         #=> Atoms
      -1            #=> Integers
      -2.0          #=> Floats
      -[1,2]        #=> Lists
      -"binaries"   #=> Binaries
      -{key, value} #=> Tuple with two elements
      -
      - -

      Hygiene

      - -

      Elixir macros are hygienic regarding to variables. This means -a variable defined in a macro cannot affect the scope where -the macro is included. Consider the following example:

      - -
      defmodule Hygiene do
      -  defmacro no_interference do
      -    quote do: a = 1
      -  end
      -end
      -
      -require Hygiene
      -
      -a = 10
      -Hygiene.no_interference
      -a #=> 10
      -
      - -

      In the example above, a returns 10 even if the macro -is apparently setting it to 1 because the variables defined -in the macro does not affect the context the macro is -executed. If you want to set or get a variable, you can do -it with the help of the var! macro:

      - -
      defmodule NoHygiene do
      -  defmacro interference do
      -    quote do: var!(a) = 1
      -  end
      -end
      -
      -require NoHygiene
      -
      -a = 10
      -NoHygiene.interference
      -a #=> 11
      -
      - -

      Notice that aliases are not hygienic in Elixir, ambiguity -must be solved by prepending MAIN:

      - -
      quote do
      -  __MAIN__.Foo #=> Access the root Foo
      -  Foo          #=> Access the Foo alias in the current module
      -                   (if any is set), then fallback to __MAIN__.Foo
      -end
      -
      - -

      Options

      - -
        -
      • :hygiene - When false, disables hygiene;
      • -
      • :unquote - When false, disables unquoting. Useful when you have a quote -inside another quote and want to control which quote is able to unquote;
      • -
      • :location - When set to :keep, keeps the current line and file on quotes. - Read the Stacktrace information section below for more information;
      • -
      - -

      Stacktrace information

      - -

      One of Elixir goals is to provide proper stacktrace whenever there is an -exception. In order to work properly with macros, the default behavior -in quote is to set the line to 0. When a macro is invoked and the quoted -expressions is expanded, 0 is replaced by the line of the call site.

      - -

      This is a good behavior for the majority of the cases, except if the macro -is defining new functions. Consider this example:

      - -
      defmodule MyServer do
      -  use GenServer.Behavior
      -end
      -
      - -

      GenServer.Behavior defines new functions in our MyServer module. -However, if there is an exception in any of these functions, we want -the stacktrace to point to the GenServer.Behavior and not the line -that calls use GenServer.Behavior. For this reason, there is an -option called :location that when set to :keep keeps these proper -semantics:

      - -
      quote location: :keep do
      -  def handle_call(request, _from, state) do
      -    { :reply, :undef, state }
      -  end
      -end
      -
      - -

      It is important to warn though that location: :keep evaluates the -code as if it was defined inside GenServer.Behavior file, in -particular, the macro __FILE__ will always point to -GenServer.Behavior file.

      -
      - Source -
      -

      - require(module, opts) -

      -

      require is used to require the presence of external -modules so macros can be invoked.

      - -

      Examples

      - -

      Notice that usually modules should not be required before usage, -the only exception is if you want to use the macros from a module. -In such cases, you need to explicitly require them.

      - -

      Let's suppose you created your own if implementation in the module -MyMacros. If you want to invoke it, you need to first explicitly -require the MyMacros:

      - -
      defmodule Math do
      -  require MyMacros
      -  MyMacros.if do_something, it_works
      -end
      -
      - -

      An attempt to call a macro that was not loaded will raise an error.

      - -

      Alias shortcut

      - -

      require also accepts as: as an option so it automatically sets -up an alias. Please check alias for more information.

      -
      - Source -
      -

      - unquote(expr) -

      -

      Unquotes the given expression from inside a macro.

      - -

      Examples

      - -

      Imagine the situation you have a variable name and -you want to inject it inside some quote. The first attempt -would be:

      - -
      value = 13
      -quote do: sum(1, value, 3)
      -
      - -

      Which would then return:

      - -
      { :sum, 0, [1, { :value, 0, quoted }, 3] }
      -
      - -

      Which is not the expected result. For this, we use unquote:

      - -
      value = 13
      -quote do: sum(1, unquote(value), 3)
      -#=> { :sum, 0, [1, 13, 3] }
      -
      -
      - Source -
      -

      - unquote_splicing(expr) -

      -

      Unquotes the given list expanding its arguments. Similar -to unquote.

      - -

      Examples

      - -
      values = [2,3,4]
      -quote do: sum(1, unquote_splicing(values), 5)
      -#=> { :sum, 0, [1, 2, 3, 4, 5] }
      -
      -
      - Source -
      -

      - {}(args) -

      -

      Defines a new tuple.

      - -

      Examples

      - -
      :{}.(1,2,3)
      -{ 1, 2, 3 }
      -
      -
      - Source -
      -
      - -
      - - diff --git a/docs/master/Elixir.Typespec.html b/docs/master/Elixir.Typespec.html deleted file mode 100644 index c81524d75..000000000 --- a/docs/master/Elixir.Typespec.html +++ /dev/null @@ -1,147 +0,0 @@ - - - - Elixir.Typespec - - - - - - - - - - - - -
      -

      - Elixir.Typespec - -

      - - -
      -

      This is the module that converts Elixir typespecs -to Erlang typespecs syntax. Everytime @spec, @type -and @typep are used they proxy to the functions -in this module.

      - -
      - - - Source - - - - - - -

      Functions summary

      - - - - -

      Macros summary

      - - - - -
      -

      Functions

      -
      -

      - get_specs(module) -

      -

      Get the specs defined for the given module. This function -is only available for modules being compiled. If the module -was already compiled, you need to loop its attributes -to get such information.

      -
      - Source -
      -

      - get_types(module) -

      -

      Get the types defined for the given module. This function -is only available for modules being compiled. If the module -was already compiled, you need to loop its attributes -to get such information.

      -
      - Source -
      -
      - - - -
      -

      Macros

      -
      -

      - defcallback(spec, block) -

      -
      - Source -
      -

      - defspec(spec, block) -

      -
      - Source -
      -

      - deftype(name, options // []) -

      -
      - Source -
      -

      - deftypep(name) -

      -
      - Source -
      -
      - -
      - - diff --git a/docs/master/Enum.Iterator.HashDict.Record.html b/docs/master/Enum.Iterator.HashDict.Record.html deleted file mode 100644 index 6658757db..000000000 --- a/docs/master/Enum.Iterator.HashDict.Record.html +++ /dev/null @@ -1,79 +0,0 @@ - - - - Enum.Iterator.HashDict.Record - - - - - - - - - - - - -
      -

      - Enum.Iterator.HashDict.Record - - impl - -

      - - - - Source - - - - - - -

      Functions summary

      - - - - - - -
      -

      Functions

      -
      -

      - count(arg1) -

      -
      - Source -
      -

      - iterator(arg1) -

      -
      - Source -
      -
      - - - -
      - - diff --git a/docs/master/Enum.Iterator.List.html b/docs/master/Enum.Iterator.List.html index c2d6245d7..0cf75b7b6 100644 --- a/docs/master/Enum.Iterator.List.html +++ b/docs/master/Enum.Iterator.List.html @@ -29,7 +29,7 @@

      - Source + Source @@ -62,13 +62,13 @@

      Functions

      count(list)

      - Source + Source

      iterator(list)

      - Source + Source
      diff --git a/docs/master/Enum.Iterator.Orddict.Record.html b/docs/master/Enum.Iterator.Orddict.Record.html deleted file mode 100644 index 91853a5bb..000000000 --- a/docs/master/Enum.Iterator.Orddict.Record.html +++ /dev/null @@ -1,79 +0,0 @@ - - - - Enum.Iterator.Orddict.Record - - - - - - - - - - - - -
      -

      - Enum.Iterator.Orddict.Record - - impl - -

      - - - - Source - - - - - - -

      Functions summary

      - - - - - - -
      -

      Functions

      -
      -

      - count(arg1) -

      -
      - Source -
      -

      - iterator(arg1) -

      -
      - Source -
      -
      - - - -
      - - diff --git a/docs/master/Enum.Iterator.html b/docs/master/Enum.Iterator.html index 73bb4b368..c076be032 100644 --- a/docs/master/Enum.Iterator.html +++ b/docs/master/Enum.Iterator.html @@ -53,7 +53,13 @@

      Implementations

    12. - HashDict.Record + Function + +
    13. + +
    14. + + HashDict
    15. @@ -65,7 +71,7 @@

      Implementations

    16. - Orddict.Record + Orddict
    17. diff --git a/docs/master/Enum.OrdIterator.List.html b/docs/master/Enum.OrdIterator.List.html index 93c0df261..6370c349d 100644 --- a/docs/master/Enum.OrdIterator.List.html +++ b/docs/master/Enum.OrdIterator.List.html @@ -29,7 +29,7 @@

      - Source + Source @@ -62,13 +62,13 @@

      Functions

      iterator(list)

      - Source + Source

      to_list(arg1, _)

      - Source + Source
      diff --git a/docs/master/Enum.OrdIterator.Orddict.Record.html b/docs/master/Enum.OrdIterator.Orddict.Record.html deleted file mode 100644 index d6e126fc2..000000000 --- a/docs/master/Enum.OrdIterator.Orddict.Record.html +++ /dev/null @@ -1,79 +0,0 @@ - - - - Enum.OrdIterator.Orddict.Record - - - - - - - - - - - - -
      -

      - Enum.OrdIterator.Orddict.Record - - impl - -

      - - - - Source - - - - - - -

      Functions summary

      - - - - - - -
      -

      Functions

      -
      -

      - iterator(arg1) -

      -
      - Source -
      -

      - to_list(arg1, _) -

      -
      - Source -
      -
      - - - -
      - - diff --git a/docs/master/Enum.OrdIterator.html b/docs/master/Enum.OrdIterator.html index 6752d4620..e6b0e98e2 100644 --- a/docs/master/Enum.OrdIterator.html +++ b/docs/master/Enum.OrdIterator.html @@ -48,6 +48,12 @@

      Implementations

        +
      • + + Function + +
      • +
      • List @@ -56,7 +62,7 @@

        Implementations

      • - Orddict.Record + Orddict
      • diff --git a/docs/master/Enum.html b/docs/master/Enum.html index ccabd49e1..2a76fb9d3 100644 --- a/docs/master/Enum.html +++ b/docs/master/Enum.html @@ -197,7 +197,7 @@

        Functions summary

        Functions

        - all?(collection, fun // fn(x) do + all?(collection, fun // fn x -> x end)

        @@ -224,7 +224,7 @@

        Examples

        Source

        - any?(collection, fun // fn(x) do + any?(collection, fun // fn x -> x end)

        diff --git a/docs/master/ExUnit.Assertions.html b/docs/master/ExUnit.Assertions.html index 073d28f18..b4caf637c 100644 --- a/docs/master/ExUnit.Assertions.html +++ b/docs/master/ExUnit.Assertions.html @@ -40,9 +40,8 @@

        This module also provides other small convenient functions -like assert_empty, and assert_raise to easily handle other -common cases as checking if an enumerable is empty and handling -exceptions.

        +like assert_in_delta and assert_raise to easily handle other +common cases as checking a float number or handling exceptions.

        @@ -61,31 +60,11 @@

        Functions summary

        assert/2 -
      • - - assert_empty/2 - -
      • -
      • - - assert_error/2 - -
      • -
      • - - assert_exit/2 - -
      • assert_in_delta/4
      • -
      • - - assert_nil/2 - -
      • assert_raise/2 @@ -96,11 +75,6 @@

        Functions summary

        assert_raise/3
      • -
      • - - assert_throw/2 - -
      • flunk/1 @@ -111,26 +85,11 @@

        Functions summary

        refute/2
      • -
      • - - refute_empty/2 - -
      • refute_in_delta/4
      • -
      • - - refute_member/3 - -
      • -
      • - - refute_nil/2 - -
      @@ -148,6 +107,21 @@

      Macros summary

      assert_received/2 +
    18. + + catch_error/1 + +
    19. +
    20. + + catch_exit/1 + +
    21. +
    22. + + catch_throw/1 + +
    23. refute/1 @@ -170,55 +144,14 @@

      Functions

      assert(expected, message)

      Asserts the expected value is true. -If it fails, raises the given message.

      +If it fails, raises the given message.

      Examples

      assert false, "it will never be true"
       
      - Source -
      -

      - assert_empty(enum, message // nil) -

      -

      Asserts the enum collection is empty.

      - -

      Examples

      - -
      assert_empty []
      -assert_empty [1, 2]
      -
      -
      - Source -
      -

      - assert_error(expected, function) -

      -

      Asserts the error expected during function execution.

      - -

      Examples

      - -
      assert_error :function_clause, fn ->
      -  List.flatten(1)
      -end
      -
      -
      - Source -
      -

      - assert_exit(expected, function) -

      -

      Asserts the exit expected during function execution.

      - -

      Examples

      - -
      assert_exit 1, fn ->
      -  exit 1
      -end
      -
      -
      - Source + Source

      assert_in_delta(expected, received, delta, message // nil) @@ -231,19 +164,13 @@

      Examples

      assert_in_delta 10, 15, 4
      - Source -
      -

      - assert_nil(value, message // nil) -

      -

      Asserts the value is nil.

      -
      - Source + Source

      assert_raise(exception, function)

      -

      Asserts the exception is raised during function execution.

      +

      Asserts the exception is raised during function execution. +Returns the rescued exception, fails otherwise.

      Examples

      @@ -252,12 +179,13 @@

      Examples

      end
      - Source + Source

      assert_raise(exception, expected_message, function)

      -

      Asserts the exception is raised during function execution with the expected message.

      +

      Asserts the exception is raised during function execution with +the expected_message. Returns the rescued exception, fails otherwise.

      Examples

      @@ -266,21 +194,7 @@

      Examples

      end
      - Source -
      -

      - assert_throw(expected, function) -

      -

      Asserts the throw expected during function execution.

      - -

      Examples

      - -
      assert_throw 1, fn ->
      -  throw 1
      -end
      -
      -
      - Source + Source

      flunk(message // "Epic Fail!") @@ -292,7 +206,7 @@

      Examples

      flunk "This should raise an error"
       
      - Source + Source

      refute(not_expected, message) @@ -305,20 +219,7 @@

      Examples

      refute true, "This will obviously fail"
       
      - Source -
      -

      - refute_empty(enum, message // nil) -

      -

      Asserts the enum collection is not empty.

      - -

      Examples

      - -
      refute_empty []
      -refute_empty [1, 2]
      -
      -
      - Source + Source

      refute_in_delta(expected, received, delta, message // nil) @@ -331,20 +232,7 @@

      Examples

      refute_in_delta 10, 11, 2
      - Source -
      -

      - refute_member(base, container, message // nil) -

      -
      - Source -
      -

      - refute_nil(value, message // nil) -

      -

      Asserts the value is not nil.

      -
      - Source + Source
      @@ -370,21 +258,68 @@

      Examples

      assert true
       
      - Source + Source

      - assert_received(content, message // nil) + assert_received(expected, message // nil)

      -

      Assert a message was received and is in the current process mailbox. -Timeout is set to 0, so there is no waiting time.

      +

      Asserts a message was received and is in the current process mailbox. +The given expected content must to be a match pattern.

      + +

      Timeout is set to 0, so there is no waiting time.

      Examples

      self <- :hello
       assert_received :hello
       
      + +

      You can also match against specific patterns:

      + +
      self <- { :hello, "world" }
      +assert_received { :hello, _ }
      +
      - Source + Source +
      +

      + catch_error(expression) +

      +

      Asserts the given expression will cause an error. +Returns the error or fails otherwise.

      + +

      Examples

      + +
      assert catch_error(error 1) == 1
      +
      +
      + Source +
      +

      + catch_exit(expression) +

      +

      Asserts the given expression will exit. +Returns the exit status/message or fails otherwise.

      + +

      Examples

      + +
      assert catch_exit(exit 1) == 1
      +
      +
      + Source +
      +

      + catch_throw(expression) +

      +

      Asserts the given expression will throw a value. +Returns the thrown value or fails otherwise.

      + +

      Examples

      + +
      assert catch_throw(throw 1) == 1
      +
      +
      + Source

      refute(expected) @@ -399,13 +334,15 @@

      Examples

      refute false
       
      - Source + Source

      - refute_received(content, message // nil) + refute_received(not_expected, message // nil)

      -

      Refutes a message was not received (i.e. it is not in the current process mailbox). -Timeout is set to 0, so there is no waiting time.

      +

      Asserts a message was not received (i.e. it is not in the current process mailbox). +The not_expected contents must be a match pattern.

      + +

      Timeout is set to 0, so there is no waiting time.

      Examples

      @@ -413,7 +350,7 @@

      Examples

      refute_received :bye
      - Source + Source
      diff --git a/docs/master/ExUnit.Case.html b/docs/master/ExUnit.Case.html index a7fb67a14..ea0ddf86a 100644 --- a/docs/master/ExUnit.Case.html +++ b/docs/master/ExUnit.Case.html @@ -40,10 +40,11 @@

      Callbacks

      -

      This module defines two callbacks. setup_all and teardown_all -which are executed before and after all tests respectively. -Those callbacks needs to return :ok, otherwise we assume -tests should not be run.

      +

      This module defines four callbacks. setup_all() and +teardown_all() which are executed before and after +all tests respectively and setup(test) and teardown(test) +which are executed before and after each test, receiving +the test name as argument.

      Examples

      @@ -102,7 +103,7 @@

      Examples

      end - Source + Source diff --git a/docs/master/ExUnit.html b/docs/master/ExUnit.html index 1b2628cb8..ffa43d8c2 100644 --- a/docs/master/ExUnit.html +++ b/docs/master/ExUnit.html @@ -38,14 +38,20 @@

      Example

      # 1) Start ExUnit. You can pass some options as argument (list below) ExUnit.start -# 2) Next we create a new TestCase and use ExUnit.Case, async: true +# 2) Next we create a new TestCase and use ExUnit.Case defmodule AssertionTest do + # 3) Notice we pass async: true, this runs the test case in parallel use ExUnit.Case, async: true - # 3) A test is a method which name finishes with _test + # 4) A test is a method which name finishes with _test def test_always_pass do assert true end + + # 5) It is recommended to use the test macro instead of def + test "the truth" do + assert true + end end @@ -111,7 +117,7 @@

      Options

    24. :max_cases - Maximum number of cases to run in parallel
    25. - Source + Source

      run() @@ -119,7 +125,7 @@

      Options

      API used to run the tests. A developer does not need to call it directly.

      - Source + Source

      start(options // []) @@ -128,7 +134,7 @@

      Options

      any file that uses ExUnit.Case. Check configure/1 to see the supported options.

      - Source + Source diff --git a/docs/master/File.html b/docs/master/File.html index c0c0145c8..668139fa6 100644 --- a/docs/master/File.html +++ b/docs/master/File.html @@ -65,7 +65,7 @@

      - Source + Source @@ -174,6 +174,21 @@

      Functions summary

      extname/1 +
    26. + + iterator/1 + +
    27. +
    28. + + iterator/2 + +
    29. +
    30. + + iterator!/2 + +
    31. join/1 @@ -306,12 +321,12 @@

      Functions summary

    32. - touch/1 + touch/2
    33. - touch!/1 + touch!/2
    34. @@ -370,7 +385,7 @@

      Examples

      #=> "" - Source + Source

      basename(path, extension) @@ -392,7 +407,7 @@

      Examples

      #=> "bar.old"
      - Source + Source

      cd(path) @@ -400,14 +415,14 @@

      Examples

      Sets the current working directory. Returns :ok if successful, { :error, reason } otherwise.

      - Source + Source

      cd!(path)

      The same as cd/0, but raises an exception if it fails.

      - Source + Source

      cd!(path, function) @@ -419,7 +434,7 @@

      Examples

      Raises an error if retrieving or changing the current directory fails.

      - Source + Source

      close(io_device) @@ -431,7 +446,7 @@

      Examples

      close/1 might return an old write error and not even try to close the file. See open/2.

      - Source + Source

      copy(source, destination, bytes_count // :infinity) @@ -450,7 +465,7 @@

      Examples

      Typical error reasons are the same as in open/2, read/1 and write/2.

      - Source + Source

      copy!(source, destination, bytes_count // :infinity) @@ -458,10 +473,10 @@

      Examples

      The same as copy/3 but raises an File.CopyError if it fails. Returns the bytes_copied otherwise.

      - Source + Source

      - cp(source, destination, callback // fn(_, _) do + cp(source, destination, callback // fn _, _ -> true end)

      @@ -483,20 +498,20 @@

      Examples

      It returns :ok in case of success, returns { :error, reason } otherwise.

      - Source + Source

      - cp!(source, destination, callback // fn(_, _) do + cp!(source, destination, callback // fn _, _ -> true end)

      The same as cp/3, but raises File.CopyError if it fails. Returns the list of copied files otherwise.

      - Source + Source

      - cp_r(source, destination, callback // fn(_, _) do + cp_r(source, destination, callback // fn _, _ -> true end)

      @@ -545,17 +560,17 @@

      Examples

      end
      - Source + Source

      - cp_r!(source, destination, callback // fn(_, _) do + cp_r!(source, destination, callback // fn _, _ -> true end)

      The same as cp_r/3, but raises File.CopyError if it fails. Returns the list of copied files otherwise.

      - Source + Source

      cwd() @@ -565,21 +580,21 @@

      Examples

      directories of the current directory. For this reason, returns { :ok, cwd } in case of success, { :error, reason } otherwise.

      - Source + Source

      cwd!()

      The same as cwd/0, but raises an exception if it fails.

      - Source + Source

      dir?(path)

      Returns true if the path is a directory.

      - Source + Source

      dirname(path) @@ -595,7 +610,7 @@

      Examples

      #=> "foo"
      - Source + Source

      exists?(path) @@ -616,7 +631,7 @@

      Examples

      #=> true
      - Source + Source

      expand_path(path) @@ -632,7 +647,7 @@

      Examples

      File.expand_path("/foo/bar/../bar") == "/foo/bar"
       
      - Source + Source

      expand_path(path, relative_to) @@ -650,7 +665,7 @@

      Examples

      File.expand_path("/foo/bar/../bar", "/baz") == "/foo/bar"
      - Source + Source

      extname(path) @@ -668,7 +683,48 @@

      Examples

      #=> ""
      - Source + Source +
      +

      + iterator(device) +

      +

      Convert the file device into an iterator that can be +passed into Enum. The device is iterated line +by line lazily, at the end of iteration the file is +closed.

      + +

      Examples

      + +

      An example that lazily iterates a file replacing all double +quotes per single quotes and write each line to a target file +is shown below:

      + +
      source = File.iterator("README.md")
      +File.open "NEWREADME.md", [:write], fn(target) ->
      +  Enum.each source, fn(line) ->
      +    IO.write target, Regex.replace_all(%r/"/, line, "'")
      +  end
      +end
      +
      +
      + Source +
      +

      + iterator(file, mode) +

      +

      Opens the given file with the given mode and +returns its iterator. Fails for the same reasons +as File.open.

      +
      + Source +
      +

      + iterator!(file, mode // []) +

      +

      Same as iterator/2 but raises if the file +cannot be opened.

      +
      + Source

      join(paths) @@ -689,7 +745,7 @@

      Examples

      #=> "/foo/bar"
      - Source + Source

      join(left, right) @@ -705,7 +761,7 @@

      Examples

      #=> "foo/bar"
      - Source + Source

      mkdir(path) @@ -724,14 +780,14 @@

      Examples

      On some platforms, :enoent is returned instead.
    35. - Source + Source

      mkdir!(path)

      Same as mkdir, but raises an exception in case of failure. Otherwise :ok.

      - Source + Source

      mkdir_p(path) @@ -747,14 +803,14 @@

      Examples

    36. :enotdir - A component of path is not a directory.
    37. - Source + Source

      mkdir_p!(path)

      Same as mkdir_p, but raises an exception in case of failure. Otherwise :ok.

      - Source + Source

      open(path, modes // []) @@ -804,7 +860,7 @@

      Examples

      File.close(file)
      - Source + Source

      open(path, modes, function) @@ -828,7 +884,7 @@

      Examples

      IO.readline(file) end)

      - Source + Source

      open!(path, modes // []) @@ -836,7 +892,7 @@

      Examples

      Same as open/2 but raises an error if file could not be opened. Returns the io_device otherwise.

      - Source + Source

      open!(path, modes, function) @@ -844,7 +900,7 @@

      Examples

      Same as open/3 but raises an error if file could not be opened. Returns the function result otherwise.

      - Source + Source

      read(path) @@ -866,7 +922,7 @@

      Examples

      You can use Erlang.file.format_error(reason) to get a descriptive string of the error.

      - Source + Source

      read!(path) @@ -874,19 +930,19 @@

      Examples

      Returns binary with the contents of the given filename or raises File.Error if an error occurs.

      - Source + Source

      read_info(path, opts // [])

      - Source + Source

      read_info!(path, opts // [])

      - Source + Source

      regular?(path) @@ -898,7 +954,7 @@

      Examples

      File.regular? __FILE__ #=> true
       
      - Source + Source

      rm(path) @@ -926,14 +982,14 @@

      Examples

      #=> {:error, :eperm}
      - Source + Source

      rm!(path)

      Same as rm, but raises an exception in case of failure. Otherwise :ok.

      - Source + Source

      rm_rf(path) @@ -955,7 +1011,7 @@

      Examples

      #=> { :ok, [] }
      - Source + Source

      rm_rf!(path) @@ -963,7 +1019,7 @@

      Examples

      Same as rm_rf/1 but raises File.Error in case of failures, otherwise the list of files or directories removed.

      - Source + Source

      rmdir(path) @@ -980,14 +1036,14 @@

      Examples

      #=> {:error, :enotdir}
      - Source + Source

      rmdir!(path)

      Same as rmdir/1, but raises an exception in case of failure. Otherwise :ok.

      - Source + Source

      rootname(path) @@ -1005,7 +1061,7 @@

      Examples

      #=> "/foo/bar"
      - Source + Source

      rootname(path, extension) @@ -1024,7 +1080,7 @@

      Examples

      #=> "/foo/bar.erl"
      - Source + Source

      split(path) @@ -1042,7 +1098,7 @@

      Examples

      #=> ["/", "foo", "bar"]
      - Source + Source

      stat(path, opts // []) @@ -1061,7 +1117,7 @@

      Options

      Default is local.
      - Source + Source

      stat!(path, opts // []) @@ -1069,23 +1125,23 @@

      Options

      Same as stat but returns the File.Stat directly and throws File.Error if an error is returned.

      - Source + Source
      -

      - touch(path) +

      + touch(path, time // calendar.local_time())

      Updates modification time (mtime) and access time (atime) of the given file. File is created if it doesn’t exist.

      - Source + Source
      -

      - touch!(path) +

      + touch!(path, time // calendar.local_time())

      Same as touch/1 but raises an exception if it fails. Returns :ok otherwise.

      - Source + Source

      wildcard(glob) @@ -1125,7 +1181,7 @@

      Examples

      File.wildcard("projects/*/ebin/**/*.{beam,app}")
       
      - Source + Source

      write(path, content, modes // []) @@ -1145,14 +1201,14 @@

      Examples

    38. :eisdir - The named file is a directory.
    39. - Source + Source

      write!(path, content, modes // [])

      Same as write/3 but raises an exception if it fails, returns :ok otherwise.

      - Source + Source

      write_stat(path, stat, opts // []) @@ -1160,7 +1216,7 @@

      Examples

      Writes the given File.Stat back to the filesystem at the given path. Returns :ok or { :error, reason }.

      - Source + Source

      write_stat!(path, stat, opts // []) @@ -1168,7 +1224,7 @@

      Examples

      Same as write_stat/3 but raises an exception if it fails. Returns :ok otherwise.

      - Source + Source
      diff --git a/docs/master/HashDict.html b/docs/master/HashDict.html index e9f02cabe..4ce626f19 100644 --- a/docs/master/HashDict.html +++ b/docs/master/HashDict.html @@ -34,7 +34,7 @@

      - Source + Source @@ -73,7 +73,7 @@

      Functions

      Creates a new empty dict.

      - Source + Source

      new(pairs) @@ -86,7 +86,7 @@

      Examples

      #=> [a: 1, b: 2]
      - Source + Source

      new(list, transform) @@ -100,7 +100,7 @@

      Examples

      #=> ["a": "a", "b": "b"]
      - Source + Source diff --git a/docs/master/IEx.Helpers.html b/docs/master/IEx.Helpers.html index 5008d85b4..1412891f2 100644 --- a/docs/master/IEx.Helpers.html +++ b/docs/master/IEx.Helpers.html @@ -29,14 +29,19 @@

      A bunch of helpers available in IEx.

      -

      Documentation for functions in this module can be -consulted directly from the command line, example:

      +
        +
      • c - compiles a file in the given path
      • +
      • d - prints documentation
      • +
      • h - prints history
      • +
      • m - prints loaded modules
      • +
      • r - recompiles and reloads the given module's source file
      • +
      • v - retrieves nth value from console
      • +
      -
      d(:c, 2)
      -
      +

      Documentation for functions in this module can be consulted +directly from the command line, as an example, try:

      -

      Will print the documentation for the function c -in this module with arity 2.

      +

      d(:c, 1)

      @@ -57,7 +62,7 @@

      Functions summary

    40. - d/1 + d/0
    41. @@ -82,7 +87,12 @@

      Functions summary

    42. - m/1 + r/0 + +
    43. +
    44. + + r/1
    45. @@ -95,6 +105,16 @@

      Functions summary

      +

      Macros summary

      +
        +
      • + + d/1 + +
      • + +
      +
      @@ -113,21 +133,14 @@

      Examples

      #=> Foo
      - Source + Source
      -

      - d(module // IEx.Helpers) +

      + d()

      -

      Shows the documentation for the given module. -Defaults to print documentation for IEx.Helpers.

      - -

      Examples

      - -
      d(Enum)
      -#=> Prints documentation for Enum
      -
      +

      Shows the documentation for IEx.Helpers.

      - Source + Source

      d(function, arity) @@ -135,7 +148,7 @@

      Examples

      Prints the documentation for the given function and arity.

      The function may either be a function defined inside IEx.Helpers -or in Elixir.Builtin. To see functions from other module, use +or in Kernel. To see functions from other module, use d/3 instead.

      Examples

      @@ -144,35 +157,46 @@

      Examples

      #=> Prints documentation for this function
      - Source + Source

      d(module, function, arity)

      Shows the documentation for the function/arity in module.

      - Source + Source

      h()

      Prints commands history and their result.

      - Source + Source

      m()

      Returns the name and module of all modules loaded.

      - Source + Source +
      +

      + r() +

      +

      Reloads all modules that were already reloaded +at some point with r/1.

      +
      + Source
      -

      - m(mod) +

      + r(module)

      -

      Prints the module information for the given module.

      +

      Recompiles and reloads the specified module's source file.

      + +

      Please note that all the modules defined in the specified +files are recompiled and reloaded.

      - Source + Source

      v(n) @@ -181,12 +205,38 @@

      Examples

      values to lookup query's value from latest to earliest. For instance, v(-1) returns the latest result.

      - Source + Source
      +
      +

      Macros

      +
      +

      + d(other) +

      +

      Shows the documentation for the given module +or for the given function/arity pair.

      + +

      Examples

      + +
      d(Enum)
      +#=> Prints documentation for Enum
      +
      + +

      It also accepts functions in the format fun/arity +and module.fun/arity, for example:

      + +
      d receive/1
      +d Enum.all?/2
      +
      +
      + Source +
      +
      + diff --git a/docs/master/IEx.UnicodeIO.html b/docs/master/IEx.UnicodeIO.html index b959eda8d..4e93074ed 100644 --- a/docs/master/IEx.UnicodeIO.html +++ b/docs/master/IEx.UnicodeIO.html @@ -74,7 +74,7 @@

      Functions

      Implements the error IO API used by IEx. It prints error messages.

      - Source + Source

      get(config) @@ -91,7 +91,7 @@

      Functions

      Implements the put IO API used by IEx. It receives the result and prints it.

      - Source + Source
      diff --git a/docs/master/IEx.html b/docs/master/IEx.html index 6327e7e4e..d104f4fc4 100644 --- a/docs/master/IEx.html +++ b/docs/master/IEx.html @@ -51,17 +51,22 @@

      Functions summary

      • - simple/2 + cli/0
      • - start/2 + run/1
      • - tty/2 + simple/1 + +
      • +
      • + + tty/1
      • @@ -74,28 +79,34 @@

        Functions summary

        Functions

        -

        - simple(binding // [], io // IEx.UnicodeIO) +

        + cli()

        -

        Starts IEx simply using stdio. It requires the initial -binding an the IO mechanism as argument.

        +

        Interface to start IEx from CLI.

        - Source + Source
        -

        - start(binding // [], io // IEx.UnicodeIO) +

        + run(opts // [])

        -

        Starts IEx checking if tty is available or not. +

        Runs IEx checking if tty is available or not. If so, invoke tty, otherwise go with the simple iex.

        - Source + Source
        -

        - tty(binding // [], io // IEx.UnicodeIO) +

        + simple(opts // []) +

        +

        Starts IEx simply using the current stdio.

        +
        + Source +
        +

        + tty(opts // [])

        Starts IEx using a tty server.

        - Source + Source
        diff --git a/docs/master/List.Chars.html b/docs/master/List.Chars.html index 997b2cf38..e47ec9542 100644 --- a/docs/master/List.Chars.html +++ b/docs/master/List.Chars.html @@ -35,7 +35,7 @@

        to_char_list which does the conversion.

        The to_char_list function automatically imported -by Elixir.Builtin invokes this protocol.

        +by Kernel invokes this protocol.

        diff --git a/docs/master/List.html b/docs/master/List.html index d9ddbecb4..01c671c83 100644 --- a/docs/master/List.html +++ b/docs/master/List.html @@ -227,7 +227,7 @@

        Examples

        #=> [[1,2],[1,2]]
        - Source + Source

        flatten(list) @@ -303,7 +303,7 @@

        Examples

        #=> [{ :a, 1 }, { :b, 2 }]
        - Source + Source

        keyfind(list, item, position, default // nil) @@ -324,7 +324,7 @@

        Examples

        #=> nil
        - Source + Source

        keymember?(list, item, position) @@ -345,10 +345,10 @@

        Examples

        #=> false
        - Source + Source

        - last(xA) + last(list)

        Returns the last element in list or nil if the list is empty.

        @@ -362,7 +362,7 @@

        Examples

        #=> 3
        - Source + Source

        member?(list, term) @@ -380,7 +380,7 @@

        Examples

        #=> false
        - Source + Source

        range(first, last, step // nil) @@ -400,10 +400,10 @@

        Examples

        List.range 5, 1, -2 #=> [5, 3, 1]
        - Source + Source

        - reverse(xA) + reverse(list)

        Reverses the given list. This function simply delegates to lists:reverse which is implemented in C for performance.

        @@ -428,7 +428,7 @@

        Examples

        #=> [1, 2, 3, 4, 7]
        - Source + Source

        sort(list, fun) @@ -442,7 +442,7 @@

        Examples

        #=> [7, 4, 3, 2, 1]
        - Source + Source

        uniq(list) @@ -455,7 +455,7 @@

        Examples

        #=> [1,2,3]
        - Source + Source

        unzip(list) @@ -472,7 +472,7 @@

        Examples

        #=> [[1, 2, 3], [:a, :b, :c]]
        - Source + Source

        wrap(list) @@ -486,7 +486,7 @@

        Examples

        List.wrap [1,2,3] #=> [1,2,3]
         
        - Source + Source

        zip(list_of_lists) @@ -502,7 +502,7 @@

        Examples

        #=> [{1, 3, 5}]
        - Source + Source

        zip(item1, item2) @@ -520,7 +520,7 @@

        Examples

        #=> [{1, 4}, {2, 5}]
        - Source + Source diff --git a/docs/master/Macro.html b/docs/master/Macro.html index 754c605c9..1d655ebfb 100644 --- a/docs/master/Macro.html +++ b/docs/master/Macro.html @@ -193,7 +193,7 @@

        Examples

        end - Source + Source

        to_binary(tree) diff --git a/docs/master/Mix.Project.html b/docs/master/Mix.Project.html index 16b4dc92b..90c110473 100644 --- a/docs/master/Mix.Project.html +++ b/docs/master/Mix.Project.html @@ -41,7 +41,7 @@

        Examples

        def project do [ - app: "my_app", + app: :my_app, vsn: "0.6.0" ] end @@ -49,7 +49,7 @@

        Examples

        After defined, the configuration for this project can be read -as Mix.Project.config/0. Notice that config won't fail if a +as Mix.project/0. Notice that config won't fail if a project is not defined, this allows many of mix tasks to work even without a project.

        @@ -72,7 +72,7 @@

        Functions summary

        • - config/0 + behaviour_info/1
        • @@ -95,16 +95,11 @@

          Functions summary

          Functions

          -

          - config() +

          + behaviour_info(atom1)

          -

          Retrieves the current project configuration. If there -isn't a project defined, this function will simply -return a keywords list with default values. This allows -many mix functions to work without a need for an -underlying project.

          -
          - Source +
          + Source

          current() @@ -112,14 +107,14 @@

          Functions

          Retrieves the current project, raises an error if there is no project set.

          - Source + Source

          defined?()

          Returns true if a current project is defined.

          - Source + Source
          diff --git a/docs/master/Mix.Shell.Test.html b/docs/master/Mix.Shell.Test.html deleted file mode 100644 index 74a44384f..000000000 --- a/docs/master/Mix.Shell.Test.html +++ /dev/null @@ -1,104 +0,0 @@ - - - - Mix.Shell.Test - - - - - - - - - - - - -
          -

          - Mix.Shell.Test - -

          - - -
          -

          This is Mix's test shell. -It simply sends the received calls to -the current process queue, so they can be read later.

          - -
          - - - Source - - - - - - -

          Functions summary

          - - - - - - -
          -

          Functions

          -
          -

          - error(message) -

          -
          - Source -
          -

          - flush(callback // fn(x) do - x -end) -

          -

          Flush all :mix_shell messages from the current process. -If a callback is given, it is invoked for each received message.

          - -

          Examples

          - -
          flush IO.inspect(&1)
          -
          -
          - Source -
          -

          - info(message) -

          -
          - Source -
          -
          - - - -
          - - diff --git a/docs/master/Mix.Shell.html b/docs/master/Mix.Shell.html index b6caef203..e9b9f0da6 100644 --- a/docs/master/Mix.Shell.html +++ b/docs/master/Mix.Shell.html @@ -57,6 +57,11 @@

          Functions summary

          info/1
        • +
        • + + yes?/1 + +
        @@ -72,7 +77,7 @@

        Functions

        Define Mix.Shell callbacks.

        - Source + Source

        error(message) @@ -87,6 +92,15 @@

        Functions

        Writes a message to the shell followed by new line.

        Source +
        +

        + yes?(message) +

        +

        Receives a message and asks the user if he wants to proceed. +He must press enter or type anything that matches the a "yes" +regex %r/^Y(es)?$/i.

        +
        + Source
        diff --git a/docs/master/Mix.Task.html b/docs/master/Mix.Task.html index d2d0c6f18..35d17fb87 100644 --- a/docs/master/Mix.Task.html +++ b/docs/master/Mix.Task.html @@ -46,6 +46,11 @@

        Functions summary

        all_modules/0 +
      • + + behaviour_info/1 + +
      • clear/0 @@ -56,6 +61,11 @@

        Functions summary

        get/1
      • +
      • + + hidden?/1 + +
      • load_all/0 @@ -103,6 +113,12 @@

        Functions

        won't show up. Check load_all/0 if you want to preload all tasks.

        Source +
        +

        + behaviour_info(atom1) +

        +
        + Source

        clear() @@ -110,7 +126,7 @@

        Functions

        Clears all invoked tasks, allowing them to be reinvoked. Returns an ordset with all the tasks invoked thus far.

        - Source + Source

        get(task) @@ -124,7 +140,14 @@

        Exceptions

      • Mix.InvalidTaskError - raised if the task is not a valid Mix.Task
      - Source + Source +
      +

      + hidden?(module) +

      +

      Checks if the task is hidden or not. Returns a boolean.

      +
      + Source

      load_all() @@ -146,7 +169,7 @@

      Exceptions

      Reenables a given task so it can be executed again down the stack.

      - Source + Source

      run(task, args // []) @@ -161,7 +184,7 @@

      Exceptions

      It may raise an exception if the task was not found or it is invalid. Check get/2 for more information.

      - Source + Source

      shortdoc(module) @@ -176,7 +199,7 @@

      Exceptions

      Returns the task name for the given module.

      - Source + Source
      diff --git a/docs/master/Mix.Tasks.Compile.Elixir.html b/docs/master/Mix.Tasks.Compile.Elixir.html index 8ac322438..07036492f 100644 --- a/docs/master/Mix.Tasks.Compile.Elixir.html +++ b/docs/master/Mix.Tasks.Compile.Elixir.html @@ -64,13 +64,13 @@

      Configuration

      Command line options

        -
      • --force forces compilation regardless of mod times;
      • +
      • --force - forces compilation regardless of mod times;
      - Source + Source @@ -98,7 +98,7 @@

      Functions

      run(args)

      - Source + Source diff --git a/docs/master/Mix.Tasks.Compile.html b/docs/master/Mix.Tasks.Compile.html index 0f438c0db..c9a9ade06 100644 --- a/docs/master/Mix.Tasks.Compile.html +++ b/docs/master/Mix.Tasks.Compile.html @@ -28,7 +28,8 @@

      A meta task that compile source files. It simply runs the -compilers registered in your project.

      +compilers registered in your project. At the end of compilation +it ensures load paths are set.

      Configuration

      @@ -38,16 +39,16 @@

      Configuration

      [:elixir, :app]

    46. -

      Can be configured in your projects as:

      +

      It can be configured to handle custom compilers, for example:

      -
      [compilers: [:elixir, :erlang, :app]]
      +
      [compilers: [:elixir, :mycompiler, :app]]
       

      Command line options

        -
      • --list List all enabled compilers. - mix help should give you the full list.
      • +
      • --list - List all enabled compilers.
      • +
      • --no-check - Skip dependencies check before compilation.
      @@ -81,7 +82,7 @@

      Functions

      run(args)

      - Source + Source diff --git a/docs/master/Mix.Tasks.Loadpaths.html b/docs/master/Mix.Tasks.Loadpaths.html index 3f3520cd6..11c914bf2 100644 --- a/docs/master/Mix.Tasks.Loadpaths.html +++ b/docs/master/Mix.Tasks.Loadpaths.html @@ -27,11 +27,17 @@

      -

      Loads the application paths.

      +

      Load the application and its dependencies paths.

      -

      This task is does not appear when mix help is invoked -since it is hidden (it does not contain a shortdoc), -however it can be freely invoked from other tasks.

      +

      This task is not shown in mix help but it is part +of mix public API and can be depended on.

      + +

      Configuration

      + +
        +
      • :load_paths extra load paths to be added. +They are added with lower priority than the app ones.
      • +
      @@ -64,7 +70,7 @@

      Functions

      run(_)

      - Source + Source diff --git a/docs/master/Mix.Utils.html b/docs/master/Mix.Utils.html index e66d56b2c..2ae2b9095 100644 --- a/docs/master/Mix.Utils.html +++ b/docs/master/Mix.Utils.html @@ -29,21 +29,17 @@

      Utilities used throughout Mix and tasks.

      -

      Command names and module names

      +

      Conversions

      -

      Throughout this module (and Mix), we use two main terms:

      +

      This module handles two types of conversions:

        -
      • command names: are names as given from the command line; -usually all items are in lowercase and uses dashes instead -of underscores;

      • -
      • module names: valid module names according to Elixir;

      • +
      • From command names to module names, i.e. how the command +deps.get translates to Deps.Get and vice-versa;

      • +
      • From underscore to camelize, i.e. how the file path +my_project translates to MyProject;

      -

      Some tasks in this module works exactly with converting -from one to the other. See command_to_module_name/2, -module_name_to_command/2, get_module/2.

      -
      @@ -57,13 +53,23 @@

      Command names and module names

      Functions summary

      @@ -81,21 +107,20 @@

      Functions summary

      Functions

      -

      - command_to_module_name(s) +

      + camelize(arg1)

      -

      Takes a command and converts it to a module name format.

      +

      Converts the given string to camelize format.

      Examples

      -
      command_to_module_name("compile.elixir")
      -#=> "Compile.Elixir"
      +
      Mix.Utils.camelize "foo_bar" #=> "FooBar"
       
      - Source + Source
      -

      - get_module(command, at // __MAIN__) +

      + command_to_module(command, at // Elixir)

      Takes a command name and try to load a module with the command name converted to a module name @@ -106,11 +131,32 @@

      Examples

      Examples

      -
      Mix.Utils.get_module("compile", Mix.Tasks)
      +
      Mix.Utils.command_to_module("compile", Mix.Tasks)
       #=> { :module, Mix.Tasks.Compile }
       
      - Source + Source +
      +

      + command_to_module_name(s) +

      +

      Takes a command and converts it to a module name format.

      + +

      Examples

      + +
      command_to_module_name("compile.elixir")
      +#=> "Compile.Elixir"
      +
      +
      + Source +
      +

      + config_merge(old, new) +

      +

      Merges two configs recursively, merging keywords lists +and concatenating normal lists.

      +
      + Source

      module_name_to_command(module, nesting // 0) @@ -128,7 +174,48 @@

      Examples

      #=> "compile.elixir"
      - Source + Source +
      +

      + source(module) +

      +

      Gets the source location of a module as a binary.

      +
      + Source +
      +

      + stale?(source, target) +

      +

      Returns true if any of target is stale compared to source. +If target or source is a binary, it is expanded using File.wildcard.

      +
      + Source +
      +

      + underscore(arg1) +

      +

      Converts the given string to underscore format.

      + +

      Examples

      + +
      Mix.Utils.underscore "FooBar" #=> "foo_bar"
      +
      + +

      In general, underscore can be thought as the reverse of +camelize, however, in some cases formatting may be lost:

      + +
      Mix.Utils.underscore "SAPExample"  #=> "sap_example"
      +Mix.Utils.camelize   "sap_example" #=> "SapExample"
      +
      +
      + Source +
      +

      + user_home() +

      +

      Gets the user home attempting to consider OS system diferences.

      +
      + Source
      diff --git a/docs/master/Mix.html b/docs/master/Mix.html index 8ac4c0dfa..ec81e79ff 100644 --- a/docs/master/Mix.html +++ b/docs/master/Mix.html @@ -26,6 +26,19 @@

      +
      +

      Mix is a build tool that provides tasks for creating, compiling, testing +(and soon deploying) Elixir projects. Mix is inspired by the Leiningen +build tool for Clojure and was written by one of its contributors.

      + +

      This module works as a facade for accessing the most common functionality +in Elixir, as the shell and the current project configuration.

      + +

      For getting started with Elixir, checkout out the guide available in +Elixir's website.

      + +
      + Source @@ -37,6 +50,16 @@

      Functions summary

      • + + loadpaths/0 + +
      • +
      • + + project/0 + +
      • +
      • shell/0 @@ -61,6 +84,24 @@

        Functions summary

        Functions

        +

        + loadpaths() +

        +

        Starts mix and loads the project and dependencies into +one step. Useful when invoking mix from an external tool.

        +
        + Source +
        +

        + project() +

        +

        Retrieves the current project configuration. If there +isn't a project defined, this function will simply +return an empty keywords list. This allows many mix +tasks to work without a need for an underlying project.

        +
        + Source +

        shell()

        @@ -71,21 +112,21 @@

        Functions

        allow developers to use a test shell, that simply sends the messages to the current process.

        - Source + Source

        shell(shell)

        Sets the current shell.

        - Source + Source

        start()

        Starts the mix application and its dependencies.

        - Source + Source
        diff --git a/docs/master/Module.html b/docs/master/Module.html index 22586d798..7139589cf 100644 --- a/docs/master/Module.html +++ b/docs/master/Module.html @@ -75,32 +75,32 @@

        Functions summary

      • - defined_functions/1 + defines?/2
      • - defined_functions/2 + defines?/3
      • - delete_attribute/2 + definitions_in/1
      • - eval_quoted/4 + definitions_in/2
      • - function_defined?/2 + delete_attribute/2
      • - function_defined?/3 + eval_quoted/4
      • @@ -152,13 +152,13 @@

        Examples

        end
        - Source + Source

        add_compile_callback(module, target, fun // :__compiling__)

        - Source + Source

        add_doc(module, line, kind, tuple, signature, doc) @@ -209,8 +209,43 @@

        Examples

        Source
        -

        - defined_functions(module) +

        + defines?(module, tuple) +

        +

        Checks if the module defines the given function or macro. +Use defines?/3 to assert for an specific type.

        + +

        Examples

        + +
        defmodule Example do
        +  Module.defines? __MODULE__, { :version, 0 } #=> false
        +  def version, do: 1
        +  Module.defines? __MODULE__, { :version, 0 } #=> true
        +end
        +
        +
        + Source +
        +

        + defines?(module, tuple, kind) +

        +

        Checks if the module defines a function or macro with the +given kind. kind can be either :def, :defp, +:defmacro or :defmacrop.

        + +

        Examples

        + +
        defmodule Example do
        +  Module.defines? __MODULE__, { :version, 0 }, :defp #=> false
        +  def version, do: 1
        +  Module.defines? __MODULE__, { :version, 0 }, :defp #=> false
        +end
        +
        +
        + Source +
        +

        + definitions_in(module)

        Return all functions defined in the given module.

        @@ -218,14 +253,14 @@

        Examples

        defmodule Example do
           def version, do: 1
        -  Module.defined_functions __MODULE__ #=> [{:version,1}]
        +  Module.definitions_in __MODULE__ #=> [{:version,1}]
         end
         
        - Source + Source
        -

        - defined_functions(module, kind) +

        + definitions_in(module, kind)

        Returns all functions defined in te given module according to its kind.

        @@ -234,12 +269,12 @@

        Examples

        defmodule Example do
           def version, do: 1
        -  Module.defined_functions __MODULE__, :def  #=> [{:version,1}]
        -  Module.defined_functions __MODULE__, :defp #=> []
        +  Module.definitions_in __MODULE__, :def  #=> [{:version,1}]
        +  Module.definitions_in __MODULE__, :defp #=> []
         end
         
        - Source + Source

        delete_attribute(module, key) @@ -254,7 +289,7 @@

        Examples

        end
        - Source + Source

        eval_quoted(env, quoted, binding // [], opts // []) @@ -295,41 +330,6 @@

        Examples

        Source -
        -

        - function_defined?(module, tuple) -

        -

        Checks if a function was defined, regardless if it is -a macro or a private function. Use function_defined?/3 -to assert for an specific type.

        - -

        Examples

        - -
        defmodule Example do
        -  Module.function_defined? __MODULE__, { :version, 0 } #=> false
        -  def version, do: 1
        -  Module.function_defined? __MODULE__, { :version, 0 } #=> true
        -end
        -
        -
        - Source -
        -

        - function_defined?(module, tuple, kind) -

        -

        Checks if a function was defined and also for its kind. -kind can be either :def, :defp or :defmacro.

        - -

        Examples

        - -
        defmodule Example do
        -  Module.function_defined? __MODULE__, { :version, 0 }, :defp #=> false
        -  def version, do: 1
        -  Module.function_defined? __MODULE__, { :version, 0 }, :defp #=> false
        -end
        -
        -
        - Source

        make_overridable(module, tuples) @@ -338,7 +338,7 @@

        Examples

        An overridable function is lazily defined, allowing a developer to customize it.

        - Source + Source

        read_attribute(module, key) @@ -359,7 +359,7 @@

        Examples

        end
        - Source + Source

        register_attribute(module, new, opts // []) @@ -396,7 +396,7 @@

        Examples

        end
        - Source + Source

        safe_concat(list) diff --git a/docs/master/Node.html b/docs/master/Node.html index 52656c0ff..cd64c1d1d 100644 --- a/docs/master/Node.html +++ b/docs/master/Node.html @@ -76,6 +76,26 @@

        Functions summary

        self/0
      • +
      • + + spawn/3 + +
      • +
      • + + spawn/5 + +
      • +
      • + + spawn_link/2 + +
      • +
      • + + spawn_link/4 + +
      @@ -151,6 +171,51 @@

      Functions

      Returns the current node. It returns the same as the built-in node().

      Source +
      +

      + spawn(node, fun, opts // []) +

      +

      Returns the pid of a new process started by the application of fun +on node. If node does not exist, a useless pid is returned.

      + +

      Check http://www.erlang.org/doc/man/erlang.html#spawn_opt-4 for +the list of available options.

      +
      + Source +
      +

      + spawn(node, module, fun, args, opts // []) +

      +

      Returns the pid of a new process started by the application of +module.function(args) on node. If node does not exists, a useless +pid is returned.

      + +

      Check http://www.erlang.org/doc/man/erlang.html#spawn_opt-4 for +the list of available options.

      +
      + Source +
      +

      + spawn_link(node, fun) +

      +

      Returns the pid of a new process started by the application of fun +on node. A link is created between the calling process and the +new process, atomically. If node does not exist, a useless pid is returned +(and due to the link, an exit signal with exit reason :noconnection will be +received).

      +
      + Source +
      +

      + spawn_link(node, module, fun, args) +

      +

      Returns the pid of a new process started by the application of +module.function(args) on node. A link is created between the calling +process and the new process, atomically. If node does not exist, a useless +pid is returned (and due to the link, an exit signal with exit reason +:noconnection will be received).

      +
      + Source
      diff --git a/docs/master/OptionParser.Simple.html b/docs/master/OptionParser.Simple.html deleted file mode 100644 index 9ba941c1f..000000000 --- a/docs/master/OptionParser.Simple.html +++ /dev/null @@ -1,86 +0,0 @@ - - - - OptionParser.Simple - - - - - - - - - - - - -
      -

      - OptionParser.Simple - -

      - - - - Source - - - - - - -

      Functions summary

      - - - - - - -
      -

      Functions

      -
      -

      - parse(options, aliases // []) -

      -

      Parses the argv and returns one tuple with parsed options -and the arguments.

      - -

      Example

      - -
      OptionParser.Simple.parse(["--debug"])
      -#=> { [debug: true], [] }
      -
      -OptionParser.Simple.parse(["--source", "lib"])
      -#=> { [source: "lib"], [] }
      -
      -OptionParser.Simple.parse(["--source", "lib", "test/enum_test.exs"])
      -#=> { [source: "lib"], ["test/enum_test.exs"] }
      -
      - -

      A set of aliases can be given as second argument:

      - -
      OptionParser.Simple.parse(["-d"], [d: :debug])
      -#=> { [debug: true], [] }
      -
      -
      - Source -
      -
      - - - -
      - - diff --git a/docs/master/Orddict.html b/docs/master/Orddict.html index 2eb20d587..13598b58e 100644 --- a/docs/master/Orddict.html +++ b/docs/master/Orddict.html @@ -35,7 +35,7 @@

      - Source + Source @@ -74,7 +74,7 @@

      Functions

      Creates a new empty dict.

      - Source + Source

      new(pairs) @@ -87,7 +87,7 @@

      Examples

      #=> [a: 1, b: 2]
      - Source + Source

      new(list, transform) @@ -101,7 +101,7 @@

      Examples

      #=> ["a": "a", "b": "b"]
      - Source + Source diff --git a/docs/master/Process.html b/docs/master/Process.html index 1cd6831d2..a5b2588aa 100644 --- a/docs/master/Process.html +++ b/docs/master/Process.html @@ -136,21 +136,11 @@

      Functions summary

      self/0 -
    47. - - spawn/1 - -
    48. spawn/2
    49. -
    50. - - spawn/3 - -
    51. spawn/4 @@ -161,21 +151,11 @@

      Functions summary

      spawn_link/1
    52. -
    53. - - spawn_link/2 - -
    54. spawn_link/3
    55. -
    56. - - spawn_link/4 - -
    57. spawn_monitor/1 @@ -186,26 +166,6 @@

      Functions summary

      spawn_monitor/3
    58. -
    59. - - spawn_opt/2 - -
    60. -
    61. - - spawn_opt/3 - -
    62. -
    63. - - spawn_opt/4 - -
    64. -
    65. - - spawn_opt/5 - -
    66. unlink/1 @@ -246,14 +206,14 @@

      Functions

      Deletes all items in the dictionary.

      - Source + Source

      delete(key)

      Deletes the given key from the dictionary.

      - Source + Source

      demonitor(monitor_ref, options // []) @@ -264,10 +224,10 @@

      Functions

      See http://www.erlang.org/doc/man/erlang.html#demonitor-2 for more info.

      - Source + Source

      - exit(xA, xB) + exit(pid, status)

      Sends an exit signal with the given reason to the pid.

      @@ -288,10 +248,10 @@

      Functions

      Examples

      -
      Process.exit(other, :kil)
      +
      Process.exit(pid, :kill)
       
      - Source + Source

      flag(flag, value) @@ -301,7 +261,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#process_flag-2 for more info.

      - Source + Source

      flag(pid, flag, value) @@ -312,7 +272,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#process_flag-3 for more info.

      - Source + Source

      get() @@ -331,7 +291,7 @@

      Examples

      Source

      - get_keys(xA) + get_keys(value)

      Returns all keys that have the given value.

      @@ -345,17 +305,17 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#process_info-2 for more info.

      - Source + Source

      - link(xA) + link(pid)

      Creates a link between the calling process and another process (or port) pid, if there is not such a link already.

      See http://www.erlang.org/doc/man/erlang.html#link-1 for more info.

      - Source + Source

      list() @@ -369,7 +329,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#processes-0 for more info.

      - Source + Source

      monitor(item) @@ -379,17 +339,17 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#monitor-2 for more info.

      - Source + Source

      put(key, value)

      Stores the given key-value in the process dictionary.

      - Source + Source

      - register(xA, xB) + register(name, pid)

      Associates the name with a pid or a port identifier. name, which must be an atom, can be used instead of the pid / port identifier in the @@ -397,14 +357,14 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#register-2 for more info.

      - Source + Source

      registered()

      Returns a list of names which have been registered using register/2.

      - Source + Source

      self() @@ -412,140 +372,68 @@

      Examples

      Returns the current process.

      Source -
      -

      - spawn(xA) -

      -

      Returns the pid of a new process started by the application of fun. -Otherwise works like spawn/3.

      -
      - Source

      - spawn(xA, xB) + spawn(fun, opts // [])

      -

      Returns the pid of a new process started by the application of fun -on node. If node does not exist, a useless pid is returned. -Otherwise works like spawn/3.

      +

      Returns the pid of a new process started by the application of fun.

      + +

      It behaves exactly the same as the Kernel.spawn/1 function except +it also accepts extra options, for the list of available options +check http://www.erlang.org/doc/man/erlang.html#spawn_opt-4

      Source
      -

      - spawn(xA, xB, xC) +

      + spawn(mod, fun, args, opts // [])

      Returns the pid of a new process started by the application of module.function(args). The new process created will be placed in the system scheduler queue and be run some time later.

      -

      See http://www.erlang.org/doc/man/erlang.html#spawn-3 for more info.

      +

      It behaves exactly the same as the Kernel.spawn/3 function except +it also accepts extra options, for the list of available options +check http://www.erlang.org/doc/man/erlang.html#spawn_opt-4

      - Source -
      -

      - spawn(xA, xB, xC, xD) -

      -

      Returns the pid of a new process started by the application of -module.function(args) on node. If node does not exists, a useless -pid is returned. Otherwise works like spawn/3.

      -
      - Source + Source

      - spawn_link(xA) + spawn_link(fun)

      Returns the pid of a new process started by the application of fun. A link is created between the calling process and the new -process, atomically. Otherwise works like spawn/3.

      +process, atomically.

      Source -
      -

      - spawn_link(xA, xB) -

      -

      Returns the pid of a new process started by the application of fun -on node. A link is created between the calling process and the -new process, atomically. If node does not exist, a useless pid is returned -(and due to the link, an exit signal with exit reason :noconnection will be -received). Otherwise works like spawn/3.

      -
      - Source

      - spawn_link(xA, xB, xC) + spawn_link(mod, fun, args)

      Returns the pid of a new process started by the application of module.function(args). A link is created between the calling process and the new process, atomically. Otherwise works like spawn/3.

      - Source -
      -

      - spawn_link(xA, xB, xC, xD) -

      -

      Returns the pid of a new process started by the application of -module.function(args) on node. A link is created between the calling -process and the new process, atomically. If node does not exist, a useless -pid is returned (and due to the link, an exit signal with exit reason -:noconnection will be received). Otherwise works like spawn/3.

      -
      - Source + Source

      - spawn_monitor(xA) + spawn_monitor(fun)

      Returns the pid of a new process started by the application of fun -and reference for a monitor created to the new process. -Otherwise works like spawn/3.

      +and reference for a monitor created to the new process.

      - Source + Source

      - spawn_monitor(xA, xB, xC) + spawn_monitor(mod, fun, args)

      A new process is started by the application of module.function(args) and the process is monitored at the same time. Returns the pid and a reference for the monitor. Otherwise works like spawn/3.

      - Source -
      -

      - spawn_opt(xA, xB) -

      -

      The same as spawn/1 but accepts extra options as arguments. -Please read http://www.erlang.org/doc/man/erlang.html#spawn_opt-4 for -documentation of the options.

      -
      - Source -
      -

      - spawn_opt(xA, xB, xC) -

      -

      The same as spawn/2 but accepts extra options as arguments. -Please read http://www.erlang.org/doc/man/erlang.html#spawn_opt-4 for -documentation of the options.

      -
      - Source -
      -

      - spawn_opt(xA, xB, xC, xD) -

      -

      The same as spawn/3 but accepts extra options as arguments. -Please read http://www.erlang.org/doc/man/erlang.html#spawn_opt-4 for -documentation of the options.

      -
      - Source -
      -

      - spawn_opt(xA, xB, xC, xD, xE) -

      -

      The same as spawn/4 but accepts extra options as arguments. -Please read http://www.erlang.org/doc/man/erlang.html#spawn_opt-4 for -documentation of the options.

      -
      - Source + Source

      - unlink(xA) + unlink(pid)

      Removes the link, if there is one, between the calling process and the process or port referred to by pid. Returns true and does not @@ -553,26 +441,26 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#unlink-1 for more info.

      - Source + Source

      - unregister(xA) + unregister(name)

      Removes the registered name, associated with a pid or a port identifier.

      See http://www.erlang.org/doc/man/erlang.html#unregister-1 for more info.

      - Source + Source

      - whereis(xA) + whereis(name)

      Returns the pid or port identifier with the registered name. Returns undefined if the name is not registered.

      See http://www.erlang.org/doc/man/erlang.html#whereis-1 for more info.

      - Source + Source
      diff --git a/docs/master/Record.html b/docs/master/Record.html index ad1b13b92..7d0015e8a 100644 --- a/docs/master/Record.html +++ b/docs/master/Record.html @@ -79,7 +79,7 @@

      Functions

      defrecord(name, values, opts)

      Main entry point for records definition. -This is invoked directly by Elixir.Builtin.defrecord. +This is invoked directly by Kernel.defrecord. Returns the quoted expression of a module given by name.

      Source diff --git a/docs/master/Regex.html b/docs/master/Regex.html index 0bda025f9..45ecb468d 100644 --- a/docs/master/Regex.html +++ b/docs/master/Regex.html @@ -31,7 +31,7 @@

      in the Erlang Standard Library. More information can be found on re documentation: http://www.erlang.org/doc/man/re.html

      -

      Regular expressions in Elixir can be created using Regex.compile +

      Regular expressions in Elixir can be created using Regex.compile! or using the special form with %r:

      # A simple regular expressions that matches foo anywhere in the string
      @@ -41,17 +41,8 @@ 

      %r/foo/iu

      -

      The re module provides several options, some of them are not -available in Elixir while others are enabled by default. The -ones enabled by default are:

      - -
        -
      • multiline - the given string is always considered to be multiline, so -^ and $ marks the beginning and end of each line. You need to use -\A and \z to match the end or beginning of the string
      • -
      - -

      The available options, followed by their shortcut in parenthesis, are:

      +

      The re module provides several options, the one available in Elixir, followed by +their shortcut in parenthesis, are:

      • unicode (u) - used when you want to match against specific unicode characters
      • @@ -101,7 +92,12 @@

        Functions summary

      • - first/2 + compile!/2 + +
      • +
      • + + index/2
      • @@ -167,28 +163,35 @@

        Functions

        compile(source, options // "")

        -

        Compile the regular expression according to the given options. -The result returned is a record named :re_pattern and its -length can be modified in future releases.

        +

        Compiles the regular expression according to the given options.

        -

        Check the module documentation for more information -about the options supported by compile.

        +

        It returns { :ok, regex } in case of success, +{ :error, reason } otherwise.

        - Source + Source
        -

        - first(arg1, string) +

        + compile!(source, options // "")

        -

        Runs the regular expression against the given string. -It returns the first match or nil if no match ocurred.

        +

        Compiles the regular expression according to the given options. +Fails with Regex.CompileError if the regex cannot be compiled.

        +
        + Source +
        +

        + index(arg1, string) +

        +

        Runs the regular expression against the given string +and returns the index (zero indexes) where the first +match occurs, nil otherwise.

        Examples

        -
        Regex.first %r/c(d)/, "abcd"  #=> "cd"
        -Regex.first %r/e/, "abcd"     #=> nil
        +
        Regex.index %r/c(d)/, "abcd"  #=> 3
        +Regex.index %r/e/, "abcd"     #=> nil
         
        - Source + Source

        indexes(arg1, string) @@ -200,11 +203,11 @@

        Examples

        Examples

        -
        Regex.run %r/c(d)/, "abcd"  #=> [{2,2},{3,1}]
        -Regex.run %r/e/, "abcd"     #=> nil
        +
        Regex.indexes %r/c(d)/, "abcd"  #=> [{2,2},{3,1}]
        +Regex.indexes %r/e/, "abcd"     #=> nil
         
        - Source + Source

        match?(arg1, string) @@ -217,7 +220,7 @@

        Examples

        Regex.match? %r/foo/, "bar" #=> false
        - Source + Source

        opts(arg1) @@ -229,14 +232,14 @@

        Examples

        Regex.opts %r(foo)m #=> 'm'
         
        - Source + Source

        re_pattern(arg1)

        Returns the underlying re_pattern in the regular expression.

        - Source + Source

        replace(arg1, string, replacement) @@ -256,7 +259,7 @@

        Examples

        Regex.replace(%r/(b)/, "abc", "[\\1]") #=> "a[b]c"
        - Source + Source

        replace_all(arg1, string, replacement) @@ -265,7 +268,7 @@

        Examples

        expressions matches in the string. Please read replace/3 for documentation and examples.

        - Source + Source

        run(arg1, string) @@ -279,7 +282,7 @@

        Examples

        Regex.run %r/e/, "abcd" #=> nil
        - Source + Source

        scan(arg1, string) @@ -296,7 +299,7 @@

        Examples

        Regex.scan %r/e/, "abcd" #=> []
        - Source + Source

        source(arg1) @@ -308,7 +311,7 @@

        Examples

        Regex.source %r(foo) #=> "foo"
         
        - Source + Source

        split(arg1, string, parts // :infinity) @@ -316,7 +319,7 @@

        Examples

        Split the given target in the number of parts specified. If no ammount of parts is given, it defaults to :infinity.

        - Source + Source
        diff --git a/docs/master/modules_list.html b/docs/master/modules_list.html index cc61d939d..fcb0b14fa 100644 --- a/docs/master/modules_list.html +++ b/docs/master/modules_list.html @@ -87,7 +87,8 @@

        Binary

      • -
    67. + +
    68. @@ -190,7 +191,8 @@

      Bitwise

    69. -
    70. + +
    71. @@ -230,6 +232,13 @@

      Code

    72. +
    73. + + ensure_compiled/1 + + Code +
    74. +
    75. ensure_loaded/1 @@ -293,7 +302,8 @@

      Code

    76. -
    77. + +
    78. @@ -315,7 +325,8 @@

        -
    79. + +
    80. @@ -348,19 +359,8 @@

      EEx.Engine

    81. -
    82. - - - - ForEngine - - - EEx.ForEngine -
    83. -
        - - -
    84. + +
    85. @@ -386,7 +386,8 @@

      EEx.SmartEngine

    86. -
    87. + +
    88. @@ -399,6 +400,7 @@

      +
    89. @@ -442,2318 +444,2390 @@

      EEx

    90. -
    91. + +
    92. - - Elixir.Builtin + + Enum - Elixir.Builtin + Enum
    93. +
    94. + + + + ExUnit + + + ExUnit +
    95. + +
    96. + + + + Exception + + + Exception +
    97. + +
    98. + + + + File + + + File +
    99. + +
    100. + + + + GenServer.Behavior + + + GenServer.Behavior +
    101. + +
    102. + + + + HashDict + + + HashDict +
    103. + +
    104. + + + + IEx + + + IEx +
    105. + +
    106. + + + + IO + + + IO +
    107. +
    108. + +
    109. + + + + Kernel + + + Kernel +
    110. + +
    111. - - Elixir.ParallelRequire + + ParallelRequire - Elixir.ParallelRequire + Kernel.ParallelRequire
      • - files/2 + files/2 - Elixir.ParallelRequire + Kernel.ParallelRequire
      • -
    112. + +
    113. - - Elixir.SpecialForms + + SpecialForms - Elixir.SpecialForms + Kernel.SpecialForms
    114. + +
    115. - - Elixir.Typespec + + Typespec - Elixir.Typespec + Kernel.Typespec
    116. - - - - Enum - - - Enum -
    117. -
        - +
      +
    118. - all?/2 + !/1 - Enum + Kernel
    119. - any?/2 + !=/2 - Enum + Kernel
    120. - count/1 + !==/2 - Enum + Kernel
    121. - drop/2 + &&/2 - Enum + Kernel
    122. - drop_while/2 + */2 - Enum + Kernel
    123. - each/2 + +/2 - Enum + Kernel
    124. - empty?/1 + ++/2 - Enum + Kernel
    125. - filter/2 + -/2 - Enum + Kernel
    126. - filter_map/3 + --/2 - Enum + Kernel
    127. - find/3 + ../2 - Enum + Kernel
    128. - find_index/2 + //2 - Enum + Kernel
    129. - find_value/3 + />/2 - Enum + Kernel
    130. - first/1 + </2 - Enum + Kernel
    131. - join/2 + <-/2 - Enum + Kernel
    132. - map/2 + <=/2 - Enum + Kernel
    133. - map_join/3 + <>/2 - Enum + Kernel
    134. - map_reduce/3 + ==/2 - Enum + Kernel
    135. - nth!/2 + ===/2 - Enum + Kernel
    136. - partition/2 + =~/2 - Enum + Kernel
    137. - qsort/1 + >/2 - Enum + Kernel
    138. - reduce/3 + >=/2 - Enum + Kernel
    139. - split/2 + @/1 - Enum + Kernel
    140. - split_with/2 + __B__/2 - Enum + Kernel
    141. - take/2 + __C__/2 - Enum + Kernel
    142. - take_while/2 + __R__/2 - Enum + Kernel
    143. - times/2 + __b__/2 - Enum + Kernel
    144. - times/3 + __c__/2 - Enum + Kernel
    145. -
    146. - - - - ExUnit - - - ExUnit -
    147. -
    148. - - - - Exception - - - Exception -
    149. -
    150. - - - - File - - - File -
    151. -
    152. - - - - GenServer.Behavior - - - GenServer.Behavior -
    153. -
    154. - - - - HashDict - - - HashDict -
    155. -
    156. - - - - IEx - - - IEx -
    157. -
    158. - - - - IO - - - IO -
    159. -
    160. + +
    161. @@ -2863,7 +2937,8 @@

      Keyword

    162. -
    163. + +
    164. @@ -3029,7 +3104,8 @@

      List

    165. -
    166. + +
    167. @@ -3076,7 +3152,8 @@

      Macro

    168. -
    169. + +
    170. @@ -3089,273 +3166,919 @@

    171. - - Project + + Deps - Mix.Project + Mix.Deps
    172. + +
    173. - - Shell + + Deps.Lock - Mix.Shell + Mix.Deps.Lock
    174. + +
    175. - - Shell.Test + + Generator - Mix.Shell.Test + Mix.Generator
    176. + +
    177. - - Task + + Local - Mix.Task + Mix.Local
    178. +
    179. + + + + Project + + + Mix.Project +
    180. + +
    181. + + + + SCM + + + Mix.SCM +
    182. + +
    183. + + + + Shell + + + Mix.Shell +
    184. + +
    185. + + + + Shell.Process + + + Mix.Shell.Process +
    186. +
        + + +
      • + + error/1 + + Mix.Shell.Process +
      • + +
      • + + flush/1 + + Mix.Shell.Process +
      • + +
      • + + info/1 + + Mix.Shell.Process +
      • + +
      • + + yes?/1 + + Mix.Shell.Process +
      • + +
      +
    187. + + + + Task + + + Mix.Task +
    188. + +
    189. + + + + Tasks.Clean + + + Mix.Tasks.Clean +
    190. +
        + + +
      • + + run/1 + + Mix.Tasks.Clean +
      • + +
      +
    191. + + + + Tasks.Compile + + + Mix.Tasks.Compile +
    192. +
        + + +
      • + + run/1 + + Mix.Tasks.Compile +
      • + +
      +
    193. + + + + Tasks.Compile.App + + + Mix.Tasks.Compile.App +
    194. +
        + + +
      • + + run/1 + + Mix.Tasks.Compile.App +
      • + +
      +
    195. + + + + Tasks.Compile.Elixir + + + Mix.Tasks.Compile.Elixir +
    196. +
        + + +
      • + + run/1 + + Mix.Tasks.Compile.Elixir +
      • + +
      +
    197. + + + + Tasks.Deps + + + Mix.Tasks.Deps +
    198. +
        + + +
      • + + run/1 + + Mix.Tasks.Deps +
      • + +
      +
    199. + + + + Tasks.Deps.Check + + + Mix.Tasks.Deps.Check +
    200. +
        + + +
      • + + run/1 + + Mix.Tasks.Deps.Check +
      • + +
      +
    201. + + + + Tasks.Deps.Clean + + + Mix.Tasks.Deps.Clean +
    202. +
        + + +
      • + + run/1 + + Mix.Tasks.Deps.Clean +
      • + +
      +
    203. + + + + Tasks.Deps.Compile + + + Mix.Tasks.Deps.Compile +
    204. +
        + + +
      • + + run/1 + + Mix.Tasks.Deps.Compile +
      • + +
      +
    205. + + + + Tasks.Deps.Get + + + Mix.Tasks.Deps.Get +
    206. +
        + + +
      • + + run/1 + + Mix.Tasks.Deps.Get +
      • + +
      +
    207. + + + + Tasks.Deps.Loadpaths + + + Mix.Tasks.Deps.Loadpaths +
    208. +
        + + +
      • + + run/1 + + Mix.Tasks.Deps.Loadpaths +
      • + +
      +
    209. + + + + Tasks.Deps.Unlock + + + Mix.Tasks.Deps.Unlock +
    210. +
        + + +
      • + + run/1 + + Mix.Tasks.Deps.Unlock +
      • + +
      +
    211. + + + + Tasks.Deps.Update + + + Mix.Tasks.Deps.Update +
    212. + +
    213. + + + + Tasks.Do + + + Mix.Tasks.Do +
    214. + +
    215. + + + + Tasks.Help + + + Mix.Tasks.Help +
    216. +
        + +
      • - run/2 + run/1 - Mix.Task + Mix.Tasks.Help
      • +
      +
    217. + + + + Tasks.Iex + + + Mix.Tasks.Iex +
    218. + +
    219. + + + + Tasks.Loadpaths + + + Mix.Tasks.Loadpaths +
    220. +
    221. + +
    222. - - Tasks.Compile + + Tasks.Local - Mix.Tasks.Compile + Mix.Tasks.Local
      • - run/1 + run/1 - Mix.Tasks.Compile + Mix.Tasks.Local
      • -
    223. + +
    224. - - Tasks.Compile.Elixir + + Tasks.Local.Install - Mix.Tasks.Compile.Elixir + Mix.Tasks.Local.Install
      • - run/1 + run/1 - Mix.Tasks.Compile.Elixir + Mix.Tasks.Local.Install
      • -
    225. + +
    226. - - Tasks.Help + + Tasks.Local.Uninstall - Mix.Tasks.Help + Mix.Tasks.Local.Uninstall
      • - run/1 + run/1 - Mix.Tasks.Help + Mix.Tasks.Local.Uninstall
      • -
    227. + +
    228. - - Tasks.Iex + + Tasks.New - Mix.Tasks.Iex + Mix.Tasks.New
      • - run/1 + run/1 - Mix.Tasks.Iex + Mix.Tasks.New
      • -
    229. + +
    230. - - Tasks.Loadpaths + + Tasks.Run - Mix.Tasks.Loadpaths + Mix.Tasks.Run
      • - run/1 + run/1 - Mix.Tasks.Loadpaths + Mix.Tasks.Run
      • -
    231. + +
    232. @@ -3374,7 +4097,8 @@

      Mix.Tasks.Test

    233. -
    234. + +
    235. @@ -3386,6 +4110,20 @@

      + + +
    236. + + loadpaths/0 + + Mix +
    237. + +
    238. + + project/0 + + Mix +
    239. @@ -3430,7 +4211,8 @@

      Mix

    240. -
    241. + +
    242. @@ -3479,42 +4261,42 @@

    243. - defined_functions/1 + defines?/2 Module
    244. - defined_functions/2 + defines?/3 Module
    245. - delete_attribute/2 + definitions_in/1 Module
    246. - eval_quoted/4 + definitions_in/2 Module
    247. - function_defined?/2 + delete_attribute/2 Module
    248. - function_defined?/3 + eval_quoted/4 Module
    249. @@ -3554,7 +4336,8 @@

      Module

    250. -
    251. + +
    252. @@ -3615,26 +4398,63 @@

      Node

    253. -
    254. +
    255. + + spawn/3 + + Node +
    256. + +
    257. + + spawn/5 + + Node +
    258. + +
    259. + + spawn_link/2 + + Node +
    260. + +
    261. + + spawn_link/4 + + Node +
    262. + + +
    263. - - OptionParser.Simple + + OptionParser - OptionParser.Simple + OptionParser
    264. + +
    265. @@ -3667,7 +4487,8 @@

      Orddict

    266. -
    267. + +
    268. @@ -3742,7 +4563,8 @@

      Port

    269. -
    270. + +
    271. @@ -3880,13 +4702,6 @@

      Process

    272. -
    273. - - spawn/1 - - Process -
    274. -
    275. spawn/2 @@ -3894,13 +4709,6 @@

      Process

    276. -
    277. - - spawn/3 - - Process -
    278. -
    279. spawn/4 @@ -3915,13 +4723,6 @@

      Process

    280. -
    281. - - spawn_link/2 - - Process -
    282. -
    283. spawn_link/3 @@ -3929,13 +4730,6 @@

      Process

    284. -
    285. - - spawn_link/4 - - Process -
    286. -
    287. spawn_monitor/1 @@ -3950,34 +4744,6 @@

      Process

    288. -
    289. - - spawn_opt/2 - - Process -
    290. - -
    291. - - spawn_opt/3 - - Process -
    292. - -
    293. - - spawn_opt/4 - - Process -
    294. - -
    295. - - spawn_opt/5 - - Process -
    296. -
    297. unlink/1 @@ -3999,7 +4765,8 @@

      Process

    298. -
    299. + +
    300. @@ -4032,7 +4799,8 @@

      Record

    301. -
    302. + +
    303. @@ -4053,7 +4821,14 @@

    304. - first/2 + compile!/2 + + Regex +
    305. + +
    306. + + index/2 Regex
    307. @@ -4128,7 +4903,8 @@

      Regex

    308. -
    309. + +
    310. @@ -4224,7 +5000,8 @@

      System

    311. -
    312. + +
    313. @@ -4236,7 +5013,8 @@

        -
    314. + +
    315. @@ -4272,7 +5050,8 @@

      URI.FTP

    316. -
    317. + +
    318. @@ -4298,7 +5077,8 @@

      URI.HTTP

    319. -
    320. + +
    321. @@ -4324,7 +5104,8 @@

      URI.HTTPS

    322. -
    323. + +
    324. @@ -4350,7 +5131,8 @@

      URI.LDAP

    325. -
    326. + +
    327. @@ -4369,7 +5151,8 @@

      URI.Parser

    328. -
    329. + +
    330. @@ -4395,7 +5178,8 @@

      URI.SFTP

    331. -
    332. + +
    333. @@ -4422,6 +5206,7 @@

    334. +
    335. @@ -4459,7 +5244,8 @@

    336. + - \ No newline at end of file + diff --git a/docs/master/protocols_list.html b/docs/master/protocols_list.html index 9e11738d5..f164c5479 100644 --- a/docs/master/protocols_list.html +++ b/docs/master/protocols_list.html @@ -62,7 +62,8 @@

      Access.Atom

    337. -
    338. + +
    339. @@ -81,7 +82,8 @@

      Access.Function

    340. -
    341. + +
    342. @@ -101,6 +103,7 @@

    343. +
    344. @@ -109,7 +112,8 @@

      Access

    345. -
    346. + +
    347. @@ -138,7 +142,8 @@

      Binary.Chars.Atom

    348. -
    349. + +
    350. @@ -157,7 +162,8 @@

      Binary.Chars.BitString

    351. -
    352. + +
    353. @@ -176,7 +182,8 @@

      Binary.Chars.List

    354. -
    355. + +
    356. @@ -196,6 +203,7 @@

    357. +
    358. @@ -204,7 +212,8 @@

      Binary.Chars

    359. -
    360. + +
    361. @@ -233,7 +242,8 @@

      Binary.Inspect.Any

    362. -
    363. + +
    364. @@ -252,7 +262,8 @@

      Binary.Inspect.Atom

    365. -
    366. + +
    367. @@ -271,7 +282,8 @@

      Binary.Inspect.BitString

    368. -
    369. + +
    370. @@ -297,7 +309,8 @@

      Binary.Inspect.List

    371. -
    372. + +
    373. @@ -316,7 +329,8 @@

      Binary.Inspect.Number

    374. -
    375. + +
    376. @@ -335,7 +349,8 @@

      Binary.Inspect.Regex

    377. -
    378. + +
    379. @@ -355,6 +370,7 @@

    380. +
    381. @@ -363,7 +379,8 @@

      Binary.Inspect

    382. -
    383. + +
    384. @@ -376,210 +393,212 @@

    385. - - HashDict.Record + + HashDict - Dict.HashDict.Record + Dict.HashDict
    386. + +
    387. - - Orddict.Record + + Orddict - Dict.Orddict.Record + Dict.Orddict
    388. +
    389. @@ -679,7 +698,8 @@

      Dict

    390. -
    391. + +
    392. @@ -692,30 +712,58 @@

    393. - - HashDict.Record + + Function - Enum.Iterator.HashDict.Record + Enum.Iterator.Function
    394. + +
    395. + + + + HashDict + + + Enum.Iterator.HashDict +
    396. +
        + + +
      • + + count/1 + + Enum.Iterator.HashDict +
      • + +
      • + + iterator/1 + + Enum.Iterator.HashDict +
      • + +
      +
    397. @@ -741,33 +789,35 @@

      Enum.Iterator.List

    398. -
    399. + +
    400. - - Orddict.Record + + Orddict - Enum.Iterator.Orddict.Record + Enum.Iterator.Orddict
    401. + +
    402. @@ -794,6 +844,7 @@

    403. +
    404. @@ -809,7 +860,8 @@

      Enum.Iterator

    405. -
    406. + +
    407. @@ -820,6 +872,33 @@

    408. + +
    409. - - Orddict.Record + + Orddict - Enum.OrdIterator.Orddict.Record + Enum.OrdIterator.Orddict
    410. + +
    411. @@ -898,6 +979,7 @@

    412. +
    413. @@ -913,7 +995,62 @@

      Enum.OrdIterator

    414. -
    415. + +
    416. + + + + IEx.Autocomplete.Entry.IEx.Autocomplete.Fun + + + IEx.Autocomplete.Entry.IEx.Autocomplete.Fun +
    417. +
        + + +
      • + + to_entries/1 + + IEx.Autocomplete.Entry.IEx.Autocomplete.Fun +
      • + +
      • + + to_hint/2 + + IEx.Autocomplete.Entry.IEx.Autocomplete.Fun +
      • + +
      +
    418. + + + + IEx.Autocomplete.Entry.IEx.Autocomplete.Mod + + + IEx.Autocomplete.Entry.IEx.Autocomplete.Mod +
    419. +
        + + +
      • + + to_entries/1 + + IEx.Autocomplete.Entry.IEx.Autocomplete.Mod +
      • + +
      • + + to_hint/2 + + IEx.Autocomplete.Entry.IEx.Autocomplete.Mod +
      • + +
      +
    420. @@ -942,7 +1079,8 @@

      List.Chars.Atom

    421. -
    422. + +
    423. @@ -961,7 +1099,8 @@

      List.Chars.BitString

    424. -
    425. + +
    426. @@ -980,7 +1119,8 @@

      List.Chars.List

    427. -
    428. + +
    429. @@ -1000,6 +1140,7 @@

    430. +
    431. @@ -1008,7 +1149,8 @@

      List.Chars

    432. -
    433. + +
    434. @@ -1045,6 +1187,7 @@

    435. +
    436. @@ -1061,7 +1204,8 @@

    437. + - \ No newline at end of file + diff --git a/docs/master/records_list.html b/docs/master/records_list.html index 8a3ff6896..f3beb137b 100644 --- a/docs/master/records_list.html +++ b/docs/master/records_list.html @@ -101,7 +101,8 @@

      ArgumentError

    438. -
    439. + +
    440. @@ -169,7 +170,8 @@

      ArithmeticError

    441. -
    442. + +
    443. @@ -265,7 +267,8 @@

      BadArityError

    444. -
    445. + +
    446. @@ -340,7 +343,8 @@

      BadFunctionError

    447. -
    448. + +
    449. @@ -415,7 +419,8 @@

      CaseClauseError

    450. -
    451. + +
    452. @@ -532,7 +537,8 @@

      CompileError

    453. -
    454. + +
    455. @@ -600,7 +606,8 @@

      EEx.SyntaxError

    456. -
    457. + +
    458. @@ -668,7 +675,8 @@

      Enum.OutOfBoundsError

    459. -
    460. + +
    461. @@ -743,7 +751,8 @@

      ErlangError

    462. -
    463. + +
    464. @@ -811,7 +820,8 @@

      ExUnit.AssertionError

    465. -
    466. + +
    467. @@ -949,7 +959,8 @@

      File.CopyError

    468. -
    469. + +
    470. @@ -1066,7 +1077,84 @@

      File.Error

    471. -
    472. + +
    473. + + + + File.IteratorError + + + File.IteratorError +
    474. + +
    475. @@ -1372,7 +1460,8 @@

      File.Stat

    476. -
    477. + +
    478. @@ -1489,7 +1578,8 @@

      FunctionClauseError

    479. -
    480. + +
    481. @@ -1564,7 +1654,8 @@

      Keyword.KeyError

    482. -
    483. + +
    484. @@ -1653,7 +1744,8 @@

      Macro.Env

    485. -
    486. + +
    487. @@ -1728,7 +1820,147 @@

      MatchError

    488. -
    489. + +
    490. + + + + Mix.Dep + + + Mix.Dep +
    491. + +
    492. @@ -1796,7 +2028,8 @@

      Mix.Error

    493. -
    494. + +
    495. @@ -1871,7 +2104,8 @@

      Mix.InvalidTaskError

    496. -
    497. + +
    498. @@ -1939,7 +2173,8 @@

      Mix.NoProjectError

    499. -
    500. + +
    501. @@ -2014,7 +2249,77 @@

      Mix.NoTaskError

    502. -
    503. + +
    504. + + + + Mix.OutOfDateDepsError + + + Mix.OutOfDateDepsError +
    505. + +
    506. @@ -2110,7 +2415,8 @@

      Protocol.UndefinedError

    507. -
    508. + +
    509. @@ -2143,7 +2449,77 @@

      Range

    510. -
    511. + +
    512. + + + + Regex.CompileError + + + Regex.CompileError +
    513. + +
    514. @@ -2211,7 +2587,8 @@

      RuntimeError

    515. -
    516. + +
    517. @@ -2328,7 +2705,8 @@

      SyntaxError

    518. -
    519. + +
    520. @@ -2396,7 +2774,8 @@

      SystemLimitError

    521. -
    522. + +
    523. @@ -2513,7 +2892,8 @@

      TokenMissingError

    524. -
    525. + +
    526. @@ -2631,7 +3011,8 @@

    527. + - \ No newline at end of file + From 91b5e5488b3425d7e86aa4f10dd64df756f25c20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Tue, 31 Jul 2012 15:15:54 +0200 Subject: [PATCH 210/437] Update master docs --- docs/master/Dict.HashDict.html | 200 + docs/master/Dict.Orddict.html | 200 + docs/master/Enum.Iterator.Function.html | 79 + docs/master/Enum.Iterator.HashDict.html | 79 + docs/master/Enum.Iterator.Orddict.html | 79 + docs/master/Enum.OrdIterator.Function.html | 79 + docs/master/Enum.OrdIterator.Orddict.html | 79 + docs/master/File.IteratorError.html | 167 + ...tocomplete.Entry.IEx.Autocomplete.Fun.html | 79 + ...tocomplete.Entry.IEx.Autocomplete.Mod.html | 79 + docs/master/IEx.Autocomplete.html | 71 + docs/master/IEx.Remsh.html | 84 + docs/master/Kernel.ParallelCompiler.html | 93 + docs/master/Kernel.ParallelRequire.html | 75 + docs/master/Kernel.SpecialForms.html | 652 ++++ docs/master/Kernel.Typespec.html | 147 + docs/master/Kernel.html | 3473 +++++++++++++++++ docs/master/Mix.Dep.html | 304 ++ docs/master/Mix.Deps.Lock.html | 103 + docs/master/Mix.Deps.html | 194 + docs/master/Mix.Generator.html | 148 + docs/master/Mix.Local.html | 96 + docs/master/Mix.OutOfDateDepsError.html | 156 + docs/master/Mix.SCM.html | 213 + docs/master/Mix.Shell.Process.html | 136 + docs/master/Mix.Tasks.Clean.html | 77 + docs/master/Mix.Tasks.Compile.App.html | 95 + docs/master/Mix.Tasks.Deps.Check.html | 75 + docs/master/Mix.Tasks.Deps.Clean.html | 75 + docs/master/Mix.Tasks.Deps.Compile.html | 96 + docs/master/Mix.Tasks.Deps.Get.html | 72 + docs/master/Mix.Tasks.Deps.Loadpaths.html | 75 + docs/master/Mix.Tasks.Deps.Unlock.html | 72 + docs/master/Mix.Tasks.Deps.Update.html | 75 + docs/master/Mix.Tasks.Deps.html | 78 + docs/master/Mix.Tasks.Do.html | 79 + docs/master/Mix.Tasks.Local.Install.html | 82 + docs/master/Mix.Tasks.Local.Uninstall.html | 74 + docs/master/Mix.Tasks.Local.html | 71 + docs/master/Mix.Tasks.New.html | 90 + docs/master/Mix.Tasks.Run.html | 77 + docs/master/OptionParser.html | 130 + docs/master/Regex.CompileError.html | 156 + 43 files changed, 8614 insertions(+) create mode 100644 docs/master/Dict.HashDict.html create mode 100644 docs/master/Dict.Orddict.html create mode 100644 docs/master/Enum.Iterator.Function.html create mode 100644 docs/master/Enum.Iterator.HashDict.html create mode 100644 docs/master/Enum.Iterator.Orddict.html create mode 100644 docs/master/Enum.OrdIterator.Function.html create mode 100644 docs/master/Enum.OrdIterator.Orddict.html create mode 100644 docs/master/File.IteratorError.html create mode 100644 docs/master/IEx.Autocomplete.Entry.IEx.Autocomplete.Fun.html create mode 100644 docs/master/IEx.Autocomplete.Entry.IEx.Autocomplete.Mod.html create mode 100644 docs/master/IEx.Autocomplete.html create mode 100644 docs/master/IEx.Remsh.html create mode 100644 docs/master/Kernel.ParallelCompiler.html create mode 100644 docs/master/Kernel.ParallelRequire.html create mode 100644 docs/master/Kernel.SpecialForms.html create mode 100644 docs/master/Kernel.Typespec.html create mode 100644 docs/master/Kernel.html create mode 100644 docs/master/Mix.Dep.html create mode 100644 docs/master/Mix.Deps.Lock.html create mode 100644 docs/master/Mix.Deps.html create mode 100644 docs/master/Mix.Generator.html create mode 100644 docs/master/Mix.Local.html create mode 100644 docs/master/Mix.OutOfDateDepsError.html create mode 100644 docs/master/Mix.SCM.html create mode 100644 docs/master/Mix.Shell.Process.html create mode 100644 docs/master/Mix.Tasks.Clean.html create mode 100644 docs/master/Mix.Tasks.Compile.App.html create mode 100644 docs/master/Mix.Tasks.Deps.Check.html create mode 100644 docs/master/Mix.Tasks.Deps.Clean.html create mode 100644 docs/master/Mix.Tasks.Deps.Compile.html create mode 100644 docs/master/Mix.Tasks.Deps.Get.html create mode 100644 docs/master/Mix.Tasks.Deps.Loadpaths.html create mode 100644 docs/master/Mix.Tasks.Deps.Unlock.html create mode 100644 docs/master/Mix.Tasks.Deps.Update.html create mode 100644 docs/master/Mix.Tasks.Deps.html create mode 100644 docs/master/Mix.Tasks.Do.html create mode 100644 docs/master/Mix.Tasks.Local.Install.html create mode 100644 docs/master/Mix.Tasks.Local.Uninstall.html create mode 100644 docs/master/Mix.Tasks.Local.html create mode 100644 docs/master/Mix.Tasks.New.html create mode 100644 docs/master/Mix.Tasks.Run.html create mode 100644 docs/master/OptionParser.html create mode 100644 docs/master/Regex.CompileError.html diff --git a/docs/master/Dict.HashDict.html b/docs/master/Dict.HashDict.html new file mode 100644 index 000000000..73d4230f5 --- /dev/null +++ b/docs/master/Dict.HashDict.html @@ -0,0 +1,200 @@ + + + + Dict.HashDict + + + + + + + + + + + + +
      +

      + Dict.HashDict + + impl + +

      + + + +
      Source + + + + + + +

      Functions summary

      + + + + + + +
      +

      Functions

      +
      +

      + delete(arg1, key) +

      +
      + Source +
      +

      + empty(_) +

      +
      + Source +
      +

      + get(arg1, key, default // nil) +

      +
      + Source +
      +

      + has_key?(arg1, key) +

      +
      + Source +
      +

      + keys(arg1) +

      +
      + Source +
      +

      + merge(arg1, arg2) +

      +
      + Source +
      +

      + merge(arg1, arg2, fun) +

      +
      + Source +
      +

      + put(arg1, key, value) +

      +
      + Source +
      +

      + size(arg1) +

      +
      + Source +
      +

      + to_list(arg1) +

      +
      + Source +
      +

      + update(arg1, key, fun) +

      +
      + Source +
      +

      + update(arg1, key, initial, fun) +

      +
      + Source +
      +

      + values(arg1) +

      +
      + Source +
      +
      + + + +
      + + diff --git a/docs/master/Dict.Orddict.html b/docs/master/Dict.Orddict.html new file mode 100644 index 000000000..5de22fa0f --- /dev/null +++ b/docs/master/Dict.Orddict.html @@ -0,0 +1,200 @@ + + + + Dict.Orddict + + + + + + + + + + + + +
      +

      + Dict.Orddict + + impl + +

      + + + + Source + + + + + + +

      Functions summary

      + + + + + + +
      +

      Functions

      +
      +

      + delete(arg1, key) +

      +
      + Source +
      +

      + empty(_) +

      +
      + Source +
      +

      + get(arg1, key, default // nil) +

      +
      + Source +
      +

      + has_key?(arg1, key) +

      +
      + Source +
      +

      + keys(arg1) +

      +
      + Source +
      +

      + merge(arg1, arg2) +

      +
      + Source +
      +

      + merge(arg1, arg2, fun) +

      +
      + Source +
      +

      + put(arg1, key, value) +

      +
      + Source +
      +

      + size(arg1) +

      +
      + Source +
      +

      + to_list(arg1) +

      +
      + Source +
      +

      + update(arg1, key, fun) +

      +
      + Source +
      +

      + update(arg1, key, initial, fun) +

      +
      + Source +
      +

      + values(arg1) +

      +
      + Source +
      +
      + + + +
      + + diff --git a/docs/master/Enum.Iterator.Function.html b/docs/master/Enum.Iterator.Function.html new file mode 100644 index 000000000..b6bc368fd --- /dev/null +++ b/docs/master/Enum.Iterator.Function.html @@ -0,0 +1,79 @@ + + + + Enum.Iterator.Function + + + + + + + + + + + + +
      +

      + Enum.Iterator.Function + + impl + +

      + + + + Source + + + + + + +

      Functions summary

      + + + + + + +
      +

      Functions

      +
      +

      + count(function) +

      +
      + Source +
      +

      + iterator(function) +

      +
      + Source +
      +
      + + + +
      + + diff --git a/docs/master/Enum.Iterator.HashDict.html b/docs/master/Enum.Iterator.HashDict.html new file mode 100644 index 000000000..e0edca8b3 --- /dev/null +++ b/docs/master/Enum.Iterator.HashDict.html @@ -0,0 +1,79 @@ + + + + Enum.Iterator.HashDict + + + + + + + + + + + + +
      +

      + Enum.Iterator.HashDict + + impl + +

      + + + + Source + + + + + + +

      Functions summary

      + + + + + + +
      +

      Functions

      +
      +

      + count(arg1) +

      +
      + Source +
      +

      + iterator(arg1) +

      +
      + Source +
      +
      + + + +
      + + diff --git a/docs/master/Enum.Iterator.Orddict.html b/docs/master/Enum.Iterator.Orddict.html new file mode 100644 index 000000000..ab52a0d1a --- /dev/null +++ b/docs/master/Enum.Iterator.Orddict.html @@ -0,0 +1,79 @@ + + + + Enum.Iterator.Orddict + + + + + + + + + + + + +
      +

      + Enum.Iterator.Orddict + + impl + +

      + + + + Source + + + + + + +

      Functions summary

      + + + + + + +
      +

      Functions

      +
      +

      + count(arg1) +

      +
      + Source +
      +

      + iterator(arg1) +

      +
      + Source +
      +
      + + + +
      + + diff --git a/docs/master/Enum.OrdIterator.Function.html b/docs/master/Enum.OrdIterator.Function.html new file mode 100644 index 000000000..583820a96 --- /dev/null +++ b/docs/master/Enum.OrdIterator.Function.html @@ -0,0 +1,79 @@ + + + + Enum.OrdIterator.Function + + + + + + + + + + + + +
      +

      + Enum.OrdIterator.Function + + impl + +

      + + + + Source + + + + + + +

      Functions summary

      + + + + + + +
      +

      Functions

      +
      +

      + iterator(function) +

      +
      + Source +
      +

      + to_list(arg1, function) +

      +
      + Source +
      +
      + + + +
      + + diff --git a/docs/master/Enum.OrdIterator.Orddict.html b/docs/master/Enum.OrdIterator.Orddict.html new file mode 100644 index 000000000..a186f26bc --- /dev/null +++ b/docs/master/Enum.OrdIterator.Orddict.html @@ -0,0 +1,79 @@ + + + + Enum.OrdIterator.Orddict + + + + + + + + + + + + +
      +

      + Enum.OrdIterator.Orddict + + impl + +

      + + + + Source + + + + + + +

      Functions summary

      + + + + + + +
      +

      Functions

      +
      +

      + iterator(arg1) +

      +
      + Source +
      +

      + to_list(arg1, _) +

      +
      + Source +
      +
      + + + +
      + + diff --git a/docs/master/File.IteratorError.html b/docs/master/File.IteratorError.html new file mode 100644 index 000000000..8e15528c0 --- /dev/null +++ b/docs/master/File.IteratorError.html @@ -0,0 +1,167 @@ + + + + File.IteratorError + + + + + + + + + + + + +
      +

      + File.IteratorError + + exception + +

      + + + + Source + + + + +

      Fields (and defaults)

      +
        + +
      • + + reason: nil + +
      • + +
      + + + +

      Functions summary

      + + + + + + +
      +

      Functions

      +
      +

      + exception(args) +

      +
      + Source +
      +

      + exception(args, self) +

      +
      + Source +
      +

      + message(exception) +

      +
      + Source +
      +

      + new() +

      +
      + Source +
      +

      + new(opts) +

      +
      + Source +
      +

      + reason(record) +

      +
      + Source +
      +

      + reason(value, record) +

      +
      + Source +
      +

      + to_keywords(record) +

      +
      + Source +
      +

      + update_reason(function, record) +

      +
      + Source +
      +
      + + + +
      + + diff --git a/docs/master/IEx.Autocomplete.Entry.IEx.Autocomplete.Fun.html b/docs/master/IEx.Autocomplete.Entry.IEx.Autocomplete.Fun.html new file mode 100644 index 000000000..fb85bdef1 --- /dev/null +++ b/docs/master/IEx.Autocomplete.Entry.IEx.Autocomplete.Fun.html @@ -0,0 +1,79 @@ + + + + IEx.Autocomplete.Entry.IEx.Autocomplete.Fun + + + + + + + + + + + + +
      +

      + IEx.Autocomplete.Entry.IEx.Autocomplete.Fun + + impl + +

      + + + + Source + + + + + + +

      Functions summary

      + + + + + + +
      +

      Functions

      +
      +

      + to_entries(fun) +

      +
      + Source +
      +

      + to_hint(arg1, hint) +

      +
      + Source +
      +
      + + + +
      + + diff --git a/docs/master/IEx.Autocomplete.Entry.IEx.Autocomplete.Mod.html b/docs/master/IEx.Autocomplete.Entry.IEx.Autocomplete.Mod.html new file mode 100644 index 000000000..53bcba396 --- /dev/null +++ b/docs/master/IEx.Autocomplete.Entry.IEx.Autocomplete.Mod.html @@ -0,0 +1,79 @@ + + + + IEx.Autocomplete.Entry.IEx.Autocomplete.Mod + + + + + + + + + + + + +
      +

      + IEx.Autocomplete.Entry.IEx.Autocomplete.Mod + + impl + +

      + + + + Source + + + + + + +

      Functions summary

      + + + + + + +
      +

      Functions

      +
      +

      + to_entries(mod) +

      +
      + Source +
      +

      + to_hint(arg1, hint) +

      +
      + Source +
      +
      + + + +
      + + diff --git a/docs/master/IEx.Autocomplete.html b/docs/master/IEx.Autocomplete.html new file mode 100644 index 000000000..28a1ec869 --- /dev/null +++ b/docs/master/IEx.Autocomplete.html @@ -0,0 +1,71 @@ + + + + IEx.Autocomplete + + + + + + + + + + + + +
      +

      + IEx.Autocomplete + +

      + + +
      +

      Autocompletion for the Elixir shell.

      + +
      + + + Source + + + + + + +

      Functions summary

      + + + + + + +
      +

      Functions

      +
      +

      + expand(expr) +

      +
      + Source +
      +
      + + + +
      + + diff --git a/docs/master/IEx.Remsh.html b/docs/master/IEx.Remsh.html new file mode 100644 index 000000000..4f5151f20 --- /dev/null +++ b/docs/master/IEx.Remsh.html @@ -0,0 +1,84 @@ + + + + IEx.Remsh + + + + + + + + + + + + +
      +

      + IEx.Remsh + +

      + + +
      +

      Helper function injected into connecting remote nodes +to properly handle autocompletion. Elixir supports:

      + +
        +
      • remsh from an elixir node to an elixir node
      • +
      • remsh from a plain erlang node to an elixir node (through the ^G menu)
      • +
      • remsh from an elixir node to a plain erlang node (and get an erl shell there)
      • +
      + +

      In order to get an Elixir shell from the ^G menu, +you need to use 'Elixir-IEx' as the shell name.

      + +

      Connecting an Elixir shell to a remote node without +Elixir is not supported.

      + +
      + + + Source + + + + + + +

      Functions summary

      + + + + + + +
      +

      Functions

      +
      +

      + expand(node) +

      +
      + Source +
      +
      + + + +
      + + diff --git a/docs/master/Kernel.ParallelCompiler.html b/docs/master/Kernel.ParallelCompiler.html new file mode 100644 index 000000000..ae4645c69 --- /dev/null +++ b/docs/master/Kernel.ParallelCompiler.html @@ -0,0 +1,93 @@ + + + + Kernel.ParallelCompiler + + + + + + + + + + + + +
      +

      + Kernel.ParallelCompiler + +

      + + +
      +

      A module responsible for compiling files in parallel.

      + +
      + + + Source + + + + + + +

      Functions summary

      + + + + + + +
      +

      Functions

      +
      +

      + files(files, callback // default_callback) +

      +

      Compiles the given files.

      + +

      Those files are compiled in parallel and can automatically +detect dependencies between them. Once a dependency is found, +the current file stops being compiled until the dependency is +resolved.

      + +

      A callback that is invoked every time a file is compiled +with its name can be optionally given as argument.

      +
      + Source +
      +

      + files_to_path(files, path, callback // default_callback) +

      +

      Compiles the given files to the given path. +Read files/2 for more information.

      +
      + Source +
      +
      + + + +
      + + diff --git a/docs/master/Kernel.ParallelRequire.html b/docs/master/Kernel.ParallelRequire.html new file mode 100644 index 000000000..b3ae3d4d9 --- /dev/null +++ b/docs/master/Kernel.ParallelRequire.html @@ -0,0 +1,75 @@ + + + + Kernel.ParallelRequire + + + + + + + + + + + + +
      +

      + Kernel.ParallelRequire + +

      + + +
      +

      A module responsible for requiring files in parallel.

      + +
      + + + Source + + + + + + +

      Functions summary

      + + + + + + +
      +

      Functions

      +
      +

      + files(files, callback // default_callback) +

      +

      Requires the given files.

      + +

      A callback that is invoked every time a file is required +can be optionally given as argument.

      +
      + Source +
      +
      + + + +
      + + diff --git a/docs/master/Kernel.SpecialForms.html b/docs/master/Kernel.SpecialForms.html new file mode 100644 index 000000000..5b0504bcf --- /dev/null +++ b/docs/master/Kernel.SpecialForms.html @@ -0,0 +1,652 @@ + + + + Kernel.SpecialForms + + + + + + + + + + + + +
      +

      + Kernel.SpecialForms + +

      + + +
      +

      In this module we define Elixir special forms. Those are called +special forms because they cannot be overridden by the developer +and sometimes have lexical scope (like alias, import, etc).

      + +

      This module also documents Elixir's pseudo variables (__MODULE__, +__FILE__, __ENV__ and __CALLER__). Pseudo variables return +information about Elixir's compilation environment and can only +be read, never assigned to.

      + +

      Finally, it also documents 3 special forms (__block__, +__scope__ and __aliases__), which are not intended to be +called directly by the developer but they appear in quoted +contents since they are essential in Elixir's constructions.

      + +
      + + + Source + + + + + + + + +

      Macros summary

      + + + + + + +
      +

      Macros

      +
      +

      + <<>>(args) +

      +

      Defines a new bitstring.

      + +

      Examples

      + +
      :<<>>.(1,2,3)
      +<< 1, 2, 3 >>
      +
      +
      + Source +
      +

      + [](args) +

      +

      Defines a new list.

      + +

      Examples

      + +
      :[].(1,2,3)
      +[ 1, 2, 3 ]
      +
      +
      + Source +
      +

      + __ENV__() +

      +

      Returns the current environment information as a Macro.Env +record. In the environment you can access the current filename, +line numbers, set up aliases, the current function and others.

      +
      + Source +
      +

      + __FILE__() +

      +

      Returns the current file name as a binary. +Although the file can be accessed in the ENV, this macro +is a convenient shortcut.

      +
      + Source +
      +

      + __MODULE__() +

      +

      Returns the current module name as an atom or nil otherwise. +Although the module can be accessed in the ENV, this macro +is a convenient shortcut.

      +
      + Source +
      +

      + __aliases__(args) +

      +

      This is the special form used to hold aliases information. +At compilation time, it is usually compiled to an atom:

      + +
      quote do: Foo.Bar
      +{ :__aliases__, 0, [:Foo,:Bar] }
      +
      +
      + Source +
      +

      + __block__(args) +

      +

      This is the special form used whenever we have a block +of expressions in Elixir. This special form is private +and should not be invoked directly:

      + +
      quote do: (1; 2; 3)
      +#=> { :__block__, 0, [1,2,3] }
      +
      +
      + Source +
      +

      + __scope__(opts, args) +

      +

      This is the special form used whenever we have to temporarily +change the scope information of a block. Used when quote is +invoked with location: :keep to execute a given block as if +it belonged to another file.

      + +
      quote location: :keep, do: 1
      +#=> { :__scope__, 1,[[file: "iex"],[do: 1]] }
      +
      + +

      Check quote/1 for more information.

      +
      + Source +
      +

      + alias(module, opts) +

      +

      alias is used to setup atom aliases, often useful with modules names.

      + +

      Examples

      + +

      alias can be used to setup an alias for any module:

      + +
      defmodule Math do
      +  alias MyKeyword, as: Keyword
      +end
      +
      + +

      In the example above, we have set up MyOrdict to be alias +as Keyword. So now, any reference to Keyword will be +automatically replaced by MyKeyword.

      + +

      In case one wants to access the original Keyword, it can be done +by accessing Elixir:

      + +
      Keyword.values   #=> uses MyKeyword.values
      +Elixir.Keyword.values #=> uses Keyword.values
      +
      + +

      Notice that calling alias without the as: option automatically +sets an alias based on the last part of the module. For example:

      + +
      alias Foo.Bar.Baz
      +
      + +

      Is the same as:

      + +
      alias Foo.Bar.Baz, as: Baz
      +
      + +

      Lexical scope

      + +

      import, require and alias are called directives and all +have lexical scope. This means you can set up aliases inside +specific functions and it won't affect the overall scope.

      +
      + Source +
      +

      + bc(args) +

      +

      Defines a bit comprehension. It follows the same syntax as +a list comprehension but expects each element returned to +be a bitstring. For example, here is how to remove all +spaces from a string:

      + +
      bc <<c>> inbits " hello world ", c != ? , do: <<c>>
      +"helloworld"
      +
      +
      + Source +
      +

      + import(module, opts) +

      +

      import allows one to easily access functions or macros from +others modules without using the qualified name.

      + +

      Examples

      + +

      If you want to use the values function from Keyword several times +in your module and you don't want to always type Keyword.values, +you can simply import it:

      + +
      defmodule Math do
      +  import Keyword, only: [values: 1]
      +
      +  def some_function do
      +    # call values(orddict)
      +  end
      +end
      +
      + +

      In this case, we are importing only the function values (with arity 1) +from Keyword. Although only is optional, its usage is recommended. +except could also be given as an option. If no option is given, all +functions and macros are imported.

      + +

      In case you want to import only functions or macros, you can pass a +first argument selecting the scope:

      + +
      import :macros, MyMacros
      +
      + +

      And you can then use only or except to filter the macros being +included.

      + +

      Lexical scope

      + +

      It is important to notice that import is lexical. This means you +can import specific macros inside specific functions:

      + +
      defmodule Math do
      +  def some_function do
      +    # 1) Disable `if/2` from Kernel
      +    import Kernel, except: [if: 2]
      +
      +    # 2) Require the new `if` macro from MyMacros
      +    import MyMacros
      +
      +    # 3) Use the new macro
      +    if do_something, it_works
      +  end
      +end
      +
      + +

      In the example above, we imported macros from MyMacros, replacing +the original if/2 implementation by our own during that +specific function. All other functions in that module will still +be able to use the original one.

      + +

      Alias/Require shortcut

      + +

      All imported modules are also required by default. import +also accepts as: as an option so it automatically sets up +an alias. Please check alias for more information.

      +
      + Source +
      +

      + lc(args) +

      +

      List comprehensions allow you to quickly build a list from another list:

      + +
      lc n inlist [1,2,3,4], do: n * 2
      +#=> [2,4,6,8]
      +
      + +

      A comprehension accepts many generators and also filters. Generators +are defined using both inlist and inbits operators, allowing you +to loop lists and bitstrings:

      + +
      # A list generator:
      +lc n inlist [1,2,3,4], do: n * 2
      +#=> [2,4,6,8]
      +
      +# A bit string generator:
      +lc <<n>> inbits <<1,2,3,4>>, do: n * 2
      +#=> [2,4,6,8]
      +
      +# A generator from a variable:
      +list = [1,2,3,4]
      +lc n inlist list, do: n * 2
      +#=> [2,4,6,8]
      +
      +# A comprehension with two generators
      +lc x inlist [1,2], y inlist [2,3], do: x*y
      +#=> [2,3,4,6]
      +
      + +

      Filters can also be given:

      + +
      # A comprehension with a generator and a filter
      +lc n inlist [1,2,3,4,5,6], rem(n, 2) == 0, do: n
      +#=> [2,4,6]
      +
      + +

      Bit string generators are quite useful when you need to +organize bit string streams:

      + +
      iex> pixels = <<213,45,132,64,76,32,76,0,0,234,32,15>>
      +iex> lc <<r:8,g:8,b:8>> inbits pixels, do: {r,g,b}
      +[{213,45,132},{64,76,32},{76,0,0},{234,32,15}]
      +
      +
      + Source +
      +

      + quote(opts, list2) +

      +

      Allows you to get the representation of any expression.

      + +

      Examples

      + +
      quote do: sum(1, 2, 3)
      +#=> { :sum, 0, [1, 2, 3] }
      +
      + +

      Homoiconicity

      + +

      Elixir is an homoiconic language. Any Elixir program can be +represented using its own data structures. The building block +of Elixir homoiconicity is a tuple with three elements, for example:

      + +
      { :sum, 1, [1, 2, 3] }
      +
      + +

      The tuple above represents a function call to sum passing 1, 2 and +3 as arguments. The tuple elements are:

      + +
        +
      • The first element of the tuple is always an atom or +another tuple in the same representation;
      • +
      • The second element of the tuple is always an integer +representing the line number;
      • +
      • The third element of the tuple are the arguments for the +function call. The third argument may be an atom, meaning +that it may be a variable.
      • +
      + +

      Macro literals

      + +

      Besides the tuple described above, Elixir has a few literals that +when quoted return themselves. They are:

      + +
      :sum         #=> Atoms
      +1            #=> Integers
      +2.0          #=> Floats
      +[1,2]        #=> Lists
      +"binaries"   #=> Binaries
      +{key, value} #=> Tuple with two elements
      +
      + +

      Hygiene

      + +

      Elixir macros are hygienic regarding to variables. This means +a variable defined in a macro cannot affect the scope where +the macro is included. Consider the following example:

      + +
      defmodule Hygiene do
      +  defmacro no_interference do
      +    quote do: a = 1
      +  end
      +end
      +
      +require Hygiene
      +
      +a = 10
      +Hygiene.no_interference
      +a #=> 10
      +
      + +

      In the example above, a returns 10 even if the macro +is apparently setting it to 1 because the variables defined +in the macro does not affect the context the macro is +executed. If you want to set or get a variable, you can do +it with the help of the var! macro:

      + +
      defmodule NoHygiene do
      +  defmacro interference do
      +    quote do: var!(a) = 1
      +  end
      +end
      +
      +require NoHygiene
      +
      +a = 10
      +NoHygiene.interference
      +a #=> 11
      +
      + +

      Notice that aliases are not hygienic in Elixir, ambiguity +must be solved by prepending Elixir:

      + +
      quote do
      +  Elixir.Foo #=> Access the root Foo
      +  Foo        #=> Access the Foo alias in the current module
      +                 (if any is set), then fallback to Elixir.Foo
      +end
      +
      + +

      Options

      + +
        +
      • :hygiene - When false, disables hygiene;
      • +
      • :unquote - When false, disables unquoting. Useful when you have a quote +inside another quote and want to control which quote is able to unquote;
      • +
      • :location - When set to :keep, keeps the current line and file on quotes. + Read the Stacktrace information section below for more information;
      • +
      + +

      Stacktrace information

      + +

      One of Elixir goals is to provide proper stacktrace whenever there is an +exception. In order to work properly with macros, the default behavior +in quote is to set the line to 0. When a macro is invoked and the quoted +expressions is expanded, 0 is replaced by the line of the call site.

      + +

      This is a good behavior for the majority of the cases, except if the macro +is defining new functions. Consider this example:

      + +
      defmodule MyServer do
      +  use GenServer.Behavior
      +end
      +
      + +

      GenServer.Behavior defines new functions in our MyServer module. +However, if there is an exception in any of these functions, we want +the stacktrace to point to the GenServer.Behavior and not the line +that calls use GenServer.Behavior. For this reason, there is an +option called :location that when set to :keep keeps these proper +semantics:

      + +
      quote location: :keep do
      +  def handle_call(request, _from, state) do
      +    { :reply, :undef, state }
      +  end
      +end
      +
      + +

      It is important to warn though that location: :keep evaluates the +code as if it was defined inside GenServer.Behavior file, in +particular, the macro __FILE__ will always point to +GenServer.Behavior file.

      +
      + Source +
      +

      + require(module, opts) +

      +

      require is used to require the presence of external +modules so macros can be invoked.

      + +

      Examples

      + +

      Notice that usually modules should not be required before usage, +the only exception is if you want to use the macros from a module. +In such cases, you need to explicitly require them.

      + +

      Let's suppose you created your own if implementation in the module +MyMacros. If you want to invoke it, you need to first explicitly +require the MyMacros:

      + +
      defmodule Math do
      +  require MyMacros
      +  MyMacros.if do_something, it_works
      +end
      +
      + +

      An attempt to call a macro that was not loaded will raise an error.

      + +

      Alias shortcut

      + +

      require also accepts as: as an option so it automatically sets +up an alias. Please check alias for more information.

      +
      + Source +
      +

      + unquote(expr) +

      +

      Unquotes the given expression from inside a macro.

      + +

      Examples

      + +

      Imagine the situation you have a variable name and +you want to inject it inside some quote. The first attempt +would be:

      + +
      value = 13
      +quote do: sum(1, value, 3)
      +
      + +

      Which would then return:

      + +
      { :sum, 0, [1, { :value, 0, quoted }, 3] }
      +
      + +

      Which is not the expected result. For this, we use unquote:

      + +
      value = 13
      +quote do: sum(1, unquote(value), 3)
      +#=> { :sum, 0, [1, 13, 3] }
      +
      +
      + Source +
      +

      + unquote_splicing(expr) +

      +

      Unquotes the given list expanding its arguments. Similar +to unquote.

      + +

      Examples

      + +
      values = [2,3,4]
      +quote do: sum(1, unquote_splicing(values), 5)
      +#=> { :sum, 0, [1, 2, 3, 4, 5] }
      +
      +
      + Source +
      +

      + {}(args) +

      +

      Defines a new tuple.

      + +

      Examples

      + +
      :{}.(1,2,3)
      +{ 1, 2, 3 }
      +
      +
      + Source +
      +
      + +
      + + diff --git a/docs/master/Kernel.Typespec.html b/docs/master/Kernel.Typespec.html new file mode 100644 index 000000000..4fcedf60c --- /dev/null +++ b/docs/master/Kernel.Typespec.html @@ -0,0 +1,147 @@ + + + + Kernel.Typespec + + + + + + + + + + + + +
      +

      + Kernel.Typespec + +

      + + +
      +

      This is the module that converts Elixir typespecs +to Erlang typespecs syntax. Everytime @spec, @type +and @typep are used they proxy to the functions +in this module.

      + +
      + + + Source + + + + + + +

      Functions summary

      + + + + +

      Macros summary

      + + + + +
      +

      Functions

      +
      +

      + get_specs(module) +

      +

      Get the specs defined for the given module. This function +is only available for modules being compiled. If the module +was already compiled, you need to loop its attributes +to get such information.

      +
      + Source +
      +

      + get_types(module) +

      +

      Get the types defined for the given module. This function +is only available for modules being compiled. If the module +was already compiled, you need to loop its attributes +to get such information.

      +
      + Source +
      +
      + + + +
      +

      Macros

      +
      +

      + defcallback(spec, block) +

      +
      + Source +
      +

      + defspec(spec, block) +

      +
      + Source +
      +

      + deftype(name, options // []) +

      +
      + Source +
      +

      + deftypep(name) +

      +
      + Source +
      +
      + +
      + + diff --git a/docs/master/Kernel.html b/docs/master/Kernel.html new file mode 100644 index 000000000..52f30761f --- /dev/null +++ b/docs/master/Kernel.html @@ -0,0 +1,3473 @@ + + + + Kernel + + + + + + + + + + + + +
      +

      + Kernel + +

      + + +
      +

      Kernel provides the default macros and functions +Elixir imports into your environment. Those macros and functions +can be skipped or cherry-picked via the import macro. For +instance, if you want to tell Elixir to not import the case +macro, you can do:

      + +
      import Kernel, except: [case: 2]
      +
      + +

      Elixir also has special forms that are always imported and +cannot be skipped. These are described in Kernel.SpecialForms.

      + +

      Some of the functions described in this module are simply +a proxy to its Erlang counterpart. Although they are documented +here for convenience, you can access their original documentation +at http://www.erlang.org/doc/man/erlang.html.

      + +
      + + + Source + + + + + + +

      Functions summary

      + + + + +

      Macros summary

      + + + + +
      +

      Functions

      +
      +

      + raise(msg) +

      +

      Raises an error.

      + +

      If the argument is a binary, it raises RuntimeError with the message. +If anything else, becomes a call to raise(argument, []).

      + +

      Examples

      + +
      raise "Given values do not match"
      +
      +try do
      +  1 + :foo
      +rescue
      +  x in [BadargError] ->
      +    IO.puts "that was expected"
      +    raise x
      +end
      +
      +
      + Source +
      +

      + raise(exception, args) +

      +

      Raises an error.

      + +

      It calls .exception on the given argument passing +the args in order to retrieve the appropriate exception +structure.

      + +

      Any module defined via defexception automatically +defines exception(args) that returns a new instance +of the record and a exception(args, current) that +works as no-op.

      + +

      Examples

      + +
      raise ArgumentError, message: "Sample"
      +
      +
      + Source +
      +
      + + + +
      +

      Macros

      +
      +

      + !(arg) +

      +

      It receives any argument and returns true if it is false +or nil. Returns false otherwise. Not allowed in guard +clauses.

      + +

      Examples

      + +

      !1 #=> false + ![1,2,3] #=> false + !false #=> true + !nil #=> true

      +
      + Source +
      +

      + !=(left, right) +

      +

      Returns true if the two items are not equal.

      + +

      This operator considers 1 and 1.0 to be equal. For strict +comparison, use !== instead.

      + +

      As Erlang, Elixir can compare any term. Allowed in guard clauses.

      + +

      Examples

      + +
      1 != 2
      +#=> true
      +1 != 1.0
      +#=> false
      +
      +
      + Source +
      +

      + !==(left, right) +

      +

      Returns true if the two items are strictly not equal. +As Erlang, Elixir can compare any term. Allowed in guard clauses.

      + +

      Examples

      + +
      1 !== 2
      +#=> true
      +
      +1 !== 1.0
      +#=> true
      +
      +
      + Source +
      +

      + &&(left, right) +

      +

      Provides a short-circuit operator that executes the second +expression only if the first one evalutes to true (i.e. it is +not nil nor false). Returns the first expression otherwise.

      + +

      Examples

      + +
      true && true         #=> true
      +nil && true          #=> nil
      +true && 1            #=> 1
      +false && error(:bad) #=> false
      +
      + +

      Notice that, differently from Erlang and operator, +this operator accepts any expression as arguments, +not only booleans, however it is not allowed in guards.

      +
      + Source +
      +

      + *(left, right) +

      +

      Arithmetic multiplication. Allowed in guard clauses.

      + +

      Examples

      + +
      1 * 2 #=> 2
      +
      +
      + Source +
      +

      + +(left, right) +

      +

      Arithmetic plus. Allowed in guard clauses.

      + +

      Examples

      + +
      1 + 2 #=> 3
      +
      +
      + Source +
      +

      + ++(left, right) +

      +

      Concatenates two lists. Allowed in guard clauses.

      + +

      Examples

      + +
      [1] ++ [2,3]
      +#=> [1,2,3]
      +
      +'foo' ++ 'bar'
      +#=> 'foobar'
      +
      +
      + Source +
      +

      + -(left, right) +

      +

      Arithmetic minus. Allowed in guard clauses.

      + +

      Examples

      + +
      1 - 2 #=> -1
      +
      +
      + Source +
      +

      + --(left, right) +

      +

      Removes the first occorrence of an item on the left +for each item on the right. Allowed in guard clauses.

      + +

      Examples

      + +
      [1,2,3] -- [1,2]
      +#=> [3]
      +
      +[1,2,3,2,1] -- [1,2,2]
      +#=> [3,1]
      +
      +
      + Source +
      +

      + ..(first, last) +

      +

      Returns a range with the specified start and end. +Includes both ends.

      + +

      Examples

      + +
      0 in 1..3 #=> false
      +1 in 1..3 #=> true
      +2 in 1..3 #=> true
      +3 in 1..3 #=> true
      +
      +
      + Source +
      +

      + /(left, right) +

      +

      Arithmetic division. Differently from other languages, +the result is always a float. Use div and rem if you want +a natural division or the remainder. Allowed in guard clauses.

      + +

      Examples

      + +
      1 / 2 #=> 0.5
      +2 / 1 #=> 2.0
      +
      +
      + Source +
      +

      + />(left, right) +

      +

      /> is called the pipeline operator as it is useful +to write pipeline style expressions. This operator +tntroduces the expression on the left as the first +argument to the expression on the right.

      + +

      Examples

      + +
      [1,[2],3] /> List.flatten /> Enum.map(&1 * 2)
      +#=> [2,4,6]
      +
      + +

      The expression above is simply translated to:

      + +
      Enum.map(List.flatten([1,[2],3]), &1 * 2)
      +
      +
      + Source +
      +

      + <(left, right) +

      +

      Return true if left is less than right. +As Erlang, Elixir can compare any term. Allowed in guard clauses.

      + +

      Examples

      + +
      1 < 2
      +#=> true
      +
      +
      + Source +
      +

      + <-(pid, msg) +

      +

      Sends a message to the process identified on the left. +A process can be identified bu its PID or, if it is registered, +by an atom.

      + +

      Examples

      + +
      process = Process.self
      +process <- { :ok, "Sending myself a message" }
      +
      +
      + Source +
      +

      + <=(left, right) +

      +

      Return true if left is less than or equal to right. +As Erlang, Elixir can compare any term. Allowed in guard clauses.

      + +

      Examples

      + +
      1 <= 2
      +#=> true
      +
      +
      + Source +
      +

      + <>(left, right) +

      +

      Concatenates two binaries. Allowed in guard clauses.

      + +

      Examples

      + +
      "foo" <> "bar" #=> "foobar"
      +
      + +

      The <> operator can also be used in guard clauses as +long as the first part is a literal binary:

      + +
      "foo" <> x = "foobar"
      +x #=> "bar"
      +
      +
      + Source +
      +

      + ==(left, right) +

      +

      Returns true if the two items are equal.

      + +

      This operator considers 1 and 1.0 to be equal. For strict +comparison, use === instead.

      + +

      As Erlang, Elixir can compare any term. Allowed in guard clauses.

      + +

      Examples

      + +
      1 == 2
      +#=> false
      +
      +1 == 1.0
      +#=> true
      +
      +
      + Source +
      +

      + ===(left, right) +

      +

      Returns true if the two items are strictly equal. +As Erlang, Elixir can compare any term. Allowed in guard clauses.

      + +

      Examples

      + +
      1 === 2
      +#=> false
      +
      +1 === 1.0
      +#=> false
      +
      +
      + Source +
      +

      + =~(left, right) +

      +

      Matches the term on the left against the regular expression +on the right. It returns nil if not match happened or the +first match otherwise.

      + +

      Examples

      + +
      "abcd" =~ %r/c(d)/  #=> 2
      +"abcd" =~ %r/e/     #=> nil
      +
      +
      + Source +
      +

      + >(left, right) +

      +

      Return true if left is more than right. +As Erlang, Elixir can compare any term. Allowed in guard clauses.

      + +

      Examples

      + +
      1 > 2
      +#=> false
      +
      +
      + Source +
      +

      + >=(left, right) +

      +

      Return true if left is more than or equal to right. +As Erlang, Elixir can compare any term. Allowed in guard clauses.

      + +

      Examples

      + +
      1 >= 2
      +#=> false
      +
      +
      + Source +
      +

      + @(expr) +

      +

      This macro is a shortcut to read and add attributes to the module +being compiled. Elixir module attributes are similar to Erlang's with +some differences. The canonical example for attributes is annotating +that a module implements the OTP behavior called gen_server:

      + +
      defmodule MyServer do
      +  @behavior :gen_server
      +  # ... callbacks ...
      +end
      +
      + +

      Elixir supports by default all Erlang module attributes but any developer +can also add custom attributes:

      + +
      defmodule MyServer do
      +  @my_data 13
      +  IO.inspect @my_data #=> 13
      +end
      +
      + +

      Differently from Erlang, such attributes are not stored in the module by +default since it is common in Elixir to use such attributes to store +temporary data. A developer can configure an attribute to behave closer +to Erlang by calling Module.register_attribute/2.

      + +

      Finally notice that attributes can also be read inside functions:

      + +
      defmodule MyServer do
      +  @my_data 11
      +  def first_data, do: @my_data
      +  @my_data 13
      +  def second_data, do: @my_data
      +end
      +
      +MyServer.first_data #=> 11
      +MyServer.second_data #=> 13
      +
      + +

      It is important to note that reading an attribute takes a snapshot of +its current value. In other words, the value is read at compilation +time and not at runtime. Check the module Module for other functions +to manipulate module attributes.

      +
      + Source +
      +

      + __B__(string, list2) +

      +

      Handles the sigil %B. It simples returns a binary +without escaping characters and without interpolations.

      + +

      Examples

      + +
      %B(foo)      #=> "foo"
      +%B(f#{o}o)  #=> "f\#{o}o"
      +
      +
      + Source +
      +

      + __C__(arg1, list2) +

      +

      Handles the sigil %C. It simples returns a char list +without escaping characters and without interpolations.

      + +

      Examples

      + +
      %C(foo)      #=> 'foo'
      +%C(f#{o}o)  #=> 'f\#{o}o'
      +
      +
      + Source +
      +

      + __R__(arg1, options) +

      +

      Handles the sigil %R. It returns a Regex pattern without escaping +nor interpreating interpolations.

      + +

      Examples

      + +
      Regex.match? %R(f#{1,3}o), "f#o"  #=> true
      +
      +
      + Source +
      +

      + __b__(arg1, list2) +

      +

      Handles the sigil %b. It returns a binary as if it was double quoted +string, unescaping characters and replacing interpolations.

      + +

      Examples

      + +
      %b(foo)       #=> "foo"
      +%b(f#{:o}o)  #=> "foo"
      +
      +
      + Source +
      +

      + __c__(arg1, list2) +

      +

      Handles the sigil %c. It returns a char list as if it was a single +quoted string, unescaping characters and replacing interpolations.

      + +

      Examples

      + +
      %c(foo)       #=> 'foo'
      +%c(f#{:o}o)  #=> 'foo'
      +
      +
      + Source +
      +

      + __r__(arg1, options) +

      +

      Handles the sigil %r. It returns a Regex pattern.

      + +

      Examples

      + +
      Regex.match? %r(foo), "foo"  #=> true
      +
      +
      + Source +
      +

      + abs(number) +

      +

      Returns an integer or float which is the arithmetical absolute value of number.

      + +

      Allowed in guard tests.

      + +

      Examples

      + +
      abs(-3.33) #=> 3.33
      +abs(-3)    #=> 3
      +
      +
      + Source +
      +

      + access(element, args) +

      +

      Access the given element using the qualifier according +to the Access protocol. All calls in the form foo[bar] +are translated to access(foo, bar).

      + +

      The usage of this protocol is to access a raw value in a +keywords list.

      + +
      sample = [a: 1, b: 2, c: 3]
      +sample[:b] #=> 2
      +
      + +

      Atoms

      + +

      Whenever invoked on an atom, the access protocol is expanded +at compilation time rather than on runtime. This feature is used +by records to allow a developer to match against an specific part +of a record:

      + +
      def increment(State[counter: counter, other: 13] = state) do
      +  state.counter(counter + 1)
      +end
      +
      + +

      In the example above, we use the Access protocol to match the +counter field in the record State. Considering the record +definition is as follows:

      + +
      defrecord State, counter: 0, other: nil
      +
      + +

      The clause above is translated to:

      + +
      def increment({ State, counter, 13 } = state) do
      +  state.counter(counter + 1)
      +end
      +
      + +

      The same pattern can be used to create a new record:

      + +
      def new_state(counter) do
      +  State[counter: counter]
      +end
      +
      + +

      The example above is slightly faster than State.new(counter: :counter) +because the record is expanded at compilation time and not at runtime. +If a field is not specified on creation, it will have its default value.

      + +

      Finally, as in Erlang, Elixir also allows the following syntax:

      + +
      new_uri = State[_: 1]
      +
      + +

      In this case all fields will be set to 1. Notice that, +as in Erlang, in case an expression is given, it will be +evaluated multiple times:

      + +
      new_uri = State[_: IO.puts "Hello"]
      +
      + +

      In this case, "Hello" will be printed twice (one per each field).

      + +

      Examples

      + +
      a = { :a, :b, :c }
      +a[1] #=> :a
      +access a, 1 #=> :a
      +
      +
      + Source +
      +

      + and(left, right) +

      +

      Boolean and. Arguments needs to necessarily be booleans. +Allowed in guard clauses.

      + +

      Examples

      + +
      true and false
      +#=> false
      +
      +
      + Source +
      +

      + apply(fun, args) +

      +

      Invokes the given fun with the array of arguments args.

      + +

      Examples

      + +
      apply fn x -> x * 2 end, [2]
      +#=> 4
      +
      +
      + Source +
      +

      + apply(module, fun, args) +

      +

      Invokes the given fun from module with the array of arguments args.

      + +

      Examples

      + +
      apply List, reverse, [[1,2,3]]
      +#=> [3,2,1]
      +
      +
      + Source +
      +

      + atom_to_binary(some_atom) +

      +

      Returns a binary which corresponds to the text representation +of some_atom in UTF8 encoding. Allowed in guard clauses.

      + +

      Examples

      + +
      atom_to_binary :my_atom #=> "my_atom"
      +
      +
      + Source +
      +

      + atom_to_binary(atom, encoding) +

      +

      Returns a binary which corresponds to the text representation of atom. +If encoding is latin1, there will be one byte for each character in the text +representation. If encoding is utf8 or unicode, the characters will be encoded +using UTF-8 (meaning that characters from 16#80 up to 0xFF will be encoded in +two bytes).

      + +

      Examples

      + +
      atom_to_binary(:elixir, utf8) #=> "elixir"
      +
      +
      + Source +
      +

      + atom_to_list(atom) +

      +

      Returns a string which corresponds to the text representation of atom.

      + +

      Examples

      + +
      atom_to_list(:elixir) #=> 'elixir'
      +
      +
      + Source +
      +

      + binary_part(binary, start, length) +

      +

      Extracts the part of the binary starting at start with length length. +Binaries are zero-indexed.

      + +

      If start or length references in any way outside the binary, an +ArgumentError exception is raised.

      + +

      Allowed in guard tests.

      + +

      Examples

      + +
      binary_part "foo", 1, 2 #=> "oo"
      +
      + +

      A negative length can be used to extract bytes at the end of a binary:

      + +
      binary_part "foo", 3, -1 #=> 1
      +
      +
      + Source +
      +

      + binary_to_atom(some_binary) +

      +

      Returns the atom whose text representation is +some_binary in UTF8 encoding. +Allowed in guard clauses.

      + +

      Examples

      + +
      binary_to_atom "my_atom" #=> :my_atom
      +
      +
      + Source +
      +

      + binary_to_atom(binary, encoding) +

      +

      Returns the atom whose text representation is binary. If encoding is latin1, +no translation of bytes in the binary is done. If encoding is utf8 or unicode, +the binary must contain valid UTF-8 sequences; furthermore, only Unicode +characters up to 0xFF are allowed.

      + +

      Examples

      + +
      binary_to_atom("elixir", :utf8) #=> :elixir
      +
      +
      + Source +
      +

      + binary_to_existing_atom(some_binary) +

      +

      Works like binary_to_atom but the atom must exist. +Allowed in guard clauses.

      + +

      Examples

      + +
      :my_atom                          #=> :my_atom
      +binary_to_existing_atom "my_atom" #=> :my_atom
      +
      +
      + Source +
      +

      + binary_to_existing_atom(binary, encoding) +

      +

      Works like binary_to_atom/2, but the atom must already exist.

      +
      + Source +
      +

      + binary_to_list(binary) +

      +

      Returns a list of integers which correspond to the bytes of binary.

      +
      + Source +
      +

      + binary_to_list(binary, start, stop) +

      +

      As binarytolist/1, but returns a list of integers corresponding to the bytes +from position start to position stop in binary. Positions in the binary +are numbered starting from 1.

      +
      + Source +
      +

      + binary_to_term(binary) +

      +

      Returns an Erlang term which is the result of decoding the binary +object binary, which must be encoded according to the Erlang external +term format.

      + +

      Examples

      + +
      binary_to_term(term_to_binary("foo")) #=> "foo"
      +
      +
      + Source +
      +

      + binary_to_term(binary, options) +

      +

      As binary_to_term/1, but accepts a safe option useful when receiving +binaries from an untrusted source.

      + +

      When enabled, it prevents decoding data that may be used to attack the +Erlang system. In the event of receiving unsafe data, decoding fails +with a badarg error.

      + +

      Currently, this prevents creation of new atoms directly, creation of +new atoms indirectly (as they are embedded in certain structures like pids, +refs, funs, etc), and creation of new external function references. None +of those resources are currently garbage collected, so unchecked creation +of them can exhaust available memory.

      + +

      Examples

      + +
      binary_to_term(term_to_binary("foo"), [:safe])
      +
      +
      + Source +
      +

      + bit_size(bitstring) +

      +

      Returns an integer which is the size in bits of bitstring.

      + +

      Allowed in guard tests.

      + +

      Examples

      + +
      bit_size(<<433|16,3|3>>) #=> 19
      +bit_size(<<1,2,3>>) #=> 24
      +
      +
      + Source +
      +

      + bitstring_to_list(bitstring) +

      +

      Returns a list of integers which correspond to the bytes of bitstring. If the +number of bits in the binary is not divisible by 8, the last element of the list will +be a bitstring containing the remaining bits (1 up to 7 bits).

      +
      + Source +
      +

      + byte_size(bitstring) +

      +

      Returns an integer which is the number of bytes needed to contain bitstring. +(That is, if the number of bits in Bitstring is not divisible by 8, the resulting +number of bytes will be rounded up.)

      + +

      Allowed in guard tests.

      + +

      Examples

      + +
      byte_size(<<433|16,3|3>>) #=> 3
      +byte_size(<<1,2,3>>) #=> 3
      +
      +
      + Source +
      +

      + case(condition, blocks) +

      +

      Matches the given condition against the match clauses.

      + +

      Examples

      + +
      case thing do
      +  { :selector, i, value } when is_integer(i) ->
      +    value
      +  value -> value
      +end
      +
      + +

      In the example above, we compare thing with each given +match clause and execute the first one that matches. If no +clause matches, an error is raised.

      + +

      Since Elixir variables can be assigned more than once, variables +in a match clause will always be assigned instead of matching with +its previous values. For example:

      + +
      i = 1
      +case 10 do
      +  i -> i * 2
      +end
      +
      + +

      The example above will return 20, because i is assgined to 10 +and then multiplied by 2. If you desire to match the value of i +against the given condition, you need to use the ^ operator:

      + +
      i = 1
      +case 10 do
      +  ^i -> i * 2
      +end
      +
      + +

      The example above will actually fail because 10 does not match 1.

      + +

      Finally, case accepts an else: branch as a fallback if none +of the clauses match:

      + +
      case thing do
      +  { :selector, i, value } when is_integer(i) ->
      +    value
      +  _ ->
      +    thing
      +end
      +
      +
      + Source +
      +

      + cond(list1) +

      +

      Execute the first clause where the condition returns true, +raises an error otherwise.

      + +

      Examples

      + +
      cond do
      +  1 + 1 == 2 ->
      +    "This will never match"
      +  2 * 2 != 4 ->
      +    "Nor this"
      +  true ->
      +    "This will"
      +end
      +
      +
      + Source +
      +

      + def(name, list2) +

      +

      Defines a function with the given name and contents.

      + +

      Examples

      + +
      defmodule Foo do
      +  def bar, do: :baz
      +end
      +
      +Foo.bar #=> :baz
      +
      + +

      A function that expects arguments can be defined as follow:

      + +
      defmodule Foo do
      +  def sum(a, b) do
      +    a + b
      +  end
      +end
      +
      + +

      In the example above, we defined a function sum that receives +two arguments and sum them.

      + +

      Dynamic generation with atoms

      + +

      Elixir follows the same rule as Erlang when it comes to +function invocations. Calling a function is the same thing +as "invoking at atom". That said, we could invoke a function +named sum in these two equivalent ways:

      + +
      sum(1, 2)
      +:sum.(1, 2)
      +
      + +

      We can also use the atom format to define functions:

      + +
      defmodule Foo do
      +  def :sum.(a, b) do
      +    a + b
      +  end
      +end
      +
      + +

      In general, a developer never needs to use the format above +except when he wants to dynamically define functions with macros. +In such scenarios, the name needs to be given dynamically via +the unquoting mechanism.

      + +

      Imagine a macro that receives keywords and defines a function +for each entry in the keyword, using the key as function name +and the value as the value returned by the function:

      + +
      defmacro defkv(keywords) do
      +  Enum.map keywords, fn {k,v} ->
      +    quote do
      +      def unquote(k).() do
      +        unquote(v)
      +      end
      +    end
      +  end
      +end
      +
      + +

      This macro could be invoked as:

      + +
      defkv one: 1, two: 2
      +
      + +

      Notice in the example above, we define the function as def unquote(k).() +because each entry k is a an atom and invoking def unquote(k)() +would be invalid Elixir syntax.

      +
      + Source +
      +

      + def(name, args, guards, list4) +

      +

      This macro allows a function to be defined more explicitly +by accepting the name, args and guards as different entries.

      + +

      Differently from def/2, the macro arguments are evaluated +and therefore requires quoting.

      + +

      The name must be an atom, the arguments a list where each +element represents another argument and guards a list of +clauses, where each clause is disjunct.

      + +

      Examples

      + +

      The most common mistake when using this macro is to pass the +arguments without quoting:

      + +
      def :some_function, [first_arg, second_arg], is_list(first_arg) do
      +  # ...
      +end
      +
      + +

      However, the example above will fail because it will attempt to +evaluate [first_arg, second_arg] and fail because the variable +first_arg is not defined. Therefore, we need to use quote:

      + +
      name   = :some_function
      +args   = quote(do: [first_arg, second_arg])
      +guards = quote(do: is_list(first_arg))
      +
      +def name, args, guards do
      +  # ...
      +end
      +
      +
      + Source +
      +

      + defdelegate(funs, opts) +

      +

      Defines the given functions in the current module that will +delegate to the given target. Functions defined with +defdelegate are public and are allowed to be invoked +from external. If you find yourself wishing to define a +delegation as private, you should likely use import +instead.

      + +

      Delegation only works with functions, delegating to macros +is not supported.

      + +

      Options

      + +
        +
      • :to - The expression to delegate to. Any expression +is allowed and its results will be calculated on runtime;

      • +
      • :as - The function to call on the target given in :to. +This parameter is optional and defaults to the name being +delegated.

      • +
      • :append_first - If true, when delegated, first argument +passed to the delegate will be relocated to the end of the +arguments when dispatched to the target. The motivation behind +this is a disparity between conventions used in Elixir and Erlang. +Elixir's convention is to pass the "handle" as a first argument, +while in Erlang the convention is to pass it as the last argument

      • +
      + +

      Examples

      + +
      defmodule MyList do
      +  defdelegate reverse(list), to: Erlang.lists
      +  defdelegate [reverse(list), map(callback, list)], to: Erlang.lists
      +  defdelegate other_reverse(list), to: Erlang.lists, as: :reverse
      +end
      +
      +MyList.reverse([1,2,3])
      +#=> [3,2,1]
      +
      +MyList.other_reverse([1,2,3])
      +#=> [3,2,1]
      +
      +
      + Source +
      +

      + defexception(name, values, opts // [], do_block // []) +

      +

      Defines an exception.

      + +

      Exceptions are simply records and therefore defexception/4 has +the same API and similar behavior to defrecord/4 with two notable +differences:

      + +

      1) Differently from records, exceptions are documented by default; +2) Exceptions must implement message/1 as API and return a + binary as result;

      +
      + Source +
      +

      + defimpl(name, opts, do_block // []) +

      +

      Defines an implementation for the given protocol. See +defprotocol/2 for examples.

      +
      + Source +
      +

      + defmodule(name, list2) +

      +

      Defines a module given by name with the given contents.

      + +

      Examples

      + +
      defmodule Foo do
      +  def bar, do: :baz
      +end
      +
      +Foo.bar #=> :baz
      +
      + +

      Nesting

      + +

      Nesting a module inside the other affects its name:

      + +
      defmodule Foo do
      +  defmodule Bar do
      +  end
      +end
      +
      + +

      In the example above, two modules Foo and Foo.Bar. The +second can be accessed as Bar inside Foo in the same +lexical scope. If the module Bar is moved away to another +file, it needs to be referenced via the full name or an +alias need to be set with the help of Kernel.SpecialForms.alias/2.

      + +

      Dynamic names

      + +

      Elixir module names can be dynamically generated. This is very +useful for macros. For instance, one could write:

      + +
      defmodule binary_to_atom("Foo#{1}", :utf8) do
      +  # contents ...
      +end
      +
      + +

      Elixir will accept any module name as long as the expression +returns an atom.

      +
      + Source +
      +

      + defoverridable(tuples) +

      +

      Makes the given functions in the current module overridable. +An overridable function is lazily defined, allowing a +developer to customize it.

      +
      + Source +
      +

      + defp(name, list2) +

      +

      Defines a function that is private. Private functions +can only be accessible from the same module it is defined.

      + +

      Check def/2 for more information

      + +

      Examples

      + +
      defmodule Foo do
      +  def bar do
      +    sum(1, 2)
      +  end
      +
      +  defp sum(a, b), do: a + b
      +end
      +
      + +

      In the example above, sum is private and accessing it +through Foo.sum will raise an error.

      +
      + Source +
      +

      + defp(name, args, guards, list4) +

      +

      The same as def/4 but generates a private function.

      +
      + Source +
      +

      + defprotocol(name, list2) +

      +

      Defines the current module as a protocol and specifies the API +that should be implemented.

      + +

      Examples

      + +

      In Elixir, only false and nil are considered falsy values. +Everything else evaluates to true in if clauses. Depending +on the application, it may be important to specify a blank? +protocol that returns a boolean for other data types that should +be considered blank?. For instance, an empty list or an empty +binary could be considered blanks.

      + +

      We could implement this protocol as follow:

      + +
      defprotocol Blank do
      +  @doc "Returns true if data is considered blank/empty"
      +  def blank?(data)
      +end
      +
      + +

      Now that the protocol is defined, we can implement it. We need +to implement the protocol for each Elixir type. For example:

      + +
      # Numbers are never blank
      +defimpl Blank, for: Number do
      +  def blank?(number), do: false
      +end
      +
      +# Just empty list is blank
      +defimpl Blank, for: List do
      +  def blank?([]), do: true
      +  def blank?(_),  do: false
      +end
      +
      +# Just the atoms false and nil are blank
      +defimpl Blank, for: Atom do
      +  def blank?(false), do: true
      +  def blank?(nil),   do: true
      +  def blank?(_),     do: false
      +end
      +
      + +

      And we would have to define the implementation for all types. +The types available are:

      + +
        +
      • Record
      • +
      • Tuple
      • +
      • Atom
      • +
      • List
      • +
      • BitString
      • +
      • Number
      • +
      • Function
      • +
      • PID
      • +
      • Port
      • +
      • Reference
      • +
      • Any
      • +
      + +

      Selecting implementations

      + +

      Implementing the protocol for all default types can be cumbersome. +Even more, if you consider that Number, Function, PID, Port and +Reference are never going to be blank, it would be easier if we +could simply provide a default implementation.

      + +

      This can be achieved with Elixir as follows:

      + +
      defprotocol Blank do
      +  @only [Atom, Tuple, List, BitString, Any]
      +  def blank?(data)
      +end
      +
      + +

      If the protocol is invoked with a data type that is not an Atom, +nor Tuple, nor List, nor BitString, Elixir will now dispatch to +Any. That said, the default behavior could be implemented as:

      + +
      defimpl Blank, for: Any do
      +  def blank?(_), do: false
      +end
      +
      + +

      Now, all data types that we have not specified will be +automatically considered non blank.

      + +

      Protocols + Records

      + +

      The real benefit of protocols comes when mixed with records. For instance, +imagine we have a module called RedBlack that provides an API to create +and manipulate Red-Black trees. This module represents such trees via a +record named RedBlack.Tree and we want this tree to be considered blank +in case it has no items. To achieve this, the developer just needs to +implement the protocol for RedBlack.Tree:

      + +
      defimpl Blank, for: RedBlack.Tree do
      +  def blank?(tree), do: RedBlack.empty?(tree)
      +end
      +
      + +

      In the example above, we have implemented blank? for RedBlack.Tree +that simply delegates to RedBlack.empty? passing the tree as argument. +This implementation doesn't need to be defined inside the RedBlack +tree or inside the record, but anywhere in the code.

      + +

      Finally, since records are simply tuples, one can add a default protocol +implementation to any record by defining a default implementation for tuples.

      +
      + Source +
      +

      + defrecord(name, values, opts // [], do_block // []) +

      +

      Define a record given by name and values.

      + +

      Examples

      + +
      defrecord FileInfo, atime: nil, mtime: nil
      +
      + +

      The line above will define a module named FileInfo which +contains a function named new that returns a new record +and other functions to read and set the values in the +record. Therefore, we can do:

      + +
      file_info = FileInfo.new(atime: now())
      +file_info.atime         #=> Returns the value of atime
      +file_info.atime(now())  #=> Updates the value of atime
      +
      + +

      Internally, a record is simply a tuple where the first element is +the record module name. This can be noticed if we print the record:

      + +
      IO.inspect FileInfo.new
      +{ FileInfo, nil, nil }
      +
      + +

      Default based functions

      + +

      Depending on the default value, Elixir will define helpers to interact +with the record. For example, ExUnit defines a record which keeps +track of how many tests were executed and the failures that happened +The record definition is similar to:

      + +
      defrecord Config, counter: 0, failures: []
      +
      + +

      Since counter is an integer, Elixir automatically defines a helper +named increment_counter that will increase the counter value:

      + +
      Config.new.increment_counter.counter #=> 1
      +
      + +

      increment_counter also accepts a number of increment as argument:

      + +
      Config.new.increment_counter(10).counter #=> 10
      +
      + +

      Besides, if the default is a list, Elixir will define three helpers:

      + +
        +
      • merge_field - Receives keywords and merge it into the current value;
      • +
      • prepend_field - Receives another list and prepend its values
      • +
      + +

      Documentation

      + +

      By default records are not documented and have @moduledoc set to false. +This can be changed by passing a moduledoc option after values:

      + +
      defrecord Config, [counter: 0, failures: []], moduledoc: "A simple record"
      +
      +
      + Source +
      +

      + destructure(left, right) +

      +

      Allows you to destructure two lists, assigning each +term in the right to the left. Differently from pattern +matching via =, if the sizes of the left and right +lists don't match,, structuring simply stops instead +of raising an error.

      + +

      Examples

      + +
      destructure [x,y,z], [1,2,3,4,5]
      +x #=> 1
      +y #=> 2
      +z #=> 3
      +
      + +

      Notice in the example above, even though the right +size has more entries than the left, structuring works +fine. If the right size is smaller, the remaining items +are simply assigned to nil:

      + +
      destructure [x,y,z], [1]
      +x #=> 1
      +y #=> nil
      +z #=> nil
      +
      + +

      The left side supports any expression you would use +on the left side of a match:

      + +
      x = 1
      +destructure [^x,y,z], [1,2,3]
      +
      + +

      The example above will only work if x matches +the first value from the right side. Otherwise, +it will raise a CaseClauseError.

      +
      + Source +
      +

      + div(left, right) +

      +

      Provides an integer division macro according to Erlang semantics. +Raises an error if one of the arguments is not an integer. +Can be used in guard tests.

      + +

      Examples

      + +
      div 5, 2 #=> 2
      +
      +
      + Source +
      +

      + elem(tuple, index) +

      +

      Define elem to get Tuple element according to Elixir conventions. +We need to implement it as a macro to it can be used in guards.

      + +

      Example

      + +

      tuple = { :foo, :bar, 3 } + elem(tuple, 1) #=> :foo

      +
      + Source +
      +

      + exit(reason) +

      +

      Stops the execution of the calling process with the given reason. +Since evaluating this function causes the process to terminate, +it has no return value.

      + +

      Examples

      + +
      exit(:normal)
      +exit(:seems_bad)
      +
      +
      + Source +
      +

      + float(number) +

      +

      Converts the given number to a float. Allowed in guard clauses.

      +
      + Source +
      +

      + float_to_list(number) +

      +

      Returns a char list which corresponds to the text representation of the given float.

      + +

      Examples

      + +
      float_to_list(7.0)
      +#=> '7.00000000000000000000e+00'
      +
      +
      + Source +
      +

      + function(args) +

      +

      Returns an anonymous function based on the given arguments.

      + +

      Examples

      + +
      sum = function do
      +  (x, y) -> x + y
      +end
      +
      +sum.(1, 2) #=> 3
      +
      + +

      Notice that a function needs to be invoked using the dot between +the function and the arguments.

      + +

      Multiple clauses can be specified as in case, receive and +similar macros:

      + +
      sum = function do
      +  x, y when y > 0 -> x + y
      +  x, y -> x - y
      +end
      +
      +sum.(1, 2) #=> 3
      +
      + +

      Shortcut syntax

      + +

      In order to reduce verbosity, functions in Elixir can be written +using a shortcut syntax via fn:

      + +
      Enum.map [1,2,3], fn x ->
      +  x * 2
      +end
      +
      + +

      Not only the example is shorter, it solves ambiguity issues. Since +do/end always matches the furthest call, if we used the function +macro as below:

      + +
      Enum.map [1,2,3], function(x) do
      +  x * 2
      +end
      +
      + +

      It would be parsed as:

      + +
      Enum.map([1,2,3], function(x)) do
      +  x * 2
      +end
      +
      + +

      The stab shortcut syntax has the proper precedence:

      + +
      Enum.map [1,2,3], fn x ->
      +  x * 2
      +end
      +
      + +

      Which is handled as:

      + +
      Enum.map([1,2,3], fn x ->
      +  x * 2
      +end)
      +
      + +

      Function retrieval

      + +

      The function macro can also be used to retrieve local or remote +functions:

      + +
      f = function(:is_atom, 2)
      +f.(:foo) #=> true
      +
      +f = function(List, :flatten, 1)
      +f.([1,[2],3]) #=> [1,2,3]
      +
      +
      + Source +
      +

      + function_exported?(module, function, arity) +

      +

      Returns true if the module is loaded and contains a +public function with the given arity, otherwise false.

      + +

      Notice that this function does not load the module in case +it is not loaded. Check Code.ensure_loaded/1 for more +information.

      +
      + Source +
      +

      + halt() +

      +

      The same as halt(0, []).

      +
      + Source +
      +

      + halt(status) +

      +

      The same as halt(status, []).

      +
      + Source +
      +

      + halt(status, options) +

      +

      Halts the Erlang runtime system where the first argument status must be a +non-negative integer, a char list, or the atom :abort.

      + +
        +
      • If an integer, the runtime system exits with the integer value which +is returned to the Operating System;

      • +
      • If a char list, an erlang crash dump is produced with status as slogan, +and then the runtime system exits with status code 1;

      • +
      • If :abort, the runtime system aborts producing a core dump, if that is +enabled in the operating system.

      • +
      + +

      Note that on many platforms, only the status codes 0-255 are supported +by the operating system.

      + +

      For integer status, Erlang runtime system closes all ports and allows async +threads to finish their operations before exiting. To exit without such +flushing, pass options [flush: false] instead.

      + +

      Examples

      + +
      halt(0)
      +halt(1, flush: false)
      +halt(:abort)
      +
      +
      + Source +
      +

      + hd(list) +

      +

      Returns the head of a list, raises badarg if the list is empty.

      +
      + Source +
      +

      + if(condition, list2) +

      +

      Provides an if macro. This macro expects the first argument to +be a condition and the rest are keywords arguments.

      + +

      One-liner examples

      + +
      if(foo, do: bar)
      +
      + +

      In the example above, bar will be returned if foo evalutes to +true (i.e. it is not false nor nil). Otherwise, nil will be returned.

      + +

      An else option can be given to specify the opposite:

      + +
      if(foo, do: bar, else: bar)
      +
      + +

      Blocks examples

      + +

      Elixir also allows you to pass a block to the if macro. The first +example above would be translated to:

      + +
      if foo do
      +  bar
      +end
      +
      + +

      Notice that do/end becomes delimiters. The second example would +then translate do:

      + +
      if foo do
      +  bar
      +else
      +  baz
      +end
      +
      + +

      If you want to compare more than two clauses, you can use the cond/1 +macro.

      +
      + Source +
      +

      + in(left, right) +

      +

      Returns true if the element on the left is equal (==) to +any of the items in the right. For now, it only accepts +a list as the right argument.

      + +

      Examples

      + +
      x = 1
      +x in [1,2,3] #=> true
      +
      + +

      This macro simply translates the expression above to:

      + +
      x == 1 or x == 2 or x == 3
      +
      + +

      Clauses

      + +

      Whenever used inside a function or a case clause, you can +optionally omit the variable declaration, for example:

      + +
      case 3 do
      +  x when x in [1,2] -> x * 2
      +  _ -> 0
      +end
      +
      + +

      Could be rewritten as:

      + +
      case 3 do
      +  x in [1,2] -> x * 2
      +  _ -> 0
      +end
      +
      + +

      In this case, Elixir will automatically expand it and define +the variable for us.

      +
      + Source +
      +

      + inspect(arg) +

      +

      Inspect the given arguments according to the Binary.Inspect protocol.

      + +

      Examples

      + +
      inspect(:foo)
      +#=> ":foo"
      +
      +
      + Source +
      +

      + integer_to_list(number) +

      +

      Returns a char list which corresponds to the text representation of the given integer.

      + +

      Examples

      + +
      integer_to_list(7)
      +#=> '7'
      +
      +
      + Source +
      +

      + integer_to_list(number, base) +

      +

      Returns a char list which corresponds to the text representation of the +given integer in the given case.

      + +

      Examples

      + +
      integer_to_list(1023, 16).
      +#=> "3FF"
      +
      +
      + Source +
      +

      + iolist_size(item) +

      +

      Returns the size of an iolist.

      + +

      Examples

      + +
      iolist_size([1,2|<<3,4>>])
      +#=> 4
      +
      +
      + Source +
      +

      + iolist_to_binary(item) +

      +

      Returns a binary which is made from the integers and binaries in iolist.

      + +

      Examples

      + +
      bin1 = <<1,2,3>>
      +bin2 = <<4,5>>
      +bin3 = <<6>>
      +
      +iolist_to_binary([bin1,1,[2,3,bin2],4|bin3])
      +#=> <<1,2,3,1,2,3,4,5,4,6>>
      +
      +
      + Source +
      +

      + is_atom(term) +

      +

      Returns true if term is an atom; otherwise returns false.

      + +

      Allowed in guard tests.

      +
      + Source +
      +

      + is_binary(term) +

      +

      Returns true if term is a binary; otherwise returns false.

      + +

      A binary always contains a complete number of bytes.

      + +

      Allowed in guard tests.

      +
      + Source +
      +

      + is_bitstring(term) +

      +

      Returns true if term is a bitstring (including a binary); otherwise returns false.

      + +

      Allowed in guard tests.

      +
      + Source +
      +

      + is_boolean(term) +

      +

      Returns true if term is either the atom true or the atom false (i.e. a boolean); +otherwise returns false.

      + +

      Allowed in guard tests.

      +
      + Source +
      +

      + is_exception(thing) +

      +

      Check if the given structure is an exception.

      + +

      Examples

      + +
      is_exception(Error.new) #=> true
      +is_exception(1)         #=> false
      +
      +
      + Source +
      +

      + is_float(term) +

      +

      Returns true if term is a floating point number; otherwise returns false.

      + +

      Allowed in guard tests.

      +
      + Source +
      +

      + is_function(term) +

      +

      Returns true if term is a function; otherwise returns false.

      + +

      Allowed in guard tests.

      +
      + Source +
      +

      + is_function(term, arity) +

      +

      Returns true if term is a function that can be applied with arity number of arguments; +otherwise returns false.

      + +

      Allowed in guard tests.

      +
      + Source +
      +

      + is_integer(term) +

      +

      Returns true if term is an integer; otherwise returns false.

      + +

      Allowed in guard tests.

      +
      + Source +
      +

      + is_list(term) +

      +

      Returns true if term is a list with zero or more elements; otherwise returns false.

      + +

      Allowed in guard tests.

      +
      + Source +
      +

      + is_number(term) +

      +

      Returns true if term is either an integer or a floating point number; +otherwise returns false.

      + +

      Allowed in guard tests.

      +
      + Source +
      +

      + is_pid(term) +

      +

      Returns true if term is a pid (process identifier); otherwise returns false.

      + +

      Allowed in guard tests.

      +
      + Source +
      +

      + is_port(term) +

      +

      Returns true if term is a port identifier; otherwise returns false.

      + +

      Allowed in guard tests.

      +
      + Source +
      +

      + is_record(thing, kind) +

      +

      Check if the given structure is a record. It is basically +a convenient macro that checks the structure is a tuple and +the first element matches the given kind.

      + +

      Examples

      + +
      defrecord Config, sample: nil
      +
      +is_record(Config.new, Config) #=> true
      +is_record(Config.new, List)   #=> false
      +
      +
      + Source +
      +

      + is_reference(term) +

      +

      Returns true if term is a reference; otherwise returns false.

      + +

      Allowed in guard tests.

      +
      + Source +
      +

      + is_regex(thing) +

      +

      Check if the given argument is a regex.

      +
      + Source +
      +

      + is_tuple(term) +

      +

      Returns true if term is a tuple; otherwise returns false.

      + +

      Allowed in guard tests.

      +
      + Source +
      +

      + length(list) +

      +

      Returns the length of list.

      + +

      Allowed in guard tests.

      + +

      Examples

      + +
      length([1,2,3,4,5,6,7,8,9]) #=> 9
      +
      +
      + Source +
      +

      + list_to_atom(char_list) +

      +

      Returns the atom whose text representation is char_list.

      + +

      Examples

      + +
      list_to_atom('elixir') #=> :elixir
      +
      +
      + Source +
      +

      + list_to_binary(char_list) +

      +

      Returns a binary which is made from the content of char_list.

      + +

      Examples

      + +
      list_to_binary('Elixir') #=> "Elixir"
      +
      +
      + Source +
      +

      + list_to_bitstring(bitstring_list) +

      +

      Returns a bitstring which is made from the integers and bitstrings in bitstring_list. +(the last tail in bitstring_list is allowed to be a bitstring.)

      + +

      Examples

      + +
      bin1 = <<1,2,3>>
      +bin2 = <<4,5>>
      +bin3 = <<6,7|4>>
      +
      +list_to_bitstring([bin1,1,[2,3,bin2],4|bin3])
      +#=> <<1,2,3,1,2,3,4,5,4,6,7|4>>
      +
      +
      + Source +
      +

      + list_to_existing_atom(char_list) +

      +

      Returns the atom whose text representation is char_list, but only if there already +exists such atom.

      +
      + Source +
      +

      + list_to_float(char_list) +

      +

      Returns the float whose text representation is char_list.

      + +

      Examples

      + +
      list_to_float('2.2017764e+0') #=> 2.2017764
      +
      +
      + Source +
      +

      + list_to_integer(char_list) +

      +

      Returns an integer whose text representation is char_list.

      + +

      Examples

      + +
      list_to_integer('123') #=> 123
      +
      +
      + Source +
      +

      + list_to_integer(char_list, base) +

      +

      Returns an integer whose text representation in base base is char_list.

      + +

      Examples

      + +
      > list_to_integer('3FF', 16) #=> 1023
      +
      +
      + Source +
      +

      + list_to_pid(char_list) +

      +

      Returns a pid whose text representation is char_list.

      + +

      Warning:

      + +

      This function is intended for debugging and for use in the Erlang +operating system.

      + +

      It should not be used in application programs.

      + +

      Examples

      + +
      list_to_pid('<0.41>') #=> <0.4.1>
      +
      +
      + Source +
      +

      + list_to_tuple(list) +

      +

      Returns a tuple which corresponds to list. list can contain any Erlang terms.

      + +

      Examples

      + +
      list_to_tuple([share, [:elixir, 163]]). #=> {share, [:elixir, 163]}
      +
      +
      + Source +
      +

      + make_ref() +

      +

      Returns an almost unique reference.

      + +

      The returned reference will re-occur after approximately 2^82 calls; +therefore it is unique enough for practical purposes.

      + +

      Examples

      + +
      make_ref()
      +#=> #Ref<0.0.0.135>
      +
      +
      + Source +
      +

      + match?(left, right) +

      +

      A convenient macro that checks if the right side matches +the left side. The left side is allowed to be a match pattern.

      + +

      Examples

      + +
      match?(1, 1) #=> true
      +match?(1, 2) #=> false
      +match?({1,_}, {1,2}) #=> true
      +
      + +

      Match can also be used to filter or find a value in an enumerable:

      + +
      list = [{:a,1},{:b,2},{:a,3}]
      +Enum.filter list, match?({:a, _}, _)
      +
      + +

      Guard clauses can also be given to the match:

      + +
      list = [{:a,1},{:b,2},{:a,3}]
      +Enum.filter list, match?({:a, x } when x < 2, &1)
      +
      +
      + Source +
      +

      + max(first, second) +

      +

      Return the biggest of the two given terms according to +Erlang's term ordering. If the terms compare equal, the +first one is returned.

      + +

      Examples

      + +
      max(1, 2) #=> 2
      +
      +
      + Source +
      +

      + min(first, second) +

      +

      Return the smallest of the two given terms according to +Erlang's term ordering. If the terms compare equal, the +first one is returned.

      + +

      Examples

      + +
      min(1, 2) #=> 1
      +
      +
      + Source +
      +

      + node() +

      +

      Returns an atom representing the name of the local node. +If the node is not alive, nonode@nohost is returned instead.

      + +

      Allowed in guard tests.

      +
      + Source +
      +

      + node(arg) +

      +

      Returns the node where the given argmuent is located. +The argument can be a pid, a reference, or a port. +If the local node is not alive, nonode@nohost is returned.

      + +

      Allowed in guard tests.

      +
      + Source +
      +

      + not(arg) +

      +

      Boolean not. Argument needs to necessarily be a boolean. +Allowed in guard clauses.

      + +

      Examples

      + +
      not false
      +#=> true
      +
      +
      + Source +
      +

      + or(left, right) +

      +

      Boolean or. Arguments needs to necessarily be booleans. +Allowed in guard clauses.

      + +

      Examples

      + +
      true or false
      +#=> true
      +
      +
      + Source +
      +

      + pid_to_list(pid) +

      +

      Returns a char list which corresponds to the text representation of pid. +This function is intended for debugging and for use in the Erlang operating +system. It should not be used in application programs.

      + +

      Warning:

      + +

      This function is intended for debugging and for use in the Erlang +operating system.

      + +

      It should not be used in application programs.

      +
      + Source +
      +

      + receive(args) +

      +

      The current process will hang until it receives a message +from other processes that matches the given clauses.

      + +

      Examples

      + +
      receive do
      +  { :selector, i, value } when is_integer(i) ->
      +    value
      +  value when is_atom(value) ->
      +    value
      +  _ ->
      +    IO.puts :standard_error, "Unexpected message received"
      +end
      +
      + +

      The match clauses above follows the same rules as case/2.

      + +

      An optional after clause can be given in case the message was not +received after the specified period of time:

      + +
      receive do
      +  { :selector, i, value } when is_integer(i) ->
      +    value
      +  value when is_atom(value) ->
      +    value
      +  _ ->
      +    IO.puts :standard_error, "Unexpected message received"
      +after
      +  5000 ->
      +    IO.puts :standard_error, "No message in 5 seconds"
      +end
      +
      + +

      The after clause can be specified even if there are no match clauses. +There are two special cases for the timout value given to after

      + +
        +
      • :infinity - The process should wait indefinitely for a matching +message, this is the same as not using a timeout.

      • +
      • 0 - if there is no matching message in the mailbox, the timeout +will occur immediately.

      • +
      +
      + Source +
      +

      + rem(left, right) +

      +

      Provides an integer remainder macro according to Erlang semantics. +Raises an error if one of the arguments is not an integer. +Can be used in guard tests.

      + +

      Examples

      + +
      rem 5, 2 #=> 1
      +
      +
      + Source +
      +

      + round(number) +

      +

      Returns an integer by rounding the given number. +Allowed in guard tests.

      + +

      Examples

      + +
      round(5.5) #=> 6
      +
      +
      + Source +
      +

      + self() +

      +

      Returns the pid (process identifier) of the calling process. +Allowed in guard clauses.

      +
      + Source +
      +

      + setelem(tuple, index, value) +

      +

      Define setelem to set Tuple element according to Elixir conventions. +We need to implement it as a macro to it can be used in guards.

      + +

      Example

      + +

      tuple = { :foo, :bar, 3 } + setelem(tuple, 1, :baz) #=> { :baz, :bar, 3 }

      +
      + Source +
      +

      + size(arg) +

      +

      Returns the size of the given argument, which must be a tuple +or a binary. If possible, please use tuplesize or binarysize.

      +
      + Source +
      +

      + spawn(fun) +

      +

      Spawns the given function and returns its pid.

      + +

      Check the modules Process and Node for other functions +to handle processes, including spawning functions in nodes.

      + +

      Examples

      + +
      current = Process.self
      +child   = spawn(fn -> current <- { Process.self, 1 + 2 } end)
      +
      +receive
      +  { ^child, 3 } -> IO.puts "Received 3 back"
      +end
      +
      +
      + Source +
      +

      + spawn(module, fun, args) +

      +

      Spawns the given module and function passing the given args +and returns its pid.

      + +

      Check the modules Process and Node for other functions +to handle processes, including spawning functions in nodes.

      + +

      Examples

      + +
      spawn(SomeModule, :function, [1,2,3])
      +
      +
      + Source +
      +

      + spawn_link(fun) +

      +

      Spawns the given function, links it to the current process and returns its pid.

      + +

      Check the modules Process and Node for other functions +to handle processes, including spawning functions in nodes.

      + +

      Examples

      + +
      current = Process.self
      +child   = spawn_link(fn -> current <- { Process.self, 1 + 2 } end)
      +
      +receive
      +  { ^child, 3 } ->
      +    IO.puts "Received 3 back"
      +end
      +
      +
      + Source +
      +

      + spawn_link(module, fun, args) +

      +

      Spawns the given module and function passing the given args, +links it to the current process and returns its pid.

      + +

      Check the modules Process and Node for other functions +to handle processes, including spawning functions in nodes.

      + +

      Examples

      + +
      spawn_link(SomeModule, :function, [1,2,3])
      +
      +
      + Source +
      +

      + term_to_binary(term) +

      +

      Returns a binary data which is the result of encoding the given term +according to the Erlang external term format.

      + +

      This can be used for a variety of purposes, for example, writing a term +to a file in an efficient way, or sending an Erlang term to some type +of communications channel not supported by distributed Erlang.

      +
      + Source +
      +

      + term_to_binary(term, opts) +

      +

      The same as term_to_binary/1 but also supports two options:

      + + +
      + Source +
      +

      + throw(term) +

      +

      A non-local return from a function. Check try/2 for more information.

      +
      + Source +
      +

      + tl(list) +

      +

      Returns the tail of a list. Raises ArgumentError if the list is empty.

      +
      + Source +
      +

      + to_binary(arg) +

      +

      Convert the argument to a string according to the Binary.Chars protocol. +This is the function invoked when there is string interpolation.

      + +

      Examples

      + +
      to_binary(:foo)
      +#=> "foo"
      +
      +
      + Source +
      +

      + to_char_list(arg) +

      +

      Convert the argument to a list according to the List.Chars protocol.

      + +

      Examples

      + +
      to_char_list(:foo)
      +#=> 'foo'
      +
      +
      + Source +
      +

      + trunc(number) +

      +

      Returns an integer by the truncating the given number. +Allowed in guard clauses.

      + +

      Examples

      + +
      trunc(5.5) #=> 5
      +
      +
      + Source +
      +

      + try(args) +

      +

      Execute the given expressions and catch any error, exit +or throw that may have happened.

      + +

      Examples

      + +
      try do
      +  do_something_that_may_fail(some_arg)
      +rescue
      +  ArgumentError ->
      +    IO.puts "Invalid argument given"
      +catch
      +  value ->
      +    IO.puts "caught #{value}"
      +after
      +  IO.puts "This is printed regardless if it failed or succeed"
      +end
      +
      + +

      The rescue clause is used to handle errors, while the catch clause +can be used to catch throw values. Both catch and rescue clauses +accepts the same pattern matching rules as match.

      + +

      Note that calls inside try are not tail recursive since the VM +needs to keep the stacktrace in case an exception happens.

      + +

      Rescue clauses

      + +

      Besides accepting the same pattern matching rules as match +clauses, rescue provides some conveniences around exceptions +that allows one to rescue an exception by its name and not by +its internal contents. All the following formats are valid +rescue expressions:

      + +
      try do
      +  UndefinedModule.undefined_function
      +rescue
      +  UndefinedFunctionError -> nil
      +end
      +
      +try do
      +  UndefinedModule.undefined_function
      +rescue
      +  [UndefinedFunctionError] -> nil
      +end
      +
      +# rescue and assign to x
      +try do
      +  UndefinedModule.undefined_function
      +rescue
      +  x in [UndefinedFunctionError] -> nil
      +end
      +
      +# rescue all and assign to x
      +try do
      +  UndefinedModule.undefined_function
      +rescue
      +  x -> nil
      +end
      +
      + +

      Variable visibility

      + +

      Since an expression inside try may not have been evaluted +due to an exception, any variable created inside try cannot +be accessed externaly. +For instance:

      + +
      try do
      +  x = 1
      +  do_something_that_may_fail(same_arg)
      +  :ok
      +catch
      +  _ | _ -> :failed
      +end
      +
      +x #=> Cannot access `x`
      +
      + +

      In the example above, x cannot be accessed since it was defined +inside the try clause.

      + +

      Catching exits and Erlang errors

      + +

      The catch clause works exactly the same as in Erlang. Therefore, +one can also handle exits/errors coming from Erlang as below:

      + +
      try do
      +  exit(1)
      +catch
      +  :exit, 1 -> IO.puts "Exited with 1"
      +end
      +
      +try do
      +  error(:sample)
      +catch
      +  :error, :sample ->
      +    IO.puts "sample error"
      +end
      +
      + +

      Although the second form should be avoided in favor of raise/rescue +control mechanisms.

      +
      + Source +
      +

      + tuple_size(tuple) +

      +

      Returns the size of a tuple.

      +
      + Source +
      +

      + tuple_to_list(tuple) +

      +

      Converts a tuple to a list.

      +
      + Source +
      +

      + unless(clause, options) +

      +

      Provides a unless macro that executes the expression +unless a value evalutes to true. Check if for examples +and documentation.

      +
      + Source +
      +

      + use(module, args // []) +

      +

      use is a simple mechanism for extending the current module with the +given module.

      + +

      Examples

      + +
      defmodule AssertionTest do
      +  use ExUnit.Case, async: true
      +
      +  def test_always_pass do
      +    true = true
      +  end
      +end
      +
      + +

      By calling use, a hook called __using__ will be invoked in +ExUnit.Case which will then do the proper setup. In other words, +use is simply a translation to:

      + +
      defmodule AssertionTest do
      +  require ExUnit.Case
      +  ExUnit.Case.__using__([sync: true])
      +
      +  def test_always_pass do
      +    true = true
      +  end
      +end
      +
      +
      + Source +
      +

      + var!(var) +

      +

      When used inside quoting, marks that the variable should not +be hygienezed. Check Kernel.SpecialForms.quote/1 for more +information.

      +
      + Source +
      +

      + xor(left, right) +

      +

      Boolean xor. Arguments needs to necessarily be booleans. +Allowed in guard clauses.

      + +

      Examples

      + +
      true xor false
      +#=> true
      +
      +
      + Source +
      +

      + ||(left, right) +

      +

      Provides a short-circuit operator that executes the second +expression only if the first one does not evalute to true (i.e. it +is not nil nor false). Returns the first expression otherwise.

      + +

      Examples

      + +
      false || false       #=> false
      +nil || true          #=> true
      +false || 1           #=> 1
      +true || error(:bad)  #=> true
      +
      + +

      Notice that, differently from Erlang or operator, +this operator accepts any expression as arguments, +not only booleans, however it is not allowed in guards.

      +
      + Source +
      +
      + +
      + + diff --git a/docs/master/Mix.Dep.html b/docs/master/Mix.Dep.html new file mode 100644 index 000000000..d28778260 --- /dev/null +++ b/docs/master/Mix.Dep.html @@ -0,0 +1,304 @@ + + + + Mix.Dep + + + + + + + + + + + + +
      +

      + Mix.Dep + + record + +

      + + +
      +

      This is a record that keeps information about your project +dependencies. It keeps:

      + +
        +
      • scm - a module representing the source code management tool (SCM) operations;
      • +
      • app - the app name as an atom;
      • +
      • requirements - a binary or regexp with the deps requirement;
      • +
      • status - the current status of dependency, check Mix.Deps.format_status/1 for more info;
      • +
      • opts - the options given by the developer
      • +
      + +
      + + + Source + + + + +

      Fields (and defaults)

      +
        + +
      • + + app: nil + +
      • + +
      • + + opts: nil + +
      • + +
      • + + requirement: nil + +
      • + +
      • + + scm: nil + +
      • + +
      • + + status: nil + +
      • + +
      + + + +

      Functions summary

      + + + + + + +
      +

      Functions

      +
      +

      + app(record) +

      +
      + Source +
      +

      + app(value, record) +

      +
      + Source +
      +

      + new() +

      +
      + Source +
      +

      + new(opts) +

      +
      + Source +
      +

      + opts(record) +

      +
      + Source +
      +

      + opts(value, record) +

      +
      + Source +
      +

      + requirement(record) +

      +
      + Source +
      +

      + requirement(value, record) +

      +
      + Source +
      +

      + scm(record) +

      +
      + Source +
      +

      + scm(value, record) +

      +
      + Source +
      +

      + status(record) +

      +
      + Source +
      +

      + status(value, record) +

      +
      + Source +
      +

      + to_keywords(record) +

      +
      + Source +
      +

      + update_app(function, record) +

      +
      + Source +
      +

      + update_opts(function, record) +

      +
      + Source +
      +

      + update_requirement(function, record) +

      +
      + Source +
      +

      + update_scm(function, record) +

      +
      + Source +
      +

      + update_status(function, record) +

      +
      + Source +
      +
      + + + +
      + + diff --git a/docs/master/Mix.Deps.Lock.html b/docs/master/Mix.Deps.Lock.html new file mode 100644 index 000000000..7cbcf7fc7 --- /dev/null +++ b/docs/master/Mix.Deps.Lock.html @@ -0,0 +1,103 @@ + + + + Mix.Deps.Lock + + + + + + + + + + + + +
      +

      + Mix.Deps.Lock + +

      + + +
      +

      This is the module responsible to manage mix.lock file.

      + +
      + + + Source + + + + + + +

      Functions summary

      + + + + + + +
      +

      Functions

      +
      +

      + read() +

      +

      Read the file, returns a keywords list containing +the app name and its current lock information.

      +
      + Source +
      +

      + update_lock(deps, callback) +

      +

      Loop the given dependencies triggering the callback. +The callback receives the dependency and its current lock +(may be nil). The callback must return a lock or nil in +case a lock could not be retrieved.

      + +

      This function returns a list with the app names in the +given dependencies that got a lock.

      +
      + Source +
      +

      + write(dict) +

      +

      Receives a keywords list and writes it to the disk.

      +
      + Source +
      +
      + + + +
      + + diff --git a/docs/master/Mix.Deps.html b/docs/master/Mix.Deps.html new file mode 100644 index 000000000..fe69a1bcb --- /dev/null +++ b/docs/master/Mix.Deps.html @@ -0,0 +1,194 @@ + + + + Mix.Deps + + + + + + + + + + + + +
      +

      + Mix.Deps + +

      + + +
      +

      A module with common functions to work with dependencies.

      + +
      + + + Source + + + + + + +

      Functions summary

      + + + + + + +
      +

      Functions

      +
      +

      + all() +

      +

      Returns all dependencies in as Mix.Dep record.

      + +

      Exceptions

      + +

      This function raises an exception in case the developer +provides a dependency in the wrong format.

      + +

      Statuses

      + +

      The status element in the tuple returns the current +situation of the repository. Check format_status/1 +for more information.

      +
      + Source +
      +

      + all(status) +

      +

      Get all dependencies that match the specific status.

      +
      + Source +
      +

      + by_name(given) +

      +

      Receives a list of deps names and returns deps records. +Raises an error if the dependency does not exist.

      +
      + Source +
      +

      + check_lock(dep, lock) +

      +

      Checks the lock for the given dependency and update its status accordingly.

      +
      + Source +
      +

      + deps_path() +

      +

      The default path for dependencies.

      +
      + Source +
      +

      + deps_path(arg1) +

      +

      Returns the path for the given dependency.

      +
      + Source +
      +

      + format_dep(arg1) +

      +

      Format the dependency for printing.

      +
      + Source +
      +

      + format_status(arg1) +

      +

      Formats the status of a dependency.

      +
      + Source +
      +

      + out_of_date?(arg1) +

      +

      Check if a dependency is out of date or not, considering its +lock status. Therefore, be sure to call check_lock before +invoking this function.

      +
      + Source +
      +

      + update_status(arg1) +

      +

      Receives a dependency and update its status

      +
      + Source +
      +
      + + + +
      + + diff --git a/docs/master/Mix.Generator.html b/docs/master/Mix.Generator.html new file mode 100644 index 000000000..17f4f4bdc --- /dev/null +++ b/docs/master/Mix.Generator.html @@ -0,0 +1,148 @@ + + + + Mix.Generator + + + + + + + + + + + + +
      +

      + Mix.Generator + +

      + + +
      +

      Conveniences for working with paths and generating content.

      + +
      + + + Source + + + + + + +

      Functions summary

      + + + + +

      Macros summary

      + + + + +
      +

      Functions

      +
      +

      + create_directory(path) +

      +

      Creates a directory if one does not exist yet.

      +
      + Source +
      +

      + create_file(path, contents) +

      +

      Creates a file with the given contents. +If the file already exists, asks for user confirmation.

      +
      + Source +
      +
      + + + +
      +

      Macros

      +
      +

      + embed_template(name, contents) +

      +

      Embed a template given by contents into the current module.

      + +

      It will define a private function with the name followed by +_template that expects assigns as arguments.

      + +

      This function must be invoked passing a keywords list. +Each key in the keyword list can be accessed in the +template using the @ macro.

      + +

      For more information, check EEx.SmartEngine.

      +
      + Source +
      +

      + embed_text(name, contents) +

      +

      Embeds a text given by contents into the current module.

      + +

      It will define a private function with the name followed by +_text that expects no argument.

      +
      + Source +
      +

      + from_file(path) +

      +

      Reads the content from a file relative to the current +file and not relative to the cwd. Useful when used with +embed macros:

      + +
      embed_template :lib, from_file("../templates/lib.eex")
      +
      +
      + Source +
      +
      + +
      + + diff --git a/docs/master/Mix.Local.html b/docs/master/Mix.Local.html new file mode 100644 index 000000000..4dff0b954 --- /dev/null +++ b/docs/master/Mix.Local.html @@ -0,0 +1,96 @@ + + + + Mix.Local + + + + + + + + + + + + +
      +

      + Mix.Local + +

      + + +
      +

      Module responsible to manage local .mix installation.

      + +
      + + + Source + + + + + + +

      Functions summary

      + + + + + + +
      +

      Functions

      +
      +

      + all_tasks() +

      +

      Returns all tasks modules in .mix/tasks.

      +
      + Source +
      +

      + append_tasks() +

      +

      Append local tasks path into Erlang code path.

      +
      + Source +
      +

      + tasks_path() +

      +

      The path for local tasks.

      +
      + Source +
      +
      + + + +
      + + diff --git a/docs/master/Mix.OutOfDateDepsError.html b/docs/master/Mix.OutOfDateDepsError.html new file mode 100644 index 000000000..b03a3d22d --- /dev/null +++ b/docs/master/Mix.OutOfDateDepsError.html @@ -0,0 +1,156 @@ + + + + Mix.OutOfDateDepsError + + + + + + + + + + + + +
      +

      + Mix.OutOfDateDepsError + + exception + +

      + + + + Source + + + + +

      Fields (and defaults)

      +
        + +
      • + + message: "Some dependencies are out of date, please run `mix deps.get` to proceed" + +
      • + +
      + + + +

      Functions summary

      + + + + + + +
      +

      Functions

      +
      +

      + exception(args) +

      +
      + Source +
      +

      + exception(args, self) +

      +
      + Source +
      +

      + message(record) +

      +
      + Source +
      +

      + message(value, record) +

      +
      + Source +
      +

      + new() +

      +
      + Source +
      +

      + new(opts) +

      +
      + Source +
      +

      + to_keywords(record) +

      +
      + Source +
      +

      + update_message(function, record) +

      +
      + Source +
      +
      + + + +
      + + diff --git a/docs/master/Mix.SCM.html b/docs/master/Mix.SCM.html new file mode 100644 index 000000000..09d8a2b03 --- /dev/null +++ b/docs/master/Mix.SCM.html @@ -0,0 +1,213 @@ + + + + Mix.SCM + + + + + + + + + + + + +
      +

      + Mix.SCM + +

      + + + + Source + + + + + + +

      Functions summary

      + + + + + + +
      +

      Functions

      +
      +

      + available() +

      +

      Returns all available SCM.

      +
      + Source +
      +

      + available?(path, opts) +

      +

      This behavior function receives a path, opts and returns +a boolean if the dependency is available.

      +
      + Source +
      +

      + behaviour_info(atom1) +

      +

      Register required callbacks.

      +
      + Source +
      +

      + check?(path, opts) +

      +

      This behavior function checks if the dependency is locked and +the current repository version matches the lock. Note that some +SCMs do not require a lock, for such, this function can simply +return true.

      +
      + Source +
      +

      + clean(path, opts) +

      +

      This behavior function should clean the given dependency.

      +
      + Source +
      +

      + consumes?(opts) +

      +

      This behavior function receives a keywords list of opts +and should return an updated list in case the SCM consumes +the available options. For example, when a developer specifies +a dependency:

      + +
      { "foo", "0.1.0", github: "foo/bar" }
      +
      + +

      Each registered SCM will be asked if they consume this dependency, +receiving [github: "foo/bar"] as argument. Since this option makes +sense for the Git SCM, it will return an update list of options +while other SCMs would simply return nil.

      +
      + Source +
      +

      + get(path, opts) +

      +

      This behavior function gets unchecked dependencies. +If the dependency is locked, it receives the lock under the +:lock key in opts. In case no lock is given, it must +return a new lock (if one exists). If a lock is given, +it must preferably return the same lock, but can return +a different one in case of failure.

      +
      + Source +
      +

      + key() +

      +

      This behavior function should retrieve an atom representing +the SCM key. In the dependency opts, a value for the given +must be found since it is used to print information about +the requested dependency.

      +
      + Source +
      +

      + register(mod) +

      +

      Register the scm repository with the given key and mod.

      +
      + Source +
      +

      + register_builtin() +

      +

      Register builtin SCMs.

      +
      + Source +
      +

      + update(path, opts) +

      +

      This behavior function updates dependencies. It may be +called either directly via deps.update or implicitly +by deps.get. In the first scenario, no lock is received, +while one is given in the second.

      +
      + Source +
      +
      + + + +
      + + diff --git a/docs/master/Mix.Shell.Process.html b/docs/master/Mix.Shell.Process.html new file mode 100644 index 000000000..aed8ea3ce --- /dev/null +++ b/docs/master/Mix.Shell.Process.html @@ -0,0 +1,136 @@ + + + + Mix.Shell.Process + + + + + + + + + + + + +
      +

      + Mix.Shell.Process + +

      + + +
      +

      This is Mix shell that uses the current process mailbox +for communication instead of IO.

      + +

      When a developer calls info("hello"), the following +message will be sent to the current process:

      + +
      { :mix_shell, :info, ["hello"] }
      +
      + +

      This is mainly useful in tests, allowing us to assert +if given messages were received or not. Since we need +to guarantee a clean slate in between tests, there +is also a flush function responsible for flushing all +:mix_shell related tasks from the process inbox.

      + +
      + + + Source + + + + + + +

      Functions summary

      + + + + + + +
      +

      Functions

      +
      +

      + error(message) +

      +

      Simply forwards the message to the current process.

      +
      + Source +
      +

      + flush(callback // fn x -> + x +end) +

      +

      Flush all :mix_shell messages from the current process. +If a callback is given, it is invoked for each received message.

      + +

      Examples

      + +
      flush IO.inspect(&1)
      +
      +
      + Source +
      +

      + info(message) +

      +

      Simply forwards the message to the current process.

      +
      + Source +
      +

      + yes?(message) +

      +

      Simply forwards the message to the current process. +It also checks the inbox for an input message matching:

      + +
      { :mix_shell_input, :yes?, value }
      +
      + +

      If one does not exist, it will abort since there no shell +process input given. Value must be true or false.

      +
      + Source +
      +
      + + + +
      + + diff --git a/docs/master/Mix.Tasks.Clean.html b/docs/master/Mix.Tasks.Clean.html new file mode 100644 index 000000000..228bebf3c --- /dev/null +++ b/docs/master/Mix.Tasks.Clean.html @@ -0,0 +1,77 @@ + + + + Mix.Tasks.Clean + + + + + + + + + + + + +
      +

      + Mix.Tasks.Clean + +

      + + +
      +

      Clean generated application files.

      + +

      Command line options

      + +
        +
      • --all - Clean everything, including dependencies
      • +
      + +
      + + + Source + + + + + + +

      Functions summary

      + + + + + + +
      +

      Functions

      +
      +

      + run(args) +

      +
      + Source +
      +
      + + + +
      + + diff --git a/docs/master/Mix.Tasks.Compile.App.html b/docs/master/Mix.Tasks.Compile.App.html new file mode 100644 index 000000000..1de7f169d --- /dev/null +++ b/docs/master/Mix.Tasks.Compile.App.html @@ -0,0 +1,95 @@ + + + + Mix.Tasks.Compile.App + + + + + + + + + + + + +
      +

      + Mix.Tasks.Compile.App + +

      + + +
      +

      Writes an .app file.

      + +

      By default, this task will detect all modules in your compile_path +(default to "ebin") and generate a best guess for your application +specification. This best guess also includes "kernel", "stdlib" +and "elixir" as application dependencies.

      + +

      You can optionally define an application/0 function inside your +Mix.Project that returns a keywords list to further configure +your application according to OTP design principles:

      + +

      http://www.erlang.org/doc/design_principles/applications.html

      + +

      Configuration

      + +
        +
      • :app - The application name as a binary (required)
      • +
      • :version - The application version as a binary (required)
      • +
      + +

      Command line options

      + +
        +
      • --force forces compilation regardless of mod times
      • +
      + +
      + + + Source + + + + + + +

      Functions summary

      + + + + + + +
      +

      Functions

      +
      +

      + run(args) +

      +
      + Source +
      +
      + + + +
      + + diff --git a/docs/master/Mix.Tasks.Deps.Check.html b/docs/master/Mix.Tasks.Deps.Check.html new file mode 100644 index 000000000..0b62a7398 --- /dev/null +++ b/docs/master/Mix.Tasks.Deps.Check.html @@ -0,0 +1,75 @@ + + + + Mix.Tasks.Deps.Check + + + + + + + + + + + + +
      +

      + Mix.Tasks.Deps.Check + +

      + + +
      +

      Checks if all dependencies are valid and if not, abort. +Prints the invalid dependencies status before aborting.

      + +

      This task is not shown in mix help but it is part +of mix public API and can be depended on.

      + +
      + + + Source + + + + + + +

      Functions summary

      + + + + + + +
      +

      Functions

      +
      +

      + run(_) +

      +
      + Source +
      +
      + + + +
      + + diff --git a/docs/master/Mix.Tasks.Deps.Clean.html b/docs/master/Mix.Tasks.Deps.Clean.html new file mode 100644 index 000000000..d18681e20 --- /dev/null +++ b/docs/master/Mix.Tasks.Deps.Clean.html @@ -0,0 +1,75 @@ + + + + Mix.Tasks.Deps.Clean + + + + + + + + + + + + +
      +

      + Mix.Tasks.Deps.Clean + +

      + + +
      +

      Clean dependencies.

      + +

      By default, cleans all dependencies. A list of deps can +be given to clean specific ones. Clean does not unlock +the repositories, unless --unlock is given.

      + +
      + + + Source + + + + + + +

      Functions summary

      + + + + + + +
      +

      Functions

      +
      +

      + run(args) +

      +
      + Source +
      +
      + + + +
      + + diff --git a/docs/master/Mix.Tasks.Deps.Compile.html b/docs/master/Mix.Tasks.Deps.Compile.html new file mode 100644 index 000000000..9a2a5562a --- /dev/null +++ b/docs/master/Mix.Tasks.Deps.Compile.html @@ -0,0 +1,96 @@ + + + + Mix.Tasks.Deps.Compile + + + + + + + + + + + + +
      +

      + Mix.Tasks.Deps.Compile + +

      + + +
      +

      Compile dependencies.

      + +

      By default, compile all dependencies. A list of deps can +be given to force the compilation of specific deps.

      + +

      By default, it tries to detect if the project contains one of +the following files:

      + +
        +
      • mix.exs - if so, invokes mix compile
      • +
      • rebar.config - if so, invokes rebar compile
      • +
      • Makefile - if so, invokes make
      • +
      + +

      The compilation can be customized by passing a compile option +in the dependency:

      + +
      { :some_dependency, "0.1.0", git: "...", compile: :compile_some_dependency }
      +
      + +

      If the compile option is an atom, it will invoke the given atom +in the current project passing the app name as argument. Except +if the atom is :noop, where nothing is done.

      + +

      If a binary, it is considered to be command line instructions +which mix will use to shell out.

      + +
      + + + Source + + + + + + +

      Functions summary

      + + + + + + +
      +

      Functions

      +
      +

      + run(args) +

      +
      + Source +
      +
      + + + +
      + + diff --git a/docs/master/Mix.Tasks.Deps.Get.html b/docs/master/Mix.Tasks.Deps.Get.html new file mode 100644 index 000000000..9e0b1bced --- /dev/null +++ b/docs/master/Mix.Tasks.Deps.Get.html @@ -0,0 +1,72 @@ + + + + Mix.Tasks.Deps.Get + + + + + + + + + + + + +
      +

      + Mix.Tasks.Deps.Get + +

      + + +
      +

      Get all out of date dependencies, i.e. dependencies +that are not available or have a wrong lock.

      + +
      + + + Source + + + + + + +

      Functions summary

      + + + + + + +
      +

      Functions

      +
      +

      + run(args) +

      +
      + Source +
      +
      + + + +
      + + diff --git a/docs/master/Mix.Tasks.Deps.Loadpaths.html b/docs/master/Mix.Tasks.Deps.Loadpaths.html new file mode 100644 index 000000000..22cc8eec8 --- /dev/null +++ b/docs/master/Mix.Tasks.Deps.Loadpaths.html @@ -0,0 +1,75 @@ + + + + Mix.Tasks.Deps.Loadpaths + + + + + + + + + + + + +
      +

      + Mix.Tasks.Deps.Loadpaths + +

      + + +
      +

      Loads all dependencies. Invokes "deps.check" before +unless --no-check is given.

      + +

      This task is not shown in mix help but it is part +of mix public API and can be depended on.

      + +
      + + + Source + + + + + + +

      Functions summary

      + + + + + + +
      +

      Functions

      +
      +

      + run(args) +

      +
      + Source +
      +
      + + + +
      + + diff --git a/docs/master/Mix.Tasks.Deps.Unlock.html b/docs/master/Mix.Tasks.Deps.Unlock.html new file mode 100644 index 000000000..cf90c64ec --- /dev/null +++ b/docs/master/Mix.Tasks.Deps.Unlock.html @@ -0,0 +1,72 @@ + + + + Mix.Tasks.Deps.Unlock + + + + + + + + + + + + +
      +

      + Mix.Tasks.Deps.Unlock + +

      + + +
      +

      Unlock the given dependencies. If no dependencies +are given, unlock all.

      + +
      + + + Source + + + + + + +

      Functions summary

      + + + + + + +
      +

      Functions

      +
      +

      + run(args) +

      +
      + Source +
      +
      + + + +
      + + diff --git a/docs/master/Mix.Tasks.Deps.Update.html b/docs/master/Mix.Tasks.Deps.Update.html new file mode 100644 index 000000000..1b02de7cd --- /dev/null +++ b/docs/master/Mix.Tasks.Deps.Update.html @@ -0,0 +1,75 @@ + + + + Mix.Tasks.Deps.Update + + + + + + + + + + + + +
      +

      + Mix.Tasks.Deps.Update + +

      + + +
      +

      Update dependencies.

      + +

      By default, updates all dependencies. A list of deps can +be given to update specific ones. Recompiles the given +projects after updating.

      + +
      + + + Source + + + + + + +

      Functions summary

      + + + + + + +
      +

      Functions

      +
      +

      + run(args) +

      +
      + Source +
      +
      + + + +
      + + diff --git a/docs/master/Mix.Tasks.Deps.html b/docs/master/Mix.Tasks.Deps.html new file mode 100644 index 000000000..0f6615bb9 --- /dev/null +++ b/docs/master/Mix.Tasks.Deps.html @@ -0,0 +1,78 @@ + + + + Mix.Tasks.Deps + + + + + + + + + + + + +
      +

      + Mix.Tasks.Deps + +

      + + +
      +

      List all dependencies and their status. +The output is given as follow:

      + +
        +
      • APP [VERSION] SCM: LOCATION +[locked at REF] +STATUS
      • +
      + +
      + + + Source + + + + + + +

      Functions summary

      + + + + + + +
      +

      Functions

      +
      +

      + run(_) +

      +
      + Source +
      +
      + + + +
      + + diff --git a/docs/master/Mix.Tasks.Do.html b/docs/master/Mix.Tasks.Do.html new file mode 100644 index 000000000..87d35adf4 --- /dev/null +++ b/docs/master/Mix.Tasks.Do.html @@ -0,0 +1,79 @@ + + + + Mix.Tasks.Do + + + + + + + + + + + + +
      +

      + Mix.Tasks.Do + +

      + + +
      +

      Executes the commands separated by comma.

      + +

      Examples

      + +

      The example below prints the available compilers and +then the list of dependencies.

      + +
      mix do compile --list, deps
      +
      + +
      + + + Source + + + + + + +

      Functions summary

      + + + + + + +
      +

      Functions

      +
      +

      + run(args) +

      +
      + Source +
      +
      + + + +
      + + diff --git a/docs/master/Mix.Tasks.Local.Install.html b/docs/master/Mix.Tasks.Local.Install.html new file mode 100644 index 000000000..9ac7d4196 --- /dev/null +++ b/docs/master/Mix.Tasks.Local.Install.html @@ -0,0 +1,82 @@ + + + + Mix.Tasks.Local.Install + + + + + + + + + + + + +
      +

      + Mix.Tasks.Local.Install + +

      + + +
      +

      Install a task locally.

      + +

      The task can be either a local beam file or a beam +file located at some URL.

      + +
      mix local.install http://example.com/some_task.beam
      +
      + +

      After installed, the task can be invoked locally:

      + +
      mix some_task
      +
      + +
      + + + Source + + + + + + +

      Functions summary

      + + + + + + +
      +

      Functions

      +
      +

      + run(argv) +

      +
      + Source +
      +
      + + + +
      + + diff --git a/docs/master/Mix.Tasks.Local.Uninstall.html b/docs/master/Mix.Tasks.Local.Uninstall.html new file mode 100644 index 000000000..e23bda7a6 --- /dev/null +++ b/docs/master/Mix.Tasks.Local.Uninstall.html @@ -0,0 +1,74 @@ + + + + Mix.Tasks.Local.Uninstall + + + + + + + + + + + + +
      +

      + Mix.Tasks.Local.Uninstall + +

      + + +
      +

      Uninstall local tasks:

      + +
      mix local.uninstall task_name
      +
      + +
      + + + Source + + + + + + +

      Functions summary

      + + + + + + +
      +

      Functions

      +
      +

      + run(argv) +

      +
      + Source +
      +
      + + + +
      + + diff --git a/docs/master/Mix.Tasks.Local.html b/docs/master/Mix.Tasks.Local.html new file mode 100644 index 000000000..bb8b730c0 --- /dev/null +++ b/docs/master/Mix.Tasks.Local.html @@ -0,0 +1,71 @@ + + + + Mix.Tasks.Local + + + + + + + + + + + + +
      +

      + Mix.Tasks.Local + +

      + + +
      +

      List local tasks.

      + +
      + + + Source + + + + + + +

      Functions summary

      + + + + + + +
      +

      Functions

      +
      +

      + run(list1) +

      +
      + Source +
      +
      + + + +
      + + diff --git a/docs/master/Mix.Tasks.New.html b/docs/master/Mix.Tasks.New.html new file mode 100644 index 000000000..3b6d936ad --- /dev/null +++ b/docs/master/Mix.Tasks.New.html @@ -0,0 +1,90 @@ + + + + Mix.Tasks.New + + + + + + + + + + + + +
      +

      + Mix.Tasks.New + +

      + + +
      +

      Creates a new Elixir project. +It expects the path of the project as argument.

      + +
      mix new PATH [--app APP] [--module MODULE]
      +
      + +

      A project with the given path name will be created, +unless --app is given, allowing you to set the app +name or the --module is given configuring the module +name.

      + +

      Examples

      + +
      mix new hello_world
      +
      + +

      Is equivalent to:

      + +
      mix new hello_world --app hello_world --module HelloWorld
      +
      + +
      + + + Source + + + + + + +

      Functions summary

      + + + + + + +
      +

      Functions

      +
      +

      + run(argv) +

      +
      + Source +
      +
      + + + +
      + + diff --git a/docs/master/Mix.Tasks.Run.html b/docs/master/Mix.Tasks.Run.html new file mode 100644 index 000000000..acb3edadf --- /dev/null +++ b/docs/master/Mix.Tasks.Run.html @@ -0,0 +1,77 @@ + + + + Mix.Tasks.Run + + + + + + + + + + + + +
      +

      + Mix.Tasks.Run + +

      + + +
      +

      Run the given expression in the application context.

      + +

      Examples

      + +
      mix run Hello.world
      +mix run "Some.function with_args"
      +
      + +
      + + + Source + + + + + + +

      Functions summary

      + + + + + + +
      +

      Functions

      +
      +

      + run(args) +

      +
      + Source +
      +
      + + + +
      + + diff --git a/docs/master/OptionParser.html b/docs/master/OptionParser.html new file mode 100644 index 000000000..94c1bda9a --- /dev/null +++ b/docs/master/OptionParser.html @@ -0,0 +1,130 @@ + + + + OptionParser + + + + + + + + + + + + +
      +

      + OptionParser + +

      + + + + Source + + + + + + +

      Functions summary

      + + + + + + +
      +

      Functions

      +
      +

      + parse(argv, opts // []) +

      +

      Parses the argv and returns one tuple with parsed options +and the arguments.

      + +

      Examples

      + +
      OptionParser.parse(["--debug"])
      +#=> { [debug: true], [] }
      +
      +OptionParser.parse(["--source", "lib"])
      +#=> { [source: "lib"], [] }
      +
      +OptionParser.parse(["--source", "lib", "test/enum_test.exs", "--verbose"])
      +#=> { [source: "lib", verbose: true], ["test/enum_test.exs"] }
      +
      + +

      Aliases

      + +

      A set of aliases can be given as second argument:

      + +
      OptionParser.parse(["-d"], aliases: [d: :debug])
      +#=> { [debug: true], [] }
      +
      + +

      Flags

      + +

      A set of flags can be given as argument too. Those are considered +boolean and never consume the next value unless it is a boolean:

      + +
      OptionParser.parse(["--unlock path/to/file"], flags: [:unlock])
      +#=> { [unlock: true], ["path/to/file"] }
      +
      +OptionParser.parse(["--unlock false path/to/file"], flags: [:unlock])
      +#=> { [unlock: false], ["path/to/file"] }
      +
      + +

      Negation switches

      + +

      Any switches starting with --no- are always considered to be +booleans and never parse the next value.

      + +
      OptionParser.parse(["--no-op path/to/file"])
      +#=> { [no_op: true], ["path/to/file"] }
      +
      +
      + Source +
      +

      + parse_head(argv, opts // []) +

      +

      Similar to parse but only parses the head of the argv. +I.e. as soon as it finds a non switch, it stops parsing.

      + +

      Check parse/2 for more info.

      + +

      Example

      + +
      OptionParser.parse_head(["--source", "lib", "test/enum_test.exs", "--verbose"])
      +#=> { [source: "lib"], ["test/enum_test.exs", "--verbose"] }
      +
      +
      + Source +
      +
      + + + +
      + + diff --git a/docs/master/Regex.CompileError.html b/docs/master/Regex.CompileError.html new file mode 100644 index 000000000..d34a75700 --- /dev/null +++ b/docs/master/Regex.CompileError.html @@ -0,0 +1,156 @@ + + + + Regex.CompileError + + + + + + + + + + + + +
      +

      + Regex.CompileError + + exception + +

      + + + + Source + + + + +

      Fields (and defaults)

      +
        + +
      • + + message: "regex could not be compiled" + +
      • + +
      + + + +

      Functions summary

      + + + + + + +
      +

      Functions

      +
      +

      + exception(args) +

      +
      + Source +
      +

      + exception(args, self) +

      +
      + Source +
      +

      + message(record) +

      +
      + Source +
      +

      + message(value, record) +

      +
      + Source +
      +

      + new() +

      +
      + Source +
      +

      + new(opts) +

      +
      + Source +
      +

      + to_keywords(record) +

      +
      + Source +
      +

      + update_message(function, record) +

      +
      + Source +
      +
      + + + +
      + + From fb71ce880489d911b3ecb7b634015c1451d7717d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Tue, 31 Jul 2012 16:00:49 +0200 Subject: [PATCH 211/437] MixFile -> Mixfile --- getting_started/mix.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/getting_started/mix.markdown b/getting_started/mix.markdown index 3c8873e02..3276f3b53 100644 --- a/getting_started/mix.markdown +++ b/getting_started/mix.markdown @@ -43,7 +43,7 @@ Let's take a brief look at some of these. This is the file with your projects configuration. It looks like this: {% highlight ruby %} -defmodule MyProject.MixFile do +defmodule MyProject.Mixfile do use Mix.Project def project do From 006569025688df84fc2ac51c38f673ac862c5b6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Wed, 1 Aug 2012 08:47:02 +0200 Subject: [PATCH 212/437] Update master docs --- docs/master/IO.html | 2 +- docs/master/Kernel.html | 6 +++--- docs/master/modules_list.html | 2 +- docs/master/protocols_list.html | 2 +- docs/master/records_list.html | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/master/IO.html b/docs/master/IO.html index cd4b850cf..87b1d23d0 100644 --- a/docs/master/IO.html +++ b/docs/master/IO.html @@ -206,7 +206,7 @@

      Examples

      IO.write "sample"
       #=> "sample"
       
      -IO.write :standard_error, "error"
      +IO.write :stderr, "error"
       #=> "error"
       
      diff --git a/docs/master/Kernel.html b/docs/master/Kernel.html index 52f30761f..b9c36b34a 100644 --- a/docs/master/Kernel.html +++ b/docs/master/Kernel.html @@ -3015,7 +3015,7 @@

      Examples

      value when is_atom(value) -> value _ -> - IO.puts :standard_error, "Unexpected message received" + IO.puts :stderr, "Unexpected message received" end @@ -3030,10 +3030,10 @@

      Examples

      value when is_atom(value) -> value _ -> - IO.puts :standard_error, "Unexpected message received" + IO.puts :stderr, "Unexpected message received" after 5000 -> - IO.puts :standard_error, "No message in 5 seconds" + IO.puts :stderr, "No message in 5 seconds" end diff --git a/docs/master/modules_list.html b/docs/master/modules_list.html index fcb0b14fa..f220a82af 100644 --- a/docs/master/modules_list.html +++ b/docs/master/modules_list.html @@ -16,7 +16,7 @@

      - Elixir v0.6.0.dev + Elixir v0.6.0

    528. -
    529. - - BitString - -
    530. -
    531. Function @@ -70,12 +65,6 @@

      Implementations

    532. -
    533. - - Tuple - -
    534. - @@ -100,11 +89,11 @@

      Functions summary

      Functions

      - access/2 + access(xA, xB)

      Receives the element being accessed and the access item.

      - Source + Source
      diff --git a/docs/latest/ArgumentError.html b/docs/stable/ArgumentError.html similarity index 71% rename from docs/latest/ArgumentError.html rename to docs/stable/ArgumentError.html index 1df5e4eee..934d4c77e 100644 --- a/docs/latest/ArgumentError.html +++ b/docs/stable/ArgumentError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -79,6 +79,11 @@

      Functions summary

      new/1

    535. +
    536. + + to_keywords/1 + +
    537. update_message/2 @@ -95,46 +100,52 @@

      Functions summary

      Functions

      - exception/1 + exception(args)

      - Source + Source

      - exception/2 + exception(args, self)

      - Source + Source

      - message/1 + message(record)

      - Source + Source

      - message/2 + message(value, record)

      - Source + Source

      - new/0 + new()

      - Source + Source

      - new/1 + new(opts) +

      +
      + Source +
      +

      + to_keywords(record)

      - Source + Source

      - update_message/2 + update_message(function, record)

      - Source + Source
      diff --git a/docs/latest/ArithmeticError.html b/docs/stable/ArithmeticError.html similarity index 71% rename from docs/latest/ArithmeticError.html rename to docs/stable/ArithmeticError.html index b120ef790..b7483a548 100644 --- a/docs/latest/ArithmeticError.html +++ b/docs/stable/ArithmeticError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -79,6 +79,11 @@

      Functions summary

      new/1
    538. +
    539. + + to_keywords/1 + +
    540. update_message/2 @@ -95,46 +100,52 @@

      Functions summary

      Functions

      - exception/1 + exception(args)

      - Source + Source

      - exception/2 + exception(args, self)

      - Source + Source

      - message/1 + message(record)

      - Source + Source

      - message/2 + message(value, record)

      - Source + Source

      - new/0 + new()

      - Source + Source

      - new/1 + new(opts) +

      +
      + Source +
      +

      + to_keywords(record)

      - Source + Source

      - update_message/2 + update_message(function, record)

      - Source + Source
      diff --git a/docs/latest/BadArityError.html b/docs/stable/BadArityError.html similarity index 71% rename from docs/latest/BadArityError.html rename to docs/stable/BadArityError.html index 66723218f..44d289472 100644 --- a/docs/latest/BadArityError.html +++ b/docs/stable/BadArityError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -100,6 +100,11 @@

      Functions summary

      new/1
    541. +
    542. + + to_keywords/1 + +
    543. update_args/2 @@ -121,70 +126,76 @@

      Functions summary

      Functions

      - args/1 + args(record)

      - Source + Source

      - args/2 + args(value, record)

      - Source + Source

      - exception/1 + exception(args)

      - Source + Source

      - exception/2 + exception(args, self)

      - Source + Source

      - function/1 + function(record)

      - Source + Source

      - function/2 + function(value, record)

      - Source + Source

      - message/1 + message(exception)

      - Source + Source

      - new/0 + new()

      - Source + Source

      - new/1 + new(opts) +

      +
      + Source +
      +

      + to_keywords(record)

      - Source + Source

      - update_args/2 + update_args(function, record)

      - Source + Source

      - update_function/2 + update_function(function, record)

      - Source + Source
      diff --git a/docs/latest/BadFunctionError.html b/docs/stable/BadFunctionError.html similarity index 71% rename from docs/latest/BadFunctionError.html rename to docs/stable/BadFunctionError.html index f71203516..c71393de3 100644 --- a/docs/latest/BadFunctionError.html +++ b/docs/stable/BadFunctionError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -84,6 +84,11 @@

      Functions summary

      new/1
    544. +
    545. + + to_keywords/1 + +
    546. update_actual/2 @@ -100,52 +105,58 @@

      Functions summary

      Functions

      - actual/1 + actual(record)

      - Source + Source

      - actual/2 + actual(value, record)

      - Source + Source

      - exception/1 + exception(args)

      - Source + Source

      - exception/2 + exception(args, self)

      - Source + Source

      - message/1 + message(exception)

      - Source + Source

      - new/0 + new()

      - Source + Source

      - new/1 + new(opts) +

      +
      + Source +
      +

      + to_keywords(record)

      - Source + Source

      - update_actual/2 + update_actual(function, record)

      - Source + Source
      diff --git a/docs/latest/Binary.Chars.Atom.html b/docs/stable/Binary.Chars.Atom.html similarity index 88% rename from docs/latest/Binary.Chars.Atom.html rename to docs/stable/Binary.Chars.Atom.html index 0147163f6..b394c9311 100644 --- a/docs/latest/Binary.Chars.Atom.html +++ b/docs/stable/Binary.Chars.Atom.html @@ -29,7 +29,7 @@

      - Source + Source @@ -54,12 +54,12 @@

      Functions summary

      Functions

      - to_binary/1 + to_binary(atom)

      Convert the atom literally to a binary, except nil which is converted to an empty string.

      - Source + Source
      diff --git a/docs/latest/Binary.Chars.BitString.html b/docs/stable/Binary.Chars.BitString.html similarity index 87% rename from docs/latest/Binary.Chars.BitString.html rename to docs/stable/Binary.Chars.BitString.html index c99718b52..8d4b3a8b3 100644 --- a/docs/latest/Binary.Chars.BitString.html +++ b/docs/stable/Binary.Chars.BitString.html @@ -29,7 +29,7 @@

      - Source + Source @@ -54,11 +54,11 @@

      Functions summary

      Functions

      - to_binary/1 + to_binary(thing)

      Simply returns the binary itself.

      - Source + Source
      diff --git a/docs/latest/Binary.Chars.List.html b/docs/stable/Binary.Chars.List.html similarity index 89% rename from docs/latest/Binary.Chars.List.html rename to docs/stable/Binary.Chars.List.html index 41429f50e..b480a7b3e 100644 --- a/docs/latest/Binary.Chars.List.html +++ b/docs/stable/Binary.Chars.List.html @@ -29,7 +29,7 @@

      - Source + Source @@ -54,7 +54,7 @@

      Functions summary

      Functions

      - to_binary/1 + to_binary(thing)

      Consider the list is an iolist and converts it to a binary. This allows a list of binaries, or @@ -67,7 +67,7 @@

      Examples

      to_binary ["foo", 'bar'] #=> "foobar"
      - Source + Source
      diff --git a/docs/latest/Binary.Chars.Number.html b/docs/stable/Binary.Chars.Number.html similarity index 87% rename from docs/latest/Binary.Chars.Number.html rename to docs/stable/Binary.Chars.Number.html index 3ab66b009..9d4b24298 100644 --- a/docs/latest/Binary.Chars.Number.html +++ b/docs/stable/Binary.Chars.Number.html @@ -29,7 +29,7 @@

      - Source + Source @@ -54,11 +54,11 @@

      Functions summary

      Functions

      - to_binary/1 + to_binary(thing)

      Simply converts the number (integer or a float) to a binary.

      - Source + Source
      diff --git a/docs/latest/Binary.Chars.html b/docs/stable/Binary.Chars.html similarity index 91% rename from docs/latest/Binary.Chars.html rename to docs/stable/Binary.Chars.html index c822cafe5..f25f13800 100644 --- a/docs/latest/Binary.Chars.html +++ b/docs/stable/Binary.Chars.html @@ -35,7 +35,7 @@

      to_binary which does the conversion.

      The to_binary function automatically imported -by Elixir.Builtin invokes this protocol. String +by Kernel invokes this protocol. String interpolation also invokes to_binary in its arguments. For example, "foo#{bar}" is the same as "foo" <> to_binary(bar).

      @@ -43,7 +43,7 @@

      - Source + Source

      Implementations

      @@ -97,10 +97,10 @@

      Functions summary

      Functions

      - to_binary/1 + to_binary(xA)

      - Source + Source
      diff --git a/docs/latest/Binary.Inspect.Any.html b/docs/stable/Binary.Inspect.Any.html similarity index 88% rename from docs/latest/Binary.Inspect.Any.html rename to docs/stable/Binary.Inspect.Any.html index dcb605e58..8bd40dd40 100644 --- a/docs/latest/Binary.Inspect.Any.html +++ b/docs/stable/Binary.Inspect.Any.html @@ -29,7 +29,7 @@

      - Source + Source @@ -54,7 +54,7 @@

      Functions summary

      Functions

      - inspect/1 + inspect(thing)

      For all other terms not implemented, we use the default Erlang representation.

      @@ -64,7 +64,7 @@

      Examples

      inspect Process.self #=> "<0.35.0>"
       
      - Source + Source
      diff --git a/docs/latest/Binary.Inspect.Atom.html b/docs/stable/Binary.Inspect.Atom.html similarity index 79% rename from docs/latest/Binary.Inspect.Atom.html rename to docs/stable/Binary.Inspect.Atom.html index 3a18760dc..1e80c80b7 100644 --- a/docs/latest/Binary.Inspect.Atom.html +++ b/docs/stable/Binary.Inspect.Atom.html @@ -29,7 +29,7 @@

      - Source + Source @@ -54,13 +54,15 @@

      Functions summary

      Functions

      - inspect/1 + inspect(atom)

      -

      Represents the atom as an Elixir term. -The atoms false, true and nil are simply -quoted. Modules are properly represented +

      Represents the atom as an Elixir term. The atoms false, true +and nil are simply quoted. Modules are properly represented as modules using the dot notation.

      +

      Notice that in Elixir, all operators can be represented using +literal atoms (:+, :-, etc).

      +

      Examples

      inspect(:foo)    #=> ":foo"
      @@ -68,7 +70,7 @@ 

      Examples

      inspect(Foo.Bar) #=> "Foo.Bar"
      - Source + Source
      diff --git a/docs/latest/Binary.Inspect.BitString.html b/docs/stable/Binary.Inspect.BitString.html similarity index 88% rename from docs/latest/Binary.Inspect.BitString.html rename to docs/stable/Binary.Inspect.BitString.html index 2100ee1e1..b927a4052 100644 --- a/docs/latest/Binary.Inspect.BitString.html +++ b/docs/stable/Binary.Inspect.BitString.html @@ -29,7 +29,7 @@

      - Source + Source @@ -54,7 +54,7 @@

      Functions summary

      Functions

      - inspect/1 + inspect(thing)

      Represents the string as itself escaping all necessary characters.

      @@ -65,7 +65,7 @@

      Examples

      inspect("f\"oo") #=> "f\"oo"
      - Source + Source
      diff --git a/docs/latest/Binary.Inspect.List.html b/docs/stable/Binary.Inspect.List.html similarity index 75% rename from docs/latest/Binary.Inspect.List.html rename to docs/stable/Binary.Inspect.List.html index a524cd407..f737fe5bb 100644 --- a/docs/latest/Binary.Inspect.List.html +++ b/docs/stable/Binary.Inspect.List.html @@ -29,7 +29,7 @@

      - Source + Source @@ -59,18 +59,24 @@

      Functions summary

      Functions

      - container_join/3 + container_join(list1, acc, last)

      - Source + Source

      - inspect/1 + inspect(thing)

      Represents a list checking if it can be printed or not. If so, a single-quoted representation is returned, otherwise the brackets syntax is used.

      +

      Inspecting a list is conservative as it does not try +to guess how the list is encoded. That said, 'josé' +will likely be inspected as [106,111,115,195,169] +because we can't know if it is encoded in utf-8 +or iso-5569-1, which is common in Erlang libraries.

      +

      Examples

      inspect('bar')       #=> 'bar'
      @@ -78,7 +84,7 @@ 

      Examples

      inspect([:foo,:bar]) #=> "[:foo, :bar]"
      - Source + Source
      diff --git a/docs/latest/Binary.Inspect.Number.html b/docs/stable/Binary.Inspect.Number.html similarity index 88% rename from docs/latest/Binary.Inspect.Number.html rename to docs/stable/Binary.Inspect.Number.html index e1e15b40f..4b3591776 100644 --- a/docs/latest/Binary.Inspect.Number.html +++ b/docs/stable/Binary.Inspect.Number.html @@ -29,7 +29,7 @@

      - Source + Source @@ -54,7 +54,7 @@

      Functions summary

      Functions

      - inspect/1 + inspect(thing)

      Represents the number as a binary.

      @@ -63,7 +63,7 @@

      Examples

      inspect(1) #=> "1"
       
      - Source + Source
      diff --git a/docs/latest/Binary.Inspect.Regex.html b/docs/stable/Binary.Inspect.Regex.html similarity index 88% rename from docs/latest/Binary.Inspect.Regex.html rename to docs/stable/Binary.Inspect.Regex.html index a631e22f8..009614b88 100644 --- a/docs/latest/Binary.Inspect.Regex.html +++ b/docs/stable/Binary.Inspect.Regex.html @@ -29,7 +29,7 @@

      - Source + Source @@ -54,7 +54,7 @@

      Functions summary

      Functions

      - inspect/1 + inspect(thing)

      Represents the Regex using the %r"" syntax.

      @@ -63,7 +63,7 @@

      Examples

      inspect(%r/foo/m) #=> "%r\"foo\"m"
       
      - Source + Source
      diff --git a/docs/latest/Binary.Inspect.Tuple.html b/docs/stable/Binary.Inspect.Tuple.html similarity index 88% rename from docs/latest/Binary.Inspect.Tuple.html rename to docs/stable/Binary.Inspect.Tuple.html index d816a14e1..19410ccab 100644 --- a/docs/latest/Binary.Inspect.Tuple.html +++ b/docs/stable/Binary.Inspect.Tuple.html @@ -29,7 +29,7 @@

      - Source + Source @@ -54,7 +54,7 @@

      Functions summary

      Functions

      - inspect/1 + inspect(exception)

      Inspect tuples. If the tuple represents a record, it shows it nicely formatted using the access syntax.

      @@ -65,7 +65,7 @@

      Examples

      inspect(ArgumentError.new) #=> ArgumentError[message: "argument error"]
      - Source + Source
      diff --git a/docs/latest/Binary.Inspect.html b/docs/stable/Binary.Inspect.html similarity index 93% rename from docs/latest/Binary.Inspect.html rename to docs/stable/Binary.Inspect.html index c330a64dc..c83349a8c 100644 --- a/docs/latest/Binary.Inspect.html +++ b/docs/stable/Binary.Inspect.html @@ -39,7 +39,7 @@

      - Source + Source

      Implementations

      @@ -111,10 +111,10 @@

      Functions summary

      Functions

      - inspect/1 + inspect(xA)

      - Source + Source
      diff --git a/docs/latest/Binary.html b/docs/stable/Binary.html similarity index 82% rename from docs/latest/Binary.html rename to docs/stable/Binary.html index ca487bc5f..d9925ff26 100644 --- a/docs/latest/Binary.html +++ b/docs/stable/Binary.html @@ -32,7 +32,7 @@

      - Source + Source @@ -42,11 +42,6 @@

      Functions summary

      • - - access/2 - -
      • -
      • escape/2 @@ -86,16 +81,8 @@

        Functions summary

        Functions

        -

        - access/2 -

        -

        Simply invokes the Access protocol for the given binary. -Check Access.BitString for more information.

        -
        - Source -

        - escape/2 + escape(other, char)

        Receives a char list and escapes all special chars (like \n) and interpolation markers. A last argument is given and wraps @@ -107,10 +94,10 @@

        Examples

        #=> "'foo'"
        - Source + Source

        - printable?/1 + printable?(arg1)

        Check if a binary is printable considering it is encoded as UTF-8. Returns true if so, false otherwise.

        @@ -120,10 +107,10 @@

        Examples

        Binary.printable?("abc") #=> true
         
        - Source + Source

        - unescape/1 + unescape(chars)

        Unescape the given chars. The unescaping is driven by the same rules as single- and double-quoted strings. Check unescape/2 @@ -142,10 +129,10 @@

        Examples

        In the example above, we pass a string with \n escaped and we return a version with it unescaped.

        - Source + Source

        - unescape/2 + unescape(chars, map)

        Unescape the given chars according to the map given. Check unescape/1 if you want to use the same map as Elixir @@ -172,6 +159,11 @@

        Map

        If the unescape_map function returns false. The char is not escaped and \ is kept in the char list.

        +

        Octals

        + +

        Octals will by default be escaped unless the map function +returns false for ?0.

        +

        Examples

        Using the unescape_map defined above is easy:

        @@ -179,27 +171,27 @@

        Examples

        Binary.unescape "example\\n", unescape_map(&1)
         
        - Source + Source

        - unescape_tokens/1 + unescape_tokens(tokens)

        Unescape the given tokens according to the default map. Check unescape/1 and unescape/2 for more information about unescaping. Only tokens that are char lists are unescaped, all others are ignored. This method is useful when implementing your own sigils. Check the implementation -of Elixir::Builtin.__b__ for examples.

        +of Kernel.__b__ for examples.

        - Source + Source

        - unescape_tokens/2 + unescape_tokens(tokens, map)

        Unescape the given tokens according to the given map. Check unescape_tokens/1 and unescaped/2 for more information.

        - Source + Source
        diff --git a/docs/stable/Bitwise.html b/docs/stable/Bitwise.html new file mode 100644 index 000000000..5a8664906 --- /dev/null +++ b/docs/stable/Bitwise.html @@ -0,0 +1,238 @@ + + + + Bitwise + + + + + + + + + + + + +
        +

        + Bitwise + +

        + + +
        +

        This module provide macros and operators for bitwise operators. +These macros can be used in guards.

        + +

        The easiest way to use is to simply import them into +your module:

        + +
        use Bitwise
        +
        +bnot 1   #=> -2
        +1 &&& 1  #=> 1
        +
        + +

        You can select to include only or skip operators by passing options:

        + +
        use Bitwise, only_operators: true
        +1 &&& 1 #=> 1
        +
        + +
        + + + Source + + + + + + + + +

        Macros summary

        + + + + + + +
        +

        Macros

        +
        +

        + &&&(left, right) +

        +

        Bitwise and as operator.

        +
        + Source +
        +

        + <<<(left, right) +

        +

        Arithmetic bitshift left as operator.

        +
        + Source +
        +

        + >>>(left, right) +

        +

        Arithmetic bitshift right as operator.

        +
        + Source +
        +

        + ^^^(left, right) +

        +

        Bitwise xor as operator.

        +
        + Source +
        +

        + __using__(options) +

        +

        Allow a developer to use this module in their programs with +the following options:

        + +
          +
        • :only_operators - Include only operators;
        • +
        • :skip_operators - Skip operators;
        • +
        +
        + Source +
        +

        + band(left, right) +

        +

        Bitwise and.

        +
        + Source +
        +

        + bnot(expr) +

        +

        Bitwise not.

        +
        + Source +
        +

        + bor(left, right) +

        +

        Bitwise or.

        +
        + Source +
        +

        + bsl(left, right) +

        +

        Arithmetic bitshift left.

        +
        + Source +
        +

        + bsr(left, right) +

        +

        Arithmetic bitshift right.

        +
        + Source +
        +

        + bxor(left, right) +

        +

        Bitwise xor.

        +
        + Source +
        +

        + |||(left, right) +

        +

        Bitwise or as operator.

        +
        + Source +
        +

        + ~~~(expr) +

        +

        Bitwise not as operator.

        +
        + Source +
        +
        + +
        + + diff --git a/docs/latest/CaseClauseError.html b/docs/stable/CaseClauseError.html similarity index 71% rename from docs/latest/CaseClauseError.html rename to docs/stable/CaseClauseError.html index 47d7115b5..e2732e8dc 100644 --- a/docs/latest/CaseClauseError.html +++ b/docs/stable/CaseClauseError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -84,6 +84,11 @@

        Functions summary

        new/1
      • +
      • + + to_keywords/1 + +
      • update_actual/2 @@ -100,52 +105,58 @@

        Functions summary

        Functions

        - actual/1 + actual(record)

        - Source + Source

        - actual/2 + actual(value, record)

        - Source + Source

        - exception/1 + exception(args)

        - Source + Source

        - exception/2 + exception(args, self)

        - Source + Source

        - message/1 + message(exception)

        - Source + Source

        - new/0 + new()

        - Source + Source

        - new/1 + new(opts) +

        +
        + Source +
        +

        + to_keywords(record)

        - Source + Source

        - update_actual/2 + update_actual(function, record)

        - Source + Source
        diff --git a/docs/stable/Code.html b/docs/stable/Code.html new file mode 100644 index 000000000..752c40315 --- /dev/null +++ b/docs/stable/Code.html @@ -0,0 +1,375 @@ + + + + Code + + + + + + + + + + + + +
        +

        + Code + +

        + + +
        +

        The Code module is responsible to manage code compilation, +code evaluation and code loading.

        + +

        It complements (Erlang's code module)1 to add behavior +which is specific to Elixir.

        + +
        + + + Source + + + + + + +

        Functions summary

        + + + + + + +
        +

        Functions

        +
        +

        + append_path(path) +

        +

        Appends a path to Erlang VM code path. +The path is expanded with File.expand_path before added.

        +
        + Source +
        +

        + compile_string(string, file // "nofile") +

        +

        Compiles the given string and returns a list of tuples where +the first element is the module name and the second one is its +binary.

        + +

        For compiling many files at once, check Kernel.ParallelCompiler.

        +
        + Source +
        +

        + compiler_options() +

        +

        Loads the compilation options from the code server. +Check compiler_options/1 for more information.

        +
        + Source +
        +

        + compiler_options(opts) +

        +

        Sets compilation options. Those options are global +since they are stored by Elixir's Code Server.

        + +

        Available options are:

        + +
          +
        • docs - when true, retain documentation in the compiled module. + True by default;
        • +
        • debug_info - when true, retain debug information in the compiled module. + This allows a developer to reconstruct the original source + code, for such reasons, false by default;
        • +
        • ignoremoduleconflict - when true, override modules that were already defined + without raising errors, false by default;
        • +
        +
        + Source +
        +

        + ensure_compiled(module) +

        +

        Ensures the given module is compiled and loaded. If the module +is already loaded, it works as no-op. If the module was not +loaded yet, it checks if it needs to be compiled first and just +then tries to load it.

        + +

        If it succeeds loading the module anyhow, it returns +{ :module, module }. If not, returns { :error, reason } with +the error reason.

        + +

        Check ensure_loaded/1 for more information on module loading +and when to use ensure_loaded/1 or ensure_compiled/1.

        +
        + Source +
        +

        + ensure_loaded(module) +

        +

        Ensures the given module is loaded. If the module is already +loaded, it works as no-op. If the module was not loaded yet, +it tries to load it.

        + +

        If it succeeds loading the module anyhow, it returns +{ :module, module }. If not, returns { :error, reason } with +the error reason.

        + +

        Code loading on the Erlang VM

        + +

        Erlang has two modes to load code: interactive and embedded.

        + +

        By default, the Erlang VM runs on interactive mode, where modules +are loaded as needed. In embedded mode the opposite happens, as all +modules need to be loaded upfront or explicitly.

        + +

        Therefore, this function is useful to check if a module is loaded +before using it and react accordingly. For example, the URI module +uses this function to check if a specific parser exists and is for the +given URI scheme.

        + +

        Code.ensure_compiled

        + +

        Elixir also contains an ensure_compiled/1 function that is a +superset of ensure_loaded/1.

        + +

        Since Elixir's compilation happens in parallel, in some situations +you may need to use a module but it was not compiled yet, therefore +it can't even be loaded.

        + +

        ensure_compiled/1 puts a halt in the current process until the +module we are depending on is available.

        + +

        In most of the cases, ensure_loaded is enough. ensure_compiled +must be used just in same rare conditions, usually involving macros +that needs to invoke a module for callback information.

        +
        + Source +
        +

        + eval(string, binding // [], opts // []) +

        +

        Evalutes the contents given by string. The second argument is the binding +(which should be a Keyword) followed by a keyword list of options. The +options can be:

        + +
          +
        • :file - the file to be considered in the evaluation
        • +
        • :line - the line the script starts
        • +
        • :delegate_locals_to - delegate local calls to the given module, +otherwise functions are evaluated inside Erlang's default scope.
        • +
        + +

        Examples

        + +
        Code.eval "a + b", [a: 1, b: 2], file: __ENV__.file, line: __ENV__.line
        +#=> { 3, [ {:a, 1}, {:b, 2} ] }
        +
        + +

        When passing the ENV's file and line, we could simply get +the location which already returns both fields as a keywords lists:

        + +
        Code.eval "a + b", [a: 1, b: 2], __ENV__.location
        +#=> { 3, [ {:a, 1}, {:b, 2} ] }
        +
        +
        + Source +
        +

        + eval_quoted(quoted, binding // [], opts // []) +

        +

        Evalutes the quoted contents.

        + +

        Options

        + +

        This function accepts a list of options. The supported +options are:

        + +
          +
        • :file - The filename to be used in stacktraces +and the file reported in the ENV variable.

        • +
        • :line - The line reported in the ENV variable.

        • +
        + +

        Examples

        + +
        contents = quote hygiene: false, do: a + b
        +
        +Code.eval_quoted contents, [a: 1, b: 2], file: __ENV__.file, line: __ENV__.line
        +#=> { 3, [ {:a, 1}, {:b, 2} ] }
        +
        + +

        When passing the ENV's file and line, we could simply get +the location which already returns both fields as a keywords lists:

        + +
        Code.eval_quoted contents, [a: 1, b: 2], __ENV__.location
        +#=> { 3, [ {:a, 1}, {:b, 2} ] }
        +
        +
        + Source +
        +

        + load_file(file, relative_to // nil) +

        +

        Loads the given file. Accepts relative_to as an argument to tell +where the file is located. If the file was already required/loaded, +loads it again. It returns the full path of the loaded file.

        + +

        When loading a file, you may skip passing .exs as extension as Elixir +automatically adds it for you.

        +
        + Source +
        +

        + loaded_files() +

        +

        Returns all the loaded files.

        +
        + Source +
        +

        + prepend_path(path) +

        +

        Prepends a path to Erlang VM code path. +The path is expanded with File.expand_path before added.

        +
        + Source +
        +

        + require_file(file, relative_to // nil) +

        +

        Requires the given file. Accepts relative_to as an argument to tell +where the file is located. If the file was already required/loaded, +returns nil, otherwise the full path of the loaded file.

        + +

        When requiring a file, you may skip passing .exs as extension as +Elixir automatically adds it for you.

        +
        + Source +
        +

        + string_to_ast(string, opts // []) +

        +

        Converts the given string to AST. It returns { :ok, ast } +if it succeeds, { :error, { line, error, token } } otherwise.

        + +

        Options

        + +
          +
        • :file - The filename to be used in stacktraces +and the file reported in the ENV variable.

        • +
        • :line - The line reported in the ENV variable.

        • +
        +
        + Source +
        +

        + string_to_ast!(string, opts // []) +

        +

        Converts the given string to AST. It returns the ast if it succeeds, +raises an exception otherwise. The exception is a TokenMissingError +in case a token is missing (usually because the expression is incomplete), +SyntaxError otherwise.

        + +

        Options

        + +
          +
        • :file - The filename to be used in stacktraces +and the file reported in the ENV variable.

        • +
        • :line - The line reported in the ENV variable.

        • +
        +
        + Source +
        +
        + + + +
        + + diff --git a/docs/latest/CompileError.html b/docs/stable/CompileError.html similarity index 71% rename from docs/latest/CompileError.html rename to docs/stable/CompileError.html index aa3b13263..2af7d7487 100644 --- a/docs/latest/CompileError.html +++ b/docs/stable/CompileError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -116,6 +116,11 @@

        Functions summary

        new/1
      • +
      • + + to_keywords/1 + +
      • update_description/2 @@ -142,88 +147,94 @@

        Functions summary

        Functions

        - description/1 + description(record)

        - Source + Source

        - description/2 + description(value, record)

        - Source + Source

        - exception/1 + exception(args)

        - Source + Source

        - exception/2 + exception(args, self)

        - Source + Source

        - file/1 + file(record)

        - Source + Source

        - file/2 + file(value, record)

        - Source + Source

        - line/1 + line(record)

        - Source + Source

        - line/2 + line(value, record)

        - Source + Source

        - message/1 + message(exception)

        - Source + Source

        - new/0 + new()

        - Source + Source

        - new/1 + new(opts) +

        +
        + Source +
        +

        + to_keywords(record)

        - Source + Source

        - update_description/2 + update_description(function, record)

        - Source + Source

        - update_file/2 + update_file(function, record)

        - Source + Source

        - update_line/2 + update_line(function, record)

        - Source + Source
        diff --git a/docs/latest/Dict.Orddict.Record.html b/docs/stable/Dict.HashDict.html similarity index 72% rename from docs/latest/Dict.Orddict.Record.html rename to docs/stable/Dict.HashDict.html index 299875f93..73d4230f5 100644 --- a/docs/latest/Dict.Orddict.Record.html +++ b/docs/stable/Dict.HashDict.html @@ -1,7 +1,7 @@ - Dict.Orddict.Record + Dict.HashDict @@ -21,7 +21,7 @@

        - Dict.Orddict.Record + Dict.HashDict impl @@ -29,7 +29,7 @@

        - Source + Source @@ -114,82 +114,82 @@

        Functions summary

        Functions

        - delete/2 + delete(arg1, key)

        - Source + Source

        - empty/1 + empty(_)

        - Source + Source

        - get/3 + get(arg1, key, default // nil)

        - Source + Source

        - has_key?/2 + has_key?(arg1, key)

        - Source + Source

        - keys/1 + keys(arg1)

        - Source + Source

        - merge/2 + merge(arg1, arg2)

        - Source + Source

        - merge/3 + merge(arg1, arg2, fun)

        - Source + Source

        - put/3 + put(arg1, key, value)

        - Source + Source

        - size/1 + size(arg1)

        - Source + Source

        - to_list/1 + to_list(arg1)

        - Source + Source

        - update/3 + update(arg1, key, fun)

        - Source + Source

        - update/4 + update(arg1, key, initial, fun)

        - Source + Source

        - values/1 + values(arg1)

        - Source + Source
        diff --git a/docs/latest/Dict.HashDict.Record.html b/docs/stable/Dict.Orddict.html similarity index 73% rename from docs/latest/Dict.HashDict.Record.html rename to docs/stable/Dict.Orddict.html index 231af5418..5de22fa0f 100644 --- a/docs/latest/Dict.HashDict.Record.html +++ b/docs/stable/Dict.Orddict.html @@ -1,7 +1,7 @@ - Dict.HashDict.Record + Dict.Orddict @@ -21,7 +21,7 @@

        - Dict.HashDict.Record + Dict.Orddict impl @@ -29,7 +29,7 @@

        - Source + Source @@ -114,82 +114,82 @@

        Functions summary

        Functions

        - delete/2 + delete(arg1, key)

        - Source + Source

        - empty/1 + empty(_)

        - Source + Source

        - get/3 + get(arg1, key, default // nil)

        - Source + Source

        - has_key?/2 + has_key?(arg1, key)

        - Source + Source

        - keys/1 + keys(arg1)

        - Source + Source

        - merge/2 + merge(arg1, arg2)

        - Source + Source

        - merge/3 + merge(arg1, arg2, fun)

        - Source + Source

        - put/3 + put(arg1, key, value)

        - Source + Source

        - size/1 + size(arg1)

        - Source + Source

        - to_list/1 + to_list(arg1)

        - Source + Source

        - update/3 + update(arg1, key, fun)

        - Source + Source

        - update/4 + update(arg1, key, initial, fun)

        - Source + Source

        - values/1 + values(arg1)

        - Source + Source
        diff --git a/docs/latest/Dict.html b/docs/stable/Dict.html similarity index 81% rename from docs/latest/Dict.html rename to docs/stable/Dict.html index 8cae3e052..ac36c91fe 100644 --- a/docs/latest/Dict.html +++ b/docs/stable/Dict.html @@ -36,7 +36,7 @@

        - Source + Source

        Implementations

        @@ -44,13 +44,13 @@

        Implementations

      • - HashDict.Record + HashDict
      • - Orddict.Record + Orddict
      • @@ -143,7 +143,7 @@

        Functions summary

        Functions

        - delete/2 + delete(xA, xB)

        Removes the entry stored under the given key from dict. If dict does not contain key, returns the dictionary unchanged.

        @@ -154,17 +154,17 @@

        Examples

        Dict.delete [b: 2], :a #=> [b: 2]
        - Source + Source

        - empty/1 + empty(xA)

        Returns an empty dict of the same type as dict.

        - Source + Source

        - get/2 + get(xA, xB)

        Returns the value associated with key in dict. If dict does not contain key, returns default (or nil if not provided).

        @@ -176,29 +176,29 @@

        Examples

        Dict.get [a: 1], :b, 3 #=> 3
        - Source + Source

        - get/3 + get(xA, xB, xC)

        - Source + Source

        - has_key?/2 + has_key?(xA, xB)

        Returns whether the given key exists in the given dict.

        Examples

        -
        Dict.has_key?([a:, 1], :a)  #=> true
        -Dict.has_key?([a:, 1], :b)  #=> false
        +
        Dict.has_key?([a: 1], :a)  #=> true
        +Dict.has_key?([a: 1], :b)  #=> false
         
        - Source + Source

        - keys/1 + keys(xA)

        Returns a list containing all dict's keys. The keys are not guaranteed to be sorted, unless @@ -209,10 +209,10 @@

        Examples

        Dict.keys [a: 1, b: 2]  #=> [:a,:b]
         
        - Source + Source

        - merge/2 + merge(xA, xB)

        Merges two dicts into one. If the dicts have duplicated entries, the one given as second argument wins.

        @@ -223,10 +223,10 @@

        Examples

        #=> [a:3, b:2, d: 4]
        - Source + Source

        - merge/3 + merge(xA, xB, xC)

        Merges two dicts into one. If the dicts have duplicated entries, the given function is invoked to solve conflicts.

        @@ -239,10 +239,10 @@

        Examples

        #=> [a: 4, b: 2, d: 4]
        - Source + Source

        - put/3 + put(xA, xB, xC)

        Stores the given value under key in dict. If dict already has key, the stored value is replaced by the new one.

        @@ -253,10 +253,10 @@

        Examples

        #=> [a: 3, b: 2]
        - Source + Source

        - size/1 + size(xA)

        Returns the number of elements in dict.

        @@ -265,18 +265,18 @@

        Examples

        Dict.size [a: 1, b: 2]  #=> 2
         
        - Source + Source

        - to_list/1 + to_list(xA)

        Returns a list of key-value pairs stored in dict. No particular order is enforced.

        - Source + Source

        - update/3 + update(xA, xB, xC)

        Update a value in dict by calling fun on the value to get a new value. An exception is generated if key is not present in the dict.

        @@ -287,10 +287,10 @@

        Examples

        #=> [a: -1, b: 2]
        - Source + Source

        - update/4 + update(xA, xB, xC, xD)

        Update a value in dict by calling fun on the value to get a new value. If key is not present in dict then initial will be stored as the first @@ -302,10 +302,10 @@

        Examples

        #=> [a: 1, b: 2, c: 3]
        - Source + Source

        - values/1 + values(xA)

        Returns a list containing all dict's values.

        @@ -314,7 +314,7 @@

        Examples

        Dict.values [a: 1, b: 2]  #=> [1,2]
         
        - Source + Source
        diff --git a/docs/latest/EEx.AssignsEngine.html b/docs/stable/EEx.AssignsEngine.html similarity index 95% rename from docs/latest/EEx.AssignsEngine.html rename to docs/stable/EEx.AssignsEngine.html index 1a8e207ad..3e98b63fb 100644 --- a/docs/latest/EEx.AssignsEngine.html +++ b/docs/stable/EEx.AssignsEngine.html @@ -53,7 +53,7 @@

        Examples

        - Source + Source diff --git a/docs/latest/EEx.Engine.html b/docs/stable/EEx.Engine.html similarity index 87% rename from docs/latest/EEx.Engine.html rename to docs/stable/EEx.Engine.html index da6c0c9d2..d5fe1e0ec 100644 --- a/docs/latest/EEx.Engine.html +++ b/docs/stable/EEx.Engine.html @@ -52,7 +52,7 @@

        - Source + Source @@ -87,13 +87,13 @@

        Functions summary

        Functions

        - behaviour_info/1 + behaviour_info(atom1)

        - Source + Source

        - handle_expr/3 + handle_expr(buffer, list2, expr)

        Implements expressions according to the markers.

        @@ -103,14 +103,14 @@

        Functions

        All other markers are not implemented by this engine.

        - Source + Source

        - handle_text/2 + handle_text(buffer, text)

        The default implementation simply concatenates text to the buffer.

        - Source + Source
        diff --git a/docs/latest/EEx.SmartEngine.html b/docs/stable/EEx.SmartEngine.html similarity index 73% rename from docs/latest/EEx.SmartEngine.html rename to docs/stable/EEx.SmartEngine.html index 18d9fd770..aa28a9bba 100644 --- a/docs/latest/EEx.SmartEngine.html +++ b/docs/stable/EEx.SmartEngine.html @@ -27,16 +27,14 @@

        -

        An engine meant for end-user usage that includes both -AssignsEngine and ForEngine conveniences. Therefore, -a developer can easily access assigns via @ and loop -using for. Read EEx.AssignsEngine and EEx.ForEngine -for examples.

        +

        An engine meant for end-user usage that includes +AssignsEngine and other conveniences. Read +EEx.AssignsEngine for examples.

        - Source + Source @@ -66,16 +64,16 @@

        Functions summary

        Functions

        - handle_expr/3 + handle_expr(buffer, mark, expr)

        - Source + Source

        - handle_text/2 + handle_text(buffer, text)

        - Source + Source
        diff --git a/docs/latest/EEx.SyntaxError.html b/docs/stable/EEx.SyntaxError.html similarity index 73% rename from docs/latest/EEx.SyntaxError.html rename to docs/stable/EEx.SyntaxError.html index 564d44959..d03b26618 100644 --- a/docs/latest/EEx.SyntaxError.html +++ b/docs/stable/EEx.SyntaxError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -79,6 +79,11 @@

        Functions summary

        new/1 +
      • + + to_keywords/1 + +
      • update_message/2 @@ -95,46 +100,52 @@

        Functions summary

        Functions

        - exception/1 + exception(args)

        - Source + Source

        - exception/2 + exception(args, self)

        - Source + Source

        - message/1 + message(record)

        - Source + Source

        - message/2 + message(value, record)

        - Source + Source

        - new/0 + new()

        - Source + Source

        - new/1 + new(opts) +

        +
        + Source +
        +

        + to_keywords(record)

        - Source + Source

        - update_message/2 + update_message(function, record)

        - Source + Source
        diff --git a/docs/latest/EEx.TransformerEngine.html b/docs/stable/EEx.TransformerEngine.html similarity index 85% rename from docs/latest/EEx.TransformerEngine.html rename to docs/stable/EEx.TransformerEngine.html index e5929b133..c1658e032 100644 --- a/docs/latest/EEx.TransformerEngine.html +++ b/docs/stable/EEx.TransformerEngine.html @@ -33,13 +33,13 @@

        overridable directive that allows a developer to customize the expression returned by the engine.

        -

        Check EEx.AssignsEngine, EEx.ForEngine and -EEx.SmartEngine for examples of using this module.

        +

        Check EEx.AssignsEngine and EEx.SmartEngine for +examples of using this module.

        - Source + Source diff --git a/docs/latest/EEx.html b/docs/stable/EEx.html similarity index 81% rename from docs/latest/EEx.html rename to docs/stable/EEx.html index c3dc89b20..ea71a9af9 100644 --- a/docs/latest/EEx.html +++ b/docs/stable/EEx.html @@ -45,7 +45,8 @@

        API

        2) Define a function from a string (function_from_string) or a file (function_from_file). This allows you to embed the template as a function inside a module which will then - be compiled. This is the preferred API;

        + be compiled. This is the preferred API if you have access + to the template at compilation time;

        3) Compile a string (compile_string) or a file (compile_file) into Elixir syntax tree. This is the API used by both functions @@ -65,16 +66,15 @@

        Tags

        EEx.SmartEngine supports the following tags:

        <% Elixir expression - inline with output %>
        -<& Elxir matching expression - not printed &>
         <%= Elixir expression - replace with result %>
         

        All expressions that output something to the template -must use the equals sign (=). Since everything in +must use the equals sign (=). Since everything in Elixir is a macro, there are no exceptions for this rule. For example, while some template languages would special- case if clauses, they are treated the same in EEx and -also requires = in order to have their result printed:

        +also require = in order to have their result printed:

        <%= if true do %>
           It is obviously true
        @@ -83,29 +83,14 @@ 

        Tags

        <% end %>
        -

        The <& ... &> expression is only used in matching clauses. -For example, the cond macro would be written as:

        - -
        <%= cond do %>
        -  <& false -> &> Never printed
        -  <& true  -> &> always printed
        -<% end %>
        -
        -

        Notice that different engines may have different rules for each tag. Other tags may be added in future versions.

        Macros

        -

        EEx.SmartEngine also adds two macros to your template. -The first one is the for macro, which allows you to easily -loop a variable:

        - -
        EEx.eval_string "<%= for x in [1,2,3] do %><%= x %>\n<% end %>", []
        -#=> "1\n2\n3\n"
        -
        - -

        It also adds defines a macro named @ that allows easy access:

        +

        EEx.SmartEngine also adds some macros to your template. +An example is the @ macro which allows easy data access +in a template:

        EEx.eval_string "<%= @foo %>", assigns: [foo: 1]
         #=> 1
        @@ -122,7 +107,7 @@ 

        Macros

        - Source + Source @@ -177,23 +162,23 @@

        Macros summary

        Functions

        - compile_file/2 + compile_file(filename, options // [])

        Get a filename and generate a quoted expression that can be evaluated by Elixir or compiled to a function.

        - Source + Source

        - compile_string/2 + compile_string(source, options // [])

        Get a string source and generate a quoted expression that can be evaluated by Elixir or compiled to a function.

        - Source + Source

        - eval_file/3 + eval_file(filename, bindings // [], options // [])

        Get a filename and evaluate the values using the bindings.

        @@ -207,10 +192,10 @@

        Examples

        #=> "foo baz"
        - Source + Source

        - eval_string/3 + eval_string(source, bindings // [], options // [])

        Get a string source and evaluate the values using the bindings.

        @@ -220,7 +205,7 @@

        Examples

        #=> "foo baz"
        - Source + Source
        @@ -230,7 +215,7 @@

        Examples

        Macros

        - function_from_file/5 + function_from_file(kind, name, filename, args // [], options // [])

        Generates a function definition from the file contents. The kind (:def or :defp) must be given, the @@ -254,10 +239,10 @@

        Examples

        Sample.sample(1, 2) #=> "3"
        - Source + Source

        - function_from_string/5 + function_from_string(kind, name, source, args // [], options // [])

        Generates a function definition from the string. The kind (:def or :defp) must be given, the @@ -273,7 +258,7 @@

        Examples

        Sample.sample(1, 2) #=> "3"
        - Source + Source
        diff --git a/docs/stable/Enum.Iterator.Function.html b/docs/stable/Enum.Iterator.Function.html new file mode 100644 index 000000000..b6bc368fd --- /dev/null +++ b/docs/stable/Enum.Iterator.Function.html @@ -0,0 +1,79 @@ + + + + Enum.Iterator.Function + + + + + + + + + + + + +
        +

        + Enum.Iterator.Function + + impl + +

        + + + + Source + + + + + + +

        Functions summary

        + + + + + + +
        +

        Functions

        +
        +

        + count(function) +

        +
        + Source +
        +

        + iterator(function) +

        +
        + Source +
        +
        + + + +
        + + diff --git a/docs/stable/Enum.Iterator.HashDict.html b/docs/stable/Enum.Iterator.HashDict.html new file mode 100644 index 000000000..e0edca8b3 --- /dev/null +++ b/docs/stable/Enum.Iterator.HashDict.html @@ -0,0 +1,79 @@ + + + + Enum.Iterator.HashDict + + + + + + + + + + + + +
        +

        + Enum.Iterator.HashDict + + impl + +

        + + + + Source + + + + + + +

        Functions summary

        + + + + + + +
        +

        Functions

        +
        +

        + count(arg1) +

        +
        + Source +
        +

        + iterator(arg1) +

        +
        + Source +
        +
        + + + +
        + + diff --git a/docs/stable/Enum.Iterator.List.html b/docs/stable/Enum.Iterator.List.html new file mode 100644 index 000000000..0cf75b7b6 --- /dev/null +++ b/docs/stable/Enum.Iterator.List.html @@ -0,0 +1,79 @@ + + + + Enum.Iterator.List + + + + + + + + + + + + +
        +

        + Enum.Iterator.List + + impl + +

        + + + + Source + + + + + + +

        Functions summary

        + + + + + + +
        +

        Functions

        +
        +

        + count(list) +

        +
        + Source +
        +

        + iterator(list) +

        +
        + Source +
        +
        + + + +
        + + diff --git a/docs/stable/Enum.Iterator.Orddict.html b/docs/stable/Enum.Iterator.Orddict.html new file mode 100644 index 000000000..ab52a0d1a --- /dev/null +++ b/docs/stable/Enum.Iterator.Orddict.html @@ -0,0 +1,79 @@ + + + + Enum.Iterator.Orddict + + + + + + + + + + + + +
        +

        + Enum.Iterator.Orddict + + impl + +

        + + + + Source + + + + + + +

        Functions summary

        + + + + + + +
        +

        Functions

        +
        +

        + count(arg1) +

        +
        + Source +
        +

        + iterator(arg1) +

        +
        + Source +
        +
        + + + +
        + + diff --git a/docs/stable/Enum.Iterator.Range.html b/docs/stable/Enum.Iterator.Range.html new file mode 100644 index 000000000..8b757bfe7 --- /dev/null +++ b/docs/stable/Enum.Iterator.Range.html @@ -0,0 +1,79 @@ + + + + Enum.Iterator.Range + + + + + + + + + + + + +
        +

        + Enum.Iterator.Range + + impl + +

        + + + + Source + + + + + + +

        Functions summary

        + + + + + + +
        +

        Functions

        +
        +

        + count(range) +

        +
        + Source +
        +

        + iterator(range) +

        +
        + Source +
        +
        + + + +
        + + diff --git a/docs/latest/Enum.Iterator.html b/docs/stable/Enum.Iterator.html similarity index 70% rename from docs/latest/Enum.Iterator.html rename to docs/stable/Enum.Iterator.html index 1ccfd189c..c076be032 100644 --- a/docs/latest/Enum.Iterator.html +++ b/docs/stable/Enum.Iterator.html @@ -38,14 +38,14 @@

        Enum.map [1,2,3], &1 * 2
         
        -

        Is invoked, it invokes Enum.Iterator.iterator([1,2,3]) +

        Is invoked, it invokes Enum.Iterator.iterator([1,2,3]) which returns all the information required by Enum. Read each function documentation below for more information.

        - Source + Source

        Implementations

        @@ -53,7 +53,13 @@

        Implementations

      • - HashDict.Record + Function + +
      • + +
      • + + HashDict
      • @@ -65,7 +71,13 @@

        Implementations

      • - Orddict.Record + Orddict + +
      • + +
      • + + Range
      • @@ -78,6 +90,11 @@

        Implementations

        Functions summary

        • + + count/1 + +
        • +
        • iterator/1 @@ -92,8 +109,15 @@

          Functions summary

          Functions

          +

          + count(xA) +

          +

          The function used to retrieve the collection size.

          +
          + Source +

          - iterator/1 + iterator(xA)

          Iteration in Elixir happens with the help of a iterator function. Every time this function is called, it must @@ -116,8 +140,15 @@

          Functions

          defp iterate([h|t]), do: { h, t } defp iterate([]), do: :stop + +

          Iterating lists

          + +

          If a data structure needs to be converted to a list in order +to be iterated, the iterator function can simply return the +list and the Enum module will be able to take over the list +and retrieve the proper iterator function.

          - Source + Source
          diff --git a/docs/stable/Enum.OrdIterator.Function.html b/docs/stable/Enum.OrdIterator.Function.html new file mode 100644 index 000000000..583820a96 --- /dev/null +++ b/docs/stable/Enum.OrdIterator.Function.html @@ -0,0 +1,79 @@ + + + + Enum.OrdIterator.Function + + + + + + + + + + + + +
          +

          + Enum.OrdIterator.Function + + impl + +

          + + + + Source + + + + + + +

          Functions summary

          + + + + + + +
          +

          Functions

          +
          +

          + iterator(function) +

          +
          + Source +
          +

          + to_list(arg1, function) +

          +
          + Source +
          +
          + + + +
          + + diff --git a/docs/latest/Enum.OrdIterator.List.html b/docs/stable/Enum.OrdIterator.List.html similarity index 84% rename from docs/latest/Enum.OrdIterator.List.html rename to docs/stable/Enum.OrdIterator.List.html index a77fe873f..6370c349d 100644 --- a/docs/latest/Enum.OrdIterator.List.html +++ b/docs/stable/Enum.OrdIterator.List.html @@ -29,7 +29,7 @@

          - Source + Source @@ -59,16 +59,16 @@

          Functions summary

          Functions

          - iterator/1 + iterator(list)

          - Source + Source

          - to_list/2 + to_list(arg1, _)

          - Source + Source
          diff --git a/docs/stable/Enum.OrdIterator.Orddict.html b/docs/stable/Enum.OrdIterator.Orddict.html new file mode 100644 index 000000000..a186f26bc --- /dev/null +++ b/docs/stable/Enum.OrdIterator.Orddict.html @@ -0,0 +1,79 @@ + + + + Enum.OrdIterator.Orddict + + + + + + + + + + + + +
          +

          + Enum.OrdIterator.Orddict + + impl + +

          + + + + Source + + + + + + +

          Functions summary

          + + + + + + +
          +

          Functions

          +
          +

          + iterator(arg1) +

          +
          + Source +
          +

          + to_list(arg1, _) +

          +
          + Source +
          +
          + + + +
          + + diff --git a/docs/latest/Enum.OrdIterator.Orddict.Record.html b/docs/stable/Enum.OrdIterator.Range.html similarity index 80% rename from docs/latest/Enum.OrdIterator.Orddict.Record.html rename to docs/stable/Enum.OrdIterator.Range.html index c7ae76601..c59ad03e1 100644 --- a/docs/latest/Enum.OrdIterator.Orddict.Record.html +++ b/docs/stable/Enum.OrdIterator.Range.html @@ -1,7 +1,7 @@ - Enum.OrdIterator.Orddict.Record + Enum.OrdIterator.Range @@ -21,7 +21,7 @@

          - Enum.OrdIterator.Orddict.Record + Enum.OrdIterator.Range impl @@ -29,7 +29,7 @@

          - Source + Source @@ -59,16 +59,16 @@

          Functions summary

          Functions

          - iterator/1 + iterator(range)

          - Source + Source

          - to_list/2 + to_list(arg1, iterator)

          - Source + Source
          diff --git a/docs/latest/Enum.OrdIterator.html b/docs/stable/Enum.OrdIterator.html similarity index 80% rename from docs/latest/Enum.OrdIterator.html rename to docs/stable/Enum.OrdIterator.html index 227a0832a..e6b0e98e2 100644 --- a/docs/latest/Enum.OrdIterator.html +++ b/docs/stable/Enum.OrdIterator.html @@ -42,12 +42,18 @@

          - Source + Source

          Implementations

            +
          • + + Function + +
          • +
          • List @@ -56,7 +62,13 @@

            Implementations

          • - Orddict.Record + Orddict + +
          • + +
          • + + Range
          • @@ -89,19 +101,19 @@

            Functions summary

            Functions

            - iterator/1 + iterator(xA)

            Must return a tuple under the same conditions as Enum.Iterator.iterator.

            - Source + Source

            - to_list/2 + to_list(xA, xB)

            On each step, the iterator function returned by iterator/1 returns a tuple with two elements. This function receives -those two elements and must return a list back.

            +those two elements as a tuple and must return a list back.

            This is used in order to quicky return a list from any point during iteration. For example, consider the function Enum.drop. @@ -110,7 +122,7 @@

            Functions

            back, this function is invoked allowing us to get a result back without a need to loop the remaining items.

            - Source + Source
            diff --git a/docs/stable/Enum.OutOfBoundsError.html b/docs/stable/Enum.OutOfBoundsError.html new file mode 100644 index 000000000..be05279cb --- /dev/null +++ b/docs/stable/Enum.OutOfBoundsError.html @@ -0,0 +1,156 @@ + + + + Enum.OutOfBoundsError + + + + + + + + + + + + +
            +

            + Enum.OutOfBoundsError + + exception + +

            + + + + Source + + + + +

            Fields (and defaults)

            +
              + +
            • + + message: "out of bounds error" + +
            • + +
            + + + +

            Functions summary

            + + + + + + +
            +

            Functions

            +
            +

            + exception(args) +

            +
            + Source +
            +

            + exception(args, self) +

            +
            + Source +
            +

            + message(record) +

            +
            + Source +
            +

            + message(value, record) +

            +
            + Source +
            +

            + new() +

            +
            + Source +
            +

            + new(opts) +

            +
            + Source +
            +

            + to_keywords(record) +

            +
            + Source +
            +

            + update_message(function, record) +

            +
            + Source +
            +
            + + + +
            + + diff --git a/docs/latest/Enum.html b/docs/stable/Enum.html similarity index 73% rename from docs/latest/Enum.html rename to docs/stable/Enum.html index f550aecf9..2a76fb9d3 100644 --- a/docs/latest/Enum.html +++ b/docs/stable/Enum.html @@ -30,7 +30,7 @@

            Provides a set of algorithms that enumerate over collections according to the Enum.Iterator protocol. Most of the functions in this module have two flavours. If a given collection implements the mentioned protocol (like -list, for instance), you can do

            +list, for instance), you can do:

            Enum.map [1,2,3], fn(x) -> x * 2 end
             
            @@ -42,7 +42,7 @@

            - Source + Source @@ -61,6 +61,11 @@

            Functions summary

            any?/2 +
          • + + count/1 + +
          • drop/2 @@ -96,11 +101,21 @@

            Functions summary

            find/3
          • +
          • + + find_index/2 + +
          • find_value/3
          • +
          • + + first/1 + +
          • join/2 @@ -121,6 +136,11 @@

            Functions summary

            map_reduce/3
          • +
          • + + nth!/2 + +
          • partition/2 @@ -177,7 +197,9 @@

            Functions summary

            Functions

            - all?/2 + all?(collection, fun // fn x -> + x +end)

            Invokes the given fun for each item in the collection and returns true if each invocation returns true as well, otherwise it shirt-circuits and returns @@ -199,10 +221,12 @@

            Examples

            Enum.all? [1,nil,3] #=> false
            - Source + Source

            - any?/2 + any?(collection, fun // fn x -> + x +end)

            Invokes the given fun for each item in the collection and returns true if at least one invocation returns true. Returns false otherwise.

            @@ -223,10 +247,22 @@

            Examples

            Enum.any? [false,true,false] #=> true
            - Source + Source +
            +

            + count(collection) +

            +

            Returns the collection size.

            + +

            Examples

            + +
            Enum.count [1,2,3] #=> 3
            +
            +
            + Source

            - drop/2 + drop(collection, count)

            Drops the first count items from the collection. Expects an ordered collection.

            @@ -238,10 +274,10 @@

            Examples

            Enum.drop [1,2,3], 0 #=> [1,2,3]
            - Source + Source

            - drop_while/2 + drop_while(collection, fun)

            Drops items at the beginning of collection while fun returns true. Expects an ordered collection.

            @@ -252,10 +288,10 @@

            Examples

            #=> [3,4,5]
            - Source + Source

            - each/2 + each(collection, fun)

            Invokes the given fun for each item in the collection. Returns the collection itself.

            @@ -265,10 +301,10 @@

            Examples

            Enum.each ['some', 'example'], fn(x) -> IO.puts x end
             
            - Source + Source

            - empty?/1 + empty?(collection)

            Returns true if the collection is empty, otherwise false.

            @@ -278,10 +314,10 @@

            Examples

            Enum.empty? [1,2,3] #=> false
            - Source + Source

            - filter/2 + filter(collection, fun)

            Filters the collection, i.e. returns only those elements for which fun returns true.

            @@ -292,10 +328,10 @@

            Examples

            #=> [2]
            - Source + Source

            - filter_map/3 + filter_map(collection, filter, mapper)

            Filters the collection and maps its values in one pass.

            @@ -305,10 +341,10 @@

            Examples

            #=> [4]
            - Source + Source

            - find/3 + find(collection, ifnone // nil, fun)

            Returns the first item for which fun returns a truthy value. If no such item is found, returns ifnone.

            @@ -325,10 +361,29 @@

            Examples

            #=> 3
            - Source + Source +
            +

            + find_index(collection, fun) +

            +

            Similar to find, but returns the index (count starts with 1) +of the item instead of the element itself.

            + +

            Expects an ordered collection.

            + +

            ## Examples

            + +
              Enum.find_index [2,4,6], fn(x) -> rem(x, 2) == 1 end
            +  #=> nil
            +
            +  Enum.find_index [2,3,4], fn(x) -> rem(x, 2) == 1 end
            +  #=> 2
            +
            +
            + Source

            - find_value/3 + find_value(collection, ifnone // nil, fun)

            Similar to find, but returns the value of the function invocation instead of the element itself.

            @@ -338,17 +393,27 @@

            Examples

              Enum.find_value [2,4,6], fn(x) -> rem(x, 2) == 1 end
               #=> nil
             
            -  Enum.find_value [2,4,6], 0, fn(x) -> rem(x, 2) == 1 end
            -  #=> 0
            -
               Enum.find_value [2,3,4], fn(x) -> rem(x, 2) == 1 end
               #=> true
             
            - Source + Source +
            +

            + first(collection) +

            +

            Returns the first item in the collection or nil otherwise.

            + +

            Examples

            + +
            Enum.first []      #=> nil
            +Enum.first [1,2,3] #=> 1
            +
            +
            + Source

            - join/2 + join(collection, joiner // "")

            Joins the given collection according to joiner. Joiner can be either a binary or a list and the @@ -366,10 +431,10 @@

            Examples

            Enum.join([1,2,3], ' = ') #=> '1 = 2 = 3'
            - Source + Source

            - map/2 + map(collection, fun)

            Returns a new collection, where each item is the result of invoking fun on each corresponding item of collection. @@ -384,10 +449,10 @@

            Examples

            #=> [a: -1, b: -2]
            - Source + Source

            - map_join/3 + map_join(collection, joiner // "", mapper)

            Maps and joins the given collection in one pass. Joiner can be either a binary or a list and the @@ -405,10 +470,10 @@

            Examples

            Enum.map_join([1,2,3], &1 * 2, ' = ') #=> '2 = 4 = 6'
            - Source + Source

            - map_reduce/3 + map_reduce(collection, acc, f)

            Invokes the given fun for each item in the collection while also keeping an accumulator. Returns a tuple where @@ -424,10 +489,27 @@

            Examples

            #=> { [2, 4, 6], 6 }
            - Source + Source +
            +

            + nth!(collection, n) +

            +

            Finds the element at the nth index. Returns nil in case +the given index is outside the range of the collection.

            + +

            Expects an ordered collection.

            + +

            ## Examples

            + +
              Enum.nth! [2,4,6], 1 #=> 2
            +  Enum.nth! [2,4,6], 3 #=> 6
            +  Enum.nth! [2,4,6], 5 #=> raises Enum.OutOfBoundsError
            +
            +
            + Source

            - partition/2 + partition(collection, fun)

            Partitions collection into two where the first one contains elements for which fun returns a truthy value, and the second one -- for which fun @@ -439,10 +521,10 @@

            Examples

            #=> { [2], [1,3] }
            - Source + Source

            - qsort/1 + qsort(collection)

            Sorts the collection according to the quick sort algorithm.

            @@ -451,10 +533,10 @@

            Examples

            Enum.qsort [3,2,1] #=> [1,2,3]
             
            - Source + Source

            - reduce/3 + reduce(collection, acc, fun)

            Invokes fun for each element in the collection passing the accumulator acc and the element as arguments. The return value is stored in acc. @@ -466,10 +548,10 @@

            Examples

            #=> 6
            - Source + Source

            - split/2 + split(collection, count)

            Splits the enumerable into two collections, leaving count elements in the first one. Expects an ordered collection.

            @@ -481,10 +563,10 @@

            Examples

            Enum.split [1,2,3], 0 #=> { [], [1,2,3] }
            - Source + Source

            - split_with/2 + split_with(collection, fun)

            Splits collection at the first element, for which fun returns true. Expects an ordered collection.

            @@ -495,10 +577,10 @@

            Examples

            #=> { [1], [2, 3, 4] }
            - Source + Source

            - take/2 + take(collection, count)

            Takes the first count items from the collection. Expects an ordered collection.

            @@ -510,10 +592,10 @@

            Examples

            Enum.take [1,2,3], 0 #=> []
            - Source + Source

            - take_while/2 + take_while(collection, fun)

            Takes the items at the beginning of collection while fun returns true. Expects an ordered collection.

            @@ -524,26 +606,26 @@

            Examples

            #=> [1, 2]
            - Source + Source

            - times/2 + times(times, function)

            Iterates the given function n times, passing values from 1 to n.

            Examples

            -
            Enum.times 3, fn(x) -> IO.puts x end
            +
            Enum.times 3, fn(x) -> IO.inspect x end
             1
             2
             3
             
            - Source + Source

            - times/3 + times(times, acc, function)

            Iterates the given function n times, passing values from 1 to n. Also has an accumulator similar to reduce to store the @@ -555,7 +637,7 @@

            Examples

            #=> 15
            - Source + Source
            diff --git a/docs/latest/ErlangError.html b/docs/stable/ErlangError.html similarity index 71% rename from docs/latest/ErlangError.html rename to docs/stable/ErlangError.html index 9ad711f5a..6420f55d1 100644 --- a/docs/latest/ErlangError.html +++ b/docs/stable/ErlangError.html @@ -29,7 +29,7 @@

            - Source + Source @@ -84,6 +84,11 @@

            Functions summary

            original/2
          • +
          • + + to_keywords/1 + +
          • update_original/2 @@ -100,52 +105,58 @@

            Functions summary

            Functions

            - exception/1 + exception(args)

            - Source + Source

            - exception/2 + exception(args, self)

            - Source + Source

            - message/1 + message(exception)

            - Source + Source

            - new/0 + new()

            - Source + Source

            - new/1 + new(opts)

            - Source + Source

            - original/1 + original(record)

            - Source + Source

            - original/2 + original(value, record) +

            +
            + Source +
            +

            + to_keywords(record)

            - Source + Source

            - update_original/2 + update_original(function, record)

            - Source + Source
            diff --git a/docs/latest/ExUnit.AssertionError.html b/docs/stable/ExUnit.AssertionError.html similarity index 70% rename from docs/latest/ExUnit.AssertionError.html rename to docs/stable/ExUnit.AssertionError.html index 62aca2f8b..da50116b6 100644 --- a/docs/latest/ExUnit.AssertionError.html +++ b/docs/stable/ExUnit.AssertionError.html @@ -29,7 +29,7 @@

            - Source + Source @@ -79,6 +79,11 @@

            Functions summary

            new/1
          • +
          • + + to_keywords/1 + +
          • update_message/2 @@ -95,46 +100,52 @@

            Functions summary

            Functions

            - exception/1 + exception(args)

            - Source + Source

            - exception/2 + exception(args, self)

            - Source + Source

            - message/1 + message(record)

            - Source + Source

            - message/2 + message(value, record)

            - Source + Source

            - new/0 + new()

            - Source + Source

            - new/1 + new(opts) +

            +
            + Source +
            +

            + to_keywords(record)

            - Source + Source

            - update_message/2 + update_message(function, record)

            - Source + Source
            diff --git a/docs/latest/ExUnit.Assertions.html b/docs/stable/ExUnit.Assertions.html similarity index 51% rename from docs/latest/ExUnit.Assertions.html rename to docs/stable/ExUnit.Assertions.html index 12a635699..b4caf637c 100644 --- a/docs/latest/ExUnit.Assertions.html +++ b/docs/stable/ExUnit.Assertions.html @@ -40,15 +40,13 @@

            This module also provides other small convenient functions -like assert_match, assert_member and assert_raise to -easily handle other common cases as, respectively, asserting -if two terms match, asserting if an item belongs to a list or -if a function raises an exception.

            +like assert_in_delta and assert_raise to easily handle other +common cases as checking a float number or handling exceptions.

            - Source + Source @@ -62,36 +60,11 @@

            Functions summary

            assert/2
          • -
          • - - assert_empty/2 - -
          • -
          • - - assert_error/2 - -
          • -
          • - - assert_exit/2 - -
          • assert_in_delta/4
          • -
          • - - assert_member/3 - -
          • -
          • - - assert_nil/2 - -
          • assert_raise/2 @@ -104,59 +77,59 @@

            Functions summary

          • - assert_throw/2 + flunk/1
          • - flunk/1 + refute/2
          • - refute/2 + refute_in_delta/4
          • -
          • + +
          + + + +

          Macros summary

          + - - - -

          Macros summary

          -
            -
          • +
          • - assert/1 + catch_throw/1
          • - assert_match/2 + refute/1
          • - refute_match/2 + refute_received/2
          • @@ -168,61 +141,20 @@

            Macros summary

            Functions

            - assert/2 + assert(expected, message)

            Asserts the expected value is true. -If it fails, raises the given message.

            +If it fails, raises the given message.

            Examples

            assert false, "it will never be true"
             
            - Source -
            -

            - assert_empty/2 -

            -

            Asserts the enum collection is empty.

            - -

            Examples

            - -
            assert_empty []
            -assert_empty [1, 2]
            -
            -
            - Source -
            -

            - assert_error/2 -

            -

            Asserts the error expected during function execution.

            - -

            Examples

            - -
            assert_error :function_clause, fn ->
            -  List.flatten(1)
            -end
            -
            -
            - Source -
            -

            - assert_exit/2 -

            -

            Asserts the exit expected during function execution.

            - -

            Examples

            - -
            assert_exit 1, fn ->
            -  exit 1
            -end
            -
            -
            - Source + Source

            - assert_in_delta/4 + assert_in_delta(expected, received, delta, message // nil)

            Asserts the expected and received are within delta.

            @@ -232,32 +164,13 @@

            Examples

            assert_in_delta 10, 15, 4
            - Source -
            -

            - assert_member/3 -

            -

            Asserts the value is a member of the given enumerable. -Used to check if an item belongs to a list.

            - -

            Examples

            - -
            assert_member "foo", ["foo", "bar"]
            -
            -
            - Source -
            -

            - assert_nil/2 -

            -

            Asserts the value is nil.

            -
            - Source + Source

            - assert_raise/2 + assert_raise(exception, function)

            -

            Asserts the exception is raised during function execution.

            +

            Asserts the exception is raised during function execution. +Returns the rescued exception, fails otherwise.

            Examples

            @@ -266,12 +179,13 @@

            Examples

            end
            - Source + Source

            - assert_raise/3 + assert_raise(exception, expected_message, function)

            -

            Asserts the exception is raised during function execution with the expected message.

            +

            Asserts the exception is raised during function execution with +the expected_message. Returns the rescued exception, fails otherwise.

            Examples

            @@ -280,24 +194,10 @@

            Examples

            end
            - Source -
            -

            - assert_throw/2 -

            -

            Asserts the throw expected during function execution.

            - -

            Examples

            - -
            assert_throw 1, fn ->
            -  throw 1
            -end
            -
            -
            - Source + Source

            - flunk/1 + flunk(message // "Epic Fail!")

            Fails with a message.

            @@ -306,35 +206,23 @@

            Examples

            flunk "This should raise an error"
             
            - Source + Source

            - refute/2 + refute(not_expected, message)

            -

            Asserts the not_expected value is false.

            +

            Asserts the not_expected value is nil or false. +In case it is a truthy value, raises the given message.

            Examples

            -
            refute false
            +
            refute true, "This will obviously fail"
             
            - Source -
            -

            - refute_empty/2 -

            -

            Asserts the enum collection is not empty.

            - -

            Examples

            - -
            refute_empty []
            -refute_empty [1, 2]
            -
            -
            - Source + Source

            - refute_in_delta/4 + refute_in_delta(expected, received, delta, message // nil)

            Asserts the expected and received are not within delta.

            @@ -344,27 +232,7 @@

            Examples

            refute_in_delta 10, 11, 2
            - Source -
            -

            - refute_member/3 -

            -

            Asserts the value is not a member of the given enumerable. -Used to check if an item belongs to a list.

            - -

            Examples

            - -
            refute_member "baz", ["foo", "bar"]
            -
            -
            - Source -
            -

            - refute_nil/2 -

            -

            Asserts the value is not nil.

            -
            - Source + Source
            @@ -374,7 +242,7 @@

            Examples

            Macros

            - assert/1 + assert(expected)

            Asserts the expected value is true.

            @@ -390,33 +258,99 @@

            Examples

            assert true
             
            - Source + Source
            -

            - assert_match/2 +

            + assert_received(expected, message // nil)

            -

            Asserts the expected value matches received. This relies -on Elixir's pattern match instead of simply comparing terms.

            +

            Asserts a message was received and is in the current process mailbox. +The given expected content must to be a match pattern.

            + +

            Timeout is set to 0, so there is no waiting time.

            + +

            Examples

            + +
            self <- :hello
            +assert_received :hello
            +
            + +

            You can also match against specific patterns:

            + +
            self <- { :hello, "world" }
            +assert_received { :hello, _ }
            +
            +
            + Source +
            +

            + catch_error(expression) +

            +

            Asserts the given expression will cause an error. +Returns the error or fails otherwise.

            + +

            Examples

            + +
            assert catch_error(error 1) == 1
            +
            +
            + Source +
            +

            + catch_exit(expression) +

            +

            Asserts the given expression will exit. +Returns the exit status/message or fails otherwise.

            Examples

            -
            assert_match { 1, _, 3 }, { 1, 2, 3 }
            +
            assert catch_exit(exit 1) == 1
             
            - Source + Source
            -

            - refute_match/2 +

            + catch_throw(expression)

            -

            Assets the expected value does not match received. This uses -Elixir's pattern matching instead of simply comparing terms.

            +

            Asserts the given expression will throw a value. +Returns the thrown value or fails otherwise.

            + +

            Examples

            + +
            assert catch_throw(throw 1) == 1
            +
            +
            + Source +
            +

            + refute(expected) +

            +

            Refutes the expected value is true.

            + +

            refute in general tries to be smart and provide a good +reporting whenever there is a failure.

            + +

            Examples

            + +
            refute false
            +
            +
            + Source +
            +

            + refute_received(not_expected, message // nil) +

            +

            Asserts a message was not received (i.e. it is not in the current process mailbox). +The not_expected contents must be a match pattern.

            + +

            Timeout is set to 0, so there is no waiting time.

            Examples

            -
            refute_match { 1, _, 3 }, { 1, 2, 3 }
            +
            self <- :hello
            +refute_received :bye
             
            - Source + Source
            diff --git a/docs/latest/ExUnit.Case.html b/docs/stable/ExUnit.Case.html similarity index 74% rename from docs/latest/ExUnit.Case.html rename to docs/stable/ExUnit.Case.html index ac2080932..ea0ddf86a 100644 --- a/docs/latest/ExUnit.Case.html +++ b/docs/stable/ExUnit.Case.html @@ -33,22 +33,23 @@

            When used, it allows the following options:

              -
            • :sync - by default, ExUnit run test cases in parallel -to each other. If this test case needs to run in sync, -set sync to true.
            • +
            • :async - configure Elixir to run that specific test case + in parallel with others. Must be used for performance + when your test cases do not change any global state;

            Callbacks

            -

            This module defines two callbacks. setup_all and teardown_all -which are executed before and after all tests respectively. -Those callbacks needs to return :ok, otherwise we assume -tests should not be run.

            +

            This module defines four callbacks. setup_all() and +teardown_all() which are executed before and after +all tests respectively and setup(test) and teardown(test) +which are executed before and after each test, receiving +the test name as argument.

            Examples

            defmodule AssertionTest do
            -  use ExUnit.Case
            +  use ExUnit.Case, async: true
             
               def test_always_pass
                 assert true
            @@ -59,7 +60,7 @@ 

            Examples

            - Source + Source @@ -86,7 +87,7 @@

            Macros summary

            Macros

            - test/2 + test(message, contents)

            Provides a convenient macro that allows a test to be defined with a string. This macro automatically inserts @@ -102,7 +103,7 @@

            Examples

            end
            - Source + Source
            diff --git a/docs/latest/ExUnit.html b/docs/stable/ExUnit.html similarity index 80% rename from docs/latest/ExUnit.html rename to docs/stable/ExUnit.html index df55f25d1..ffa43d8c2 100644 --- a/docs/latest/ExUnit.html +++ b/docs/stable/ExUnit.html @@ -40,10 +40,16 @@

            Example

            # 2) Next we create a new TestCase and use ExUnit.Case defmodule AssertionTest do - use ExUnit.Case + # 3) Notice we pass async: true, this runs the test case in parallel + use ExUnit.Case, async: true - # 3) A test is a method which name finishes with _test - def test_always_pass + # 4) A test is a method which name finishes with _test + def test_always_pass do + assert true + end + + # 5) It is recommended to use the test macro instead of def + test "the truth" do assert true end end @@ -53,7 +59,7 @@

            Example

            using elixir from command line. Assuming you named your file assertion_test.exs, you can run it as:

            -
            elixir assertion_test.exs
            +
            bin/elixir assertion_test.exs
             

            Assertions

            @@ -63,7 +69,7 @@

            Assertions

            - Source + Source @@ -98,7 +104,7 @@

            Functions summary

            Functions

            - configure/1 + configure(options)

            Configure ExUnit.

            @@ -111,24 +117,24 @@

            Options

          • :max_cases - Maximum number of cases to run in parallel
          - Source + Source

          - run/0 + run()

          API used to run the tests. A developer does not need to call it directly.

          - Source + Source

          - start/1 + start(options // [])

          Start ExUnit. Required to be invoked before loading any file that uses ExUnit.Case. Check configure/1 to see the supported options.

          - Source + Source
          diff --git a/docs/latest/Exception.html b/docs/stable/Exception.html similarity index 82% rename from docs/latest/Exception.html rename to docs/stable/Exception.html index d37a73aeb..c95850d2d 100644 --- a/docs/latest/Exception.html +++ b/docs/stable/Exception.html @@ -33,7 +33,7 @@

          - Source + Source @@ -73,35 +73,35 @@

          Functions summary

          Functions

          - format_file_line/1 + format_file_line(file_line)

          Formats file and line information present in stacktraces. Expect them to be given in a keywords list.

          - Source + Source

          - format_file_line/2 + format_file_line(file, line)

          Formats the given file and line.

          - Source + Source

          - format_module_fun_arity/3 + format_module_fun_arity(module, fun, arity)

          Receives a module, fun and arity and returns a string representing such invocation. Arity may also be a list of arguments. It follows the same syntax as in stacktraces.

          - Source + Source

          - format_stacktrace/1 + format_stacktrace(arg1)

          Formats each line in the stacktrace.

          - Source + Source
          diff --git a/docs/stable/File.CopyError.html b/docs/stable/File.CopyError.html new file mode 100644 index 000000000..c495764e5 --- /dev/null +++ b/docs/stable/File.CopyError.html @@ -0,0 +1,284 @@ + + + + File.CopyError + + + + + + + + + + + + +
          +

          + File.CopyError + + exception + +

          + + + + Source + + + + +

          Fields (and defaults)

          +
            + +
          • + + action: "" + +
          • + +
          • + + destination: nil + +
          • + +
          • + + reason: nil + +
          • + +
          • + + source: nil + +
          • + +
          + + + +

          Functions summary

          + + + + + + +
          +

          Functions

          +
          +

          + action(record) +

          +
          + Source +
          +

          + action(value, record) +

          +
          + Source +
          +

          + destination(record) +

          +
          + Source +
          +

          + destination(value, record) +

          +
          + Source +
          +

          + exception(args) +

          +
          + Source +
          +

          + exception(args, self) +

          +
          + Source +
          +

          + message(exception) +

          +
          + Source +
          +

          + new() +

          +
          + Source +
          +

          + new(opts) +

          +
          + Source +
          +

          + reason(record) +

          +
          + Source +
          +

          + reason(value, record) +

          +
          + Source +
          +

          + source(record) +

          +
          + Source +
          +

          + source(value, record) +

          +
          + Source +
          +

          + to_keywords(record) +

          +
          + Source +
          +

          + update_action(function, record) +

          +
          + Source +
          +

          + update_destination(function, record) +

          +
          + Source +
          +

          + update_reason(function, record) +

          +
          + Source +
          +

          + update_source(function, record) +

          +
          + Source +
          +
          + + + +
          + + diff --git a/docs/latest/File.Error.html b/docs/stable/File.Error.html similarity index 72% rename from docs/latest/File.Error.html rename to docs/stable/File.Error.html index d52901aae..b0cd6526b 100644 --- a/docs/latest/File.Error.html +++ b/docs/stable/File.Error.html @@ -29,7 +29,7 @@

          - Source + Source @@ -116,6 +116,11 @@

          Functions summary

          reason/2
        • +
        • + + to_keywords/1 + +
        • update_action/2 @@ -142,88 +147,94 @@

          Functions summary

          Functions

          - action/1 + action(record)

          - Source + Source

          - action/2 + action(value, record)

          - Source + Source

          - exception/1 + exception(args)

          - Source + Source

          - exception/2 + exception(args, self)

          - Source + Source

          - message/1 + message(exception)

          - Source + Source

          - new/0 + new()

          - Source + Source

          - new/1 + new(opts)

          - Source + Source

          - path/1 + path(record)

          - Source + Source

          - path/2 + path(value, record)

          - Source + Source

          - reason/1 + reason(record)

          - Source + Source

          - reason/2 + reason(value, record) +

          +
          + Source +
          +

          + to_keywords(record)

          - Source + Source

          - update_action/2 + update_action(function, record)

          - Source + Source

          - update_path/2 + update_path(function, record)

          - Source + Source

          - update_reason/2 + update_reason(function, record)

          - Source + Source
          diff --git a/docs/stable/File.IteratorError.html b/docs/stable/File.IteratorError.html new file mode 100644 index 000000000..8e15528c0 --- /dev/null +++ b/docs/stable/File.IteratorError.html @@ -0,0 +1,167 @@ + + + + File.IteratorError + + + + + + + + + + + + +
          +

          + File.IteratorError + + exception + +

          + + + + Source + + + + +

          Fields (and defaults)

          +
            + +
          • + + reason: nil + +
          • + +
          + + + +

          Functions summary

          + + + + + + +
          +

          Functions

          +
          +

          + exception(args) +

          +
          + Source +
          +

          + exception(args, self) +

          +
          + Source +
          +

          + message(exception) +

          +
          + Source +
          +

          + new() +

          +
          + Source +
          +

          + new(opts) +

          +
          + Source +
          +

          + reason(record) +

          +
          + Source +
          +

          + reason(value, record) +

          +
          + Source +
          +

          + to_keywords(record) +

          +
          + Source +
          +

          + update_reason(function, record) +

          +
          + Source +
          +
          + + + +
          + + diff --git a/docs/latest/File.Info.html b/docs/stable/File.Stat.html similarity index 75% rename from docs/latest/File.Info.html rename to docs/stable/File.Stat.html index 2f08aa3ef..4a2162c50 100644 --- a/docs/latest/File.Info.html +++ b/docs/stable/File.Stat.html @@ -1,7 +1,7 @@ - File.Info + File.Stat @@ -21,7 +21,7 @@

          - File.Info + File.Stat record @@ -63,7 +63,7 @@

          - Source + Source @@ -275,6 +275,11 @@

          Functions summary

          size/2
        • +
        • + + to_keywords/1 + +
        • type/1 @@ -371,250 +376,256 @@

          Functions summary

          Functions

          - access/1 + access(record)

          - Source + Source

          - access/2 + access(value, record)

          - Source + Source

          - atime/1 + atime(record)

          - Source + Source

          - atime/2 + atime(value, record)

          - Source + Source

          - ctime/1 + ctime(record)

          - Source + Source

          - ctime/2 + ctime(value, record)

          - Source + Source

          - gid/1 + gid(record)

          - Source + Source

          - gid/2 + gid(value, record)

          - Source + Source

          - inode/1 + inode(record)

          - Source + Source

          - inode/2 + inode(value, record)

          - Source + Source

          - links/1 + links(record)

          - Source + Source

          - links/2 + links(value, record)

          - Source + Source

          - major_device/1 + major_device(record)

          - Source + Source

          - major_device/2 + major_device(value, record)

          - Source + Source

          - minor_device/1 + minor_device(record)

          - Source + Source

          - minor_device/2 + minor_device(value, record)

          - Source + Source

          - mode/1 + mode(record)

          - Source + Source

          - mode/2 + mode(value, record)

          - Source + Source

          - mtime/1 + mtime(record)

          - Source + Source

          - mtime/2 + mtime(value, record)

          - Source + Source

          - new/0 + new()

          - Source + Source

          - new/1 + new(opts)

          - Source + Source

          - size/1 + size(record)

          - Source + Source

          - size/2 + size(value, record) +

          +
          + Source +
          +

          + to_keywords(record)

          - Source + Source

          - type/1 + type(record)

          - Source + Source

          - type/2 + type(value, record)

          - Source + Source

          - uid/1 + uid(record)

          - Source + Source

          - uid/2 + uid(value, record)

          - Source + Source

          - update_access/2 + update_access(function, record)

          - Source + Source

          - update_atime/2 + update_atime(function, record)

          - Source + Source

          - update_ctime/2 + update_ctime(function, record)

          - Source + Source

          - update_gid/2 + update_gid(function, record)

          - Source + Source

          - update_inode/2 + update_inode(function, record)

          - Source + Source

          - update_links/2 + update_links(function, record)

          - Source + Source

          - update_major_device/2 + update_major_device(function, record)

          - Source + Source

          - update_minor_device/2 + update_minor_device(function, record)

          - Source + Source

          - update_mode/2 + update_mode(function, record)

          - Source + Source

          - update_mtime/2 + update_mtime(function, record)

          - Source + Source

          - update_size/2 + update_size(function, record)

          - Source + Source

          - update_type/2 + update_type(function, record)

          - Source + Source

          - update_uid/2 + update_uid(function, record)

          - Source + Source
          diff --git a/docs/stable/File.html b/docs/stable/File.html new file mode 100644 index 000000000..668139fa6 --- /dev/null +++ b/docs/stable/File.html @@ -0,0 +1,1235 @@ + + + + File + + + + + + + + + + + + +
          +

          + File + +

          + + +
          +

          This module contains function to manipulate files, +filenames and the filesystem. Many of the functions +that interact with the filesystem have their naming +based on its UNIX variants. For example, deleting a +file is done with File.rm. Getting its stats with +File.stat. If you want to read or write to a file +in chunks, check the IO module.

          + +

          Most of the functions in this module return :ok +or { :ok, result } in case of success, { :error, reason } +otherwise. Those function are also followed by +a variant that ends with ! which returns the +result (without the { :ok, result } tuple) in +case of success or raises an exception in case it +fails. For example:

          + +
          File.read("hello.txt")
          +#=> { :ok, "World" }
          +
          +File.read("invalid.txt")
          +#=> { :error, :enoent }
          +
          +File.read!("hello.txt")
          +#=> "World"
          +
          +File.read!("invalid.txt")
          +#=> raises File.Error
          +
          + +

          In general, a developer should use the former in case +he wants to react in the fie does not exist. The latter +should be used when the developer expects his software +to fail in case the file cannot be read (i.e. it is +literally an exception).

          + +
          + + + Source + + + + + + +

          Functions summary

          + + + + + + +
          +

          Functions

          +
          +

          + basename(path) +

          +

          Returns the last component of the path or the path +itself if it does not contain any directory separators.

          + +

          If the given path is a char list, returns a char list. +Otherwise returns a binary.

          + +

          Examples

          + +
          File.basename("foo")
          +#=> "foo"
          +
          +File.basename("foo/bar")
          +#=> "bar"
          +
          +File.basename("/")
          +#=> ""
          +
          +
          + Source +
          +

          + basename(path, extension) +

          +

          Returns the last component of path with the extension +stripped. This function should be used to remove a specific +extension which might, or might not, be there.

          + +

          If the given path is a char list, returns a char list. +Otherwise returns a binary.

          + +

          Examples

          + +
          File.basename("~/foo/bar.ex", ".ex")
          +#=> "bar"
          +File.basename("~/foo/bar.exs", ".ex")
          +#=> "bar.exs"
          +File.basename("~/foo/bar.old.ex", ".ex")
          +#=> "bar.old"
          +
          +
          + Source +
          +

          + cd(path) +

          +

          Sets the current working directory. Returns :ok if successful, +{ :error, reason } otherwise.

          +
          + Source +
          +

          + cd!(path) +

          +

          The same as cd/0, but raises an exception if it fails.

          +
          + Source +
          +

          + cd!(path, function) +

          +

          Changes the current directory to the given path, +executes the given function and then revert back +to the previous path regardless if there is an exception.

          + +

          Raises an error if retrieving or changing the current +directory fails.

          +
          + Source +
          +

          + close(io_device) +

          +

          Closes the file referenced by io_device. It mostly returns :ok, except +for some severe errors such as out of memory.

          + +

          Note that if the option :delayed_write was used when opening the file, +close/1 might return an old write error and not even try to close the file. +See open/2.

          +
          + Source +
          +

          + copy(source, destination, bytes_count // :infinity) +

          +

          Copies the contents of source to destination. Both +parameters can be a filename or an io device opened with File.open. +bytes_count specifies the number of bytes to count, the default +being :infinity.

          + +

          If file destination already exists, it is overriden +by the contents in source.

          + +

          Returns { :ok, bytes_copied } if successful, +{ :error, reason } otherwise.

          + +

          Typical error reasons are the same as in open/2, +read/1 and write/2.

          +
          + Source +
          +

          + copy!(source, destination, bytes_count // :infinity) +

          +

          The same as copy/3 but raises an File.CopyError if it fails. +Returns the bytes_copied otherwise.

          +
          + Source +
          +

          + cp(source, destination, callback // fn _, _ -> + true +end) +

          +

          Copies the contents in source to destination. +Similar to the command cp -r in Unix systems, +this function behaves differently depending +if source and destination are a file or a directory.

          + +

          If both are files, it simply copies source to +destination. However, if destination is a directory, +it copies the contents of source to destination/source +recursively.

          + +

          If a file already exists in the destination, +it invokes a callback which should return +true if the existing file should be overriden, +false otherwise. It defaults to return true.

          + +

          It returns :ok in case of success, returns +{ :error, reason } otherwise.

          +
          + Source +
          +

          + cp!(source, destination, callback // fn _, _ -> + true +end) +

          +

          The same as cp/3, but raises File.CopyError if it fails. +Returns the list of copied files otherwise.

          +
          + Source +
          +

          + cp_r(source, destination, callback // fn _, _ -> + true +end) +

          +

          Copies the contents in source to destination. +Similar to the command cp -r in Unix systems, +this function behaves differently depending +if source and destination are a file or a directory.

          + +

          If both are files, it simply copies source to +destination. However, if destination is a directory, +it copies the contents of source to destination/source +recursively.

          + +

          If a file already exists in the destination, +it invokes a callback which should return +true if the existing file should be overriden, +false otherwise. It defaults to return true.

          + +

          If a directory already exists in the destination +where a file is meant to be (or otherwise), this +function will fail.

          + +

          This function may fail while copying files, +in such cases, it will leave the destination +directory in a dirty state, where already +copied files won't be removed.

          + +

          It returns { :ok, files_and_directories } in case of +success with all files and directories copied in no +specific order, { :error, reason } otherwise.

          + +

          Examples

          + +
          # Copies "a.txt" to "tmp/a.txt"
          +File.cp_r "a.txt", "tmp"
          +
          +# Copies all files in "samples" to "tmp/samples"
          +File.cp_r "samples", "tmp"
          +
          +# Copies all files in "samples" to "tmp"
          +File.cp_r "samples/.", "tmp"
          +
          +# Same as before, but asks the user how to proceed in case of conflicts
          +File.cp_r "samples/.", "tmp", fn(source, destination) ->
          +  IO.gets("Overriding #{destination} by #{source}. Type y to confirm.") == "y"
          +end
          +
          +
          + Source +
          +

          + cp_r!(source, destination, callback // fn _, _ -> + true +end) +

          +

          The same as cp_r/3, but raises File.CopyError if it fails. +Returns the list of copied files otherwise.

          +
          + Source +
          +

          + cwd() +

          +

          Gets the current working directory. In rare circumstances, this function can +fail on Unix. It may happen if read permission does not exist for the parent +directories of the current directory. For this reason, returns { :ok, cwd } +in case of success, { :error, reason } otherwise.

          +
          + Source +
          +

          + cwd!() +

          +

          The same as cwd/0, but raises an exception if it fails.

          +
          + Source +
          +

          + dir?(path) +

          +

          Returns true if the path is a directory.

          +
          + Source +
          +

          + dirname(path) +

          +

          Return the directory component of path.

          + +

          If the given path is a char list, returns a char list. +Otherwise returns a binary.

          + +

          Examples

          + +
          File.dirname("/foo/bar.ex")
          +#=> "foo"
          +
          +
          + Source +
          +

          + exists?(path) +

          +

          Returns true if the given argument exists. +It can be regular file, directory, socket, +symbolic link, named pipe or device file.

          + +

          Examples

          + +
          File.exists?("test/")
          +#=> true
          +
          +File.exists?("missing.txt")
          +#=> false
          +
          +File.exists?("/dev/null")
          +#=> true
          +
          +
          + Source +
          +

          + expand_path(path) +

          +

          Expands the path by returning its absolute name and expanding +any . and .. characters.

          + +

          If the given path is a char list, returns a char list. +Otherwise returns a binary.

          + +

          Examples

          + +
          File.expand_path("/foo/bar/../bar") == "/foo/bar"
          +
          +
          + Source +
          +

          + expand_path(path, relative_to) +

          +

          Expands the path to the relative location and expanding +any . and .. characters. If the path is already an +absolute path, the relative location is ignored.

          + +

          If the given path is a char list, returns a char list. +Otherwise returns a binary.

          + +

          Examples

          + +
          File.expand_path("foo/bar/../bar", "/baz") == "/baz/foo/bar"
          +File.expand_path("/foo/bar/../bar", "/baz") == "/foo/bar"
          +
          +
          + Source +
          +

          + extname(path) +

          +

          Return the extension of the last component of path.

          + +

          If the given path is a char list, returns a char list. +Otherwise returns a binary.

          + +

          Examples

          + +
          File.extname("foo.erl")
          +#=> ".erl"
          +File.extname("~/foo/bar")
          +#=> ""
          +
          +
          + Source +
          +

          + iterator(device) +

          +

          Convert the file device into an iterator that can be +passed into Enum. The device is iterated line +by line lazily, at the end of iteration the file is +closed.

          + +

          Examples

          + +

          An example that lazily iterates a file replacing all double +quotes per single quotes and write each line to a target file +is shown below:

          + +
          source = File.iterator("README.md")
          +File.open "NEWREADME.md", [:write], fn(target) ->
          +  Enum.each source, fn(line) ->
          +    IO.write target, Regex.replace_all(%r/"/, line, "'")
          +  end
          +end
          +
          +
          + Source +
          +

          + iterator(file, mode) +

          +

          Opens the given file with the given mode and +returns its iterator. Fails for the same reasons +as File.open.

          +
          + Source +
          +

          + iterator!(file, mode // []) +

          +

          Same as iterator/2 but raises if the file +cannot be opened.

          +
          + Source +
          +

          + join(paths) +

          +

          Returns a string with one or more paths components joint by the path separator. +This function should be used to convert a list of strings in a path.

          + +

          If the given paths are a char list, returns a char list. +Otherwise returns a binary.

          + +

          Examples

          + +
          File.join(["~", "foo"])
          +#=> "~/foo"
          +File.join(["foo"])
          +#=> "foo"
          +File.join(["/", "foo", "bar"])
          +#=> "/foo/bar"
          +
          +
          + Source +
          +

          + join(left, right) +

          +

          Join two paths.

          + +

          If the given paths are a char list, returns a char list. +Otherwise returns a binary.

          + +

          Examples

          + +
          File.join("foo", "bar")
          +#=> "foo/bar"
          +
          +
          + Source +
          +

          + mkdir(path) +

          +

          Tries to create the directory path. Missing parent directories are not created. +Returns :ok if successful, or {:error, reason} if an error occurs.

          + +

          Typical error reasons are:

          + +
            +
          • :eacces - Missing search or write permissions for the parent directories of path.
          • +
          • :eexist - There is already a file or directory named path.
          • +
          • :enoent - A component of path does not exist.
          • +
          • :enospc - There is a no space left on the device.
          • +
          • :enotdir - A component of path is not a directory + On some platforms, :enoent is returned instead.
          • +
          +
          + Source +
          +

          + mkdir!(path) +

          +

          Same as mkdir, but raises an exception in case of failure. Otherwise :ok.

          +
          + Source +
          +

          + mkdir_p(path) +

          +

          Tries to create the directory path. Missing parent directories are created. +Returns :ok if successful, or {:error, reason} if an error occurs.

          + +

          Typical error reasons are:

          + +
            +
          • :eacces - Missing search or write permissions for the parent directories of path.
          • +
          • :enospc - There is a no space left on the device.
          • +
          • :enotdir - A component of path is not a directory.
          • +
          +
          + Source +
          +

          + mkdir_p!(path) +

          +

          Same as mkdir_p, but raises an exception in case of failure. Otherwise :ok.

          +
          + Source +
          +

          + open(path, modes // []) +

          +

          Opens the given path according to the given list of modes.

          + +

          By default, the file is opened in read mode, as a binary with utf8 encoding.

          + +

          The allowed modes:

          + +
            +
          • :read - The file, which must exist, is opened for reading.

          • +
          • :write - The file is opened for writing. It is created if it does not exist. + If the file exists, and if write is not combined with read, the file will be truncated.

          • +
          • :append - The file will be opened for writing, and it will be created if it does not exist. + Every write operation to a file opened with append will take place at the end of the file.

          • +
          • :exclusive - The file, when opened for writing, is created if it does not exist. + If the file exists, open will return { :error, :eexist }.

          • +
          • :charlist - When this term is given, read operations on the file will return char lists rather than binaries;

          • +
          • :compressed - Makes it possible to read or write gzip compressed files. + The compressed option must be combined with either read or write, but not both. + Note that the file size obtained with stat/1 will most probably not + match the number of bytes that can be read from a compressed file.

          • +
          + +

          If a function is given to modes (instead of a list), it dispatches to open/3.

          + +

          Check http://www.erlang.org/doc/man/file.html#open-2 for more information about +other options as read_ahead and delayed_write.

          + +

          This function returns:

          + +
            +
          • { :ok, iodevice } - The file has been opened in the requested mode. + io_device is actually the pid of the process which handles the file. + This process is linked to the process which originally opened the file. + If any process to which the iodevice is linked terminates, the file will + be closed and the process itself will be terminated. An io_device returned + from this call can be used as an argument to the IO module functions.

          • +
          • { :error, reason } - The file could not be opened.

          • +
          + +

          Examples

          + +
          { :ok, file } = File.open("foo.tar.gz", [:read, :compressed])
          +IO.readline(file)
          +File.close(file)
          +
          +
          + Source +
          +

          + open(path, modes, function) +

          +

          Similar to open/2 but expects a function as last argument.

          + +

          The file is opened, given to the function as argument and +automatically closed after the function returns, regardless +if there was an error or not.

          + +

          It returns { :ok, function_result } in case of success, +{ :error, reason } otherwise.

          + +

          Do not use this function with :delayed_write option +since automatically closing the file may fail +(as writes are delayed).

          + +

          Examples

          + +

          File.open!("foo.txt", [:read, :write], fn(file) -> + IO.readline(file) + end)

          +
          + Source +
          +

          + open!(path, modes // []) +

          +

          Same as open/2 but raises an error if file could not be opened. +Returns the io_device otherwise.

          +
          + Source +
          +

          + open!(path, modes, function) +

          +

          Same as open/3 but raises an error if file could not be opened. +Returns the function result otherwise.

          +
          + Source +
          +

          + read(path) +

          +

          Returns {:ok, binary}, where binary is a binary data object that contains the contents +of path, or {:error, reason} if an error occurs.

          + +

          Typical error reasons:

          + +
            +
          • :enoent - The file does not exist.
          • +
          • :eacces - Missing permission for reading the file, + or for searching one of the parent directories.
          • +
          • :eisdir - The named file is a directory.
          • +
          • :enotdir - A component of the file name is not a directory. + On some platforms, :enoent is returned instead.
          • +
          • :enomem - There is not enough memory for the contents of the file.
          • +
          + +

          You can use Erlang.file.format_error(reason) to get a descriptive string of the error.

          +
          + Source +
          +

          + read!(path) +

          +

          Returns binary with the contents of the given filename or raises +File.Error if an error occurs.

          +
          + Source +
          +

          + read_info(path, opts // []) +

          +
          + Source +
          +

          + read_info!(path, opts // []) +

          +
          + Source +
          +

          + regular?(path) +

          +

          Returns true if the path is a regular file.

          + +

          Examples

          + +
          File.regular? __FILE__ #=> true
          +
          +
          + Source +
          +

          + rm(path) +

          +

          Tries to delete the file path. +Returns :ok if successful, or {:error, reason} if an error occurs.

          + +

          Typical error reasons are:

          + +
            +
          • :enoent - The file does not exist.
          • +
          • :eacces - Missing permission for the file or one of its parents.
          • +
          • :eperm - The file is a directory and user is not super-user.
          • +
          • :enotdir - A component of the file name is not a directory. + On some platforms, enoent is returned instead.
          • +
          • :einval - Filename had an improper type, such as tuple.
          • +
          + +

          Examples

          + +
          File.rm('foo.txt')
          +#=> :ok
          +
          +File.rm('tmp_dir/')
          +#=> {:error, :eperm}
          +
          +
          + Source +
          +

          + rm!(path) +

          +

          Same as rm, but raises an exception in case of failure. Otherwise :ok.

          +
          + Source +
          +

          + rm_rf(path) +

          +

          Remove files and directories recursively at the given path. +Symlinks are not followed but simply removed, non existing +files are simply ignored (i.e. doesn't make this function fail).

          + +

          Returns { :ok, files_and_directories } with all files and +directories removed in no specific order, { :error, reason } +otherwise.

          + +

          Examples

          + +
          File.rm_rf "samples"
          +#=> { :ok, ["samples", "samples/1.txt"] }
          +
          +File.rm_rf "unknown"
          +#=> { :ok, [] }
          +
          +
          + Source +
          +

          + rm_rf!(path) +

          +

          Same as rm_rf/1 but raises File.Error in case of failures, +otherwise the list of files or directories removed.

          +
          + Source +
          +

          + rmdir(path) +

          +

          Tries to delete the dir at path. +Returns :ok if successful, or {:error, reason} if an error occurs.

          + +

          Examples

          + +
          File.rddir('tmp_dir')
          +#=> :ok
          +
          +File.rmdir('foo.txt')
          +#=> {:error, :enotdir}
          +
          +
          + Source +
          +

          + rmdir!(path) +

          +

          Same as rmdir/1, but raises an exception in case of failure. Otherwise :ok.

          +
          + Source +
          +

          + rootname(path) +

          +

          Returns the path with the extension stripped.

          + +

          If the given path is a char list, returns a char list. +Otherwise returns a binary.

          + +

          Examples

          + +
          File.rootname("/foo/bar")
          +#=> "/foo/bar"
          +File.rootname("/foo/bar.ex")
          +#=> "/foo/bar"
          +
          +
          + Source +
          +

          + rootname(path, extension) +

          +

          Returns the path with the extension stripped. This function should be used to +remove a specific extension which might, or might not, be there.

          + +

          If the given path is a char list, returns a char list. +Otherwise returns a binary.

          + +

          Examples

          + +
          File.rootname("/foo/bar.erl", ".erl")
          +#=> "/foo/bar"
          +File.rootname("/foo/bar.erl", ".ex")
          +#=> "/foo/bar.erl"
          +
          +
          + Source +
          +

          + split(path) +

          +

          Returns a list with the path splitted by the path separator. +If an empty string is given, then it returns the root path.

          + +

          Examples

          + +
           File.split("")
          + #=> ["/"]
          + File.split("foo")
          + #=> ["foo"]
          + File.split("/foo/bar")
          + #=> ["/", "foo", "bar"]
          +
          +
          + Source +
          +

          + stat(path, opts // []) +

          +

          Returns information about the path. If it exists, it +returns a { :ok, info } tuple, where info is as a +File.Info record. Retuns { :error, reason } with +the same reasons as File.read if a failure occurs.

          + +

          Options

          + +

          The accepted options are:

          + +
            +
          • :time if the time should be local, universal or posix. +Default is local.
          • +
          +
          + Source +
          +

          + stat!(path, opts // []) +

          +

          Same as stat but returns the File.Stat directly and +throws File.Error if an error is returned.

          +
          + Source +
          +

          + touch(path, time // calendar.local_time()) +

          +

          Updates modification time (mtime) and access time (atime) of +the given file. File is created if it doesn’t exist.

          +
          + Source +
          +

          + touch!(path, time // calendar.local_time()) +

          +

          Same as touch/1 but raises an exception if it fails. +Returns :ok otherwise.

          +
          + Source +
          +

          + wildcard(glob) +

          +

          Traverses files and directories according to the given glob expression.

          + +

          The wildcard string looks like an ordinary filename, except that certain +"wildcard characters" are interpreted in a special way. The following +characters are special:

          + +
            +
          • ? - Matches one character.
          • +
          • * - Matches any number of characters up to the end of + the filename, the next dot, or the next slash.
          • +
          • ** - Two adjacent *'s used as a single pattern will + match all files and zero or more directories and subdirectories.
          • +
          • [char1,char2,...] - Matches any of the characters listed. Two characters + separated by a hyphen will match a range of characters.
          • +
          • {item1,item2,...} - Matches one of the alternatives.
          • +
          + +

          Other characters represent themselves. Only filenames that have exactly +the same character in the same position will match. Note that matching +is case-sensitive; i.e. "a" will not match "A".

          + +

          Examples

          + +

          Imagine you have a directory called projects with three Elixir projects +inside of it: elixir, exdoc and dynamo. You can find all .beam files +inside their ebin directories all projects as follows:

          + +
          File.wildcard("projects/*/ebin/**/*.beam")
          +
          + +

          If you want to search for both .beam and .app files, you could do:

          + +
          File.wildcard("projects/*/ebin/**/*.{beam,app}")
          +
          +
          + Source +
          +

          + write(path, content, modes // []) +

          +

          Writes content to the file path. The file is created if it +does not exist. If it exists, the previous contents are overwritten. +Returns :ok if successful, or {:error, reason} if an error occurs.

          + +

          Typical error reasons are:

          + +
            +
          • :enoent - A component of the file name does not exist.
          • +
          • :enotdir - A component of the file name is not a directory. + On some platforms, enoent is returned instead.
          • +
          • :enospc - There is a no space left on the device.
          • +
          • :eacces - Missing permission for writing the file or searching one of the parent directories.
          • +
          • :eisdir - The named file is a directory.
          • +
          +
          + Source +
          +

          + write!(path, content, modes // []) +

          +

          Same as write/3 but raises an exception if it fails, returns :ok otherwise.

          +
          + Source +
          +

          + write_stat(path, stat, opts // []) +

          +

          Writes the given File.Stat back to the filesystem at the given +path. Returns :ok or { :error, reason }.

          +
          + Source +
          +

          + write_stat!(path, stat, opts // []) +

          +

          Same as write_stat/3 but raises an exception if it fails. +Returns :ok otherwise.

          +
          + Source +
          +
          + + + +
          + + diff --git a/docs/latest/FunctionClauseError.html b/docs/stable/FunctionClauseError.html similarity index 71% rename from docs/latest/FunctionClauseError.html rename to docs/stable/FunctionClauseError.html index 65f762a3b..65884f6c5 100644 --- a/docs/latest/FunctionClauseError.html +++ b/docs/stable/FunctionClauseError.html @@ -29,7 +29,7 @@

          - Source + Source @@ -116,6 +116,11 @@

          Functions summary

          new/1
        • +
        • + + to_keywords/1 + +
        • update_arity/2 @@ -142,88 +147,94 @@

          Functions summary

          Functions

          - arity/1 + arity(record)

          - Source + Source

          - arity/2 + arity(value, record)

          - Source + Source

          - exception/1 + exception(args)

          - Source + Source

          - exception/2 + exception(args, self)

          - Source + Source

          - function/1 + function(record)

          - Source + Source

          - function/2 + function(value, record)

          - Source + Source

          - message/1 + message(exception)

          - Source + Source

          - module/1 + module(record)

          - Source + Source

          - module/2 + module(value, record)

          - Source + Source

          - new/0 + new()

          - Source + Source

          - new/1 + new(opts) +

          +
          + Source +
          +

          + to_keywords(record)

          - Source + Source

          - update_arity/2 + update_arity(function, record)

          - Source + Source

          - update_function/2 + update_function(function, record)

          - Source + Source

          - update_module/2 + update_module(function, record)

          - Source + Source
          diff --git a/docs/latest/GenServer.Behavior.html b/docs/stable/GenServer.Behavior.html similarity index 77% rename from docs/latest/GenServer.Behavior.html rename to docs/stable/GenServer.Behavior.html index bc2fc799c..4db52d446 100644 --- a/docs/latest/GenServer.Behavior.html +++ b/docs/stable/GenServer.Behavior.html @@ -27,7 +27,7 @@

          - Source + Source @@ -40,7 +40,7 @@

          Macros summary

          • - __using__/2 + __using__/1
          • @@ -53,8 +53,8 @@

            Macros summary

            Macros

            -

            - __using__/2 +

            + __using__(_)

            By using this module, you get default GenServer callbacks for handle_call, handle_info, handle_cast, terminate @@ -68,10 +68,10 @@

            Macros

            information on genserver, please refer to the Erlang documentation:

            -

            http://www.erlang.org/doc/man/genserver.html -http://www.erlang.org/doc/designprinciples/genserverconcepts.html

            +

            http://www.erlang.org/doc/man/gen_server.html +http://www.erlang.org/doc/design_principles/gen_server_concepts.html

            - Source + Source
            diff --git a/docs/latest/HashDict.html b/docs/stable/HashDict.html similarity index 82% rename from docs/latest/HashDict.html rename to docs/stable/HashDict.html index 14c4d4bd0..4ce626f19 100644 --- a/docs/latest/HashDict.html +++ b/docs/stable/HashDict.html @@ -34,7 +34,7 @@

            - Source + Source @@ -69,38 +69,38 @@

            Functions summary

            Functions

            - new/0 + new()

            Creates a new empty dict.

            - Source + Source

            - new/1 + new(pairs)

            Creates a new dict from a list of pairs.

            Examples

            -
            Dict.Common.new [{:b,1},{:a,2}]
            +
            HashDict.new [{:b,1},{:a,2}]
             #=> [a: 1, b: 2]
             
            - Source + Source

            - new/2 + new(list, transform)

            Creates a new dict from a list of elements with the help of the transformation function.

            Examples

            -
            Dict.Common.new ["a", "b"], fn x -> {x, x} end
            +
            HashDict.new ["a", "b"], fn x -> {x, x} end
             #=> ["a": "a", "b": "b"]
             
            - Source + Source
            diff --git a/docs/stable/IEx.Autocomplete.Entry.IEx.Autocomplete.Fun.html b/docs/stable/IEx.Autocomplete.Entry.IEx.Autocomplete.Fun.html new file mode 100644 index 000000000..fb85bdef1 --- /dev/null +++ b/docs/stable/IEx.Autocomplete.Entry.IEx.Autocomplete.Fun.html @@ -0,0 +1,79 @@ + + + + IEx.Autocomplete.Entry.IEx.Autocomplete.Fun + + + + + + + + + + + + +
            +

            + IEx.Autocomplete.Entry.IEx.Autocomplete.Fun + + impl + +

            + + + + Source + + + + + + +

            Functions summary

            + + + + + + +
            +

            Functions

            +
            +

            + to_entries(fun) +

            +
            + Source +
            +

            + to_hint(arg1, hint) +

            +
            + Source +
            +
            + + + +
            + + diff --git a/docs/stable/IEx.Autocomplete.Entry.IEx.Autocomplete.Mod.html b/docs/stable/IEx.Autocomplete.Entry.IEx.Autocomplete.Mod.html new file mode 100644 index 000000000..53bcba396 --- /dev/null +++ b/docs/stable/IEx.Autocomplete.Entry.IEx.Autocomplete.Mod.html @@ -0,0 +1,79 @@ + + + + IEx.Autocomplete.Entry.IEx.Autocomplete.Mod + + + + + + + + + + + + +
            +

            + IEx.Autocomplete.Entry.IEx.Autocomplete.Mod + + impl + +

            + + + + Source + + + + + + +

            Functions summary

            + + + + + + +
            +

            Functions

            +
            +

            + to_entries(mod) +

            +
            + Source +
            +

            + to_hint(arg1, hint) +

            +
            + Source +
            +
            + + + +
            + + diff --git a/docs/latest/Enum.Iterator.List.html b/docs/stable/IEx.Autocomplete.html similarity index 72% rename from docs/latest/Enum.Iterator.List.html rename to docs/stable/IEx.Autocomplete.html index dd842b6da..28a1ec869 100644 --- a/docs/latest/Enum.Iterator.List.html +++ b/docs/stable/IEx.Autocomplete.html @@ -1,7 +1,7 @@ - Enum.Iterator.List + IEx.Autocomplete @@ -21,15 +21,18 @@

            - Enum.Iterator.List - - impl + IEx.Autocomplete

            +
            +

            Autocompletion for the Elixir shell.

            + +
            + - Source + Source @@ -40,7 +43,7 @@

            Functions summary

            • - iterator/1 + expand/1
            • @@ -53,11 +56,11 @@

              Functions summary

              Functions

              -

              - iterator/1 +

              + expand(expr)

              - Source + Source
              diff --git a/docs/stable/IEx.Helpers.html b/docs/stable/IEx.Helpers.html new file mode 100644 index 000000000..1412891f2 --- /dev/null +++ b/docs/stable/IEx.Helpers.html @@ -0,0 +1,242 @@ + + + + IEx.Helpers + + + + + + + + + + + + +
              +

              + IEx.Helpers + +

              + + +
              +

              A bunch of helpers available in IEx.

              + +
                +
              • c - compiles a file in the given path
              • +
              • d - prints documentation
              • +
              • h - prints history
              • +
              • m - prints loaded modules
              • +
              • r - recompiles and reloads the given module's source file
              • +
              • v - retrieves nth value from console
              • +
              + +

              Documentation for functions in this module can be consulted +directly from the command line, as an example, try:

              + +

              d(:c, 1)

              + +
              + + + Source + + + + + + +

              Functions summary

              + + + + +

              Macros summary

              +
                +
              • + + d/1 + +
              • + +
              + + + +
              +

              Functions

              +
              +

              + c(files, path // ".") +

              +

              Expects a list of files to compile and a path +to write their object code to. It returns the name +of the compiled modules.

              + +

              Examples

              + +
              c ["foo.ex"], "ebin"
              +#=> Foo
              +
              +
              + Source +
              +

              + d() +

              +

              Shows the documentation for IEx.Helpers.

              +
              + Source +
              +

              + d(function, arity) +

              +

              Prints the documentation for the given function and arity.

              + +

              The function may either be a function defined inside IEx.Helpers +or in Kernel. To see functions from other module, use +d/3 instead.

              + +

              Examples

              + +
              d(:d, 2)
              +#=> Prints documentation for this function
              +
              +
              + Source +
              +

              + d(module, function, arity) +

              +

              Shows the documentation for the function/arity in module.

              +
              + Source +
              +

              + h() +

              +

              Prints commands history and their result.

              +
              + Source +
              +

              + m() +

              +

              Returns the name and module of all modules loaded.

              +
              + Source +
              +

              + r() +

              +

              Reloads all modules that were already reloaded +at some point with r/1.

              +
              + Source +
              +

              + r(module) +

              +

              Recompiles and reloads the specified module's source file.

              + +

              Please note that all the modules defined in the specified +files are recompiled and reloaded.

              +
              + Source +
              +

              + v(n) +

              +

              Retrieves nth query's value from the history. Use negative +values to lookup query's value from latest to earliest. +For instance, v(-1) returns the latest result.

              +
              + Source +
              +
              + + + +
              +

              Macros

              +
              +

              + d(other) +

              +

              Shows the documentation for the given module +or for the given function/arity pair.

              + +

              Examples

              + +
              d(Enum)
              +#=> Prints documentation for Enum
              +
              + +

              It also accepts functions in the format fun/arity +and module.fun/arity, for example:

              + +
              d receive/1
              +d Enum.all?/2
              +
              +
              + Source +
              +
              + +
              + + diff --git a/docs/stable/IEx.Remsh.html b/docs/stable/IEx.Remsh.html new file mode 100644 index 000000000..4f5151f20 --- /dev/null +++ b/docs/stable/IEx.Remsh.html @@ -0,0 +1,84 @@ + + + + IEx.Remsh + + + + + + + + + + + + +
              +

              + IEx.Remsh + +

              + + +
              +

              Helper function injected into connecting remote nodes +to properly handle autocompletion. Elixir supports:

              + +
                +
              • remsh from an elixir node to an elixir node
              • +
              • remsh from a plain erlang node to an elixir node (through the ^G menu)
              • +
              • remsh from an elixir node to a plain erlang node (and get an erl shell there)
              • +
              + +

              In order to get an Elixir shell from the ^G menu, +you need to use 'Elixir-IEx' as the shell name.

              + +

              Connecting an Elixir shell to a remote node without +Elixir is not supported.

              + +
              + + + Source + + + + + + +

              Functions summary

              + + + + + + +
              +

              Functions

              +
              +

              + expand(node) +

              +
              + Source +
              +
              + + + +
              + + diff --git a/docs/latest/IO.html b/docs/stable/IEx.UnicodeIO.html similarity index 54% rename from docs/latest/IO.html rename to docs/stable/IEx.UnicodeIO.html index 7a9a30e20..4e93074ed 100644 --- a/docs/latest/IO.html +++ b/docs/stable/IEx.UnicodeIO.html @@ -1,7 +1,7 @@ - IO + IEx.UnicodeIO @@ -21,20 +21,20 @@

              - IO + IEx.UnicodeIO

              -

              Module responsible for doing IO. -It is incomplete now. More functions will be -added in upcoming releases.

              +

              This module implements the API used by IEX to +interact with the console. This API may change +in the future without warnings.

              - Source + Source @@ -45,17 +45,17 @@

              Functions summary

              • - inspect/2 + error/1
              • - print/2 + get/1
              • - puts/2 + put/1
              • @@ -68,43 +68,30 @@

                Functions summary

                Functions

                -

                - inspect/2 +

                + error(result)

                -

                Prints the given argument to the device -but inspects it before.

                +

                Implements the error IO API used by IEx. It prints error +messages.

                - Source + Source
                -

                - print/2 +

                + get(config)

                -

                Prints the given argument to the given device. -By default the device is the standard output. -The argument is converted to binary before -printing.

                - -

                It returns :ok if it succeeds.

                - -

                Examples

                - -
                IO.print :sample
                -#=> "sample"
                -
                -IO.print :standard_error, "error"
                -#=> "error"
                -
                +

                Implements the get IO API used by IEx. It receives the +code cache, the instructions counter and needs to +return a list with the new characters inserted.

                - Source + Source
                -

                - puts/2 +

                + put(result)

                -

                Prints the given argument to the device, -similarly to print but adds a new line -at the end.

                +

                Implements the put IO API used by IEx. It receives the +result and prints it.

                - Source + Source
                diff --git a/docs/stable/IEx.html b/docs/stable/IEx.html new file mode 100644 index 000000000..d104f4fc4 --- /dev/null +++ b/docs/stable/IEx.html @@ -0,0 +1,117 @@ + + + + IEx + + + + + + + + + + + + +
                +

                + IEx + +

                + + +
                +

                This module implements interactive Elixir. It provides a main +function, start which will either delegate to tty or simple. +The former is meant for systems where tty is available and relies +on it in order to work properly. This makes all control commands +available in tty available to the developer.

                + +

                In case tty is not available (for example, Windows), a +developer may invoke simple which starts a stripped +down version.

                + +
                + + + Source + + + + + + +

                Functions summary

                + + + + + + +
                +

                Functions

                +
                +

                + cli() +

                +

                Interface to start IEx from CLI.

                +
                + Source +
                +

                + run(opts // []) +

                +

                Runs IEx checking if tty is available or not. +If so, invoke tty, otherwise go with the simple iex.

                +
                + Source +
                +

                + simple(opts // []) +

                +

                Starts IEx simply using the current stdio.

                +
                + Source +
                +

                + tty(opts // []) +

                +

                Starts IEx using a tty server.

                +
                + Source +
                +
                + + + +
                + + diff --git a/docs/stable/IO.html b/docs/stable/IO.html new file mode 100644 index 000000000..87b1d23d0 --- /dev/null +++ b/docs/stable/IO.html @@ -0,0 +1,221 @@ + + + + IO + + + + + + + + + + + + +
                +

                + IO + +

                + + +
                +

                Module responsible for doing IO. The function in this +module expects an iodata as argument encoded in UTF-8. +An iodata can be:

                + +
                  +
                • A list of integers representing a string. Any unicode +character must be represented with one entry in the list, +this entry being an integer with the codepoint value;
                • +
                • A binary in which unicode characters are represented +with many bytes (Elixir's default representation);
                • +
                • A list of binaries or a list of char lists (as described above);
                • +
                • If none of the above, to_binary is invoked in the +given argument;
                • +
                + +
                + + + Source + + + + + + +

                Functions summary

                + + + + + + +
                +

                Functions

                +
                +

                + getb(device // :stdio, prompt, count // 1) +

                +

                Gets count bytes from the IO device. It returns:

                + +
                  +
                • data - The input characters.

                • +
                • :eof - End of file was encountered.

                • +
                • {:error, reason} - Other (rare) error condition, +for instance {:error, :estale} if reading from an +NFS file system.

                • +
                +
                + Source +
                +

                + gets(device // :stdio, prompt) +

                +

                Reads a line from the IO device. It returns:

                + +
                  +
                • data - The characters in the line terminated +by a LF (or end of file).

                • +
                • :eof - End of file was encountered.

                • +
                • {:error, reason} - Other (rare) error condition, +for instance {:error, :estale} if reading from an +NFS file system.

                • +
                +
                + Source +
                +

                + inspect(device // :stdio, item) +

                +

                Inspects and writes the given argument to the device +followed by a new line. Returns the item given.

                +
                + Source +
                +

                + print(device // :stdio, item) +

                +
                + Source +
                +

                + puts(device // :stdio, item) +

                +

                Writes the argument to the device, similarly to write +but adds a new line at the end. The argument is expected +to be a chardata.

                +
                + Source +
                +

                + read(device // :stdio, count) +

                +

                Reads count bytes from the IO device. It returns:

                + +
                  +
                • data - The input characters.

                • +
                • :eof - End of file was encountered.

                • +
                • {:error, reason} - Other (rare) error condition, +for instance {:error, :estale} if reading from an +NFS file system.

                • +
                +
                + Source +
                +

                + readline(device // :stdio) +

                +

                Read a line from the IO device. It returns:

                + +
                  +
                • data - The input characters.

                • +
                • :eof - End of file was encountered.

                • +
                • {:error, reason} - Other (rare) error condition, +for instance {:error, :estale} if reading from an +NFS file system.

                • +
                + +

                This function does the same as gets/2, +except the prompt is not required as argument.

                +
                + Source +
                +

                + write(device // :stdio, item) +

                +

                Writes the given argument to the given device. +By default the device is the standard output. +The argument is expected to be a chardata (i.e. +a char list or an unicode binary).

                + +

                It returns :ok if it succeeds.

                + +

                Examples

                + +
                IO.write "sample"
                +#=> "sample"
                +
                +IO.write :stderr, "error"
                +#=> "error"
                +
                +
                + Source +
                +
                + + + +
                + + diff --git a/docs/latest/Elixir.ParallelCompiler.html b/docs/stable/Kernel.ParallelCompiler.html similarity index 76% rename from docs/latest/Elixir.ParallelCompiler.html rename to docs/stable/Kernel.ParallelCompiler.html index 53d382b62..ae4645c69 100644 --- a/docs/latest/Elixir.ParallelCompiler.html +++ b/docs/stable/Kernel.ParallelCompiler.html @@ -1,7 +1,7 @@ - Elixir.ParallelCompiler + Kernel.ParallelCompiler @@ -21,7 +21,7 @@

                - Elixir.ParallelCompiler + Kernel.ParallelCompiler

                @@ -32,7 +32,7 @@

                - Source + Source @@ -62,7 +62,7 @@

                Functions summary

                Functions

                - files/2 + files(files, callback // default_callback)

                Compiles the given files.

                @@ -71,19 +71,18 @@

                Functions

                the current file stops being compiled until the dependency is resolved.

                -

                A callback that receives every time a file is compiled -with the module names and binaries defined inside it can -be optionally given as argument.

                +

                A callback that is invoked every time a file is compiled +with its name can be optionally given as argument.

                - Source + Source

                - files_to_path/3 + files_to_path(files, path, callback // default_callback)

                Compiles the given files to the given path. Read files/2 for more information.

                - Source + Source
                diff --git a/docs/latest/Access.Tuple.html b/docs/stable/Kernel.ParallelRequire.html similarity index 63% rename from docs/latest/Access.Tuple.html rename to docs/stable/Kernel.ParallelRequire.html index 62d6e71ab..b3ae3d4d9 100644 --- a/docs/latest/Access.Tuple.html +++ b/docs/stable/Kernel.ParallelRequire.html @@ -1,7 +1,7 @@ - Access.Tuple + Kernel.ParallelRequire @@ -21,15 +21,18 @@

                - Access.Tuple - - impl + Kernel.ParallelRequire

                +
                +

                A module responsible for requiring files in parallel.

                - Source +
                + + + Source @@ -40,7 +43,7 @@

                Functions summary

                • - access/2 + files/2
                • @@ -53,21 +56,15 @@

                  Functions summary

                  Functions

                  -

                  - access/2 +

                  + files(files, callback // default_callback)

                  -

                  Access the tuple via an integer. Negative indexes -performs an inverted lookup, for example, -1 can be -used to retrieve the last item in the tuple. Returns -nil if an out of bounds access occurs.

                  - -

                  Examples

                  +

                  Requires the given files.

                  -
                  tuple = { :a, :b, :c }
                  -tuple[-1] #=> :c
                  -
                  +

                  A callback that is invoked every time a file is required +can be optionally given as argument.

                  - Source + Source
                  diff --git a/docs/latest/Elixir.SpecialForms.html b/docs/stable/Kernel.SpecialForms.html similarity index 57% rename from docs/latest/Elixir.SpecialForms.html rename to docs/stable/Kernel.SpecialForms.html index 5c165b99d..5b0504bcf 100644 --- a/docs/latest/Elixir.SpecialForms.html +++ b/docs/stable/Kernel.SpecialForms.html @@ -1,7 +1,7 @@ - Elixir.SpecialForms + Kernel.SpecialForms @@ -21,7 +21,7 @@

                  - Elixir.SpecialForms + Kernel.SpecialForms

                  @@ -29,12 +29,22 @@

                  In this module we define Elixir special forms. Those are called special forms because they cannot be overridden by the developer -and sometimes have lexical scope (like refer, require, import, etc).

                  +and sometimes have lexical scope (like alias, import, etc).

                  + +

                  This module also documents Elixir's pseudo variables (__MODULE__, +__FILE__, __ENV__ and __CALLER__). Pseudo variables return +information about Elixir's compilation environment and can only +be read, never assigned to.

                  + +

                  Finally, it also documents 3 special forms (__block__, +__scope__ and __aliases__), which are not intended to be +called directly by the developer but they appear in quoted +contents since they are essential in Elixir's constructions.

                  - Source + Source @@ -57,17 +67,12 @@

                  Macros summary

                • - __FILE__/0 - -
                • -
                • - - __FUNCTION__/0 + __ENV__/0
                • - __LINE__/0 + __FILE__/0
                • @@ -77,47 +82,42 @@

                  Macros summary

                • - bc/1 - -
                • -
                • - - fn/1 + __aliases__/1
                • - import/2 + __block__/1
                • - in_guard/1 + __scope__/2
                • - lc/1 + alias/2
                • - loop/1 + bc/1
                • - quote/2 + import/2
                • - recur/1 + lc/1
                • - refer/2 + quote/2
                • @@ -151,7 +151,7 @@

                  Macros summary

                  Macros

                  - <<>>/1 + <<>>(args)

                  Defines a new bitstring.

                  @@ -161,10 +161,10 @@

                  Examples

                  << 1, 2, 3 >>
                  - Source + Source

                  - []/1 + [](args)

                  Defines a new list.

                  @@ -174,106 +174,136 @@

                  Examples

                  [ 1, 2, 3 ]
                  - Source + Source +
                  +

                  + __ENV__() +

                  +

                  Returns the current environment information as a Macro.Env +record. In the environment you can access the current filename, +line numbers, set up aliases, the current function and others.

                  +
                  + Source

                  - __FILE__/0 + __FILE__()

                  -

                  Returns the current file name as a binary.

                  +

                  Returns the current file name as a binary. +Although the file can be accessed in the ENV, this macro +is a convenient shortcut.

                  - Source + Source
                  -

                  - __FUNCTION__/0 +

                  + __MODULE__()

                  -

                  Returns the current function as a tuple, -where the first element is the name as an atom -and the second is the arity as an integer.

                  +

                  Returns the current module name as an atom or nil otherwise. +Although the module can be accessed in the ENV, this macro +is a convenient shortcut.

                  - Source + Source
                  -

                  - __LINE__/0 +

                  + __aliases__(args)

                  -

                  Returns the current line number as an integer.

                  +

                  This is the special form used to hold aliases information. +At compilation time, it is usually compiled to an atom:

                  + +
                  quote do: Foo.Bar
                  +{ :__aliases__, 0, [:Foo,:Bar] }
                  +
                  - Source + Source
                  -

                  - __MODULE__/0 +

                  + __block__(args)

                  -

                  Returns the current module name as an atom or nil otherwise.

                  +

                  This is the special form used whenever we have a block +of expressions in Elixir. This special form is private +and should not be invoked directly:

                  + +
                  quote do: (1; 2; 3)
                  +#=> { :__block__, 0, [1,2,3] }
                  +
                  - Source + Source
                  -

                  - bc/1 +

                  + __scope__(opts, args)

                  -

                  Defines a bit comprehension. It follows the same syntax as -a list comprehension but expects each element returned to -be a bitstring. For example, here is how to remove all -spaces from a string:

                  +

                  This is the special form used whenever we have to temporarily +change the scope information of a block. Used when quote is +invoked with location: :keep to execute a given block as if +it belonged to another file.

                  -
                  bc <<c>> in " hello world " when c != ? , do: <<c>>
                  -"helloworld"
                  +
                  quote location: :keep, do: 1
                  +#=> { :__scope__, 1,[[file: "iex"],[do: 1]] }
                   
                  + +

                  Check quote/1 for more information.

                  - Source + Source
                  -

                  - fn/1 +

                  + alias(module, opts)

                  -

                  Returns an anonymous function based on the given arguments.

                  +

                  alias is used to setup atom aliases, often useful with modules names.

                  Examples

                  -
                  sum = fn(x, y) -> x + y end
                  -sum.(1, 2) #=> 3
                  +

                  alias can be used to setup an alias for any module:

                  + +
                  defmodule Math do
                  +  alias MyKeyword, as: Keyword
                  +end
                   
                  -

                  Notice that a function needs to be invoked using the dot between -the function and the arguments.

                  +

                  In the example above, we have set up MyOrdict to be alias +as Keyword. So now, any reference to Keyword will be +automatically replaced by MyKeyword.

                  -

                  A function could also be defined using the end syntax, although -it is recommend to use it only with the stab operator in order to -avoid ambiguity. For example, consider this case:

                  +

                  In case one wants to access the original Keyword, it can be done +by accessing Elixir:

                  -
                  Enum.map [1,2,3], fn x ->
                  -  x * 2
                  -end
                  +
                  Keyword.values   #=> uses MyKeyword.values
                  +Elixir.Keyword.values #=> uses Keyword.values
                   
                  -

                  The example works fine because -> binds to the closest function call, -which is fn, but if we replace it by do/end, it will fail:

                  +

                  Notice that calling alias without the as: option automatically +sets an alias based on the last part of the module. For example:

                  -
                  Enum.map [1,2,3], fn(x) do
                  -  x * 2
                  -end
                  +
                  alias Foo.Bar.Baz
                   
                  -

                  The reason it fails is because do/end always bind to the farthest -function call.

                  +

                  Is the same as:

                  -

                  Function with multiple clauses

                  +
                  alias Foo.Bar.Baz, as: Baz
                  +
                  -

                  One may define a function which expects different clauses as long -as all clauses expects the same number of arguments:

                  +

                  Lexical scope

                  -
                  fun = fn do
                  -  x, y when y < 0 ->
                  -    x - y
                  -  x, y ->
                  -    x + y
                  -end
                  +

                  import, require and alias are called directives and all +have lexical scope. This means you can set up aliases inside +specific functions and it won't affect the overall scope.

                  +
                  + Source +
                  +

                  + bc(args) +

                  +

                  Defines a bit comprehension. It follows the same syntax as +a list comprehension but expects each element returned to +be a bitstring. For example, here is how to remove all +spaces from a string:

                  -fun.(10, -10) #=> 20 -fun.(10, 10) #=> 20 +
                  bc <<c>> inbits " hello world ", c != ? , do: <<c>>
                  +"helloworld"
                   
                  - Source + Source

                  - import/2 + import(module, opts)

                  import allows one to easily access functions or macros from others modules without using the qualified name.

                  @@ -314,8 +344,8 @@

                  Lexical scope

                  defmodule Math do
                     def some_function do
                  -    # 1) Disable `if/2` from Elixir.Builtin
                  -    import Elixir.Builtin, except: [if: 2]
                  +    # 1) Disable `if/2` from Kernel
                  +    import Kernel, except: [if: 2]
                   
                       # 2) Require the new `if` macro from MyMacros
                       import MyMacros
                  @@ -331,141 +361,64 @@ 

                  Lexical scope

                  specific function. All other functions in that module will still be able to use the original one.

                  -

                  Refer/Require shortcut

                  +

                  Alias/Require shortcut

                  All imported modules are also required by default. import also accepts as: as an option so it automatically sets up -an alias. Please check refer for more information.

                  -
                  - Source -
                  -

                  - in_guard/1 -

                  -

                  Keeps one of the given expressions depending in the context -of evaluation is a guard or not. This is useful when creating -macro that should work both inside and outside guards but -still hold some characteristics.

                  - -

                  Example

                  - -

                  A good example is the is_exception/1 macro defined in Elixir:

                  - -
                   defmacro is_exception(thing) do
                  -   quote do
                  -     quote do
                  -       is_tuple(unquote(thing)) and elem(unquote(thing), 2) == :__exception__
                  -     else
                  -       result = unquote(thing)
                  -       is_tuple(result) and elem(result, 2) == :__exception__
                  -     end
                  -   end
                  - end
                  -
                  - -

                  Notice that if inside a guard, we unquote the same element twice. -This will cause the same element to be evaluted twice, but this is -fine for guards since we cannot assign variables in guards and -we cannot call expressions inside guards. However, when outside -of a guard, evaluating the arguments twice can be harmful and -unexpected, for this reason, we save the result in a variable.

                  - -

                  In the example above, in_guard is allowing us to customize -the same macro to work inside and outside guards.

                  +an alias. Please check alias for more information.

                  - Source + Source

                  - lc/1 + lc(args)

                  List comprehensions allow you to quickly build a list from another list:

                  -
                  lc n in [1,2,3,4], do: n * 2
                  +
                  lc n inlist [1,2,3,4], do: n * 2
                   #=> [2,4,6,8]
                   
                  -

                  A comprehension accepts many generators and also filters. Filters must be given after the when clause:

                  - -
                  # A comprehension with a generator and a filter
                  -lc n in [1,2,3,4,5,6] when rem(n, 2) == 0, do: n
                  -#=> [2,4,6]
                  -
                  -# A comprehension with two generators
                  -lc x in [1,2], y in [2,3], do: x*y
                  -#=> [2,3,4,6]
                  -
                  - -

                  Elixir provides generators for both lists and bitstrings:

                  +

                  A comprehension accepts many generators and also filters. Generators +are defined using both inlist and inbits operators, allowing you +to loop lists and bitstrings:

                  # A list generator:
                  -lc n in [1,2,3,4], do: n * 2
                  +lc n inlist [1,2,3,4], do: n * 2
                   #=> [2,4,6,8]
                   
                   # A bit string generator:
                  -lc <<n>> in <<1,2,3,4>>, do: n * 2
                  +lc <<n>> inbits <<1,2,3,4>>, do: n * 2
                   #=> [2,4,6,8]
                  -
                  -

                  Bit string generators are quite useful when you need to organize bit string streams:

                  +# A generator from a variable: +list = [1,2,3,4] +lc n inlist list, do: n * 2 +#=> [2,4,6,8] -
                  iex> pixels = <<213,45,132,64,76,32,76,0,0,234,32,15>>
                  -iex> lc <<r:8,g:8,b:8>> in pixels, do: {r,g,b}
                  -[{213,45,132},{64,76,32},{76,0,0},{234,32,15}]
                  +# A comprehension with two generators
                  +lc x inlist [1,2], y inlist [2,3], do: x*y
                  +#=> [2,3,4,6]
                   
                  -

                  Elixir does its best to hide the differences between list and bit string generators. -However, there is a special case due to Erlang limitation where we need to explicitly -tell Erlang that a list is being given as argument:

                  - -
                  # This will fail because when Elixir sees that the left side
                  -# of the in expression is a bit string, it expects the right side
                  -# to be a bit string as well:
                  -lc <<n>> in [<<1>>,<<2>>,<<3>>], do: n*2
                  -#=> ** (ErlangError) erlang error {:bad_generator,[<<1>>,<<2>>,<<3>>]}
                  -
                  -# You need to be explicit and use inlist:
                  -lc inlist(<<n>>, [<<1>>,<<2>>,<<3>>]), do: n*2
                  -#=> [2,4,6]
                  +

                  Filters can also be given:

                  -# For consistency, inbin is also available: -lc inbin(<<n>>, <<1,2,3>>), do: n*2 +
                  # A comprehension with a generator and a filter
                  +lc n inlist [1,2,3,4,5,6], rem(n, 2) == 0, do: n
                   #=> [2,4,6]
                   
                  -

                  Notice that although comprehensions uses when to specify filters, filters are not -guards and therefore accept any expression (they are not limited as guards).

                  -
                  - Source -
                  -

                  - loop/1 -

                  -

                  Handle annonymous recursive loops.

                  - -

                  Examples

                  - -
                  list = [1,2,3]
                  +

                  Bit string generators are quite useful when you need to +organize bit string streams:

                  -loop list, [] do - [h|t], acc -> - recur t, [h*2|acc] - [], acc -> - acc -end -#=> [6,4,2] +
                  iex> pixels = <<213,45,132,64,76,32,76,0,0,234,32,15>>
                  +iex> lc <<r:8,g:8,b:8>> inbits pixels, do: {r,g,b}
                  +[{213,45,132},{64,76,32},{76,0,0},{234,32,15}]
                   
                  - -

                  Notice that all match clauses expects the same ammount -of arguments. Guards can also be given.

                  - -

                  Recursion happens by calling recur with the same number -of arguments of each match clause. recur does not guarantee -that it will be tail recursive.

                  - Source + Source

                  - quote/2 + quote(opts, list2)

                  Allows you to get the representation of any expression.

                  @@ -548,79 +501,64 @@

                  Hygiene

                  a #=> 11
                  -

                  Notice that references are not hygienic in Elixir unless -you explicitly access it via MAIN to the reference name.

                  +

                  Notice that aliases are not hygienic in Elixir, ambiguity +must be solved by prepending Elixir:

                  quote do
                  -  __MAIN__.Foo #=> Access the root Foo
                  -  Foo   #=> Access the Foo reference in the current
                  -             module (if any is set), then fallback to root
                  +  Elixir.Foo #=> Access the root Foo
                  +  Foo        #=> Access the Foo alias in the current module
                  +                 (if any is set), then fallback to Elixir.Foo
                   end
                   

                  Options

                  -

                  quote also accepts some options as arguments. For example, -hygiene can be turned off via hygiene: false which is useful -when one is generating a code that should be inserted into -some function.

                  -
                  - Source -
                  -

                  - recur/1 -

                  -

                  A function that forces the current loop to recur. See loop/1 -for more information.

                  -
                  - Source -
                  -

                  - refer/2 -

                  -

                  refer is used to setup aliases between modules.

                  - -

                  Examples

                  - -

                  refer can be used to setup an alias for any module:

                  - -
                  defmodule Math do
                  -  refer MyKeyword, as: Keyword
                  -end
                  -
                  - -

                  In the example above, we have set up MyOrdict to be referenced -as Keyword. So now, any reference to Keyword will be -automatically replaced by MyKeyword.

                  +
                    +
                  • :hygiene - When false, disables hygiene;
                  • +
                  • :unquote - When false, disables unquoting. Useful when you have a quote +inside another quote and want to control which quote is able to unquote;
                  • +
                  • :location - When set to :keep, keeps the current line and file on quotes. + Read the Stacktrace information section below for more information;
                  • +
                  -

                  In case one wants to access the original Keyword, it can be done -by accessing MAIN:

                  +

                  Stacktrace information

                  -
                  Keyword.values   #=> uses MyKeyword.values
                  -__MAIN__.Keyword.values #=> uses Keyword.values
                  -
                  +

                  One of Elixir goals is to provide proper stacktrace whenever there is an +exception. In order to work properly with macros, the default behavior +in quote is to set the line to 0. When a macro is invoked and the quoted +expressions is expanded, 0 is replaced by the line of the call site.

                  -

                  Notice that calling refer without the as: option automatically -sets an alias based on the last part of the module. For example:

                  +

                  This is a good behavior for the majority of the cases, except if the macro +is defining new functions. Consider this example:

                  -
                  refer Foo.Bar.Baz
                  +
                  defmodule MyServer do
                  +  use GenServer.Behavior
                  +end
                   
                  -

                  Is the same as:

                  +

                  GenServer.Behavior defines new functions in our MyServer module. +However, if there is an exception in any of these functions, we want +the stacktrace to point to the GenServer.Behavior and not the line +that calls use GenServer.Behavior. For this reason, there is an +option called :location that when set to :keep keeps these proper +semantics:

                  -
                  refer Foo.Bar.Baz, as: Baz
                  +
                  quote location: :keep do
                  +  def handle_call(request, _from, state) do
                  +    { :reply, :undef, state }
                  +  end
                  +end
                   
                  -

                  Lexical scope

                  - -

                  import, require and refer are called directives and all -have lexical scope. This means you can set up aliases inside -specific functions and it won't affect the overall scope.

                  +

                  It is important to warn though that location: :keep evaluates the +code as if it was defined inside GenServer.Behavior file, in +particular, the macro __FILE__ will always point to +GenServer.Behavior file.

                  - Source + Source

                  - require/2 + require(module, opts)

                  require is used to require the presence of external modules so macros can be invoked.

                  @@ -643,15 +581,15 @@

                  Examples

                  An attempt to call a macro that was not loaded will raise an error.

                  -

                  Refer shortcut

                  +

                  Alias shortcut

                  require also accepts as: as an option so it automatically sets -up an alias. Please check refer for more information.

                  +up an alias. Please check alias for more information.

                  - Source + Source

                  - unquote/1 + unquote(expr)

                  Unquotes the given expression from inside a macro.

                  @@ -677,10 +615,10 @@

                  Examples

                  #=> { :sum, 0, [1, 13, 3] }
                  - Source + Source

                  - unquote_splicing/1 + unquote_splicing(expr)

                  Unquotes the given list expanding its arguments. Similar to unquote.

                  @@ -692,10 +630,10 @@

                  Examples

                  #=> { :sum, 0, [1, 2, 3, 4, 5] }
                  - Source + Source

                  - {}/1 + {}(args)

                  Defines a new tuple.

                  @@ -705,7 +643,7 @@

                  Examples

                  { 1, 2, 3 }
                  - Source + Source
                  diff --git a/docs/stable/Kernel.Typespec.html b/docs/stable/Kernel.Typespec.html new file mode 100644 index 000000000..4fcedf60c --- /dev/null +++ b/docs/stable/Kernel.Typespec.html @@ -0,0 +1,147 @@ + + + + Kernel.Typespec + + + + + + + + + + + + +
                  +

                  + Kernel.Typespec + +

                  + + +
                  +

                  This is the module that converts Elixir typespecs +to Erlang typespecs syntax. Everytime @spec, @type +and @typep are used they proxy to the functions +in this module.

                  + +
                  + + + Source + + + + + + +

                  Functions summary

                  + + + + +

                  Macros summary

                  + + + + +
                  +

                  Functions

                  +
                  +

                  + get_specs(module) +

                  +

                  Get the specs defined for the given module. This function +is only available for modules being compiled. If the module +was already compiled, you need to loop its attributes +to get such information.

                  +
                  + Source +
                  +

                  + get_types(module) +

                  +

                  Get the types defined for the given module. This function +is only available for modules being compiled. If the module +was already compiled, you need to loop its attributes +to get such information.

                  +
                  + Source +
                  +
                  + + + +
                  +

                  Macros

                  +
                  +

                  + defcallback(spec, block) +

                  +
                  + Source +
                  +

                  + defspec(spec, block) +

                  +
                  + Source +
                  +

                  + deftype(name, options // []) +

                  +
                  + Source +
                  +

                  + deftypep(name) +

                  +
                  + Source +
                  +
                  + +
                  + + diff --git a/docs/latest/Elixir.Builtin.html b/docs/stable/Kernel.html similarity index 72% rename from docs/latest/Elixir.Builtin.html rename to docs/stable/Kernel.html index ac01b9b1b..b9c36b34a 100644 --- a/docs/latest/Elixir.Builtin.html +++ b/docs/stable/Kernel.html @@ -1,7 +1,7 @@ - Elixir.Builtin + Kernel @@ -21,33 +21,33 @@

                  - Elixir.Builtin + Kernel

                  -

                  Elixir.Builtin provides the default macros and functions +

                  Kernel provides the default macros and functions Elixir imports into your environment. Those macros and functions can be skipped or cherry-picked via the import macro. For instance, if you want to tell Elixir to not import the case macro, you can do:

                  -
                  import Elixir.Builtin, except: [case: 2]
                  +
                  import Kernel, except: [case: 2]
                   

                  Elixir also has special forms that are always imported and -cannot be skipped. These are described in Elixir.SpecialForms.

                  +cannot be skipped. These are described in Kernel.SpecialForms.

                  Some of the functions described in this module are simply a proxy to its Erlang counterpart. Although they are documented here for convenience, you can access their original documentation -at http://www.erlang.org/doc/man/erlang.html.

                  +at http://www.erlang.org/doc/man/erlang.html.

                  - Source + Source @@ -58,639 +58,669 @@

                  Functions summary

                  + + + +

                  Macros summary

                  + - - - -

                  Macros summary

                  -
                    -
                  • +
                  • - !/1 + function_exported?/3
                  • - !=/2 + halt/0
                  • - !==/2 + halt/1
                  • - &&/2 + halt/2
                  • - */2 + hd/1
                  • - +/2 + if/2
                  • - ++/2 + in/2
                  • - -/2 + inspect/1
                  • - --/2 + integer_to_list/1
                  • - //2 + integer_to_list/2
                  • - </2 + iolist_size/1
                  • - <-/2 + iolist_to_binary/1
                  • - <=/2 + is_atom/1
                  • - <>/2 + is_binary/1
                  • - ==/2 + is_bitstring/1
                  • - ===/2 + is_boolean/1
                  • - >/2 + is_exception/1
                  • - >=/2 + is_float/1
                  • - __B__/2 + is_function/1
                  • - __C__/2 + is_function/2
                  • - __b__/2 + is_integer/1
                  • - __c__/2 + is_list/1
                  • - __r__/2 + is_number/1
                  • - access/2 + is_pid/1
                  • - and/2 + is_port/1
                  • - atom_to_binary/1 + is_record/2
                  • - binary_to_atom/1 + is_reference/1
                  • - binary_to_existing_atom/1 + is_regex/1
                  • - case/2 + is_tuple/1
                  • - cond/1 + length/1
                  • - def/2 + list_to_atom/1
                  • - def/4 + list_to_binary/1
                  • - defdelegate/2 + list_to_bitstring/1
                  • - defexception/4 + list_to_existing_atom/1
                  • - defimpl/3 + list_to_float/1
                  • - defmodule/2 + list_to_integer/1
                  • - defoverridable/1 + list_to_integer/2
                  • - defp/2 + list_to_pid/1
                  • - defp/4 + list_to_tuple/1
                  • - defprotocol/2 + make_ref/0
                  • - defrecord/4 + match?/2
                  • - destructure/2 + max/2
                  • - div/2 + min/2
                  • - elem/2 + node/0
                  • - if/2 + node/1
                  • - in/2 + not/1
                  • - inspect/1 + or/2
                  • - is_exception/1 + pid_to_list/1
                  • - is_record/2 + receive/1
                  • - is_regex/1 + rem/2
                  • - match?/2 + round/1
                  • - not/1 + self/0
                  • - or/2 + setelem/3
                  • - receive/1 + size/1
                  • - rem/2 + spawn/1
                  • - setelem/3 + spawn/3 + +
                  • +
                  • + + spawn_link/1 + +
                  • +
                  • + + spawn_link/3 + +
                  • +
                  • + + term_to_binary/1 + +
                  • +
                  • + + term_to_binary/2 + +
                  • +
                  • + + throw/1 + +
                  • +
                  • + + tl/1
                  • @@ -703,11 +733,26 @@

                    Macros summary

                    to_char_list/1
                  • +
                  • + + trunc/1 + +
                  • try/1
                  • +
                  • + + tuple_size/1 + +
                  • +
                  • + + tuple_to_list/1 + +
                  • unless/2 @@ -741,1989 +786,2103 @@

                    Macros summary

                    Functions

                    -

                    - abs/1 +

                    + raise(msg)

                    -

                    Returns an integer or float which is the arithmetical absolute value of number.

                    +

                    Raises an error.

                    -

                    Allowed in guard tests.

                    +

                    If the argument is a binary, it raises RuntimeError with the message. +If anything else, becomes a call to raise(argument, []).

                    Examples

                    -
                    abs(-3.33) #=> 3.33
                    -abs(-3)    #=> 3
                    +
                    raise "Given values do not match"
                    +
                    +try do
                    +  1 + :foo
                    +rescue
                    +  x in [BadargError] ->
                    +    IO.puts "that was expected"
                    +    raise x
                    +end
                     
                    - Source + Source
                    -

                    - apply/2 +

                    + raise(exception, args)

                    -

                    Invokes the given fun with the array of arguments args.

                    +

                    Raises an error.

                    + +

                    It calls .exception on the given argument passing +the args in order to retrieve the appropriate exception +structure.

                    + +

                    Any module defined via defexception automatically +defines exception(args) that returns a new instance +of the record and a exception(args, current) that +works as no-op.

                    Examples

                    -
                    apply fn x -> x * 2 end, [2]
                    -#=> 4
                    +
                    raise ArgumentError, message: "Sample"
                     
                    - Source -
                    -

                    - apply/3 + Source +

                    +
                    + + + +
                    +

                    Macros

                    +
                    +

                    + !(arg)

                    -

                    Invokes the given fun from module with the array of arguments args.

                    +

                    It receives any argument and returns true if it is false +or nil. Returns false otherwise. Not allowed in guard +clauses.

                    Examples

                    -
                    apply List, reverse, [[1,2,3]]
                    -#=> [3,2,1]
                    -
                    +

                    !1 #=> false + ![1,2,3] #=> false + !false #=> true + !nil #=> true

                    - Source + Source
                    -

                    - atom_to_binary/2 +

                    + !=(left, right)

                    -

                    Returns a binary which corresponds to the text representation of atom. -If encoding is latin1, there will be one byte for each character in the text -representation. If encoding is utf8 or unicode, the characters will be encoded -using UTF-8 (meaning that characters from 16#80 up to 0xFF will be encoded in -two bytes).

                    +

                    Returns true if the two items are not equal.

                    + +

                    This operator considers 1 and 1.0 to be equal. For strict +comparison, use !== instead.

                    + +

                    As Erlang, Elixir can compare any term. Allowed in guard clauses.

                    Examples

                    -
                    atom_to_binary(:elixir, utf8) #=> "elixir"
                    +
                    1 != 2
                    +#=> true
                    +1 != 1.0
                    +#=> false
                     
                    - Source + Source
                    -

                    - atom_to_list/1 +

                    + !==(left, right)

                    -

                    Returns a string which corresponds to the text representation of atom.

                    +

                    Returns true if the two items are strictly not equal. +As Erlang, Elixir can compare any term. Allowed in guard clauses.

                    Examples

                    -
                    atom_to_list(:elixir) #=> 'elixir'
                    +
                    1 !== 2
                    +#=> true
                    +
                    +1 !== 1.0
                    +#=> true
                     
                    - Source + Source
                    -

                    - binary_to_atom/2 +

                    + &&(left, right)

                    -

                    Returns the atom whose text representation is binary. If encoding is latin1, -no translation of bytes in the binary is done. If encoding is utf8 or unicode, -the binary must contain valid UTF-8 sequences; furthermore, only Unicode -characters up to 0xFF are allowed.

                    +

                    Provides a short-circuit operator that executes the second +expression only if the first one evalutes to true (i.e. it is +not nil nor false). Returns the first expression otherwise.

                    Examples

                    -
                    binary_to_atom("elixir", :utf8) #=> :elixir
                    +
                    true && true         #=> true
                    +nil && true          #=> nil
                    +true && 1            #=> 1
                    +false && error(:bad) #=> false
                     
                    + +

                    Notice that, differently from Erlang and operator, +this operator accepts any expression as arguments, +not only booleans, however it is not allowed in guards.

                    - Source -
                    -

                    - binary_to_existing_atom/2 -

                    -

                    Works like binary_to_atom/2, but the atom must already exist.

                    -
                    - Source -
                    -

                    - binary_to_list/1 -

                    -

                    Returns a list of integers which correspond to the bytes of binary.

                    -
                    - Source -
                    -

                    - binary_to_list/3 -

                    -

                    As binarytolist/1, but returns a list of integers corresponding to the bytes -from position start to position stop in binary. Positions in the binary -are numbered starting from 1.

                    -
                    - Source + Source
                    -

                    - binary_to_term/1 +

                    + *(left, right)

                    -

                    Returns an Erlang term which is the result of decoding the binary -object binary, which must be encoded according to the Erlang external -term format.

                    +

                    Arithmetic multiplication. Allowed in guard clauses.

                    Examples

                    -
                    binary_to_term(term_to_binary("foo")) #=> true
                    +
                    1 * 2 #=> 2
                     
                    - Source + Source
                    -

                    - binary_to_term/2 +

                    + +(left, right)

                    -

                    As binary_to_term/1, but accepts a safe option useful when receiving -binaries from an untrusted source.

                    - -

                    When enabled, it prevents decoding data that may be used to attack the -Erlang system. In the event of receiving unsafe data, decoding fails -with a badarg error.

                    - -

                    Currently, this prevents creation of new atoms directly, creation of -new atoms indirectly (as they are embedded in certain structures like pids, -refs, funs, etc), and creation of new external function references. None -of those resources are currently garbage collected, so unchecked creation -of them can exhaust available memory.

                    +

                    Arithmetic plus. Allowed in guard clauses.

                    Examples

                    -
                    binary_to_term(term_to_binary("foo"), [:safe])
                    +
                    1 + 2 #=> 3
                     
                    - Source + Source
                    -

                    - bit_size/1 +

                    + ++(left, right)

                    -

                    Returns an integer which is the size in bits of bitstring.

                    - -

                    Allowed in guard tests.

                    +

                    Concatenates two lists. Allowed in guard clauses.

                    Examples

                    -
                    bit_size(<<433|16,3|3>>) #=> 19
                    -bit_size(<<1,2,3>>) #=> 24
                    +
                    [1] ++ [2,3]
                    +#=> [1,2,3]
                    +
                    +'foo' ++ 'bar'
                    +#=> 'foobar'
                     
                    - Source + Source
                    -

                    - bitstring_to_list/1 +

                    + -(left, right)

                    -

                    Returns a list of integers which correspond to the bytes of bitstring. If the -number of bits in the binary is not divisible by 8, the last element of the list will -be a bitstring containing the remaining bits (1 up to 7 bits).

                    +

                    Arithmetic minus. Allowed in guard clauses.

                    + +

                    Examples

                    + +
                    1 - 2 #=> -1
                    +
                    - Source + Source
                    -

                    - byte_size/1 +

                    + --(left, right)

                    -

                    Returns an integer which is the number of bytes needed to contain bitstring. -(That is, if the number of bits in Bitstring is not divisible by 8, the resulting -number of bytes will be rounded up.)

                    - -

                    Allowed in guard tests.

                    +

                    Removes the first occorrence of an item on the left +for each item on the right. Allowed in guard clauses.

                    Examples

                    -
                    byte_size(<<433|16,3|3>>) #=> 3
                    -byte_size(<<1,2,3>>) #=> 3
                    +
                    [1,2,3] -- [1,2]
                    +#=> [3]
                    +
                    +[1,2,3,2,1] -- [1,2,2]
                    +#=> [3,1]
                     
                    - Source + Source
                    -

                    - exit/1 +

                    + ..(first, last)

                    -

                    Stops the execution of the calling process with the given reason. -Since evaluating this function causes the process to terminate, -it has no return value.

                    +

                    Returns a range with the specified start and end. +Includes both ends.

                    Examples

                    -
                    exit(:normal)
                    -exit(:seems_bad)
                    +
                    0 in 1..3 #=> false
                    +1 in 1..3 #=> true
                    +2 in 1..3 #=> true
                    +3 in 1..3 #=> true
                     
                    - Source + Source
                    -

                    - float/1 +

                    + /(left, right)

                    -

                    Converts the given number to a float. Allowed in guard clauses.

                    +

                    Arithmetic division. Differently from other languages, +the result is always a float. Use div and rem if you want +a natural division or the remainder. Allowed in guard clauses.

                    + +

                    Examples

                    + +
                    1 / 2 #=> 0.5
                    +2 / 1 #=> 2.0
                    +
                    - Source + Source
                    -

                    - float_to_list/1 +

                    + />(left, right)

                    -

                    Returns a char list which corresponds to the text representation of the given float.

                    +

                    /> is called the pipeline operator as it is useful +to write pipeline style expressions. This operator +tntroduces the expression on the left as the first +argument to the expression on the right.

                    Examples

                    -
                    float_to_list(7.0)
                    -#=> '7.00000000000000000000e+00'
                    +
                    [1,[2],3] /> List.flatten /> Enum.map(&1 * 2)
                    +#=> [2,4,6]
                    +
                    + +

                    The expression above is simply translated to:

                    + +
                    Enum.map(List.flatten([1,[2],3]), &1 * 2)
                     
                    - Source + Source
                    -

                    - halt/0 -

                    -

                    The same as halt(0, []).

                    -
                    - Source -
                    -

                    - halt/1 -

                    -

                    The same as halt(status, []).

                    -
                    - Source -
                    -

                    - halt/2 +

                    + <(left, right)

                    -

                    Halts the Erlang runtime system where the first argument status must be a -non-negative integer, a char list, or the atom :abort.

                    - -
                      -
                    • If an integer, the runtime system exits with the integer value which -is returned to the Operating System;

                    • -
                    • If a char list, an erlang crash dump is produced with status as slogan, -and then the runtime system exits with status code 1;

                    • -
                    • If :abort, the runtime system aborts producing a core dump, if that is -enabled in the operating system.

                    • -
                    - -

                    Note that on many platforms, only the status codes 0-255 are supported -by the operating system.

                    - -

                    For integer status, Erlang runtime system closes all ports and allows async -threads to finish their operations before exiting. To exit without such -flushing, pass options [flush: false] instead.

                    +

                    Return true if left is less than right. +As Erlang, Elixir can compare any term. Allowed in guard clauses.

                    Examples

                    -
                    halt(0)
                    -halt(1, flush: false)
                    -halt(:abort)
                    +
                    1 < 2
                    +#=> true
                     
                    - Source -
                    -

                    - hd/1 -

                    -

                    Returns the head of a list, raises badarg if the list is empty.

                    -
                    - Source + Source
                    -

                    - integer_to_list/1 +

                    + <-(pid, msg)

                    -

                    Returns a char list which corresponds to the text representation of the given integer.

                    +

                    Sends a message to the process identified on the left. +A process can be identified bu its PID or, if it is registered, +by an atom.

                    Examples

                    -
                    integer_to_list(7)
                    -#=> '7'
                    +
                    process = Process.self
                    +process <- { :ok, "Sending myself a message" }
                     
                    - Source + Source
                    -

                    - integer_to_list/2 +

                    + <=(left, right)

                    -

                    Returns a char list which corresponds to the text representation of the -given integer in the given case.

                    +

                    Return true if left is less than or equal to right. +As Erlang, Elixir can compare any term. Allowed in guard clauses.

                    Examples

                    -
                    integer_to_list(1023, 16).
                    -#=> "3FF"
                    +
                    1 <= 2
                    +#=> true
                     
                    - Source + Source
                    -

                    - iolist_size/1 +

                    + <>(left, right)

                    -

                    Returns the size of an iolist.

                    +

                    Concatenates two binaries. Allowed in guard clauses.

                    Examples

                    -
                    iolist_size([1,2|<<3,4>>])
                    -#=> 4
                    +
                    "foo" <> "bar" #=> "foobar"
                    +
                    + +

                    The <> operator can also be used in guard clauses as +long as the first part is a literal binary:

                    + +
                    "foo" <> x = "foobar"
                    +x #=> "bar"
                     
                    - Source + Source
                    -

                    - iolist_to_binary/1 +

                    + ==(left, right)

                    -

                    Returns a binary which is made from the integers and binaries in iolist.

                    +

                    Returns true if the two items are equal.

                    + +

                    This operator considers 1 and 1.0 to be equal. For strict +comparison, use === instead.

                    + +

                    As Erlang, Elixir can compare any term. Allowed in guard clauses.

                    Examples

                    -
                    bin1 = <<1,2,3>>
                    -bin2 = <<4,5>>
                    -bin3 = <<6>>
                    +
                    1 == 2
                    +#=> false
                     
                    -iolist_to_binary([bin1,1,[2,3,bin2],4|bin3])
                    -#=> <<1,2,3,1,2,3,4,5,4,6>>
                    +1 == 1.0
                    +#=> true
                     
                    - Source + Source
                    -

                    - is_atom/1 +

                    + ===(left, right)

                    -

                    Returns true if term is an atom; otherwise returns false.

                    +

                    Returns true if the two items are strictly equal. +As Erlang, Elixir can compare any term. Allowed in guard clauses.

                    -

                    Allowed in guard tests.

                    -
                    - Source -
                    -

                    - is_binary/1 -

                    -

                    Returns true if term is a binary; otherwise returns false.

                    +

                    Examples

                    -

                    A binary always contains a complete number of bytes.

                    +
                    1 === 2
                    +#=> false
                     
                    -

                    Allowed in guard tests.

                    +1 === 1.0 +#=> false +
                    - Source + Source
                    -

                    - is_bitstring/1 +

                    + =~(left, right)

                    -

                    Returns true if term is a bitstring (including a binary); otherwise returns false.

                    +

                    Matches the term on the left against the regular expression +on the right. It returns nil if not match happened or the +first match otherwise.

                    -

                    Allowed in guard tests.

                    -
                    - Source -
                    -

                    - is_boolean/1 -

                    -

                    Returns true if term is either the atom true or the atom false (i.e. a boolean); -otherwise returns false.

                    +

                    Examples

                    -

                    Allowed in guard tests.

                    +
                    "abcd" =~ %r/c(d)/  #=> 2
                    +"abcd" =~ %r/e/     #=> nil
                    +
                    - Source + Source
                    -

                    - is_float/1 +

                    + >(left, right)

                    -

                    Returns true if term is a floating point number; otherwise returns false.

                    +

                    Return true if left is more than right. +As Erlang, Elixir can compare any term. Allowed in guard clauses.

                    -

                    Allowed in guard tests.

                    -
                    - Source -
                    -

                    - is_function/1 -

                    -

                    Returns true if term is a function; otherwise returns false.

                    +

                    Examples

                    -

                    Allowed in guard tests.

                    +
                    1 > 2
                    +#=> false
                    +
                    - Source + Source
                    -

                    - is_function/2 +

                    + >=(left, right)

                    -

                    Returns true if term is a function that can be applied with arity number of arguments; -otherwise returns false.

                    +

                    Return true if left is more than or equal to right. +As Erlang, Elixir can compare any term. Allowed in guard clauses.

                    -

                    Allowed in guard tests.

                    -
                    - Source -
                    -

                    - is_integer/1 -

                    -

                    Returns true if term is an integer; otherwise returns false.

                    +

                    Examples

                    -

                    Allowed in guard tests.

                    +
                    1 >= 2
                    +#=> false
                    +
                    - Source + Source
                    -

                    - is_list/1 +

                    + @(expr)

                    -

                    Returns true if term is a list with zero or more elements; otherwise returns false.

                    +

                    This macro is a shortcut to read and add attributes to the module +being compiled. Elixir module attributes are similar to Erlang's with +some differences. The canonical example for attributes is annotating +that a module implements the OTP behavior called gen_server:

                    -

                    Allowed in guard tests.

                    -
                    - Source -
                    -

                    - is_number/1 -

                    -

                    Returns true if term is either an integer or a floating point number; -otherwise returns false.

                    +
                    defmodule MyServer do
                    +  @behavior :gen_server
                    +  # ... callbacks ...
                    +end
                    +
                    -

                    Allowed in guard tests.

                    -
                    - Source -
                    -

                    - is_pid/1 -

                    -

                    Returns true if term is a pid (process identifier); otherwise returns false.

                    +

                    Elixir supports by default all Erlang module attributes but any developer +can also add custom attributes:

                    -

                    Allowed in guard tests.

                    -
                    - Source -
                    -

                    - is_port/1 -

                    -

                    Returns true if term is a port identifier; otherwise returns false.

                    +
                    defmodule MyServer do
                    +  @my_data 13
                    +  IO.inspect @my_data #=> 13
                    +end
                    +
                    -

                    Allowed in guard tests.

                    -
                    - Source -
                    -

                    - is_reference/1 -

                    -

                    Returns true if term is a reference; otherwise returns false.

                    +

                    Differently from Erlang, such attributes are not stored in the module by +default since it is common in Elixir to use such attributes to store +temporary data. A developer can configure an attribute to behave closer +to Erlang by calling Module.register_attribute/2.

                    -

                    Allowed in guard tests.

                    -
                    - Source -
                    -

                    - is_tuple/1 -

                    -

                    Returns true if term is a tuple; otherwise returns false.

                    +

                    Finally notice that attributes can also be read inside functions:

                    -

                    Allowed in guard tests.

                    +
                    defmodule MyServer do
                    +  @my_data 11
                    +  def first_data, do: @my_data
                    +  @my_data 13
                    +  def second_data, do: @my_data
                    +end
                    +
                    +MyServer.first_data #=> 11
                    +MyServer.second_data #=> 13
                    +
                    + +

                    It is important to note that reading an attribute takes a snapshot of +its current value. In other words, the value is read at compilation +time and not at runtime. Check the module Module for other functions +to manipulate module attributes.

                    - Source + Source
                    -

                    - length/1 +

                    + __B__(string, list2)

                    -

                    Returns the length of list.

                    - -

                    Allowed in guard tests.

                    +

                    Handles the sigil %B. It simples returns a binary +without escaping characters and without interpolations.

                    Examples

                    -
                    length([1,2,3,4,5,6,7,8,9]) #=> 9
                    +
                    %B(foo)      #=> "foo"
                    +%B(f#{o}o)  #=> "f\#{o}o"
                     
                    - Source + Source
                    -

                    - list_to_atom/1 +

                    + __C__(arg1, list2)

                    -

                    Returns the atom whose text representation is char_list.

                    +

                    Handles the sigil %C. It simples returns a char list +without escaping characters and without interpolations.

                    Examples

                    -
                    list_to_atom('elixir') #=> :elixir
                    +
                    %C(foo)      #=> 'foo'
                    +%C(f#{o}o)  #=> 'f\#{o}o'
                     
                    - Source + Source
                    -

                    - list_to_binary/1 +

                    + __R__(arg1, options)

                    -

                    Returns a binary which is made from the content of char_list.

                    +

                    Handles the sigil %R. It returns a Regex pattern without escaping +nor interpreating interpolations.

                    Examples

                    -
                    list_to_binary('Elixir') #=> "Elixir"
                    +
                    Regex.match? %R(f#{1,3}o), "f#o"  #=> true
                     
                    - Source + Source
                    -

                    - list_to_bitstring/1 +

                    + __b__(arg1, list2)

                    -

                    Returns a bitstring which is made from the integers and bitstrings in bitstring_list. -(the last tail in bitstring_list is allowed to be a bitstring.)

                    +

                    Handles the sigil %b. It returns a binary as if it was double quoted +string, unescaping characters and replacing interpolations.

                    Examples

                    -
                    bin1 = <<1,2,3>>
                    -bin2 = <<4,5>>
                    -bin3 = <<6,7|4>>
                    -
                    -list_to_binary([bin1,1,[2,3,bin2],4|bin3])
                    -#=> <<1,2,3,1,2,3,4,5,4,6,7|4>>
                    +
                    %b(foo)       #=> "foo"
                    +%b(f#{:o}o)  #=> "foo"
                     
                    - Source -
                    -

                    - list_to_existing_atom/1 -

                    -

                    Returns the atom whose text representation is char_list, but only if there already -exists such atom.

                    -
                    - Source + Source
                    -

                    - list_to_float/1 +

                    + __c__(arg1, list2)

                    -

                    Returns the float whose text representation is char_list.

                    +

                    Handles the sigil %c. It returns a char list as if it was a single +quoted string, unescaping characters and replacing interpolations.

                    Examples

                    -
                    list_to_float('2.2017764e+0') #=> 2.2017764
                    +
                    %c(foo)       #=> 'foo'
                    +%c(f#{:o}o)  #=> 'foo'
                     
                    - Source + Source
                    -

                    - list_to_integer/1 +

                    + __r__(arg1, options)

                    -

                    Returns an integer whose text representation is char_list.

                    +

                    Handles the sigil %r. It returns a Regex pattern.

                    Examples

                    -
                    list_to_integer('123') #=> 123
                    +
                    Regex.match? %r(foo), "foo"  #=> true
                     
                    - Source + Source
                    -

                    - list_to_integer/2 +

                    + abs(number)

                    -

                    Returns an integer whose text representation in base base is char_list.

                    +

                    Returns an integer or float which is the arithmetical absolute value of number.

                    + +

                    Allowed in guard tests.

                    Examples

                    -
                    > list_to_integer('3FF', 16) #=> 1023
                    +
                    abs(-3.33) #=> 3.33
                    +abs(-3)    #=> 3
                     
                    - Source + Source
                    -

                    - list_to_pid/1 +

                    + access(element, args)

                    -

                    Returns a pid whose text representation is char_list.

                    +

                    Access the given element using the qualifier according +to the Access protocol. All calls in the form foo[bar] +are translated to access(foo, bar).

                    -

                    Examples

                    +

                    The usage of this protocol is to access a raw value in a +keywords list.

                    -
                    list_to_pid('<0.41>') #=> <0.4.1>
                    +
                    sample = [a: 1, b: 2, c: 3]
                    +sample[:b] #=> 2
                     
                    -
                    - Source -
                    -

                    - list_to_tuple/1 -

                    -

                    Returns a tuple which corresponds to list. list can contain any Erlang terms.

                    -

                    Examples

                    +

                    Atoms

                    -
                    list_to_tuple([share, [:elixir, 163]]). #=> {share, [:elixir, 163]}
                    +

                    Whenever invoked on an atom, the access protocol is expanded +at compilation time rather than on runtime. This feature is used +by records to allow a developer to match against an specific part +of a record:

                    + +
                    def increment(State[counter: counter, other: 13] = state) do
                    +  state.counter(counter + 1)
                    +end
                     
                    -
                    - Source -
                    -

                    - make_ref/0 -

                    -

                    Returns an almost unique reference.

                    -

                    The returned reference will re-occur after approximately 2^82 calls; -therefore it is unique enough for practical purposes.

                    +

                    In the example above, we use the Access protocol to match the +counter field in the record State. Considering the record +definition is as follows:

                    + +
                    defrecord State, counter: 0, other: nil
                    +
                    + +

                    The clause above is translated to:

                    + +
                    def increment({ State, counter, 13 } = state) do
                    +  state.counter(counter + 1)
                    +end
                    +
                    + +

                    The same pattern can be used to create a new record:

                    + +
                    def new_state(counter) do
                    +  State[counter: counter]
                    +end
                    +
                    + +

                    The example above is slightly faster than State.new(counter: :counter) +because the record is expanded at compilation time and not at runtime. +If a field is not specified on creation, it will have its default value.

                    + +

                    Finally, as in Erlang, Elixir also allows the following syntax:

                    + +
                    new_uri = State[_: 1]
                    +
                    + +

                    In this case all fields will be set to 1. Notice that, +as in Erlang, in case an expression is given, it will be +evaluated multiple times:

                    + +
                    new_uri = State[_: IO.puts "Hello"]
                    +
                    + +

                    In this case, "Hello" will be printed twice (one per each field).

                    Examples

                    -
                    make_ref()
                    -#=> #Ref<0.0.0.135>
                    +
                    a = { :a, :b, :c }
                    +a[1] #=> :a
                    +access a, 1 #=> :a
                     
                    - Source + Source
                    -

                    - max/2 +

                    + and(left, right)

                    -

                    Return the biggest of the two given terms according to -Erlang's term ordering. If the terms compare equal, the -first one is returned.

                    +

                    Boolean and. Arguments needs to necessarily be booleans. +Allowed in guard clauses.

                    Examples

                    -
                    max(1, 2) #=> 2
                    +
                    true and false
                    +#=> false
                     
                    - Source + Source
                    -

                    - min/2 +

                    + apply(fun, args)

                    -

                    Return the smallest of the two given terms according to -Erlang's term ordering. If the terms compare equal, the -first one is returned.

                    +

                    Invokes the given fun with the array of arguments args.

                    Examples

                    -
                    min(1, 2) #=> 1
                    +
                    apply fn x -> x * 2 end, [2]
                    +#=> 4
                     
                    - Source + Source
                    -

                    - node/0 +

                    + apply(module, fun, args)

                    -

                    Returns an atom representing the name of the local node. -If the node is not alive, nonode@nohost is returned instead.

                    +

                    Invokes the given fun from module with the array of arguments args.

                    -

                    Allowed in guard tests.

                    -
                    - Source -
                    -

                    - node/1 -

                    -

                    Returns the node where the given argmuent is located. -The argument can be a pid, a reference, or a port. -If the local node is not alive, nonode@nohost is returned.

                    +

                    Examples

                    -

                    Allowed in guard tests.

                    -
                    - Source -
                    -

                    - pid_to_list/1 -

                    -

                    Returns a char list which corresponds to the text representation of pid. -This function is intended for debugging and for use in the Erlang operating -system. It should not be used in application programs.

                    +
                    apply List, reverse, [[1,2,3]]
                    +#=> [3,2,1]
                    +
                    - Source + Source
                    -

                    - raise/1 +

                    + atom_to_binary(some_atom)

                    -

                    Raises an error.

                    - -

                    If the argument is a binary, it raises RuntimeError with the message. -If anything else, becomes a call to raise(argument, []).

                    +

                    Returns a binary which corresponds to the text representation +of some_atom in UTF8 encoding. Allowed in guard clauses.

                    Examples

                    -
                    raise "Given values do not match"
                    -
                    -try do
                    -  1 + :foo
                    -rescue
                    -  x in [BadargError] ->
                    -    IO.puts "that was expected"
                    -    raise x
                    -end
                    +
                    atom_to_binary :my_atom #=> "my_atom"
                     
                    - Source + Source
                    -

                    - raise/2 +

                    + atom_to_binary(atom, encoding)

                    -

                    Raises an error.

                    - -

                    It calls .exception on the given argument passing -the args in order to retrieve the appropriate exception -structure.

                    - -

                    Any module defined via defexception automatically -defines exception(args) that returns a new instance -of the record and a exception(args, current) that -works as no-op.

                    +

                    Returns a binary which corresponds to the text representation of atom. +If encoding is latin1, there will be one byte for each character in the text +representation. If encoding is utf8 or unicode, the characters will be encoded +using UTF-8 (meaning that characters from 16#80 up to 0xFF will be encoded in +two bytes).

                    Examples

                    -
                    raise ArgumentError, message: "Sample"
                    +
                    atom_to_binary(:elixir, utf8) #=> "elixir"
                     
                    - Source + Source
                    -

                    - round/1 +

                    + atom_to_list(atom)

                    -

                    Returns an integer by rounding the given number. -Allowed in guard tests.

                    +

                    Returns a string which corresponds to the text representation of atom.

                    Examples

                    -
                    round(5.5) #=> 6
                    +
                    atom_to_list(:elixir) #=> 'elixir'
                     
                    - Source -
                    -

                    - size/1 -

                    -

                    Returns the size of the given argument, which must be a tuple -or a binary. If possible, please use tuplesize or binarysize.

                    -
                    - Source + Source
                    -

                    - spawn/1 +

                    + binary_part(binary, start, length)

                    -

                    Spawns the given function and returns its pid. -Check the module Process for other functions that handle -process, including spawning functions in nodes.

                    +

                    Extracts the part of the binary starting at start with length length. +Binaries are zero-indexed.

                    + +

                    If start or length references in any way outside the binary, an +ArgumentError exception is raised.

                    + +

                    Allowed in guard tests.

                    Examples

                    -
                    current = Process.self
                    -child   = spawn(fn -> current <- { Process.self, 1 + 2 } end)
                    +
                    binary_part "foo", 1, 2 #=> "oo"
                    +
                    -receive - { ^child, 3 } -> IO.puts "Received 3 back" -end +

                    A negative length can be used to extract bytes at the end of a binary:

                    + +
                    binary_part "foo", 3, -1 #=> 1
                     
                    - Source + Source
                    -

                    - spawn/3 +

                    + binary_to_atom(some_binary)

                    -

                    Spawns the given module and function passing the given args -and returns its pid.

                    - -

                    Check the module Process for other functions that handle -process, including spawning functions in nodes.

                    +

                    Returns the atom whose text representation is +some_binary in UTF8 encoding. +Allowed in guard clauses.

                    Examples

                    -
                    spawn(SomeModule, :function, [1,2,3])
                    +
                    binary_to_atom "my_atom" #=> :my_atom
                     
                    - Source + Source
                    -

                    - spawn_link/1 +

                    + binary_to_atom(binary, encoding)

                    -

                    Spawns the given function, links it to the current process and returns its pid. -Check the module Process for other functions that handle -process, including spawning functions in nodes.

                    +

                    Returns the atom whose text representation is binary. If encoding is latin1, +no translation of bytes in the binary is done. If encoding is utf8 or unicode, +the binary must contain valid UTF-8 sequences; furthermore, only Unicode +characters up to 0xFF are allowed.

                    Examples

                    -
                    current = Process.self
                    -child   = spawn_link(fn -> current <- { Process.self, 1 + 2 } end)
                    -
                    -receive
                    -  { ^child, 3 } ->
                    -    IO.puts "Received 3 back"
                    -end
                    +
                    binary_to_atom("elixir", :utf8) #=> :elixir
                     
                    - Source + Source
                    -

                    - spawn_link/3 +

                    + binary_to_existing_atom(some_binary)

                    -

                    Spawns the given module and function passing the given args, -links it to the current process and returns its pid.

                    - -

                    Check the module Process for other functions that handle -process, including spawning functions in nodes.

                    +

                    Works like binary_to_atom but the atom must exist. +Allowed in guard clauses.

                    Examples

                    -
                    spawn_link(SomeModule, :function, [1,2,3])
                    +
                    :my_atom                          #=> :my_atom
                    +binary_to_existing_atom "my_atom" #=> :my_atom
                     
                    - Source + Source
                    -

                    - term_to_binary/1 +

                    + binary_to_existing_atom(binary, encoding)

                    -

                    Returns a binary data which is the result of encoding the given term -according to the Erlang external term format.

                    - -

                    This can be used for a variety of purposes, for example, writing a term -to a file in an efficient way, or sending an Erlang term to some type -of communications channel not supported by distributed Erlang.

                    +

                    Works like binary_to_atom/2, but the atom must already exist.

                    - Source + Source
                    -

                    - term_to_binary/2 +

                    + binary_to_list(binary)

                    -

                    The same as term_to_binary/1 but also supports two options:

                    - -
                      -
                    • compressed: the level of compression to be used from 0 to 9;
                    • -
                    • minorversion: used to control the details of encoding. Can be 0 or 1, -please read http://www.erlang.org/doc/man/erlang.html#termto_binary-2 -for more details
                    • -
                    +

                    Returns a list of integers which correspond to the bytes of binary.

                    - Source + Source
                    -

                    - throw/1 +

                    + binary_to_list(binary, start, stop)

                    -

                    A non-local return from a function. Check try/2 for more information.

                    +

                    As binarytolist/1, but returns a list of integers corresponding to the bytes +from position start to position stop in binary. Positions in the binary +are numbered starting from 1.

                    - Source + Source
                    -

                    - tl/1 +

                    + binary_to_term(binary)

                    -

                    Returns the tail of a list. Raises ArgumentError if the list is empty.

                    +

                    Returns an Erlang term which is the result of decoding the binary +object binary, which must be encoded according to the Erlang external +term format.

                    + +

                    Examples

                    + +
                    binary_to_term(term_to_binary("foo")) #=> "foo"
                    +
                    - Source + Source
                    -

                    - trunc/1 +

                    + binary_to_term(binary, options)

                    -

                    Returns an integer by the truncating the given number. -Allowed in guard clauses.

                    +

                    As binary_to_term/1, but accepts a safe option useful when receiving +binaries from an untrusted source.

                    + +

                    When enabled, it prevents decoding data that may be used to attack the +Erlang system. In the event of receiving unsafe data, decoding fails +with a badarg error.

                    + +

                    Currently, this prevents creation of new atoms directly, creation of +new atoms indirectly (as they are embedded in certain structures like pids, +refs, funs, etc), and creation of new external function references. None +of those resources are currently garbage collected, so unchecked creation +of them can exhaust available memory.

                    Examples

                    -
                    trunc(5.5) #=> 5
                    +
                    binary_to_term(term_to_binary("foo"), [:safe])
                     
                    - Source + Source
                    -

                    - tuple_size/1 +

                    + bit_size(bitstring)

                    -

                    Returns the size of a tuple.

                    +

                    Returns an integer which is the size in bits of bitstring.

                    + +

                    Allowed in guard tests.

                    + +

                    Examples

                    + +
                    bit_size(<<433|16,3|3>>) #=> 19
                    +bit_size(<<1,2,3>>) #=> 24
                    +
                    - Source + Source
                    -

                    - tuple_to_list/1 +

                    + bitstring_to_list(bitstring)

                    -

                    Converts a tuple to a list.

                    -
                    - Source -
                    -
                    - - - -
                    -

                    Macros

                    -
                    -

                    - !/1 -

                    -

                    Implements the unary operator ! as a macro. It receives any -argument and returns true if it is false or nil. Returns false -otherwise. Not allowed in guard clauses.

                    - -

                    Examples

                    - -

                    !1 #=> false - ![1,2,3] #=> false - !false #=> true - !nil #=> true

                    +

                    Returns a list of integers which correspond to the bytes of bitstring. If the +number of bits in the binary is not divisible by 8, the last element of the list will +be a bitstring containing the remaining bits (1 up to 7 bits).

                    - Source + Source
                    -

                    - !=/2 +

                    + byte_size(bitstring)

                    -

                    Returns true if the two items are not equal.

                    - -

                    This operator considers 1 and 1.0 to be equal. For strict -comparison, use !== instead.

                    - -

                    As Erlang, Elixir can compare any term. Allowed in guard clauses.

                    - -

                    Examples

                    +

                    Returns an integer which is the number of bytes needed to contain bitstring. +(That is, if the number of bits in Bitstring is not divisible by 8, the resulting +number of bytes will be rounded up.)

                    -
                    1 != 2
                    -#=> true
                    -1 != 1.0
                    -#=> false
                    -
                    -
                    - Source -
                    -

                    - !==/2 -

                    -

                    Returns true if the two items are strictly not equal. -As Erlang, Elixir can compare any term. Allowed in guard clauses.

                    +

                    Allowed in guard tests.

                    Examples

                    -
                    1 !== 2
                    -#=> true
                    -
                    -1 !== 1.0
                    -#=> true
                    +
                    byte_size(<<433|16,3|3>>) #=> 3
                    +byte_size(<<1,2,3>>) #=> 3
                     
                    - Source + Source
                    -

                    - &&/2 +

                    + case(condition, blocks)

                    -

                    Provides a short-circuit operator that executes the second -expression only if the first one evalutes to true (i.e. it is -not nil nor false). Returns the first expression otherwise.

                    +

                    Matches the given condition against the match clauses.

                    Examples

                    -
                    true && true         #=> true
                    -nil && true          #=> nil
                    -true && 1            #=> 1
                    -false && error(:bad) #=> false
                    +
                    case thing do
                    +  { :selector, i, value } when is_integer(i) ->
                    +    value
                    +  value -> value
                    +end
                     
                    -

                    Notice that, differently from Erlang and operator, -this operator accepts any expression as arguments, -not only booleans, however it is not allowed in guards.

                    -
                    - Source -
                    -

                    - */2 -

                    -

                    Arithmetic multiplication. Allowed in guard clauses.

                    +

                    In the example above, we compare thing with each given +match clause and execute the first one that matches. If no +clause matches, an error is raised.

                    -

                    Examples

                    +

                    Since Elixir variables can be assigned more than once, variables +in a match clause will always be assigned instead of matching with +its previous values. For example:

                    -
                    1 * 2 #=> 2
                    +
                    i = 1
                    +case 10 do
                    +  i -> i * 2
                    +end
                     
                    -
                    - Source -
                    -

                    - +/2 -

                    -

                    Arithmetic plus. Allowed in guard clauses.

                    -

                    Examples

                    +

                    The example above will return 20, because i is assgined to 10 +and then multiplied by 2. If you desire to match the value of i +against the given condition, you need to use the ^ operator:

                    -
                    1 + 2 #=> 3
                    +
                    i = 1
                    +case 10 do
                    +  ^i -> i * 2
                    +end
                     
                    -
                    - Source -
                    -

                    - ++/2 -

                    -

                    Concatenates two lists. Allowed in guard clauses.

                    -

                    Examples

                    +

                    The example above will actually fail because 10 does not match 1.

                    -
                    [1] ++ [2,3]
                    -#=> [1,2,3]
                    +

                    Finally, case accepts an else: branch as a fallback if none +of the clauses match:

                    -'foo' ++ 'bar' -#=> 'foobar' +
                    case thing do
                    +  { :selector, i, value } when is_integer(i) ->
                    +    value
                    +  _ ->
                    +    thing
                    +end
                     
                    - Source + Source
                    -

                    - -/2 +

                    + cond(list1)

                    -

                    Arithmetic minus. Allowed in guard clauses.

                    +

                    Execute the first clause where the condition returns true, +raises an error otherwise.

                    Examples

                    -
                    1 - 2 #=> -1
                    +
                    cond do
                    +  1 + 1 == 2 ->
                    +    "This will never match"
                    +  2 * 2 != 4 ->
                    +    "Nor this"
                    +  true ->
                    +    "This will"
                    +end
                     
                    - Source + Source
                    -

                    - --/2 +

                    + def(name, list2)

                    -

                    Removes the first occorrence of an item on the left -for each item on the right. Allowed in guard clauses.

                    +

                    Defines a function with the given name and contents.

                    Examples

                    -
                    [1,2,3] -- [1,2]
                    -#=> [3]
                    +
                    defmodule Foo do
                    +  def bar, do: :baz
                    +end
                     
                    -[1,2,3,2,1] -- [1,2,2]
                    -#=> [3,1]
                    +Foo.bar #=> :baz
                     
                    -
                    - Source -
                    -

                    - //2 -

                    -

                    Arithmetic division. Differently from other languages, -the result is always a float. Use div and rem if you want -a natural division or the remainder. Allowed in guard clauses.

                    -

                    Examples

                    +

                    A function that expects arguments can be defined as follow:

                    -
                    1 / 2 #=> 0.5
                    -2 / 1 #=> 2.0
                    +
                    defmodule Foo do
                    +  def sum(a, b) do
                    +    a + b
                    +  end
                    +end
                     
                    -
                    - Source -
                    -

                    - </2 -

                    -

                    Return true if left is less than right. -As Erlang, Elixir can compare any term. Allowed in guard clauses.

                    -

                    Examples

                    +

                    In the example above, we defined a function sum that receives +two arguments and sum them.

                    -
                    1 < 2
                    -#=> true
                    -
                    -
                    - Source -
                    -

                    - <-/2 -

                    -

                    Sends a message to the process identified on the left. -A process can be identified bu its PID or, if it is registered, -by an atom.

                    +

                    Dynamic generation with atoms

                    -

                    Examples

                    +

                    Elixir follows the same rule as Erlang when it comes to +function invocations. Calling a function is the same thing +as "invoking at atom". That said, we could invoke a function +named sum in these two equivalent ways:

                    -
                    process = Process.self
                    -process <- { :ok, "Sending myself a message" }
                    +
                    sum(1, 2)
                    +:sum.(1, 2)
                     
                    -
                    - Source -
                    -

                    - <=/2 -

                    -

                    Return true if left is less than or equal to right. -As Erlang, Elixir can compare any term. Allowed in guard clauses.

                    -

                    Examples

                    +

                    We can also use the atom format to define functions:

                    -
                    1 <= 2
                    -#=> true
                    +
                    defmodule Foo do
                    +  def :sum.(a, b) do
                    +    a + b
                    +  end
                    +end
                     
                    -
                    - Source -
                    -

                    - <>/2 -

                    -

                    Concatenates two binaries. Allowed in guard clauses.

                    -

                    Examples

                    +

                    In general, a developer never needs to use the format above +except when he wants to dynamically define functions with macros. +In such scenarios, the name needs to be given dynamically via +the unquoting mechanism.

                    -
                    "foo" <> "bar" #=> "foobar"
                    +

                    Imagine a macro that receives keywords and defines a function +for each entry in the keyword, using the key as function name +and the value as the value returned by the function:

                    + +
                    defmacro defkv(keywords) do
                    +  Enum.map keywords, fn {k,v} ->
                    +    quote do
                    +      def unquote(k).() do
                    +        unquote(v)
                    +      end
                    +    end
                    +  end
                    +end
                     
                    -

                    The <> operator can also be used in guard clauses as -long as the first part is a literal binary:

                    +

                    This macro could be invoked as:

                    -
                    "foo" <> x = "foobar"
                    -x #=> "bar"
                    +
                    defkv one: 1, two: 2
                     
                    + +

                    Notice in the example above, we define the function as def unquote(k).() +because each entry k is a an atom and invoking def unquote(k)() +would be invalid Elixir syntax.

                    - Source + Source
                    -

                    - ==/2 +

                    + def(name, args, guards, list4)

                    -

                    Returns true if the two items are equal.

                    +

                    This macro allows a function to be defined more explicitly +by accepting the name, args and guards as different entries.

                    -

                    This operator considers 1 and 1.0 to be equal. For strict -comparison, use === instead.

                    +

                    Differently from def/2, the macro arguments are evaluated +and therefore requires quoting.

                    -

                    As Erlang, Elixir can compare any term. Allowed in guard clauses.

                    +

                    The name must be an atom, the arguments a list where each +element represents another argument and guards a list of +clauses, where each clause is disjunct.

                    Examples

                    -
                    1 == 2
                    -#=> false
                    +

                    The most common mistake when using this macro is to pass the +arguments without quoting:

                    -1 == 1.0 -#=> true +
                    def :some_function, [first_arg, second_arg], is_list(first_arg) do
                    +  # ...
                    +end
                     
                    -
                    - Source -
                    -

                    - ===/2 -

                    -

                    Returns true if the two items are strictly equal. -As Erlang, Elixir can compare any term. Allowed in guard clauses.

                    -

                    Examples

                    +

                    However, the example above will fail because it will attempt to +evaluate [first_arg, second_arg] and fail because the variable +first_arg is not defined. Therefore, we need to use quote:

                    -
                    1 === 2
                    -#=> false
                    +
                    name   = :some_function
                    +args   = quote(do: [first_arg, second_arg])
                    +guards = quote(do: is_list(first_arg))
                     
                    -1 === 1.0
                    -#=> false
                    +def name, args, guards do
                    +  # ...
                    +end
                     
                    - Source + Source
                    -

                    - >/2 +

                    + defdelegate(funs, opts)

                    -

                    Return true if left is more than right. -As Erlang, Elixir can compare any term. Allowed in guard clauses.

                    - -

                    Examples

                    +

                    Defines the given functions in the current module that will +delegate to the given target. Functions defined with +defdelegate are public and are allowed to be invoked +from external. If you find yourself wishing to define a +delegation as private, you should likely use import +instead.

                    -
                    1 > 2
                    -#=> false
                    -
                    -
                    - Source -
                    -

                    - >=/2 -

                    -

                    Return true if left is more than or equal to right. -As Erlang, Elixir can compare any term. Allowed in guard clauses.

                    +

                    Delegation only works with functions, delegating to macros +is not supported.

                    -

                    Examples

                    +

                    Options

                    -
                    1 >= 2
                    -#=> false
                    -
                    -
                    - Source -
                    -

                    - __B__/2 -

                    -

                    Handles the sigil %B. It simples returns a binary -without escaping characters and without interpolations.

                    +
                      +
                    • :to - The expression to delegate to. Any expression +is allowed and its results will be calculated on runtime;

                    • +
                    • :as - The function to call on the target given in :to. +This parameter is optional and defaults to the name being +delegated.

                    • +
                    • :append_first - If true, when delegated, first argument +passed to the delegate will be relocated to the end of the +arguments when dispatched to the target. The motivation behind +this is a disparity between conventions used in Elixir and Erlang. +Elixir's convention is to pass the "handle" as a first argument, +while in Erlang the convention is to pass it as the last argument

                    • +

                    Examples

                    -
                    %B(foo)      #=> "foo"
                    -%B(f#{o}o)  #=> "f\#{o}o"
                    -
                    -
                    - Source -
                    -

                    - __C__/2 -

                    -

                    Handles the sigil %C. It simples returns a char list -without escaping characters and without interpolations.

                    +
                    defmodule MyList do
                    +  defdelegate reverse(list), to: Erlang.lists
                    +  defdelegate [reverse(list), map(callback, list)], to: Erlang.lists
                    +  defdelegate other_reverse(list), to: Erlang.lists, as: :reverse
                    +end
                     
                    -

                    Examples

                    +MyList.reverse([1,2,3]) +#=> [3,2,1] -
                    %C(foo)      #=> 'foo'
                    -%C(f#{o}o)  #=> 'f\#{o}o'
                    +MyList.other_reverse([1,2,3])
                    +#=> [3,2,1]
                     
                    - Source + Source
                    -

                    - __b__/2 +

                    + defexception(name, values, opts // [], do_block // [])

                    -

                    Handles the sigil %b. It returns a binary as if it was double quoted -string, unescaping characters and replacing interpolations.

                    +

                    Defines an exception.

                    -

                    Examples

                    +

                    Exceptions are simply records and therefore defexception/4 has +the same API and similar behavior to defrecord/4 with two notable +differences:

                    -
                    %b(foo)       #=> "foo"
                    -%b(f#{:o}o)  #=> "foo"
                    -
                    +

                    1) Differently from records, exceptions are documented by default; +2) Exceptions must implement message/1 as API and return a + binary as result;

                    - Source + Source
                    -

                    - __c__/2 +

                    + defimpl(name, opts, do_block // [])

                    -

                    Handles the sigil %c. It returns a char list as if it was a single -quoted string, unescaping characters and replacing interpolations.

                    - -

                    Examples

                    - -
                    %c(foo)       #=> 'foo'
                    -%c(f#{:o}o)  #=> 'foo'
                    -
                    +

                    Defines an implementation for the given protocol. See +defprotocol/2 for examples.

                    - Source + Source
                    -

                    - __r__/2 +

                    + defmodule(name, list2)

                    -

                    handles the sigil %r. It returns a Regex pattern.

                    +

                    Defines a module given by name with the given contents.

                    Examples

                    -
                    Regex.match? %r(foo), "foo"  #=> true
                    +
                    defmodule Foo do
                    +  def bar, do: :baz
                    +end
                    +
                    +Foo.bar #=> :baz
                     
                    -
                    - Source -
                    -

                    - access/2 -

                    -

                    Access the given element according the qualifier according -to the Access protocol. Many types implement the access -protocol, so check the protocol documentation for more -information.

                    -

                    It is important to notice the access protocol is also -allowed in function signatures when applying to references. -This is useful when working with records to allow to match -against an specific part of a record:

                    +

                    Nesting

                    + +

                    Nesting a module inside the other affects its name:

                    -
                    def uri_parse(Uri.Config[schema: :http])
                    +
                    defmodule Foo do
                    +  defmodule Bar do
                    +  end
                    +end
                     
                    -

                    In the example above, the schema clause will only match if -the config schema is :http. Using the access protocol with -a reference that does not point to a record module will -generate a compilation exception.

                    +

                    In the example above, two modules Foo and Foo.Bar. The +second can be accessed as Bar inside Foo in the same +lexical scope. If the module Bar is moved away to another +file, it needs to be referenced via the full name or an +alias need to be set with the help of Kernel.SpecialForms.alias/2.

                    + +

                    Dynamic names

                    -

                    Examples

                    +

                    Elixir module names can be dynamically generated. This is very +useful for macros. For instance, one could write:

                    -
                    a = { :a, :b, :c }
                    -a[1] #=> :a
                    -access a, 1 #=> :a
                    +
                    defmodule binary_to_atom("Foo#{1}", :utf8) do
                    +  # contents ...
                    +end
                     
                    + +

                    Elixir will accept any module name as long as the expression +returns an atom.

                    - Source + Source
                    -

                    - and/2 +

                    + defoverridable(tuples)

                    -

                    Boolean and. Arguments needs to necessarily be booleans. -Allowed in guard clauses.

                    - -

                    Examples

                    - -
                    true and false
                    -#=> false
                    -
                    +

                    Makes the given functions in the current module overridable. +An overridable function is lazily defined, allowing a +developer to customize it.

                    - Source + Source
                    -

                    - atom_to_binary/1 +

                    + defp(name, list2)

                    -

                    Returns a binary which corresponds to the text representation -of some_atom in UTF8 encoding. Allowed in guard clauses.

                    +

                    Defines a function that is private. Private functions +can only be accessible from the same module it is defined.

                    + +

                    Check def/2 for more information

                    Examples

                    -
                    atom_to_binary :my_atom #=> "my_atom"
                    +
                    defmodule Foo do
                    +  def bar do
                    +    sum(1, 2)
                    +  end
                    +
                    +  defp sum(a, b), do: a + b
                    +end
                     
                    + +

                    In the example above, sum is private and accessing it +through Foo.sum will raise an error.

                    - Source + Source
                    -

                    - binary_to_atom/1 +

                    + defp(name, args, guards, list4)

                    -

                    Returns the atom whose text representation is -some_binary in UTF8 encoding. -Allowed in guard clauses.

                    - -

                    Examples

                    - -
                    binary_to_atom "my_atom" #=> :my_atom
                    -
                    +

                    The same as def/4 but generates a private function.

                    - Source + Source
                    -

                    - binary_to_existing_atom/1 +

                    + defprotocol(name, list2)

                    -

                    Works like binary_to_atom but the atom must exist. -Allowed in guard clauses.

                    +

                    Defines the current module as a protocol and specifies the API +that should be implemented.

                    Examples

                    -
                    :my_atom                          #=> :my_atom
                    -binary_to_existing_atom "my_atom" #=> :my_atom
                    -
                    -
                    - Source -
                    -

                    - case/2 -

                    -

                    Matches the given condition against the match clauses.

                    +

                    In Elixir, only false and nil are considered falsy values. +Everything else evaluates to true in if clauses. Depending +on the application, it may be important to specify a blank? +protocol that returns a boolean for other data types that should +be considered blank?. For instance, an empty list or an empty +binary could be considered blanks.

                    -

                    Examples

                    +

                    We could implement this protocol as follow:

                    -
                    case thing do
                    -  { :selector, i, value } when is_integer(i) ->
                    -    value
                    -  value -> value
                    +
                    defprotocol Blank do
                    +  @doc "Returns true if data is considered blank/empty"
                    +  def blank?(data)
                     end
                     
                    -

                    In the example above, we compare thing with each given -match clause and execute the first one that matches. If no -clause matches, an error is raised.

                    - -

                    Since Elixir variables can be assigned more than once, variables -in a match clause will always be assigned instead of matching with -its previous values. For example:

                    +

                    Now that the protocol is defined, we can implement it. We need +to implement the protocol for each Elixir type. For example:

                    -
                    i = 1
                    -case 10 do
                    -  i -> i * 2
                    +
                    # Numbers are never blank
                    +defimpl Blank, for: Number do
                    +  def blank?(number), do: false
                     end
                    -
                    -

                    The example above will return 20, because i is assgined to 10 -and then multiplied by 2. If you desire to match the value of i -against the given condition, you need to use the ^ operator:

                    +# Just empty list is blank +defimpl Blank, for: List do + def blank?([]), do: true + def blank?(_), do: false +end -
                    i = 1
                    -case 10 do
                    -  ^i -> i * 2
                    +# Just the atoms false and nil are blank
                    +defimpl Blank, for: Atom do
                    +  def blank?(false), do: true
                    +  def blank?(nil),   do: true
                    +  def blank?(_),     do: false
                     end
                     
                    -

                    The example above will actually fail because 10 does not match 1.

                    +

                    And we would have to define the implementation for all types. +The types available are:

                    -

                    Finally, case accepts an else: branch as a fallback if none -of the clauses match:

                    +
                      +
                    • Record
                    • +
                    • Tuple
                    • +
                    • Atom
                    • +
                    • List
                    • +
                    • BitString
                    • +
                    • Number
                    • +
                    • Function
                    • +
                    • PID
                    • +
                    • Port
                    • +
                    • Reference
                    • +
                    • Any
                    • +
                    -
                    case thing do
                    -  { :selector, i, value } when is_integer(i) ->
                    -    value
                    -  _ ->
                    -    thing
                    +

                    Selecting implementations

                    + +

                    Implementing the protocol for all default types can be cumbersome. +Even more, if you consider that Number, Function, PID, Port and +Reference are never going to be blank, it would be easier if we +could simply provide a default implementation.

                    + +

                    This can be achieved with Elixir as follows:

                    + +
                    defprotocol Blank do
                    +  @only [Atom, Tuple, List, BitString, Any]
                    +  def blank?(data)
                     end
                     
                    -
                    - Source -
                    -

                    - cond/1 -

                    -

                    Execute the first clause where the condition returns true, -raises an error otherwise.

                    -

                    Examples

                    +

                    If the protocol is invoked with a data type that is not an Atom, +nor Tuple, nor List, nor BitString, Elixir will now dispatch to +Any. That said, the default behavior could be implemented as:

                    -
                    cond do
                    -  1 + 1 == 2 ->
                    -    "This will never match"
                    -  2 * 2 != 4 ->
                    -    "Nor this"
                    -  true ->
                    -    "This will"
                    +
                    defimpl Blank, for: Any do
                    +  def blank?(_), do: false
                    +end
                    +
                    + +

                    Now, all data types that we have not specified will be +automatically considered non blank.

                    + +

                    Protocols + Records

                    + +

                    The real benefit of protocols comes when mixed with records. For instance, +imagine we have a module called RedBlack that provides an API to create +and manipulate Red-Black trees. This module represents such trees via a +record named RedBlack.Tree and we want this tree to be considered blank +in case it has no items. To achieve this, the developer just needs to +implement the protocol for RedBlack.Tree:

                    + +
                    defimpl Blank, for: RedBlack.Tree do
                    +  def blank?(tree), do: RedBlack.empty?(tree)
                     end
                     
                    + +

                    In the example above, we have implemented blank? for RedBlack.Tree +that simply delegates to RedBlack.empty? passing the tree as argument. +This implementation doesn't need to be defined inside the RedBlack +tree or inside the record, but anywhere in the code.

                    + +

                    Finally, since records are simply tuples, one can add a default protocol +implementation to any record by defining a default implementation for tuples.

                    - Source + Source
                    -

                    - def/2 +

                    + defrecord(name, values, opts // [], do_block // [])

                    -

                    Defines a function with the given name and contents.

                    +

                    Define a record given by name and values.

                    Examples

                    -
                    defmodule Foo do
                    -  def bar, do: :baz
                    -end
                    +
                    defrecord FileInfo, atime: nil, mtime: nil
                    +
                    -Foo.bar #=> :baz +

                    The line above will define a module named FileInfo which +contains a function named new that returns a new record +and other functions to read and set the values in the +record. Therefore, we can do:

                    + +
                    file_info = FileInfo.new(atime: now())
                    +file_info.atime         #=> Returns the value of atime
                    +file_info.atime(now())  #=> Updates the value of atime
                     
                    -

                    A function that expects arguments can be defined as follow:

                    +

                    Internally, a record is simply a tuple where the first element is +the record module name. This can be noticed if we print the record:

                    -
                    defmodule Foo do
                    -  def sum(a, b) do
                    -    a + b
                    -  end
                    -end
                    +
                    IO.inspect FileInfo.new
                    +{ FileInfo, nil, nil }
                     
                    -

                    In the example above, we defined a function sum that receives -two arguments and sum them.

                    +

                    Default based functions

                    -

                    Dynamic generation with atoms

                    +

                    Depending on the default value, Elixir will define helpers to interact +with the record. For example, ExUnit defines a record which keeps +track of how many tests were executed and the failures that happened +The record definition is similar to:

                    -

                    Elixir follows the same rule as Erlang when it comes to -function invocations. Calling a function is the same thing -as "invoking at atom". That said, we could invoke a function -named sum in these two equivalent ways:

                    +
                    defrecord Config, counter: 0, failures: []
                    +
                    -
                    sum(1, 2)
                    -:sum.(1, 2)
                    +

                    Since counter is an integer, Elixir automatically defines a helper +named increment_counter that will increase the counter value:

                    + +
                    Config.new.increment_counter.counter #=> 1
                     
                    -

                    We can also use the atom format to define functions:

                    +

                    increment_counter also accepts a number of increment as argument:

                    -
                    defmodule Foo do
                    -  def :sum.(a, b) do
                    -    a + b
                    -  end
                    -end
                    +
                    Config.new.increment_counter(10).counter #=> 10
                     
                    -

                    In general, a developer never needs to use the format above -except when he wants to dynamically define functions with macros. -In such scenarios, the name needs to be given dynamically via -the unquoting mechanism.

                    +

                    Besides, if the default is a list, Elixir will define three helpers:

                    -

                    Imagine a macro that receives keywords and defines a function -for each entry in the keyword, using the key as function name -and the value as the value returned by the function:

                    +
                      +
                    • merge_field - Receives keywords and merge it into the current value;
                    • +
                    • prepend_field - Receives another list and prepend its values
                    • +
                    -
                    defmacro defkv(keywords) do
                    -  Enum.map keywords, fn {k,v} ->
                    -    quote do
                    -      def unquote(k).() do
                    -        unquote(v)
                    -      end
                    -    end
                    -  end
                    -end
                    -
                    +

                    Documentation

                    -

                    This macro could be invoked as:

                    +

                    By default records are not documented and have @moduledoc set to false. +This can be changed by passing a moduledoc option after values:

                    -
                    defkv one: 1, two: 2
                    +
                    defrecord Config, [counter: 0, failures: []], moduledoc: "A simple record"
                     
                    - -

                    Notice in the example above, we define the function as def unquote(k).() -because each entry k is a an atom and invoking def unquote(k)() -would be invalid Elixir syntax.

                    - Source + Source
                    -

                    - def/4 +

                    + destructure(left, right)

                    -

                    This macro allows a function to be defined more explicitly -by accepting the name, args and guards as different entries.

                    +

                    Allows you to destructure two lists, assigning each +term in the right to the left. Differently from pattern +matching via =, if the sizes of the left and right +lists don't match,, structuring simply stops instead +of raising an error.

                    -

                    Differently from def/2, the macro arguments are evaluated -and therefore requires quoting.

                    +

                    Examples

                    -

                    The name must be an atom, the arguments a list where each -element represents another argument and guards a list of -clauses, where each clause is disjunct.

                    +
                    destructure [x,y,z], [1,2,3,4,5]
                    +x #=> 1
                    +y #=> 2
                    +z #=> 3
                    +
                    -

                    Examples

                    +

                    Notice in the example above, even though the right +size has more entries than the left, structuring works +fine. If the right size is smaller, the remaining items +are simply assigned to nil:

                    -

                    The most common mistake when using this macro is to pass the -arguments without quoting:

                    +
                    destructure [x,y,z], [1]
                    +x #=> 1
                    +y #=> nil
                    +z #=> nil
                    +
                    -
                    def :some_function, [first_arg, second_arg], is_list(first_arg) do
                    -  # ...
                    -end
                    +

                    The left side supports any expression you would use +on the left side of a match:

                    + +
                    x = 1
                    +destructure [^x,y,z], [1,2,3]
                     
                    -

                    However, the example above will fail because it will attempt to -evaluate [first_arg, second_arg] and fail because the variable -first_arg is not defined. Therefore, we need to use quote:

                    +

                    The example above will only work if x matches +the first value from the right side. Otherwise, +it will raise a CaseClauseError.

                    +
                    + Source +
                    +

                    + div(left, right) +

                    +

                    Provides an integer division macro according to Erlang semantics. +Raises an error if one of the arguments is not an integer. +Can be used in guard tests.

                    -
                    name   = :some_function
                    -args   = quote(do: [first_arg, second_arg])
                    -guards = quote(do: is_list(first_arg))
                    +

                    Examples

                    -def name, args, guards do - # ... -end +
                    div 5, 2 #=> 2
                     
                    - Source + Source
                    -

                    - defdelegate/2 +

                    + elem(tuple, index)

                    -

                    Defines the given functions in the current module that will -delegate to the given target. Functions defined with defdelegate -are public and should be purposedly allowed to be invoked from -external. If you find yourself wishing to define a delegation -as private, you should likely use import instead.

                    +

                    Define elem to get Tuple element according to Elixir conventions. +We need to implement it as a macro to it can be used in guards.

                    -

                    Delegation only works with functions, delegating to macros -is not supported.

                    +

                    Example

                    -

                    Examples

                    +

                    tuple = { :foo, :bar, 3 } + elem(tuple, 1) #=> :foo

                    +
                    + Source +
                    +

                    + exit(reason) +

                    +

                    Stops the execution of the calling process with the given reason. +Since evaluating this function causes the process to terminate, +it has no return value.

                    -
                    defmodule MyList do
                    -  defdelegate [reverse: 1], to: Erlang.lists
                    -end
                    +

                    Examples

                    -MyList.reverse([1,2,3]) -#=> [3,2,1] +
                    exit(:normal)
                    +exit(:seems_bad)
                     
                    - Source + Source
                    -

                    - defexception/4 +

                    + float(number)

                    -

                    Defines an exception. It follows exactly the same API as record. -The defined record must implement message/1 as API, otherwise -an error is raised. Check exception.ex for examples.

                    +

                    Converts the given number to a float. Allowed in guard clauses.

                    - Source + Source
                    -

                    - defimpl/3 +

                    + float_to_list(number)

                    -

                    Defines an implementation for the given protocol. See -defprotocol/2 for examples.

                    +

                    Returns a char list which corresponds to the text representation of the given float.

                    + +

                    Examples

                    + +
                    float_to_list(7.0)
                    +#=> '7.00000000000000000000e+00'
                    +
                    - Source + Source
                    -

                    - defmodule/2 +

                    + function(args)

                    -

                    Defines a module given by name with the given contents.

                    +

                    Returns an anonymous function based on the given arguments.

                    Examples

                    -
                    defmodule Foo do
                    -  def bar, do: :baz
                    +
                    sum = function do
                    +  (x, y) -> x + y
                     end
                     
                    -Foo.bar #=> :baz
                    +sum.(1, 2) #=> 3
                     
                    -

                    Nesting

                    +

                    Notice that a function needs to be invoked using the dot between +the function and the arguments.

                    -

                    Nesting a module inside the other affects its name:

                    +

                    Multiple clauses can be specified as in case, receive and +similar macros:

                    -
                    defmodule Foo do
                    -  defmodule Bar do
                    -  end
                    +
                    sum = function do
                    +  x, y when y > 0 -> x + y
                    +  x, y -> x - y
                     end
                    +
                    +sum.(1, 2) #=> 3
                     
                    -

                    In the example above, two modules Foo and Foo.Bar. The -second can be accessed as Bar inside Foo in the same -lexical scope. If the module Bar is moved away to another -file, it needs to be referenced via the full name or a -reference need to be set with the help of refer/2.

                    +

                    Shortcut syntax

                    -

                    Dynamic names

                    +

                    In order to reduce verbosity, functions in Elixir can be written +using a shortcut syntax via fn:

                    -

                    Elixir module names can be dynamically generated. This is very -useful for macros. For instance, one could write:

                    +
                    Enum.map [1,2,3], fn x ->
                    +  x * 2
                    +end
                    +
                    -
                    defmodule binary_to_atom("Foo#{1}", :utf8) do
                    -  # contents ...
                    +

                    Not only the example is shorter, it solves ambiguity issues. Since +do/end always matches the furthest call, if we used the function +macro as below:

                    + +
                    Enum.map [1,2,3], function(x) do
                    +  x * 2
                     end
                     
                    -

                    Elixir will accept any module name as long as the expression -returns an atom.

                    +

                    It would be parsed as:

                    + +
                    Enum.map([1,2,3], function(x)) do
                    +  x * 2
                    +end
                    +
                    + +

                    The stab shortcut syntax has the proper precedence:

                    + +
                    Enum.map [1,2,3], fn x ->
                    +  x * 2
                    +end
                    +
                    + +

                    Which is handled as:

                    + +
                    Enum.map([1,2,3], fn x ->
                    +  x * 2
                    +end)
                    +
                    + +

                    Function retrieval

                    + +

                    The function macro can also be used to retrieve local or remote +functions:

                    + +
                    f = function(:is_atom, 2)
                    +f.(:foo) #=> true
                    +
                    +f = function(List, :flatten, 1)
                    +f.([1,[2],3]) #=> [1,2,3]
                    +
                    - Source + Source
                    -

                    - defoverridable/1 +

                    + function_exported?(module, function, arity)

                    -

                    Makes the given functions in the current module overridable. -An overridable function is lazily defined, allowing a -developer to customize it.

                    +

                    Returns true if the module is loaded and contains a +public function with the given arity, otherwise false.

                    + +

                    Notice that this function does not load the module in case +it is not loaded. Check Code.ensure_loaded/1 for more +information.

                    - Source + Source
                    -

                    - defp/2 +

                    + halt()

                    -

                    Defines a function that is private. Private functions -can only be accessible from the same module it is defined.

                    +

                    The same as halt(0, []).

                    +
                    + Source +
                    +

                    + halt(status) +

                    +

                    The same as halt(status, []).

                    +
                    + Source +
                    +

                    + halt(status, options) +

                    +

                    Halts the Erlang runtime system where the first argument status must be a +non-negative integer, a char list, or the atom :abort.

                    -

                    Check def/2 for more information

                    +
                      +
                    • If an integer, the runtime system exits with the integer value which +is returned to the Operating System;

                    • +
                    • If a char list, an erlang crash dump is produced with status as slogan, +and then the runtime system exits with status code 1;

                    • +
                    • If :abort, the runtime system aborts producing a core dump, if that is +enabled in the operating system.

                    • +
                    -

                    Examples

                    +

                    Note that on many platforms, only the status codes 0-255 are supported +by the operating system.

                    -
                    defmodule Foo do
                    -  def bar do
                    -    sum(1, 2)
                    -  end
                    +

                    For integer status, Erlang runtime system closes all ports and allows async +threads to finish their operations before exiting. To exit without such +flushing, pass options [flush: false] instead.

                    - defp sum(a, b), do: a + b -end -
                    +

                    Examples

                    -

                    In the example above, sum is private and accessing it -through Foo.sum will raise an error.

                    +
                    halt(0)
                    +halt(1, flush: false)
                    +halt(:abort)
                    +
                    - Source + Source
                    -

                    - defp/4 +

                    + hd(list)

                    -

                    The same as def/4 but generates a private function.

                    +

                    Returns the head of a list, raises badarg if the list is empty.

                    - Source + Source
                    -

                    - defprotocol/2 +

                    + if(condition, list2)

                    -

                    Defines the current module as a protocol and specifies the API -that should be implemented.

                    +

                    Provides an if macro. This macro expects the first argument to +be a condition and the rest are keywords arguments.

                    -

                    Examples

                    +

                    One-liner examples

                    -

                    In Elixir, only false and nil are considered falsy values. -Everything else evaluates to true in if clauses. Depending -on the application, it may be important to specify a blank? -protocol that returns a boolean for other data types that should -be considered blank?. For instance, an empty list or an empty -binary could be considered blanks.

                    +
                    if(foo, do: bar)
                    +
                    -

                    We could implement this protocol as follow:

                    +

                    In the example above, bar will be returned if foo evalutes to +true (i.e. it is not false nor nil). Otherwise, nil will be returned.

                    -
                    defprotocol Blank do
                    -  @doc "Returns true if data is considered blank/empty"
                    -  def blank?(data)
                    -end
                    +

                    An else option can be given to specify the opposite:

                    + +
                    if(foo, do: bar, else: bar)
                     
                    -

                    Now that the protocol is defined, we can implement it. We need -to implement the protocol for each Elixir type. For example:

                    +

                    Blocks examples

                    -
                    # Numbers are never blank
                    -defimpl Blank, for: Number do
                    -  def blank?(number), do: false
                    -end
                    +

                    Elixir also allows you to pass a block to the if macro. The first +example above would be translated to:

                    -# Just empty list is blank -defimpl Blank, for: List do - def blank?([]), do: true - def blank?(_), do: false +
                    if foo do
                    +  bar
                     end
                    +
                    -# Just the atoms false and nil are blank -defimpl Blank, for: Atom do - def blank?(false), do: true - def blank?(nil), do: true - def blank?(_), do: false +

                    Notice that do/end becomes delimiters. The second example would +then translate do:

                    + +
                    if foo do
                    +  bar
                    +else
                    +  baz
                     end
                     
                    -

                    And we would have to define the implementation for all types. -The types available are:

                    - -
                      -
                    • Record
                    • -
                    • Tuple
                    • -
                    • Atom
                    • -
                    • List
                    • -
                    • BitString
                    • -
                    • Number
                    • -
                    • Function
                    • -
                    • PID
                    • -
                    • Port
                    • -
                    • Reference
                    • -
                    • Any
                    • -
                    +

                    If you want to compare more than two clauses, you can use the cond/1 +macro.

                    +
                    + Source +
                    +

                    + in(left, right) +

                    +

                    Returns true if the element on the left is equal (==) to +any of the items in the right. For now, it only accepts +a list as the right argument.

                    -

                    Selecting implementations

                    +

                    Examples

                    -

                    Implementing the protocol for all default types can be cumbersome. -Even more, if you consider that Number, Function, PID, Port and -Reference are never going to be blank, it would be easier if we -could simply provide a default implementation.

                    +
                    x = 1
                    +x in [1,2,3] #=> true
                    +
                    -

                    This can be achieved with Elixir as follows:

                    +

                    This macro simply translates the expression above to:

                    -
                    defprotocol Blank do
                    -  @only [Atom, Tuple, List, BitString, Any]
                    -  def blank?(data)
                    -end
                    +
                    x == 1 or x == 2 or x == 3
                     
                    -

                    If the protocol is invoked with a data type that is not an Atom, -nor Tuple, nor List, nor BitString, Elixir will now dispatch to -Any. That said, the default behavior could be implemented as:

                    +

                    Clauses

                    -
                    defimpl Blank, for: Any do
                    -  def blank?(_), do: false
                    +

                    Whenever used inside a function or a case clause, you can +optionally omit the variable declaration, for example:

                    + +
                    case 3 do
                    +  x when x in [1,2] -> x * 2
                    +  _ -> 0
                     end
                     
                    -

                    Now, all data types that we have not specified will be -automatically considered non blank.

                    - -

                    Protocols + Records

                    +

                    Could be rewritten as:

                    -

                    The real benefit of protocols comes when mixed with records. For instance, -imagine we have a module called RedBlack that provides an API to create -and manipulate Red-Black trees. This module represents such trees via a -record named RedBlack.Tree and we want this tree to be considered blank -in case it has no items. To achieve this, the developer just needs to -implement the protocol for RedBlack.Tree:

                    - -
                    defimpl Blank, for: RedBlack.Tree do
                    -  def blank?(tree), do: RedBlack.empty?(tree)
                    +
                    case 3 do
                    +  x in [1,2] -> x * 2
                    +  _ -> 0
                     end
                     
                    -

                    In the example above, we have implemented blank? for RedBlack.Tree -that simply delegates to RedBlack.empty? passing the tree as argument. -This implementation doesn't need to be defined inside the RedBlack -tree or inside the record, but anywhere in the code.

                    - -

                    Finally, since records are simply tuples, one can add a default protocol -implementation to any record by defining a default implementation for tuples.

                    +

                    In this case, Elixir will automatically expand it and define +the variable for us.

                    - Source + Source
                    -

                    - defrecord/4 +

                    + inspect(arg)

                    -

                    Define a record given by name and values.

                    +

                    Inspect the given arguments according to the Binary.Inspect protocol.

                    Examples

                    -
                    defrecord FileInfo, atime: nil, mtime: nil
                    +
                    inspect(:foo)
                    +#=> ":foo"
                     
                    +
                    + Source +
                    +

                    + integer_to_list(number) +

                    +

                    Returns a char list which corresponds to the text representation of the given integer.

                    -

                    The line above will define a module named FileInfo which -contains a function named new that returns a new record -and other functions to read and set the values in the -record. Therefore, we can do:

                    +

                    Examples

                    -
                    file_info = FileInfo.new(atime: now())
                    -file_info.atime         #=> Returns the value of atime
                    -file_info.atime(now())  #=> Updates the value of atime
                    +
                    integer_to_list(7)
                    +#=> '7'
                     
                    +
                    + Source +
                    +

                    + integer_to_list(number, base) +

                    +

                    Returns a char list which corresponds to the text representation of the +given integer in the given case.

                    -

                    Internally, a record is simply a tuple where the first element is -the record module name. This can be noticed if we print the record:

                    +

                    Examples

                    -
                    IO.puts FileInfo.new
                    -{ FileInfo, nil, nil }
                    +
                    integer_to_list(1023, 16).
                    +#=> "3FF"
                     
                    +
                    + Source +
                    +

                    + iolist_size(item) +

                    +

                    Returns the size of an iolist.

                    -

                    Default based functions

                    - -

                    Depending on the default value, Elixir will define helpers to interact -with the record. For example, ExUnit defines a record which keeps -track of how many tests were executed and the failures that happened -The record definition is similar to:

                    +

                    Examples

                    -
                    defrecord Config, counter: 0, failures: []
                    +
                    iolist_size([1,2|<<3,4>>])
                    +#=> 4
                     
                    +
                    + Source +
                    +

                    + iolist_to_binary(item) +

                    +

                    Returns a binary which is made from the integers and binaries in iolist.

                    -

                    Since counter is an integer, Elixir automatically defines a helper -named increment_counter that will increase the counter value:

                    - -
                    Config.new.increment_counter.counter #=> 1
                    -
                    +

                    Examples

                    -

                    increment_counter also accepts a number of increment as argument:

                    +
                    bin1 = <<1,2,3>>
                    +bin2 = <<4,5>>
                    +bin3 = <<6>>
                     
                    -
                    Config.new.increment_counter(10).counter #=> 10
                    +iolist_to_binary([bin1,1,[2,3,bin2],4|bin3])
                    +#=> <<1,2,3,1,2,3,4,5,4,6>>
                     
                    +
                    + Source +
                    +

                    + is_atom(term) +

                    +

                    Returns true if term is an atom; otherwise returns false.

                    -

                    Besides, if the default is a list, Elixir will define three helpers:

                    +

                    Allowed in guard tests.

                    +
                    + Source +
                    +

                    + is_binary(term) +

                    +

                    Returns true if term is a binary; otherwise returns false.

                    -
                      -
                    • merge_field - Receives keywords and merge it into the current value;
                    • -
                    • prepend_field - Receives another list and prepend its values
                    • -
                    +

                    A binary always contains a complete number of bytes.

                    -

                    Documentation

                    +

                    Allowed in guard tests.

                    +
                    + Source +
                    +

                    + is_bitstring(term) +

                    +

                    Returns true if term is a bitstring (including a binary); otherwise returns false.

                    -

                    By default records are not documented and have @moduledoc set to false. -This can be changed by passing a moduledoc option after values:

                    +

                    Allowed in guard tests.

                    +
                    + Source +
                    +

                    + is_boolean(term) +

                    +

                    Returns true if term is either the atom true or the atom false (i.e. a boolean); +otherwise returns false.

                    -
                    defrecord Config, [counter: 0, failures: []], moduledoc: "A simple record"
                    -
                    +

                    Allowed in guard tests.

                    - Source + Source
                    -

                    - destructure/2 +

                    + is_exception(thing)

                    -

                    Allows you to destructure two lists, assigning each -term in the right to the left. Differently from pattern -matching via =, if the sizes of the left and right -lists don't match,, structuring simply stops instead -of raising an error.

                    +

                    Check if the given structure is an exception.

                    Examples

                    -
                    destructure [x,y,z], [1,2,3,4,5]
                    -x #=> 1
                    -y #=> 2
                    -z #=> 3
                    +
                    is_exception(Error.new) #=> true
                    +is_exception(1)         #=> false
                     
                    +
                    + Source +
                    +

                    + is_float(term) +

                    +

                    Returns true if term is a floating point number; otherwise returns false.

                    -

                    Notice in the example above, even though the right -size has more entries than the left, structuring works -fine. If the right size is smaller, the remaining items -are simply assigned to nil:

                    +

                    Allowed in guard tests.

                    +
                    + Source +
                    +

                    + is_function(term) +

                    +

                    Returns true if term is a function; otherwise returns false.

                    -
                    destructure [x,y,z], [1]
                    -x #=> 1
                    -y #=> nil
                    -z #=> nil
                    -
                    +

                    Allowed in guard tests.

                    +
                    + Source +
                    +

                    + is_function(term, arity) +

                    +

                    Returns true if term is a function that can be applied with arity number of arguments; +otherwise returns false.

                    -

                    The left side supports any expression you would use -on the left side of a match:

                    +

                    Allowed in guard tests.

                    +
                    + Source +
                    +

                    + is_integer(term) +

                    +

                    Returns true if term is an integer; otherwise returns false.

                    -
                    x = 1
                    -destructure [^x,y,z], [1,2,3]
                    -
                    +

                    Allowed in guard tests.

                    +
                    + Source +
                    +

                    + is_list(term) +

                    +

                    Returns true if term is a list with zero or more elements; otherwise returns false.

                    -

                    The example above will only work if x matches -the first value from the right side. Otherwise, -it will raise a CaseClauseError.

                    +

                    Allowed in guard tests.

                    - Source + Source
                    -

                    - div/2 +

                    + is_number(term)

                    -

                    Provides an integer division macro according to Erlang semantics. -Raises an error if one of the arguments is not an integer. -Can be used in guard tests.

                    +

                    Returns true if term is either an integer or a floating point number; +otherwise returns false.

                    + +

                    Allowed in guard tests.

                    +
                    + Source +
                    +

                    + is_pid(term) +

                    +

                    Returns true if term is a pid (process identifier); otherwise returns false.

                    + +

                    Allowed in guard tests.

                    +
                    + Source +
                    +

                    + is_port(term) +

                    +

                    Returns true if term is a port identifier; otherwise returns false.

                    + +

                    Allowed in guard tests.

                    +
                    + Source +
                    +

                    + is_record(thing, kind) +

                    +

                    Check if the given structure is a record. It is basically +a convenient macro that checks the structure is a tuple and +the first element matches the given kind.

                    Examples

                    -
                    5 div 2 #=> 2
                    +
                    defrecord Config, sample: nil
                    +
                    +is_record(Config.new, Config) #=> true
                    +is_record(Config.new, List)   #=> false
                     
                    - Source + Source
                    -

                    - elem/2 +

                    + is_reference(term)

                    -

                    Define elem to get Tuple element according to Elixir conventions. -We need to implement it as a macro to it can be used in guards.

                    +

                    Returns true if term is a reference; otherwise returns false.

                    -

                    Example

                    +

                    Allowed in guard tests.

                    +
                    + Source +
                    +

                    + is_regex(thing) +

                    +

                    Check if the given argument is a regex.

                    +
                    + Source +
                    +

                    + is_tuple(term) +

                    +

                    Returns true if term is a tuple; otherwise returns false.

                    -

                    tuple = { :foo, :bar, 3 } - elem(tuple, 1) #=> :foo

                    +

                    Allowed in guard tests.

                    - Source + Source
                    -

                    - if/2 +

                    + length(list)

                    -

                    Provides an if macro. This macro expects the first argument to -be a condition and the rest are keywords arguments.

                    +

                    Returns the length of list.

                    -

                    One-liner examples

                    +

                    Allowed in guard tests.

                    -
                    if(foo, do: bar)
                    -
                    +

                    Examples

                    -

                    In the example above, bar will be returned if foo evalutes to -true (i.e. it is not false nor nil). Otherwise, nil will be returned.

                    +
                    length([1,2,3,4,5,6,7,8,9]) #=> 9
                    +
                    +
                    + Source +
                    +

                    + list_to_atom(char_list) +

                    +

                    Returns the atom whose text representation is char_list.

                    -

                    An else option can be given to specify the opposite:

                    +

                    Examples

                    -
                    if(foo, do: bar, else: bar)
                    +
                    list_to_atom('elixir') #=> :elixir
                     
                    +
                    + Source +
                    +

                    + list_to_binary(char_list) +

                    +

                    Returns a binary which is made from the content of char_list.

                    -

                    Blocks examples

                    - -

                    Elixir also allows you to pass a block to the if macro. The first -example above would be translated to:

                    +

                    Examples

                    -
                    if foo do
                    -  bar
                    -end
                    +
                    list_to_binary('Elixir') #=> "Elixir"
                     
                    +
                    + Source +
                    +

                    + list_to_bitstring(bitstring_list) +

                    +

                    Returns a bitstring which is made from the integers and bitstrings in bitstring_list. +(the last tail in bitstring_list is allowed to be a bitstring.)

                    -

                    Notice that do/end becomes delimiters. The second example would -then translate do:

                    +

                    Examples

                    -
                    if foo do
                    -  bar
                    -else
                    -  baz
                    -end
                    -
                    +
                    bin1 = <<1,2,3>>
                    +bin2 = <<4,5>>
                    +bin3 = <<6,7|4>>
                     
                    -

                    If you want to compare more than two clauses, you can use the cond/1 -macro.

                    +list_to_bitstring([bin1,1,[2,3,bin2],4|bin3]) +#=> <<1,2,3,1,2,3,4,5,4,6,7|4>> +
                    - Source + Source
                    -

                    - in/2 +

                    + list_to_existing_atom(char_list)

                    -

                    Returns true if the element on the left is equal (==) to -any of the items in the right. For now, it only accepts -a list as the right argument. Useful in guard clauses.

                    +

                    Returns the atom whose text representation is char_list, but only if there already +exists such atom.

                    +
                    + Source +
                    +

                    + list_to_float(char_list) +

                    +

                    Returns the float whose text representation is char_list.

                    Examples

                    -
                    x = 1
                    -x in [1,2,3] #=> true
                    +
                    list_to_float('2.2017764e+0') #=> 2.2017764
                     
                    +
                    + Source +
                    +

                    + list_to_integer(char_list) +

                    +

                    Returns an integer whose text representation is char_list.

                    -

                    This macro simply translates the expression above to:

                    +

                    Examples

                    -
                    x == 1 or x == 2 or x == 3
                    +
                    list_to_integer('123') #=> 123
                     
                    - Source + Source
                    -

                    - inspect/1 +

                    + list_to_integer(char_list, base)

                    -

                    Inspect the given arguments according to the Binary.Inspect protocol.

                    +

                    Returns an integer whose text representation in base base is char_list.

                    Examples

                    -
                    inspect(:foo)
                    -#=> ":foo"
                    +
                    > list_to_integer('3FF', 16) #=> 1023
                     
                    - Source + Source
                    -

                    - is_exception/1 +

                    + list_to_pid(char_list)

                    -

                    Check if the given structure is an exception.

                    +

                    Returns a pid whose text representation is char_list.

                    + +

                    Warning:

                    + +

                    This function is intended for debugging and for use in the Erlang +operating system.

                    + +

                    It should not be used in application programs.

                    Examples

                    -
                    is_exception(Error.new) #=> true
                    -is_exception(1)         #=> false
                    +
                    list_to_pid('<0.41>') #=> <0.4.1>
                     
                    - Source + Source
                    -

                    - is_record/2 +

                    + list_to_tuple(list)

                    -

                    Check if the given structure is a record. It is basically -a convenient macro that checks the structure is a tuple and -the first element matches the given kind.

                    +

                    Returns a tuple which corresponds to list. list can contain any Erlang terms.

                    Examples

                    -
                    defrecord Config, sample: nil
                    -
                    -is_record(Config.new, Config) #=> true
                    -is_record(Config.new, List)   #=> false
                    +
                    list_to_tuple([share, [:elixir, 163]]). #=> {share, [:elixir, 163]}
                     
                    - Source + Source
                    -

                    - is_regex/1 +

                    + make_ref()

                    -

                    Check if the given argument is a regex.

                    +

                    Returns an almost unique reference.

                    + +

                    The returned reference will re-occur after approximately 2^82 calls; +therefore it is unique enough for practical purposes.

                    + +

                    Examples

                    + +
                    make_ref()
                    +#=> #Ref<0.0.0.135>
                    +
                    - Source + Source

                    - match?/2 + match?(left, right)

                    A convenient macro that checks if the right side matches the left side. The left side is allowed to be a match pattern.

                    @@ -2747,10 +2906,59 @@

                    Examples

                    Enum.filter list, match?({:a, x } when x < 2, &1)
                    - Source + Source +
                    +

                    + max(first, second) +

                    +

                    Return the biggest of the two given terms according to +Erlang's term ordering. If the terms compare equal, the +first one is returned.

                    + +

                    Examples

                    + +
                    max(1, 2) #=> 2
                    +
                    +
                    + Source +
                    +

                    + min(first, second) +

                    +

                    Return the smallest of the two given terms according to +Erlang's term ordering. If the terms compare equal, the +first one is returned.

                    + +

                    Examples

                    + +
                    min(1, 2) #=> 1
                    +
                    +
                    + Source +
                    +

                    + node() +

                    +

                    Returns an atom representing the name of the local node. +If the node is not alive, nonode@nohost is returned instead.

                    + +

                    Allowed in guard tests.

                    +
                    + Source +
                    +

                    + node(arg) +

                    +

                    Returns the node where the given argmuent is located. +The argument can be a pid, a reference, or a port. +If the local node is not alive, nonode@nohost is returned.

                    + +

                    Allowed in guard tests.

                    +
                    + Source

                    - not/1 + not(arg)

                    Boolean not. Argument needs to necessarily be a boolean. Allowed in guard clauses.

                    @@ -2761,10 +2969,10 @@

                    Examples

                    #=> true
                    - Source + Source

                    - or/2 + or(left, right)

                    Boolean or. Arguments needs to necessarily be booleans. Allowed in guard clauses.

                    @@ -2775,10 +2983,26 @@

                    Examples

                    #=> true
                    - Source + Source +
                    +

                    + pid_to_list(pid) +

                    +

                    Returns a char list which corresponds to the text representation of pid. +This function is intended for debugging and for use in the Erlang operating +system. It should not be used in application programs.

                    + +

                    Warning:

                    + +

                    This function is intended for debugging and for use in the Erlang +operating system.

                    + +

                    It should not be used in application programs.

                    +
                    + Source

                    - receive/1 + receive(args)

                    The current process will hang until it receives a message from other processes that matches the given clauses.

                    @@ -2791,7 +3015,7 @@

                    Examples

                    value when is_atom(value) -> value _ -> - IO.puts :standard_error, "Unexpected message received" + IO.puts :stderr, "Unexpected message received" end @@ -2806,10 +3030,10 @@

                    Examples

                    value when is_atom(value) -> value _ -> - IO.puts :standard_error, "Unexpected message received" + IO.puts :stderr, "Unexpected message received" after 5000 -> - IO.puts :standard_error, "No message in 5 seconds" + IO.puts :stderr, "No message in 5 seconds" end @@ -2823,10 +3047,10 @@

                    Examples

                    will occur immediately.

                  - Source + Source

                  - rem/2 + rem(left, right)

                  Provides an integer remainder macro according to Erlang semantics. Raises an error if one of the arguments is not an integer. @@ -2834,13 +3058,34 @@

                  Examples

                  Examples

                  -
                  5 rem 2 #=> 1
                  +
                  rem 5, 2 #=> 1
                   
                  - Source + Source +
                  +

                  + round(number) +

                  +

                  Returns an integer by rounding the given number. +Allowed in guard tests.

                  + +

                  Examples

                  + +
                  round(5.5) #=> 6
                  +
                  +
                  + Source +
                  +

                  + self() +

                  +

                  Returns the pid (process identifier) of the calling process. +Allowed in guard clauses.

                  +
                  + Source

                  - setelem/3 + setelem(tuple, index, value)

                  Define setelem to set Tuple element according to Elixir conventions. We need to implement it as a macro to it can be used in guards.

                  @@ -2850,10 +3095,131 @@

                  Example

                  tuple = { :foo, :bar, 3 } setelem(tuple, 1, :baz) #=> { :baz, :bar, 3 }

                  - Source + Source +
                  +

                  + size(arg) +

                  +

                  Returns the size of the given argument, which must be a tuple +or a binary. If possible, please use tuplesize or binarysize.

                  +
                  + Source +
                  +

                  + spawn(fun) +

                  +

                  Spawns the given function and returns its pid.

                  + +

                  Check the modules Process and Node for other functions +to handle processes, including spawning functions in nodes.

                  + +

                  Examples

                  + +
                  current = Process.self
                  +child   = spawn(fn -> current <- { Process.self, 1 + 2 } end)
                  +
                  +receive
                  +  { ^child, 3 } -> IO.puts "Received 3 back"
                  +end
                  +
                  +
                  + Source +
                  +

                  + spawn(module, fun, args) +

                  +

                  Spawns the given module and function passing the given args +and returns its pid.

                  + +

                  Check the modules Process and Node for other functions +to handle processes, including spawning functions in nodes.

                  + +

                  Examples

                  + +
                  spawn(SomeModule, :function, [1,2,3])
                  +
                  +
                  + Source +
                  +

                  + spawn_link(fun) +

                  +

                  Spawns the given function, links it to the current process and returns its pid.

                  + +

                  Check the modules Process and Node for other functions +to handle processes, including spawning functions in nodes.

                  + +

                  Examples

                  + +
                  current = Process.self
                  +child   = spawn_link(fn -> current <- { Process.self, 1 + 2 } end)
                  +
                  +receive
                  +  { ^child, 3 } ->
                  +    IO.puts "Received 3 back"
                  +end
                  +
                  +
                  + Source +
                  +

                  + spawn_link(module, fun, args) +

                  +

                  Spawns the given module and function passing the given args, +links it to the current process and returns its pid.

                  + +

                  Check the modules Process and Node for other functions +to handle processes, including spawning functions in nodes.

                  + +

                  Examples

                  + +
                  spawn_link(SomeModule, :function, [1,2,3])
                  +
                  +
                  + Source +
                  +

                  + term_to_binary(term) +

                  +

                  Returns a binary data which is the result of encoding the given term +according to the Erlang external term format.

                  + +

                  This can be used for a variety of purposes, for example, writing a term +to a file in an efficient way, or sending an Erlang term to some type +of communications channel not supported by distributed Erlang.

                  +
                  + Source +
                  +

                  + term_to_binary(term, opts) +

                  +

                  The same as term_to_binary/1 but also supports two options:

                  + + +
                  + Source +
                  +

                  + throw(term) +

                  +

                  A non-local return from a function. Check try/2 for more information.

                  +
                  + Source +
                  +

                  + tl(list) +

                  +

                  Returns the tail of a list. Raises ArgumentError if the list is empty.

                  +
                  + Source

                  - to_binary/1 + to_binary(arg)

                  Convert the argument to a string according to the Binary.Chars protocol. This is the function invoked when there is string interpolation.

                  @@ -2864,10 +3230,10 @@

                  Examples

                  #=> "foo"
                  - Source + Source

                  - to_char_list/1 + to_char_list(arg)

                  Convert the argument to a list according to the List.Chars protocol.

                  @@ -2877,10 +3243,23 @@

                  Examples

                  #=> 'foo'
                  - Source + Source +
                  +

                  + trunc(number) +

                  +

                  Returns an integer by the truncating the given number. +Allowed in guard clauses.

                  + +

                  Examples

                  + +
                  trunc(5.5) #=> 5
                  +
                  +
                  + Source

                  - try/1 + try(args)

                  Execute the given expressions and catch any error, exit or throw that may have happened.

                  @@ -2985,19 +3364,33 @@

                  Catching exits and Erlang errors

                  Although the second form should be avoided in favor of raise/rescue control mechanisms.

                  - Source + Source +
                  +

                  + tuple_size(tuple) +

                  +

                  Returns the size of a tuple.

                  +
                  + Source +
                  +

                  + tuple_to_list(tuple) +

                  +

                  Converts a tuple to a list.

                  +
                  + Source

                  - unless/2 + unless(clause, options)

                  Provides a unless macro that executes the expression unless a value evalutes to true. Check if for examples and documentation.

                  - Source + Source

                  - use/2 + use(module, args // [])

                  use is a simple mechanism for extending the current module with the given module.

                  @@ -3005,7 +3398,7 @@

                  Catching exits and Erlang errors

                  Examples

                  defmodule AssertionTest do
                  -  use ExUnit.Case
                  +  use ExUnit.Case, async: true
                   
                     def test_always_pass do
                       true = true
                  @@ -3019,7 +3412,7 @@ 

                  Examples

                  defmodule AssertionTest do
                     require ExUnit.Case
                  -  ExUnit.Case.__using__(AssertionTest)
                  +  ExUnit.Case.__using__([sync: true])
                   
                     def test_always_pass do
                       true = true
                  @@ -3027,19 +3420,19 @@ 

                  Examples

                  end
                  - Source + Source

                  - var!/1 + var!(var)

                  When used inside quoting, marks that the variable should not -be hygienezed. Check Elixir.SpecialForms.quote/1 for more +be hygienezed. Check Kernel.SpecialForms.quote/1 for more information.

                  - Source + Source

                  - xor/2 + xor(left, right)

                  Boolean xor. Arguments needs to necessarily be booleans. Allowed in guard clauses.

                  @@ -3050,10 +3443,10 @@

                  Examples

                  #=> true
                  - Source + Source

                  - ||/2 + ||(left, right)

                  Provides a short-circuit operator that executes the second expression only if the first one does not evalute to true (i.e. it @@ -3071,7 +3464,7 @@

                  Examples

                  this operator accepts any expression as arguments, not only booleans, however it is not allowed in guards.

                  - Source + Source
                  diff --git a/docs/stable/Keyword.KeyError.html b/docs/stable/Keyword.KeyError.html new file mode 100644 index 000000000..bb74ca1f6 --- /dev/null +++ b/docs/stable/Keyword.KeyError.html @@ -0,0 +1,167 @@ + + + + Keyword.KeyError + + + + + + + + + + + + +
                  +

                  + Keyword.KeyError + + exception + +

                  + + + + Source + + + + +

                  Fields (and defaults)

                  +
                    + +
                  • + + key: nil + +
                  • + +
                  + + + +

                  Functions summary

                  + + + + + + +
                  +

                  Functions

                  +
                  +

                  + exception(args) +

                  +
                  + Source +
                  +

                  + exception(args, self) +

                  +
                  + Source +
                  +

                  + key(record) +

                  +
                  + Source +
                  +

                  + key(value, record) +

                  +
                  + Source +
                  +

                  + message(exception) +

                  +
                  + Source +
                  +

                  + new() +

                  +
                  + Source +
                  +

                  + new(opts) +

                  +
                  + Source +
                  +

                  + to_keywords(record) +

                  +
                  + Source +
                  +

                  + update_key(function, record) +

                  +
                  + Source +
                  +
                  + + + +
                  + + diff --git a/docs/latest/Keyword.html b/docs/stable/Keyword.html similarity index 78% rename from docs/latest/Keyword.html rename to docs/stable/Keyword.html index 83a1ef8ec..6f1b1bdcc 100644 --- a/docs/latest/Keyword.html +++ b/docs/stable/Keyword.html @@ -46,7 +46,7 @@

                  - Source + Source @@ -70,6 +70,11 @@

                  Functions summary

                  get/3
                • +
                • + + get!/2 + +
                • get_values/2 @@ -131,7 +136,7 @@

                  Functions summary

                  Functions

                  - delete/2 + delete(keywords, key)

                  Deletes all entries in the keywords list for a specific key. If the key does not exist, returns the keywords list unchanged. @@ -144,19 +149,19 @@

                  Examples

                  Keyword.delete [b: 2], :a #=> [b: 2]
                  - Source + Source

                  - from_enum/1 + from_enum(enum)

                  Creates a Keyword from enum. Differently from Keyword.new that behaves as a dict, Keyword.from_enum do not remove duplicated entries.

                  - Source + Source

                  - get/3 + get(keywords, key, default // nil)

                  Gets the value for specific key.

                  @@ -173,10 +178,24 @@

                  Examples

                  Keyword.get [a: 1], :b, 3 #=> 3
                  - Source + Source +
                  +

                  + get!(list1, key) +

                  +

                  Gets the value for specific key. If key does not exist, +an error is raised.

                  + +

                  Examples

                  + +
                  Keyword.get! [a: 1], :a      #=> 1
                  +Keyword.get! [a: 1], :b      #=> raises KeyError[key: :b]
                  +
                  +
                  + Source

                  - get_values/2 + get_values(list1, key)

                  Gets all values for a specific key.

                  @@ -186,10 +205,10 @@

                  Examples

                  #=> [1,2]
                  - Source + Source

                  - key?/2 + key?(list1, key)

                  Returns whether a given key exists in the given keywords.

                  @@ -201,10 +220,10 @@

                  Examples

                  #=> false
                  - Source + Source

                  - keys/1 + keys(keywords)

                  Returns all keys from the keywords list. Duplicated keys appear duplicated in the final list of keys.

                  @@ -214,10 +233,10 @@

                  Examples

                  Keyword.keys [a: 1, b: 2] #=> [:a,:b]
                   
                  - Source + Source

                  - merge/2 + merge(d1, d2)

                  Merges two keywords lists into one. If they have duplicated entries, the one given as second argument wins.

                  @@ -228,10 +247,10 @@

                  Examples

                  #=> [a:3, b:2, d: 4]
                  - Source + Source

                  - merge/3 + merge(d1, d2, fun)

                  Merges two keywords lists into one. If they have duplicated entries, the given function is invoked to solve conflicts.

                  @@ -244,17 +263,17 @@

                  Examples

                  #=> [a:4, b:2, d: 4]
                  - Source + Source

                  - new/0 + new()

                  Returns an empty keywords list, i.e. an empty list.

                  - Source + Source

                  - new/1 + new(pairs)

                  Creates a Keyword from an enumerable. Similarly to dicts, duplicated entries are removed, the latest one prevails.

                  @@ -265,10 +284,10 @@

                  Examples

                  #=> [a: 2, b: 1]
                  - Source + Source

                  - new/2 + new(pairs, transform)

                  Creates a Keyword from an enumerable with the help of the transformation function. Duplicated @@ -280,10 +299,10 @@

                  Examples

                  #=> [a: :a, b: :b]
                  - Source + Source

                  - put/3 + put(list1, key, value)

                  Sets the given value under key.

                  @@ -299,10 +318,10 @@

                  Examples

                  #=> [a: 3, b: 2]
                  - Source + Source

                  - values/1 + values(keywords)

                  Returns all values.

                  @@ -311,7 +330,7 @@

                  Examples

                  Keyword.values [a: 1, b: 2] #=> [1,2]
                   
                  - Source + Source
                • diff --git a/docs/latest/List.Chars.Atom.html b/docs/stable/List.Chars.Atom.html similarity index 87% rename from docs/latest/List.Chars.Atom.html rename to docs/stable/List.Chars.Atom.html index 399c5fe76..6b2c6837d 100644 --- a/docs/latest/List.Chars.Atom.html +++ b/docs/stable/List.Chars.Atom.html @@ -29,7 +29,7 @@

                  - Source + Source @@ -54,10 +54,10 @@

                  Functions summary

                  Functions

                  - to_char_list/1 + to_char_list(atom)

                  - Source + Source
                  diff --git a/docs/latest/List.Chars.BitString.html b/docs/stable/List.Chars.BitString.html similarity index 87% rename from docs/latest/List.Chars.BitString.html rename to docs/stable/List.Chars.BitString.html index 728d91363..981bf34ee 100644 --- a/docs/latest/List.Chars.BitString.html +++ b/docs/stable/List.Chars.BitString.html @@ -29,7 +29,7 @@

                  - Source + Source @@ -54,10 +54,10 @@

                  Functions summary

                  Functions

                  - to_char_list/1 + to_char_list(bitstring)

                  - Source + Source
                diff --git a/docs/latest/List.Chars.List.html b/docs/stable/List.Chars.List.html similarity index 87% rename from docs/latest/List.Chars.List.html rename to docs/stable/List.Chars.List.html index 1af4f246c..5a8b40ce1 100644 --- a/docs/latest/List.Chars.List.html +++ b/docs/stable/List.Chars.List.html @@ -29,7 +29,7 @@

                - Source + Source @@ -54,10 +54,10 @@

                Functions summary

                Functions

                - to_char_list/1 + to_char_list(list)

                - Source + Source
                diff --git a/docs/latest/List.Chars.Number.html b/docs/stable/List.Chars.Number.html similarity index 87% rename from docs/latest/List.Chars.Number.html rename to docs/stable/List.Chars.Number.html index 4289bc97f..2edf4d347 100644 --- a/docs/latest/List.Chars.Number.html +++ b/docs/stable/List.Chars.Number.html @@ -29,7 +29,7 @@

                - Source + Source @@ -54,10 +54,10 @@

                Functions summary

                Functions

                - to_char_list/1 + to_char_list(integer)

                - Source + Source
                diff --git a/docs/latest/List.Chars.html b/docs/stable/List.Chars.html similarity index 91% rename from docs/latest/List.Chars.html rename to docs/stable/List.Chars.html index 3c25e4db8..e47ec9542 100644 --- a/docs/latest/List.Chars.html +++ b/docs/stable/List.Chars.html @@ -35,12 +35,12 @@

                to_char_list which does the conversion.

                The to_char_list function automatically imported -by Elixir.Builtin invokes this protocol.

                +by Kernel invokes this protocol.

              - Source + Source

              Implementations

              @@ -94,10 +94,10 @@

              Functions summary

              Functions

              - to_char_list/1 + to_char_list(xA)

              - Source + Source
            diff --git a/docs/latest/List.html b/docs/stable/List.html similarity index 80% rename from docs/latest/List.html rename to docs/stable/List.html index 33abcc599..01c671c83 100644 --- a/docs/latest/List.html +++ b/docs/stable/List.html @@ -39,7 +39,7 @@

            - Source + Source @@ -49,11 +49,6 @@

            Functions summary

            • - - access/2 - -
            • -
            • concat/1 @@ -73,11 +68,6 @@

              Functions summary

              duplicate/2
            • -
            • - - find_index/2 - -
            • flatten/1 @@ -178,16 +168,8 @@

              Functions summary

              Functions

              -

              - access/2 -

              -

              Simply invokes the Access protocol for the given list. -Check Access.List for more information.

              -
              - Source -

              - concat/1 + concat(list)

              Given a list of lists, concatenates the sublists into a single list.

              @@ -197,10 +179,10 @@

              Examples

              #=> [1,[2],3,4,5,6]
              - Source + Source

              - concat/2 + concat(list, elements)

              Concatenates the list on the right with the list on the left.

              @@ -214,10 +196,10 @@

              Examples

              #=> [1,2,3,4,5,6]
              - Source + Source

              - delete/2 + delete(list, item)

              Deletes the given item from the list. Returns a list without the item. If the item occurs more than once in the list, just the first occurrence @@ -229,10 +211,10 @@

              Examples

              #=> [2,3]
              - Source + Source

              - duplicate/2 + duplicate(elem, n)

              Duplicates the given element n times in a list.

              @@ -245,27 +227,10 @@

              Examples

              #=> [[1,2],[1,2]]
              - Source -
              -

              - find_index/2 -

              -

              Looks for a term in a list and returns its position. -If term is found in the first position, return 1. -If no terms not found in list, the return value is nil.

              - -

              Examples

              - -
              List.find_index ['a'], 'b'
              -#=> nil
              -List.find_index ['a'], 'a'
              -#=> 1
              -
              -
              - Source + Source

              - flatten/1 + flatten(list)

              Flattens the given list of nested lists. An optional tail can be given that will be added at the end of @@ -280,16 +245,16 @@

              Examples

              #=> [1,2,3,4,5]
              - Source + Source

              - flatten/2 + flatten(list, tail)

              - Source + Source

              - foldl/3 + foldl(list, acc, function)

              Folds (reduces) the given list to the left with a function. Requires an accumulator.

              @@ -303,10 +268,10 @@

              Examples

              #=> 2
              - Source + Source

              - foldr/3 + foldr(list, acc, function)

              Folds (reduces) the given list to the right with a function. Requires an accumulator.

              @@ -317,10 +282,10 @@

              Examples

              #=> -2
              - Source + Source

              - keydelete/3 + keydelete(list, item, position)

              Receives a list of tuples and deletes the first tuple where the item at position posistion matches with the @@ -338,10 +303,10 @@

              Examples

              #=> [{ :a, 1 }, { :b, 2 }]
              - Source + Source

              - keyfind/4 + keyfind(list, item, position, default // nil)

              Receives a list of tuples and returns the first tuple where the item at position posistion matches with the @@ -359,10 +324,10 @@

              Examples

              #=> nil
              - Source + Source

              - keymember?/3 + keymember?(list, item, position)

              Receives a list of tuples and returns true if there is a tuple where the item at position posistion matches @@ -380,10 +345,10 @@

              Examples

              #=> false
              - Source + Source

              - last/1 + last(list)

              Returns the last element in list or nil if the list is empty.

              @@ -397,10 +362,10 @@

              Examples

              #=> 3
              - Source + Source

              - member?/2 + member?(list, term)

              Checks if the given term is included in the list. This function simply delegates to lists:member @@ -415,10 +380,10 @@

              Examples

              #=> false
              - Source + Source

              - range/3 + range(first, last, step // nil)

              Returns a list of integers in the given range (both ends included when possible). An optional step can be provided as well (defaults to 1).

              @@ -435,10 +400,10 @@

              Examples

              List.range 5, 1, -2 #=> [5, 3, 1]
              - Source + Source

              - reverse/1 + reverse(list)

              Reverses the given list. This function simply delegates to lists:reverse which is implemented in C for performance.

              @@ -449,10 +414,10 @@

              Examples

              #=> [3,2,1]
              - Source + Source

              - sort/1 + sort(list)

              Sorts the list by comparing each term. For an alternative sorting algorithm, check Enum.qsort.

              @@ -463,10 +428,10 @@

              Examples

              #=> [1, 2, 3, 4, 7]
              - Source + Source

              - sort/2 + sort(list, fun)

              Sorts the list according to an ordering function. fun(a, b) should return true if a compares less than or equal to b, false otherwise.

              @@ -477,10 +442,10 @@

              Examples

              #=> [7, 4, 3, 2, 1]
              - Source + Source

              - uniq/1 + uniq(list)

              Returns a list without duplicated items.

              @@ -490,10 +455,10 @@

              Examples

              #=> [1,2,3]
              - Source + Source

              - unzip/1 + unzip(list)

              Unzips the given list of lists or tuples into separate lists and returns a list of lists.

              @@ -507,10 +472,10 @@

              Examples

              #=> [[1, 2, 3], [:a, :b, :c]]
              - Source + Source

              - wrap/1 + wrap(list)

              Wraps the argument in a list. If the argument is already a list, returns the list. @@ -521,10 +486,10 @@

              Examples

              List.wrap [1,2,3] #=> [1,2,3]
               
              - Source + Source

              - zip/1 + zip(list_of_lists)

              Zips corresponding elements from each list in list_of_lists.

              @@ -537,10 +502,10 @@

              Examples

              #=> [{1, 3, 5}]
              - Source + Source

              - zip/2 + zip(item1, item2)

              Zips corresponding elements from two lists (or tuples) into one list of tuples. The number of elements in the resulting list is equal to the length of the @@ -555,7 +520,7 @@

              Examples

              #=> [{1, 4}, {2, 5}]
              - Source + Source
              diff --git a/docs/stable/Macro.Env.html b/docs/stable/Macro.Env.html new file mode 100644 index 000000000..3f830967a --- /dev/null +++ b/docs/stable/Macro.Env.html @@ -0,0 +1,249 @@ + + + + Macro.Env + + + + + + + + + + + + +
              +

              + Macro.Env + + record + +

              + + + + Source + + + + +

              Fields (and defaults)

              +
                + +
              • + + module: nil + +
              • + +
              • + + file: nil + +
              • + +
              • + + line: nil + +
              • + +
              • + + function: nil + +
              • + +
              • + + aliases: nil + +
              • + +
              • + + context: nil + +
              • + +
              • + + requires: nil + +
              • + +
              • + + macros: nil + +
              • + +
              + + + +

              Functions summary

              + + + + + + +
              +

              Functions

              +
              +

              + __access__(caller, args) +

              +

              A record that contains compile time environment information, +It can be accessed at any time by calling ENV.

              +
              + Source +
              +

              + aliases(record) +

              +

              Returns a list of two item tuples, where the first +item is the aliased name and the second the actual name.

              +
              + Source +
              +

              + file(record) +

              +

              Returns the current file name as a binary.

              +
              + Source +
              +

              + function(record) +

              +

              Returns a tuple as { Atom, Integer }, where the first element +is the function name and the seconds its arity. Returns nil +if not inside a function.

              +
              + Source +
              +

              + in_guard?(record) +

              +

              Returns wether the compilation environment is currently +inside a guard.

              +
              + Source +
              +

              + in_match?(record) +

              +

              Returns wether the compilation environment is currently +inside a match clause.

              +
              + Source +
              +

              + line(record) +

              +

              Returns the current line as an integer.

              +
              + Source +
              +

              + location(record) +

              +

              Returns a keywords list containing the file and line +information as keys.

              +
              + Source +
              +

              + macros(record) +

              +

              Returns a list of macros imported from each module.

              +
              + Source +
              +

              + module(record) +

              +

              Returns the current module name.

              +
              + Source +
              +

              + requires(record) +

              +

              Returns the list of required modules.

              +
              + Source +
              +
              + + + +
              + + diff --git a/docs/stable/Macro.html b/docs/stable/Macro.html new file mode 100644 index 000000000..1d655ebfb --- /dev/null +++ b/docs/stable/Macro.html @@ -0,0 +1,238 @@ + + + + Macro + + + + + + + + + + + + +
              +

              + Macro + +

              + + +
              +

              This module provides conveniences for working with macros.

              + +
              + + + Source + + + + + + +

              Functions summary

              + + + + +

              Macros summary

              + + + + +
              +

              Functions

              +
              +

              + escape(tuple) +

              +

              Recursively escapes the given value so it can be inserted +into a syntax tree. Structures that are valid syntax nodes +(like atoms, integers, binaries) are represented by themselves.

              + +

              Examples

              + +
              Macro.escape(:foo)
              +#=> :foo
              +
              +Macro.escape({ :a, :b, :c })
              +#=> { :{}, 0, [:a, :b, :c] }
              +
              +
              + Source +
              +

              + expand(aliases, env) +

              +

              Receives an expression representation and expands it. The following +contents are expanded:

              + +
                +
              • Macros (local or remote);
              • +
              • Aliases are expanded (if possible) and return atoms;
              • +
              • All pseudo-variables (FILE, MODULE, etc);
              • +
              + +

              In case the expression cannot be expanded, it returns the expression itself.

              + +

              Notice that Macro.expand is not recursive and it does not +expand child expressions. For example, !some_macro will expand as:

              + +
              iex> IO.puts Macro.to_binary Macro.expand(quote(do: !some_macro), __ENV__)
              +case some_macro do
              +  false -> true
              +  nil   -> true
              +  _     -> false
              +end
              +
              + +

              Notice that the ! operator is a macro that expands to a case. +Even though some_macro is also a macro, it is not expanded +because it is a child expression given to ! as argument.

              + +

              Examples

              + +

              In the example below, we have a macro that generates a module +with a function named name_length that returns the length +of the module name. The value of this function will be calculated +at compilation time and not at runtime.

              + +

              Consider the implementation below:

              + +
              defmacro defmodule_with_length(name, do: block) do
              +  length = length(atom_to_list(name))
              +
              +  quote do
              +    defmodule unquote(name) do
              +      def name_length, do: unquote(length)
              +      unquote(block)
              +    end
              +  end
              +end
              +
              + +

              When invoked like this:

              + +
              defmodule_with_length My.Module do
              +  def other_function, do: ...
              +end
              +
              + +

              The compilation will fail because My.Module when quoted +is not an atom, but a syntax tree as follow:

              + +
              {:__aliases__, 0, [:My, :Module] }
              +
              + +

              That said, we need to expand the aliases node above to an +atom, so we can retrieve its length. Expanding the node is +not straight-forward because we also need to expand the +caller aliases. For example:

              + +
              alias MyHelpers, as: My
              +
              +defmodule_with_length My.Module do
              +  def other_function, do: ...
              +end
              +
              + +

              The final module name will be MyHelpers.Module and not +My.Module. With Macro.expand, such aliases are taken +into consideration. Local and remote macros are also +expanded. We could rewrite our macro above to use this +function as:

              + +
              defmacro defmodule_with_length(name, do: block) do
              +  expanded = Macro.expand(name, __CALLER__)
              +  length   = length(atom_to_list(expanded))
              +
              +  quote do
              +    defmodule unquote(name) do
              +      def name_length, do: unquote(length)
              +      unquote(block)
              +    end
              +  end
              +end
              +
              +
              + Source +
              +

              + to_binary(tree) +

              +

              Converts the given expression to a binary.

              + +

              Examples

              + +
              Macro.to_binary(quote do: foo.bar(1, 2, 3))
              +#=> "foo.bar(1, 2, 3)"
              +
              +
              + Source +
              +
              + + + +
              +

              Macros

              +
              +

              + binary_ops() +

              +

              Returns a list of binary operators. This is available +as a macro so it can be used in guard clauses.

              +
              + Source +
              +

              + unary_ops() +

              +

              Returns a list of unary operators. This is available +as a macro so it can be used in guard clauses.

              +
              + Source +
              +
              + +
              + + diff --git a/docs/latest/MatchError.html b/docs/stable/MatchError.html similarity index 71% rename from docs/latest/MatchError.html rename to docs/stable/MatchError.html index 58ecba564..a1aa5f729 100644 --- a/docs/latest/MatchError.html +++ b/docs/stable/MatchError.html @@ -29,7 +29,7 @@

              - Source + Source @@ -84,6 +84,11 @@

              Functions summary

              new/1
            • +
            • + + to_keywords/1 + +
            • update_actual/2 @@ -100,52 +105,58 @@

              Functions summary

              Functions

              - actual/1 + actual(record)

              - Source + Source

              - actual/2 + actual(value, record)

              - Source + Source

              - exception/1 + exception(args)

              - Source + Source

              - exception/2 + exception(args, self)

              - Source + Source

              - message/1 + message(exception)

              - Source + Source

              - new/0 + new()

              - Source + Source

              - new/1 + new(opts) +

              +
              + Source +
              +

              + to_keywords(record)

              - Source + Source

              - update_actual/2 + update_actual(function, record)

              - Source + Source
              diff --git a/docs/stable/Mix.Dep.html b/docs/stable/Mix.Dep.html new file mode 100644 index 000000000..d28778260 --- /dev/null +++ b/docs/stable/Mix.Dep.html @@ -0,0 +1,304 @@ + + + + Mix.Dep + + + + + + + + + + + + +
              +

              + Mix.Dep + + record + +

              + + +
              +

              This is a record that keeps information about your project +dependencies. It keeps:

              + +
                +
              • scm - a module representing the source code management tool (SCM) operations;
              • +
              • app - the app name as an atom;
              • +
              • requirements - a binary or regexp with the deps requirement;
              • +
              • status - the current status of dependency, check Mix.Deps.format_status/1 for more info;
              • +
              • opts - the options given by the developer
              • +
              + +
              + + + Source + + + + +

              Fields (and defaults)

              +
                + +
              • + + app: nil + +
              • + +
              • + + opts: nil + +
              • + +
              • + + requirement: nil + +
              • + +
              • + + scm: nil + +
              • + +
              • + + status: nil + +
              • + +
              + + + +

              Functions summary

              + + + + + + +
              +

              Functions

              +
              +

              + app(record) +

              +
              + Source +
              +

              + app(value, record) +

              +
              + Source +
              +

              + new() +

              +
              + Source +
              +

              + new(opts) +

              +
              + Source +
              +

              + opts(record) +

              +
              + Source +
              +

              + opts(value, record) +

              +
              + Source +
              +

              + requirement(record) +

              +
              + Source +
              +

              + requirement(value, record) +

              +
              + Source +
              +

              + scm(record) +

              +
              + Source +
              +

              + scm(value, record) +

              +
              + Source +
              +

              + status(record) +

              +
              + Source +
              +

              + status(value, record) +

              +
              + Source +
              +

              + to_keywords(record) +

              +
              + Source +
              +

              + update_app(function, record) +

              +
              + Source +
              +

              + update_opts(function, record) +

              +
              + Source +
              +

              + update_requirement(function, record) +

              +
              + Source +
              +

              + update_scm(function, record) +

              +
              + Source +
              +

              + update_status(function, record) +

              +
              + Source +
              +
              + + + +
              + + diff --git a/docs/stable/Mix.Deps.Lock.html b/docs/stable/Mix.Deps.Lock.html new file mode 100644 index 000000000..7cbcf7fc7 --- /dev/null +++ b/docs/stable/Mix.Deps.Lock.html @@ -0,0 +1,103 @@ + + + + Mix.Deps.Lock + + + + + + + + + + + + +
              +

              + Mix.Deps.Lock + +

              + + +
              +

              This is the module responsible to manage mix.lock file.

              + +
              + + + Source + + + + + + +

              Functions summary

              + + + + + + +
              +

              Functions

              +
              +

              + read() +

              +

              Read the file, returns a keywords list containing +the app name and its current lock information.

              +
              + Source +
              +

              + update_lock(deps, callback) +

              +

              Loop the given dependencies triggering the callback. +The callback receives the dependency and its current lock +(may be nil). The callback must return a lock or nil in +case a lock could not be retrieved.

              + +

              This function returns a list with the app names in the +given dependencies that got a lock.

              +
              + Source +
              +

              + write(dict) +

              +

              Receives a keywords list and writes it to the disk.

              +
              + Source +
              +
              + + + +
              + + diff --git a/docs/stable/Mix.Deps.html b/docs/stable/Mix.Deps.html new file mode 100644 index 000000000..fe69a1bcb --- /dev/null +++ b/docs/stable/Mix.Deps.html @@ -0,0 +1,194 @@ + + + + Mix.Deps + + + + + + + + + + + + +
              +

              + Mix.Deps + +

              + + +
              +

              A module with common functions to work with dependencies.

              + +
              + + + Source + + + + + + +

              Functions summary

              + + + + + + +
              +

              Functions

              +
              +

              + all() +

              +

              Returns all dependencies in as Mix.Dep record.

              + +

              Exceptions

              + +

              This function raises an exception in case the developer +provides a dependency in the wrong format.

              + +

              Statuses

              + +

              The status element in the tuple returns the current +situation of the repository. Check format_status/1 +for more information.

              +
              + Source +
              +

              + all(status) +

              +

              Get all dependencies that match the specific status.

              +
              + Source +
              +

              + by_name(given) +

              +

              Receives a list of deps names and returns deps records. +Raises an error if the dependency does not exist.

              +
              + Source +
              +

              + check_lock(dep, lock) +

              +

              Checks the lock for the given dependency and update its status accordingly.

              +
              + Source +
              +

              + deps_path() +

              +

              The default path for dependencies.

              +
              + Source +
              +

              + deps_path(arg1) +

              +

              Returns the path for the given dependency.

              +
              + Source +
              +

              + format_dep(arg1) +

              +

              Format the dependency for printing.

              +
              + Source +
              +

              + format_status(arg1) +

              +

              Formats the status of a dependency.

              +
              + Source +
              +

              + out_of_date?(arg1) +

              +

              Check if a dependency is out of date or not, considering its +lock status. Therefore, be sure to call check_lock before +invoking this function.

              +
              + Source +
              +

              + update_status(arg1) +

              +

              Receives a dependency and update its status

              +
              + Source +
              +
              + + + +
              + + diff --git a/docs/stable/Mix.Error.html b/docs/stable/Mix.Error.html new file mode 100644 index 000000000..8e248a5dd --- /dev/null +++ b/docs/stable/Mix.Error.html @@ -0,0 +1,156 @@ + + + + Mix.Error + + + + + + + + + + + + +
              +

              + Mix.Error + + exception + +

              + + + + Source + + + + +

              Fields (and defaults)

              +
                + +
              • + + message: nil + +
              • + +
              + + + +

              Functions summary

              + + + + + + +
              +

              Functions

              +
              +

              + exception(args) +

              +
              + Source +
              +

              + exception(args, self) +

              +
              + Source +
              +

              + message(record) +

              +
              + Source +
              +

              + message(value, record) +

              +
              + Source +
              +

              + new() +

              +
              + Source +
              +

              + new(opts) +

              +
              + Source +
              +

              + to_keywords(record) +

              +
              + Source +
              +

              + update_message(function, record) +

              +
              + Source +
              +
              + + + +
              + + diff --git a/docs/stable/Mix.Generator.html b/docs/stable/Mix.Generator.html new file mode 100644 index 000000000..17f4f4bdc --- /dev/null +++ b/docs/stable/Mix.Generator.html @@ -0,0 +1,148 @@ + + + + Mix.Generator + + + + + + + + + + + + +
              +

              + Mix.Generator + +

              + + +
              +

              Conveniences for working with paths and generating content.

              + +
              + + + Source + + + + + + +

              Functions summary

              + + + + +

              Macros summary

              + + + + +
              +

              Functions

              +
              +

              + create_directory(path) +

              +

              Creates a directory if one does not exist yet.

              +
              + Source +
              +

              + create_file(path, contents) +

              +

              Creates a file with the given contents. +If the file already exists, asks for user confirmation.

              +
              + Source +
              +
              + + + +
              +

              Macros

              +
              +

              + embed_template(name, contents) +

              +

              Embed a template given by contents into the current module.

              + +

              It will define a private function with the name followed by +_template that expects assigns as arguments.

              + +

              This function must be invoked passing a keywords list. +Each key in the keyword list can be accessed in the +template using the @ macro.

              + +

              For more information, check EEx.SmartEngine.

              +
              + Source +
              +

              + embed_text(name, contents) +

              +

              Embeds a text given by contents into the current module.

              + +

              It will define a private function with the name followed by +_text that expects no argument.

              +
              + Source +
              +

              + from_file(path) +

              +

              Reads the content from a file relative to the current +file and not relative to the cwd. Useful when used with +embed macros:

              + +
              embed_template :lib, from_file("../templates/lib.eex")
              +
              +
              + Source +
              +
              + +
              + + diff --git a/docs/stable/Mix.InvalidTaskError.html b/docs/stable/Mix.InvalidTaskError.html new file mode 100644 index 000000000..753eacc94 --- /dev/null +++ b/docs/stable/Mix.InvalidTaskError.html @@ -0,0 +1,167 @@ + + + + Mix.InvalidTaskError + + + + + + + + + + + + +
              +

              + Mix.InvalidTaskError + + exception + +

              + + + + Source + + + + +

              Fields (and defaults)

              +
                + +
              • + + task: nil + +
              • + +
              + + + +

              Functions summary

              + + + + + + +
              +

              Functions

              +
              +

              + exception(args) +

              +
              + Source +
              +

              + exception(args, self) +

              +
              + Source +
              +

              + message(exception) +

              +
              + Source +
              +

              + new() +

              +
              + Source +
              +

              + new(opts) +

              +
              + Source +
              +

              + task(record) +

              +
              + Source +
              +

              + task(value, record) +

              +
              + Source +
              +

              + to_keywords(record) +

              +
              + Source +
              +

              + update_task(function, record) +

              +
              + Source +
              +
              + + + +
              + + diff --git a/docs/stable/Mix.Local.html b/docs/stable/Mix.Local.html new file mode 100644 index 000000000..4dff0b954 --- /dev/null +++ b/docs/stable/Mix.Local.html @@ -0,0 +1,96 @@ + + + + Mix.Local + + + + + + + + + + + + +
              +

              + Mix.Local + +

              + + +
              +

              Module responsible to manage local .mix installation.

              + +
              + + + Source + + + + + + +

              Functions summary

              + + + + + + +
              +

              Functions

              +
              +

              + all_tasks() +

              +

              Returns all tasks modules in .mix/tasks.

              +
              + Source +
              +

              + append_tasks() +

              +

              Append local tasks path into Erlang code path.

              +
              + Source +
              +

              + tasks_path() +

              +

              The path for local tasks.

              +
              + Source +
              +
              + + + +
              + + diff --git a/docs/stable/Mix.NoProjectError.html b/docs/stable/Mix.NoProjectError.html new file mode 100644 index 000000000..918ab3ecf --- /dev/null +++ b/docs/stable/Mix.NoProjectError.html @@ -0,0 +1,156 @@ + + + + Mix.NoProjectError + + + + + + + + + + + + +
              +

              + Mix.NoProjectError + + exception + +

              + + + + Source + + + + +

              Fields (and defaults)

              +
                + +
              • + + message: "Could not find a Mix.Project" + +
              • + +
              + + + +

              Functions summary

              + + + + + + +
              +

              Functions

              +
              +

              + exception(args) +

              +
              + Source +
              +

              + exception(args, self) +

              +
              + Source +
              +

              + message(record) +

              +
              + Source +
              +

              + message(value, record) +

              +
              + Source +
              +

              + new() +

              +
              + Source +
              +

              + new(opts) +

              +
              + Source +
              +

              + to_keywords(record) +

              +
              + Source +
              +

              + update_message(function, record) +

              +
              + Source +
              +
              + + + +
              + + diff --git a/docs/stable/Mix.NoTaskError.html b/docs/stable/Mix.NoTaskError.html new file mode 100644 index 000000000..9b9a65b2a --- /dev/null +++ b/docs/stable/Mix.NoTaskError.html @@ -0,0 +1,167 @@ + + + + Mix.NoTaskError + + + + + + + + + + + + +
              +

              + Mix.NoTaskError + + exception + +

              + + + + Source + + + + +

              Fields (and defaults)

              +
                + +
              • + + task: nil + +
              • + +
              + + + +

              Functions summary

              + + + + + + +
              +

              Functions

              +
              +

              + exception(args) +

              +
              + Source +
              +

              + exception(args, self) +

              +
              + Source +
              +

              + message(exception) +

              +
              + Source +
              +

              + new() +

              +
              + Source +
              +

              + new(opts) +

              +
              + Source +
              +

              + task(record) +

              +
              + Source +
              +

              + task(value, record) +

              +
              + Source +
              +

              + to_keywords(record) +

              +
              + Source +
              +

              + update_task(function, record) +

              +
              + Source +
              +
              + + + +
              + + diff --git a/docs/stable/Mix.OutOfDateDepsError.html b/docs/stable/Mix.OutOfDateDepsError.html new file mode 100644 index 000000000..b03a3d22d --- /dev/null +++ b/docs/stable/Mix.OutOfDateDepsError.html @@ -0,0 +1,156 @@ + + + + Mix.OutOfDateDepsError + + + + + + + + + + + + +
              +

              + Mix.OutOfDateDepsError + + exception + +

              + + + + Source + + + + +

              Fields (and defaults)

              +
                + +
              • + + message: "Some dependencies are out of date, please run `mix deps.get` to proceed" + +
              • + +
              + + + +

              Functions summary

              + + + + + + +
              +

              Functions

              +
              +

              + exception(args) +

              +
              + Source +
              +

              + exception(args, self) +

              +
              + Source +
              +

              + message(record) +

              +
              + Source +
              +

              + message(value, record) +

              +
              + Source +
              +

              + new() +

              +
              + Source +
              +

              + new(opts) +

              +
              + Source +
              +

              + to_keywords(record) +

              +
              + Source +
              +

              + update_message(function, record) +

              +
              + Source +
              +
              + + + +
              + + diff --git a/docs/stable/Mix.Project.html b/docs/stable/Mix.Project.html new file mode 100644 index 000000000..90c110473 --- /dev/null +++ b/docs/stable/Mix.Project.html @@ -0,0 +1,125 @@ + + + + Mix.Project + + + + + + + + + + + + +
              +

              + Mix.Project + +

              + + +
              +

              A module that provides conveniences for defining and working +with projects.

              + +

              Examples

              + +

              In order to configure Mix, a developer needs to use +Mix.Project in a module and define a function named +project that returns a keywords list with configuration.

              + +
              defmodule MyApp do
              +  use Mix.Project
              +
              +  def project do
              +    [
              +      app: :my_app,
              +      vsn: "0.6.0"
              +    ]
              +  end
              +end
              +
              + +

              After defined, the configuration for this project can be read +as Mix.project/0. Notice that config won't fail if a +project is not defined, this allows many of mix tasks to work +even without a project.

              + +

              In case the developer needs a project or want to access a special +function in the project, he can access Mix.Project.current/0 +which fails with Mix.NoProjectError in case a project is not +defined.

              + +
              + + + Source + + + + + + +

              Functions summary

              + + + + + + +
              +

              Functions

              +
              +

              + behaviour_info(atom1) +

              +
              + Source +
              +

              + current() +

              +

              Retrieves the current project, raises an error +if there is no project set.

              +
              + Source +
              +

              + defined?() +

              +

              Returns true if a current project is defined.

              +
              + Source +
              +
              + + + +
              + + diff --git a/docs/stable/Mix.SCM.html b/docs/stable/Mix.SCM.html new file mode 100644 index 000000000..09d8a2b03 --- /dev/null +++ b/docs/stable/Mix.SCM.html @@ -0,0 +1,213 @@ + + + + Mix.SCM + + + + + + + + + + + + +
              +

              + Mix.SCM + +

              + + + + Source + + + + + + +

              Functions summary

              + + + + + + +
              +

              Functions

              +
              +

              + available() +

              +

              Returns all available SCM.

              +
              + Source +
              +

              + available?(path, opts) +

              +

              This behavior function receives a path, opts and returns +a boolean if the dependency is available.

              +
              + Source +
              +

              + behaviour_info(atom1) +

              +

              Register required callbacks.

              +
              + Source +
              +

              + check?(path, opts) +

              +

              This behavior function checks if the dependency is locked and +the current repository version matches the lock. Note that some +SCMs do not require a lock, for such, this function can simply +return true.

              +
              + Source +
              +

              + clean(path, opts) +

              +

              This behavior function should clean the given dependency.

              +
              + Source +
              +

              + consumes?(opts) +

              +

              This behavior function receives a keywords list of opts +and should return an updated list in case the SCM consumes +the available options. For example, when a developer specifies +a dependency:

              + +
              { "foo", "0.1.0", github: "foo/bar" }
              +
              + +

              Each registered SCM will be asked if they consume this dependency, +receiving [github: "foo/bar"] as argument. Since this option makes +sense for the Git SCM, it will return an update list of options +while other SCMs would simply return nil.

              +
              + Source +
              +

              + get(path, opts) +

              +

              This behavior function gets unchecked dependencies. +If the dependency is locked, it receives the lock under the +:lock key in opts. In case no lock is given, it must +return a new lock (if one exists). If a lock is given, +it must preferably return the same lock, but can return +a different one in case of failure.

              +
              + Source +
              +

              + key() +

              +

              This behavior function should retrieve an atom representing +the SCM key. In the dependency opts, a value for the given +must be found since it is used to print information about +the requested dependency.

              +
              + Source +
              +

              + register(mod) +

              +

              Register the scm repository with the given key and mod.

              +
              + Source +
              +

              + register_builtin() +

              +

              Register builtin SCMs.

              +
              + Source +
              +

              + update(path, opts) +

              +

              This behavior function updates dependencies. It may be +called either directly via deps.update or implicitly +by deps.get. In the first scenario, no lock is received, +while one is given in the second.

              +
              + Source +
              +
              + + + +
              + + diff --git a/docs/stable/Mix.Shell.Process.html b/docs/stable/Mix.Shell.Process.html new file mode 100644 index 000000000..aed8ea3ce --- /dev/null +++ b/docs/stable/Mix.Shell.Process.html @@ -0,0 +1,136 @@ + + + + Mix.Shell.Process + + + + + + + + + + + + +
              +

              + Mix.Shell.Process + +

              + + +
              +

              This is Mix shell that uses the current process mailbox +for communication instead of IO.

              + +

              When a developer calls info("hello"), the following +message will be sent to the current process:

              + +
              { :mix_shell, :info, ["hello"] }
              +
              + +

              This is mainly useful in tests, allowing us to assert +if given messages were received or not. Since we need +to guarantee a clean slate in between tests, there +is also a flush function responsible for flushing all +:mix_shell related tasks from the process inbox.

              + +
              + + + Source + + + + + + +

              Functions summary

              + + + + + + +
              +

              Functions

              +
              +

              + error(message) +

              +

              Simply forwards the message to the current process.

              +
              + Source +
              +

              + flush(callback // fn x -> + x +end) +

              +

              Flush all :mix_shell messages from the current process. +If a callback is given, it is invoked for each received message.

              + +

              Examples

              + +
              flush IO.inspect(&1)
              +
              +
              + Source +
              +

              + info(message) +

              +

              Simply forwards the message to the current process.

              +
              + Source +
              +

              + yes?(message) +

              +

              Simply forwards the message to the current process. +It also checks the inbox for an input message matching:

              + +
              { :mix_shell_input, :yes?, value }
              +
              + +

              If one does not exist, it will abort since there no shell +process input given. Value must be true or false.

              +
              + Source +
              +
              + + + +
              + + diff --git a/docs/stable/Mix.Shell.html b/docs/stable/Mix.Shell.html new file mode 100644 index 000000000..e9b9f0da6 --- /dev/null +++ b/docs/stable/Mix.Shell.html @@ -0,0 +1,111 @@ + + + + Mix.Shell + + + + + + + + + + + + +
              +

              + Mix.Shell + +

              + + +
              +

              This is Mix's default shell. +It simply prints messages to stdio and stderr.

              + +
              + + + Source + + + + + + +

              Functions summary

              + + + + + + +
              +

              Functions

              +
              +

              + behaviour_info(atom1) +

              +

              Define Mix.Shell callbacks.

              +
              + Source +
              +

              + error(message) +

              +

              Writes an error message to the shell followed by new line.

              +
              + Source +
              +

              + info(message) +

              +

              Writes a message to the shell followed by new line.

              +
              + Source +
              +

              + yes?(message) +

              +

              Receives a message and asks the user if he wants to proceed. +He must press enter or type anything that matches the a "yes" +regex %r/^Y(es)?$/i.

              +
              + Source +
              +
              + + + +
              + + diff --git a/docs/stable/Mix.Task.html b/docs/stable/Mix.Task.html new file mode 100644 index 000000000..35d17fb87 --- /dev/null +++ b/docs/stable/Mix.Task.html @@ -0,0 +1,210 @@ + + + + Mix.Task + + + + + + + + + + + + +
              +

              + Mix.Task + +

              + + +
              +

              A simple module that provides conveniences for creating tasks.

              + +
              + + + Source + + + + + + +

              Functions summary

              + + + + + + +
              +

              Functions

              +
              +

              + all_modules() +

              +

              Returns all loaded modules. Modules that were not yet loaded +won't show up. Check load_all/0 if you want to preload all tasks.

              +
              + Source +
              +

              + behaviour_info(atom1) +

              +
              + Source +
              +

              + clear() +

              +

              Clears all invoked tasks, allowing them to be reinvoked. +Returns an ordset with all the tasks invoked thus far.

              +
              + Source +
              +

              + get(task) +

              +

              Receives a task name and retrives the task module.

              + +

              Exceptions

              + +
                +
              • Mix.NoTaskError - raised if the task could not be found;
              • +
              • Mix.InvalidTaskError - raised if the task is not a valid Mix.Task
              • +
              +
              + Source +
              +

              + hidden?(module) +

              +

              Checks if the task is hidden or not. Returns a boolean.

              +
              + Source +
              +

              + load_all() +

              +

              Loads all tasks in all code paths.

              +
              + Source +
              +

              + moduledoc(module) +

              +

              Gets the moduledoc for the given module. +Returns the moduledoc or nil.

              +
              + Source +
              +

              + reenable(task) +

              +

              Reenables a given task so it can be executed again down the stack.

              +
              + Source +
              +

              + run(task, args // []) +

              +

              Runs a task with the given args.

              + +

              If the task was not yet invoked, it returns :ok.

              + +

              If the task was already invoked, it does not run the task +again and simply aborts with :noop.

              + +

              It may raise an exception if the task was not found +or it is invalid. Check get/2 for more information.

              +
              + Source +
              +

              + shortdoc(module) +

              +

              Gets the shortdoc for the given module. +Returns the shortdoc or nil.

              +
              + Source +
              +

              + task_name(module) +

              +

              Returns the task name for the given module.

              +
              + Source +
              +
              + + + +
              + + diff --git a/docs/stable/Mix.Tasks.Clean.html b/docs/stable/Mix.Tasks.Clean.html new file mode 100644 index 000000000..228bebf3c --- /dev/null +++ b/docs/stable/Mix.Tasks.Clean.html @@ -0,0 +1,77 @@ + + + + Mix.Tasks.Clean + + + + + + + + + + + + +
              +

              + Mix.Tasks.Clean + +

              + + +
              +

              Clean generated application files.

              + +

              Command line options

              + +
                +
              • --all - Clean everything, including dependencies
              • +
              + +
              + + + Source + + + + + + +

              Functions summary

              + + + + + + +
              +

              Functions

              +
              +

              + run(args) +

              +
              + Source +
              +
              + + + +
              + + diff --git a/docs/stable/Mix.Tasks.Compile.App.html b/docs/stable/Mix.Tasks.Compile.App.html new file mode 100644 index 000000000..1de7f169d --- /dev/null +++ b/docs/stable/Mix.Tasks.Compile.App.html @@ -0,0 +1,95 @@ + + + + Mix.Tasks.Compile.App + + + + + + + + + + + + +
              +

              + Mix.Tasks.Compile.App + +

              + + +
              +

              Writes an .app file.

              + +

              By default, this task will detect all modules in your compile_path +(default to "ebin") and generate a best guess for your application +specification. This best guess also includes "kernel", "stdlib" +and "elixir" as application dependencies.

              + +

              You can optionally define an application/0 function inside your +Mix.Project that returns a keywords list to further configure +your application according to OTP design principles:

              + +

              http://www.erlang.org/doc/design_principles/applications.html

              + +

              Configuration

              + +
                +
              • :app - The application name as a binary (required)
              • +
              • :version - The application version as a binary (required)
              • +
              + +

              Command line options

              + +
                +
              • --force forces compilation regardless of mod times
              • +
              + +
              + + + Source + + + + + + +

              Functions summary

              + + + + + + +
              +

              Functions

              +
              +

              + run(args) +

              +
              + Source +
              +
              + + + +
              + + diff --git a/docs/stable/Mix.Tasks.Compile.Elixir.html b/docs/stable/Mix.Tasks.Compile.Elixir.html new file mode 100644 index 000000000..07036492f --- /dev/null +++ b/docs/stable/Mix.Tasks.Compile.Elixir.html @@ -0,0 +1,109 @@ + + + + Mix.Tasks.Compile.Elixir + + + + + + + + + + + + +
              +

              + Mix.Tasks.Compile.Elixir + +

              + + +
              +

              A task to compile Elixir source files.

              + +

              When this task runs, it will first check the mod times of +all of the files to be compiled and if they haven't been +changed since the last compilation, it will not compile +them at all. If any one of them has changed, it compiles +everything.

              + +

              For this reason, this task touches your :compile_path +directory and sets the modification time to the current +time and date at the end of each compilation. You can +force compilation regardless of mod times by passing +the --force option.

              + +

              Configuration

              + +
                +
              • :source_paths - directories to find source files. +Defaults to ["lib"], can be configured as:

                + +

                [source_paths: ["lib", "other"]]

              • +
              • :compile_path - directory to output compiled files. +Defaults to "ebin", can be configured as:

                + +

                [compile_path: "ebin"]

              • +
              • :compile_first - which files need to be compiled first. +Defaults to an empty list, can be configured as:

                + +

                [compile_first: ["lib/foo.ex" "lib/bar.ex"]]

              • +
              • :elixirc_options - compilation options that applies +to Elixir's compiler, they are: :ignore_module_conflict, +:docs and :debug_info. They all default to false.

              • +
              + +

              Command line options

              + +
                +
              • --force - forces compilation regardless of mod times;
              • +
              + +
              + + + Source + + + + + + +

              Functions summary

              + + + + + + +
              +

              Functions

              +
              +

              + run(args) +

              +
              + Source +
              +
              + + + +
              + + diff --git a/docs/stable/Mix.Tasks.Compile.html b/docs/stable/Mix.Tasks.Compile.html new file mode 100644 index 000000000..c9a9ade06 --- /dev/null +++ b/docs/stable/Mix.Tasks.Compile.html @@ -0,0 +1,93 @@ + + + + Mix.Tasks.Compile + + + + + + + + + + + + +
              +

              + Mix.Tasks.Compile + +

              + + +
              +

              A meta task that compile source files. It simply runs the +compilers registered in your project. At the end of compilation +it ensures load paths are set.

              + +

              Configuration

              + +
                +
              • :compilers - compilers to be run, defaults to:

                + +

                [:elixir, :app]

              • +
              + +

              It can be configured to handle custom compilers, for example:

              + +
              [compilers: [:elixir, :mycompiler, :app]]
              +
              + +

              Command line options

              + +
                +
              • --list - List all enabled compilers.
              • +
              • --no-check - Skip dependencies check before compilation.
              • +
              + +
              + + + Source + + + + + + +

              Functions summary

              + + + + + + +
              +

              Functions

              +
              +

              + run(args) +

              +
              + Source +
              +
              + + + +
              + + diff --git a/docs/stable/Mix.Tasks.Deps.Check.html b/docs/stable/Mix.Tasks.Deps.Check.html new file mode 100644 index 000000000..0b62a7398 --- /dev/null +++ b/docs/stable/Mix.Tasks.Deps.Check.html @@ -0,0 +1,75 @@ + + + + Mix.Tasks.Deps.Check + + + + + + + + + + + + +
              +

              + Mix.Tasks.Deps.Check + +

              + + +
              +

              Checks if all dependencies are valid and if not, abort. +Prints the invalid dependencies status before aborting.

              + +

              This task is not shown in mix help but it is part +of mix public API and can be depended on.

              + +
              + + + Source + + + + + + +

              Functions summary

              + + + + + + +
              +

              Functions

              +
              +

              + run(_) +

              +
              + Source +
              +
              + + + +
              + + diff --git a/docs/stable/Mix.Tasks.Deps.Clean.html b/docs/stable/Mix.Tasks.Deps.Clean.html new file mode 100644 index 000000000..d18681e20 --- /dev/null +++ b/docs/stable/Mix.Tasks.Deps.Clean.html @@ -0,0 +1,75 @@ + + + + Mix.Tasks.Deps.Clean + + + + + + + + + + + + +
              +

              + Mix.Tasks.Deps.Clean + +

              + + +
              +

              Clean dependencies.

              + +

              By default, cleans all dependencies. A list of deps can +be given to clean specific ones. Clean does not unlock +the repositories, unless --unlock is given.

              + +
              + + + Source + + + + + + +

              Functions summary

              + + + + + + +
              +

              Functions

              +
              +

              + run(args) +

              +
              + Source +
              +
              + + + +
              + + diff --git a/docs/stable/Mix.Tasks.Deps.Compile.html b/docs/stable/Mix.Tasks.Deps.Compile.html new file mode 100644 index 000000000..9a2a5562a --- /dev/null +++ b/docs/stable/Mix.Tasks.Deps.Compile.html @@ -0,0 +1,96 @@ + + + + Mix.Tasks.Deps.Compile + + + + + + + + + + + + +
              +

              + Mix.Tasks.Deps.Compile + +

              + + +
              +

              Compile dependencies.

              + +

              By default, compile all dependencies. A list of deps can +be given to force the compilation of specific deps.

              + +

              By default, it tries to detect if the project contains one of +the following files:

              + +
                +
              • mix.exs - if so, invokes mix compile
              • +
              • rebar.config - if so, invokes rebar compile
              • +
              • Makefile - if so, invokes make
              • +
              + +

              The compilation can be customized by passing a compile option +in the dependency:

              + +
              { :some_dependency, "0.1.0", git: "...", compile: :compile_some_dependency }
              +
              + +

              If the compile option is an atom, it will invoke the given atom +in the current project passing the app name as argument. Except +if the atom is :noop, where nothing is done.

              + +

              If a binary, it is considered to be command line instructions +which mix will use to shell out.

              + +
              + + + Source + + + + + + +

              Functions summary

              + + + + + + +
              +

              Functions

              +
              +

              + run(args) +

              +
              + Source +
              +
              + + + +
              + + diff --git a/docs/stable/Mix.Tasks.Deps.Get.html b/docs/stable/Mix.Tasks.Deps.Get.html new file mode 100644 index 000000000..9e0b1bced --- /dev/null +++ b/docs/stable/Mix.Tasks.Deps.Get.html @@ -0,0 +1,72 @@ + + + + Mix.Tasks.Deps.Get + + + + + + + + + + + + +
              +

              + Mix.Tasks.Deps.Get + +

              + + +
              +

              Get all out of date dependencies, i.e. dependencies +that are not available or have a wrong lock.

              + +
              + + + Source + + + + + + +

              Functions summary

              + + + + + + +
              +

              Functions

              +
              +

              + run(args) +

              +
              + Source +
              +
              + + + +
              + + diff --git a/docs/stable/Mix.Tasks.Deps.Loadpaths.html b/docs/stable/Mix.Tasks.Deps.Loadpaths.html new file mode 100644 index 000000000..22cc8eec8 --- /dev/null +++ b/docs/stable/Mix.Tasks.Deps.Loadpaths.html @@ -0,0 +1,75 @@ + + + + Mix.Tasks.Deps.Loadpaths + + + + + + + + + + + + +
              +

              + Mix.Tasks.Deps.Loadpaths + +

              + + +
              +

              Loads all dependencies. Invokes "deps.check" before +unless --no-check is given.

              + +

              This task is not shown in mix help but it is part +of mix public API and can be depended on.

              + +
              + + + Source + + + + + + +

              Functions summary

              + + + + + + +
              +

              Functions

              +
              +

              + run(args) +

              +
              + Source +
              +
              + + + +
              + + diff --git a/docs/latest/Enum.Iterator.Orddict.Record.html b/docs/stable/Mix.Tasks.Deps.Unlock.html similarity index 70% rename from docs/latest/Enum.Iterator.Orddict.Record.html rename to docs/stable/Mix.Tasks.Deps.Unlock.html index 44ef38382..cf90c64ec 100644 --- a/docs/latest/Enum.Iterator.Orddict.Record.html +++ b/docs/stable/Mix.Tasks.Deps.Unlock.html @@ -1,7 +1,7 @@ - Enum.Iterator.Orddict.Record + Mix.Tasks.Deps.Unlock @@ -21,15 +21,19 @@

              - Enum.Iterator.Orddict.Record - - impl + Mix.Tasks.Deps.Unlock

              +
              +

              Unlock the given dependencies. If no dependencies +are given, unlock all.

              + +
              + - Source + Source @@ -40,7 +44,7 @@

              Functions summary

              • - iterator/1 + run/1
              • @@ -53,11 +57,11 @@

                Functions summary

                Functions

                -

                - iterator/1 +

                + run(args)

                - Source + Source
                diff --git a/docs/stable/Mix.Tasks.Deps.Update.html b/docs/stable/Mix.Tasks.Deps.Update.html new file mode 100644 index 000000000..1b02de7cd --- /dev/null +++ b/docs/stable/Mix.Tasks.Deps.Update.html @@ -0,0 +1,75 @@ + + + + Mix.Tasks.Deps.Update + + + + + + + + + + + + +
                +

                + Mix.Tasks.Deps.Update + +

                + + +
                +

                Update dependencies.

                + +

                By default, updates all dependencies. A list of deps can +be given to update specific ones. Recompiles the given +projects after updating.

                + +
                + + + Source + + + + + + +

                Functions summary

                + + + + + + +
                +

                Functions

                +
                +

                + run(args) +

                +
                + Source +
                +
                + + + +
                + + diff --git a/docs/stable/Mix.Tasks.Deps.html b/docs/stable/Mix.Tasks.Deps.html new file mode 100644 index 000000000..0f6615bb9 --- /dev/null +++ b/docs/stable/Mix.Tasks.Deps.html @@ -0,0 +1,78 @@ + + + + Mix.Tasks.Deps + + + + + + + + + + + + +
                +

                + Mix.Tasks.Deps + +

                + + +
                +

                List all dependencies and their status. +The output is given as follow:

                + +
                  +
                • APP [VERSION] SCM: LOCATION +[locked at REF] +STATUS
                • +
                + +
                + + + Source + + + + + + +

                Functions summary

                + + + + + + +
                +

                Functions

                +
                +

                + run(_) +

                +
                + Source +
                +
                + + + +
                + + diff --git a/docs/stable/Mix.Tasks.Do.html b/docs/stable/Mix.Tasks.Do.html new file mode 100644 index 000000000..87d35adf4 --- /dev/null +++ b/docs/stable/Mix.Tasks.Do.html @@ -0,0 +1,79 @@ + + + + Mix.Tasks.Do + + + + + + + + + + + + +
                +

                + Mix.Tasks.Do + +

                + + +
                +

                Executes the commands separated by comma.

                + +

                Examples

                + +

                The example below prints the available compilers and +then the list of dependencies.

                + +
                mix do compile --list, deps
                +
                + +
                + + + Source + + + + + + +

                Functions summary

                + + + + + + +
                +

                Functions

                +
                +

                + run(args) +

                +
                + Source +
                +
                + + + +
                + + diff --git a/docs/stable/Mix.Tasks.Help.html b/docs/stable/Mix.Tasks.Help.html new file mode 100644 index 000000000..9d19d553f --- /dev/null +++ b/docs/stable/Mix.Tasks.Help.html @@ -0,0 +1,79 @@ + + + + Mix.Tasks.Help + + + + + + + + + + + + +
                +

                + Mix.Tasks.Help + +

                + + +
                +

                If given a task name, prints the documentation for that task. +If no task name is given, prints the short form documentation +for all tasks.

                + +

                Arguments

                + +
                mix help      - prints all tasks and their shortdoc
                +mix help TASK - prints full docs for the given task
                +
                + +
                + + + Source + + + + + + +

                Functions summary

                + + + + + + +
                +

                Functions

                +
                +

                + run(list1) +

                +
                + Source +
                +
                + + + +
                + + diff --git a/docs/stable/Mix.Tasks.Iex.html b/docs/stable/Mix.Tasks.Iex.html new file mode 100644 index 000000000..4b8b928c9 --- /dev/null +++ b/docs/stable/Mix.Tasks.Iex.html @@ -0,0 +1,74 @@ + + + + Mix.Tasks.Iex + + + + + + + + + + + + +
                +

                + Mix.Tasks.Iex + +

                + + +
                +

                Starts an iex repl with your project settings.

                + +

                Elixir ensures your code is compiled and loaded +before starting IEx.

                + +
                + + + Source + + + + + + +

                Functions summary

                + + + + + + +
                +

                Functions

                +
                +

                + run(_) +

                +
                + Source +
                +
                + + + +
                + + diff --git a/docs/stable/Mix.Tasks.Loadpaths.html b/docs/stable/Mix.Tasks.Loadpaths.html new file mode 100644 index 000000000..11c914bf2 --- /dev/null +++ b/docs/stable/Mix.Tasks.Loadpaths.html @@ -0,0 +1,81 @@ + + + + Mix.Tasks.Loadpaths + + + + + + + + + + + + +
                +

                + Mix.Tasks.Loadpaths + +

                + + +
                +

                Load the application and its dependencies paths.

                + +

                This task is not shown in mix help but it is part +of mix public API and can be depended on.

                + +

                Configuration

                + +
                  +
                • :load_paths extra load paths to be added. +They are added with lower priority than the app ones.
                • +
                + +
                + + + Source + + + + + + +

                Functions summary

                + + + + + + +
                +

                Functions

                +
                +

                + run(_) +

                +
                + Source +
                +
                + + + +
                + + diff --git a/docs/latest/Macro.html b/docs/stable/Mix.Tasks.Local.Install.html similarity index 64% rename from docs/latest/Macro.html rename to docs/stable/Mix.Tasks.Local.Install.html index 2038b6ce6..9ac7d4196 100644 --- a/docs/latest/Macro.html +++ b/docs/stable/Mix.Tasks.Local.Install.html @@ -1,7 +1,7 @@ - Macro + Mix.Tasks.Local.Install @@ -21,18 +21,29 @@

                - Macro + Mix.Tasks.Local.Install

                -

                This module provides conveniences for working with macros.

                +

                Install a task locally.

                + +

                The task can be either a local beam file or a beam +file located at some URL.

                + +
                mix local.install http://example.com/some_task.beam
                +
                + +

                After installed, the task can be invoked locally:

                + +
                mix some_task
                +
                - Source + Source @@ -43,7 +54,7 @@

                Functions summary

                • - escape/1 + run/1
                • @@ -56,23 +67,11 @@

                  Functions summary

                  Functions

                  -

                  - escape/1 +

                  + run(argv)

                  -

                  Recursively escapes the given value so it can be inserted -into a syntax tree. Structures that are valid syntax nodes -(like atoms, integers, binaries) are represented by themselves.

                  - -

                  Examples

                  - -
                  Macro.escape(:foo)
                  -#=> :foo
                  -
                  -Macro.escape({ :a, :b, :c })
                  -#=> { :{}, 0, [:a, :b, :c] }
                  -
                  -
                  - Source +
                  + Source
                  diff --git a/docs/stable/Mix.Tasks.Local.Uninstall.html b/docs/stable/Mix.Tasks.Local.Uninstall.html new file mode 100644 index 000000000..e23bda7a6 --- /dev/null +++ b/docs/stable/Mix.Tasks.Local.Uninstall.html @@ -0,0 +1,74 @@ + + + + Mix.Tasks.Local.Uninstall + + + + + + + + + + + + +
                  +

                  + Mix.Tasks.Local.Uninstall + +

                  + + +
                  +

                  Uninstall local tasks:

                  + +
                  mix local.uninstall task_name
                  +
                  + +
                  + + + Source + + + + + + +

                  Functions summary

                  + + + + + + +
                  +

                  Functions

                  +
                  +

                  + run(argv) +

                  +
                  + Source +
                  +
                  + + + +
                  + + diff --git a/docs/latest/Enum.Iterator.HashDict.Record.html b/docs/stable/Mix.Tasks.Local.html similarity index 73% rename from docs/latest/Enum.Iterator.HashDict.Record.html rename to docs/stable/Mix.Tasks.Local.html index 2be1f424f..bb8b730c0 100644 --- a/docs/latest/Enum.Iterator.HashDict.Record.html +++ b/docs/stable/Mix.Tasks.Local.html @@ -1,7 +1,7 @@ - Enum.Iterator.HashDict.Record + Mix.Tasks.Local @@ -21,15 +21,18 @@

                  - Enum.Iterator.HashDict.Record - - impl + Mix.Tasks.Local

                  +
                  +

                  List local tasks.

                  + +
                  + - Source + Source @@ -40,7 +43,7 @@

                  Functions summary

                  • - iterator/1 + run/1
                  • @@ -53,11 +56,11 @@

                    Functions summary

                    Functions

                    -

                    - iterator/1 +

                    + run(list1)

                    - Source + Source
                    diff --git a/docs/latest/Access.List.html b/docs/stable/Mix.Tasks.New.html similarity index 57% rename from docs/latest/Access.List.html rename to docs/stable/Mix.Tasks.New.html index 475f9d215..3b6d936ad 100644 --- a/docs/latest/Access.List.html +++ b/docs/stable/Mix.Tasks.New.html @@ -1,7 +1,7 @@ - Access.List + Mix.Tasks.New @@ -21,15 +21,37 @@

                    - Access.List - - impl + Mix.Tasks.New

                    +
                    +

                    Creates a new Elixir project. +It expects the path of the project as argument.

                    + +
                    mix new PATH [--app APP] [--module MODULE]
                    +
                    + +

                    A project with the given path name will be created, +unless --app is given, allowing you to set the app +name or the --module is given configuring the module +name.

                    + +

                    Examples

                    - Source +
                    mix new hello_world
                    +
                    + +

                    Is equivalent to:

                    + +
                    mix new hello_world --app hello_world --module HelloWorld
                    +
                    + +
                    + + + Source @@ -40,7 +62,7 @@

                    Functions summary

                    • - access/2 + run/1
                    • @@ -53,32 +75,11 @@

                      Functions summary

                      Functions

                      -

                      - access/2 +

                      + run(argv)

                      -

                      Access the list via a predicate.

                      - -

                      If a regular expression, it returns a list with the -matched contents.

                      - -

                      If an atom, assumes the list is a keywords list and -access the key in the keywords equals to the given -atom.

                      - -

                      Notice this protocol does not implement an integer -lookup. This is intentional since doing an index -based access on lists is usually undesired.

                      - -

                      Examples

                      - -
                      list = 'sample'
                      -list[%r/a/] #=> 'a'
                      -
                      -keywords = [a: 1, b: 2]
                      -keywords[:a] #=> 1
                      -
                      -
                      - Source +
                      + Source
                      diff --git a/docs/stable/Mix.Tasks.Run.html b/docs/stable/Mix.Tasks.Run.html new file mode 100644 index 000000000..acb3edadf --- /dev/null +++ b/docs/stable/Mix.Tasks.Run.html @@ -0,0 +1,77 @@ + + + + Mix.Tasks.Run + + + + + + + + + + + + +
                      +

                      + Mix.Tasks.Run + +

                      + + +
                      +

                      Run the given expression in the application context.

                      + +

                      Examples

                      + +
                      mix run Hello.world
                      +mix run "Some.function with_args"
                      +
                      + +
                      + + + Source + + + + + + +

                      Functions summary

                      + + + + + + +
                      +

                      Functions

                      +
                      +

                      + run(args) +

                      +
                      + Source +
                      +
                      + + + +
                      + + diff --git a/docs/stable/Mix.Tasks.Test.html b/docs/stable/Mix.Tasks.Test.html new file mode 100644 index 000000000..3d822553c --- /dev/null +++ b/docs/stable/Mix.Tasks.Test.html @@ -0,0 +1,86 @@ + + + + Mix.Tasks.Test + + + + + + + + + + + + +
                      +

                      + Mix.Tasks.Test + +

                      + + +
                      +

                      Run the tests for a project.

                      + +

                      This task will preload the test/test_helper.exs which +should do all testing setup and then require all files +that matches the given test_pattern in parallel.

                      + +

                      It ensures the project is compiled before executing.

                      + +

                      Configuration

                      + +
                        +
                      • :test_pattern - a pattern to load test files. +Defaults to test/**/*_test.exs.

                      • +
                      • :test_helper - a file that sets up whatever is necessary +for testing. Defaults to test/test_helper.exs.

                      • +
                      + +
                      + + + Source + + + + + + +

                      Functions summary

                      + + + + + + +
                      +

                      Functions

                      +
                      +

                      + run(_) +

                      +
                      + Source +
                      +
                      + + + +
                      + + diff --git a/docs/stable/Mix.Utils.html b/docs/stable/Mix.Utils.html new file mode 100644 index 000000000..2ae2b9095 --- /dev/null +++ b/docs/stable/Mix.Utils.html @@ -0,0 +1,226 @@ + + + + Mix.Utils + + + + + + + + + + + + +
                      +

                      + Mix.Utils + +

                      + + +
                      +

                      Utilities used throughout Mix and tasks.

                      + +

                      Conversions

                      + +

                      This module handles two types of conversions:

                      + +
                        +
                      • From command names to module names, i.e. how the command +deps.get translates to Deps.Get and vice-versa;

                      • +
                      • From underscore to camelize, i.e. how the file path +my_project translates to MyProject;

                      • +
                      + +
                      + + + Source + + + + + + +

                      Functions summary

                      + + + + + + +
                      +

                      Functions

                      +
                      +

                      + camelize(arg1) +

                      +

                      Converts the given string to camelize format.

                      + +

                      Examples

                      + +
                      Mix.Utils.camelize "foo_bar" #=> "FooBar"
                      +
                      +
                      + Source +
                      +

                      + command_to_module(command, at // Elixir) +

                      +

                      Takes a command name and try to load a module +with the command name converted to a module name +in the given at scope.

                      + +

                      Returns { :module, module } in case a module +exists and is loaded, { :error, reason } otherwise.

                      + +

                      Examples

                      + +
                      Mix.Utils.command_to_module("compile", Mix.Tasks)
                      +#=> { :module, Mix.Tasks.Compile }
                      +
                      +
                      + Source +
                      +

                      + command_to_module_name(s) +

                      +

                      Takes a command and converts it to a module name format.

                      + +

                      Examples

                      + +
                      command_to_module_name("compile.elixir")
                      +#=> "Compile.Elixir"
                      +
                      +
                      + Source +
                      +

                      + config_merge(old, new) +

                      +

                      Merges two configs recursively, merging keywords lists +and concatenating normal lists.

                      +
                      + Source +
                      +

                      + module_name_to_command(module, nesting // 0) +

                      +

                      Takes a module and converts it to a command. The nesting +argument can be given in order to remove the nesting of +module.

                      + +

                      Examples

                      + +
                      module_name_to_command(Mix.Tasks.Compile, 2)
                      +#=> "compile"
                      +
                      +module_name_to_command("Mix.Tasks.Compile.Elixir", 2)
                      +#=> "compile.elixir"
                      +
                      +
                      + Source +
                      +

                      + source(module) +

                      +

                      Gets the source location of a module as a binary.

                      +
                      + Source +
                      +

                      + stale?(source, target) +

                      +

                      Returns true if any of target is stale compared to source. +If target or source is a binary, it is expanded using File.wildcard.

                      +
                      + Source +
                      +

                      + underscore(arg1) +

                      +

                      Converts the given string to underscore format.

                      + +

                      Examples

                      + +
                      Mix.Utils.underscore "FooBar" #=> "foo_bar"
                      +
                      + +

                      In general, underscore can be thought as the reverse of +camelize, however, in some cases formatting may be lost:

                      + +
                      Mix.Utils.underscore "SAPExample"  #=> "sap_example"
                      +Mix.Utils.camelize   "sap_example" #=> "SapExample"
                      +
                      +
                      + Source +
                      +

                      + user_home() +

                      +

                      Gets the user home attempting to consider OS system diferences.

                      +
                      + Source +
                      +
                      + + + +
                      + + diff --git a/docs/stable/Mix.html b/docs/stable/Mix.html new file mode 100644 index 000000000..ec81e79ff --- /dev/null +++ b/docs/stable/Mix.html @@ -0,0 +1,137 @@ + + + + Mix + + + + + + + + + + + + +
                      +

                      + Mix + +

                      + + +
                      +

                      Mix is a build tool that provides tasks for creating, compiling, testing +(and soon deploying) Elixir projects. Mix is inspired by the Leiningen +build tool for Clojure and was written by one of its contributors.

                      + +

                      This module works as a facade for accessing the most common functionality +in Elixir, as the shell and the current project configuration.

                      + +

                      For getting started with Elixir, checkout out the guide available in +Elixir's website.

                      + +
                      + + + Source + + + + + + +

                      Functions summary

                      + + + + + + +
                      +

                      Functions

                      +
                      +

                      + loadpaths() +

                      +

                      Starts mix and loads the project and dependencies into +one step. Useful when invoking mix from an external tool.

                      +
                      + Source +
                      +

                      + project() +

                      +

                      Retrieves the current project configuration. If there +isn't a project defined, this function will simply +return an empty keywords list. This allows many mix +tasks to work without a need for an underlying project.

                      +
                      + Source +
                      +

                      + shell() +

                      +

                      The shell is a wrapper for doing IO.

                      + +

                      It contains conveniences for asking the user information, +printing status and so forth. The fact it is also swappable +allow developers to use a test shell, that simply sends the +messages to the current process.

                      +
                      + Source +
                      +

                      + shell(shell) +

                      +

                      Sets the current shell.

                      +
                      + Source +
                      +

                      + start() +

                      +

                      Starts the mix application and its dependencies.

                      +
                      + Source +
                      +
                      + + + +
                      + + diff --git a/docs/latest/Module.html b/docs/stable/Module.html similarity index 50% rename from docs/latest/Module.html rename to docs/stable/Module.html index 4e714a2a6..7139589cf 100644 --- a/docs/latest/Module.html +++ b/docs/stable/Module.html @@ -29,7 +29,7 @@

                      This module provides many functions to deal with modules during compilation time. It allows a developer to dynamically attach -documentation, merge data, register attributes and so forth.

                      +documentation, add, delete and register attributes and so forth.

                      After the module is compiled, using many of the functions in this module will raise errors, since it is out of their purpose @@ -39,7 +39,7 @@

                      - Source + Source @@ -60,12 +60,7 @@

                      Functions summary

                    • - add_doc/5 - -
                    • -
                    • - - compiled?/1 + add_doc/6
                    • @@ -80,32 +75,32 @@

                      Functions summary

                    • - defined_functions/1 + defines?/2
                    • - defined_functions/2 + defines?/3
                    • - delete_attribute/2 + definitions_in/1
                    • - eval_quoted/4 + definitions_in/2
                    • - function_defined?/2 + delete_attribute/2
                    • - function_defined?/3 + eval_quoted/4
                    • @@ -115,22 +110,12 @@

                      Functions summary

                    • - merge_data/2 - -
                    • -
                    • - - read_data/1 - -
                    • -
                    • - - read_data/2 + read_attribute/2
                    • - register_attribute/2 + register_attribute/3
                    • @@ -154,10 +139,11 @@

                      Functions summary

                      Functions

                      - add_attribute/3 + add_attribute(module, key, value)

                      Adds an Erlang attribute to the given module with the given -key and value. The same attribute can be added more than once.

                      +key and value. The semantics of adding the attribute depends +if the attribute was registered or not via register_attribute/2.

                      Examples

                      @@ -166,56 +152,16 @@

                      Examples

                      end
                      - Source + Source

                      - add_compile_callback/3 + add_compile_callback(module, target, fun // :__compiling__)

                      -

                      Adds a compilation callback hook that is invoked -exactly before the module is compiled.

                      - -

                      This callback is useful, for example, when used with use -as a mechanism to clean up any internal data in the module -before it is compiled.

                      - -

                      Examples

                      - -

                      Imagine you are creating a module/library that is meant for -external usage called MyLib. It could be defined as:

                      - -
                      defmodule MyLib do
                      -  def __using__(target) do
                      -    Module.merge_data target, some_data: nil
                      -    Module.add_compile_callback(target, __MODULE__, :__callback__)
                      -  end
                      -
                      -  defmacro __callback__(target) do
                      -    value = Module.read_data(target, :some_data)
                      -    quote do: (def my_lib_value, do: unquote(value))
                      -  end
                      -end
                      -
                      - -

                      And a module could use MyLib with:

                      - -
                      defmodule App do
                      -  use ModuleTest.ToBeUsed
                      -  @some_data :new_value
                      -end
                      -
                      - -

                      In the example above, MyLib defines a data on the target. -This data can be updated throughout the module definition -and therefore, the final value of the data can only be retrieved -via the compilation callback.

                      - -

                      In this example, the compilation callback reads the value and -compile it to a function.

                      -
                      - Source +
                      + Source
                      -

                      - add_doc/5 +

                      + add_doc(module, line, kind, tuple, signature, doc)

                      Attaches documentation to a given function. It expects the module the function belongs to, the line (a non negative @@ -226,33 +172,17 @@

                      Examples

                      Examples

                      defmodule MyModule do
                      -  Module.add_doc(__MODULE__, __LINE__ + 1, :def, { :version, 0 }, "Manually added docs")
                      +  Module.add_doc(__MODULE__, __ENV__.line + 1, :def, { :version, 0 }, [], "Manually added docs")
                         def version, do: 1
                       end
                       
                      - Source -
                      -

                      - compiled?/1 -

                      -

                      Checks if the module is compiled or not.

                      - -

                      Examples

                      - -
                      defmodule Foo do
                      -  Module.compiled?(__MODULE__) #=> false
                      -end
                      -
                      -Module.compiled?(Foo) #=> true
                      -
                      -
                      - Source + Source

                      - concat/1 + concat(list)

                      -

                      Concatenates the list of arguments and returns the module name. +

                      Concatenates the list of aliases and returns a new alias. It handles char lists, binaries and atoms.

                      Examples

                      @@ -262,12 +192,12 @@

                      Examples

                      Module.concat [Foo, 'Bar'] #=> Foo.Bar
                      - Source + Source

                      - concat/2 + concat(left, right)

                      -

                      Concatenates two arguments and returns the module name. +

                      Concatenates the two given aliases and returns a new alias. It handles char lists, binaries and atoms.

                      Examples

                      @@ -277,10 +207,45 @@

                      Examples

                      Module.concat Foo, 'Bar' #=> Foo.Bar
                      - Source + Source +
                      +

                      + defines?(module, tuple) +

                      +

                      Checks if the module defines the given function or macro. +Use defines?/3 to assert for an specific type.

                      + +

                      Examples

                      + +
                      defmodule Example do
                      +  Module.defines? __MODULE__, { :version, 0 } #=> false
                      +  def version, do: 1
                      +  Module.defines? __MODULE__, { :version, 0 } #=> true
                      +end
                      +
                      +
                      + Source
                      -

                      - defined_functions/1 +

                      + defines?(module, tuple, kind) +

                      +

                      Checks if the module defines a function or macro with the +given kind. kind can be either :def, :defp, +:defmacro or :defmacrop.

                      + +

                      Examples

                      + +
                      defmodule Example do
                      +  Module.defines? __MODULE__, { :version, 0 }, :defp #=> false
                      +  def version, do: 1
                      +  Module.defines? __MODULE__, { :version, 0 }, :defp #=> false
                      +end
                      +
                      +
                      + Source +
                      +

                      + definitions_in(module)

                      Return all functions defined in the given module.

                      @@ -288,14 +253,14 @@

                      Examples

                      defmodule Example do
                         def version, do: 1
                      -  Module.defined_functions __MODULE__ #=> [{:version,1}]
                      +  Module.definitions_in __MODULE__ #=> [{:version,1}]
                       end
                       
                      - Source + Source
                      -

                      - defined_functions/2 +

                      + definitions_in(module, kind)

                      Returns all functions defined in te given module according to its kind.

                      @@ -304,15 +269,15 @@

                      Examples

                      defmodule Example do
                         def version, do: 1
                      -  Module.defined_functions __MODULE__, :def  #=> [{:version,1}]
                      -  Module.defined_functions __MODULE__, :defp #=> []
                      +  Module.definitions_in __MODULE__, :def  #=> [{:version,1}]
                      +  Module.definitions_in __MODULE__, :defp #=> []
                       end
                       
                      - Source + Source

                      - delete_attribute/2 + delete_attribute(module, key)

                      Deletes all attributes that matches the given key.

                      @@ -324,174 +289,152 @@

                      Examples

                      end
                      - Source + Source

                      - eval_quoted/4 + eval_quoted(env, quoted, binding // [], opts // [])

                      Evalutes the quotes contents in the given module context. Raises an error if the module was already compiled.

                      +

                      Options

                      + +

                      This function accepts a list of options. The supported +options are:

                      + +
                        +
                      • :file - The filename to be used in stacktraces +and the file reported in the ENV variable.

                      • +
                      • :line - The line reported in the ENV variable.

                      • +
                      +

                      Examples

                      defmodule Foo do
                         contents = quote do: (def sum(a, b), do: a + b)
                      -  Module.eval_quoted __MODULE__, contents, [], file: __FILE__, line: __LINE__
                      +  Module.eval_quoted __MODULE__, contents, []
                       end
                       
                       Foo.sum(1, 2) #=> 3
                       
                      -
                      - Source -
                      -

                      - function_defined?/2 -

                      -

                      Checks if a function was defined, regardless if it is -a macro or a private function. Use function_defined?/3 -to assert for an specific type.

                      -

                      Examples

                      +

                      This function also accepts a Macro.Env as first argument. This +is useful to evalute the quoted contents inside an existing environment:

                      -
                      defmodule Example do
                      -  Module.function_defined? __MODULE__, { :version, 0 } #=> false
                      -  def version, do: 1
                      -  Module.function_defined? __MODULE__, { :version, 0 } #=> true
                      +
                      defmodule Foo do
                      +  contents = quote do: (def sum(a, b), do: a + b)
                      +  Module.eval_quoted __ENV__, contents, []
                       end
                      -
                      -
                      - Source -
                      -

                      - function_defined?/3 -

                      -

                      Checks if a function was defined and also for its kind. -kind can be either :def, :defp or :defmacro.

                      -

                      Examples

                      - -
                      defmodule Example do
                      -  Module.function_defined? __MODULE__, { :version, 0 }, :defp #=> false
                      -  def version, do: 1
                      -  Module.function_defined? __MODULE__, { :version, 0 }, :defp #=> false
                      -end
                      +Foo.sum(1, 2) #=> 3
                       
                      - Source + Source

                      - make_overridable/2 + make_overridable(module, tuples)

                      Makes the given functions in the given module overridable. An overridable function is lazily defined, allowing a developer to customize it.

                      - Source + Source
                      -

                      - merge_data/2 +

                      + read_attribute(module, key)

                      -

                      Merge the given data into the module, overriding any -previous one.

                      - -

                      If any of the given data is a registered attribute, it is -automatically added to the attribute set, instead of marking -it as data. See registerattribute/2 and addattribute/3 for -more info.

                      +

                      Reads the given attribute from a module. If the attribute +was marked as accumulate with Module.register_attribute, +a list is always returned.

                      Examples

                      defmodule Foo do
                      -  Module.merge_data __MODULE__, value: 1
                      -end
                      +  Module.add_attribute __MODULE__, :value, 1
                      +  Module.read_attribute __MODULE__, :value #=> 1
                       
                      -Foo.__info__(:data) #=> [value: 1]
                      +  Module.register_attribute __MODULE__, :value, accumulate: true
                      +  Module.add_attribute __MODULE__, :value, 1
                      +  Module.read_attribute __MODULE__, :value #=> [1]
                      +end
                       
                      - Source + Source
                      -

                      - read_data/1 +

                      + register_attribute(module, new, opts // [])

                      -

                      Reads the data for the given module. This is used -to read data of uncompiled modules. If the module -was already compiled, you shoul access the data -directly by invoking __info__(:data) in that module.

                      +

                      Registers an attribute. By registering an attribute, a developer +is able to customize how Elixir will store and accumulate the +attribute values.

                      -

                      Examples

                      +

                      Options

                      -
                      defmodule Foo do
                      -  Module.merge_data __MODULE__, value: 1
                      -  Module.read_data __MODULE__ #=> [value: 1]
                      -end
                      -
                      -
                      - Source -
                      -

                      - read_data/2 -

                      -

                      Reads the data from module at the given key at.

                      +

                      When registering an attribute, two options can be given:

                      -

                      Examples

                      +
                        +
                      • :accumulate - Several calls to the same attribute will +accumulate instead of override the previous one;

                      • +
                      • :persist - The attribute will be persisted in the Erlang +Abstract Format. Useful when interfacing with Erlang libraries.

                      • +
                      -
                      defmodule Foo do
                      -  Module.merge_data __MODULE__, value: 1
                      -  Module.read_data __MODULE__, :value #=> 1
                      -end
                      -
                      -
                      - Source -
                      -

                      - register_attribute/2 -

                      -

                      Registers an attribute. This allows a developer to use the data API -but Elixir will register the data as an attribute automatically. -By default, vsn, behavior and other Erlang attributes are -automatically registered.

                      +

                      By default, both options are true. Which means that registering +an attribute without passing any options will revert the attribute +behavior to exactly the same expected in Erlang.

                      Examples

                      defmodule MyModule do
                      -  Module.register_attribute __MODULE__, :custom_threshold_for_lib
                      +  Module.register_attribute __MODULE__,
                      +    :custom_threshold_for_lib,
                      +    accumulate: true, persist: false
                      +
                         @custom_threshold_for_lib 10
                      +  @custom_threshold_for_lib 20
                      +  @custom_threshold_for_lib #=> [20, 10]
                       end
                       
                      - Source + Source

                      - safe_concat/1 + safe_concat(list)

                      -

                      Concatenates the list arguments and returns the module -name only if the module was already referenced. -If the module was not referenced yet, fails with ArgumentError. +

                      Concatenates the list aliases and returns a new alias only +if the alias was already referenced. If the alias was not +referenced yet, fails with ArgumentError. It handles char lists, binaries and atoms.

                      Examples

                      Module.safe_concat [Unknown, Module]
                       #=> ArgumentError
                      +
                      +Module.safe_concat [List, Chars]
                      +#=> List.Chars
                       
                      - Source + Source

                      - safe_concat/2 + safe_concat(left, right)

                      -

                      Concatenates two arguments and returns the module -name only if the module was already referenced. -If the module was not referenced yet, fails with ArgumentError. +

                      Concatenates the two aliases and returns a new alias only +if the alias was already referenced. If the alias was not +referenced yet, fails with ArgumentError. It handles char lists, binaries and atoms.

                      Examples

                      Module.safe_concat Unknown, Module
                       #=> ArgumentError
                      +
                      +Module.safe_concat List, Chars
                      +#=> List.Chars
                       
                      - Source + Source
                      diff --git a/docs/stable/Node.html b/docs/stable/Node.html new file mode 100644 index 000000000..cd64c1d1d --- /dev/null +++ b/docs/stable/Node.html @@ -0,0 +1,226 @@ + + + + Node + + + + + + + + + + + + +
                      +

                      + Node + +

                      + + +
                      +

                      Functions related to Erlang nodes.

                      + +
                      + + + Source + + + + + + +

                      Functions summary

                      + + + + + + +
                      +

                      Functions

                      +
                      +

                      + alive?() +

                      +

                      Returns true if the local node is alive; that is, if the node can be +part of a distributed system. Otherwise, it returns false.

                      +
                      + Source +
                      +

                      + disconnect(node) +

                      +

                      Forces the disconnection of a node. This will appear to the node as if +the local node has crashed. This BIF is mainly used in the Erlang network +authentication protocols. Returns true if disconnection succeeds, otherwise +false. If the local node is not alive, the function returns ignored.

                      + +

                      See http://www.erlang.org/doc/man/erlang.html#disconnect_node-1 for more info.

                      +
                      + Source +
                      +

                      + list() +

                      +

                      Returns a list of all visible nodes in the system, excluding +the local node. Same as list(visible).

                      +
                      + Source +
                      +

                      + list(args) +

                      +

                      Returns a list of nodes according to argument given. The result +returned when the argument is a list, is the list of nodes +satisfying the disjunction(s) of the list elements.

                      + +

                      See http://www.erlang.org/doc/man/erlang.html#nodes-1 for more info.

                      +
                      + Source +
                      +

                      + monitor(node, flag) +

                      +

                      Monitors the status of the node. If flag is true, monitoring is +turned on. If flag is false, monitoring is turned off.

                      + +

                      See http://www.erlang.org/doc/man/erlang.html#monitor_node-2 for more info.

                      +
                      + Source +
                      +

                      + monitor(node, flag, options) +

                      +

                      Behaves as monitornode/2 except that it allows an extra +option to be given, namely :allowpassive_connect.

                      + +

                      See http://www.erlang.org/doc/man/erlang.html#monitor_node-3 for more info.

                      +
                      + Source +
                      +

                      + self() +

                      +

                      Returns the current node. It returns the same as the built-in node().

                      +
                      + Source +
                      +

                      + spawn(node, fun, opts // []) +

                      +

                      Returns the pid of a new process started by the application of fun +on node. If node does not exist, a useless pid is returned.

                      + +

                      Check http://www.erlang.org/doc/man/erlang.html#spawn_opt-4 for +the list of available options.

                      +
                      + Source +
                      +

                      + spawn(node, module, fun, args, opts // []) +

                      +

                      Returns the pid of a new process started by the application of +module.function(args) on node. If node does not exists, a useless +pid is returned.

                      + +

                      Check http://www.erlang.org/doc/man/erlang.html#spawn_opt-4 for +the list of available options.

                      +
                      + Source +
                      +

                      + spawn_link(node, fun) +

                      +

                      Returns the pid of a new process started by the application of fun +on node. A link is created between the calling process and the +new process, atomically. If node does not exist, a useless pid is returned +(and due to the link, an exit signal with exit reason :noconnection will be +received).

                      +
                      + Source +
                      +

                      + spawn_link(node, module, fun, args) +

                      +

                      Returns the pid of a new process started by the application of +module.function(args) on node. A link is created between the calling +process and the new process, atomically. If node does not exist, a useless +pid is returned (and due to the link, an exit signal with exit reason +:noconnection will be received).

                      +
                      + Source +
                      +
                      + + + +
                      + + diff --git a/docs/stable/OptionParser.html b/docs/stable/OptionParser.html new file mode 100644 index 000000000..94c1bda9a --- /dev/null +++ b/docs/stable/OptionParser.html @@ -0,0 +1,130 @@ + + + + OptionParser + + + + + + + + + + + + +
                      +

                      + OptionParser + +

                      + + + + Source + + + + + + +

                      Functions summary

                      + + + + + + +
                      +

                      Functions

                      +
                      +

                      + parse(argv, opts // []) +

                      +

                      Parses the argv and returns one tuple with parsed options +and the arguments.

                      + +

                      Examples

                      + +
                      OptionParser.parse(["--debug"])
                      +#=> { [debug: true], [] }
                      +
                      +OptionParser.parse(["--source", "lib"])
                      +#=> { [source: "lib"], [] }
                      +
                      +OptionParser.parse(["--source", "lib", "test/enum_test.exs", "--verbose"])
                      +#=> { [source: "lib", verbose: true], ["test/enum_test.exs"] }
                      +
                      + +

                      Aliases

                      + +

                      A set of aliases can be given as second argument:

                      + +
                      OptionParser.parse(["-d"], aliases: [d: :debug])
                      +#=> { [debug: true], [] }
                      +
                      + +

                      Flags

                      + +

                      A set of flags can be given as argument too. Those are considered +boolean and never consume the next value unless it is a boolean:

                      + +
                      OptionParser.parse(["--unlock path/to/file"], flags: [:unlock])
                      +#=> { [unlock: true], ["path/to/file"] }
                      +
                      +OptionParser.parse(["--unlock false path/to/file"], flags: [:unlock])
                      +#=> { [unlock: false], ["path/to/file"] }
                      +
                      + +

                      Negation switches

                      + +

                      Any switches starting with --no- are always considered to be +booleans and never parse the next value.

                      + +
                      OptionParser.parse(["--no-op path/to/file"])
                      +#=> { [no_op: true], ["path/to/file"] }
                      +
                      +
                      + Source +
                      +

                      + parse_head(argv, opts // []) +

                      +

                      Similar to parse but only parses the head of the argv. +I.e. as soon as it finds a non switch, it stops parsing.

                      + +

                      Check parse/2 for more info.

                      + +

                      Example

                      + +
                      OptionParser.parse_head(["--source", "lib", "test/enum_test.exs", "--verbose"])
                      +#=> { [source: "lib"], ["test/enum_test.exs", "--verbose"] }
                      +
                      +
                      + Source +
                      +
                      + + + +
                      + + diff --git a/docs/latest/Orddict.html b/docs/stable/Orddict.html similarity index 82% rename from docs/latest/Orddict.html rename to docs/stable/Orddict.html index d22b23243..13598b58e 100644 --- a/docs/latest/Orddict.html +++ b/docs/stable/Orddict.html @@ -35,7 +35,7 @@

                      - Source + Source @@ -70,38 +70,38 @@

                      Functions summary

                      Functions

                      - new/0 + new()

                      Creates a new empty dict.

                      - Source + Source

                      - new/1 + new(pairs)

                      Creates a new dict from a list of pairs.

                      Examples

                      -
                      Dict.Common.new [{:b,1},{:a,2}]
                      +
                      Orddict.new [{:b,1},{:a,2}]
                       #=> [a: 1, b: 2]
                       
                      - Source + Source

                      - new/2 + new(list, transform)

                      Creates a new dict from a list of elements with the help of the transformation function.

                      Examples

                      -
                      Dict.Common.new ["a", "b"], fn x -> {x, x} end
                      +
                      Orddict.new ["a", "b"], fn x -> {x, x} end
                       #=> ["a": "a", "b": "b"]
                       
                      - Source + Source
                      diff --git a/docs/latest/Port.html b/docs/stable/Port.html similarity index 56% rename from docs/latest/Port.html rename to docs/stable/Port.html index fa284868d..ccbec0685 100644 --- a/docs/latest/Port.html +++ b/docs/stable/Port.html @@ -32,7 +32,7 @@

                      - Source + Source @@ -97,67 +97,67 @@

                      Functions summary

                      Functions

                      - call/3 + call(port, operation, data)

                      -

                      See http://www.erlang.org/doc/man/erlang.html#port_call-3.

                      + - Source + Source

                      - close/1 + close(port)

                      -

                      See http://www.erlang.org/doc/man/erlang.html#port_close-1.

                      + - Source + Source

                      - command/3 + command(port, data, options // [])

                      -

                      See http://www.erlang.org/doc/man/erlang.html#port_command-2.

                      + - Source + Source

                      - connect/2 + connect(port, pid)

                      -

                      See http://www.erlang.org/doc/man/erlang.html#port_connect-2.

                      + - Source + Source

                      - control/3 + control(port, operation, data)

                      -

                      See http://www.erlang.org/doc/man/erlang.html#port_control-3.

                      + - Source + Source

                      - info/1 + info(port)

                      -

                      See http://www.erlang.org/doc/man/erlang.html#port_info-1.

                      + - Source + Source

                      - info/2 + info(port, item)

                      -

                      See http://www.erlang.org/doc/man/erlang.html#port_info-2.

                      + - Source + Source

                      - list/0 + list()

                      -

                      See http://www.erlang.org/doc/man/erlang.html#ports-0.

                      + - Source + Source

                      - open/2 + open(name, settings)

                      -

                      See http://www.erlang.org/doc/man/erlang.html#open_port-2.

                      + - Source + Source
                      diff --git a/docs/latest/Process.html b/docs/stable/Process.html similarity index 59% rename from docs/latest/Process.html rename to docs/stable/Process.html index 2a0a23dd2..a5b2588aa 100644 --- a/docs/latest/Process.html +++ b/docs/stable/Process.html @@ -37,7 +37,7 @@

                      - Source + Source @@ -136,21 +136,11 @@

                      Functions summary

                      self/0
                    • -
                    • - - spawn/1 - -
                    • spawn/2
                    • -
                    • - - spawn/3 - -
                    • spawn/4 @@ -161,21 +151,11 @@

                      Functions summary

                      spawn_link/1
                    • -
                    • - - spawn_link/2 - -
                    • spawn_link/3
                    • -
                    • - - spawn_link/4 - -
                    • spawn_monitor/1 @@ -186,26 +166,6 @@

                      Functions summary

                      spawn_monitor/3
                    • -
                    • - - spawn_opt/2 - -
                    • -
                    • - - spawn_opt/3 - -
                    • -
                    • - - spawn_opt/4 - -
                    • -
                    • - - spawn_opt/5 - -
                    • unlink/1 @@ -232,42 +192,42 @@

                      Functions summary

                      Functions

                      - alive?/1 + alive?(pid)

                      Returns true if the process exists and is alive, that is, is not exiting and has not exited. Otherwise, returns false.

                      pid must refer to a process at the local node.

                      - Source + Source

                      - delete/0 + delete()

                      Deletes all items in the dictionary.

                      - Source + Source

                      - delete/1 + delete(key)

                      Deletes the given key from the dictionary.

                      - Source + Source

                      - demonitor/2 + demonitor(monitor_ref, options // [])

                      If monitor_ref is a reference which the calling process obtained by calling monitor/1, this monitoring is turned off. If the monitoring is already turned off, nothing happens.

                      -

                      See http://www.erlang.org/doc/man/erlang.html#demonitor-2 for more info.

                      +

                      See http://www.erlang.org/doc/man/erlang.html#demonitor-2 for more info.

                      - Source + Source

                      - exit/2 + exit(pid, status)

                      Sends an exit signal with the given reason to the pid.

                      @@ -288,77 +248,77 @@

                      Functions

                      Examples

                      -
                      Process.exit(other, :kil)
                      +
                      Process.exit(pid, :kill)
                       
                      - Source + Source

                      - flag/2 + flag(flag, value)

                      Sets certain flags for the process which calls this function. Returns the old value of the flag.

                      -

                      See http://www.erlang.org/doc/man/erlang.html#process_flag-2 for more info.

                      +

                      See http://www.erlang.org/doc/man/erlang.html#process_flag-2 for more info.

                      - Source + Source

                      - flag/3 + flag(pid, flag, value)

                      Sets certain flags for the process Pid, in the same manner as flag/2. Returns the old value of the flag. The allowed values for Flag are only a subset of those allowed in flag/2, namely: save_calls.

                      -

                      See http://www.erlang.org/doc/man/erlang.html#process_flag-3 for more info.

                      +

                      See http://www.erlang.org/doc/man/erlang.html#process_flag-3 for more info.

                      - Source + Source

                      - get/0 + get()

                      Returns all key-values in the dictionary with no specific ordering (i.e. they are not a keywords list).

                      - Source + Source

                      - get/2 + get(key, default // nil)

                      Returns the value for the given key.

                      - Source + Source

                      - get_keys/1 + get_keys(value)

                      Returns all keys that have the given value.

                      - Source + Source

                      - info/2 + info(pid, spec)

                      Returns information about the process identified by pid or undefined if the process is not alive.

                      -

                      See http://www.erlang.org/doc/man/erlang.html#process_info-2 for more info.

                      +

                      See http://www.erlang.org/doc/man/erlang.html#process_info-2 for more info.

                      - Source + Source

                      - link/1 + link(pid)

                      Creates a link between the calling process and another process (or port) pid, if there is not such a link already.

                      -

                      See http://www.erlang.org/doc/man/erlang.html#link-1 for more info.

                      +

                      See http://www.erlang.org/doc/man/erlang.html#link-1 for more info.

                      - Source + Source

                      - list/0 + list()

                      Returns a list of process identifiers corresponding to all the processes currently existing on the local node.

                      @@ -367,212 +327,140 @@

                      Examples

                      alive?/1 will return false for a process that is exiting, but its process identifier will be part of the result returned.

                      -

                      See http://www.erlang.org/doc/man/erlang.html#processes-0 for more info.

                      +

                      See http://www.erlang.org/doc/man/erlang.html#processes-0 for more info.

                      - Source + Source

                      - monitor/1 + monitor(item)

                      The calling process starts monitoring the item given. It returns the monitor reference.

                      -

                      See http://www.erlang.org/doc/man/erlang.html#monitor-2 for more info.

                      +

                      See http://www.erlang.org/doc/man/erlang.html#monitor-2 for more info.

                      - Source + Source

                      - put/2 + put(key, value)

                      Stores the given key-value in the process dictionary.

                      - Source + Source

                      - register/2 + register(name, pid)

                      Associates the name with a pid or a port identifier. name, which must be an atom, can be used instead of the pid / port identifier in the send operator (name <- message).

                      -

                      See http://www.erlang.org/doc/man/erlang.html#register-2 for more info.

                      +

                      See http://www.erlang.org/doc/man/erlang.html#register-2 for more info.

                      - Source + Source

                      - registered/0 + registered()

                      Returns a list of names which have been registered using register/2.

                      - Source + Source

                      - self/0 + self()

                      Returns the current process.

                      - Source -
                      -

                      - spawn/1 -

                      -

                      Returns the pid of a new process started by the application of fun. -Otherwise works like spawn/3.

                      -
                      - Source + Source

                      - spawn/2 + spawn(fun, opts // [])

                      -

                      Returns the pid of a new process started by the application of fun -on node. If node does not exist, a useless pid is returned. -Otherwise works like spawn/3.

                      +

                      Returns the pid of a new process started by the application of fun.

                      + +

                      It behaves exactly the same as the Kernel.spawn/1 function except +it also accepts extra options, for the list of available options +check http://www.erlang.org/doc/man/erlang.html#spawn_opt-4

                      - Source + Source
                      -

                      - spawn/3 +

                      + spawn(mod, fun, args, opts // [])

                      Returns the pid of a new process started by the application of module.function(args). The new process created will be placed in the system scheduler queue and be run some time later.

                      -

                      See http://www.erlang.org/doc/man/erlang.html#spawn-3 for more info.

                      -
                      - Source -
                      -

                      - spawn/4 -

                      -

                      Returns the pid of a new process started by the application of -module.function(args) on node. If node does not exists, a useless -pid is returned. Otherwise works like spawn/3.

                      +

                      It behaves exactly the same as the Kernel.spawn/3 function except +it also accepts extra options, for the list of available options +check http://www.erlang.org/doc/man/erlang.html#spawn_opt-4

                      - Source + Source

                      - spawn_link/1 + spawn_link(fun)

                      Returns the pid of a new process started by the application of fun. A link is created between the calling process and the new -process, atomically. Otherwise works like spawn/3.

                      -
                      - Source -
                      -

                      - spawn_link/2 -

                      -

                      Returns the pid of a new process started by the application of fun -on node. A link is created between the calling process and the -new process, atomically. If node does not exist, a useless pid is returned -(and due to the link, an exit signal with exit reason :noconnection will be -received). Otherwise works like spawn/3.

                      +process, atomically.

                      - Source + Source

                      - spawn_link/3 + spawn_link(mod, fun, args)

                      Returns the pid of a new process started by the application of module.function(args). A link is created between the calling process and the new process, atomically. Otherwise works like spawn/3.

                      - Source -
                      -

                      - spawn_link/4 -

                      -

                      Returns the pid of a new process started by the application of -module.function(args) on node. A link is created between the calling -process and the new process, atomically. If node does not exist, a useless -pid is returned (and due to the link, an exit signal with exit reason -:noconnection will be received). Otherwise works like spawn/3.

                      -
                      - Source + Source

                      - spawn_monitor/1 + spawn_monitor(fun)

                      Returns the pid of a new process started by the application of fun -and reference for a monitor created to the new process. -Otherwise works like spawn/3.

                      +and reference for a monitor created to the new process.

                      - Source + Source

                      - spawn_monitor/3 + spawn_monitor(mod, fun, args)

                      A new process is started by the application of module.function(args) and the process is monitored at the same time. Returns the pid and a reference for the monitor. Otherwise works like spawn/3.

                      - Source -
                      -

                      - spawn_opt/2 -

                      -

                      The same as spawn/1 but accepts extra options as arguments. -Please read http://www.erlang.org/doc/man/erlang.html#spawn_opt-4 for -documentation of the options.

                      -
                      - Source -
                      -

                      - spawn_opt/3 -

                      -

                      The same as spawn/2 but accepts extra options as arguments. -Please read http://www.erlang.org/doc/man/erlang.html#spawn_opt-4 for -documentation of the options.

                      -
                      - Source -
                      -

                      - spawn_opt/4 -

                      -

                      The same as spawn/3 but accepts extra options as arguments. -Please read http://www.erlang.org/doc/man/erlang.html#spawn_opt-4 for -documentation of the options.

                      -
                      - Source -
                      -

                      - spawn_opt/5 -

                      -

                      The same as spawn/4 but accepts extra options as arguments. -Please read http://www.erlang.org/doc/man/erlang.html#spawn_opt-4 for -documentation of the options.

                      -
                      - Source + Source

                      - unlink/1 + unlink(pid)

                      Removes the link, if there is one, between the calling process and the process or port referred to by pid. Returns true and does not fail, even if there is no link or id does not exist

                      -

                      See http://www.erlang.org/doc/man/erlang.html#unlink-1 for more info.

                      +

                      See http://www.erlang.org/doc/man/erlang.html#unlink-1 for more info.

                      - Source + Source

                      - unregister/1 + unregister(name)

                      Removes the registered name, associated with a pid or a port identifier.

                      -

                      See http://www.erlang.org/doc/man/erlang.html#unregister-1 for more info.

                      +

                      See http://www.erlang.org/doc/man/erlang.html#unregister-1 for more info.

                      - Source + Source

                      - whereis/1 + whereis(name)

                      Returns the pid or port identifier with the registered name. Returns undefined if the name is not registered.

                      -

                      See http://www.erlang.org/doc/man/erlang.html#whereis-1 for more info.

                      +

                      See http://www.erlang.org/doc/man/erlang.html#whereis-1 for more info.

                      - Source + Source
                      diff --git a/docs/latest/Protocol.UndefinedError.html b/docs/stable/Protocol.UndefinedError.html similarity index 71% rename from docs/latest/Protocol.UndefinedError.html rename to docs/stable/Protocol.UndefinedError.html index b9909fc4b..98e455500 100644 --- a/docs/latest/Protocol.UndefinedError.html +++ b/docs/stable/Protocol.UndefinedError.html @@ -29,7 +29,7 @@

                      - Source + Source @@ -100,6 +100,11 @@

                      Functions summary

                      structure/2
                    • +
                    • + + to_keywords/1 + +
                    • update_protocol/2 @@ -121,70 +126,76 @@

                      Functions summary

                      Functions

                      - exception/1 + exception(args)

                      - Source + Source

                      - exception/2 + exception(args, self)

                      - Source + Source

                      - message/1 + message(exception)

                      - Source + Source

                      - new/0 + new()

                      - Source + Source

                      - new/1 + new(opts)

                      - Source + Source

                      - protocol/1 + protocol(record)

                      - Source + Source

                      - protocol/2 + protocol(value, record)

                      - Source + Source

                      - structure/1 + structure(record)

                      - Source + Source

                      - structure/2 + structure(value, record) +

                      +
                      + Source +
                      +

                      + to_keywords(record)

                      - Source + Source

                      - update_protocol/2 + update_protocol(function, record)

                      - Source + Source

                      - update_structure/2 + update_structure(function, record)

                      - Source + Source
                    diff --git a/docs/stable/Range.Iterator.Number.html b/docs/stable/Range.Iterator.Number.html new file mode 100644 index 000000000..7bf6fdb11 --- /dev/null +++ b/docs/stable/Range.Iterator.Number.html @@ -0,0 +1,79 @@ + + + + Range.Iterator.Number + + + + + + + + + + + + +
                    +

                    + Range.Iterator.Number + + impl + +

                    + + + + Source + + + + + + +

                    Functions summary

                    + + + + + + +
                    +

                    Functions

                    +
                    +

                    + count(first, arg2) +

                    +
                    + Source +
                    +

                    + iterator(first, arg2) +

                    +
                    + Source +
                    +
                    + + + +
                    + + diff --git a/docs/stable/Range.Iterator.html b/docs/stable/Range.Iterator.html new file mode 100644 index 000000000..ee8baa9b1 --- /dev/null +++ b/docs/stable/Range.Iterator.html @@ -0,0 +1,96 @@ + + + + Range.Iterator + + + + + + + + + + + + +
                    +

                    + Range.Iterator + + protocol + +

                    + + + + Source + + +

                    Implementations

                    + + + + + + +

                    Functions summary

                    + + + + + + +
                    +

                    Functions

                    +
                    +

                    + count(xA, xB) +

                    +

                    Count how many items are in the range.

                    +
                    + Source +
                    +

                    + iterator(xA, xB) +

                    +

                    How to iterate the range, receives the first +and range as arguments. It needs to return a +function that receives an item and returns +a tuple with two elements: the given item +and the next item in the iteration.

                    +
                    + Source +
                    +
                    + + + +
                    + + diff --git a/docs/stable/Range.html b/docs/stable/Range.html new file mode 100644 index 000000000..19576c884 --- /dev/null +++ b/docs/stable/Range.html @@ -0,0 +1,115 @@ + + + + Range + + + + + + + + + + + + +
                    +

                    + Range + + record + +

                    + + + + Source + + + + +

                    Fields (and defaults)

                    +
                      + +
                    • + + first: nil + +
                    • + +
                    • + + last: nil + +
                    • + +
                    + + + +

                    Functions summary

                    + + + + + + +
                    +

                    Functions

                    +
                    +

                    + first(range) +

                    +

                    Returns the first item of the range.

                    +
                    + Source +
                    +

                    + last(range) +

                    +

                    Returns the last item of the range.

                    +
                    + Source +
                    +

                    + new(options) +

                    +

                    Returns a new range based on the given options.

                    + +

                    Examples

                    + +
                    Range.new first: 1, last: 10
                    +
                    +
                    + Source +
                    +
                    + + + +
                    + + diff --git a/docs/latest/Record.html b/docs/stable/Record.html similarity index 69% rename from docs/latest/Record.html rename to docs/stable/Record.html index e60e27bf8..7d0015e8a 100644 --- a/docs/latest/Record.html +++ b/docs/stable/Record.html @@ -32,7 +32,7 @@

                  - Source + Source @@ -42,6 +42,11 @@

                  Functions summary

                  • + + access/4 + +
                  • +
                  • defrecord/3 @@ -61,17 +66,26 @@

                    Functions summary

                    Functions

                    +

                    + access(caller, atom, fields, keyword) +

                    +

                    Implements the access macro used by records. +It returns a quoted expression that represents +the access given by the keywords.

                    +
                    + Source +

                    - defrecord/3 + defrecord(name, values, opts)

                    Main entry point for records definition. -This is invoked directly by Elixir.Builtin.defrecord. +This is invoked directly by Kernel.defrecord. Returns the quoted expression of a module given by name.

                    - Source + Source

                    - extract/2 + extract(name, opts)

                    Extract record information from an Erlang file and return the fields as a list of tuples.

                    @@ -81,7 +95,7 @@

                    Examples

                    defrecord FileInfo, Record.extract(:file_info, from_lib: "kernel/include/file.hrl")
                     
                    - Source + Source
                    diff --git a/docs/stable/Regex.CompileError.html b/docs/stable/Regex.CompileError.html new file mode 100644 index 000000000..d34a75700 --- /dev/null +++ b/docs/stable/Regex.CompileError.html @@ -0,0 +1,156 @@ + + + + Regex.CompileError + + + + + + + + + + + + +
                    +

                    + Regex.CompileError + + exception + +

                    + + + + Source + + + + +

                    Fields (and defaults)

                    +
                      + +
                    • + + message: "regex could not be compiled" + +
                    • + +
                    + + + +

                    Functions summary

                    + + + + + + +
                    +

                    Functions

                    +
                    +

                    + exception(args) +

                    +
                    + Source +
                    +

                    + exception(args, self) +

                    +
                    + Source +
                    +

                    + message(record) +

                    +
                    + Source +
                    +

                    + message(value, record) +

                    +
                    + Source +
                    +

                    + new() +

                    +
                    + Source +
                    +

                    + new(opts) +

                    +
                    + Source +
                    +

                    + to_keywords(record) +

                    +
                    + Source +
                    +

                    + update_message(function, record) +

                    +
                    + Source +
                    +
                    + + + +
                    + + diff --git a/docs/latest/Regex.html b/docs/stable/Regex.html similarity index 70% rename from docs/latest/Regex.html rename to docs/stable/Regex.html index ae217c3d0..45ecb468d 100644 --- a/docs/latest/Regex.html +++ b/docs/stable/Regex.html @@ -29,9 +29,9 @@

                    Regular expressions for Elixir built on top of the re module in the Erlang Standard Library. More information can be found -on re documentation: http://www.erlang.org/doc/man/re.html

                    +on re documentation: http://www.erlang.org/doc/man/re.html

                    -

                    Regular expressions in Elixir can be created using Regex.compile +

                    Regular expressions in Elixir can be created using Regex.compile! or using the special form with %r:

                    # A simple regular expressions that matches foo anywhere in the string
                    @@ -41,24 +41,17 @@ 

                    %r/foo/iu

                    -

                    The re module provides several options, some of them are not -available in Elixir while others are enabled by default. The -ones enabled by default are:

                    - -
                      -
                    • multiline - the given string is always considered to be multiline, so -^ and $ marks the beginning and end of each line. You need to use -\A and \z to match the end or beginning of the string
                    • -
                    - -

                    The available options, followed by their shortcut in parenthesis, are:

                    +

                    The re module provides several options, the one available in Elixir, followed by +their shortcut in parenthesis, are:

                    • unicode (u) - used when you want to match against specific unicode characters
                    • caseless (i) - add case insensitivity
                    • -
                    • dotall (m) - causes dot to match newlines and also set newline to anycrlf. +
                    • dotall (s) - causes dot to match newlines and also set newline to anycrlf. The new line setting can be overwritten by setting (*CR) or (*LF) or (*CRLF) or (*ANY) according to re documentation
                    • +
                    • multiline (m) - causes ^ and $ to mark the beginning and end of each line. +You need to use \A and \z to match the end or beginning of the string
                    • extended (x) - whitespace characters are ignored except when escaped and allow # to delimit comments
                    • firstline (f) - forces the unanchored pattern to match before or at the first @@ -77,13 +70,13 @@

                    Most of the functions in this module accept either a binary or a char list -as string subject. The result is based on the argument (a binary will return +as subject. The result is based on the argument (a binary will return a binary, a char list will return a char list).

                    - Source + Source @@ -97,6 +90,16 @@

                    Functions summary

                    compile/2
                  • +
                  • + + compile!/2 + +
                  • +
                  • + + index/2 + +
                  • indexes/2 @@ -158,19 +161,40 @@

                    Functions summary

                    Functions

                    - compile/2 + compile(source, options // "")

                    -

                    Compile the regular expression according to the given options. -The result returned is a record named :re_pattern and its -length can be modified in future releases.

                    +

                    Compiles the regular expression according to the given options.

                    -

                    Check the module documentation for more information -about the options supported by compile.

                    +

                    It returns { :ok, regex } in case of success, +{ :error, reason } otherwise.

                    - Source + Source +
                    +

                    + compile!(source, options // "") +

                    +

                    Compiles the regular expression according to the given options. +Fails with Regex.CompileError if the regex cannot be compiled.

                    +
                    + Source +
                    +

                    + index(arg1, string) +

                    +

                    Runs the regular expression against the given string +and returns the index (zero indexes) where the first +match occurs, nil otherwise.

                    + +

                    Examples

                    + +
                    Regex.index %r/c(d)/, "abcd"  #=> 3
                    +Regex.index %r/e/, "abcd"     #=> nil
                    +
                    +
                    + Source

                    - indexes/2 + indexes(arg1, string)

                    Returns a list with the match indexes in the given string. The matches are tuples where the first element is the index @@ -179,14 +203,14 @@

                    Functions

                    Examples

                    -
                    Regex.run %r/c(d)/, "abcd"  #=> [{2,2},{3,1}]
                    -Regex.run %r/e/, "abcd"     #=> nil
                    +
                    Regex.indexes %r/c(d)/, "abcd"  #=> [{2,2},{3,1}]
                    +Regex.indexes %r/e/, "abcd"     #=> nil
                     
                    - Source + Source

                    - match?/2 + match?(arg1, string)

                    Returns a boolean if there was a match or not.

                    @@ -196,10 +220,10 @@

                    Examples

                    Regex.match? %r/foo/, "bar" #=> false
                    - Source + Source

                    - opts/1 + opts(arg1)

                    Returns the regex options as a list.

                    @@ -208,17 +232,17 @@

                    Examples

                    Regex.opts %r(foo)m #=> 'm'
                     
                    - Source + Source

                    - re_pattern/1 + re_pattern(arg1)

                    Returns the underlying re_pattern in the regular expression.

                    - Source + Source

                    - replace/3 + replace(arg1, string, replacement)

                    Receives a string and a replacement and returns a string where the first match of the regular expressions is replaced by replacement. @@ -235,19 +259,19 @@

                    Examples

                    Regex.replace(%r/(b)/, "abc", "[\\1]") #=> "a[b]c"
                    - Source + Source

                    - replace_all/3 + replace_all(arg1, string, replacement)

                    The same as replace, but replaces all parts where the regular expressions matches in the string. Please read replace/3 for documentation and examples.

                    - Source + Source

                    - run/2 + run(arg1, string)

                    Runs the regular expression against the given string. It returns a list with all matches or nil if no match ocurred.

                    @@ -258,10 +282,10 @@

                    Examples

                    Regex.run %r/e/, "abcd" #=> nil
                    - Source + Source

                    - scan/2 + scan(arg1, string)

                    Same as run, but scans the target several times collecting all matches of the regular expression. A list is returned with each match. If the item in @@ -275,10 +299,10 @@

                    Examples

                    Regex.scan %r/e/, "abcd" #=> []
                    - Source + Source

                    - source/1 + source(arg1)

                    Returns the regex source as binary.

                    @@ -287,15 +311,15 @@

                    Examples

                    Regex.source %r(foo) #=> "foo"
                     
                    - Source + Source

                    - split/3 + split(arg1, string, parts // :infinity)

                    Split the given target in the number of parts specified. If no ammount of parts is given, it defaults to :infinity.

                    - Source + Source
                    diff --git a/docs/latest/RuntimeError.html b/docs/stable/RuntimeError.html similarity index 71% rename from docs/latest/RuntimeError.html rename to docs/stable/RuntimeError.html index d5c04605a..46064cdce 100644 --- a/docs/latest/RuntimeError.html +++ b/docs/stable/RuntimeError.html @@ -29,7 +29,7 @@

                    - Source + Source @@ -79,6 +79,11 @@

                    Functions summary

                    new/1
                  • +
                  • + + to_keywords/1 + +
                  • update_message/2 @@ -95,46 +100,52 @@

                    Functions summary

                    Functions

                    - exception/1 + exception(args)

                    - Source + Source

                    - exception/2 + exception(args, self)

                    - Source + Source

                    - message/1 + message(record)

                    - Source + Source

                    - message/2 + message(value, record)

                    - Source + Source

                    - new/0 + new()

                    - Source + Source

                    - new/1 + new(opts) +

                    +
                    + Source +
                    +

                    + to_keywords(record)

                    - Source + Source

                    - update_message/2 + update_message(function, record)

                    - Source + Source
                diff --git a/docs/latest/SyntaxError.html b/docs/stable/SyntaxError.html similarity index 71% rename from docs/latest/SyntaxError.html rename to docs/stable/SyntaxError.html index d2f9acb93..8d1925949 100644 --- a/docs/latest/SyntaxError.html +++ b/docs/stable/SyntaxError.html @@ -29,7 +29,7 @@

                - Source + Source @@ -116,6 +116,11 @@

                Functions summary

                new/1 +
              • + + to_keywords/1 + +
              • update_description/2 @@ -142,88 +147,94 @@

                Functions summary

                Functions

                - description/1 + description(record)

                - Source + Source

                - description/2 + description(value, record)

                - Source + Source

                - exception/1 + exception(args)

                - Source + Source

                - exception/2 + exception(args, self)

                - Source + Source

                - file/1 + file(record)

                - Source + Source

                - file/2 + file(value, record)

                - Source + Source

                - line/1 + line(record)

                - Source + Source

                - line/2 + line(value, record)

                - Source + Source

                - message/1 + message(exception)

                - Source + Source

                - new/0 + new()

                - Source + Source

                - new/1 + new(opts) +

                +
                + Source +
                +

                + to_keywords(record)

                - Source + Source

                - update_description/2 + update_description(function, record)

                - Source + Source

                - update_file/2 + update_file(function, record)

                - Source + Source

                - update_line/2 + update_line(function, record)

                - Source + Source
              diff --git a/docs/latest/System.html b/docs/stable/System.html similarity index 72% rename from docs/latest/System.html rename to docs/stable/System.html index 01a799629..5e3e1a499 100644 --- a/docs/latest/System.html +++ b/docs/stable/System.html @@ -34,7 +34,7 @@

              - Source + Source @@ -63,6 +63,11 @@

              Functions summary

              cmd/1
            • +
            • + + find_executable/1 + +
            • get_env/0 @@ -109,14 +114,14 @@

              Functions summary

              Functions

              - argv/0 + argv()

              Returns the list of command-line arguments passed to the program.

              - Source + Source

              - at_exit/1 + at_exit(fun)

              Registers a function that will be invoked at the end of program execution. Useful for @@ -125,83 +130,98 @@

              Functions

              The function must expect the exit status code as argument.

              - Source + Source

              - build_info/0 + build_info()

              Returns a tuple { Elixir version, commit sha-1, build date }.

              The format of the return value may change in a future release. Please make sure your code doesn't depend on it.

              - Source + Source

              - cmd/1 + cmd(command)

              Executes command in a command shell of the target OS, captures the standard output of the command and returns the result as a binary.

              + +

              If command is a char list, a char list is returned. +Returns a binary otherwise.

              +
              + Source +
              +

              + find_executable(command) +

              +

              This functions looks up an executable program given +its name using the environment variable PATH on Unix +and Windows.

              + +

              If command is a char list, a char list is returned. +Returns a binary otherwise.

              - Source + Source

              - get_env/0 + get_env()

              Returns a list of all environment variables. Each environment variable is given as a single string of the format "VarName=Value", where VarName is the name of the variable and Value its value.

              - Source + Source

              - get_env/1 + get_env(varname)

              Returns the value of the environment variable varname as a binary, or nil if the environment variable is undefined.

              - Source + Source

              - get_pid/0 + get_pid()

              Returns the process identifier of the current Erlang emulator in the format most commonly used by the operating system environment.

              -

              See http://www.erlang.org/doc/man/os.html#getpid-0 for more info.

              +

              See http://www.erlang.org/doc/man/os.html#getpid-0 for more info.

              - Source + Source

              - put_env/1 + put_env(dict)

              Sets a new value for each environment variable corresponding to each key in dict.

              - Source + Source

              - put_env/2 + put_env(varname, value)

              Sets a new value for the environment variable varname.

              - Source + Source

              - stacktrace/0 + stacktrace()

              Get the stacktrace.

              - Source + Source

              - version/0 + version()

              Returns Elixir's version as binary.

              - Source + Source
              diff --git a/docs/latest/SystemLimitError.html b/docs/stable/SystemLimitError.html similarity index 71% rename from docs/latest/SystemLimitError.html rename to docs/stable/SystemLimitError.html index 4da9e541c..44838f29c 100644 --- a/docs/latest/SystemLimitError.html +++ b/docs/stable/SystemLimitError.html @@ -29,7 +29,7 @@

              - Source + Source @@ -79,6 +79,11 @@

              Functions summary

              new/1
            • +
            • + + to_keywords/1 + +
            • update_message/2 @@ -95,46 +100,52 @@

              Functions summary

              Functions

              - exception/1 + exception(args)

              - Source + Source

              - exception/2 + exception(args, self)

              - Source + Source

              - message/1 + message(record)

              - Source + Source

              - message/2 + message(value, record)

              - Source + Source

              - new/0 + new()

              - Source + Source

              - new/1 + new(opts) +

              +
              + Source +
              +

              + to_keywords(record)

              - Source + Source

              - update_message/2 + update_message(function, record)

              - Source + Source
              diff --git a/docs/latest/TokenMissingError.html b/docs/stable/TokenMissingError.html similarity index 71% rename from docs/latest/TokenMissingError.html rename to docs/stable/TokenMissingError.html index 87010013b..1d9ef120e 100644 --- a/docs/latest/TokenMissingError.html +++ b/docs/stable/TokenMissingError.html @@ -29,7 +29,7 @@

              - Source + Source @@ -116,6 +116,11 @@

              Functions summary

              new/1
            • +
            • + + to_keywords/1 + +
            • update_description/2 @@ -142,88 +147,94 @@

              Functions summary

              Functions

              - description/1 + description(record)

              - Source + Source

              - description/2 + description(value, record)

              - Source + Source

              - exception/1 + exception(args)

              - Source + Source

              - exception/2 + exception(args, self)

              - Source + Source

              - file/1 + file(record)

              - Source + Source

              - file/2 + file(value, record)

              - Source + Source

              - line/1 + line(record)

              - Source + Source

              - line/2 + line(value, record)

              - Source + Source

              - message/1 + message(exception)

              - Source + Source

              - new/0 + new()

              - Source + Source

              - new/1 + new(opts) +

              +
              + Source +
              +

              + to_keywords(record)

              - Source + Source

              - update_description/2 + update_description(function, record)

              - Source + Source

              - update_file/2 + update_file(function, record)

              - Source + Source

              - update_line/2 + update_line(function, record)

              - Source + Source
              diff --git a/docs/latest/EEx.ForEngine.html b/docs/stable/Tuple.html similarity index 54% rename from docs/latest/EEx.ForEngine.html rename to docs/stable/Tuple.html index 18c2e9155..d248ac3e6 100644 --- a/docs/latest/EEx.ForEngine.html +++ b/docs/stable/Tuple.html @@ -1,7 +1,7 @@ - EEx.ForEngine + Tuple @@ -21,33 +21,13 @@

              - EEx.ForEngine + Tuple

              -
              -

              An abstract engine that, when used with the -TransformerEngine, allows a developer to easily loop -using for.

              -

              This engine is included by default on the SmartEngine.

              - -

              Examples

              - -
              defmodule MyEngine do
              -  use EEx.TransformerEngine
              -  use EEx.ForEngine
              -end
              -
              -EEx.eval_string("<%= for x in [1,2,3] do %><%= x %>\n<% end %>", assigns: [foo: 1])
              -#=> "1\n2\n3\n"
              -
              - -
              - - - Source + Source diff --git a/docs/latest/URI.FTP.html b/docs/stable/URI.FTP.html similarity index 84% rename from docs/latest/URI.FTP.html rename to docs/stable/URI.FTP.html index 7779101f1..27de39a0c 100644 --- a/docs/latest/URI.FTP.html +++ b/docs/stable/URI.FTP.html @@ -27,7 +27,7 @@

              - Source + Source @@ -57,16 +57,16 @@

              Functions summary

              Functions

              - default_port/0 + default_port()

              - Source + Source

              - parse/1 + parse(info)

              - Source + Source
              diff --git a/docs/latest/URI.HTTP.html b/docs/stable/URI.HTTP.html similarity index 84% rename from docs/latest/URI.HTTP.html rename to docs/stable/URI.HTTP.html index 604bbd044..3b0d4b01d 100644 --- a/docs/latest/URI.HTTP.html +++ b/docs/stable/URI.HTTP.html @@ -27,7 +27,7 @@

              - Source + Source @@ -57,16 +57,16 @@

              Functions summary

              Functions

              - default_port/0 + default_port()

              - Source + Source

              - parse/1 + parse(info)

              - Source + Source
              diff --git a/docs/latest/URI.HTTPS.html b/docs/stable/URI.HTTPS.html similarity index 84% rename from docs/latest/URI.HTTPS.html rename to docs/stable/URI.HTTPS.html index 6ed5f4e30..348178ef3 100644 --- a/docs/latest/URI.HTTPS.html +++ b/docs/stable/URI.HTTPS.html @@ -27,7 +27,7 @@

              - Source + Source @@ -57,16 +57,16 @@

              Functions summary

              Functions

              - default_port/0 + default_port()

              - Source + Source

              - parse/1 + parse(info)

              - Source + Source
              diff --git a/docs/latest/URI.LDAP.html b/docs/stable/URI.LDAP.html similarity index 84% rename from docs/latest/URI.LDAP.html rename to docs/stable/URI.LDAP.html index 50ae0cd61..05e503e68 100644 --- a/docs/latest/URI.LDAP.html +++ b/docs/stable/URI.LDAP.html @@ -27,7 +27,7 @@

              - Source + Source @@ -57,16 +57,16 @@

              Functions summary

              Functions

              - default_port/0 + default_port()

              - Source + Source

              - parse/1 + parse(info)

              - Source + Source
              diff --git a/docs/latest/URI.Parser.html b/docs/stable/URI.Parser.html similarity index 88% rename from docs/latest/URI.Parser.html rename to docs/stable/URI.Parser.html index 7d21b1d19..a415da2e1 100644 --- a/docs/latest/URI.Parser.html +++ b/docs/stable/URI.Parser.html @@ -33,7 +33,7 @@

              - Source + Source @@ -58,10 +58,10 @@

              Functions summary

              Functions

              - behaviour_info/1 + behaviour_info(atom1)

              - Source + Source
              diff --git a/docs/latest/URI.SFTP.html b/docs/stable/URI.SFTP.html similarity index 84% rename from docs/latest/URI.SFTP.html rename to docs/stable/URI.SFTP.html index 5370eea27..0c58261db 100644 --- a/docs/latest/URI.SFTP.html +++ b/docs/stable/URI.SFTP.html @@ -27,7 +27,7 @@

              - Source + Source @@ -57,16 +57,16 @@

              Functions summary

              Functions

              - default_port/0 + default_port()

              - Source + Source

              - parse/1 + parse(info)

              - Source + Source
              diff --git a/docs/latest/URI.TFTP.html b/docs/stable/URI.TFTP.html similarity index 84% rename from docs/latest/URI.TFTP.html rename to docs/stable/URI.TFTP.html index a871a4b97..7f95f0af5 100644 --- a/docs/latest/URI.TFTP.html +++ b/docs/stable/URI.TFTP.html @@ -27,7 +27,7 @@

              - Source + Source @@ -57,16 +57,16 @@

              Functions summary

              Functions

              - default_port/0 + default_port()

              - Source + Source

              - parse/1 + parse(info)

              - Source + Source
              diff --git a/docs/latest/URI.html b/docs/stable/URI.html similarity index 86% rename from docs/latest/URI.html rename to docs/stable/URI.html index cca33af49..9ec853acf 100644 --- a/docs/latest/URI.html +++ b/docs/stable/URI.html @@ -32,7 +32,7 @@

              - Source + Source @@ -77,14 +77,14 @@

              Functions summary

              Functions

              - decode/1 + decode(arg1)

              Unpercent (URL) decodes a URI.

              - Source + Source

              - decode_query/2 + decode_query(q, dict // Orddict.new())

              Given a query string of the form "key1=value1&key=value2...", produces an orddict with one entry for each key-value pair. Each key and value will be a @@ -92,17 +92,17 @@

              Functions

              Returns nil if the query string is malformed.

              - Source + Source

              - encode/1 + encode(s)

              Percent (URL) encodes a URI.

              - Source + Source

              - encode_query/1 + encode_query(l)

              Takes an enumerable (containing a sequence of two-item tuples) and returns a string of k=v&k2=v2... where keys and values are @@ -110,10 +110,10 @@

              Functions

              that implements the Binary.Chars protocol (i.e. can be converted to binary).

              - Source + Source

              - parse/1 + parse(s)

              Parses a URI into components.

              @@ -132,7 +132,7 @@

              Functions

              for that particular scheme. Take a look at URI.HTTPS for an example of one of these extension modules.

              - Source + Source
              diff --git a/docs/latest/UndefinedFunctionError.html b/docs/stable/UndefinedFunctionError.html similarity index 71% rename from docs/latest/UndefinedFunctionError.html rename to docs/stable/UndefinedFunctionError.html index 5c910e281..fff6816a5 100644 --- a/docs/latest/UndefinedFunctionError.html +++ b/docs/stable/UndefinedFunctionError.html @@ -29,7 +29,7 @@

              - Source + Source @@ -116,6 +116,11 @@

              Functions summary

              new/1
            • +
            • + + to_keywords/1 + +
            • update_arity/2 @@ -142,88 +147,94 @@

              Functions summary

              Functions

              - arity/1 + arity(record)

              - Source + Source

              - arity/2 + arity(value, record)

              - Source + Source

              - exception/1 + exception(args)

              - Source + Source

              - exception/2 + exception(args, self)

              - Source + Source

              - function/1 + function(record)

              - Source + Source

              - function/2 + function(value, record)

              - Source + Source

              - message/1 + message(exception)

              - Source + Source

              - module/1 + module(record)

              - Source + Source

              - module/2 + module(value, record)

              - Source + Source

              - new/0 + new()

              - Source + Source

              - new/1 + new(opts) +

              +
              + Source +
              +

              + to_keywords(record)

              - Source + Source

              - update_arity/2 + update_arity(function, record)

              - Source + Source

              - update_function/2 + update_function(function, record)

              - Source + Source

              - update_module/2 + update_module(function, record)

              - Source + Source
              diff --git a/docs/latest/css/full_list.css b/docs/stable/css/full_list.css similarity index 100% rename from docs/latest/css/full_list.css rename to docs/stable/css/full_list.css diff --git a/docs/latest/css/style.css b/docs/stable/css/style.css similarity index 100% rename from docs/latest/css/style.css rename to docs/stable/css/style.css diff --git a/docs/latest/index.html b/docs/stable/index.html similarity index 85% rename from docs/latest/index.html rename to docs/stable/index.html index f8249b1aa..c66142c5e 100644 --- a/docs/latest/index.html +++ b/docs/stable/index.html @@ -7,6 +7,6 @@ - + \ No newline at end of file diff --git a/docs/latest/js/app.js b/docs/stable/js/app.js similarity index 100% rename from docs/latest/js/app.js rename to docs/stable/js/app.js diff --git a/docs/latest/js/full_list.js b/docs/stable/js/full_list.js similarity index 100% rename from docs/latest/js/full_list.js rename to docs/stable/js/full_list.js diff --git a/docs/latest/js/jquery.js b/docs/stable/js/jquery.js similarity index 100% rename from docs/latest/js/jquery.js rename to docs/stable/js/jquery.js diff --git a/docs/latest/modules_list.html b/docs/stable/modules_list.html similarity index 50% rename from docs/latest/modules_list.html rename to docs/stable/modules_list.html index 6b0137e6c..f220a82af 100644 --- a/docs/latest/modules_list.html +++ b/docs/stable/modules_list.html @@ -16,7 +16,7 @@

              - Elixir v0.5.0 + Elixir v0.6.0

            +
          • @@ -106,6 +100,41 @@

          • +
          • + + |||/2 + + Bitwise +
          • + +
          • + + ~~~/1 + + Bitwise +
          • + +

          +
        • @@ -188,6 +232,13 @@

          Code

        • +
        • + + ensure_compiled/1 + + Code +
        • +
        • ensure_loaded/1 @@ -237,7 +288,22 @@

          Code

        • -
      • +
      • + + string_to_ast/2 + + Code +
      • + +
      • + + string_to_ast!/2 + + Code +
      • + +
      +
    547. @@ -259,7 +325,8 @@

        -
    548. + +
    549. @@ -292,19 +359,8 @@

      EEx.Engine

    550. -
    551. - - - - ForEngine - - - EEx.ForEngine -
    552. -
        - - -
    553. + +
    554. @@ -330,7 +386,8 @@

      EEx.SmartEngine

    555. -
    556. + +
    557. @@ -343,6 +400,7 @@

      +
    558. @@ -386,2042 +444,3775 @@

      EEx

    559. -
    560. + +
    561. - - Elixir.Builtin + + Enum - Elixir.Builtin + Enum
    562. +
    563. + + + + ExUnit + + + ExUnit +
    564. + +
    565. + + + + Exception + + + Exception +
    566. + +
    567. + + + + File + + + File +
    568. + +
    569. + + + + GenServer.Behavior + + + GenServer.Behavior +
    570. + +
    571. + + + + HashDict + + + HashDict +
    572. + +
    573. + + + + IEx + + + IEx +
    574. + +
    575. + + + + IO + + + IO +
    576. +
    577. + +
    578. - - Elixir.ParallelCompiler + + Kernel - Elixir.ParallelCompiler + Kernel +
    579. + +
    580. - - Elixir.SpecialForms + + ParallelRequire - Elixir.SpecialForms + Kernel.ParallelRequire
      • - <<>>/1 + files/2 - Elixir.SpecialForms + Kernel.ParallelRequire
      • -
      • - - []/1 - - Elixir.SpecialForms -
      • +
      +
    581. + + + + SpecialForms + + + Kernel.SpecialForms +
    582. +
    583. + +
    584. - - Enum + + Typespec - Enum + Kernel.Typespec
    585. + +
    586. - filter/2 + !/1 - Enum + Kernel
    587. - filter_map/3 + !=/2 - Enum + Kernel
    588. - find/3 + !==/2 - Enum + Kernel
    589. - find_value/3 + &&/2 - Enum + Kernel
    590. - join/2 + */2 - Enum + Kernel
    591. - map/2 + +/2 - Enum + Kernel
    592. - map_join/3 + ++/2 - Enum + Kernel
    593. - map_reduce/3 + -/2 - Enum + Kernel
    594. - partition/2 + --/2 - Enum + Kernel
    595. - qsort/1 + ../2 - Enum + Kernel
    596. - reduce/3 + //2 - Enum + Kernel
    597. - split/2 + />/2 - Enum + Kernel
    598. - split_with/2 + </2 - Enum + Kernel
    599. - take/2 + <-/2 - Enum + Kernel
    600. - take_while/2 + <=/2 - Enum + Kernel
    601. - times/2 + <>/2 - Enum + Kernel
    602. - times/3 + ==/2 - Enum + Kernel
    603. -
    604. - - - - ExUnit - - - ExUnit -
    605. -
    606. - - - - Exception - - - Exception -
    607. -
    608. - - - - File - - - File -
    609. -
    610. - - - - GenServer.Behavior - - - GenServer.Behavior -
    611. -
    612. - - - - HashDict - - - HashDict -
    613. -
    614. - - - - IO - - - IO -
    615. -
    616. - - - - Keyword - - - Keyword -
    617. -
    618. - - - - List - - - List -
    619. - +
    620. + + + + Keyword + + + Keyword +
    621. + +
    622. + + + + List + + + List +
    623. + +
    624. + + + + Macro + + + Macro +
    625. + +
    626. + + + + Mix + + + Mix +
    627. +
    628. - - - - Macro - - - Macro -
    629. -
    630. + +
    631. @@ -2449,14 +4240,7 @@

    632. - add_doc/5 - - Module -
    633. - -
    634. - - compiled?/1 + add_doc/6 Module
    635. @@ -2477,42 +4261,42 @@

    636. - defined_functions/1 + defines?/2 Module
    637. - defined_functions/2 + defines?/3 Module
    638. - delete_attribute/2 + definitions_in/1 Module
    639. - eval_quoted/4 + definitions_in/2 Module
    640. - function_defined?/2 + delete_attribute/2 Module
    641. - function_defined?/3 + eval_quoted/4 Module
    642. @@ -2526,28 +4310,14 @@

    643. - merge_data/2 - - Module -
    644. - -
    645. - - read_data/1 + read_attribute/2 Module
    646. - read_data/2 - - Module -
    647. - -
    648. - - register_attribute/2 + register_attribute/3 Module
    649. @@ -2566,7 +4336,8 @@

      Module

    650. -
    651. + +
    652. @@ -2620,26 +4391,70 @@

      Node

    653. -
    654. +
    655. + + self/0 + + Node +
    656. + +
    657. + + spawn/3 + + Node +
    658. + +
    659. + + spawn/5 + + Node +
    660. + +
    661. + + spawn_link/2 + + Node +
    662. + +
    663. + + spawn_link/4 + + Node +
    664. + + +
    665. - - OptionParser.Simple + + OptionParser - OptionParser.Simple + OptionParser
    666. + +
    667. @@ -2672,7 +4487,8 @@

      Orddict

    668. -
    669. + +
    670. @@ -2747,7 +4563,8 @@

      Port

    671. -
    672. + +
    673. @@ -2885,13 +4702,6 @@

      Process

    674. -
    675. - - spawn/1 - - Process -
    676. -
    677. spawn/2 @@ -2899,13 +4709,6 @@

      Process

    678. -
    679. - - spawn/3 - - Process -
    680. -
    681. spawn/4 @@ -2920,13 +4723,6 @@

      Process

    682. -
    683. - - spawn_link/2 - - Process -
    684. -
    685. spawn_link/3 @@ -2934,13 +4730,6 @@

      Process

    686. -
    687. - - spawn_link/4 - - Process -
    688. -
    689. spawn_monitor/1 @@ -2955,34 +4744,6 @@

      Process

    690. -
    691. - - spawn_opt/2 - - Process -
    692. - -
    693. - - spawn_opt/3 - - Process -
    694. - -
    695. - - spawn_opt/4 - - Process -
    696. - -
    697. - - spawn_opt/5 - - Process -
    698. -
    699. unlink/1 @@ -3004,7 +4765,8 @@

      Process

    700. -
    701. + +
    702. @@ -3016,6 +4778,13 @@

    703. + +
    704. @@ -3049,6 +4819,20 @@

      Regex

    705. +
    706. + + compile!/2 + + Regex +
    707. + +
    708. + + index/2 + + Regex +
    709. +
    710. indexes/2 @@ -3119,7 +4903,8 @@

      Regex

    711. -
    712. + +
    713. @@ -3159,6 +4944,13 @@

      System

    714. +
    715. + + find_executable/1 + + System +
    716. +
    717. get_env/0 @@ -3208,7 +5000,8 @@

      System

    718. -
    719. + +
    720. @@ -3220,14 +5013,8 @@

    721. + +
    722. @@ -3263,7 +5050,8 @@

      URI.FTP

    723. -
    724. + +
    725. @@ -3289,7 +5077,8 @@

      URI.HTTP

    726. -
    727. + +
    728. @@ -3315,7 +5104,8 @@

      URI.HTTPS

    729. -
    730. + +
    731. @@ -3341,7 +5131,8 @@

      URI.LDAP

    732. -
    733. + +
    734. @@ -3360,7 +5151,8 @@

      URI.Parser

    735. -
    736. + +
    737. @@ -3386,7 +5178,8 @@

      URI.SFTP

    738. -
    739. + +
    740. @@ -3413,6 +5206,7 @@

    741. +
    742. @@ -3450,7 +5244,8 @@

    743. + - \ No newline at end of file + diff --git a/docs/latest/protocols_list.html b/docs/stable/protocols_list.html similarity index 63% rename from docs/latest/protocols_list.html rename to docs/stable/protocols_list.html index 39b6e4a5a..c946f4d3f 100644 --- a/docs/latest/protocols_list.html +++ b/docs/stable/protocols_list.html @@ -16,7 +16,7 @@

    744. -
    745. - - - - BitString - - - Access.BitString -
    746. -
        - - -
      • - - access/2 - - Access.BitString -
      • - -
    747. + +
    748. @@ -100,7 +82,8 @@

      Access.Function

    749. -
    750. + +
    751. @@ -119,26 +102,8 @@

      Access.List

    752. -
    753. - - - - Tuple - - - Access.Tuple -
    754. -
        - - -
      • - - access/2 - - Access.Tuple -
      • -
      +
    755. @@ -147,7 +112,8 @@

      Access

    756. -
    757. + +
    758. @@ -176,7 +142,8 @@

      Binary.Chars.Atom

    759. -
    760. + +
    761. @@ -195,7 +162,8 @@

      Binary.Chars.BitString

    762. -
    763. + +
    764. @@ -214,7 +182,8 @@

      Binary.Chars.List

    765. -
    766. + +
    767. @@ -234,6 +203,7 @@

    768. +
    769. @@ -242,7 +212,8 @@

      Binary.Chars

    770. -
    771. + +
    772. @@ -271,7 +242,8 @@

      Binary.Inspect.Any

    773. -
    774. + +
    775. @@ -290,7 +262,8 @@

      Binary.Inspect.Atom

    776. -
    777. + +
    778. @@ -309,7 +282,8 @@

      Binary.Inspect.BitString

    779. -
    780. + +
    781. @@ -335,7 +309,8 @@

      Binary.Inspect.List

    782. -
    783. + +
    784. @@ -354,7 +329,8 @@

      Binary.Inspect.Number

    785. -
    786. + +
    787. @@ -373,7 +349,8 @@

      Binary.Inspect.Regex

    788. -
    789. + +
    790. @@ -393,6 +370,7 @@

    791. +
    792. @@ -401,7 +379,8 @@

      Binary.Inspect

    793. -
    794. + +
    795. @@ -414,210 +393,212 @@

    796. - - HashDict.Record + + HashDict - Dict.HashDict.Record + Dict.HashDict
    797. + +
    798. - - Orddict.Record + + Orddict - Dict.Orddict.Record + Dict.Orddict
    799. +
    800. @@ -717,7 +698,8 @@

      Dict

    801. -
    802. + +
    803. @@ -730,23 +712,58 @@

    804. - - HashDict.Record + + Function - Enum.Iterator.HashDict.Record + Enum.Iterator.Function
    805. +
    806. + + iterator/1 + + Enum.Iterator.Function +
    807. + + +
    808. + + + + HashDict + + + Enum.Iterator.HashDict +
    809. +
        + + +
      • + + count/1 + + Enum.Iterator.HashDict +
      • + +
      • + + iterator/1 + + Enum.Iterator.HashDict +
      • + +
      +
    810. @@ -758,6 +775,13 @@

    811. + +
    812. - - Orddict.Record + + Orddict - Enum.Iterator.Orddict.Record + Enum.Iterator.Orddict
    813. +
    814. + + + + Range + + + Enum.Iterator.Range +
    815. +
        + + +
      • + + count/1 + + Enum.Iterator.Range +
      • + +
      • + + iterator/1 + + Enum.Iterator.Range +
      • + +
      + + +
    816. + + count/1 + + Enum.Iterator +
    817. @@ -793,7 +860,8 @@

      Enum.Iterator

    818. -
    819. + +
    820. @@ -804,6 +872,33 @@

    821. + +
    822. + + + + Orddict + + + Enum.OrdIterator.Orddict +
    823. +
        + + +
      • + + iterator/1 + + Enum.OrdIterator.Orddict +
      • + +
      • + + to_list/2 + + Enum.OrdIterator.Orddict +
      • + +
      +
    824. - - Orddict.Record + + Range - Enum.OrdIterator.Orddict.Record + Enum.OrdIterator.Range
    825. +
    826. @@ -871,7 +995,62 @@

      Enum.OrdIterator

    827. -
    828. + +
    829. + + + + IEx.Autocomplete.Entry.IEx.Autocomplete.Fun + + + IEx.Autocomplete.Entry.IEx.Autocomplete.Fun +
    830. +
        + + +
      • + + to_entries/1 + + IEx.Autocomplete.Entry.IEx.Autocomplete.Fun +
      • + +
      • + + to_hint/2 + + IEx.Autocomplete.Entry.IEx.Autocomplete.Fun +
      • + +
      +
    831. + + + + IEx.Autocomplete.Entry.IEx.Autocomplete.Mod + + + IEx.Autocomplete.Entry.IEx.Autocomplete.Mod +
    832. +
        + + +
      • + + to_entries/1 + + IEx.Autocomplete.Entry.IEx.Autocomplete.Mod +
      • + +
      • + + to_hint/2 + + IEx.Autocomplete.Entry.IEx.Autocomplete.Mod +
      • + +
      +
    833. @@ -900,7 +1079,8 @@

      List.Chars.Atom

    834. -
    835. + +
    836. @@ -919,7 +1099,8 @@

      List.Chars.BitString

    837. -
    838. + +
    839. @@ -938,7 +1119,8 @@

      List.Chars.List

    840. -
    841. + +
    842. @@ -958,6 +1140,7 @@

    843. +
    844. @@ -967,7 +1150,62 @@

    845. +
    846. + + + + Range.Iterator + + + Range.Iterator +
    847. + + - \ No newline at end of file + diff --git a/docs/latest/records_list.html b/docs/stable/records_list.html similarity index 54% rename from docs/latest/records_list.html rename to docs/stable/records_list.html index ee7dbd744..2448e2d6d 100644 --- a/docs/latest/records_list.html +++ b/docs/stable/records_list.html @@ -16,7 +16,7 @@

    848. +
    849. + + to_keywords/1 + + ArgumentError +
    850. +
    851. update_message/2 @@ -94,7 +101,8 @@

      ArgumentError

    852. -
    853. + +
    854. @@ -148,6 +156,13 @@

      ArithmeticError

    855. +
    856. + + to_keywords/1 + + ArithmeticError +
    857. +
    858. update_message/2 @@ -155,7 +170,8 @@

      ArithmeticError

    859. -
    860. + +
    861. @@ -230,6 +246,13 @@

      BadArityError

    862. +
    863. + + to_keywords/1 + + BadArityError +
    864. +
    865. update_args/2 @@ -244,7 +267,8 @@

      BadArityError

    866. -
    867. + +
    868. @@ -305,6 +329,13 @@

      BadFunctionError

    869. +
    870. + + to_keywords/1 + + BadFunctionError +
    871. +
    872. update_actual/2 @@ -312,7 +343,8 @@

      BadFunctionError

    873. -
    874. + +
    875. @@ -373,6 +405,13 @@

      CaseClauseError

    876. +
    877. + + to_keywords/1 + + CaseClauseError +
    878. +
    879. update_actual/2 @@ -380,7 +419,8 @@

      CaseClauseError

    880. -
    881. + +
    882. @@ -469,6 +509,13 @@

      CompileError

    883. +
    884. + + to_keywords/1 + + CompileError +
    885. +
    886. update_description/2 @@ -490,7 +537,8 @@

      CompileError

    887. -
    888. + +
    889. @@ -544,6 +592,13 @@

      EEx.SyntaxError

    890. +
    891. + + to_keywords/1 + + EEx.SyntaxError +
    892. +
    893. update_message/2 @@ -551,7 +606,77 @@

      EEx.SyntaxError

    894. -
    895. + +
    896. + + + + Enum.OutOfBoundsError + + + Enum.OutOfBoundsError +
    897. + +
    898. @@ -612,6 +737,13 @@

      ErlangError

    899. +
    900. + + to_keywords/1 + + ErlangError +
    901. +
    902. update_original/2 @@ -619,7 +751,8 @@

      ErlangError

    903. -
    904. + +
    905. @@ -673,6 +806,13 @@

      ExUnit.AssertionError

    906. +
    907. + + to_keywords/1 + + ExUnit.AssertionError +
    908. +
    909. update_message/2 @@ -680,7 +820,147 @@

      ExUnit.AssertionError

    910. -
    911. + +
    912. + + + + File.CopyError + + + File.CopyError +
    913. + +
    914. @@ -769,6 +1049,13 @@

      File.Error

    915. +
    916. + + to_keywords/1 + + File.Error +
    917. +
    918. update_action/2 @@ -790,484 +1077,1249 @@

      File.Error

    919. -
    920. + +
    921. - - File.Info + + File.IteratorError - File.Info + File.IteratorError
    922. +
    923. + + + + File.Stat + + + File.Stat +
    924. +
    925. - - - - FunctionClauseError - - - FunctionClauseError -
    926. - +
    927. + + + + FunctionClauseError + + + FunctionClauseError +
    928. + +
    929. + + + + Keyword.KeyError + + + Keyword.KeyError +
    930. + +
    931. + + + + Macro.Env + + + Macro.Env +
    932. + +
    933. + + + + MatchError + + + MatchError +
    934. + +
    935. + + + + Mix.Dep + + + Mix.Dep +
    936. + +
    937. + + + + Mix.Error + + + Mix.Error +
    938. + +
    939. + + + + Mix.InvalidTaskError + + + Mix.InvalidTaskError +
    940. +
    941. + +
    942. - - MatchError + + Mix.NoProjectError - MatchError + Mix.NoProjectError
    943. +
    944. + + + + Mix.NoTaskError + + + Mix.NoTaskError +
    945. + +
    946. + + + + Mix.OutOfDateDepsError + + + Mix.OutOfDateDepsError +
    947. +
    948. + +
    949. @@ -1342,6 +2394,13 @@

      Protocol.UndefinedError

    950. +
    951. + + to_keywords/1 + + Protocol.UndefinedError +
    952. +
    953. update_protocol/2 @@ -1356,7 +2415,111 @@

      Protocol.UndefinedError

    954. -
    955. + +
    956. + + + + Range + + + Range +
    957. + +
    958. + + + + Regex.CompileError + + + Regex.CompileError +
    959. + +
    960. @@ -1410,6 +2573,13 @@

      RuntimeError

    961. +
    962. + + to_keywords/1 + + RuntimeError +
    963. +
    964. update_message/2 @@ -1417,7 +2587,8 @@

      RuntimeError

    965. -
    966. + +
    967. @@ -1506,6 +2677,13 @@

      SyntaxError

    968. +
    969. + + to_keywords/1 + + SyntaxError +
    970. +
    971. update_description/2 @@ -1527,7 +2705,8 @@

      SyntaxError

    972. -
    973. + +
    974. @@ -1581,6 +2760,13 @@

      SystemLimitError

    975. +
    976. + + to_keywords/1 + + SystemLimitError +
    977. +
    978. update_message/2 @@ -1588,7 +2774,8 @@

      SystemLimitError

    979. -
    980. + +
    981. @@ -1677,6 +2864,13 @@

      TokenMissingError

    982. +
    983. + + to_keywords/1 + + TokenMissingError +
    984. +
    985. update_description/2 @@ -1698,7 +2892,8 @@

      TokenMissingError

    986. -
    987. + +
    988. @@ -1787,6 +2982,13 @@

      UndefinedFunctionError

    989. +
    990. + + to_keywords/1 + + UndefinedFunctionError +
    991. +
    992. update_arity/2 @@ -1809,7 +3011,8 @@

    993. + - \ No newline at end of file + diff --git a/getting_started/1.markdown b/getting_started/1.markdown index f724dcb95..6a42857d5 100644 --- a/getting_started/1.markdown +++ b/getting_started/1.markdown @@ -28,16 +28,16 @@ After Erlang is up and running, it is time to install Elixir. You can do that vi Elixir is available in some distributions, they are: -* [Homebrew for Mac OS X via this gist](https://gist.github.com/1955470) +* [Homebrew for Mac OS X via this gist](https://gist.github.com/1968046) * Fedora 17+ and Fedora Rawhide: `sudo yum -y install elixir` If you don't use any of the distributions above, don't worry! We also provide a precompiled package! ### 1.1.2 Precompiled package -Elixir provides a package file with its compiled source for every release. You can grab the latest [in the downloads page](https://github.com/elixir-lang/elixir/downloads) (make sure to download one of the versioned packages under the "Download packages" section and not the "Download as zip/tar.gz" buttons which will rather download Elixir's master). +Elixir provides a package file with its compiled source for every release. You can grab the latest [in the downloads page](https://github.com/elixir-lang/elixir/downloads) (make sure to download one of the versioned packages under the "Download packages" section and not the "Download as zip/tar.gz" buttons which will rather download Elixir's master branch). -After unzip-ing the package, you are ready to run the `elixir` and `iex` commands from the `bin` directory. It is recommended that you also add Elixir's bin path to your PATH environment variable to ease development. In a UNIX system, that can be achieved with: +After unzip-ing the package, you are ready to run the `elixir` and `iex` commands from the `bin` directory. It is recommended that you also add Elixir's bin path to your PATH environment variable to ease development. In a Unix system, that can be achieved with: export PATH="$PATH:/path/to/elixir/bin" diff --git a/getting_started/2.markdown b/getting_started/2.markdown index a5d1d17c9..ad3d814bc 100644 --- a/getting_started/2.markdown +++ b/getting_started/2.markdown @@ -44,7 +44,7 @@ Since updating a tuple is expensive, when we want to add or remove elements, we iex> length [head | tail] 3 -In the example above, we have assigned the head of the list to the variable `head` and the tail of the list to the variable `tail`. The [`Enum` module](/docs/latest/Enum.html) provides several helpers to manipulate lists (and other enumerables in general) while the [`List` module](/docs/latest/List.html) provides several helpers specific to lists: +In the example above, we have assigned the head of the list to the variable `head` and the tail of the list to the variable `tail`. The [`Enum` module](/docs/stable/Enum.html) provides several helpers to manipulate lists (and other enumerables in general) while the [`List` module](/docs/stable/List.html) provides several helpers specific to lists: iex> Enum.map [1,2,3], fn(x) -> x * 2 end [2,4,6] @@ -68,7 +68,7 @@ The reason for such ordering is faster access. Differently from dictionaries, ke iex> [foo: 1, bar: 2, foo: 3] [{:bar,2},{:foo,1},{:foo,3}] -The [`Keyword` module](/docs/latest/Keyword.html) contains several functions that allows a developer to manipulate a keywords list ignoring such duplicated entries or not. For example: +The [`Keyword` module](/docs/stable/Keyword.html) contains several functions that allows a developer to manipulate a keywords list ignoring such duplicated entries or not. For example: iex> keywords = [foo: 1, bar: 2, foo: 3] iex> Keyword.get keywords, :foo @@ -544,7 +544,7 @@ For catching exceptions in Elixir, we can use `rescue` instead of `catch`. Besid x -> x.message end -Custom exceptions can be defined using the `defexception` macro. You can check a list of defined exceptions in [our documentations page](/docs/latest/), by clicking "Records" in the upper left corner. +Custom exceptions can be defined using the `defexception` macro. You can check a list of defined exceptions in [our documentations page](/docs/stable/), by clicking "Records" in the upper left corner. ### 2.7.8 Receive @@ -579,10 +579,10 @@ You may not see exactly `<0.36.0>` back, but something similar. If there are no ...> end Too late -Notice we spawned a new function using the `spawn` function passing another function as argument. Elixir also supports `spawn_link`, which spawns a child process but keeps the parent and child connected. This way, if the child dies unexpectedly, the parent receives a notification. [`Process`](/docs/latest/Process.html) and [`Node`](/docs/latest/Node.html) modules contains many functions to manage processes, including spawning and get information about processes running in other nodes in the network. +Notice we spawned a new function using the `spawn` function passing another function as argument. Elixir also supports `spawn_link`, which spawns a child process but keeps the parent and child connected. This way, if the child dies unexpectedly, the parent receives a notification. [`Process`](/docs/stable/Process.html) and [`Node`](/docs/stable/Node.html) modules contains many functions to manage processes, including spawning and get information about processes running in other nodes in the network. ## 2.8 Built-in functions -Elixir ships with many built-in functions automatically available in the current scope. Besides all the control flow expressions seen above, Elixir also adds: `elem` and `setelem` to read and set values in tuples, `inspect` that returns the representation of a given data type as string and many others. All these functions imported by default are available in [`Kernel`](/docs/latest/Kernel.html) and [Elixir special forms are available in `Kernel.SpecialForms`](/docs/latest/Kernel.SpecialForms.html). +Elixir ships with many built-in functions automatically available in the current scope. Besides all the control flow expressions seen above, Elixir also adds: `elem` and `setelem` to read and set values in tuples, `inspect` that returns the representation of a given data type as string and many others. All these functions imported by default are available in [`Kernel`](/docs/stable/Kernel.html) and [Elixir special forms are available in `Kernel.SpecialForms`](/docs/stable/Kernel.SpecialForms.html). All those functions and control flow expressions are essential for building Elixir programs. The next chapter will discuss how to organize our code into modules, so it can be easily re-used between different components. \ No newline at end of file diff --git a/getting_started/3.markdown b/getting_started/3.markdown index 446828187..8cda36218 100644 --- a/getting_started/3.markdown +++ b/getting_started/3.markdown @@ -184,7 +184,7 @@ Then, we add the head of the list to the accumulator `h + acc` and call `sum_lis When the list is empty, it will match the final clause which returns the final result of `6`. In imperative languages, such implementation would usually fail for large lists because the stacktrace (a stack which keeps our execution path) would grown until it reaches a limit. Erlang however does last call optimization in which the stack does not grow when a function exits by calling another function. -Recursion and last call optimization are an important part of Erlang and are commonly used to create loops, specially in cases where a process needs to wait and respond to messages (using the `receive` macro we saw in the previous chapter). However, recursion as above is rarely used to manipulate lists, since [the `Enum` module](/docs/latest/Enum.html) already abstracts such use cases. For instance, the example above could be simply written as: +Recursion and last call optimization are an important part of Erlang and are commonly used to create loops, specially in cases where a process needs to wait and respond to messages (using the `receive` macro we saw in the previous chapter). However, recursion as above is rarely used to manipulate lists, since [the `Enum` module](/docs/stable/Enum.html) already abstracts such use cases. For instance, the example above could be simply written as: Enum.reduce([1,2,3], 0, fn(x, acc) -> x + acc end) diff --git a/getting_started/5.markdown b/getting_started/5.markdown index a74ec8535..04c19f9a0 100644 --- a/getting_started/5.markdown +++ b/getting_started/5.markdown @@ -94,7 +94,7 @@ Which would fail because the clause and options variables are not defined in the In other words, unquote is a mechanism to inject expressions into the tree being quoted and it is an essential tool for meta-programming. Elixir also provides `unquote_splicing` allowing us to inject many expressions at once. -We can define any macro we want, including ones that override the built-in macros provided by Elixir. For instance, you can redefine `case`, `receive`, `+`, etc. The only exceptions are Elixir special forms that cannot be overridden, [the full list of special forms is available in `Elixir.SpecialForms`](/docs/latest/Elixir.SpecialForms.html). +We can define any macro we want, including ones that override the built-in macros provided by Elixir. For instance, you can redefine `case`, `receive`, `+`, etc. The only exceptions are Elixir special forms that cannot be overridden, [the full list of special forms is available in `Elixir.SpecialForms`](/docs/stable/Elixir.SpecialForms.html). ## 5.3 Macros hygiene diff --git a/getting_started/6.markdown b/getting_started/6.markdown index 3f5b50782..59225b7cf 100644 --- a/getting_started/6.markdown +++ b/getting_started/6.markdown @@ -161,7 +161,7 @@ Since operators are also function calls they can also be partially applied: iex> Enum.map [1,2,3], &1 * 2 [2,4,6] -All functions can be partially applied, except [Elixir's special forms](/docs/latest/Kernel.SpecialForms.html). +All functions can be partially applied, except [Elixir's special forms](/docs/stable/Kernel.SpecialForms.html). ## 6.6 Use diff --git a/getting_started/ex_unit.markdown b/getting_started/ex_unit.markdown index 583b784f2..d6e32f93b 100644 --- a/getting_started/ex_unit.markdown +++ b/getting_started/ex_unit.markdown @@ -31,7 +31,7 @@ In this chapter, we will discuss the most common features available in ExUnit an ## 2 ExUnit -ExUnit is started using `ExUnit.start`. This function accepts a couple options, so [check its documentation](/docs/latest/ExUnit.html) for more details. For now, we will just detail the most common ones: +ExUnit is started using `ExUnit.start`. This function accepts a couple options, so [check its documentation](/docs/stable/ExUnit.html) for more details. For now, we will just detail the most common ones: * `:formatter` - When you run tests with ExUnit, all the IO is done by [the formatter](https://github.com/elixir-lang/elixir/blob/master/lib/ex_unit/lib/ex_unit/formatter.ex). Developers can define their own formatters and this is the configuration that tells ExUnit to use a custom formatter; @@ -79,7 +79,7 @@ Which is more legible. The test macro accepts either a binary or an atom as name ### 3.3 Assertions -Another convenience provided by `ExUnit.Case` is to automatically import a set of assertion macros and functions, available in [`ExUnit.Assertions`](/docs/latest/ExUnit.Assertions.html). +Another convenience provided by `ExUnit.Case` is to automatically import a set of assertion macros and functions, available in [`ExUnit.Assertions`](/docs/stable/ExUnit.Assertions.html). In the majority of tests, the only assertion macros you will need to use are `assert` and `refute`: @@ -106,7 +106,7 @@ assert_raise ArithmeticError, "bad argument in arithmetic expression", fn -> end {% endhighlight %} -So don't forget to check [`ExUnit.Assertions`' documentation](/docs/latest/ExUnit.Assertions.html) for more examples. +So don't forget to check [`ExUnit.Assertions`' documentation](/docs/stable/ExUnit.Assertions.html) for more examples. ### 3.4 Callbacks diff --git a/getting_started/mix.markdown b/getting_started/mix.markdown index 3276f3b53..610ad2c63 100644 --- a/getting_started/mix.markdown +++ b/getting_started/mix.markdown @@ -186,7 +186,7 @@ When writing tasks, there are some common mix functionality we would like to acc * `Mix.Task.run(task, args)` - This is how you invoke a task from another task in Mix; Notice that if the task was already invoked, it works as no-op; -There is more to the Mix API, so feel free to [check the documentation](/docs/latest/Mix.html), with special attention to [`Mix.Task`](/docs/latest/Mix.Task.html) and [`Mix.Project`](/docs/latest/Mix.Project.html). +There is more to the Mix API, so feel free to [check the documentation](/docs/stable/Mix.html), with special attention to [`Mix.Task`](/docs/stable/Mix.Task.html) and [`Mix.Project`](/docs/stable/Mix.Project.html). ### 4.2 Namespaced Tasks @@ -332,7 +332,7 @@ Although not a Mix feature, Elixir ships with an `OptionParser` which is quite u OptionParser.parse(["--source", "lib", "test/enum_test.exs", "--verbose"]) #=> { [source: "lib", verbose: true], ["test/enum_test.exs"] } -Check [`OptionParser`](/docs/latest/OptionParser.html) documentation for more information. +Check [`OptionParser`](/docs/stable/OptionParser.html) documentation for more information. ## 9 Lots To Do From 6de1fa31d651c16bcb4171ab27f3313898c0f780 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Wed, 1 Aug 2012 09:36:34 +0200 Subject: [PATCH 214/437] v0.6.0 released --- _includes/search.html | 2 +- ...2012-08-01-elixir-v0-6-0-released.markdown | 28 +++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 _posts/2012-08-01-elixir-v0-6-0-released.markdown diff --git a/_includes/search.html b/_includes/search.html index bd79984ae..197fa5273 100644 --- a/_includes/search.html +++ b/_includes/search.html @@ -1,6 +1,6 @@ diff --git a/_posts/2012-08-01-elixir-v0-6-0-released.markdown b/_posts/2012-08-01-elixir-v0-6-0-released.markdown new file mode 100644 index 000000000..5915a0f4d --- /dev/null +++ b/_posts/2012-08-01-elixir-v0-6-0-released.markdown @@ -0,0 +1,28 @@ +--- +layout: post +title: Elixir v0.6.0 released +author: José Valim +category: Releases +excerpt: We have finally released Elixir v0.6.0! This release includes a build tool called Mix, support to Erlang typespecs, many improvements to IEx and improved IO, File and Macro support. + +--- + +We have finally released [Elixir](http://elixir-lang.org/) v0.6.0! This release includes a build tool called Mix, support to Erlang typespecs, many improvements to IEx and improved IO, File and Macro support. + +## What's new + +When [we released version v0.5.0](http://elixir-lang.org/blog/2012/05/25/elixir-v0-5-0-released/), we have set three major goals for release v0.6.0: + +1. Provide a build tool that makes it easy to create, compile and test Elixir projects; +2. Support [Erlang typespecs](http://www.erlang.org/doc/reference_manual/typespec.html); +3. Improve IO and File modules to be more robust and complete. + +We have not only achieved those goals for this release, as we have added much more! A couple weeks ago, we have covered some of these unscheduled improvements, as improved Macro handling and Range support, which you can read more about in the ["What's new in Elixir #5" post](http://elixir-lang.org/blog/2012/07/05/what-s-new-in-elixir-5/). + +Our interactive shell (IEx) also had many improvements, thanks to the Elixir developer community. We now have easy access to documentation, remote shells, autocomplete and much more. In order to show you a bit of what you can do in this release, we have prepared a short (~6 min) screencast: + +

      Elixir v0.6 quick tour - Mix and IEx from Plataformatec on Vimeo.

      + +That's it. Of course the documentation was also improved in the process, including two brand new getting started chapters on [Mix](/getting_started/mix.html) and [ExUnit](/getting_started/ex_unit.html). For the next months, we will continue improving Elixir (you can see some ideas floating around in the [issues tracker](github.com/elixir-lang/elixir/issues)) but we will start to focus on other tools and libraries for the community. + +Thank you and don't forget to [give Elixir a try](/getting_started/1.html)! \ No newline at end of file From 76fca6c5da66003fc484f3e477ca6d167f727b3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Wed, 1 Aug 2012 21:04:21 +0300 Subject: [PATCH 215/437] support to -> support for --- _posts/2012-08-01-elixir-v0-6-0-released.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_posts/2012-08-01-elixir-v0-6-0-released.markdown b/_posts/2012-08-01-elixir-v0-6-0-released.markdown index 5915a0f4d..13bfea2fe 100644 --- a/_posts/2012-08-01-elixir-v0-6-0-released.markdown +++ b/_posts/2012-08-01-elixir-v0-6-0-released.markdown @@ -3,11 +3,11 @@ layout: post title: Elixir v0.6.0 released author: José Valim category: Releases -excerpt: We have finally released Elixir v0.6.0! This release includes a build tool called Mix, support to Erlang typespecs, many improvements to IEx and improved IO, File and Macro support. +excerpt: We have finally released Elixir v0.6.0! This release includes a build tool called Mix, support for Erlang typespecs, many improvements to IEx and improved IO, File and Macro support. --- -We have finally released [Elixir](http://elixir-lang.org/) v0.6.0! This release includes a build tool called Mix, support to Erlang typespecs, many improvements to IEx and improved IO, File and Macro support. +We have finally released [Elixir](http://elixir-lang.org/) v0.6.0! This release includes a build tool called Mix, support for Erlang typespecs, many improvements to IEx and improved IO, File and Macro support. ## What's new From 150b7a10673e85826808969149c0f2eab44843d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Ma=C5=82ecki?= Date: Sat, 4 Aug 2012 13:21:01 +0200 Subject: [PATCH 216/437] Don't link to gist, `brew` formula was merged upstream `elixir` formula was added to `homebrew` in pull mxcl/homebrew#12450. --- getting_started/1.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/getting_started/1.markdown b/getting_started/1.markdown index 6a42857d5..3733bfd64 100644 --- a/getting_started/1.markdown +++ b/getting_started/1.markdown @@ -28,7 +28,7 @@ After Erlang is up and running, it is time to install Elixir. You can do that vi Elixir is available in some distributions, they are: -* [Homebrew for Mac OS X via this gist](https://gist.github.com/1968046) +* Homebrew for Mac OS X: `brew install elixir` * Fedora 17+ and Fedora Rawhide: `sudo yum -y install elixir` If you don't use any of the distributions above, don't worry! We also provide a precompiled package! @@ -216,4 +216,4 @@ The reason we can compare different data types is for pragmatism. Sorting algori You actually don't need to memorize this ordering, it is important just to know an order exists. -Well, that is it for the introduction. In the next chapter, we are going to discuss some basic functions, data types conversions and a bit of control-flow. \ No newline at end of file +Well, that is it for the introduction. In the next chapter, we are going to discuss some basic functions, data types conversions and a bit of control-flow. From 2ed01bf2f91c191a583648f7c615216f00f8e101 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sat, 4 Aug 2012 13:02:50 -0300 Subject: [PATCH 217/437] We no longer show functions with mdoc --- index.html | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/index.html b/index.html index 7665c2189..d8d931e41 100644 --- a/index.html +++ b/index.html @@ -110,14 +110,11 @@

      Documentation as first-class citizen

      Different tools can easily access the documentation. For instance, IEx (Elixir's interactive shell) can show the documentation for any module or function with the help of the function d:

      {% highlight text %} -iex> d(MyModule) +iex> d MyModule # MyModule Documentation for my module -## Functions and macros - -* def world() {% endhighlight %} From 7e2d551d2c3dffe419e95f3ada0ee570f53912ad Mon Sep 17 00:00:00 2001 From: yawn Date: Mon, 13 Aug 2012 00:50:49 +0300 Subject: [PATCH 218/437] [fix] typo --- getting_started/1.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/getting_started/1.markdown b/getting_started/1.markdown index 6a42857d5..b26abc0d9 100644 --- a/getting_started/1.markdown +++ b/getting_started/1.markdown @@ -189,7 +189,7 @@ Giving a non-boolean will raise an exception: > Note: If you are an Erlang developer, `and` and `or` in Elixir actually map to the `andalso` and `orelse` operators in Erlang. -Elixir also provides `==`, `!=`, `===`, `!===`, `<=`, `>=`, `<` and `>` as comparison operators: +Elixir also provides `==`, `!=`, `===`, `!==`, `<=`, `>=`, `<` and `>` as comparison operators: iex> 1 == 1 true From d50a258739e0fa6e8ca5ab1a6cd21921191785c4 Mon Sep 17 00:00:00 2001 From: Gosha Arinich Date: Wed, 22 Aug 2012 23:58:36 +0300 Subject: [PATCH 219/437] running elixir application --- getting_started/mix.markdown | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/getting_started/mix.markdown b/getting_started/mix.markdown index 610ad2c63..f6c8ccb1e 100644 --- a/getting_started/mix.markdown +++ b/getting_started/mix.markdown @@ -145,6 +145,19 @@ In general, Mix tries to be smart and compile only when necessary. You can also note that, after you compile for the first time, Mix generates an `my_project.app` file inside your `ebin` directory. This file specifies an Erlang application and it holds information about your application, for example, what are its dependencies, which modules it defines and so forth. In our `MyProject.start` function, when we call `:application.start(:my_project)`, Erlang will load the `my_project.app` file and process it. For instance, if there are any dependencies missing, it will let us now. +### 3.1 Running the application + +Generally, the application starts by calling `MyProject.start` function. +It's the entry point to your application, so besides the call to +`:application.start(:my_project)`, you might want to do actual app job +here. + +There are a few ways to start an application: + +* `mix run "MyProject.start"` +* `mix iex`, and then you get into IEx. You can `MyProject.start` here, + play with exported application functions, and more. + ## 4 Tasks In Mix, a task is simply an Elixir module inside the `Mix.Tasks` namespace and a `run/1` function. For example, the `compile` task is a module named `Mix.Tasks.Compile`. @@ -336,4 +349,4 @@ Check [`OptionParser`](/docs/stable/OptionParser.html) documentation for more in ## 9 Lots To Do -Mix is still a work in progress. Feel free to visit [our issues tracker](https://github.com/elixir-lang/elixir/issues) to add issues for anything you'd like to see in Mix and feel free to contribute. \ No newline at end of file +Mix is still a work in progress. Feel free to visit [our issues tracker](https://github.com/elixir-lang/elixir/issues) to add issues for anything you'd like to see in Mix and feel free to contribute. From c9f7448e776a60099291ca588fc583c04190de46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Wed, 22 Aug 2012 18:37:41 -0300 Subject: [PATCH 220/437] ADd shortcut to iex helpers section --- getting_started/6.markdown | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/getting_started/6.markdown b/getting_started/6.markdown index 59225b7cf..e068d1118 100644 --- a/getting_started/6.markdown +++ b/getting_started/6.markdown @@ -133,11 +133,16 @@ This functionality can also be used to print the documentation for any Elixir mo iex> d(Enum, :each, 2) ... +Or, with the shortcut: + + iex> d(Enum.each/2) + ... + The documentation for built-in functions can also be accessed directly or directly in the built-in module: iex> d(:is_atom, 1) ... - iex> d(Kernel, :is_atom, 1) + iex> d(Kernel.is_atom/1) ... ## 6.5 Partial application From e70f46ca63e9d83976fab8e91a269b92818df873 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Wed, 29 Aug 2012 16:19:07 -0300 Subject: [PATCH 221/437] Talk about code execution --- getting_started/5.markdown | 52 +++++++++++++++++++++++++++++++++++- getting_started/mix.markdown | 6 +---- 2 files changed, 52 insertions(+), 6 deletions(-) diff --git a/getting_started/5.markdown b/getting_started/5.markdown index 04c19f9a0..9ef30ff4a 100644 --- a/getting_started/5.markdown +++ b/getting_started/5.markdown @@ -191,4 +191,54 @@ It is important that the macro is defined before its usage. Failing to define a MyMacros.four #=> ** (UndefinedFunctionError) undefined function: two/0 -With this note, we finish our introduction to macros. Next, let's move to the next chapter which will discuss several topics such as native code compilation, partial application and others. \ No newline at end of file +## 5.5 Code execution + +To finish our discussion about macros, we are going to briefly discuss how code execution works in Elixir. Code execution in Elixir is done in two steps: + +1) All the macros in the code are expanded recursively; +2) The expanded code is compiled to Erlang bytecode and executed + +This behavior is important to understand because it affects how we think about our code structure. Consider the following code: + + defmodule Sample do + case System.get_env("FULL") do + "true" -> + def full?(), do: true + _ -> + def full?(), do: false + end + end + +The code above will define a function `full?` which will return true or false depending on the value of the environment variable `FULL` at **compilation time**. In order to execute this code, Elixir will first expand all macros. Considering that `defmodule` and `def` are macros, the code will expand to something like: + + :elixir_module.store Sample, fn -> + case System.get_env("FULL") do + "true" -> + :elixir_def.store(Foo, :def, :full?, [], true) + _ -> + :elixir_def.store(Foo, :def, :full?, [], false) + end + +This code will then be executed, define a module `Foo` and store the appropriate function based on the value of the environment variable `FULL`. We achieve this by using the modules `:elixir_module` and `:elixir_def`, which are Elixir internal modules written in Erlang. + +There are two lessons to take away from this example: + +1) a macro is always expanded, regardless if it is inside a `case` branch that won't actually match; + +2) we cannot invoke a function or macro just after it is defined in a module. For example, consider: + + defmodule Sample do + def full?, do: true + IO.puts full? + end + + The example above will fail because it translates to: + + :elixir_module.store Sample, fn -> + :elixir_def.store(Foo, :def, :full?, [], true) + IO.puts full? + end + + At the moment this code is compiled to Erlang bytecode, there **isn't** a function `full?` defined in the module, which will lead to a compilation error. + +With those lessons, we finish our introduction to macros. Next, let's move to the next chapter which will discuss several topics such as native code compilation, partial application and others. \ No newline at end of file diff --git a/getting_started/mix.markdown b/getting_started/mix.markdown index f6c8ccb1e..4efba69f2 100644 --- a/getting_started/mix.markdown +++ b/getting_started/mix.markdown @@ -152,11 +152,7 @@ It's the entry point to your application, so besides the call to `:application.start(:my_project)`, you might want to do actual app job here. -There are a few ways to start an application: - -* `mix run "MyProject.start"` -* `mix iex`, and then you get into IEx. You can `MyProject.start` here, - play with exported application functions, and more. +There are a few ways to start an application. You can use the `mix run` task or run `mix iex` to start an Elixir interactive shell and then type `MyProject.start` to play with exported application functions and more. ## 4 Tasks From 058e0ed014c80712867619fafc08b4f57a8ec1dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Wed, 29 Aug 2012 16:26:36 -0300 Subject: [PATCH 222/437] Update master docs --- docs/master/Access.Binary.Dict.html | 68 ++ docs/master/Access.Function.html | 4 +- docs/master/Access.HashDict.html | 68 ++ docs/master/Access.Orddict.html | 68 ++ docs/master/Access.html | 22 +- docs/master/ArgumentError.html | 18 +- docs/master/ArithmeticError.html | 18 +- docs/master/BadArityError.html | 26 +- docs/master/BadFunctionError.html | 20 +- docs/master/Behaviour.html | 89 +++ docs/master/Binary.Chars.html | 2 +- .../{Dict.HashDict.html => Binary.Dict.html} | 97 ++- docs/master/Binary.Inspect.html | 2 +- docs/master/Binary.html | 99 ++- docs/master/CaseClauseError.html | 20 +- docs/master/Code.html | 74 +- docs/master/CompileError.html | 32 +- docs/master/Dict.Orddict.html | 200 ------ docs/master/Dict.html | 97 +-- docs/master/EEx.Engine.html | 2 +- docs/master/Enum.Iterator.Binary.Dict.html | 79 +++ docs/master/Enum.Iterator.Function.html | 6 +- docs/master/Enum.Iterator.HashDict.html | 10 +- docs/master/Enum.Iterator.List.html | 6 +- docs/master/Enum.Iterator.Orddict.html | 6 +- docs/master/Enum.Iterator.Range.html | 6 +- docs/master/Enum.Iterator.html | 10 +- docs/master/Enum.OrdIterator.Binary.Dict.html | 79 +++ docs/master/Enum.OrdIterator.Function.html | 6 +- docs/master/Enum.OrdIterator.List.html | 6 +- docs/master/Enum.OrdIterator.Orddict.html | 6 +- docs/master/Enum.OrdIterator.Range.html | 6 +- docs/master/Enum.OrdIterator.html | 10 +- docs/master/Enum.OutOfBoundsError.html | 18 +- docs/master/Enum.html | 78 ++- docs/master/ErlangError.html | 20 +- docs/master/ExUnit.Assertions.html | 2 +- docs/master/Exception.html | 29 +- docs/master/File.CopyError.html | 38 +- docs/master/File.Error.html | 32 +- docs/master/File.IteratorError.html | 20 +- docs/master/File.html | 133 ++-- docs/master/FunctionClauseError.html | 32 +- ...Behavior.html => GenServer.Behaviour.html} | 8 +- docs/master/HashDict.html | 144 +++- docs/master/IEx.UnicodeIO.html | 4 +- docs/master/IEx.html | 8 +- docs/master/IO.html | 19 +- docs/master/Kernel.SpecialForms.html | 12 +- docs/master/Kernel.html | 286 ++++---- docs/master/Keyword.KeyError.html | 20 +- docs/master/Keyword.html | 66 +- docs/master/List.Chars.html | 2 +- docs/master/List.html | 90 ++- docs/master/Macro.Env.html | 81 ++- docs/master/Macro.html | 2 +- docs/master/MatchError.html | 20 +- docs/master/Mix.Deps.html | 22 +- docs/master/Mix.Project.html | 4 +- docs/master/Mix.Tasks.Compile.Elixir.html | 3 +- docs/master/Mix.Tasks.Loadpaths.html | 2 +- docs/master/Mix.Tasks.New.html | 9 +- docs/master/Mix.Tasks.Run.html | 9 +- docs/master/Mix.Tasks.Test.html | 10 +- docs/master/Mix.Utils.html | 19 +- docs/master/Mix.html | 33 +- docs/master/Module.html | 64 +- docs/master/Orddict.html | 144 +++- docs/master/Process.html | 48 +- docs/master/Protocol.UndefinedError.html | 26 +- docs/master/Range.Iterator.Number.html | 6 +- docs/master/Range.Iterator.html | 10 +- docs/master/Range.html | 75 +- docs/master/Record.html | 65 +- docs/master/Regex.CompileError.html | 18 +- docs/master/Regex.html | 86 ++- docs/master/RuntimeError.html | 18 +- docs/master/SyntaxError.html | 32 +- docs/master/SystemLimitError.html | 18 +- docs/master/TokenMissingError.html | 32 +- docs/master/URI.Parser.html | 23 +- docs/master/URI.html | 21 +- docs/master/UndefinedFunctionError.html | 32 +- docs/master/index.html | 2 +- docs/master/modules_list.html | 648 ++++++++++++++++-- docs/master/protocols_list.html | 401 +++-------- docs/master/records_list.html | 55 +- 87 files changed, 2930 insertions(+), 1431 deletions(-) create mode 100644 docs/master/Access.Binary.Dict.html create mode 100644 docs/master/Access.HashDict.html create mode 100644 docs/master/Access.Orddict.html create mode 100644 docs/master/Behaviour.html rename docs/master/{Dict.HashDict.html => Binary.Dict.html} (61%) delete mode 100644 docs/master/Dict.Orddict.html create mode 100644 docs/master/Enum.Iterator.Binary.Dict.html create mode 100644 docs/master/Enum.OrdIterator.Binary.Dict.html rename docs/master/{GenServer.Behavior.html => GenServer.Behaviour.html} (89%) diff --git a/docs/master/Access.Binary.Dict.html b/docs/master/Access.Binary.Dict.html new file mode 100644 index 000000000..8c03e78b2 --- /dev/null +++ b/docs/master/Access.Binary.Dict.html @@ -0,0 +1,68 @@ + + + + Access.Binary.Dict + + + + + + + + + + + + +
      +

      + Access.Binary.Dict + + impl + +

      + + + + Source + + + + + + +

      Functions summary

      + + + + + + +
      +

      Functions

      +
      +

      + access(dict, key) +

      +
      + Source +
      +
      + + + +
      + + diff --git a/docs/master/Access.Function.html b/docs/master/Access.Function.html index 3fd5a2014..22041f0e4 100644 --- a/docs/master/Access.Function.html +++ b/docs/master/Access.Function.html @@ -29,7 +29,7 @@

      - Source + Source @@ -61,7 +61,7 @@

      Functions

      is useful because it allows a function to be passed as argument in places a dict would also fit.

      - Source + Source diff --git a/docs/master/Access.HashDict.html b/docs/master/Access.HashDict.html new file mode 100644 index 000000000..613b6d092 --- /dev/null +++ b/docs/master/Access.HashDict.html @@ -0,0 +1,68 @@ + + + + Access.HashDict + + + + + + + + + + + + +
      +

      + Access.HashDict + + impl + +

      + + + + Source + + + + + + +

      Functions summary

      + + + + + + +
      +

      Functions

      +
      +

      + access(dict, key) +

      +
      + Source +
      +
      + + + +
      + + diff --git a/docs/master/Access.Orddict.html b/docs/master/Access.Orddict.html new file mode 100644 index 000000000..47b9bd7a7 --- /dev/null +++ b/docs/master/Access.Orddict.html @@ -0,0 +1,68 @@ + + + + Access.Orddict + + + + + + + + + + + + +
      +

      + Access.Orddict + + impl + +

      + + + + Source + + + + + + +

      Functions summary

      + + + + + + +
      +

      Functions

      +
      +

      + access(dict, key) +

      +
      + Source +
      +
      + + + +
      + + diff --git a/docs/master/Access.html b/docs/master/Access.html index a2fe7b890..b2c207913 100644 --- a/docs/master/Access.html +++ b/docs/master/Access.html @@ -35,7 +35,7 @@

      invokes Access.access protocol.

      This protocol is limited and is implemented only for the -following built-in types: keywords, tuples, atoms and +following built-in types: keywords, records, atoms and functions.

      @@ -53,18 +53,36 @@

      Implementations

    994. +
    995. + + Binary.Dict + +
    996. +
    997. Function
    998. +
    999. + + HashDict + +
    1000. +
    1001. List
    1002. +
    1003. + + Orddict + +
    1004. + @@ -89,7 +107,7 @@

      Functions summary

      Functions

      - access(xA, xB) + access(element, qualifier)

      Receives the element being accessed and the access item.

      diff --git a/docs/master/ArgumentError.html b/docs/master/ArgumentError.html index 934d4c77e..84af0cdc8 100644 --- a/docs/master/ArgumentError.html +++ b/docs/master/ArgumentError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -103,49 +103,49 @@

      Functions

      exception(args)

      - Source + Source

      exception(args, self)

      - Source + Source

      message(record)

      - Source + Source

      message(value, record)

      - Source + Source

      new()

      - Source + Source

      new(opts)

      - Source + Source

      to_keywords(record)

      - Source + Source

      update_message(function, record)

      - Source + Source
      diff --git a/docs/master/ArithmeticError.html b/docs/master/ArithmeticError.html index b7483a548..de2fa44b0 100644 --- a/docs/master/ArithmeticError.html +++ b/docs/master/ArithmeticError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -103,49 +103,49 @@

      Functions

      exception(args)

      - Source + Source

      exception(args, self)

      - Source + Source

      message(record)

      - Source + Source

      message(value, record)

      - Source + Source

      new()

      - Source + Source

      new(opts)

      - Source + Source

      to_keywords(record)

      - Source + Source

      update_message(function, record)

      - Source + Source
      diff --git a/docs/master/BadArityError.html b/docs/master/BadArityError.html index 44d289472..38c5c5662 100644 --- a/docs/master/BadArityError.html +++ b/docs/master/BadArityError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -129,73 +129,73 @@

      Functions

      args(record)

      - Source + Source

      args(value, record)

      - Source + Source

      exception(args)

      - Source + Source

      exception(args, self)

      - Source + Source

      function(record)

      - Source + Source

      function(value, record)

      - Source + Source

      message(exception)

      - Source + Source

      new()

      - Source + Source

      new(opts)

      - Source + Source

      to_keywords(record)

      - Source + Source

      update_args(function, record)

      - Source + Source

      update_function(function, record)

      - Source + Source
      diff --git a/docs/master/BadFunctionError.html b/docs/master/BadFunctionError.html index c71393de3..1b586a2a9 100644 --- a/docs/master/BadFunctionError.html +++ b/docs/master/BadFunctionError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -108,55 +108,55 @@

      Functions

      actual(record)

      - Source + Source

      actual(value, record)

      - Source + Source

      exception(args)

      - Source + Source

      exception(args, self)

      - Source + Source

      message(exception)

      - Source + Source

      new()

      - Source + Source

      new(opts)

      - Source + Source

      to_keywords(record)

      - Source + Source

      update_actual(function, record)

      - Source + Source
      diff --git a/docs/master/Behaviour.html b/docs/master/Behaviour.html new file mode 100644 index 000000000..885c60e6e --- /dev/null +++ b/docs/master/Behaviour.html @@ -0,0 +1,89 @@ + + + + Behaviour + + + + + + + + + + + + +
      +

      + Behaviour + +

      + + +
      +

      A convenient module for defining behaviors. +It provides a defcallback macro for defining +the callbacks and automatically generates a +behaviour_info function before compilation.

      + +
      defmodule URI.Parser do
      +  use Behaviour
      +
      +  @doc "Parses the given URL"
      +  defcallback parse(arg)
      +
      +  @doc "Defines a default port"
      +  defcallback default_port(arg)
      +end
      +
      + +
      + + + Source + + + + + + + + +

      Macros summary

      + + + + + + +
      +

      Macros

      +
      +

      + defcallback(fun) +

      +

      Annotates the given function is a callback. defcallback is +slightly different than simple using def because, even if +defcallback contains default values, a default function +won't be generated, which would happen with def.

      +
      + Source +
      +
      + +
      + + diff --git a/docs/master/Binary.Chars.html b/docs/master/Binary.Chars.html index f25f13800..781e850d8 100644 --- a/docs/master/Binary.Chars.html +++ b/docs/master/Binary.Chars.html @@ -97,7 +97,7 @@

      Functions summary

      Functions

      - to_binary(xA) + to_binary(thing)

      Source diff --git a/docs/master/Dict.HashDict.html b/docs/master/Binary.Dict.html similarity index 61% rename from docs/master/Dict.HashDict.html rename to docs/master/Binary.Dict.html index 73d4230f5..95ff68a6b 100644 --- a/docs/master/Dict.HashDict.html +++ b/docs/master/Binary.Dict.html @@ -1,7 +1,7 @@ - Dict.HashDict + Binary.Dict @@ -21,15 +21,22 @@

      - Dict.HashDict - - impl + Binary.Dict

      +
      +

      This module implements a dictionary that forces the keys to be +converted to binaries on insertion. Currently it is implemented +using an Orddict, but this may change in the future.

      + +

      Check the Dict module for examples and documentation.

      + +
      + - Source + Source @@ -65,12 +72,22 @@

      Functions summary

    1005. - merge/2 + merge/3
    1006. - merge/3 + new/0 + +
    1007. +
    1008. + + new/1 + +
    1009. +
    1010. + + new/2
    1011. @@ -117,79 +134,107 @@

      Functions

      delete(arg1, key)

      - Source + Source

      empty(_)

      - Source + Source

      - get(arg1, key, default // nil) + get(arg1, key, default)

      - Source + Source

      has_key?(arg1, key)

      - Source + Source

      keys(arg1)

      - Source + Source
      -

      - merge(arg1, arg2) +

      + merge(d1, d2, fun)

      - Source + Source
      -

      - merge(arg1, arg2, fun) +

      + new()

      -
      - Source +

      Creates a new empty dict.

      +
      + Source +
      +

      + new(pairs) +

      +

      Creates a new dict from a list of pairs.

      + +

      Examples

      + +
      Binary.Dict.new [{:b,1},{:a,2}]
      +#=> [a: 1, b: 2]
      +
      +
      + Source +
      +

      + new(list, transform) +

      +

      Creates a new dict from a list of elements with the +help of the transformation function.

      + +

      Examples

      + +
      Binary.Dict.new ["a", "b"], fn x -> {x, x} end
      +#=> ["a": "a", "b": "b"]
      +
      +
      + Source

      put(arg1, key, value)

      - Source + Source

      size(arg1)

      - Source + Source

      to_list(arg1)

      - Source + Source

      update(arg1, key, fun)

      - Source + Source

      update(arg1, key, initial, fun)

      - Source + Source

      values(arg1)

      - Source + Source
      diff --git a/docs/master/Binary.Inspect.html b/docs/master/Binary.Inspect.html index c83349a8c..46cd9c532 100644 --- a/docs/master/Binary.Inspect.html +++ b/docs/master/Binary.Inspect.html @@ -111,7 +111,7 @@

      Functions summary

      Functions

      - inspect(xA) + inspect(thing)

      Source diff --git a/docs/master/Binary.html b/docs/master/Binary.html index d9925ff26..58a366185 100644 --- a/docs/master/Binary.html +++ b/docs/master/Binary.html @@ -46,11 +46,26 @@

      Functions summary

      escape/2
    1012. +
    1013. + + part/2 + +
    1014. +
    1015. + + part/3 + +
    1016. printable?/1
    1017. +
    1018. + + split/3 + +
    1019. unescape/1 @@ -95,11 +110,55 @@

      Examples

      Source +
      +

      + part(binary, arg2) +

      +

      Extracts a part from the binary according the given range.

      + +

      The range first and last must refer to positions in the binary. +If first or last are negative, they are counted from the end of +the binary.

      + +

      Examples

      + +
      Binary.part("foo", 1..2)      #=> "oo"
      +Binary.part("foobar", 2..4)   #=> "oba"
      +Binary.part("foobar", 0..0)   #=> "f"
      +Binary.part("foobar", 0..-1)  #=> "foobar"
      +Binary.part("foobar", 1..-2)  #=> "ooba"
      +Binary.part("foobar", -3..-1) #=> "bar"
      +
      +
      + Source +
      +

      + part(binary, start, length) +

      +

      Extracts a part from the binary according the given start and length.

      + +

      If a negative length is given, it takes the length counting back from +the given start.

      + +

      If length is out of bounds (i.e. the binary is too short for the given +length), it returns the available part.

      + +

      If start is out of bounds, it simply returns nil.

      + +

      Examples

      + +
      Binary.part("foobar", 1, 2)  #=> "oo"
      +Binary.part("foobar", 3, -3) #=> "foo"
      +Binary.part("foobar", 3, 6)  #=> "bar"
      +Binary.part("foobar", 0, -3) #=> ""
      +
      +
      + Source

      printable?(arg1)

      -

      Check if a binary is printable considering it is encoded +

      Checks if a binary is printable considering it is encoded as UTF-8. Returns true if so, false otherwise.

      Examples

      @@ -107,7 +166,35 @@

      Examples

      Binary.printable?("abc") #=> true
       
      - Source + Source +
      +

      + split(binary, pattern // " ", options // []) +

      +

      Divides a binary into sub binaries based on a pattern, +returning a list of these sub binaries. The pattern can +be another binary, a list of binaries or a regular expression.

      + +

      The binary is split into two parts by default, unless +global option is true. If a pattern is not specified, +the binary is split on whitespace occurrences.

      + +

      It returns a list with the original binary if the pattern can't be matched.

      + +

      Examples

      + +

      Binary.split("a,b,c", ",") #=> ["a", "b,c"] + Binary.split("a,b,c", ",", global: true) #=> ["a", "b,c"] + Binary.split("foo bar") #=> ["foo", "bar"] + Binary.split("1,2 3,4", [" ", ","]) #=> ["1", "2 3,4"] + Binary.split("1,2 3,4", [" ", ","], global: true) #=> ["1", "2", "3", "4"] + Binary.split("a,b", ".") #=> ["a,b"]

      + +

      Binary.split("a,b,c", %r{,}) #=> ["a", "b,c"] + Binary.split("a,b,c", %r{,}, global: true) #=> ["a", "b", "c"] + Binary.split("a,b", %r{.}) #=> ["a,b"]

      +
      + Source

      unescape(chars) @@ -129,7 +216,7 @@

      Examples

      In the example above, we pass a string with \n escaped and we return a version with it unescaped.

      - Source + Source

      unescape(chars, map) @@ -171,7 +258,7 @@

      Examples

      Binary.unescape "example\\n", unescape_map(&1)
       
      - Source + Source

      unescape_tokens(tokens) @@ -183,7 +270,7 @@

      Examples

      when implementing your own sigils. Check the implementation of Kernel.__b__ for examples.

      - Source + Source

      unescape_tokens(tokens, map) @@ -191,7 +278,7 @@

      Examples

      Unescape the given tokens according to the given map. Check unescape_tokens/1 and unescaped/2 for more information.

      - Source + Source
      diff --git a/docs/master/CaseClauseError.html b/docs/master/CaseClauseError.html index e2732e8dc..da348ccb0 100644 --- a/docs/master/CaseClauseError.html +++ b/docs/master/CaseClauseError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -108,55 +108,55 @@

      Functions

      actual(record)

      - Source + Source

      actual(value, record)

      - Source + Source

      exception(args)

      - Source + Source

      exception(args, self)

      - Source + Source

      message(exception)

      - Source + Source

      new()

      - Source + Source

      new(opts)

      - Source + Source

      to_keywords(record)

      - Source + Source

      update_actual(function, record)

      - Source + Source
      diff --git a/docs/master/Code.html b/docs/master/Code.html index 752c40315..326bd5a5e 100644 --- a/docs/master/Code.html +++ b/docs/master/Code.html @@ -115,6 +115,11 @@

      Functions summary

      string_to_ast!/2
    1020. +
    1021. + + unload_files/1 + +
    1022. @@ -131,7 +136,7 @@

      Functions

      Appends a path to Erlang VM code path. The path is expanded with File.expand_path before added.

      - Source + Source

      compile_string(string, file // "nofile") @@ -142,7 +147,7 @@

      Functions

      For compiling many files at once, check Kernel.ParallelCompiler.

      - Source + Source

      compiler_options() @@ -150,7 +155,7 @@

      Functions

      Loads the compilation options from the code server. Check compiler_options/1 for more information.

      - Source + Source

      compiler_options(opts) @@ -170,7 +175,7 @@

      Functions

      without raising errors, false by default;
    1023. - Source + Source

      ensure_compiled(module) @@ -187,7 +192,7 @@

      Functions

      Check ensure_loaded/1 for more information on module loading and when to use ensure_loaded/1 or ensure_compiled/1.

      - Source + Source

      ensure_loaded(module) @@ -229,7 +234,7 @@

      Code.ensure_compiled

      must be used just in same rare conditions, usually involving macros that needs to invoke a module for callback information.

      - Source + Source

      eval(string, binding // [], opts // []) @@ -258,7 +263,7 @@

      Examples

      #=> { 3, [ {:a, 1}, {:b, 2} ] }
      - Source + Source

      eval_quoted(quoted, binding // [], opts // []) @@ -291,19 +296,23 @@

      Examples

      #=> { 3, [ {:a, 1}, {:b, 2} ] }
      - Source + Source

      load_file(file, relative_to // nil)

      -

      Loads the given file. Accepts relative_to as an argument to tell -where the file is located. If the file was already required/loaded, -loads it again. It returns the full path of the loaded file.

      - -

      When loading a file, you may skip passing .exs as extension as Elixir -automatically adds it for you.

      +

      Loads the given file. Accepts relative_to as an argument +to tell where the file is located. If the file was already +required/loaded, loads it again. It returns all the modules +defined in the file.

      + +

      Notice that if load_file is invoked by different processes +concurrently, the target file will be invoked concurrently +in many times. I.e. if load_file is called N times with +a given file, the given file will be loaded N times. Check +require_file if you don't want a file to be loaded concurrently.

      - Source + Source

      loaded_files() @@ -318,19 +327,24 @@

      Examples

      Prepends a path to Erlang VM code path. The path is expanded with File.expand_path before added.

      - Source + Source

      require_file(file, relative_to // nil)

      -

      Requires the given file. Accepts relative_to as an argument to tell -where the file is located. If the file was already required/loaded, -returns nil, otherwise the full path of the loaded file.

      - -

      When requiring a file, you may skip passing .exs as extension as -Elixir automatically adds it for you.

      +

      Requires the given file. Accepts relative_to as an argument +to tell where the file is located. If the file was already +required/loaded, loads it again. It returns all the modules +defined in the file.

      + +

      Notice that if require_file is invoked by different processes +concurrently, the first process to invoke require_file acquires +a lock and the remaining ones will block until the file is +available. I.e. if require_file is called N times with a given +file, the given file will be loaded only once. Check load_file +if you want a file to be loaded concurrently.

      - Source + Source

      string_to_ast(string, opts // []) @@ -346,7 +360,7 @@

      Options

    1024. :line - The line reported in the ENV variable.

    1025. - Source + Source

      string_to_ast!(string, opts // []) @@ -364,7 +378,17 @@

      Options

    1026. :line - The line reported in the ENV variable.

    1027. - Source + Source +
      +

      + unload_files(files) +

      +

      Removes the given files from the loaded files list. +The modules defined in the file are not removed, +calling this function only removes it from the list, +allowing it to be required again.

      +
      + Source
      diff --git a/docs/master/CompileError.html b/docs/master/CompileError.html index 2af7d7487..56d96a965 100644 --- a/docs/master/CompileError.html +++ b/docs/master/CompileError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -150,91 +150,91 @@

      Functions

      description(record)

      - Source + Source

      description(value, record)

      - Source + Source

      exception(args)

      - Source + Source

      exception(args, self)

      - Source + Source

      file(record)

      - Source + Source

      file(value, record)

      - Source + Source

      line(record)

      - Source + Source

      line(value, record)

      - Source + Source

      message(exception)

      - Source + Source

      new()

      - Source + Source

      new(opts)

      - Source + Source

      to_keywords(record)

      - Source + Source

      update_description(function, record)

      - Source + Source

      update_file(function, record)

      - Source + Source

      update_line(function, record)

      - Source + Source
      diff --git a/docs/master/Dict.Orddict.html b/docs/master/Dict.Orddict.html deleted file mode 100644 index 5de22fa0f..000000000 --- a/docs/master/Dict.Orddict.html +++ /dev/null @@ -1,200 +0,0 @@ - - - - Dict.Orddict - - - - - - - - - - - - -
      -

      - Dict.Orddict - - impl - -

      - - - - Source - - - - - - -

      Functions summary

      - - - - - - -
      -

      Functions

      -
      -

      - delete(arg1, key) -

      -
      - Source -
      -

      - empty(_) -

      -
      - Source -
      -

      - get(arg1, key, default // nil) -

      -
      - Source -
      -

      - has_key?(arg1, key) -

      -
      - Source -
      -

      - keys(arg1) -

      -
      - Source -
      -

      - merge(arg1, arg2) -

      -
      - Source -
      -

      - merge(arg1, arg2, fun) -

      -
      - Source -
      -

      - put(arg1, key, value) -

      -
      - Source -
      -

      - size(arg1) -

      -
      - Source -
      -

      - to_list(arg1) -

      -
      - Source -
      -

      - update(arg1, key, fun) -

      -
      - Source -
      -

      - update(arg1, key, initial, fun) -

      -
      - Source -
      -

      - values(arg1) -

      -
      - Source -
      -
      - - - -
      - - diff --git a/docs/master/Dict.html b/docs/master/Dict.html index ac36c91fe..8e8631ab9 100644 --- a/docs/master/Dict.html +++ b/docs/master/Dict.html @@ -23,15 +23,14 @@

      Dict - protocol -

      -

      This module provides the Dict protocol -with the goal of being a common API -to work with dictionaries.

      +

      This module specifies the Dict API expected to be +implemented by different dictionaries. It also provides +functions that redirect to the target based on the tuple +signature.

      @@ -39,23 +38,6 @@

      Source -

      Implementations

      - - @@ -72,11 +54,6 @@

      Functions summary

      empty/1
    1028. -
    1029. - - get/2 - -
    1030. get/3 @@ -143,7 +120,7 @@

      Functions summary

      Functions

      - delete(xA, xB) + delete(dict, key)

      Removes the entry stored under the given key from dict. If dict does not contain key, returns the dictionary unchanged.

      @@ -154,17 +131,17 @@

      Examples

      Dict.delete [b: 2], :a #=> [b: 2]
      - Source + Source

      - empty(xA) + empty(dict)

      Returns an empty dict of the same type as dict.

      - Source + Source
      -

      - get(xA, xB) +

      + get(dict, key, default // nil)

      Returns the value associated with key in dict. If dict does not contain key, returns default (or nil if not provided).

      @@ -176,16 +153,10 @@

      Examples

      Dict.get [a: 1], :b, 3 #=> 3
      - Source -
      -

      - get(xA, xB, xC) -

      -
      - Source + Source

      - has_key?(xA, xB) + has_key?(dict, key)

      Returns whether the given key exists in the given dict.

      @@ -195,10 +166,10 @@

      Examples

      Dict.has_key?([a: 1], :b) #=> false
      - Source + Source

      - keys(xA) + keys(dict)

      Returns a list containing all dict's keys. The keys are not guaranteed to be sorted, unless @@ -209,13 +180,15 @@

      Examples

      Dict.keys [a: 1, b: 2]  #=> [:a,:b]
       
      - Source + Source

      - merge(xA, xB) + merge(dict1, dict2)

      -

      Merges two dicts into one. If the dicts have duplicated entries, the one -given as second argument wins.

      +

      Merges two dicts into one. If the dicts have duplicated entries, +the one given as second argument wins. In case the second argument +is not of the same kind as the first one, it is converted to the +same kind before merging as long as it implements the Enum protocol.

      Examples

      @@ -223,10 +196,10 @@

      Examples

      #=> [a:3, b:2, d: 4]
      - Source + Source

      - merge(xA, xB, xC) + merge(dict1, dict2, fun)

      Merges two dicts into one. If the dicts have duplicated entries, the given function is invoked to solve conflicts.

      @@ -239,10 +212,10 @@

      Examples

      #=> [a: 4, b: 2, d: 4]
      - Source + Source

      - put(xA, xB, xC) + put(dict, key, val)

      Stores the given value under key in dict. If dict already has key, the stored value is replaced by the new one.

      @@ -253,10 +226,10 @@

      Examples

      #=> [a: 3, b: 2]
      - Source + Source

      - size(xA) + size(dict)

      Returns the number of elements in dict.

      @@ -265,18 +238,18 @@

      Examples

      Dict.size [a: 1, b: 2]  #=> 2
       
      - Source + Source

      - to_list(xA) + to_list(dict)

      Returns a list of key-value pairs stored in dict. No particular order is enforced.

      - Source + Source

      - update(xA, xB, xC) + update(dict, key, fun)

      Update a value in dict by calling fun on the value to get a new value. An exception is generated if key is not present in the dict.

      @@ -287,10 +260,10 @@

      Examples

      #=> [a: -1, b: 2]
      - Source + Source

      - update(xA, xB, xC, xD) + update(dict, key, initial, fun)

      Update a value in dict by calling fun on the value to get a new value. If key is not present in dict then initial will be stored as the first @@ -302,10 +275,10 @@

      Examples

      #=> [a: 1, b: 2, c: 3]
      - Source + Source

      - values(xA) + values(dict)

      Returns a list containing all dict's values.

      @@ -314,7 +287,7 @@

      Examples

      Dict.values [a: 1, b: 2]  #=> [1,2]
       
      - Source + Source
      diff --git a/docs/master/EEx.Engine.html b/docs/master/EEx.Engine.html index d5fe1e0ec..2932a2cd7 100644 --- a/docs/master/EEx.Engine.html +++ b/docs/master/EEx.Engine.html @@ -90,7 +90,7 @@

      Functions

      behaviour_info(atom1)

      - Source + Source

      handle_expr(buffer, list2, expr) diff --git a/docs/master/Enum.Iterator.Binary.Dict.html b/docs/master/Enum.Iterator.Binary.Dict.html new file mode 100644 index 000000000..30b61f157 --- /dev/null +++ b/docs/master/Enum.Iterator.Binary.Dict.html @@ -0,0 +1,79 @@ + + + + Enum.Iterator.Binary.Dict + + + + + + + + + + + + +

      +

      + Enum.Iterator.Binary.Dict + + impl + +

      + + + + Source + + + + + + +

      Functions summary

      + + + + + + +
      +

      Functions

      +
      +

      + count(arg1) +

      +
      + Source +
      +

      + iterator(arg1) +

      +
      + Source +
      +
      + + + +
      + + diff --git a/docs/master/Enum.Iterator.Function.html b/docs/master/Enum.Iterator.Function.html index b6bc368fd..6704b90ae 100644 --- a/docs/master/Enum.Iterator.Function.html +++ b/docs/master/Enum.Iterator.Function.html @@ -29,7 +29,7 @@

      - Source + Source @@ -62,13 +62,13 @@

      Functions

      count(function)

      - Source + Source

      iterator(function)

      - Source + Source
      diff --git a/docs/master/Enum.Iterator.HashDict.html b/docs/master/Enum.Iterator.HashDict.html index e0edca8b3..4acbdfb72 100644 --- a/docs/master/Enum.Iterator.HashDict.html +++ b/docs/master/Enum.Iterator.HashDict.html @@ -29,7 +29,7 @@

      - Source + Source @@ -59,16 +59,16 @@

      Functions summary

      Functions

      - count(arg1) + count(dict)

      - Source + Source

      - iterator(arg1) + iterator(dict)

      - Source + Source
      diff --git a/docs/master/Enum.Iterator.List.html b/docs/master/Enum.Iterator.List.html index 0cf75b7b6..922b4c34a 100644 --- a/docs/master/Enum.Iterator.List.html +++ b/docs/master/Enum.Iterator.List.html @@ -29,7 +29,7 @@

      - Source + Source @@ -62,13 +62,13 @@

      Functions

      count(list)

      - Source + Source

      iterator(list)

      - Source + Source
      diff --git a/docs/master/Enum.Iterator.Orddict.html b/docs/master/Enum.Iterator.Orddict.html index ab52a0d1a..2e05d0e23 100644 --- a/docs/master/Enum.Iterator.Orddict.html +++ b/docs/master/Enum.Iterator.Orddict.html @@ -29,7 +29,7 @@

      - Source + Source @@ -62,13 +62,13 @@

      Functions

      count(arg1)

      - Source + Source

      iterator(arg1)

      - Source + Source
      diff --git a/docs/master/Enum.Iterator.Range.html b/docs/master/Enum.Iterator.Range.html index 8b757bfe7..665b09d50 100644 --- a/docs/master/Enum.Iterator.Range.html +++ b/docs/master/Enum.Iterator.Range.html @@ -29,7 +29,7 @@

      - Source + Source @@ -62,13 +62,13 @@

      Functions

      count(range)

      - Source + Source

      iterator(range)

      - Source + Source
      diff --git a/docs/master/Enum.Iterator.html b/docs/master/Enum.Iterator.html index c076be032..1b2b9d410 100644 --- a/docs/master/Enum.Iterator.html +++ b/docs/master/Enum.Iterator.html @@ -51,6 +51,12 @@

      Implementations

        +
      • + + Binary.Dict + +
      • +
      • Function @@ -110,14 +116,14 @@

        Functions summary

        Functions

        - count(xA) + count(collection)

        The function used to retrieve the collection size.

        Source

        - iterator(xA) + iterator(collection)

        Iteration in Elixir happens with the help of a iterator function. Every time this function is called, it must diff --git a/docs/master/Enum.OrdIterator.Binary.Dict.html b/docs/master/Enum.OrdIterator.Binary.Dict.html new file mode 100644 index 000000000..a90101562 --- /dev/null +++ b/docs/master/Enum.OrdIterator.Binary.Dict.html @@ -0,0 +1,79 @@ + + + + Enum.OrdIterator.Binary.Dict + + + + + + + + + + + + +

        +

        + Enum.OrdIterator.Binary.Dict + + impl + +

        + + + + Source + + + + + + +

        Functions summary

        + + + + + + +
        +

        Functions

        +
        +

        + iterator(arg1) +

        +
        + Source +
        +

        + to_list(arg1, _) +

        +
        + Source +
        +
        + + + +
        + + diff --git a/docs/master/Enum.OrdIterator.Function.html b/docs/master/Enum.OrdIterator.Function.html index 583820a96..7d58f1062 100644 --- a/docs/master/Enum.OrdIterator.Function.html +++ b/docs/master/Enum.OrdIterator.Function.html @@ -29,7 +29,7 @@

        - Source + Source @@ -62,13 +62,13 @@

        Functions

        iterator(function)

        - Source + Source

        to_list(arg1, function)

        - Source + Source
        diff --git a/docs/master/Enum.OrdIterator.List.html b/docs/master/Enum.OrdIterator.List.html index 6370c349d..81d754bdf 100644 --- a/docs/master/Enum.OrdIterator.List.html +++ b/docs/master/Enum.OrdIterator.List.html @@ -29,7 +29,7 @@

        - Source + Source @@ -62,13 +62,13 @@

        Functions

        iterator(list)

        - Source + Source

        to_list(arg1, _)

        - Source + Source
        diff --git a/docs/master/Enum.OrdIterator.Orddict.html b/docs/master/Enum.OrdIterator.Orddict.html index a186f26bc..c0d4510ec 100644 --- a/docs/master/Enum.OrdIterator.Orddict.html +++ b/docs/master/Enum.OrdIterator.Orddict.html @@ -29,7 +29,7 @@

        - Source + Source @@ -62,13 +62,13 @@

        Functions

        iterator(arg1)

        - Source + Source

        to_list(arg1, _)

        - Source + Source
        diff --git a/docs/master/Enum.OrdIterator.Range.html b/docs/master/Enum.OrdIterator.Range.html index c59ad03e1..2aca325cc 100644 --- a/docs/master/Enum.OrdIterator.Range.html +++ b/docs/master/Enum.OrdIterator.Range.html @@ -29,7 +29,7 @@

        - Source + Source @@ -62,13 +62,13 @@

        Functions

        iterator(range)

        - Source + Source

        to_list(arg1, iterator)

        - Source + Source
        diff --git a/docs/master/Enum.OrdIterator.html b/docs/master/Enum.OrdIterator.html index e6b0e98e2..d5186bf75 100644 --- a/docs/master/Enum.OrdIterator.html +++ b/docs/master/Enum.OrdIterator.html @@ -48,6 +48,12 @@

        Implementations

          +
        • + + Binary.Dict + +
        • +
        • Function @@ -101,7 +107,7 @@

          Functions summary

          Functions

          - iterator(xA) + iterator(collection)

          Must return a tuple under the same conditions as Enum.Iterator.iterator.

          @@ -109,7 +115,7 @@

          Functions

          Source

          - to_list(xA, xB) + to_list(xA, iterator)

          On each step, the iterator function returned by iterator/1 returns a tuple with two elements. This function receives diff --git a/docs/master/Enum.OutOfBoundsError.html b/docs/master/Enum.OutOfBoundsError.html index be05279cb..dade24699 100644 --- a/docs/master/Enum.OutOfBoundsError.html +++ b/docs/master/Enum.OutOfBoundsError.html @@ -29,7 +29,7 @@

          - Source + Source @@ -103,49 +103,49 @@

          Functions

          exception(args)

          - Source + Source

          exception(args, self)

          - Source + Source

          message(record)

          - Source + Source

          message(value, record)

          - Source + Source

          new()

          - Source + Source

          new(opts)

          - Source + Source

          to_keywords(record)

          - Source + Source

          update_message(function, record)

          - Source + Source
          diff --git a/docs/master/Enum.html b/docs/master/Enum.html index 2a76fb9d3..d7b72b887 100644 --- a/docs/master/Enum.html +++ b/docs/master/Enum.html @@ -66,6 +66,11 @@

          Functions summary

          count/1
        • +
        • + + count/2 + +
        • drop/2 @@ -156,6 +161,11 @@

          Functions summary

          reduce/3
        • +
        • + + reverse/1 + +
        • split/2 @@ -260,6 +270,13 @@

          Examples

          Source +
          +

          + count(collection, fun) +

          +

          Counts for how many items the function returns true.

          +
          + Source

          drop(collection, count) @@ -274,7 +291,7 @@

          Examples

          Enum.drop [1,2,3], 0 #=> [1,2,3]
          - Source + Source

          drop_while(collection, fun) @@ -288,7 +305,7 @@

          Examples

          #=> [3,4,5]
          - Source + Source

          each(collection, fun) @@ -301,7 +318,7 @@

          Examples

          Enum.each ['some', 'example'], fn(x) -> IO.puts x end
           
          - Source + Source

          empty?(collection) @@ -314,7 +331,7 @@

          Examples

          Enum.empty? [1,2,3] #=> false
          - Source + Source

          filter(collection, fun) @@ -328,7 +345,7 @@

          Examples

          #=> [2]
          - Source + Source

          filter_map(collection, filter, mapper) @@ -341,7 +358,7 @@

          Examples

          #=> [4]
          - Source + Source

          find(collection, ifnone // nil, fun) @@ -361,7 +378,7 @@

          Examples

          #=> 3
          - Source + Source

          find_index(collection, fun) @@ -380,7 +397,7 @@

          Examples

          #=> 2
          - Source + Source

          find_value(collection, ifnone // nil, fun) @@ -397,7 +414,7 @@

          Examples

          #=> true
          - Source + Source

          first(collection) @@ -410,7 +427,7 @@

          Examples

          Enum.first [1,2,3] #=> 1
          - Source + Source

          join(collection, joiner // "") @@ -431,7 +448,7 @@

          Examples

          Enum.join([1,2,3], ' = ') #=> '1 = 2 = 3'
          - Source + Source

          map(collection, fun) @@ -449,7 +466,7 @@

          Examples

          #=> [a: -1, b: -2]
          - Source + Source

          map_join(collection, joiner // "", mapper) @@ -470,7 +487,7 @@

          Examples

          Enum.map_join([1,2,3], &1 * 2, ' = ') #=> '2 = 4 = 6'
          - Source + Source

          map_reduce(collection, acc, f) @@ -489,7 +506,7 @@

          Examples

          #=> { [2, 4, 6], 6 }
          - Source + Source

          nth!(collection, n) @@ -506,7 +523,7 @@

          Examples

          Enum.nth! [2,4,6], 5 #=> raises Enum.OutOfBoundsError
          - Source + Source

          partition(collection, fun) @@ -521,7 +538,7 @@

          Examples

          #=> { [2], [1,3] }
          - Source + Source

          qsort(collection) @@ -533,7 +550,7 @@

          Examples

          Enum.qsort [3,2,1] #=> [1,2,3]
           
          - Source + Source

          reduce(collection, acc, fun) @@ -548,7 +565,20 @@

          Examples

          #=> 6
          - Source + Source +
          +

          + reverse(collection) +

          +

          Reverses the collection.

          + +

          Examples

          + +
          Enum.reverse [1, 2, 3]
          +#=> [3, 2, 1]
          +
          +
          + Source

          split(collection, count) @@ -563,7 +593,7 @@

          Examples

          Enum.split [1,2,3], 0 #=> { [], [1,2,3] }
          - Source + Source

          split_with(collection, fun) @@ -577,7 +607,7 @@

          Examples

          #=> { [1], [2, 3, 4] }
          - Source + Source

          take(collection, count) @@ -592,7 +622,7 @@

          Examples

          Enum.take [1,2,3], 0 #=> []
          - Source + Source

          take_while(collection, fun) @@ -606,7 +636,7 @@

          Examples

          #=> [1, 2]
          - Source + Source

          times(times, function) @@ -622,7 +652,7 @@

          Examples

          3
          - Source + Source

          times(times, acc, function) @@ -637,7 +667,7 @@

          Examples

          #=> 15
          - Source + Source diff --git a/docs/master/ErlangError.html b/docs/master/ErlangError.html index 6420f55d1..0bce774eb 100644 --- a/docs/master/ErlangError.html +++ b/docs/master/ErlangError.html @@ -29,7 +29,7 @@

          - Source + Source @@ -108,55 +108,55 @@

          Functions

          exception(args)

          - Source + Source

          exception(args, self)

          - Source + Source

          message(exception)

          - Source + Source

          new()

          - Source + Source

          new(opts)

          - Source + Source

          original(record)

          - Source + Source

          original(value, record)

          - Source + Source

          to_keywords(record)

          - Source + Source

          update_original(function, record)

          - Source + Source
          diff --git a/docs/master/ExUnit.Assertions.html b/docs/master/ExUnit.Assertions.html index b4caf637c..3e410c29d 100644 --- a/docs/master/ExUnit.Assertions.html +++ b/docs/master/ExUnit.Assertions.html @@ -182,7 +182,7 @@

          Examples

          Source

          - assert_raise(exception, expected_message, function) + assert_raise(exception, message, function)

          Asserts the exception is raised during function execution with the expected_message. Returns the rescued exception, fails otherwise.

          diff --git a/docs/master/Exception.html b/docs/master/Exception.html index c95850d2d..daa30b70e 100644 --- a/docs/master/Exception.html +++ b/docs/master/Exception.html @@ -62,6 +62,16 @@

          Functions summary

          format_stacktrace/1
        • +
        • + + formatted_stacktrace/0 + +
        • +
        • + + normalize/1 + +
        @@ -78,14 +88,14 @@

        Functions

        Formats file and line information present in stacktraces. Expect them to be given in a keywords list.

        - Source + Source

        format_file_line(file, line)

        Formats the given file and line.

        - Source + Source

        format_module_fun_arity(module, fun, arity) @@ -101,7 +111,20 @@

        Functions

        Formats each line in the stacktrace.

        - Source + Source +
        +

        + formatted_stacktrace() +

        +

        Returns the stacktrace as a binary formatted as per format_stacktrace/1.

        +
        + Source +
        +

        + normalize(exception) +

        +
        + Source
        diff --git a/docs/master/File.CopyError.html b/docs/master/File.CopyError.html index c495764e5..f8f2cbb49 100644 --- a/docs/master/File.CopyError.html +++ b/docs/master/File.CopyError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -171,109 +171,109 @@

        Functions

        action(record)

        - Source + Source

        action(value, record)

        - Source + Source

        destination(record)

        - Source + Source

        destination(value, record)

        - Source + Source

        exception(args)

        - Source + Source

        exception(args, self)

        - Source + Source

        message(exception)

        - Source + Source

        new()

        - Source + Source

        new(opts)

        - Source + Source

        reason(record)

        - Source + Source

        reason(value, record)

        - Source + Source

        source(record)

        - Source + Source

        source(value, record)

        - Source + Source

        to_keywords(record)

        - Source + Source

        update_action(function, record)

        - Source + Source

        update_destination(function, record)

        - Source + Source

        update_reason(function, record)

        - Source + Source

        update_source(function, record)

        - Source + Source
        diff --git a/docs/master/File.Error.html b/docs/master/File.Error.html index b0cd6526b..8180f46e0 100644 --- a/docs/master/File.Error.html +++ b/docs/master/File.Error.html @@ -29,7 +29,7 @@

        - Source + Source @@ -150,91 +150,91 @@

        Functions

        action(record)

        - Source + Source

        action(value, record)

        - Source + Source

        exception(args)

        - Source + Source

        exception(args, self)

        - Source + Source

        message(exception)

        - Source + Source

        new()

        - Source + Source

        new(opts)

        - Source + Source

        path(record)

        - Source + Source

        path(value, record)

        - Source + Source

        reason(record)

        - Source + Source

        reason(value, record)

        - Source + Source

        to_keywords(record)

        - Source + Source

        update_action(function, record)

        - Source + Source

        update_path(function, record)

        - Source + Source

        update_reason(function, record)

        - Source + Source
        diff --git a/docs/master/File.IteratorError.html b/docs/master/File.IteratorError.html index 8e15528c0..11ed26fc2 100644 --- a/docs/master/File.IteratorError.html +++ b/docs/master/File.IteratorError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -108,55 +108,55 @@

        Functions

        exception(args)

        - Source + Source

        exception(args, self)

        - Source + Source

        message(exception)

        - Source + Source

        new()

        - Source + Source

        new(opts)

        - Source + Source

        reason(record)

        - Source + Source

        reason(value, record)

        - Source + Source

        to_keywords(record)

        - Source + Source

        update_reason(function, record)

        - Source + Source
        diff --git a/docs/master/File.html b/docs/master/File.html index 668139fa6..cedfbd665 100644 --- a/docs/master/File.html +++ b/docs/master/File.html @@ -62,10 +62,15 @@

        to fail in case the file cannot be read (i.e. it is literally an exception).

        +

        Finally, the functions in this module accept either +a char lists or a binary. When manipulating paths, a char +list is returned if one is given as argument. However, +when reading files, binaries are always returned.

        + - Source + Source @@ -249,16 +254,6 @@

        Functions summary

        read!/1
      • -
      • - - read_info/2 - -
      • -
      • - - read_info!/2 - -
      • regular?/1 @@ -385,7 +380,7 @@

        Examples

        #=> "" - Source + Source

        basename(path, extension) @@ -407,7 +402,7 @@

        Examples

        #=> "bar.old"
        - Source + Source

        cd(path) @@ -415,14 +410,14 @@

        Examples

        Sets the current working directory. Returns :ok if successful, { :error, reason } otherwise.

        - Source + Source

        cd!(path)

        The same as cd/0, but raises an exception if it fails.

        - Source + Source

        cd!(path, function) @@ -434,7 +429,7 @@

        Examples

        Raises an error if retrieving or changing the current directory fails.

        - Source + Source

        close(io_device) @@ -446,7 +441,7 @@

        Examples

        close/1 might return an old write error and not even try to close the file. See open/2.

        - Source + Source

        copy(source, destination, bytes_count // :infinity) @@ -465,7 +460,7 @@

        Examples

        Typical error reasons are the same as in open/2, read/1 and write/2.

        - Source + Source

        copy!(source, destination, bytes_count // :infinity) @@ -473,7 +468,7 @@

        Examples

        The same as copy/3 but raises an File.CopyError if it fails. Returns the bytes_copied otherwise.

        - Source + Source

        cp(source, destination, callback // fn _, _ -> @@ -498,7 +493,7 @@

        Examples

        It returns :ok in case of success, returns { :error, reason } otherwise.

        - Source + Source

        cp!(source, destination, callback // fn _, _ -> @@ -508,7 +503,7 @@

        Examples

        The same as cp/3, but raises File.CopyError if it fails. Returns the list of copied files otherwise.

        - Source + Source

        cp_r(source, destination, callback // fn _, _ -> @@ -560,7 +555,7 @@

        Examples

        end
        - Source + Source

        cp_r!(source, destination, callback // fn _, _ -> @@ -570,7 +565,7 @@

        Examples

        The same as cp_r/3, but raises File.CopyError if it fails. Returns the list of copied files otherwise.

        - Source + Source

        cwd() @@ -580,21 +575,21 @@

        Examples

        directories of the current directory. For this reason, returns { :ok, cwd } in case of success, { :error, reason } otherwise.

        - Source + Source

        cwd!()

        The same as cwd/0, but raises an exception if it fails.

        - Source + Source

        dir?(path)

        Returns true if the path is a directory.

        - Source + Source

        dirname(path) @@ -610,7 +605,7 @@

        Examples

        #=> "foo"
        - Source + Source

        exists?(path) @@ -631,7 +626,7 @@

        Examples

        #=> true
        - Source + Source

        expand_path(path) @@ -647,7 +642,7 @@

        Examples

        File.expand_path("/foo/bar/../bar") == "/foo/bar"
         
        - Source + Source

        expand_path(path, relative_to) @@ -665,7 +660,7 @@

        Examples

        File.expand_path("/foo/bar/../bar", "/baz") == "/foo/bar"
        - Source + Source

        extname(path) @@ -683,7 +678,7 @@

        Examples

        #=> ""
        - Source + Source

        iterator(device) @@ -707,7 +702,7 @@

        Examples

        end
        - Source + Source

        iterator(file, mode) @@ -745,7 +740,7 @@

        Examples

        #=> "/foo/bar"
        - Source + Source

        join(left, right) @@ -761,7 +756,7 @@

        Examples

        #=> "foo/bar"
        - Source + Source

        mkdir(path) @@ -780,14 +775,14 @@

        Examples

        On some platforms, :enoent is returned instead.
      - Source + Source

      mkdir!(path)

      Same as mkdir, but raises an exception in case of failure. Otherwise :ok.

      - Source + Source

      mkdir_p(path) @@ -803,14 +798,14 @@

      Examples

    1031. :enotdir - A component of path is not a directory.
    1032. - Source + Source

      mkdir_p!(path)

      Same as mkdir_p, but raises an exception in case of failure. Otherwise :ok.

      - Source + Source

      open(path, modes // []) @@ -860,7 +855,7 @@

      Examples

      File.close(file)
      - Source + Source

      open(path, modes, function) @@ -884,7 +879,7 @@

      Examples

      IO.readline(file) end)

      - Source + Source

      open!(path, modes // []) @@ -892,7 +887,7 @@

      Examples

      Same as open/2 but raises an error if file could not be opened. Returns the io_device otherwise.

      - Source + Source

      open!(path, modes, function) @@ -900,7 +895,7 @@

      Examples

      Same as open/3 but raises an error if file could not be opened. Returns the function result otherwise.

      - Source + Source

      read(path) @@ -922,7 +917,7 @@

      Examples

      You can use Erlang.file.format_error(reason) to get a descriptive string of the error.

      - Source + Source

      read!(path) @@ -930,19 +925,7 @@

      Examples

      Returns binary with the contents of the given filename or raises File.Error if an error occurs.

      - Source -
      -

      - read_info(path, opts // []) -

      -
      - Source -
      -

      - read_info!(path, opts // []) -

      -
      - Source + Source

      regular?(path) @@ -954,7 +937,7 @@

      Examples

      File.regular? __FILE__ #=> true
       
      - Source + Source

      rm(path) @@ -982,14 +965,14 @@

      Examples

      #=> {:error, :eperm}
      - Source + Source

      rm!(path)

      Same as rm, but raises an exception in case of failure. Otherwise :ok.

      - Source + Source

      rm_rf(path) @@ -1011,7 +994,7 @@

      Examples

      #=> { :ok, [] }
      - Source + Source

      rm_rf!(path) @@ -1019,7 +1002,7 @@

      Examples

      Same as rm_rf/1 but raises File.Error in case of failures, otherwise the list of files or directories removed.

      - Source + Source

      rmdir(path) @@ -1036,14 +1019,14 @@

      Examples

      #=> {:error, :enotdir}
      - Source + Source

      rmdir!(path)

      Same as rmdir/1, but raises an exception in case of failure. Otherwise :ok.

      - Source + Source

      rootname(path) @@ -1061,7 +1044,7 @@

      Examples

      #=> "/foo/bar"
      - Source + Source

      rootname(path, extension) @@ -1080,7 +1063,7 @@

      Examples

      #=> "/foo/bar.erl"
      - Source + Source

      split(path) @@ -1098,7 +1081,7 @@

      Examples

      #=> ["/", "foo", "bar"]
      - Source + Source

      stat(path, opts // []) @@ -1117,7 +1100,7 @@

      Options

      Default is local.

    1033. - Source + Source

      stat!(path, opts // []) @@ -1125,7 +1108,7 @@

      Options

      Same as stat but returns the File.Stat directly and throws File.Error if an error is returned.

      - Source + Source

      touch(path, time // calendar.local_time()) @@ -1133,7 +1116,7 @@

      Options

      Updates modification time (mtime) and access time (atime) of the given file. File is created if it doesn’t exist.

      - Source + Source

      touch!(path, time // calendar.local_time()) @@ -1141,7 +1124,7 @@

      Options

      Same as touch/1 but raises an exception if it fails. Returns :ok otherwise.

      - Source + Source

      wildcard(glob) @@ -1181,7 +1164,7 @@

      Examples

      File.wildcard("projects/*/ebin/**/*.{beam,app}")
       
      - Source + Source

      write(path, content, modes // []) @@ -1201,14 +1184,14 @@

      Examples

    1034. :eisdir - The named file is a directory.
    1035. - Source + Source

      write!(path, content, modes // [])

      Same as write/3 but raises an exception if it fails, returns :ok otherwise.

      - Source + Source

      write_stat(path, stat, opts // []) @@ -1216,7 +1199,7 @@

      Examples

      Writes the given File.Stat back to the filesystem at the given path. Returns :ok or { :error, reason }.

      - Source + Source

      write_stat!(path, stat, opts // []) @@ -1224,7 +1207,7 @@

      Examples

      Same as write_stat/3 but raises an exception if it fails. Returns :ok otherwise.

      - Source + Source
      diff --git a/docs/master/FunctionClauseError.html b/docs/master/FunctionClauseError.html index 65884f6c5..16a00a35c 100644 --- a/docs/master/FunctionClauseError.html +++ b/docs/master/FunctionClauseError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -150,91 +150,91 @@

      Functions

      arity(record)

      - Source + Source

      arity(value, record)

      - Source + Source

      exception(args)

      - Source + Source

      exception(args, self)

      - Source + Source

      function(record)

      - Source + Source

      function(value, record)

      - Source + Source

      message(exception)

      - Source + Source

      module(record)

      - Source + Source

      module(value, record)

      - Source + Source

      new()

      - Source + Source

      new(opts)

      - Source + Source

      to_keywords(record)

      - Source + Source

      update_arity(function, record)

      - Source + Source

      update_function(function, record)

      - Source + Source

      update_module(function, record)

      - Source + Source
      diff --git a/docs/master/GenServer.Behavior.html b/docs/master/GenServer.Behaviour.html similarity index 89% rename from docs/master/GenServer.Behavior.html rename to docs/master/GenServer.Behaviour.html index 4db52d446..7a69021af 100644 --- a/docs/master/GenServer.Behavior.html +++ b/docs/master/GenServer.Behaviour.html @@ -1,7 +1,7 @@ - GenServer.Behavior + GenServer.Behaviour @@ -21,13 +21,13 @@ - Source + Source diff --git a/docs/master/HashDict.html b/docs/master/HashDict.html index 4ce626f19..28bb8a145 100644 --- a/docs/master/HashDict.html +++ b/docs/master/HashDict.html @@ -29,12 +29,14 @@

      This module implements a dictionary based on hashing of the keys. It is a simple wrapper around Erlang's dict module -and exposed via the Dict protocol.

      +and exposed via the Dict module.

      + +

      Check the Dict module for examples and documentation.

      - Source + Source @@ -44,6 +46,36 @@

      Functions summary

      @@ -68,12 +130,48 @@

      Functions summary

      Functions

      +

      + delete(arg1, key) +

      +
      + Source +
      +

      + empty(_) +

      +
      + Source +
      +

      + get(arg1, key, default) +

      +
      + Source +
      +

      + has_key?(arg1, key) +

      +
      + Source +
      +

      + keys(arg1) +

      +
      + Source +
      +

      + merge(d1, d2, fun) +

      +
      + Source +

      new()

      Creates a new empty dict.

      - Source + Source

      new(pairs) @@ -86,7 +184,7 @@

      Examples

      #=> [a: 1, b: 2]
      - Source + Source

      new(list, transform) @@ -100,7 +198,43 @@

      Examples

      #=> ["a": "a", "b": "b"]
      - Source + Source +
      +

      + put(arg1, key, value) +

      +
      + Source +
      +

      + size(arg1) +

      +
      + Source +
      +

      + to_list(arg1) +

      +
      + Source +
      +

      + update(arg1, key, fun) +

      +
      + Source +
      +

      + update(arg1, key, initial, fun) +

      +
      + Source +
      +

      + values(arg1) +

      +
      + Source
      diff --git a/docs/master/IEx.UnicodeIO.html b/docs/master/IEx.UnicodeIO.html index 4e93074ed..0301584e4 100644 --- a/docs/master/IEx.UnicodeIO.html +++ b/docs/master/IEx.UnicodeIO.html @@ -74,7 +74,7 @@

      Functions

      Implements the error IO API used by IEx. It prints error messages.

      - Source + Source

      get(config) @@ -91,7 +91,7 @@

      Functions

      Implements the put IO API used by IEx. It receives the result and prints it.

      - Source + Source
      diff --git a/docs/master/IEx.html b/docs/master/IEx.html index d104f4fc4..06a551262 100644 --- a/docs/master/IEx.html +++ b/docs/master/IEx.html @@ -84,7 +84,7 @@

      Functions

      Interface to start IEx from CLI.

      - Source + Source

      run(opts // []) @@ -92,21 +92,21 @@

      Functions

      Runs IEx checking if tty is available or not. If so, invoke tty, otherwise go with the simple iex.

      - Source + Source

      simple(opts // [])

      Starts IEx simply using the current stdio.

      - Source + Source

      tty(opts // [])

      Starts IEx using a tty server.

      - Source + Source
      diff --git a/docs/master/IO.html b/docs/master/IO.html index 87b1d23d0..49e488486 100644 --- a/docs/master/IO.html +++ b/docs/master/IO.html @@ -69,11 +69,6 @@

      Functions summary

      inspect/2

    1036. -
    1037. - - print/2 - -
    1038. puts/2 @@ -117,7 +112,7 @@

      Functions

      NFS file system.

    1039. - Source + Source

      gets(device // :stdio, prompt) @@ -133,7 +128,7 @@

      Functions

      NFS file system.

    1040. - Source + Source

      inspect(device // :stdio, item) @@ -141,13 +136,7 @@

      Functions

      Inspects and writes the given argument to the device followed by a new line. Returns the item given.

      - Source -
      -

      - print(device // :stdio, item) -

      -
      - Source + Source

      puts(device // :stdio, item) @@ -156,7 +145,7 @@

      Functions

      but adds a new line at the end. The argument is expected to be a chardata.

      - Source + Source

      read(device // :stdio, count) diff --git a/docs/master/Kernel.SpecialForms.html b/docs/master/Kernel.SpecialForms.html index 5b0504bcf..972fb3f45 100644 --- a/docs/master/Kernel.SpecialForms.html +++ b/docs/master/Kernel.SpecialForms.html @@ -532,14 +532,14 @@

      Stacktrace information

      is defining new functions. Consider this example:

      defmodule MyServer do
      -  use GenServer.Behavior
      +  use GenServer.Behaviour
       end
       
      -

      GenServer.Behavior defines new functions in our MyServer module. +

      GenServer.Behaviour defines new functions in our MyServer module. However, if there is an exception in any of these functions, we want -the stacktrace to point to the GenServer.Behavior and not the line -that calls use GenServer.Behavior. For this reason, there is an +the stacktrace to point to the GenServer.Behaviour and not the line +that calls use GenServer.Behaviour. For this reason, there is an option called :location that when set to :keep keeps these proper semantics:

      @@ -551,9 +551,9 @@

      Stacktrace information

      It is important to warn though that location: :keep evaluates the -code as if it was defined inside GenServer.Behavior file, in +code as if it was defined inside GenServer.Behaviour file, in particular, the macro __FILE__ will always point to -GenServer.Behavior file.

      +GenServer.Behaviour file.

      Source
      diff --git a/docs/master/Kernel.html b/docs/master/Kernel.html index b9c36b34a..a7c8a588f 100644 --- a/docs/master/Kernel.html +++ b/docs/master/Kernel.html @@ -473,6 +473,11 @@

      Macros summary

      iolist_to_binary/1

    1041. +
    1042. + + is_alive/0 + +
    1043. is_atom/1 @@ -538,6 +543,11 @@

      Macros summary

      is_port/1
    1044. +
    1045. + + is_range/1 + +
    1046. is_record/2 @@ -807,7 +817,7 @@

      Examples

      end - Source + Source

      raise(exception, args) @@ -828,7 +838,7 @@

      Examples

      raise ArgumentError, message: "Sample"
       
      - Source + Source @@ -909,7 +919,7 @@

      Examples

      this operator accepts any expression as arguments, not only booleans, however it is not allowed in guards.

      - Source + Source

      *(left, right) @@ -994,7 +1004,7 @@

      Examples

      3 in 1..3 #=> true
      - Source + Source

      /(left, right) @@ -1030,7 +1040,7 @@

      Examples

      Enum.map(List.flatten([1,[2],3]), &1 * 2)
       
      - Source + Source

      <(left, right) @@ -1092,7 +1102,7 @@

      Examples

      x #=> "bar"
      - Source + Source

      ==(left, right) @@ -1145,7 +1155,7 @@

      Examples

      "abcd" =~ %r/e/ #=> nil
      - Source + Source

      >(left, right) @@ -1221,7 +1231,7 @@

      Examples

      time and not at runtime. Check the module Module for other functions to manipulate module attributes.

      - Source + Source

      __B__(string, list2) @@ -1235,7 +1245,7 @@

      Examples

      %B(f#{o}o) #=> "f\#{o}o"
      - Source + Source

      __C__(arg1, list2) @@ -1249,7 +1259,7 @@

      Examples

      %C(f#{o}o) #=> 'f\#{o}o'
      - Source + Source

      __R__(arg1, options) @@ -1262,7 +1272,7 @@

      Examples

      Regex.match? %R(f#{1,3}o), "f#o"  #=> true
       
      - Source + Source

      __b__(arg1, list2) @@ -1276,7 +1286,7 @@

      Examples

      %b(f#{:o}o) #=> "foo"
      - Source + Source

      __c__(arg1, list2) @@ -1290,7 +1300,7 @@

      Examples

      %c(f#{:o}o) #=> 'foo'
      - Source + Source

      __r__(arg1, options) @@ -1302,7 +1312,7 @@

      Examples

      Regex.match? %r(foo), "foo"  #=> true
       
      - Source + Source

      abs(number) @@ -1391,7 +1401,7 @@

      Examples

      access a, 1 #=> :a
      - Source + Source

      and(left, right) @@ -1444,7 +1454,7 @@

      Examples

      atom_to_binary :my_atom #=> "my_atom"
       
      - Source + Source

      atom_to_binary(atom, encoding) @@ -1509,7 +1519,7 @@

      Examples

      binary_to_atom "my_atom" #=> :my_atom
       
      - Source + Source

      binary_to_atom(binary, encoding) @@ -1538,7 +1548,7 @@

      Examples

      binary_to_existing_atom "my_atom" #=> :my_atom
      - Source + Source

      binary_to_existing_atom(binary, encoding) @@ -1692,7 +1702,7 @@

      Examples

      end
      - Source + Source

      cond(list1) @@ -1712,7 +1722,7 @@

      Examples

      end
      - Source + Source

      def(name, list2) @@ -1789,7 +1799,7 @@

      Dynamic generation with atoms

      because each entry k is a an atom and invoking def unquote(k)() would be invalid Elixir syntax.

      - Source + Source

      def(name, args, guards, list4) @@ -1827,7 +1837,7 @@

      Examples

      end
      - Source + Source

      defdelegate(funs, opts) @@ -1866,14 +1876,14 @@

      Examples

      defdelegate other_reverse(list), to: Erlang.lists, as: :reverse end -MyList.reverse([1,2,3]) +My:lists.reverse([1,2,3]) #=> [3,2,1] MyList.other_reverse([1,2,3]) #=> [3,2,1]
      - Source + Source

      defexception(name, values, opts // [], do_block // []) @@ -1888,7 +1898,7 @@

      Examples

      2) Exceptions must implement message/1 as API and return a binary as result;

      - Source + Source

      defimpl(name, opts, do_block // []) @@ -1896,7 +1906,7 @@

      Examples

      Defines an implementation for the given protocol. See defprotocol/2 for examples.

      - Source + Source

      defmodule(name, list2) @@ -1941,7 +1951,7 @@

      Dynamic names

      Elixir will accept any module name as long as the expression returns an atom.

      - Source + Source

      defoverridable(tuples) @@ -1950,7 +1960,7 @@

      Dynamic names

      An overridable function is lazily defined, allowing a developer to customize it.

      - Source + Source

      defp(name, list2) @@ -1974,14 +1984,14 @@

      Examples

      In the example above, sum is private and accessing it through Foo.sum will raise an error.

      - Source + Source

      defp(name, args, guards, list4)

      The same as def/4 but generates a private function.

      - Source + Source

      defprotocol(name, list2) @@ -2094,7 +2104,7 @@

      Protocols + Records

      Finally, since records are simply tuples, one can add a default protocol implementation to any record by defining a default implementation for tuples.

      - Source + Source

      defrecord(name, values, opts // [], do_block // []) @@ -2123,12 +2133,21 @@

      Examples

      { FileInfo, nil, nil } -

      Default based functions

      +

      Extensions

      -

      Depending on the default value, Elixir will define helpers to interact -with the record. For example, ExUnit defines a record which keeps -track of how many tests were executed and the failures that happened -The record definition is similar to:

      +

      Besides defining readers and writers for each attribute. Elixir will +define extensions functions for each attribute. By default, it will +define an update_#{attribute} function to update the value. Such +functions expect a function as argument that receives the current value +and must return the new one:

      + +
      file_info.update_atime(fn(_old) -> now() end) #=> Updates the value of atime
      +
      + +

      Besides, Elixir may define new functions depending on the default value. +For example, ExUnit defines a record which keeps track of how many tests +were executed and the failures that happened. The record definition is +similar to:

      defrecord Config, counter: 0, failures: []
       
      @@ -2144,22 +2163,24 @@

      Default based functions

      Config.new.increment_counter(10).counter #=> 10
       
      -

      Besides, if the default is a list, Elixir will define three helpers:

      +

      Besides, if the default is a list, Elixir will define two helpers:

      • merge_field - Receives keywords and merge it into the current value;
      • prepend_field - Receives another list and prepend its values
      -

      Documentation

      - -

      By default records are not documented and have @moduledoc set to false. -This can be changed by passing a moduledoc option after values:

      +

      You can define your own extensions or disable them using the except +option:

      -
      defrecord Config, [counter: 0, failures: []], moduledoc: "A simple record"
      +
      defrecord Config, [counter: 0, failures: []], except: [:extensions]
       
      + +

      Documentation

      + +

      By default records are not documented and have @moduledoc set to false.

      - Source + Source

      destructure(left, right) @@ -2200,7 +2221,7 @@

      Examples

      the first value from the right side. Otherwise, it will raise a CaseClauseError.

      - Source + Source

      div(left, right) @@ -2214,7 +2235,7 @@

      Examples

      div 5, 2 #=> 2
       
      - Source + Source

      elem(tuple, index) @@ -2227,7 +2248,7 @@

      Example

      tuple = { :foo, :bar, 3 } elem(tuple, 1) #=> :foo

      - Source + Source

      exit(reason) @@ -2344,7 +2365,7 @@

      Function retrieval

      f.([1,[2],3]) #=> [1,2,3]
      - Source + Source

      function_exported?(module, function, arity) @@ -2356,7 +2377,7 @@

      Function retrieval

      it is not loaded. Check Code.ensure_loaded/1 for more information.

      - Source + Source

      halt() @@ -2452,7 +2473,7 @@

      Blocks examples

      If you want to compare more than two clauses, you can use the cond/1 macro.

      - Source + Source

      in(left, right) @@ -2494,7 +2515,7 @@

      Clauses

      In this case, Elixir will automatically expand it and define the variable for us.

      - Source + Source

      inspect(arg) @@ -2507,7 +2528,7 @@

      Examples

      #=> ":foo"
      - Source + Source

      integer_to_list(number) @@ -2565,45 +2586,53 @@

      Examples

      Source +
      +

      + is_alive() +

      +

      Returns true if the local node is alive; that is, +if the node can be part of a distributed system.

      +
      + Source

      is_atom(term)

      -

      Returns true if term is an atom; otherwise returns false.

      +

      Returns true if term is an atom; otherwise returns false.

      Allowed in guard tests.

      - Source + Source

      is_binary(term)

      -

      Returns true if term is a binary; otherwise returns false.

      +

      Returns true if term is a binary; otherwise returns false.

      A binary always contains a complete number of bytes.

      Allowed in guard tests.

      - Source + Source

      is_bitstring(term)

      -

      Returns true if term is a bitstring (including a binary); otherwise returns false.

      +

      Returns true if term is a bitstring (including a binary); otherwise returns false.

      Allowed in guard tests.

      - Source + Source

      is_boolean(term)

      -

      Returns true if term is either the atom true or the atom false (i.e. a boolean); -otherwise returns false.

      +

      Returns true if term is either the atom true or the atom false (i.e. a boolean); +otherwise returns false.

      Allowed in guard tests.

      - Source + Source

      is_exception(thing) @@ -2616,81 +2645,88 @@

      Examples

      is_exception(1) #=> false
      - Source + Source

      is_float(term)

      -

      Returns true if term is a floating point number; otherwise returns false.

      +

      Returns true if term is a floating point number; otherwise returns false.

      Allowed in guard tests.

      - Source + Source

      is_function(term)

      -

      Returns true if term is a function; otherwise returns false.

      +

      Returns true if term is a function; otherwise returns false.

      Allowed in guard tests.

      - Source + Source

      is_function(term, arity)

      -

      Returns true if term is a function that can be applied with arity number of arguments; -otherwise returns false.

      +

      Returns true if term is a function that can be applied with arity number of arguments; +otherwise returns false.

      Allowed in guard tests.

      - Source + Source

      is_integer(term)

      -

      Returns true if term is an integer; otherwise returns false.

      +

      Returns true if term is an integer; otherwise returns false.

      Allowed in guard tests.

      - Source + Source

      is_list(term)

      -

      Returns true if term is a list with zero or more elements; otherwise returns false.

      +

      Returns true if term is a list with zero or more elements; otherwise returns false.

      Allowed in guard tests.

      - Source + Source

      is_number(term)

      -

      Returns true if term is either an integer or a floating point number; -otherwise returns false.

      +

      Returns true if term is either an integer or a floating point number; +otherwise returns false.

      Allowed in guard tests.

      - Source + Source

      is_pid(term)

      -

      Returns true if term is a pid (process identifier); otherwise returns false.

      +

      Returns true if term is a pid (process identifier); otherwise returns false.

      Allowed in guard tests.

      - Source + Source

      is_port(term)

      -

      Returns true if term is a port identifier; otherwise returns false.

      +

      Returns true if term is a port identifier; otherwise returns false.

      Allowed in guard tests.

      - Source + Source +
      +

      + is_range(thing) +

      +

      Check if the given argument is a range.

      +
      + Source

      is_record(thing, kind) @@ -2707,32 +2743,32 @@

      Examples

      is_record(Config.new, List) #=> false
      - Source + Source

      is_reference(term)

      -

      Returns true if term is a reference; otherwise returns false.

      +

      Returns true if term is a reference; otherwise returns false.

      Allowed in guard tests.

      - Source + Source

      is_regex(thing)

      Check if the given argument is a regex.

      - Source + Source

      is_tuple(term)

      -

      Returns true if term is a tuple; otherwise returns false.

      +

      Returns true if term is a tuple; otherwise returns false.

      Allowed in guard tests.

      - Source + Source

      length(list) @@ -2746,7 +2782,7 @@

      Examples

      length([1,2,3,4,5,6,7,8,9]) #=> 9
       
      - Source + Source

      list_to_atom(char_list) @@ -2758,7 +2794,7 @@

      Examples

      list_to_atom('elixir') #=> :elixir
       
      - Source + Source

      list_to_binary(char_list) @@ -2770,7 +2806,7 @@

      Examples

      list_to_binary('Elixir') #=> "Elixir"
       
      - Source + Source

      list_to_bitstring(bitstring_list) @@ -2788,7 +2824,7 @@

      Examples

      #=> <<1,2,3,1,2,3,4,5,4,6,7|4>>
      - Source + Source

      list_to_existing_atom(char_list) @@ -2796,7 +2832,7 @@

      Examples

      Returns the atom whose text representation is char_list, but only if there already exists such atom.

      - Source + Source

      list_to_float(char_list) @@ -2808,7 +2844,7 @@

      Examples

      list_to_float('2.2017764e+0') #=> 2.2017764
       
      - Source + Source

      list_to_integer(char_list) @@ -2820,7 +2856,7 @@

      Examples

      list_to_integer('123') #=> 123
       
      - Source + Source

      list_to_integer(char_list, base) @@ -2832,7 +2868,7 @@

      Examples

      > list_to_integer('3FF', 16) #=> 1023
       
      - Source + Source

      list_to_pid(char_list) @@ -2851,7 +2887,7 @@

      Examples

      list_to_pid('<0.41>') #=> <0.4.1>
       
      - Source + Source

      list_to_tuple(list) @@ -2863,7 +2899,7 @@

      Examples

      list_to_tuple([share, [:elixir, 163]]). #=> {share, [:elixir, 163]}
       
      - Source + Source

      make_ref() @@ -2879,7 +2915,7 @@

      Examples

      #=> #Ref<0.0.0.135>
      - Source + Source

      match?(left, right) @@ -2906,7 +2942,7 @@

      Examples

      Enum.filter list, match?({:a, x } when x < 2, &1)
      - Source + Source

      max(first, second) @@ -2920,7 +2956,7 @@

      Examples

      max(1, 2) #=> 2
       
      - Source + Source

      min(first, second) @@ -2934,7 +2970,7 @@

      Examples

      min(1, 2) #=> 1
       
      - Source + Source

      node() @@ -2944,7 +2980,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      node(arg) @@ -2955,7 +2991,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      not(arg) @@ -2999,7 +3035,7 @@

      Warning:

      It should not be used in application programs.

      - Source + Source

      receive(args) @@ -3047,7 +3083,7 @@

      Examples

      will occur immediately.

    1047. - Source + Source

      rem(left, right) @@ -3061,7 +3097,7 @@

      Examples

      rem 5, 2 #=> 1
       
      - Source + Source

      round(number) @@ -3074,7 +3110,7 @@

      Examples

      round(5.5) #=> 6
       
      - Source + Source

      self() @@ -3082,7 +3118,7 @@

      Examples

      Returns the pid (process identifier) of the calling process. Allowed in guard clauses.

      - Source + Source

      setelem(tuple, index, value) @@ -3095,7 +3131,7 @@

      Example

      tuple = { :foo, :bar, 3 } setelem(tuple, 1, :baz) #=> { :baz, :bar, 3 }

      - Source + Source

      size(arg) @@ -3103,7 +3139,7 @@

      Example

      Returns the size of the given argument, which must be a tuple or a binary. If possible, please use tuplesize or binarysize.

      - Source + Source

      spawn(fun) @@ -3123,7 +3159,7 @@

      Examples

      end
      - Source + Source

      spawn(module, fun, args) @@ -3139,7 +3175,7 @@

      Examples

      spawn(SomeModule, :function, [1,2,3])
       
      - Source + Source

      spawn_link(fun) @@ -3160,7 +3196,7 @@

      Examples

      end
      - Source + Source

      spawn_link(module, fun, args) @@ -3176,7 +3212,7 @@

      Examples

      spawn_link(SomeModule, :function, [1,2,3])
       
      - Source + Source

      term_to_binary(term) @@ -3188,7 +3224,7 @@

      Examples

      to a file in an efficient way, or sending an Erlang term to some type of communications channel not supported by distributed Erlang.

      - Source + Source

      term_to_binary(term, opts) @@ -3202,21 +3238,21 @@

      Examples

      for more details

    1048. - Source + Source

      throw(term)

      A non-local return from a function. Check try/2 for more information.

      - Source + Source

      tl(list)

      Returns the tail of a list. Raises ArgumentError if the list is empty.

      - Source + Source

      to_binary(arg) @@ -3230,7 +3266,7 @@

      Examples

      #=> "foo"
      - Source + Source

      to_char_list(arg) @@ -3243,7 +3279,7 @@

      Examples

      #=> 'foo'
      - Source + Source

      trunc(number) @@ -3256,7 +3292,7 @@

      Examples

      trunc(5.5) #=> 5
       
      - Source + Source

      try(args) @@ -3364,21 +3400,21 @@

      Catching exits and Erlang errors

      Although the second form should be avoided in favor of raise/rescue control mechanisms.

      - Source + Source

      tuple_size(tuple)

      Returns the size of a tuple.

      - Source + Source

      tuple_to_list(tuple)

      Converts a tuple to a list.

      - Source + Source

      unless(clause, options) @@ -3387,7 +3423,7 @@

      Catching exits and Erlang errors

      unless a value evalutes to true. Check if for examples and documentation.

      - Source + Source

      use(module, args // []) @@ -3420,7 +3456,7 @@

      Examples

      end
      - Source + Source

      var!(var) @@ -3464,7 +3500,7 @@

      Examples

      this operator accepts any expression as arguments, not only booleans, however it is not allowed in guards.

      - Source + Source diff --git a/docs/master/Keyword.KeyError.html b/docs/master/Keyword.KeyError.html index bb74ca1f6..3a3e5f4cf 100644 --- a/docs/master/Keyword.KeyError.html +++ b/docs/master/Keyword.KeyError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -108,55 +108,55 @@

      Functions

      exception(args)

      - Source + Source

      exception(args, self)

      - Source + Source

      key(record)

      - Source + Source

      key(value, record)

      - Source + Source

      message(exception)

      - Source + Source

      new()

      - Source + Source

      new(opts)

      - Source + Source

      to_keywords(record)

      - Source + Source

      update_key(function, record)

      - Source + Source
      diff --git a/docs/master/Keyword.html b/docs/master/Keyword.html index 6f1b1bdcc..5dd22ad68 100644 --- a/docs/master/Keyword.html +++ b/docs/master/Keyword.html @@ -120,6 +120,16 @@

      Functions summary

      put/3 +
    1049. + + update/3 + +
    1050. +
    1051. + + update/4 + +
    1052. values/1 @@ -149,7 +159,7 @@

      Examples

      Keyword.delete [b: 2], :a #=> [b: 2] - Source + Source

      from_enum(enum) @@ -178,7 +188,7 @@

      Examples

      Keyword.get [a: 1], :b, 3 #=> 3
      - Source + Source

      get!(list1, key) @@ -192,7 +202,7 @@

      Examples

      Keyword.get! [a: 1], :b #=> raises KeyError[key: :b]
      - Source + Source

      get_values(list1, key) @@ -205,14 +215,14 @@

      Examples

      #=> [1,2]
      - Source + Source

      key?(list1, key)

      Returns whether a given key exists in the given keywords.

      -

      Examples

      +

      Examples

      Keyword.key?([a: 1], :a)
       #=> true
      @@ -220,7 +230,7 @@ 

      Examples

      #=> false
      - Source + Source

      keys(keywords) @@ -233,7 +243,7 @@

      Examples

      Keyword.keys [a: 1, b: 2] #=> [:a,:b]
       
      - Source + Source

      merge(d1, d2) @@ -247,7 +257,7 @@

      Examples

      #=> [a:3, b:2, d: 4]
      - Source + Source

      merge(d1, d2, fun) @@ -263,7 +273,7 @@

      Examples

      #=> [a:4, b:2, d: 4]
      - Source + Source

      new() @@ -299,7 +309,7 @@

      Examples

      #=> [a: :a, b: :b]
      - Source + Source

      put(list1, key, value) @@ -318,7 +328,39 @@

      Examples

      #=> [a: 3, b: 2]
      - Source + Source +
      +

      + update(list1, key, fun) +

      +

      Updates the key with the given function. If the key does +not exist, raises Keyword.KeyError.

      + +

      Examples

      + +
      Keyword.update([a: 1], :a, &1 * 2)
      +#=> [a: 2]
      +Keyword.update([a: 1], :b, &1 * 2)
      +#=> Keyword.KeyError
      +
      +
      + Source +
      +

      + update(list1, key, initial, fun) +

      +

      Updates the key with the given function. If the key does +not exist, inserts the given initial value.

      + +

      Examples

      + +
      Keyword.update([a: 1], :a, 13, &1 * 2)
      +#=> [a: 2]
      +Keyword.update([a: 1], :b, 11, &1 * 2)
      +#=> [a: 1, b: 11]
      +
      +
      + Source

      values(keywords) @@ -330,7 +372,7 @@

      Examples

      Keyword.values [a: 1, b: 2] #=> [1,2]
       
      - Source + Source diff --git a/docs/master/List.Chars.html b/docs/master/List.Chars.html index e47ec9542..6cb6cb36f 100644 --- a/docs/master/List.Chars.html +++ b/docs/master/List.Chars.html @@ -94,7 +94,7 @@

      Functions summary

      Functions

      - to_char_list(xA) + to_char_list(thing)

      Source diff --git a/docs/master/List.html b/docs/master/List.html index 01c671c83..438b70fa3 100644 --- a/docs/master/List.html +++ b/docs/master/List.html @@ -105,22 +105,27 @@

      Functions summary

    1053. - last/1 + keyreplace/4
    1054. - member?/2 + keystore/4
    1055. - range/3 + last/1
    1056. - reverse/1 + member?/2 + +
    1057. +
    1058. + + range/3
    1059. @@ -227,7 +232,7 @@

      Examples

      #=> [[1,2],[1,2]] - Source + Source

      flatten(list) @@ -285,7 +290,7 @@

      Examples

      Source

      - keydelete(list, item, position) + keydelete(list, key, position)

      Receives a list of tuples and deletes the first tuple where the item at position posistion matches with the @@ -303,10 +308,10 @@

      Examples

      #=> [{ :a, 1 }, { :b, 2 }]
      - Source + Source

      - keyfind(list, item, position, default // nil) + keyfind(list, key, position, default // nil)

      Receives a list of tuples and returns the first tuple where the item at position posistion matches with the @@ -324,10 +329,10 @@

      Examples

      #=> nil
      - Source + Source

      - keymember?(list, item, position) + keymember?(list, key, position)

      Receives a list of tuples and returns true if there is a tuple where the item at position posistion matches @@ -345,7 +350,36 @@

      Examples

      #=> false
      - Source + Source +
      +

      + keyreplace(list, key, position, new_tuple) +

      +

      Receives a list of tuples and replaces the item +identified by key at position pos if it exists.

      + +

      Examples

      + +
      List.keyreplace([a: 1, b: 2], :a, 1, { :a, 3 })
      +#=> [a: 3, b: 2]
      +
      +
      + Source +
      +

      + keystore(list, key, position, new_tuple) +

      +

      Receives a list of tuples and replaces the item +identified by key at position pos. If the item +does not exist, it is added to the end of the list.

      + +

      Examples

      + +
      List.keystore([a: 1, b: 2], :a, 1, { :a, 3 })
      +#=> [a: 3, b: 2]
      +
      +
      + Source

      last(list) @@ -362,7 +396,7 @@

      Examples

      #=> 3
      - Source + Source

      member?(list, term) @@ -380,7 +414,7 @@

      Examples

      #=> false
      - Source + Source

      range(first, last, step // nil) @@ -400,21 +434,7 @@

      Examples

      List.range 5, 1, -2 #=> [5, 3, 1]
      - Source -
      -

      - reverse(list) -

      -

      Reverses the given list. This function simply delegates -to lists:reverse which is implemented in C for performance.

      - -

      Examples

      - -
      List.reverse [1,2,3]
      -#=> [3,2,1]
      -
      -
      - Source + Source

      sort(list) @@ -428,7 +448,7 @@

      Examples

      #=> [1, 2, 3, 4, 7]
      - Source + Source

      sort(list, fun) @@ -442,7 +462,7 @@

      Examples

      #=> [7, 4, 3, 2, 1]
      - Source + Source

      uniq(list) @@ -455,7 +475,7 @@

      Examples

      #=> [1,2,3]
      - Source + Source

      unzip(list) @@ -472,7 +492,7 @@

      Examples

      #=> [[1, 2, 3], [:a, :b, :c]]
      - Source + Source

      wrap(list) @@ -486,7 +506,7 @@

      Examples

      List.wrap [1,2,3] #=> [1,2,3]
       
      - Source + Source

      zip(list_of_lists) @@ -502,7 +522,7 @@

      Examples

      #=> [{1, 3, 5}]
      - Source + Source

      zip(item1, item2) @@ -520,7 +540,7 @@

      Examples

      #=> [{1, 4}, {2, 5}]
      - Source + Source diff --git a/docs/master/Macro.Env.html b/docs/master/Macro.Env.html index 3f830967a..1a5031731 100644 --- a/docs/master/Macro.Env.html +++ b/docs/master/Macro.Env.html @@ -28,8 +28,14 @@

      +
      +

      A record that contains compile time environment information, +It can be accessed at any time by calling ENV.

      + +
      + - Source + Source @@ -93,12 +99,12 @@

      Functions summary

      @@ -156,28 +177,28 @@

      Functions summary

      Functions

      -

      - __access__(caller, args) -

      -

      A record that contains compile time environment information, -It can be accessed at any time by calling ENV.

      -
      - Source -

      aliases(record)

      Returns a list of two item tuples, where the first item is the aliased name and the second the actual name.

      - Source + Source +
      +

      + context(record) +

      +

      Returns the context of the environment. It can be nil +(default context), inside a guard or inside an assign.

      +
      + Source

      file(record)

      Returns the current file name as a binary.

      - Source + Source

      function(record) @@ -186,7 +207,7 @@

      Functions

      is the function name and the seconds its arity. Returns nil if not inside a function.

      - Source + Source

      in_guard?(record) @@ -194,7 +215,7 @@

      Functions

      Returns wether the compilation environment is currently inside a guard.

      - Source + Source

      in_match?(record) @@ -202,14 +223,14 @@

      Functions

      Returns wether the compilation environment is currently inside a match clause.

      - Source + Source

      line(record)

      Returns the current line as an integer.

      - Source + Source

      location(record) @@ -217,28 +238,46 @@

      Functions

      Returns a keywords list containing the file and line information as keys.

      - Source + Source

      macros(record)

      Returns a list of macros imported from each module.

      - Source + Source

      module(record)

      Returns the current module name.

      - Source + Source +
      +

      + new() +

      +
      + Source +
      +

      + new(opts) +

      +
      + Source

      requires(record)

      Returns the list of required modules.

      - Source + Source +
      +

      + to_keywords(record) +

      +
      + Source
      diff --git a/docs/master/Macro.html b/docs/master/Macro.html index 1d655ebfb..b2030ad26 100644 --- a/docs/master/Macro.html +++ b/docs/master/Macro.html @@ -193,7 +193,7 @@

      Examples

      end - Source + Source

      to_binary(tree) diff --git a/docs/master/MatchError.html b/docs/master/MatchError.html index a1aa5f729..89c8a4a10 100644 --- a/docs/master/MatchError.html +++ b/docs/master/MatchError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -108,55 +108,55 @@

      Functions

      actual(record)

      - Source + Source

      actual(value, record)

      - Source + Source

      exception(args)

      - Source + Source

      exception(args, self)

      - Source + Source

      message(exception)

      - Source + Source

      new()

      - Source + Source

      new(opts)

      - Source + Source

      to_keywords(record)

      - Source + Source

      update_actual(function, record)

      - Source + Source
      diff --git a/docs/master/Mix.Deps.html b/docs/master/Mix.Deps.html index fe69a1bcb..40812e7b8 100644 --- a/docs/master/Mix.Deps.html +++ b/docs/master/Mix.Deps.html @@ -32,7 +32,7 @@

      - Source + Source @@ -117,14 +117,14 @@

      Statuses

      situation of the repository. Check format_status/1 for more information.

      - Source + Source

      all(status)

      Get all dependencies that match the specific status.

      - Source + Source

      by_name(given) @@ -132,42 +132,42 @@

      Statuses

      Receives a list of deps names and returns deps records. Raises an error if the dependency does not exist.

      - Source + Source

      check_lock(dep, lock)

      Checks the lock for the given dependency and update its status accordingly.

      - Source + Source

      deps_path()

      The default path for dependencies.

      - Source + Source

      deps_path(arg1)

      Returns the path for the given dependency.

      - Source + Source

      format_dep(arg1)

      Format the dependency for printing.

      - Source + Source

      format_status(arg1)

      Formats the status of a dependency.

      - Source + Source

      out_of_date?(arg1) @@ -176,14 +176,14 @@

      Statuses

      lock status. Therefore, be sure to call check_lock before invoking this function.

      - Source + Source

      update_status(arg1)

      Receives a dependency and update its status

      - Source + Source
      diff --git a/docs/master/Mix.Project.html b/docs/master/Mix.Project.html index 90c110473..7ff472809 100644 --- a/docs/master/Mix.Project.html +++ b/docs/master/Mix.Project.html @@ -107,14 +107,14 @@

      Functions

      Retrieves the current project, raises an error if there is no project set.

      - Source + Source

      defined?()

      Returns true if a current project is defined.

      - Source + Source
      diff --git a/docs/master/Mix.Tasks.Compile.Elixir.html b/docs/master/Mix.Tasks.Compile.Elixir.html index 07036492f..8120e4a63 100644 --- a/docs/master/Mix.Tasks.Compile.Elixir.html +++ b/docs/master/Mix.Tasks.Compile.Elixir.html @@ -64,6 +64,7 @@

      Configuration

      Command line options

        +
      • -f, --file - compiles only the given file / pattern;
      • --force - forces compilation regardless of mod times;
      @@ -98,7 +99,7 @@

      Functions

      run(args)

      - Source + Source diff --git a/docs/master/Mix.Tasks.Loadpaths.html b/docs/master/Mix.Tasks.Loadpaths.html index 11c914bf2..001dbf721 100644 --- a/docs/master/Mix.Tasks.Loadpaths.html +++ b/docs/master/Mix.Tasks.Loadpaths.html @@ -67,7 +67,7 @@

      Functions summary

      Functions

      - run(_) + run(args)

      Source diff --git a/docs/master/Mix.Tasks.New.html b/docs/master/Mix.Tasks.New.html index 3b6d936ad..11e01c921 100644 --- a/docs/master/Mix.Tasks.New.html +++ b/docs/master/Mix.Tasks.New.html @@ -33,10 +33,9 @@

      mix new PATH [--app APP] [--module MODULE]
       
      -

      A project with the given path name will be created, -unless --app is given, allowing you to set the app -name or the --module is given configuring the module -name.

      +

      A project at the given PATH will be created. The +application name and module name will be retrieved +from the path, unless -app or --module is given.

      Examples

      @@ -79,7 +78,7 @@

      Functions

      run(argv)

      - Source + Source
      diff --git a/docs/master/Mix.Tasks.Run.html b/docs/master/Mix.Tasks.Run.html index acb3edadf..76efcbbbf 100644 --- a/docs/master/Mix.Tasks.Run.html +++ b/docs/master/Mix.Tasks.Run.html @@ -35,6 +35,13 @@

      Examples

      mix run "Some.function with_args" +

      Command line options

      + +
        +
      • -f, --file - runs the given file / pattern instead +of evaling code.
      • +
      + @@ -66,7 +73,7 @@

      Functions

      run(args)

      - Source + Source diff --git a/docs/master/Mix.Tasks.Test.html b/docs/master/Mix.Tasks.Test.html index 3d822553c..f06f119c9 100644 --- a/docs/master/Mix.Tasks.Test.html +++ b/docs/master/Mix.Tasks.Test.html @@ -42,6 +42,12 @@

      Configuration

      Defaults to test/**/*_test.exs.

    1060. :test_helper - a file that sets up whatever is necessary for testing. Defaults to test/test_helper.exs.

    1061. + + +

      Command line options

      + +
        +
      • -f, --file - Tests the given file / pattern;
      @@ -72,10 +78,10 @@

      Functions summary

      Functions

      - run(_) + run(args)

      - Source + Source
      diff --git a/docs/master/Mix.Utils.html b/docs/master/Mix.Utils.html index 2ae2b9095..5d350f9eb 100644 --- a/docs/master/Mix.Utils.html +++ b/docs/master/Mix.Utils.html @@ -117,7 +117,7 @@

      Examples

      Mix.Utils.camelize "foo_bar" #=> "FooBar"
       
      - Source + Source

      command_to_module(command, at // Elixir) @@ -148,7 +148,7 @@

      Examples

      #=> "Compile.Elixir"
      - Source + Source

      config_merge(old, new) @@ -174,7 +174,7 @@

      Examples

      #=> "compile.elixir"
      - Source + Source

      source(module) @@ -192,13 +192,18 @@

      Examples

      Source

      - underscore(arg1) + underscore(atom)

      -

      Converts the given string to underscore format.

      +

      Converts the given atom or binary to underscore format.

      + +

      If an atom is given, it is assumed to be an Elixir module, +so it is converted to a binary and then processed.

      Examples

      -
      Mix.Utils.underscore "FooBar" #=> "foo_bar"
      +
      Mix.Utils.underscore "FooBar"  #=> "foo_bar"
      +Mix.Utils.underscore "Foo.Bar" #=> "foo/bar"
      +Mix.Utils.underscore Foo.Bar   #=> "foo/bar"
       

      In general, underscore can be thought as the reverse of @@ -208,7 +213,7 @@

      Examples

      Mix.Utils.camelize "sap_example" #=> "SapExample"
      - Source + Source

      user_home() diff --git a/docs/master/Mix.html b/docs/master/Mix.html index ec81e79ff..030acd352 100644 --- a/docs/master/Mix.html +++ b/docs/master/Mix.html @@ -50,6 +50,16 @@

      Functions summary

      • + + env/0 + +
      • +
      • + + env/1 + +
      • +
      • loadpaths/0 @@ -84,13 +94,28 @@

        Functions summary

        Functions

        +

        + env() +

        +

        Returns the mix environment.

        +
        + Source +
        +

        + env(env) +

        +

        Changes the current mix env. Project configuration loaded +per environment is not going to be reloaded.

        +
        + Source +

        loadpaths()

        Starts mix and loads the project and dependencies into one step. Useful when invoking mix from an external tool.

        - Source + Source

        project() @@ -100,7 +125,7 @@

        Functions

        return an empty keywords list. This allows many mix tasks to work without a need for an underlying project.

        - Source + Source

        shell() @@ -112,14 +137,14 @@

        Functions

        allow developers to use a test shell, that simply sends the messages to the current process.

        - Source + Source

      shell(shell)

      Sets the current shell.

      - Source + Source

      start() diff --git a/docs/master/Module.html b/docs/master/Module.html index 7139589cf..e3bd04938 100644 --- a/docs/master/Module.html +++ b/docs/master/Module.html @@ -53,11 +53,6 @@

      Functions summary

      add_attribute/3 -
    1062. - - add_compile_callback/3 - -
    1063. add_doc/6 @@ -108,6 +103,16 @@

      Functions summary

      make_overridable/2
    1064. +
    1065. + + open?/1 + +
    1066. +
    1067. + + overridable?/2 + +
    1068. read_attribute/2 @@ -152,13 +157,7 @@

      Examples

      end
    1069. - Source -
      -

      - add_compile_callback(module, target, fun // :__compiling__) -

      -
      - Source + Source

      add_doc(module, line, kind, tuple, signature, doc) @@ -177,7 +176,7 @@

      Examples

      end
      - Source + Source

      concat(list) @@ -192,7 +191,7 @@

      Examples

      Module.concat [Foo, 'Bar'] #=> Foo.Bar
      - Source + Source

      concat(left, right) @@ -207,7 +206,7 @@

      Examples

      Module.concat Foo, 'Bar' #=> Foo.Bar
      - Source + Source

      defines?(module, tuple) @@ -224,7 +223,7 @@

      Examples

      end
      - Source + Source

      defines?(module, tuple, kind) @@ -242,7 +241,7 @@

      Examples

      end
      - Source + Source

      definitions_in(module) @@ -257,7 +256,7 @@

      Examples

      end
      - Source + Source

      definitions_in(module, kind) @@ -274,7 +273,7 @@

      Examples

      end
      - Source + Source

      delete_attribute(module, key) @@ -289,7 +288,7 @@

      Examples

      end
      - Source + Source

      eval_quoted(env, quoted, binding // [], opts // []) @@ -329,7 +328,7 @@

      Examples

      Foo.sum(1, 2) #=> 3
      - Source + Source

      make_overridable(module, tuples) @@ -337,6 +336,21 @@

      Examples

      Makes the given functions in the given module overridable. An overridable function is lazily defined, allowing a developer to customize it.

      +
      + Source +
      +

      + open?(module) +

      +

      Check if a module is open, i.e. it is currently being defined +and its attributes and functions can be modified.

      +
      + Source +
      +

      + overridable?(module, tuple) +

      +

      Returns true if the given tuple in module is marked as overridable.

      Source
      @@ -359,7 +373,7 @@

      Examples

      end
      - Source + Source

      register_attribute(module, new, opts // []) @@ -396,7 +410,7 @@

      Examples

      end
      - Source + Source

      safe_concat(list) @@ -415,7 +429,7 @@

      Examples

      #=> List.Chars
      - Source + Source

      safe_concat(left, right) @@ -434,7 +448,7 @@

      Examples

      #=> List.Chars
      - Source + Source diff --git a/docs/master/Orddict.html b/docs/master/Orddict.html index 13598b58e..b811e7236 100644 --- a/docs/master/Orddict.html +++ b/docs/master/Orddict.html @@ -30,12 +30,14 @@

      This module implements a dictionary based that stores items as a list of tuples. It is a simple wrapper around Erlang's orddict module -and exposed via the Dict protocol.

      +and exposed via the Dict module.

      + +

      Check the Dict module for examples and documentation.

      - Source + Source @@ -45,6 +47,36 @@

      Functions summary

      @@ -69,12 +131,48 @@

      Functions summary

      Functions

      +

      + delete(arg1, key) +

      +
      + Source +
      +

      + empty(_) +

      +
      + Source +
      +

      + get(arg1, key, default) +

      +
      + Source +
      +

      + has_key?(arg1, key) +

      +
      + Source +
      +

      + keys(arg1) +

      +
      + Source +
      +

      + merge(d1, d2, fun) +

      +
      + Source +

      new()

      Creates a new empty dict.

      - Source + Source

      new(pairs) @@ -87,7 +185,7 @@

      Examples

      #=> [a: 1, b: 2]
      - Source + Source

      new(list, transform) @@ -101,7 +199,43 @@

      Examples

      #=> ["a": "a", "b": "b"]
      - Source + Source +
      +

      + put(arg1, key, value) +

      +
      + Source +
      +

      + size(arg1) +

      +
      + Source +
      +

      + to_list(arg1) +

      +
      + Source +
      +

      + update(arg1, key, fun) +

      +
      + Source +
      +

      + update(arg1, key, initial, fun) +

      +
      + Source +
      +

      + values(arg1) +

      +
      + Source
      diff --git a/docs/master/Process.html b/docs/master/Process.html index a5b2588aa..e053e3d4a 100644 --- a/docs/master/Process.html +++ b/docs/master/Process.html @@ -96,6 +96,21 @@

      Functions summary

      get_keys/1 +
    1070. + + group_leader/0 + +
    1071. +
    1072. + + group_leader/2 + +
    1073. +
    1074. + + info/1 + +
    1075. info/2 @@ -261,7 +276,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#process_flag-2 for more info.

      - Source + Source

      flag(pid, flag, value) @@ -272,7 +287,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#process_flag-3 for more info.

      - Source + Source

      get() @@ -296,6 +311,31 @@

      Examples

      Returns all keys that have the given value.

      Source +
      +

      + group_leader() +

      +

      Returns the pid of the group leader for the process which evaluates the function.

      +
      + Source +
      +

      + group_leader(leader, pid) +

      +

      Sets the group leader of Pid to GroupLeader. Typically, this is used when a processes +started from a certain shell should have another group leader than :init.

      +
      + Source +
      +

      + info(pid) +

      +

      Returns information about the process identified by pid. +Use this only for debugging information.

      + +

      See http://www.erlang.org/doc/man/erlang.html#process_info-1 for more info.

      +
      + Source

      info(pid, spec) @@ -305,7 +345,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#process_info-2 for more info.

      - Source + Source

      link(pid) @@ -364,7 +404,7 @@

      Examples

      Returns a list of names which have been registered using register/2.

      - Source + Source

      self() diff --git a/docs/master/Protocol.UndefinedError.html b/docs/master/Protocol.UndefinedError.html index 98e455500..5727a09e8 100644 --- a/docs/master/Protocol.UndefinedError.html +++ b/docs/master/Protocol.UndefinedError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -129,73 +129,73 @@

      Functions

      exception(args)

      - Source + Source

      exception(args, self)

      - Source + Source

      message(exception)

      - Source + Source

      new()

      - Source + Source

      new(opts)

      - Source + Source

      protocol(record)

      - Source + Source

      protocol(value, record)

      - Source + Source

      structure(record)

      - Source + Source

      structure(value, record)

      - Source + Source

      to_keywords(record)

      - Source + Source

      update_protocol(function, record)

      - Source + Source

      update_structure(function, record)

      - Source + Source
      diff --git a/docs/master/Range.Iterator.Number.html b/docs/master/Range.Iterator.Number.html index 7bf6fdb11..35043ac6d 100644 --- a/docs/master/Range.Iterator.Number.html +++ b/docs/master/Range.Iterator.Number.html @@ -29,7 +29,7 @@

      - Source + Source @@ -62,13 +62,13 @@

      Functions

      count(first, arg2)

      - Source + Source

      iterator(first, arg2)

      - Source + Source
      diff --git a/docs/master/Range.Iterator.html b/docs/master/Range.Iterator.html index ee8baa9b1..b237f267d 100644 --- a/docs/master/Range.Iterator.html +++ b/docs/master/Range.Iterator.html @@ -29,7 +29,7 @@

      - Source + Source

      Implementations

      @@ -70,14 +70,14 @@

      Functions summary

      Functions

      - count(xA, xB) + count(first, range)

      Count how many items are in the range.

      - Source + Source

      - iterator(xA, xB) + iterator(first, range)

      How to iterate the range, receives the first and range as arguments. It needs to return a @@ -85,7 +85,7 @@

      Functions

      a tuple with two elements: the given item and the next item in the iteration.

      - Source + Source
      diff --git a/docs/master/Range.html b/docs/master/Range.html index 19576c884..dd5b4fb91 100644 --- a/docs/master/Range.html +++ b/docs/master/Range.html @@ -28,6 +28,11 @@

      +
      +

      Defines a Range.

      + +
      + Source @@ -60,16 +65,36 @@

      Functions summary

      first/1
    1076. +
    1077. + + first/2 + +
    1078. last/1
    1079. +
    1080. + + last/2 + +
    1081. +
    1082. + + new/0 + +
    1083. new/1
    1084. +
    1085. + + to_keywords/1 + +
    1086. @@ -81,30 +106,46 @@

      Functions summary

      Functions

      - first(range) + first(record)

      -

      Returns the first item of the range.

      -
      - Source +
      + Source +
      +

      + first(value, record) +

      +
      + Source

      - last(range) + last(record)

      -

      Returns the last item of the range.

      -
      - Source +
      + Source +
      +

      + last(value, record) +

      +
      + Source +
      +

      + new() +

      +
      + Source

      - new(options) + new(opts)

      -

      Returns a new range based on the given options.

      - -

      Examples

      - -
      Range.new first: 1, last: 10
      -
      -
      - Source +
      + Source +
      +

      + to_keywords(record) +

      +
      + Source
      diff --git a/docs/master/Record.html b/docs/master/Record.html index 7d0015e8a..29154b140 100644 --- a/docs/master/Record.html +++ b/docs/master/Record.html @@ -27,7 +27,7 @@

      -

      Functions to define and interact with Erlang records

      +

      Functions to define Elixir records

      @@ -43,7 +43,12 @@

      Functions summary

      • - access/4 + deffunctions/3 + +
      • +
      • + + defmacros/3
      • @@ -66,23 +71,59 @@

        Functions summary

        Functions

        -

        - access(caller, atom, fields, keyword) +

        + deffunctions(env, values, opts)

        -

        Implements the access macro used by records. -It returns a quoted expression that represents -the access given by the keywords.

        +

        Defines record functions skipping the module definition. +This is called directly by defrecord. It expects the +module environment, the module values and a keywords list +of options.

        + +

        Examples

        + +
        defmodule CustomRecord do
        +  Record.deffunctions __ENV__, [:name, :age]
        +end
        +
        +
        + Source +
        +

        + defmacros(env, name, values) +

        +

        Defines two macros for reading and writing records values. +These macros are private to the current module and are +basically a simple mechanism for manipulating tuples when +there isn't an interest in exposing the record as a whole. +In some ways, it is similar to Erlang records, since it is +only available at compilation time.

        + +

        Examples

        + +
        defmodule CustomModule do
        +  Record.defmacros __ENV__, :_user, [:name, :age]
        +
        +  def new(name, age) do
        +    _user(name: name, age: age)
        +  end
        +
        +  def name(user, name) do
        +    _user(user, name: name)
        +  end
        +end
        +
        - Source + Source

        defrecord(name, values, opts)

        -

        Main entry point for records definition. -This is invoked directly by Kernel.defrecord. -Returns the quoted expression of a module given by name.

        +

        Main entry point for records definition. It defines a module +with the given name and the fields specified in modules. +This is invoked directly by Kernel.defrecord, so check it +for more information and documentation.

        - Source + Source

        extract(name, opts) diff --git a/docs/master/Regex.CompileError.html b/docs/master/Regex.CompileError.html index d34a75700..f3163b485 100644 --- a/docs/master/Regex.CompileError.html +++ b/docs/master/Regex.CompileError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -103,49 +103,49 @@

        Functions

        exception(args)

        - Source + Source

        exception(args, self)

        - Source + Source

        message(record)

        - Source + Source

        message(value, record)

        - Source + Source

        new()

        - Source + Source

        new(opts)

        - Source + Source

        to_keywords(record)

        - Source + Source

        update_message(function, record)

        - Source + Source
        diff --git a/docs/master/Regex.html b/docs/master/Regex.html index 45ecb468d..7ac99903c 100644 --- a/docs/master/Regex.html +++ b/docs/master/Regex.html @@ -57,6 +57,7 @@

      • firstline (f) - forces the unanchored pattern to match before or at the first newline, though the matched text may continue over the newline
      • ungreedy (r) - invert the "greediness" of the regexp
      • +
      • groups (g) - compile with info about groups available

      The options not available are:

      @@ -86,6 +87,11 @@

      Functions summary

      @@ -160,6 +176,18 @@

      Functions summary

      Functions

      +

      + captures(regex, string, options // []) +

      +

      Returns the given captures as a list of tuples.

      + +

      Examples

      + +
      Regex.captures %r/c(?<foo>d)/g, "abcd"  #=> [{:foo, ["d"]}]
      +
      +
      + Source +

      compile(source, options // "")

      @@ -168,7 +196,7 @@

      Functions

      It returns { :ok, regex } in case of success, { :error, reason } otherwise.

      - Source + Source

      compile!(source, options // "") @@ -176,7 +204,19 @@

      Functions

      Compiles the regular expression according to the given options. Fails with Regex.CompileError if the regex cannot be compiled.

      - Source + Source +
      +

      + groups(arg1) +

      +

      Returns list of named groups in regex.

      + +

      Examples

      + +
      Regex.groups %r/(?<foo>foo)/g #=> ["foo"]
      +
      +
      + Source

      index(arg1, string) @@ -191,7 +231,7 @@

      Examples

      Regex.index %r/e/, "abcd" #=> nil
      - Source + Source

      indexes(arg1, string) @@ -207,7 +247,7 @@

      Examples

      Regex.indexes %r/e/, "abcd" #=> nil
      - Source + Source

      match?(arg1, string) @@ -220,7 +260,7 @@

      Examples

      Regex.match? %r/foo/, "bar" #=> false
      - Source + Source

      opts(arg1) @@ -232,14 +272,14 @@

      Examples

      Regex.opts %r(foo)m #=> 'm'
       
      - Source + Source

      re_pattern(arg1)

      Returns the underlying re_pattern in the regular expression.

      - Source + Source

      replace(arg1, string, replacement) @@ -259,7 +299,7 @@

      Examples

      Regex.replace(%r/(b)/, "abc", "[\\1]") #=> "a[b]c"
      - Source + Source

      replace_all(arg1, string, replacement) @@ -268,10 +308,10 @@

      Examples

      expressions matches in the string. Please read replace/3 for documentation and examples.

      - Source + Source
      -

      - run(arg1, string) +

      + run(regex, string, options // [])

      Runs the regular expression against the given string. It returns a list with all matches or nil if no match ocurred.

      @@ -282,10 +322,10 @@

      Examples

      Regex.run %r/e/, "abcd" #=> nil
      - Source + Source
      -

      - scan(arg1, string) +

      + scan(regex, string, options // [])

      Same as run, but scans the target several times collecting all matches of the regular expression. A list is returned with each match. If the item in @@ -299,7 +339,7 @@

      Examples

      Regex.scan %r/e/, "abcd" #=> []
      - Source + Source

      source(arg1) @@ -311,15 +351,21 @@

      Examples

      Regex.source %r(foo) #=> "foo"
       
      - Source + Source

      - split(arg1, string, parts // :infinity) + split(regex, string, options // [])

      Split the given target in the number of parts specified. If no ammount of parts is given, it defaults to :infinity.

      - Source + Source +
      +

      + unescape_map(arg1) +

      +
      + Source
      diff --git a/docs/master/RuntimeError.html b/docs/master/RuntimeError.html index 46064cdce..e8775ca56 100644 --- a/docs/master/RuntimeError.html +++ b/docs/master/RuntimeError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -103,49 +103,49 @@

      Functions

      exception(args)

      - Source + Source

      exception(args, self)

      - Source + Source

      message(record)

      - Source + Source

      message(value, record)

      - Source + Source

      new()

      - Source + Source

      new(opts)

      - Source + Source

      to_keywords(record)

      - Source + Source

      update_message(function, record)

      - Source + Source
      diff --git a/docs/master/SyntaxError.html b/docs/master/SyntaxError.html index 8d1925949..7bd12d3da 100644 --- a/docs/master/SyntaxError.html +++ b/docs/master/SyntaxError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -150,91 +150,91 @@

      Functions

      description(record)

      - Source + Source

      description(value, record)

      - Source + Source

      exception(args)

      - Source + Source

      exception(args, self)

      - Source + Source

      file(record)

      - Source + Source

      file(value, record)

      - Source + Source

      line(record)

      - Source + Source

      line(value, record)

      - Source + Source

      message(exception)

      - Source + Source

      new()

      - Source + Source

      new(opts)

      - Source + Source

      to_keywords(record)

      - Source + Source

      update_description(function, record)

      - Source + Source

      update_file(function, record)

      - Source + Source

      update_line(function, record)

      - Source + Source
      diff --git a/docs/master/SystemLimitError.html b/docs/master/SystemLimitError.html index 44838f29c..7bc143ff3 100644 --- a/docs/master/SystemLimitError.html +++ b/docs/master/SystemLimitError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -103,49 +103,49 @@

      Functions

      exception(args)

      - Source + Source

      exception(args, self)

      - Source + Source

      message(record)

      - Source + Source

      message(value, record)

      - Source + Source

      new()

      - Source + Source

      new(opts)

      - Source + Source

      to_keywords(record)

      - Source + Source

      update_message(function, record)

      - Source + Source
      diff --git a/docs/master/TokenMissingError.html b/docs/master/TokenMissingError.html index 1d9ef120e..a273d1e53 100644 --- a/docs/master/TokenMissingError.html +++ b/docs/master/TokenMissingError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -150,91 +150,91 @@

      Functions

      description(record)

      - Source + Source

      description(value, record)

      - Source + Source

      exception(args)

      - Source + Source

      exception(args, self)

      - Source + Source

      file(record)

      - Source + Source

      file(value, record)

      - Source + Source

      line(record)

      - Source + Source

      line(value, record)

      - Source + Source

      message(exception)

      - Source + Source

      new()

      - Source + Source

      new(opts)

      - Source + Source

      to_keywords(record)

      - Source + Source

      update_description(function, record)

      - Source + Source

      update_file(function, record)

      - Source + Source

      update_line(function, record)

      - Source + Source
      diff --git a/docs/master/URI.Parser.html b/docs/master/URI.Parser.html index a415da2e1..2c21ee238 100644 --- a/docs/master/URI.Parser.html +++ b/docs/master/URI.Parser.html @@ -44,7 +44,12 @@

      Functions summary

      • - behaviour_info/1 + default_port/0 + +
      • +
      • + + parse/1
      • @@ -57,11 +62,19 @@

        Functions summary

        Functions

        -

        - behaviour_info(atom1) +

        + default_port()

        -
        - Source +

        Responsible for returning the default port.

        +
        + Source +
        +

        + parse(uri_info) +

        +

        Responsible for parsing extra URL information.

        +
        + Source
        diff --git a/docs/master/URI.html b/docs/master/URI.html index 9ec853acf..c8c26acf1 100644 --- a/docs/master/URI.html +++ b/docs/master/URI.html @@ -66,6 +66,11 @@

        Functions summary

        parse/1 +
      • + + query_decoder/1 + +
      @@ -81,7 +86,7 @@

      Functions

      Unpercent (URL) decodes a URI.

      - Source + Source

      decode_query(q, dict // Orddict.new()) @@ -90,7 +95,7 @@

      Functions

      orddict with one entry for each key-value pair. Each key and value will be a binary. It also does percent-unescaping of both keys and values.

      -

      Returns nil if the query string is malformed.

      +

      Use decoder/1 if you want to customize or iterate each value manually.

      Source
      @@ -99,7 +104,7 @@

      Functions

      Percent (URL) encodes a URI.

      - Source + Source

      encode_query(l) @@ -132,7 +137,15 @@

      Functions

      for that particular scheme. Take a look at URI.HTTPS for an example of one of these extension modules.

      - Source + Source +
      +

      + query_decoder(q) +

      +

      Returns an iterator function over the query string that decodes +the query string in steps.

      +
      + Source
      diff --git a/docs/master/UndefinedFunctionError.html b/docs/master/UndefinedFunctionError.html index fff6816a5..f993a2fa4 100644 --- a/docs/master/UndefinedFunctionError.html +++ b/docs/master/UndefinedFunctionError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -150,91 +150,91 @@

      Functions

      arity(record)

      - Source + Source

      arity(value, record)

      - Source + Source

      exception(args)

      - Source + Source

      exception(args, self)

      - Source + Source

      function(record)

      - Source + Source

      function(value, record)

      - Source + Source

      message(exception)

      - Source + Source

      module(record)

      - Source + Source

      module(value, record)

      - Source + Source

      new()

      - Source + Source

      new(opts)

      - Source + Source

      to_keywords(record)

      - Source + Source

      update_arity(function, record)

      - Source + Source

      update_function(function, record)

      - Source + Source

      update_module(function, record)

      - Source + Source
      diff --git a/docs/master/index.html b/docs/master/index.html index c66142c5e..f8249b1aa 100644 --- a/docs/master/index.html +++ b/docs/master/index.html @@ -7,6 +7,6 @@ - + \ No newline at end of file diff --git a/docs/master/modules_list.html b/docs/master/modules_list.html index f220a82af..75ea27825 100644 --- a/docs/master/modules_list.html +++ b/docs/master/modules_list.html @@ -16,7 +16,7 @@

      - Elixir v0.6.0 + Elixir v0.7.0.dev

      - Source + Source +
      +

      + delete_path(path) +

      +

      Deletes a path from Erlang VM code path. +The path is expanded with File.expand_path before deleted.

      +
      + Source

      ensure_compiled(module) @@ -192,7 +217,15 @@

      Functions

      Check ensure_loaded/1 for more information on module loading and when to use ensure_loaded/1 or ensure_compiled/1.

      - Source + Source +
      +

      + ensure_compiled?(module) +

      +

      Similar to ensure_compiled/1, but returns a boolean in case +it could be ensured or not.

      +
      + Source

      ensure_loaded(module) @@ -215,8 +248,8 @@

      Code loading on the Erlang VM

      Therefore, this function is useful to check if a module is loaded before using it and react accordingly. For example, the URI module -uses this function to check if a specific parser exists and is for the -given URI scheme.

      +uses this function to check if a specific parser exists for a given +URI scheme.

      Code.ensure_compiled

      @@ -234,7 +267,15 @@

      Code.ensure_compiled

      must be used just in same rare conditions, usually involving macros that needs to invoke a module for callback information.

      - Source + Source +
      +

      + ensure_loaded?(module) +

      +

      Similar to ensure_loaded/1, but returns a boolean in case +it could be ensured or not.

      +
      + Source

      eval(string, binding // [], opts // []) @@ -257,13 +298,13 @@

      Examples

      When passing the ENV's file and line, we could simply get -the location which already returns both fields as a keyword lists:

      +the location which already returns both fields as a keyword list:

      Code.eval "a + b", [a: 1, b: 2], __ENV__.location
       #=> { 3, [ {:a, 1}, {:b, 2} ] }
       
      - Source + Source

      eval_quoted(quoted, binding // [], opts // []) @@ -290,13 +331,13 @@

      Examples

      When passing the ENV's file and line, we could simply get -the location which already returns both fields as a keyword lists:

      +the location which already returns both fields as a keyword list:

      Code.eval_quoted contents, [a: 1, b: 2], __ENV__.location
       #=> { 3, [ {:a, 1}, {:b, 2} ] }
       
      - Source + Source

      load_file(file, relative_to // nil) @@ -312,7 +353,7 @@

      Examples

      a given file, the given file will be loaded N times. Check require_file if you don't want a file to be loaded concurrently.

      - Source + Source

      loaded_files() @@ -344,7 +385,7 @@

      Examples

      file, the given file will be loaded only once. Check load_file if you want a file to be loaded concurrently.

      - Source + Source

      string_to_ast(string, opts // []) @@ -360,7 +401,7 @@

      Options

    1087. :line - The line reported in the ENV variable.

    1088. - Source + Source

      string_to_ast!(string, opts // []) @@ -378,7 +419,7 @@

      Options

    1089. :line - The line reported in the ENV variable.

    1090. - Source + Source

      unload_files(files) @@ -394,6 +435,8 @@

      Options

      + +
      diff --git a/docs/master/CompileError.html b/docs/master/CompileError.html index 56d96a965..deab79728 100644 --- a/docs/master/CompileError.html +++ b/docs/master/CompileError.html @@ -143,6 +143,8 @@

      Functions summary

      + +

      Functions

      @@ -240,6 +242,8 @@

      Functions

      + +
      diff --git a/docs/master/Dict.html b/docs/master/Dict.html index 8e8631ab9..643337aaf 100644 --- a/docs/master/Dict.html +++ b/docs/master/Dict.html @@ -23,6 +23,8 @@

      Dict + behaviour +

      @@ -116,6 +118,8 @@

      Functions summary

      + +

      Functions

      @@ -293,6 +297,8 @@

      Examples

      + +
      diff --git a/docs/master/EEx.AssignsEngine.html b/docs/master/EEx.AssignsEngine.html index 3e98b63fb..a204623a9 100644 --- a/docs/master/EEx.AssignsEngine.html +++ b/docs/master/EEx.AssignsEngine.html @@ -66,6 +66,10 @@

      Examples

      + + + +
      diff --git a/docs/master/EEx.Engine.html b/docs/master/EEx.Engine.html index 2932a2cd7..dce427e5e 100644 --- a/docs/master/EEx.Engine.html +++ b/docs/master/EEx.Engine.html @@ -23,6 +23,8 @@

      EEx.Engine + behaviour +

      @@ -83,6 +85,8 @@

      Functions summary

      + +

      Functions

      @@ -116,6 +120,8 @@

      Functions

      + +
      diff --git a/docs/master/EEx.SmartEngine.html b/docs/master/EEx.SmartEngine.html index aa28a9bba..4ae1cf5de 100644 --- a/docs/master/EEx.SmartEngine.html +++ b/docs/master/EEx.SmartEngine.html @@ -60,6 +60,8 @@

      Functions summary

      + +

      Functions

      @@ -79,6 +81,8 @@

      Functions

      + +
      diff --git a/docs/master/EEx.SyntaxError.html b/docs/master/EEx.SyntaxError.html index d03b26618..ed1c360f7 100644 --- a/docs/master/EEx.SyntaxError.html +++ b/docs/master/EEx.SyntaxError.html @@ -96,6 +96,8 @@

      Functions summary

      + +

      Functions

      @@ -151,6 +153,8 @@

      Functions

      + +
      diff --git a/docs/master/EEx.TransformerEngine.html b/docs/master/EEx.TransformerEngine.html index c1658e032..0cac9fa92 100644 --- a/docs/master/EEx.TransformerEngine.html +++ b/docs/master/EEx.TransformerEngine.html @@ -52,6 +52,10 @@

      + + + +

      diff --git a/docs/master/EEx.html b/docs/master/EEx.html index ea71a9af9..3a1e6af84 100644 --- a/docs/master/EEx.html +++ b/docs/master/EEx.html @@ -158,6 +158,8 @@

      Macros summary

      + +

      Functions

      @@ -262,6 +264,8 @@

      Examples

      + +
      diff --git a/docs/master/Enum.Iterator.Binary.Dict.html b/docs/master/Enum.Iterator.Binary.Dict.html index 30b61f157..7f3720980 100644 --- a/docs/master/Enum.Iterator.Binary.Dict.html +++ b/docs/master/Enum.Iterator.Binary.Dict.html @@ -36,41 +36,13 @@

      -

      Functions summary

      - -
      -

      Functions

      -
      -

      - count(arg1) -

      -
      - Source -
      -

      - iterator(arg1) -

      -
      - Source -
      -
      + diff --git a/docs/master/Enum.Iterator.Function.html b/docs/master/Enum.Iterator.Function.html index 6704b90ae..0990ecbfd 100644 --- a/docs/master/Enum.Iterator.Function.html +++ b/docs/master/Enum.Iterator.Function.html @@ -29,48 +29,20 @@

      - Source + Source -

      Functions summary

      - -
      -

      Functions

      -
      -

      - count(function) -

      -
      - Source -
      -

      - iterator(function) -

      -
      - Source -
      -
      + diff --git a/docs/master/Enum.Iterator.HashDict.html b/docs/master/Enum.Iterator.HashDict.html index 4acbdfb72..1144c5df8 100644 --- a/docs/master/Enum.Iterator.HashDict.html +++ b/docs/master/Enum.Iterator.HashDict.html @@ -36,41 +36,13 @@

      -

      Functions summary

      - -
      -

      Functions

      -
      -

      - count(dict) -

      -
      - Source -
      -

      - iterator(dict) -

      -
      - Source -
      -
      + diff --git a/docs/master/Enum.Iterator.List.html b/docs/master/Enum.Iterator.List.html index 922b4c34a..40235005f 100644 --- a/docs/master/Enum.Iterator.List.html +++ b/docs/master/Enum.Iterator.List.html @@ -29,48 +29,20 @@

      - Source + Source -

      Functions summary

      - -
      -

      Functions

      -
      -

      - count(list) -

      -
      - Source -
      -

      - iterator(list) -

      -
      - Source -
      -
      + diff --git a/docs/master/Enum.Iterator.Orddict.html b/docs/master/Enum.Iterator.Orddict.html index 2e05d0e23..3aab1c9d2 100644 --- a/docs/master/Enum.Iterator.Orddict.html +++ b/docs/master/Enum.Iterator.Orddict.html @@ -36,41 +36,13 @@

      -

      Functions summary

      - -
      -

      Functions

      -
      -

      - count(arg1) -

      -
      - Source -
      -

      - iterator(arg1) -

      -
      - Source -
      -
      + diff --git a/docs/master/Enum.Iterator.Range.html b/docs/master/Enum.Iterator.Range.html index 665b09d50..6284c9fd7 100644 --- a/docs/master/Enum.Iterator.Range.html +++ b/docs/master/Enum.Iterator.Range.html @@ -36,41 +36,13 @@

      -

      Functions summary

      - -
      -

      Functions

      -
      -

      - count(range) -

      -
      - Source -
      -

      - iterator(range) -

      -
      - Source -
      -
      + diff --git a/docs/master/Enum.Iterator.html b/docs/master/Enum.Iterator.html index 1b2b9d410..ac63e61b2 100644 --- a/docs/master/Enum.Iterator.html +++ b/docs/master/Enum.Iterator.html @@ -112,6 +112,8 @@

      Functions summary

      + +

      Functions

      @@ -160,6 +162,8 @@

      Iterating lists

      + +
      diff --git a/docs/master/Enum.OrdIterator.Binary.Dict.html b/docs/master/Enum.OrdIterator.Binary.Dict.html index a90101562..f5de9bc5d 100644 --- a/docs/master/Enum.OrdIterator.Binary.Dict.html +++ b/docs/master/Enum.OrdIterator.Binary.Dict.html @@ -36,41 +36,13 @@

      -

      Functions summary

      - -
      -

      Functions

      -
      -

      - iterator(arg1) -

      -
      - Source -
      -

      - to_list(arg1, _) -

      -
      - Source -
      -
      + diff --git a/docs/master/Enum.OrdIterator.Function.html b/docs/master/Enum.OrdIterator.Function.html index 7d58f1062..052172bbf 100644 --- a/docs/master/Enum.OrdIterator.Function.html +++ b/docs/master/Enum.OrdIterator.Function.html @@ -29,48 +29,20 @@

      - Source + Source -

      Functions summary

      - -
      -

      Functions

      -
      -

      - iterator(function) -

      -
      - Source -
      -

      - to_list(arg1, function) -

      -
      - Source -
      -
      + diff --git a/docs/master/Enum.OrdIterator.List.html b/docs/master/Enum.OrdIterator.List.html index 81d754bdf..e6afc9432 100644 --- a/docs/master/Enum.OrdIterator.List.html +++ b/docs/master/Enum.OrdIterator.List.html @@ -29,48 +29,20 @@

      - Source + Source -

      Functions summary

      - -
      -

      Functions

      -
      -

      - iterator(list) -

      -
      - Source -
      -

      - to_list(arg1, _) -

      -
      - Source -
      -
      + diff --git a/docs/master/Enum.OrdIterator.Orddict.html b/docs/master/Enum.OrdIterator.Orddict.html index c0d4510ec..2221eb90c 100644 --- a/docs/master/Enum.OrdIterator.Orddict.html +++ b/docs/master/Enum.OrdIterator.Orddict.html @@ -36,41 +36,13 @@

      -

      Functions summary

      - -
      -

      Functions

      -
      -

      - iterator(arg1) -

      -
      - Source -
      -

      - to_list(arg1, _) -

      -
      - Source -
      -
      + diff --git a/docs/master/Enum.OrdIterator.Range.html b/docs/master/Enum.OrdIterator.Range.html index 2aca325cc..f0832e392 100644 --- a/docs/master/Enum.OrdIterator.Range.html +++ b/docs/master/Enum.OrdIterator.Range.html @@ -36,41 +36,13 @@

      -

      Functions summary

      - -
      -

      Functions

      -
      -

      - iterator(range) -

      -
      - Source -
      -

      - to_list(arg1, iterator) -

      -
      - Source -
      -
      + diff --git a/docs/master/Enum.OrdIterator.html b/docs/master/Enum.OrdIterator.html index d5186bf75..fba1fc6cd 100644 --- a/docs/master/Enum.OrdIterator.html +++ b/docs/master/Enum.OrdIterator.html @@ -103,6 +103,8 @@

      Functions summary

      + +

      Functions

      @@ -134,6 +136,8 @@

      Functions

      + +
      diff --git a/docs/master/Enum.OutOfBoundsError.html b/docs/master/Enum.OutOfBoundsError.html index dade24699..7e922c57d 100644 --- a/docs/master/Enum.OutOfBoundsError.html +++ b/docs/master/Enum.OutOfBoundsError.html @@ -96,6 +96,8 @@

      Functions summary

      + +

      Functions

      @@ -151,6 +153,8 @@

      Functions

      + +
      diff --git a/docs/master/Enum.html b/docs/master/Enum.html index d7b72b887..2ec3c061d 100644 --- a/docs/master/Enum.html +++ b/docs/master/Enum.html @@ -61,6 +61,11 @@

      Functions summary

      any?/2 +
    1091. + + at!/2 + +
    1092. count/1 @@ -141,11 +146,6 @@

      Functions summary

      map_reduce/3
    1093. -
    1094. - - nth!/2 - -
    1095. partition/2 @@ -203,6 +203,8 @@

      Functions summary

      + +

      Functions

      @@ -258,6 +260,24 @@

      Examples

      Source +
      +

      + at!(collection, n) +

      +

      Finds the element at the given index (zero-based). +Raises out of bounds error in case the given position +is outside the range of the collection.

      + +

      Expects an ordered collection.

      + +

      ## Examples

      + +
        Enum.at! [2,4,6], 0 #=> 2
      +  Enum.at! [2,4,6], 2 #=> 6
      +  Enum.at! [2,4,6], 4 #=> raises Enum.OutOfBoundsError
      +
      +
      + Source

      count(collection) @@ -269,14 +289,14 @@

      Examples

      Enum.count [1,2,3] #=> 3
       
      - Source + Source
    1096. count(collection, fun)

      Counts for how many items the function returns true.

      - Source + Source

      drop(collection, count) @@ -291,7 +311,7 @@

      Examples

      Enum.drop [1,2,3], 0 #=> [1,2,3]
      - Source + Source

      drop_while(collection, fun) @@ -305,7 +325,7 @@

      Examples

      #=> [3,4,5]
      - Source + Source

      each(collection, fun) @@ -318,7 +338,7 @@

      Examples

      Enum.each ['some', 'example'], fn(x) -> IO.puts x end
       
      - Source + Source

      empty?(collection) @@ -331,7 +351,7 @@

      Examples

      Enum.empty? [1,2,3] #=> false
      - Source + Source

      filter(collection, fun) @@ -345,7 +365,7 @@

      Examples

      #=> [2]
      - Source + Source

      filter_map(collection, filter, mapper) @@ -358,7 +378,7 @@

      Examples

      #=> [4]
      - Source + Source

      find(collection, ifnone // nil, fun) @@ -378,12 +398,12 @@

      Examples

      #=> 3
      - Source + Source

      find_index(collection, fun)

      -

      Similar to find, but returns the index (count starts with 1) +

      Similar to find, but returns the index (count starts with 0) of the item instead of the element itself.

      Expects an ordered collection.

      @@ -397,7 +417,7 @@

      Examples

      #=> 2
      - Source + Source

      find_value(collection, ifnone // nil, fun) @@ -414,7 +434,7 @@

      Examples

      #=> true
      - Source + Source

      first(collection) @@ -427,7 +447,7 @@

      Examples

      Enum.first [1,2,3] #=> 1
      - Source + Source

      join(collection, joiner // "") @@ -448,7 +468,7 @@

      Examples

      Enum.join([1,2,3], ' = ') #=> '1 = 2 = 3'
      - Source + Source

      map(collection, fun) @@ -466,7 +486,7 @@

      Examples

      #=> [a: -1, b: -2]
      - Source + Source

      map_join(collection, joiner // "", mapper) @@ -487,7 +507,7 @@

      Examples

      Enum.map_join([1,2,3], &1 * 2, ' = ') #=> '2 = 4 = 6'
      - Source + Source

      map_reduce(collection, acc, f) @@ -506,24 +526,7 @@

      Examples

      #=> { [2, 4, 6], 6 }
      - Source -
      -

      - nth!(collection, n) -

      -

      Finds the element at the nth index. Returns nil in case -the given index is outside the range of the collection.

      - -

      Expects an ordered collection.

      - -

      ## Examples

      - -
        Enum.nth! [2,4,6], 1 #=> 2
      -  Enum.nth! [2,4,6], 3 #=> 6
      -  Enum.nth! [2,4,6], 5 #=> raises Enum.OutOfBoundsError
      -
      -
      - Source + Source

      partition(collection, fun) @@ -538,7 +541,7 @@

      Examples

      #=> { [2], [1,3] }
      - Source + Source

      qsort(collection) @@ -550,7 +553,7 @@

      Examples

      Enum.qsort [3,2,1] #=> [1,2,3]
       
      - Source + Source

      reduce(collection, acc, fun) @@ -565,7 +568,7 @@

      Examples

      #=> 6
      - Source + Source

      reverse(collection) @@ -578,22 +581,27 @@

      Examples

      #=> [3, 2, 1]
      - Source + Source

      split(collection, count)

      Splits the enumerable into two collections, leaving count elements in the -first one. Expects an ordered collection.

      +first one. If count is a negative number, it starts couting from the back +to the beginning of the collection. Be aware that a negative count +implies in an iteration through the whole collection. +Expects an ordered collection.

      Examples

      Enum.split [1,2,3], 2  #=> { [1,2], [3] }
       Enum.split [1,2,3], 10 #=> { [1,2,3], [] }
       Enum.split [1,2,3], 0  #=> { [], [1,2,3] }
      +Enum.split [1,2,3], -1 #=> { [1,2], [3] }
      +Enum.split [1,2,3], -5 #=> { [], [1,2,3] }
       
      - Source + Source

      split_with(collection, fun) @@ -607,7 +615,7 @@

      Examples

      #=> { [1], [2, 3, 4] }
      - Source + Source

      take(collection, count) @@ -622,7 +630,7 @@

      Examples

      Enum.take [1,2,3], 0 #=> []
      - Source + Source

      take_while(collection, fun) @@ -636,7 +644,7 @@

      Examples

      #=> [1, 2]
      - Source + Source

      times(times, function) @@ -652,7 +660,7 @@

      Examples

      3
      - Source + Source

      times(times, acc, function) @@ -667,12 +675,14 @@

      Examples

      #=> 15
      - Source + Source + + diff --git a/docs/master/ErlangError.html b/docs/master/ErlangError.html index 0bce774eb..33e17703a 100644 --- a/docs/master/ErlangError.html +++ b/docs/master/ErlangError.html @@ -101,6 +101,8 @@

      Functions summary

      + +

      Functions

      @@ -162,6 +164,8 @@

      Functions

      + +
      diff --git a/docs/master/ExUnit.AssertionError.html b/docs/master/ExUnit.AssertionError.html index da50116b6..853f7a7b5 100644 --- a/docs/master/ExUnit.AssertionError.html +++ b/docs/master/ExUnit.AssertionError.html @@ -96,6 +96,8 @@

      Functions summary

      + +

      Functions

      @@ -151,6 +153,8 @@

      Functions

      + +
      diff --git a/docs/master/ExUnit.Assertions.html b/docs/master/ExUnit.Assertions.html index 3e410c29d..10720b9a1 100644 --- a/docs/master/ExUnit.Assertions.html +++ b/docs/master/ExUnit.Assertions.html @@ -137,6 +137,8 @@

      Macros summary

      + +

      Functions

      @@ -354,6 +356,8 @@

      Examples

      + +
      diff --git a/docs/master/ExUnit.Case.html b/docs/master/ExUnit.Case.html index ea0ddf86a..53a4f51f1 100644 --- a/docs/master/ExUnit.Case.html +++ b/docs/master/ExUnit.Case.html @@ -83,6 +83,8 @@

      Macros summary

      + +

      Macros

      @@ -107,6 +109,8 @@

      Examples

      + +
      diff --git a/docs/master/ExUnit.html b/docs/master/ExUnit.html index ffa43d8c2..ee35114f1 100644 --- a/docs/master/ExUnit.html +++ b/docs/master/ExUnit.html @@ -79,6 +79,11 @@

      Assertions

      Functions summary

      • + + after_spawn/1 + +
      • +
      • configure/1 @@ -100,9 +105,19 @@

        Functions summary

        + +

        Functions

        +

        + after_spawn(callback) +

        +

        Register a callback to be invoked every time a +new ExUnit process is spawned.

        +
        + Source +

        configure(options)

        @@ -125,7 +140,7 @@

        Options

        API used to run the tests. A developer does not need to call it directly.

        - Source + Source

        start(options // []) @@ -140,6 +155,8 @@

        Options

        + +
        diff --git a/docs/master/Exception.html b/docs/master/Exception.html index daa30b70e..98fc0b6a8 100644 --- a/docs/master/Exception.html +++ b/docs/master/Exception.html @@ -64,12 +64,7 @@

        Functions summary

      • - formatted_stacktrace/0 - -
      • -
      • - - normalize/1 + formatted_stacktrace/1
      • @@ -79,6 +74,8 @@

        Functions summary

        + +

        Functions

        @@ -86,7 +83,7 @@

        Functions

        format_file_line(file_line)

        Formats file and line information present in stacktraces. -Expect them to be given in a keywords list.

        +Expect them to be given in a keyword list.

        Source
        @@ -113,23 +110,19 @@

        Functions

        Source
        -

        - formatted_stacktrace() +

        + formatted_stacktrace(trace // System.stacktrace())

        Returns the stacktrace as a binary formatted as per format_stacktrace/1.

        Source -
        -

        - normalize(exception) -

        -
        - Source
        + + diff --git a/docs/master/File.CopyError.html b/docs/master/File.CopyError.html index f8f2cbb49..4064a9a47 100644 --- a/docs/master/File.CopyError.html +++ b/docs/master/File.CopyError.html @@ -164,6 +164,8 @@

        Functions summary

        + +

        Functions

        @@ -279,6 +281,8 @@

        Functions

        + +
        diff --git a/docs/master/File.Error.html b/docs/master/File.Error.html index 8180f46e0..5b6893820 100644 --- a/docs/master/File.Error.html +++ b/docs/master/File.Error.html @@ -143,6 +143,8 @@

        Functions summary

        + +

        Functions

        @@ -240,6 +242,8 @@

        Functions

        + +
        diff --git a/docs/master/File.IteratorError.html b/docs/master/File.IteratorError.html index 11ed26fc2..c5088040d 100644 --- a/docs/master/File.IteratorError.html +++ b/docs/master/File.IteratorError.html @@ -101,6 +101,8 @@

        Functions summary

        + +

        Functions

        @@ -162,6 +164,8 @@

        Functions

        + +
        diff --git a/docs/master/File.Stat.html b/docs/master/File.Stat.html index 4a2162c50..d926e9cbf 100644 --- a/docs/master/File.Stat.html +++ b/docs/master/File.Stat.html @@ -372,6 +372,8 @@

        Functions summary

        + +

        Functions

        @@ -631,6 +633,8 @@

        Functions

        + +
        diff --git a/docs/master/File.html b/docs/master/File.html index cedfbd665..73e881f7f 100644 --- a/docs/master/File.html +++ b/docs/master/File.html @@ -356,6 +356,8 @@

        Functions summary

        + +

        Functions

        @@ -711,7 +713,7 @@

        Examples

        returns its iterator. Fails for the same reasons as File.open.

        - Source + Source

        iterator!(file, mode // []) @@ -719,7 +721,7 @@

        Examples

        Same as iterator/2 but raises if the file cannot be opened.

        - Source + Source

        join(paths) @@ -1213,6 +1215,8 @@

        Examples

        + +
        diff --git a/docs/master/FunctionClauseError.html b/docs/master/FunctionClauseError.html index 16a00a35c..2a263ceb7 100644 --- a/docs/master/FunctionClauseError.html +++ b/docs/master/FunctionClauseError.html @@ -143,6 +143,8 @@

        Functions summary

        + +

        Functions

        @@ -240,6 +242,8 @@

        Functions

        + +
        diff --git a/docs/master/GenServer.Behaviour.html b/docs/master/GenServer.Behaviour.html index 7a69021af..f7850e180 100644 --- a/docs/master/GenServer.Behaviour.html +++ b/docs/master/GenServer.Behaviour.html @@ -26,54 +26,71 @@

        +
        +

        By using this module, you get default GenServer callbacks +for handle_call, handle_info, handle_cast, terminate +and code_change. init still needs to be implemented by the +developer. Since these functions are defined as overridable, +they can be partially customized and have a general clause +that simply invokes super.

        - Source +

        This module also tags the behavior as :genserver. For more +information on genserver, please refer to the Erlang +documentation:

        + +

        http://www.erlang.org/doc/man/gen_server.html +http://www.erlang.org/doc/design_principles/gen_server_concepts.html

        + +

        Example

        + +
        defmodule MyServer do
        +  use GenServer.Behaviour
        +
        +  # Callbacks
        +
        +  def init(state) do
        +    { :ok, state }
        +  end
        +
        +  def handle_call(:peek, _from, [h|_] = state) do
        +    { :reply, h, state }
        +  end
        +
        +  # Default behaviour
        +  def handle_call(request, from, config) do
        +    super(request, from, config)
        +  end
         
        +  def handle_cast({ :push, item }, state) do
        +    { :noreply, [item|state] }
        +  end
        +
        +  # Default cast behaviour
        +  def handle_cast(request, config) do
        +    super(request, config)
        +  end
        +end
        +
        + +
        + Source + -

        Macros summary

        - + -
        -

        Macros

        -
        -

        - __using__(_) -

        -

        By using this module, you get default GenServer callbacks -for handle_call, handle_info, handle_cast, terminate -and code_change. init still needs to be implemented by the -developer. Since these functions are defined as overridable, -they can be partially customized and have a global clause -that simply invokes super. See ExUnit.Server for some -code examples.

        -

        This module also tags the behavior as :genserver. For more -information on genserver, please refer to the Erlang -documentation:

        + -

        http://www.erlang.org/doc/man/gen_server.html -http://www.erlang.org/doc/design_principles/gen_server_concepts.html

        -
        - Source -
        -
        diff --git a/docs/master/HashDict.html b/docs/master/HashDict.html index 28bb8a145..cdc75b66d 100644 --- a/docs/master/HashDict.html +++ b/docs/master/HashDict.html @@ -127,6 +127,8 @@

        Functions summary

        + +

        Functions

        @@ -240,6 +242,8 @@

        Examples

        + +
        diff --git a/docs/master/IEx.Autocomplete.Entry.IEx.Autocomplete.Fun.html b/docs/master/IEx.Autocomplete.Entry.IEx.Autocomplete.Fun.html deleted file mode 100644 index fb85bdef1..000000000 --- a/docs/master/IEx.Autocomplete.Entry.IEx.Autocomplete.Fun.html +++ /dev/null @@ -1,79 +0,0 @@ - - - - IEx.Autocomplete.Entry.IEx.Autocomplete.Fun - - - - - - - - - - - - -
        -

        - IEx.Autocomplete.Entry.IEx.Autocomplete.Fun - - impl - -

        - - - - Source - - - - - - -

        Functions summary

        - - - - - - -
        -

        Functions

        -
        -

        - to_entries(fun) -

        -
        - Source -
        -

        - to_hint(arg1, hint) -

        -
        - Source -
        -
        - - - -
        - - diff --git a/docs/master/IEx.Autocomplete.Entry.IEx.Autocomplete.Mod.html b/docs/master/IEx.Autocomplete.Entry.IEx.Autocomplete.Mod.html deleted file mode 100644 index 53bcba396..000000000 --- a/docs/master/IEx.Autocomplete.Entry.IEx.Autocomplete.Mod.html +++ /dev/null @@ -1,79 +0,0 @@ - - - - IEx.Autocomplete.Entry.IEx.Autocomplete.Mod - - - - - - - - - - - - -
        -

        - IEx.Autocomplete.Entry.IEx.Autocomplete.Mod - - impl - -

        - - - - Source - - - - - - -

        Functions summary

        - - - - - - -
        -

        Functions

        -
        -

        - to_entries(mod) -

        -
        - Source -
        -

        - to_hint(arg1, hint) -

        -
        - Source -
        -
        - - - -
        - - diff --git a/docs/master/IEx.Autocomplete.html b/docs/master/IEx.Autocomplete.html index 28a1ec869..52a8465c6 100644 --- a/docs/master/IEx.Autocomplete.html +++ b/docs/master/IEx.Autocomplete.html @@ -32,7 +32,7 @@

        - Source + Source @@ -53,6 +53,8 @@

        Functions summary

        + +

        Functions

        @@ -60,12 +62,14 @@

        Functions

        expand(expr)

        - Source + Source
        + +
        diff --git a/docs/master/IEx.Helpers.html b/docs/master/IEx.Helpers.html index 1412891f2..e6f8e78f0 100644 --- a/docs/master/IEx.Helpers.html +++ b/docs/master/IEx.Helpers.html @@ -46,7 +46,7 @@

        - Source + Source @@ -117,6 +117,8 @@

        Macros summary

        + +

        Functions

        @@ -133,14 +135,14 @@

        Examples

        #=> Foo
        - Source + Source

        d()

        Shows the documentation for IEx.Helpers.

        - Source + Source

        d(function, arity) @@ -157,28 +159,28 @@

        Examples

        #=> Prints documentation for this function
        - Source + Source

        d(module, function, arity)

        Shows the documentation for the function/arity in module.

        - Source + Source

        h()

        Prints commands history and their result.

        - Source + Source

        m()

        Returns the name and module of all modules loaded.

        - Source + Source

        r() @@ -186,7 +188,7 @@

        Examples

        Reloads all modules that were already reloaded at some point with r/1.

        - Source + Source

        r(module) @@ -196,7 +198,7 @@

        Examples

        Please note that all the modules defined in the specified files are recompiled and reloaded.

        - Source + Source

        v(n) @@ -205,7 +207,7 @@

        Examples

        values to lookup query's value from latest to earliest. For instance, v(-1) returns the latest result.

        - Source + Source @@ -233,10 +235,12 @@

        Examples

        d Enum.all?/2 - Source + Source + + diff --git a/docs/master/IEx.Remsh.html b/docs/master/IEx.Remsh.html index 4f5151f20..dccec5b12 100644 --- a/docs/master/IEx.Remsh.html +++ b/docs/master/IEx.Remsh.html @@ -45,7 +45,7 @@

        - Source + Source @@ -66,6 +66,8 @@

        Functions summary

        + +

        Functions

        @@ -73,12 +75,14 @@

        Functions

        expand(node)

        - Source + Source
        + + diff --git a/docs/master/IEx.UnicodeIO.html b/docs/master/IEx.UnicodeIO.html index 0301584e4..97a94243c 100644 --- a/docs/master/IEx.UnicodeIO.html +++ b/docs/master/IEx.UnicodeIO.html @@ -34,7 +34,7 @@

        - Source + Source @@ -65,6 +65,8 @@

        Functions summary

        + +

        Functions

        @@ -74,7 +76,7 @@

        Functions

        Implements the error IO API used by IEx. It prints error messages.

        - Source + Source

        get(config) @@ -83,7 +85,7 @@

        Functions

        code cache, the instructions counter and needs to return a list with the new characters inserted.

        - Source + Source

        put(result) @@ -91,12 +93,14 @@

        Functions

        Implements the put IO API used by IEx. It receives the result and prints it.

        - Source + Source
        + + diff --git a/docs/master/IEx.html b/docs/master/IEx.html index 06a551262..a379707f1 100644 --- a/docs/master/IEx.html +++ b/docs/master/IEx.html @@ -40,7 +40,7 @@

        - Source + Source @@ -50,10 +50,20 @@

        Functions summary

        • + + after_spawn/1 + +
        • +
        • cli/0
        • +
        • + + preload/0 + +
        • run/1 @@ -76,15 +86,35 @@

          Functions summary

          + +

          Functions

          +

          + after_spawn(fun) +

          +

          Registers a function to be invoked after IEx +process is spawned. Requires IEx.preload to +be invoked.

          +
          + Source +

          cli()

          Interface to start IEx from CLI.

          - Source + Source +
          +

          + preload() +

          +

          Simply loads IEx application. Most of the times it is +preloaded on demand, but if you want to pre-configure +IEx, you need to preload it.

          +
          + Source

          run(opts // []) @@ -92,26 +122,28 @@

          Functions

          Runs IEx checking if tty is available or not. If so, invoke tty, otherwise go with the simple iex.

          - Source + Source

          simple(opts // [])

          Starts IEx simply using the current stdio.

          - Source + Source

          tty(opts // [])

          Starts IEx using a tty server.

          - Source + Source
          + + diff --git a/docs/master/IO.html b/docs/master/IO.html index 49e488486..5e9660bc8 100644 --- a/docs/master/IO.html +++ b/docs/master/IO.html @@ -96,6 +96,8 @@

          Functions summary

          + +

          Functions

          @@ -205,6 +207,8 @@

          Examples

          + +
          diff --git a/docs/master/Kernel.ParallelCompiler.html b/docs/master/Kernel.ParallelCompiler.html index ae4645c69..3fd745332 100644 --- a/docs/master/Kernel.ParallelCompiler.html +++ b/docs/master/Kernel.ParallelCompiler.html @@ -58,6 +58,8 @@

          Functions summary

          + +

          Functions

          @@ -88,6 +90,8 @@

          Functions

          + +
          diff --git a/docs/master/Kernel.ParallelRequire.html b/docs/master/Kernel.ParallelRequire.html index b3ae3d4d9..1c441f715 100644 --- a/docs/master/Kernel.ParallelRequire.html +++ b/docs/master/Kernel.ParallelRequire.html @@ -53,6 +53,8 @@

          Functions summary

          + +

          Functions

          @@ -70,6 +72,8 @@

          Functions

          + +
          diff --git a/docs/master/Kernel.SpecialForms.html b/docs/master/Kernel.SpecialForms.html index 972fb3f45..7f67a59bc 100644 --- a/docs/master/Kernel.SpecialForms.html +++ b/docs/master/Kernel.SpecialForms.html @@ -147,6 +147,8 @@

          Macros summary

          + +

          Macros

          @@ -647,6 +649,8 @@

          Examples

          + +
          diff --git a/docs/master/Kernel.Typespec.html b/docs/master/Kernel.Typespec.html index 4fcedf60c..218e10160 100644 --- a/docs/master/Kernel.Typespec.html +++ b/docs/master/Kernel.Typespec.html @@ -86,6 +86,8 @@

          Macros summary

          + +

          Functions

          @@ -142,6 +144,8 @@

          Macros

          + +
          diff --git a/docs/master/Kernel.html b/docs/master/Kernel.html index a7c8a588f..e92c94e63 100644 --- a/docs/master/Kernel.html +++ b/docs/master/Kernel.html @@ -793,6 +793,8 @@

          Macros summary

          + +

          Functions

          @@ -817,7 +819,7 @@

          Examples

          end
          - Source + Source

          raise(exception, args) @@ -838,7 +840,7 @@

          Examples

          raise ArgumentError, message: "Sample"
           
          - Source + Source
          @@ -919,7 +921,7 @@

          Examples

          this operator accepts any expression as arguments, not only booleans, however it is not allowed in guards.

          - Source + Source

          *(left, right) @@ -1004,7 +1006,7 @@

          Examples

          3 in 1..3 #=> true
          - Source + Source

          /(left, right) @@ -1040,7 +1042,7 @@

          Examples

          Enum.map(List.flatten([1,[2],3]), &1 * 2)
           
          - Source + Source

          <(left, right) @@ -1102,7 +1104,7 @@

          Examples

          x #=> "bar"
          - Source + Source

          ==(left, right) @@ -1155,7 +1157,7 @@

          Examples

          "abcd" =~ %r/e/ #=> nil
          - Source + Source

          >(left, right) @@ -1231,7 +1233,7 @@

          Examples

          time and not at runtime. Check the module Module for other functions to manipulate module attributes.

          - Source + Source

          __B__(string, list2) @@ -1245,7 +1247,7 @@

          Examples

          %B(f#{o}o) #=> "f\#{o}o"
          - Source + Source

          __C__(arg1, list2) @@ -1259,7 +1261,7 @@

          Examples

          %C(f#{o}o) #=> 'f\#{o}o'
          - Source + Source

          __R__(arg1, options) @@ -1272,7 +1274,7 @@

          Examples

          Regex.match? %R(f#{1,3}o), "f#o"  #=> true
           
          - Source + Source

          __b__(arg1, list2) @@ -1286,7 +1288,7 @@

          Examples

          %b(f#{:o}o) #=> "foo"
          - Source + Source

          __c__(arg1, list2) @@ -1300,7 +1302,7 @@

          Examples

          %c(f#{:o}o) #=> 'foo'
          - Source + Source

          __r__(arg1, options) @@ -1312,7 +1314,7 @@

          Examples

          Regex.match? %r(foo), "foo"  #=> true
           
          - Source + Source

          abs(number) @@ -1337,7 +1339,7 @@

          Examples

          are translated to access(foo, bar).

          The usage of this protocol is to access a raw value in a -keywords list.

          +keyword list.

          sample = [a: 1, b: 2, c: 3]
           sample[:b] #=> 2
          @@ -1401,7 +1403,7 @@ 

          Examples

          access a, 1 #=> :a
          - Source + Source

          and(left, right) @@ -1454,7 +1456,7 @@

          Examples

          atom_to_binary :my_atom #=> "my_atom"
           
          - Source + Source

          atom_to_binary(atom, encoding) @@ -1519,7 +1521,7 @@

          Examples

          binary_to_atom "my_atom" #=> :my_atom
           
          - Source + Source

          binary_to_atom(binary, encoding) @@ -1548,7 +1550,7 @@

          Examples

          binary_to_existing_atom "my_atom" #=> :my_atom
          - Source + Source

          binary_to_existing_atom(binary, encoding) @@ -1702,7 +1704,7 @@

          Examples

          end
          - Source + Source

          cond(list1) @@ -1722,7 +1724,7 @@

          Examples

          end
          - Source + Source

          def(name, list2) @@ -1799,7 +1801,7 @@

          Dynamic generation with atoms

          because each entry k is a an atom and invoking def unquote(k)() would be invalid Elixir syntax.

          - Source + Source

          def(name, args, guards, list4) @@ -1831,13 +1833,12 @@

          Examples

          name   = :some_function
           args   = quote(do: [first_arg, second_arg])
           guards = quote(do: is_list(first_arg))
          +exprs  = quote(do: ...)
           
          -def name, args, guards do
          -  # ...
          -end
          +def name, args, guards, do: exprs
           
          - Source + Source

          defdelegate(funs, opts) @@ -1883,7 +1884,7 @@

          Examples

          #=> [3,2,1]
          - Source + Source

          defexception(name, values, opts // [], do_block // []) @@ -1898,7 +1899,7 @@

          Examples

          2) Exceptions must implement message/1 as API and return a binary as result;

          - Source + Source

          defimpl(name, opts, do_block // []) @@ -1906,13 +1907,16 @@

          Examples

          Defines an implementation for the given protocol. See defprotocol/2 for examples.

          - Source + Source

          defmodule(name, list2)

          Defines a module given by name with the given contents.

          +

          It returns the module name, the module binary and the +block contents result.

          +

          Examples

          defmodule Foo do
          @@ -1951,7 +1955,7 @@ 

          Dynamic names

          Elixir will accept any module name as long as the expression returns an atom.

          - Source + Source

          defoverridable(tuples) @@ -1960,7 +1964,7 @@

          Dynamic names

          An overridable function is lazily defined, allowing a developer to customize it.

          - Source + Source

          defp(name, list2) @@ -1984,14 +1988,14 @@

          Examples

          In the example above, sum is private and accessing it through Foo.sum will raise an error.

          - Source + Source

          defp(name, args, guards, list4)

          The same as def/4 but generates a private function.

          - Source + Source

          defprotocol(name, list2) @@ -2104,7 +2108,7 @@

          Protocols + Records

          Finally, since records are simply tuples, one can add a default protocol implementation to any record by defining a default implementation for tuples.

          - Source + Source

          defrecord(name, values, opts // [], do_block // []) @@ -2180,7 +2184,7 @@

          Documentation

          By default records are not documented and have @moduledoc set to false.

          - Source + Source

          destructure(left, right) @@ -2221,7 +2225,7 @@

          Examples

          the first value from the right side. Otherwise, it will raise a CaseClauseError.

          - Source + Source

          div(left, right) @@ -2235,20 +2239,22 @@

          Examples

          div 5, 2 #=> 2
           
          - Source + Source

          elem(tuple, index)

          -

          Define elem to get Tuple element according to Elixir conventions. -We need to implement it as a macro to it can be used in guards.

          +

          Define elem to get Tuple element according to Elixir conventions +(i.e. it expects the tuple as first argument, zero-index based).

          + +

          It is implemented as a macro so it can be used in guards.

          Example

          tuple = { :foo, :bar, 3 } - elem(tuple, 1) #=> :foo

          + elem(tuple, 1) #=> :bar

          - Source + Source

          exit(reason) @@ -2365,7 +2371,7 @@

          Function retrieval

          f.([1,[2],3]) #=> [1,2,3]
          - Source + Source

          function_exported?(module, function, arity) @@ -2377,7 +2383,7 @@

          Function retrieval

          it is not loaded. Check Code.ensure_loaded/1 for more information.

          - Source + Source

          halt() @@ -2435,7 +2441,7 @@

          Examples

          if(condition, list2)

          Provides an if macro. This macro expects the first argument to -be a condition and the rest are keywords arguments.

          +be a condition and the rest are keyword arguments.

          One-liner examples

          @@ -2473,7 +2479,7 @@

          Blocks examples

          If you want to compare more than two clauses, you can use the cond/1 macro.

          - Source + Source

          in(left, right) @@ -2515,12 +2521,12 @@

          Clauses

          In this case, Elixir will automatically expand it and define the variable for us.

          - Source + Source

          inspect(arg)

          -

          Inspect the given arguments according to the Binary.Inspect protocol.

          +

          Inspect the given arguments according to the String.Inspect protocol.

          Examples

          @@ -2528,7 +2534,7 @@

          Examples

          #=> ":foo"
          - Source + Source

          integer_to_list(number) @@ -2645,7 +2651,7 @@

          Examples

          is_exception(1) #=> false
          - Source + Source

          is_float(term) @@ -2726,7 +2732,7 @@

          Examples

          Check if the given argument is a range.

          - Source + Source

          is_record(thing, kind) @@ -2743,7 +2749,7 @@

          Examples

          is_record(Config.new, List) #=> false
          - Source + Source

          is_reference(term) @@ -2759,7 +2765,7 @@

          Examples

          Check if the given argument is a regex.

          - Source + Source

          is_tuple(term) @@ -2942,7 +2948,7 @@

          Examples

          Enum.filter list, match?({:a, x } when x < 2, &1)
          - Source + Source

          max(first, second) @@ -3083,7 +3089,7 @@

          Examples

          will occur immediately.

        - Source + Source

        rem(left, right) @@ -3097,7 +3103,7 @@

        Examples

        rem 5, 2 #=> 1
         
        - Source + Source

        round(number) @@ -3123,15 +3129,17 @@

        Examples

        setelem(tuple, index, value)

        -

        Define setelem to set Tuple element according to Elixir conventions. -We need to implement it as a macro to it can be used in guards.

        +

        Define setelem to set Tuple element according to Elixir conventions +(i.e. it expects the tuple as first argument, zero-index based).

        + +

        It is implemented as a macro so it can be used in guards.

        Example

        tuple = { :foo, :bar, 3 } - setelem(tuple, 1, :baz) #=> { :baz, :bar, 3 }

        + setelem(tuple, 0, :baz) #=> { :baz, :bar, 3 }

        - Source + Source

        size(arg) @@ -3266,7 +3274,7 @@

        Examples

        #=> "foo"
        - Source + Source

        to_char_list(arg) @@ -3279,7 +3287,7 @@

        Examples

        #=> 'foo'
        - Source + Source

        trunc(number) @@ -3400,7 +3408,7 @@

        Catching exits and Erlang errors

        Although the second form should be avoided in favor of raise/rescue control mechanisms.

        - Source + Source

        tuple_size(tuple) @@ -3423,7 +3431,7 @@

        Catching exits and Erlang errors

        unless a value evalutes to true. Check if for examples and documentation.

        - Source + Source

        use(module, args // []) @@ -3456,7 +3464,7 @@

        Examples

        end
        - Source + Source

        var!(var) @@ -3500,10 +3508,12 @@

        Examples

        this operator accepts any expression as arguments, not only booleans, however it is not allowed in guards.

        - Source + Source + + diff --git a/docs/master/Keyword.KeyError.html b/docs/master/Keyword.KeyError.html index 3a3e5f4cf..cd20b0ddd 100644 --- a/docs/master/Keyword.KeyError.html +++ b/docs/master/Keyword.KeyError.html @@ -101,6 +101,8 @@

        Functions summary

        + +

        Functions

        @@ -162,6 +164,8 @@

        Functions

        + +
        diff --git a/docs/master/Keyword.html b/docs/master/Keyword.html index d2c72d5a3..d653c4c61 100644 --- a/docs/master/Keyword.html +++ b/docs/master/Keyword.html @@ -142,6 +142,8 @@

        Functions summary

        + +

        Functions

        @@ -378,6 +380,8 @@

        Examples

        + +
        diff --git a/docs/master/List.Chars.Atom.html b/docs/master/List.Chars.Atom.html index 6b2c6837d..5939205b2 100644 --- a/docs/master/List.Chars.Atom.html +++ b/docs/master/List.Chars.Atom.html @@ -36,30 +36,13 @@

        -

        Functions summary

        - -
        -

        Functions

        -
        -

        - to_char_list(atom) -

        -
        - Source -
        -
        + diff --git a/docs/master/List.Chars.BitString.html b/docs/master/List.Chars.BitString.html index 981bf34ee..7230cf1c2 100644 --- a/docs/master/List.Chars.BitString.html +++ b/docs/master/List.Chars.BitString.html @@ -36,30 +36,13 @@

        -

        Functions summary

        - -
        -

        Functions

        -
        -

        - to_char_list(bitstring) -

        -
        - Source -
        -
        + diff --git a/docs/master/List.Chars.List.html b/docs/master/List.Chars.List.html index 5a8b40ce1..918a04826 100644 --- a/docs/master/List.Chars.List.html +++ b/docs/master/List.Chars.List.html @@ -36,30 +36,13 @@

        -

        Functions summary

        - -
        -

        Functions

        -
        -

        - to_char_list(list) -

        -
        - Source -
        -
        + diff --git a/docs/master/List.Chars.Number.html b/docs/master/List.Chars.Number.html index 2edf4d347..234e6a32d 100644 --- a/docs/master/List.Chars.Number.html +++ b/docs/master/List.Chars.Number.html @@ -36,30 +36,13 @@

        -

        Functions summary

        - -
        -

        Functions

        -
        -

        - to_char_list(integer) -

        -
        - Source -
        -
        + diff --git a/docs/master/List.Chars.html b/docs/master/List.Chars.html index 6cb6cb36f..0c725d8a0 100644 --- a/docs/master/List.Chars.html +++ b/docs/master/List.Chars.html @@ -90,6 +90,8 @@

        Functions summary

        + +

        Functions

        @@ -103,6 +105,8 @@

        Functions

        + +
        diff --git a/docs/master/List.html b/docs/master/List.html index 438b70fa3..023c775dd 100644 --- a/docs/master/List.html +++ b/docs/master/List.html @@ -170,6 +170,8 @@

        Functions summary

        + +

        Functions

        @@ -232,7 +234,7 @@

        Examples

        #=> [[1,2],[1,2]]
        - Source + Source

        flatten(list) @@ -250,13 +252,13 @@

        Examples

        #=> [1,2,3,4,5]
        - Source + Source

        flatten(list, tail)

        - Source + Source

        foldl(list, acc, function) @@ -273,7 +275,7 @@

        Examples

        #=> 2
        - Source + Source

        foldr(list, acc, function) @@ -287,7 +289,7 @@

        Examples

        #=> -2
        - Source + Source

        keydelete(list, key, position) @@ -298,17 +300,17 @@

        Examples

        Examples

        -
        List.keydelete([a: 1, b: 2], :a, 1)
        +
        List.keydelete([a: 1, b: 2], :a, 0)
         #=> [{ :b, 2 }]
         
        -List.keydelete([a: 1, b: 2], 2, 2)
        +List.keydelete([a: 1, b: 2], 2, 1)
         #=> [{ :a, 1 }]
         
        -List.keydelete([a: 1, b: 2], :c, 1)
        +List.keydelete([a: 1, b: 2], :c, 0)
         #=> [{ :a, 1 }, { :b, 2 }]
         
        - Source + Source

        keyfind(list, key, position, default // nil) @@ -319,17 +321,17 @@

        Examples

        Examples

        -
        List.keyfind([a: 1, b: 2], :a, 1)
        +
        List.keyfind([a: 1, b: 2], :a, 0)
         #=> { :a, 1 }
         
        -List.keyfind([a: 1, b: 2], 2, 2)
        +List.keyfind([a: 1, b: 2], 2, 1)
         #=> { :b, 2 }
         
        -List.keyfind([a: 1, b: 2], :c, 1)
        +List.keyfind([a: 1, b: 2], :c, 0)
         #=> nil
         
        - Source + Source

        keymember?(list, key, position) @@ -340,17 +342,17 @@

        Examples

        Examples

        -
        List.keymember?([a: 1, b: 2], :a, 1)
        +
        List.keymember?([a: 1, b: 2], :a, 0)
         #=> true
         
        -List.keymember?([a: 1, b: 2], 2, 2)
        +List.keymember?([a: 1, b: 2], 2, 1)
         #=> true
         
        -List.keymember?([a: 1, b: 2], :c, 1)
        +List.keymember?([a: 1, b: 2], :c, 0)
         #=> false
         
        - Source + Source

        keyreplace(list, key, position, new_tuple) @@ -360,11 +362,11 @@

        Examples

        Examples

        -
        List.keyreplace([a: 1, b: 2], :a, 1, { :a, 3 })
        +
        List.keyreplace([a: 1, b: 2], :a, 0, { :a, 3 })
         #=> [a: 3, b: 2]
         
        - Source + Source

        keystore(list, key, position, new_tuple) @@ -375,11 +377,11 @@

        Examples

        Examples

        -
        List.keystore([a: 1, b: 2], :a, 1, { :a, 3 })
        +
        List.keystore([a: 1, b: 2], :a, 0, { :a, 3 })
         #=> [a: 3, b: 2]
         
        - Source + Source

        last(list) @@ -396,7 +398,7 @@

        Examples

        #=> 3
        - Source + Source

        member?(list, term) @@ -414,7 +416,7 @@

        Examples

        #=> false
        - Source + Source

        range(first, last, step // nil) @@ -434,7 +436,7 @@

        Examples

        List.range 5, 1, -2 #=> [5, 3, 1]
        - Source + Source

        sort(list) @@ -448,7 +450,7 @@

        Examples

        #=> [1, 2, 3, 4, 7]
        - Source + Source

        sort(list, fun) @@ -462,7 +464,7 @@

        Examples

        #=> [7, 4, 3, 2, 1]
        - Source + Source

        uniq(list) @@ -475,7 +477,7 @@

        Examples

        #=> [1,2,3]
        - Source + Source

        unzip(list) @@ -546,6 +548,8 @@

        Examples

        + +
        diff --git a/docs/master/Macro.Env.html b/docs/master/Macro.Env.html index 1a5031731..2b38ce70c 100644 --- a/docs/master/Macro.Env.html +++ b/docs/master/Macro.Env.html @@ -174,6 +174,8 @@

        Functions summary

        + +

        Functions

        @@ -235,7 +237,7 @@

        Functions

        location(record)

        -

        Returns a keywords list containing the file and line +

        Returns a keyword list containing the file and line information as keys.

        Source @@ -283,6 +285,8 @@

        Functions

        + +
        diff --git a/docs/master/Macro.html b/docs/master/Macro.html index b2030ad26..7ec2b7b65 100644 --- a/docs/master/Macro.html +++ b/docs/master/Macro.html @@ -56,6 +56,26 @@

        Functions summary

        to_binary/1 +
      • + + unescape_binary/1 + +
      • +
      • + + unescape_binary/2 + +
      • +
      • + + unescape_tokens/1 + +
      • +
      • + + unescape_tokens/2 + +
      @@ -78,6 +98,8 @@

      Macros summary

      + +

      Functions

      @@ -193,7 +215,7 @@

      Examples

      end
      - Source + Source

      to_binary(tree) @@ -206,7 +228,95 @@

      Examples

      #=> "foo.bar(1, 2, 3)"
      - Source + Source +
      +

      + unescape_binary(chars) +

      +

      Unescape the given chars. This is the unescaping behavior +used by default in Elixir single- and double-quoted strings. +Check unescape_binary/2 for information on how to customize +the escaping map.

      + +

      In this setup, Elixir will escape the following: \b, \d, +\e, \f, \n, \r, \s, \t and \v. Octals are also +escaped according to the latin1 set they represent.

      + +

      This function is commonly used on sigil implementations +(like %r, %b and others).

      + +

      Examples

      + +
      Macro.unescape_binary "example\\n"
      +#=> "example\n"
      +
      + +

      In the example above, we pass a string with \n escaped +and we return a version with it unescaped.

      +
      + Source +
      +

      + unescape_binary(chars, map) +

      +

      Unescape the given chars according to the map given. +Check unescape/1 if you want to use the same map as +Elixir single- and double-quoted strings.

      + +

      Map

      + +

      The map must be a function. The function receives an integer +representing the number of the characters it wants to unescape. +Here is the default mapping function implemented by Elixir:

      + +
      def unescape_map(?b), do: ?\b
      +def unescape_map(?d), do: ?\d
      +def unescape_map(?e), do: ?\e
      +def unescape_map(?f), do: ?\f
      +def unescape_map(?n), do: ?\n
      +def unescape_map(?r), do: ?\r
      +def unescape_map(?s), do: ?\s
      +def unescape_map(?t), do: ?\t
      +def unescape_map(?v), do: ?\v
      +def unescape_map(e),  do: e
      +
      + +

      If the unescape_map function returns false. The char is +not escaped and \ is kept in the char list.

      + +

      Octals

      + +

      Octals will by default be escaped unless the map function +returns false for ?0.

      + +

      Examples

      + +

      Using the unescape_map defined above is easy:

      + +
      Macro.unescape_binary "example\\n", unescape_map(&1)
      +
      +
      + Source +
      +

      + unescape_tokens(tokens) +

      +

      Unescape the given tokens according to the default map. +Check unescape/1 and unescape/2 for more information +about unescaping. Only tokens that are binaries are +unescaped, all others are ignored. This method is useful +when implementing your own sigils. Check the implementation +of Kernel.__b__ for examples.

      +
      + Source +
      +

      + unescape_tokens(tokens, map) +

      +

      Unescape the given tokens according to the given map. +Check unescape_tokens/1 and unescaped/2 for more information.

      +
      + Source
      @@ -233,6 +343,8 @@

      Macros

      + + diff --git a/docs/master/MatchError.html b/docs/master/MatchError.html index 89c8a4a10..1ca9a662b 100644 --- a/docs/master/MatchError.html +++ b/docs/master/MatchError.html @@ -101,6 +101,8 @@

      Functions summary

      + +

      Functions

      @@ -162,6 +164,8 @@

      Functions

      + +
      diff --git a/docs/master/Mix.Dep.html b/docs/master/Mix.Dep.html index d28778260..6a5ed974f 100644 --- a/docs/master/Mix.Dep.html +++ b/docs/master/Mix.Dep.html @@ -184,6 +184,8 @@

      Functions summary

      + +

      Functions

      @@ -299,6 +301,8 @@

      Functions

      + +
      diff --git a/docs/master/Mix.Deps.Lock.html b/docs/master/Mix.Deps.Lock.html index 7cbcf7fc7..a974d315f 100644 --- a/docs/master/Mix.Deps.Lock.html +++ b/docs/master/Mix.Deps.Lock.html @@ -43,17 +43,17 @@

      Functions summary

      • - read/0 + read/1
      • - update_lock/2 + update_lock/3
      • - write/1 + write/2
      • @@ -63,19 +63,21 @@

        Functions summary

        + +

        Functions

        -

        - read() +

        + read(file // access(Mix.project(), :lockfile))

        -

        Read the file, returns a keywords list containing +

        Read the file, returns a keyword list containing the app name and its current lock information.

        Source
        -

        - update_lock(deps, callback) +

        + update_lock(file // access(Mix.project(), :lockfile), deps, callback)

        Loop the given dependencies triggering the callback. The callback receives the dependency and its current lock @@ -87,10 +89,10 @@

        Functions

        Source
        -

        - write(dict) +

        + write(file // access(Mix.project(), :lockfile), dict)

        -

        Receives a keywords list and writes it to the disk.

        +

        Receives a keyword list and writes it to the disk.

        Source
        @@ -98,6 +100,8 @@

        Functions

        + +
        diff --git a/docs/master/Mix.Deps.html b/docs/master/Mix.Deps.html index 40812e7b8..cba950982 100644 --- a/docs/master/Mix.Deps.html +++ b/docs/master/Mix.Deps.html @@ -98,6 +98,8 @@

        Functions summary

        + +

        Functions

        @@ -189,6 +191,8 @@

        Statuses

        + +
        diff --git a/docs/master/Mix.Error.html b/docs/master/Mix.Error.html index 8e248a5dd..1675dfc36 100644 --- a/docs/master/Mix.Error.html +++ b/docs/master/Mix.Error.html @@ -96,6 +96,8 @@

        Functions summary

        + +

        Functions

        @@ -151,6 +153,8 @@

        Functions

        + +
        diff --git a/docs/master/Mix.Generator.html b/docs/master/Mix.Generator.html index 17f4f4bdc..a0e5e8b34 100644 --- a/docs/master/Mix.Generator.html +++ b/docs/master/Mix.Generator.html @@ -78,6 +78,8 @@

        Macros summary

        + +

        Functions

        @@ -111,7 +113,7 @@

        Macros

        It will define a private function with the name followed by _template that expects assigns as arguments.

        -

        This function must be invoked passing a keywords list. +

        This function must be invoked passing a keyword list. Each key in the keyword list can be accessed in the template using the @ macro.

        @@ -143,6 +145,8 @@

        Macros

        + +
        diff --git a/docs/master/Mix.InvalidTaskError.html b/docs/master/Mix.InvalidTaskError.html index 753eacc94..d4290fbf4 100644 --- a/docs/master/Mix.InvalidTaskError.html +++ b/docs/master/Mix.InvalidTaskError.html @@ -101,6 +101,8 @@

        Functions summary

        + +

        Functions

        @@ -162,6 +164,8 @@

        Functions

        + +
        diff --git a/docs/master/Mix.Local.html b/docs/master/Mix.Local.html index 4dff0b954..91432f176 100644 --- a/docs/master/Mix.Local.html +++ b/docs/master/Mix.Local.html @@ -63,6 +63,8 @@

        Functions summary

        + +

        Functions

        @@ -91,6 +93,8 @@

        Functions

        + +
        diff --git a/docs/master/Mix.NoProjectError.html b/docs/master/Mix.NoProjectError.html index 918ab3ecf..3c35cde33 100644 --- a/docs/master/Mix.NoProjectError.html +++ b/docs/master/Mix.NoProjectError.html @@ -96,6 +96,8 @@

        Functions summary

        + +

        Functions

        @@ -151,6 +153,8 @@

        Functions

        + +
        diff --git a/docs/master/Mix.NoTaskError.html b/docs/master/Mix.NoTaskError.html index 9b9a65b2a..9164c6433 100644 --- a/docs/master/Mix.NoTaskError.html +++ b/docs/master/Mix.NoTaskError.html @@ -101,6 +101,8 @@

        Functions summary

        + +

        Functions

        @@ -162,6 +164,8 @@

        Functions

        + +
        diff --git a/docs/master/Mix.OutOfDateDepsError.html b/docs/master/Mix.OutOfDateDepsError.html index b03a3d22d..ec9c7c2f6 100644 --- a/docs/master/Mix.OutOfDateDepsError.html +++ b/docs/master/Mix.OutOfDateDepsError.html @@ -96,6 +96,8 @@

        Functions summary

        + +

        Functions

        @@ -151,6 +153,8 @@

        Functions

        + +
        diff --git a/docs/master/Mix.Project.html b/docs/master/Mix.Project.html index 7ff472809..ed69b1981 100644 --- a/docs/master/Mix.Project.html +++ b/docs/master/Mix.Project.html @@ -23,6 +23,8 @@

        Mix.Project + behaviour +

        @@ -34,7 +36,7 @@

        Examples

        In order to configure Mix, a developer needs to use Mix.Project in a module and define a function named -project that returns a keywords list with configuration.

        +project that returns a keyword list with configuration.

        defmodule MyApp do
           use Mix.Project
        @@ -72,7 +74,7 @@ 

        Functions summary

        • - behaviour_info/1 + config/0
        • @@ -92,34 +94,48 @@

          Functions summary

          + +

          Functions

          -

          - behaviour_info(atom1) +

          + config()

          -
          - Source +

          Returns the project configuration already +considering the current environment.

          +
          + Source

          current()

          -

          Retrieves the current project, raises an error -if there is no project set.

          +

          Retrieves the current project.

          + +

          This is usually called by tasks that needs additional +functions on the project to be defined. Since such +tasks usually depends on a project to be defined, this +function raises Mix.NoProjectError in case no project +is available.

          + +

          Use defined?/0 if you need to check if a project is +defined or not without raising an exception.

          - Source + Source

          defined?()

          Returns true if a current project is defined.

          - Source + Source
          + +
          diff --git a/docs/master/Mix.SCM.html b/docs/master/Mix.SCM.html index 09d8a2b03..97e57026e 100644 --- a/docs/master/Mix.SCM.html +++ b/docs/master/Mix.SCM.html @@ -23,9 +23,17 @@

          Mix.SCM + behaviour +

          +
          +

          This module provides helper functions and defines the +behavior required by any SCM used by mix.

          + +
          + Source @@ -43,12 +51,26 @@

          Functions summary

        • - available?/2 + register/1
        • - behaviour_info/1 + register_builtin/0 + +
        • + +
        + + + + + +

        Callbacks summary

        +
          +
        • + + available?/2
        • @@ -76,16 +98,6 @@

          Functions summary

          key/0
        • -
        • - - register/1 - -
        • -
        • - - register_builtin/0 - -
        • update/2 @@ -96,8 +108,6 @@

          Functions summary

          - -

          Functions

          @@ -106,22 +116,38 @@

          Functions

          Returns all available SCM.

          - Source + Source +
          +

          + register(mod) +

          +

          Register the scm repository with the given key and mod.

          +
          + Source
          +

          + register_builtin() +

          +

          Register builtin SCMs.

          +
          + Source +
          +
          + + + + + +
          +

          Callbacks

          +

          available?(path, opts)

          This behavior function receives a path, opts and returns a boolean if the dependency is available.

          - Source -
          -

          - behaviour_info(atom1) -

          -

          Register required callbacks.

          -
          - Source + Source

          check?(path, opts) @@ -131,19 +157,19 @@

          Functions

          SCMs do not require a lock, for such, this function can simply return true.

          - Source + Source

          clean(path, opts)

          This behavior function should clean the given dependency.

          - Source + Source

          consumes?(opts)

          -

          This behavior function receives a keywords list of opts +

          This behavior function receives a keyword list of opts and should return an updated list in case the SCM consumes the available options. For example, when a developer specifies a dependency:

          @@ -156,7 +182,7 @@

          Functions

          sense for the Git SCM, it will return an update list of options while other SCMs would simply return nil.

          - Source + Source

          get(path, opts) @@ -168,7 +194,7 @@

          Functions

          it must preferably return the same lock, but can return a different one in case of failure.

          - Source + Source

          key() @@ -178,21 +204,7 @@

          Functions

          must be found since it is used to print information about the requested dependency.

          - Source -
        -

        - register(mod) -

        -

        Register the scm repository with the given key and mod.

        -
        - Source -
        -

        - register_builtin() -

        -

        Register builtin SCMs.

        -
        - Source + Source

        update(path, opts) @@ -202,12 +214,10 @@

        Functions

        by deps.get. In the first scenario, no lock is received, while one is given in the second.

        - Source + Source
        - -
        diff --git a/docs/master/Mix.Shell.Process.html b/docs/master/Mix.Shell.Process.html index aed8ea3ce..f369ad1e5 100644 --- a/docs/master/Mix.Shell.Process.html +++ b/docs/master/Mix.Shell.Process.html @@ -81,6 +81,8 @@

        Functions summary

        + +

        Functions

        @@ -131,6 +133,8 @@

        Examples

        + +
        diff --git a/docs/master/Mix.Shell.html b/docs/master/Mix.Shell.html index e9b9f0da6..1d9d87cf1 100644 --- a/docs/master/Mix.Shell.html +++ b/docs/master/Mix.Shell.html @@ -23,6 +23,8 @@

        Mix.Shell + behaviour +

        @@ -69,6 +71,8 @@

        Functions summary

        + +

        Functions

        @@ -106,6 +110,8 @@

        Functions

        + +
        diff --git a/docs/master/Mix.Task.html b/docs/master/Mix.Task.html index 35d17fb87..95590f114 100644 --- a/docs/master/Mix.Task.html +++ b/docs/master/Mix.Task.html @@ -23,6 +23,8 @@

        Mix.Task + behaviour +

        @@ -46,11 +48,6 @@

        Functions summary

        all_modules/0 -
      • - - behaviour_info/1 - -
      • clear/0 @@ -103,6 +100,8 @@

        Functions summary

        + +

        Functions

        @@ -112,13 +111,7 @@

        Functions

        Returns all loaded modules. Modules that were not yet loaded won't show up. Check load_all/0 if you want to preload all tasks.

        - Source -
        -

        - behaviour_info(atom1) -

        -
        - Source + Source

        clear() @@ -126,7 +119,7 @@

        Functions

        Clears all invoked tasks, allowing them to be reinvoked. Returns an ordset with all the tasks invoked thus far.

        - Source + Source

        get(task) @@ -140,21 +133,21 @@

        Exceptions

      • Mix.InvalidTaskError - raised if the task is not a valid Mix.Task
      - Source + Source

      hidden?(module)

      Checks if the task is hidden or not. Returns a boolean.

      - Source + Source

      load_all()

      Loads all tasks in all code paths.

      - Source + Source

      moduledoc(module) @@ -162,14 +155,14 @@

      Exceptions

      Gets the moduledoc for the given module. Returns the moduledoc or nil.

      - Source + Source

      reenable(task)

      Reenables a given task so it can be executed again down the stack.

      - Source + Source

      run(task, args // []) @@ -184,7 +177,7 @@

      Exceptions

      It may raise an exception if the task was not found or it is invalid. Check get/2 for more information.

      - Source + Source

      shortdoc(module) @@ -192,19 +185,21 @@

      Exceptions

      Gets the shortdoc for the given module. Returns the shortdoc or nil.

      - Source + Source

      task_name(module)

      Returns the task name for the given module.

      - Source + Source
      + + diff --git a/docs/master/Mix.Tasks.Clean.html b/docs/master/Mix.Tasks.Clean.html index 228bebf3c..d6549952e 100644 --- a/docs/master/Mix.Tasks.Clean.html +++ b/docs/master/Mix.Tasks.Clean.html @@ -59,6 +59,8 @@

      Functions summary

      + +

      Functions

      @@ -72,6 +74,8 @@

      Functions

      + +
      diff --git a/docs/master/Mix.Tasks.Compile.App.html b/docs/master/Mix.Tasks.Compile.App.html index 1de7f169d..32132466a 100644 --- a/docs/master/Mix.Tasks.Compile.App.html +++ b/docs/master/Mix.Tasks.Compile.App.html @@ -35,7 +35,7 @@

      and "elixir" as application dependencies.

      You can optionally define an application/0 function inside your -Mix.Project that returns a keywords list to further configure +Mix.Project that returns a keyword list to further configure your application according to OTP design principles:

      http://www.erlang.org/doc/design_principles/applications.html

      @@ -77,6 +77,8 @@

      Functions summary

      + +

      Functions

      @@ -90,6 +92,8 @@

      Functions

      + +
      diff --git a/docs/master/Mix.Tasks.Compile.Elixir.html b/docs/master/Mix.Tasks.Compile.Elixir.html index 8120e4a63..fd1785912 100644 --- a/docs/master/Mix.Tasks.Compile.Elixir.html +++ b/docs/master/Mix.Tasks.Compile.Elixir.html @@ -41,6 +41,9 @@

      force compilation regardless of mod times by passing the --force option.

      +

      A list of files can be given after the task +name in order to select the files to compile.

      +

      Configuration

        @@ -56,6 +59,11 @@

        Configuration

        Defaults to an empty list, can be configured as:

        [compile_first: ["lib/foo.ex" "lib/bar.ex"]]

        +
      • :compile_exts - extensions to watch and, when any of +the files with the given extension changes, forces +recompilation:

        + +

        [compile_exts: [:ex, :eex]

      • :elixirc_options - compilation options that applies to Elixir's compiler, they are: :ignore_module_conflict, :docs and :debug_info. They all default to false.

      • @@ -64,7 +72,6 @@

        Configuration

        Command line options

          -
        • -f, --file - compiles only the given file / pattern;
        • --force - forces compilation regardless of mod times;
        @@ -92,6 +99,8 @@

        Functions summary

        + +

        Functions

        @@ -99,12 +108,14 @@

        Functions

        run(args)

        - Source + Source
        + +
      diff --git a/docs/master/Mix.Tasks.Compile.html b/docs/master/Mix.Tasks.Compile.html index c9a9ade06..480aeeea0 100644 --- a/docs/master/Mix.Tasks.Compile.html +++ b/docs/master/Mix.Tasks.Compile.html @@ -48,7 +48,6 @@

      Command line options

      • --list - List all enabled compilers.
      • -
      • --no-check - Skip dependencies check before compilation.
      @@ -75,6 +74,8 @@

      Functions summary

      + +

      Functions

      @@ -82,12 +83,14 @@

      Functions

      run(args)

      - Source + Source
      + + diff --git a/docs/master/Mix.Tasks.Deps.Check.html b/docs/master/Mix.Tasks.Deps.Check.html index 0b62a7398..fd6055c8d 100644 --- a/docs/master/Mix.Tasks.Deps.Check.html +++ b/docs/master/Mix.Tasks.Deps.Check.html @@ -57,6 +57,8 @@

      Functions summary

      + +

      Functions

      @@ -70,6 +72,8 @@

      Functions

      + +
      diff --git a/docs/master/Mix.Tasks.Deps.Clean.html b/docs/master/Mix.Tasks.Deps.Clean.html index d18681e20..f6938f846 100644 --- a/docs/master/Mix.Tasks.Deps.Clean.html +++ b/docs/master/Mix.Tasks.Deps.Clean.html @@ -57,6 +57,8 @@

      Functions summary

      + +

      Functions

      @@ -70,6 +72,8 @@

      Functions

      + +
      diff --git a/docs/master/Mix.Tasks.Deps.Compile.html b/docs/master/Mix.Tasks.Deps.Compile.html index 9a2a5562a..fcc3e500c 100644 --- a/docs/master/Mix.Tasks.Deps.Compile.html +++ b/docs/master/Mix.Tasks.Deps.Compile.html @@ -78,6 +78,8 @@

      Functions summary

      + +

      Functions

      @@ -91,6 +93,8 @@

      Functions

      + +
      diff --git a/docs/master/Mix.Tasks.Deps.Get.html b/docs/master/Mix.Tasks.Deps.Get.html index 9e0b1bced..22a9aa2b6 100644 --- a/docs/master/Mix.Tasks.Deps.Get.html +++ b/docs/master/Mix.Tasks.Deps.Get.html @@ -54,6 +54,8 @@

      Functions summary

      + +

      Functions

      @@ -67,6 +69,8 @@

      Functions

      + +
      diff --git a/docs/master/Mix.Tasks.Deps.Loadpaths.html b/docs/master/Mix.Tasks.Deps.Loadpaths.html index 22cc8eec8..86502c3a8 100644 --- a/docs/master/Mix.Tasks.Deps.Loadpaths.html +++ b/docs/master/Mix.Tasks.Deps.Loadpaths.html @@ -27,11 +27,8 @@

      -

      Loads all dependencies. Invokes "deps.check" before -unless --no-check is given.

      - -

      This task is not shown in mix help but it is part -of mix public API and can be depended on.

      +

      Loads all dependencies. This is invoked directly +by "loadpaths" when the CLI boots.

      @@ -57,19 +54,23 @@

      Functions summary

      + +

      Functions

      - run(args) + run(_args)

      - Source + Source
      + +
      diff --git a/docs/master/Mix.Tasks.Deps.Unlock.html b/docs/master/Mix.Tasks.Deps.Unlock.html index cf90c64ec..e3d24b718 100644 --- a/docs/master/Mix.Tasks.Deps.Unlock.html +++ b/docs/master/Mix.Tasks.Deps.Unlock.html @@ -54,6 +54,8 @@

      Functions summary

      + +

      Functions

      @@ -67,6 +69,8 @@

      Functions

      + +
      diff --git a/docs/master/Mix.Tasks.Deps.Update.html b/docs/master/Mix.Tasks.Deps.Update.html index 1b02de7cd..349e3be93 100644 --- a/docs/master/Mix.Tasks.Deps.Update.html +++ b/docs/master/Mix.Tasks.Deps.Update.html @@ -57,6 +57,8 @@

      Functions summary

      + +

      Functions

      @@ -70,6 +72,8 @@

      Functions

      + +
      diff --git a/docs/master/Mix.Tasks.Deps.html b/docs/master/Mix.Tasks.Deps.html index 0f6615bb9..c0733bdea 100644 --- a/docs/master/Mix.Tasks.Deps.html +++ b/docs/master/Mix.Tasks.Deps.html @@ -60,6 +60,8 @@

      Functions summary

      + +

      Functions

      @@ -73,6 +75,8 @@

      Functions

      + +
      diff --git a/docs/master/Mix.Tasks.Do.html b/docs/master/Mix.Tasks.Do.html index 87d35adf4..2c6b906fe 100644 --- a/docs/master/Mix.Tasks.Do.html +++ b/docs/master/Mix.Tasks.Do.html @@ -61,6 +61,8 @@

      Functions summary

      + +

      Functions

      @@ -74,6 +76,8 @@

      Functions

      + +
      diff --git a/docs/master/Mix.Tasks.Escriptize.html b/docs/master/Mix.Tasks.Escriptize.html new file mode 100644 index 000000000..8efedd05e --- /dev/null +++ b/docs/master/Mix.Tasks.Escriptize.html @@ -0,0 +1,95 @@ + + + + Mix.Tasks.Escriptize + + + + + + + + + + + + +
      +

      + Mix.Tasks.Escriptize + +

      + + +
      +

      Generates an escript for the project.

      + +

      The following options can be specified in your mix.exs file:

      + +
        +
      • escript_name - the name of the generated escript +Defaults to project name

      • +
      • escript_main_module - the module containing the main/1 function. +Defaults to Project

      • +
      • escript_embed_elixir - if true embed elixir in the escript file. +Defaults to false

      • +
      • escript_embed_extra_apps - embed additional Elixir applications +if escript_embed_elixir is true. +Defaults to []

      • +
      • escript_shebang +Defaults to "#! /usr/bin/env escript\n"

      • +
      • escript_comment +Defaults to "%%\n"

      • +
      • escript_emu_args - emulator arguments to embed in the escript file +Defaults to "%%!\n"

      • +
      + +
      + + + Source + + + + + + +

      Functions summary

      + + + + + + + + +
      +

      Functions

      +
      +

      + run(args) +

      +
      + Source +
      +
      + + + + + +
      + + diff --git a/docs/master/Mix.Tasks.Help.html b/docs/master/Mix.Tasks.Help.html index 9d19d553f..7dc5a8610 100644 --- a/docs/master/Mix.Tasks.Help.html +++ b/docs/master/Mix.Tasks.Help.html @@ -61,6 +61,8 @@

      Functions summary

      + +

      Functions

      @@ -74,6 +76,8 @@

      Functions

      + +
      diff --git a/docs/master/Mix.Tasks.Iex.html b/docs/master/Mix.Tasks.Iex.html index 4b8b928c9..bde71a0b6 100644 --- a/docs/master/Mix.Tasks.Iex.html +++ b/docs/master/Mix.Tasks.Iex.html @@ -29,8 +29,8 @@

      Starts an iex repl with your project settings.

      -

      Elixir ensures your code is compiled and loaded -before starting IEx.

      +

      Before starting IEx, it invokes the prepare task +which defaults to compile and load your project.

      @@ -56,6 +56,8 @@

      Functions summary

      + +

      Functions

      @@ -69,6 +71,8 @@

      Functions

      + +
      diff --git a/docs/master/Mix.Tasks.Loadpaths.html b/docs/master/Mix.Tasks.Loadpaths.html index 001dbf721..3b0d5ab4a 100644 --- a/docs/master/Mix.Tasks.Loadpaths.html +++ b/docs/master/Mix.Tasks.Loadpaths.html @@ -63,6 +63,8 @@

      Functions summary

      + +

      Functions

      @@ -76,6 +78,8 @@

      Functions

      + +
      diff --git a/docs/master/Mix.Tasks.Local.Install.html b/docs/master/Mix.Tasks.Local.Install.html index 9ac7d4196..627f47f26 100644 --- a/docs/master/Mix.Tasks.Local.Install.html +++ b/docs/master/Mix.Tasks.Local.Install.html @@ -64,6 +64,8 @@

      Functions summary

      + +

      Functions

      @@ -77,6 +79,8 @@

      Functions

      + +
      diff --git a/docs/master/Mix.Tasks.Local.Uninstall.html b/docs/master/Mix.Tasks.Local.Uninstall.html index e23bda7a6..1e6ffc217 100644 --- a/docs/master/Mix.Tasks.Local.Uninstall.html +++ b/docs/master/Mix.Tasks.Local.Uninstall.html @@ -56,6 +56,8 @@

      Functions summary

      + +

      Functions

      @@ -69,6 +71,8 @@

      Functions

      + +
      diff --git a/docs/master/Mix.Tasks.Local.html b/docs/master/Mix.Tasks.Local.html index bb8b730c0..f9eee6719 100644 --- a/docs/master/Mix.Tasks.Local.html +++ b/docs/master/Mix.Tasks.Local.html @@ -53,6 +53,8 @@

      Functions summary

      + +

      Functions

      @@ -66,6 +68,8 @@

      Functions

      + +
      diff --git a/docs/master/Mix.Tasks.New.html b/docs/master/Mix.Tasks.New.html index 11e01c921..18b56df2d 100644 --- a/docs/master/Mix.Tasks.New.html +++ b/docs/master/Mix.Tasks.New.html @@ -71,6 +71,8 @@

      Functions summary

      + +

      Functions

      @@ -84,6 +86,8 @@

      Functions

      + +
      diff --git a/docs/master/Mix.Tasks.Run.html b/docs/master/Mix.Tasks.Run.html index 76efcbbbf..b5e151e46 100644 --- a/docs/master/Mix.Tasks.Run.html +++ b/docs/master/Mix.Tasks.Run.html @@ -29,19 +29,15 @@

      Run the given expression in the application context.

      +

      Before running the code, it invokes the prepare task +which defaults to compile and load your project.

      +

      Examples

      mix run Hello.world
       mix run "Some.function with_args"
       
      -

      Command line options

      - -
        -
      • -f, --file - runs the given file / pattern instead -of evaling code.
      • -
      -
      @@ -66,6 +62,8 @@

      Functions summary

      + +

      Functions

      @@ -73,12 +71,14 @@

      Functions

      run(args)

      - Source + Source
      + +
      diff --git a/docs/master/Mix.Tasks.Test.html b/docs/master/Mix.Tasks.Test.html index f06f119c9..257556357 100644 --- a/docs/master/Mix.Tasks.Test.html +++ b/docs/master/Mix.Tasks.Test.html @@ -33,7 +33,11 @@

      should do all testing setup and then require all files that matches the given test_pattern in parallel.

      -

      It ensures the project is compiled before executing.

      +

      Before running tests, it invokes the prepare task +which defaults to compile and load your project.

      + +

      A list of files can be given after the task name in +order to select the files to compile.

      Configuration

      @@ -42,12 +46,6 @@

      Configuration

      Defaults to test/**/*_test.exs.

    1097. :test_helper - a file that sets up whatever is necessary for testing. Defaults to test/test_helper.exs.

    1098. - - -

      Command line options

      - -
        -
      • -f, --file - Tests the given file / pattern;
      @@ -74,6 +72,8 @@

      Functions summary

      + +

      Functions

      @@ -87,6 +87,8 @@

      Functions

      + +
      diff --git a/docs/master/Mix.Utils.html b/docs/master/Mix.Utils.html index 129e3fce2..67f778d4d 100644 --- a/docs/master/Mix.Utils.html +++ b/docs/master/Mix.Utils.html @@ -72,6 +72,21 @@

      Functions summary

      config_merge/2 +
    1099. + + exclude_files/1 + +
    1100. +
    1101. + + extract_files/2 + +
    1102. +
    1103. + + extract_files/3 + +
    1104. module_name_to_command/2 @@ -104,6 +119,8 @@

      Functions summary

      + +

      Functions

      @@ -117,7 +134,7 @@

      Examples

      Mix.Utils.camelize "foo_bar" #=> "FooBar"
       
      - Source + Source

      command_to_module(command, at // Elixir) @@ -148,7 +165,7 @@

      Examples

      #=> "Compile.Elixir"
      - Source + Source
    1105. config_merge(old, new) @@ -156,7 +173,34 @@

      Examples

      Merges two configs recursively, merging keyword lists and concatenating normal lists.

      - Source + Source +
      +

      + exclude_files(files) +

      +

      Filtering out files which start with "."

      +
      + Source +
      +

      + extract_files(paths, exts) +

      +

      Extract the files from the given paths with +the given extension. +It ignores files which start with "."

      +
      + Source +
      +

      + extract_files(paths, files, exts) +

      +

      Extract the files from the given paths with +the given extension in case files is an empty +array. If not, get the common subset between +files and the extracted files. +It ignores files which start with "."

      +
      + Source

      module_name_to_command(module, nesting // 0) @@ -174,7 +218,7 @@

      Examples

      #=> "compile.elixir"
      - Source + Source

      source(module) @@ -213,7 +257,7 @@

      Examples

      Mix.Utils.camelize "sap_example" #=> "SapExample"
      - Source + Source

      user_home() @@ -226,6 +270,8 @@

      Examples

      + +
      diff --git a/docs/master/Mix.html b/docs/master/Mix.html index 030acd352..53c298baf 100644 --- a/docs/master/Mix.html +++ b/docs/master/Mix.html @@ -91,6 +91,8 @@

      Functions summary

      + +

      Functions

      @@ -122,7 +124,7 @@

      Functions

      Retrieves the current project configuration. If there isn't a project defined, this function will simply -return an empty keywords list. This allows many mix +return an empty keyword list. This allows many mix tasks to work without a need for an underlying project.

      Source @@ -157,6 +159,8 @@

      Functions

      + +
      diff --git a/docs/master/Module.html b/docs/master/Module.html index e3bd04938..4aa57a5a2 100644 --- a/docs/master/Module.html +++ b/docs/master/Module.html @@ -133,6 +133,11 @@

      Functions summary

      safe_concat/2 +
    1106. + + split/1 + +
    1107. @@ -140,6 +145,8 @@

      Functions summary

      + +

      Functions

      @@ -157,7 +164,7 @@

      Examples

      end
      - Source + Source

      add_doc(module, line, kind, tuple, signature, doc) @@ -223,7 +230,7 @@

      Examples

      end
      - Source + Source

      defines?(module, tuple, kind) @@ -241,7 +248,7 @@

      Examples

      end
      - Source + Source

      definitions_in(module) @@ -256,7 +263,7 @@

      Examples

      end
      - Source + Source

      definitions_in(module, kind) @@ -273,7 +280,7 @@

      Examples

      end
      - Source + Source

      delete_attribute(module, key) @@ -288,7 +295,7 @@

      Examples

      end
      - Source + Source

      eval_quoted(env, quoted, binding // [], opts // []) @@ -337,7 +344,7 @@

      Examples

      An overridable function is lazily defined, allowing a developer to customize it.

      - Source + Source

      open?(module) @@ -352,7 +359,7 @@

      Examples

      Returns true if the given tuple in module is marked as overridable.

      - Source + Source

      read_attribute(module, key) @@ -373,7 +380,7 @@

      Examples

      end
      - Source + Source

      register_attribute(module, new, opts // []) @@ -410,7 +417,7 @@

      Examples

      end
      - Source + Source

      safe_concat(list) @@ -449,11 +456,26 @@

      Examples

      Source +
      +

      + split(module) +

      +

      Split the given module name into binary parts.

      + +

      Examples

      + +
      Module.split Very.Long.Module.Name.And.Even.Longer
      +#=> ["Very", "Long", "Module", "Name", "And", "Even", "Longer"]
      +
      +
      + Source
      + +
      diff --git a/docs/master/Node.html b/docs/master/Node.html index cd64c1d1d..1c967e210 100644 --- a/docs/master/Node.html +++ b/docs/master/Node.html @@ -103,6 +103,8 @@

      Functions summary

      + +

      Functions

      @@ -221,6 +223,8 @@

      Functions

      + +
      diff --git a/docs/master/OptionParser.html b/docs/master/OptionParser.html index 94c1bda9a..cbf2ff5ef 100644 --- a/docs/master/OptionParser.html +++ b/docs/master/OptionParser.html @@ -53,6 +53,8 @@

      Functions summary

      + +

      Functions

      @@ -125,6 +127,8 @@

      Example

      + +
      diff --git a/docs/master/Orddict.html b/docs/master/Orddict.html index b811e7236..ef8f15efd 100644 --- a/docs/master/Orddict.html +++ b/docs/master/Orddict.html @@ -128,6 +128,8 @@

      Functions summary

      + +

      Functions

      @@ -241,6 +243,8 @@

      Examples

      + +
      diff --git a/docs/master/Port.html b/docs/master/Port.html index ccbec0685..534cb3f37 100644 --- a/docs/master/Port.html +++ b/docs/master/Port.html @@ -93,6 +93,8 @@

      Functions summary

      + +

      Functions

      @@ -163,6 +165,8 @@

      Functions

      + +
      diff --git a/docs/master/Process.html b/docs/master/Process.html index e053e3d4a..6cff42845 100644 --- a/docs/master/Process.html +++ b/docs/master/Process.html @@ -203,6 +203,8 @@

      Functions summary

      + +

      Functions

      @@ -294,7 +296,7 @@

      Examples

      Returns all key-values in the dictionary with no specific ordering (i.e. they are -not a keywords list).

      +not a keyword list).

      Source
      @@ -506,6 +508,8 @@

      Examples

      + +
      diff --git a/docs/master/Protocol.UndefinedError.html b/docs/master/Protocol.UndefinedError.html index 5727a09e8..e2ba34005 100644 --- a/docs/master/Protocol.UndefinedError.html +++ b/docs/master/Protocol.UndefinedError.html @@ -122,6 +122,8 @@

      Functions summary

      + +

      Functions

      @@ -201,6 +203,8 @@

      Functions

      + +
      diff --git a/docs/master/Range.Iterator.Number.html b/docs/master/Range.Iterator.Number.html index 35043ac6d..0daf2d6a5 100644 --- a/docs/master/Range.Iterator.Number.html +++ b/docs/master/Range.Iterator.Number.html @@ -36,41 +36,13 @@

      -

      Functions summary

      - -
      -

      Functions

      -
      -

      - count(first, arg2) -

      -
      - Source -
      -

      - iterator(first, arg2) -

      -
      - Source -
      -
      + diff --git a/docs/master/Range.Iterator.html b/docs/master/Range.Iterator.html index b237f267d..5527b3806 100644 --- a/docs/master/Range.Iterator.html +++ b/docs/master/Range.Iterator.html @@ -66,6 +66,8 @@

      Functions summary

      + +

      Functions

      @@ -91,6 +93,8 @@

      Functions

      + +
      diff --git a/docs/master/Range.html b/docs/master/Range.html index dd5b4fb91..ed6928af4 100644 --- a/docs/master/Range.html +++ b/docs/master/Range.html @@ -102,6 +102,8 @@

      Functions summary

      + +

      Functions

      @@ -151,6 +153,8 @@

      Functions

      + +
      diff --git a/docs/master/Record.html b/docs/master/Record.html index 29154b140..66f359b3f 100644 --- a/docs/master/Record.html +++ b/docs/master/Record.html @@ -68,6 +68,8 @@

      Functions summary

      + +

      Functions

      @@ -76,7 +78,7 @@

      Functions

      Defines record functions skipping the module definition. This is called directly by defrecord. It expects the -module environment, the module values and a keywords list +module environment, the module values and a keyword list of options.

      Examples

      @@ -113,7 +115,7 @@

      Examples

      end
      - Source + Source

      defrecord(name, values, opts) @@ -142,6 +144,8 @@

      Examples

      + +
      diff --git a/docs/master/Regex.CompileError.html b/docs/master/Regex.CompileError.html index f3163b485..ad637f8c4 100644 --- a/docs/master/Regex.CompileError.html +++ b/docs/master/Regex.CompileError.html @@ -96,6 +96,8 @@

      Functions summary

      + +

      Functions

      @@ -151,6 +153,8 @@

      Functions

      + +
      diff --git a/docs/master/Regex.html b/docs/master/Regex.html index 7ac99903c..2addcec63 100644 --- a/docs/master/Regex.html +++ b/docs/master/Regex.html @@ -161,11 +161,6 @@

      Functions summary

      split/3 -
    1108. - - unescape_map/1 - -
    1109. @@ -173,6 +168,8 @@

      Functions summary

      + +

      Functions

      @@ -360,17 +357,13 @@

      Examples

      of parts is given, it defaults to :infinity.

      Source -
      -

      - unescape_map(arg1) -

      -
      - Source
      + +
      diff --git a/docs/master/RuntimeError.html b/docs/master/RuntimeError.html index e8775ca56..31bbc8264 100644 --- a/docs/master/RuntimeError.html +++ b/docs/master/RuntimeError.html @@ -96,6 +96,8 @@

      Functions summary

      + +

      Functions

      @@ -151,6 +153,8 @@

      Functions

      + +
      diff --git a/docs/master/Binary.Inspect.Any.html b/docs/master/String.Inspect.Any.html similarity index 57% rename from docs/master/Binary.Inspect.Any.html rename to docs/master/String.Inspect.Any.html index 8bd40dd40..9e4457f7f 100644 --- a/docs/master/Binary.Inspect.Any.html +++ b/docs/master/String.Inspect.Any.html @@ -1,7 +1,7 @@ - Binary.Inspect.Any + String.Inspect.Any @@ -21,52 +21,39 @@

      - Binary.Inspect.Any + String.Inspect.Any impl

      +
      +

      For all other terms not implemented, we use the default +Erlang representation.

      - Source +

      Examples

      +
      inspect Process.self #=> "<0.35.0>"
      +
      + +
      + Source + -

      Functions summary

      - + -
      -

      Functions

      -
      -

      - inspect(thing) -

      -

      For all other terms not implemented, we use the default -Erlang representation.

      -

      Examples

      + -
      inspect Process.self #=> "<0.35.0>"
      -
      -
      - Source -
      -
      diff --git a/docs/master/Binary.Inspect.Atom.html b/docs/master/String.Inspect.Atom.html similarity index 62% rename from docs/master/Binary.Inspect.Atom.html rename to docs/master/String.Inspect.Atom.html index 1e80c80b7..68f1fff15 100644 --- a/docs/master/Binary.Inspect.Atom.html +++ b/docs/master/String.Inspect.Atom.html @@ -1,7 +1,7 @@ - Binary.Inspect.Atom + String.Inspect.Atom @@ -21,58 +21,45 @@

      - Binary.Inspect.Atom + String.Inspect.Atom impl

      +
      +

      Represents the atom as an Elixir term. The atoms false, true +and nil are simply quoted. Modules are properly represented +as modules using the dot notation.

      - Source +

      Notice that in Elixir, all operators can be represented using +literal atoms (:+, :-, etc).

      - +

      Examples

      +
      inspect(:foo)    #=> ":foo"
      +inspect(nil)     #=> "nil"
      +inspect(Foo.Bar) #=> "Foo.Bar"
      +
      + +
      + Source + -

      Functions summary

      - + -
      -

      Functions

      -
      -

      - inspect(atom) -

      -

      Represents the atom as an Elixir term. The atoms false, true -and nil are simply quoted. Modules are properly represented -as modules using the dot notation.

      -

      Notice that in Elixir, all operators can be represented using -literal atoms (:+, :-, etc).

      + -

      Examples

      + -
      inspect(:foo)    #=> ":foo"
      -inspect(nil)     #=> "nil"
      -inspect(Foo.Bar) #=> "Foo.Bar"
      -
      -
      - Source -
      -
      diff --git a/docs/master/Binary.Inspect.BitString.html b/docs/master/String.Inspect.BitString.html similarity index 58% rename from docs/master/Binary.Inspect.BitString.html rename to docs/master/String.Inspect.BitString.html index b927a4052..6d264f0a4 100644 --- a/docs/master/Binary.Inspect.BitString.html +++ b/docs/master/String.Inspect.BitString.html @@ -1,7 +1,7 @@ - Binary.Inspect.BitString + String.Inspect.BitString @@ -21,53 +21,40 @@

      - Binary.Inspect.BitString + String.Inspect.BitString impl

      +
      +

      Represents the string as itself escaping +all necessary characters.

      + +

      Examples

      - Source +
      inspect("bar")   #=> "bar"
      +inspect("f\"oo") #=> "f\"oo"
      +
      +
      + Source + -

      Functions summary

      - + -
      -

      Functions

      -
      -

      - inspect(thing) -

      -

      Represents the string as itself escaping -all necessary characters.

      -

      Examples

      + -
      inspect("bar")   #=> "bar"
      -inspect("f\"oo") #=> "f\"oo"
      -
      -
      - Source -
      -
      diff --git a/docs/master/Binary.Inspect.List.html b/docs/master/String.Inspect.List.html similarity index 55% rename from docs/master/Binary.Inspect.List.html rename to docs/master/String.Inspect.List.html index f737fe5bb..8df9da367 100644 --- a/docs/master/Binary.Inspect.List.html +++ b/docs/master/String.Inspect.List.html @@ -1,7 +1,7 @@ - Binary.Inspect.List + String.Inspect.List @@ -21,53 +21,15 @@

      - Binary.Inspect.List + String.Inspect.List impl

      - - Source - - - - - - -

      Functions summary

      - - - - - - -
      -

      Functions

      -
      -

      - container_join(list1, acc, last) -

      -
      - Source -
      -

      - inspect(thing) -

      -

      Represents a list checking if it can be printed or not. +

      +

      Represents a list checking if it can be printed or not. If so, a single-quoted representation is returned, otherwise the brackets syntax is used.

      @@ -83,12 +45,26 @@

      Examples

      inspect([0|'bar']) #=> "[0,98,97,114]" inspect([:foo,:bar]) #=> "[:foo, :bar]" -
      - Source -
      +
      + Source + + + + + + + + + + + + + + +
      diff --git a/docs/master/Binary.Inspect.Number.html b/docs/master/String.Inspect.Number.html similarity index 56% rename from docs/master/Binary.Inspect.Number.html rename to docs/master/String.Inspect.Number.html index 4b3591776..76246afd4 100644 --- a/docs/master/Binary.Inspect.Number.html +++ b/docs/master/String.Inspect.Number.html @@ -1,7 +1,7 @@ - Binary.Inspect.Number + String.Inspect.Number @@ -21,51 +21,38 @@

      - Binary.Inspect.Number + String.Inspect.Number impl

      +
      +

      Represents the number as a binary.

      - Source +

      Examples

      + +
      inspect(1) #=> "1"
      +
      +
      + Source + -

      Functions summary

      - + -
      -

      Functions

      -
      -

      - inspect(thing) -

      -

      Represents the number as a binary.

      -

      Examples

      + -
      inspect(1) #=> "1"
      -
      -
      - Source -
      -
      diff --git a/docs/master/Binary.Inspect.Regex.html b/docs/master/String.Inspect.Regex.html similarity index 56% rename from docs/master/Binary.Inspect.Regex.html rename to docs/master/String.Inspect.Regex.html index 009614b88..6bc60ab80 100644 --- a/docs/master/Binary.Inspect.Regex.html +++ b/docs/master/String.Inspect.Regex.html @@ -1,7 +1,7 @@ - Binary.Inspect.Regex + String.Inspect.Regex @@ -21,51 +21,38 @@

      - Binary.Inspect.Regex + String.Inspect.Regex impl

      +
      +

      Represents the Regex using the %r"" syntax.

      - Source +

      Examples

      + +
      inspect(%r/foo/m) #=> "%r\"foo\"m"
      +
      +
      + Source + -

      Functions summary

      - + -
      -

      Functions

      -
      -

      - inspect(thing) -

      -

      Represents the Regex using the %r"" syntax.

      -

      Examples

      + -
      inspect(%r/foo/m) #=> "%r\"foo\"m"
      -
      -
      - Source -
      -
      diff --git a/docs/master/Binary.Inspect.Tuple.html b/docs/master/String.Inspect.Tuple.html similarity index 60% rename from docs/master/Binary.Inspect.Tuple.html rename to docs/master/String.Inspect.Tuple.html index 19410ccab..ad6bb6a96 100644 --- a/docs/master/Binary.Inspect.Tuple.html +++ b/docs/master/String.Inspect.Tuple.html @@ -1,7 +1,7 @@ - Binary.Inspect.Tuple + String.Inspect.Tuple @@ -21,53 +21,40 @@

      - Binary.Inspect.Tuple + String.Inspect.Tuple impl

      +
      +

      Inspect tuples. If the tuple represents a record, +it shows it nicely formatted using the access syntax.

      + +

      Examples

      - Source +
      inspect({1,2,3})            #=> "{1,2,3}"
      +inspect(ArgumentError.new)  #=> ArgumentError[message: "argument error"]
      +
      +
      + Source + -

      Functions summary

      - + -
      -

      Functions

      -
      -

      - inspect(exception) -

      -

      Inspect tuples. If the tuple represents a record, -it shows it nicely formatted using the access syntax.

      -

      Examples

      + -
      inspect({1,2,3})            #=> "{1,2,3}"
      -inspect(ArgumentError.new)  #=> ArgumentError[message: "argument error"]
      -
      -
      - Source -
      -
      diff --git a/docs/master/Binary.Inspect.html b/docs/master/String.Inspect.html similarity index 71% rename from docs/master/Binary.Inspect.html rename to docs/master/String.Inspect.html index 46cd9c532..bbce7cafa 100644 --- a/docs/master/Binary.Inspect.html +++ b/docs/master/String.Inspect.html @@ -1,7 +1,7 @@ - Binary.Inspect + String.Inspect @@ -21,7 +21,7 @@

      - Binary.Inspect + String.Inspect protocol @@ -29,17 +29,18 @@

      -

      The Binary.Inspect protocol is responsible for -converting any structure to a Binary for textual -representation. All basic data structures (tuple, -list, function, pid, etc) implement the inspect -protocol. Other structures are adviced to implement -the protocol in order to provide pretty printing.

      +

      The String.Inspect protocol is responsible for +converting any structure to a string (i.e. an utf-8 +binary) for textual representation. All basic data +structures (tuple, list, function, pid, etc) implement +the inspect protocol. Other structures are adviced to +implement the protocol in order to provide pretty +printing.

      - Source + Source

      Implementations

      @@ -47,43 +48,43 @@

      Implementations

    1110. - Any + Any
    1111. - Atom + Atom
    1112. - BitString + BitString
    1113. - List + List
    1114. - Number + Number
    1115. - Regex + Regex
    1116. - Tuple + Tuple
    1117. @@ -107,6 +108,8 @@

      Functions summary

      + +

      Functions

      @@ -114,12 +117,14 @@

      Functions

      inspect(thing)

      - Source + Source
      + +
      diff --git a/docs/master/String.html b/docs/master/String.html new file mode 100644 index 000000000..e9680877f --- /dev/null +++ b/docs/master/String.html @@ -0,0 +1,262 @@ + + + + String + + + + + + + + + + + + +
      +

      + String + +

      + + +
      +

      A string in Elixir is a utf-8 binary. This module +contains function to work with utf-8 data and its +codepoints.

      + +

      For working with raw binaries, use Erlang's :binary +module.

      + +
      + + + Source + + + + + + +

      Functions summary

      + + + + + + + + +
      +

      Functions

      +
      +

      + downcase(arg1) +

      +

      Convert all characters on the given string to down case.

      + +

      Examples

      + +
      String.downcase("ABCD") #=> "abcd"
      +String.downcase("AB 123 XPTO") #=> "ab 123 xpto"
      +String.downcase("JOSÉ") #=> "josé"
      +
      +
      + Source +
      +

      + duplicate(subject, n) +

      +

      Returns a binary subject duplicated n times.

      + +

      Examples

      + +
      Binary.duplicate("abc", 1) #=> "abc"
      +Binary.duplicate("abc", 2) #=> "abcabc"
      +
      +
      + Source +
      +

      + lstrip(string, char // 32) +

      +

      Returns a string where leading char have been +removed. If no char is passed spaceis used.

      + +

      Examples

      + +
      String.lstrip("   abc  ")       #=> "abc  "
      +String.lstrip("_  abc  _", ?_)  #=> "  abc  _"
      +
      +
      + Source +
      +

      + printable?(arg1) +

      +

      Checks if a string is printable considering it is encoded +as UTF-8. Returns true if so, false otherwise.

      + +

      Examples

      + +
      String.printable?("abc") #=> true
      +
      +
      + Source +
      +

      + replace(subject, pattern, replacement, raw_options // []) +

      +

      Returns a new binary based on subject by replacing the parts +matching pattern for replacement. If options is specified +with [global: true], then it will replace all matches, otherwise +it will replace just the first one.

      + +

      For the replaced part must be used in replacement, then the +position or the positions where it is to be inserted must be specified by using +the option insert_replaced.

      + +

      Examples

      + +
      Binary.replace("a,b,c", ",", "-") #=> "a-b,c"
      +Binary.replace("a,b,c", ",", "-", global: true) #=> "a-b-c"
      +Binary.replace("a,b,c", "b", "[]", insert_replaced: 1) #=> "a,[b],c"
      +Binary.replace("a,b,c", ",", "[]", global: true, insert_replaced: 2) #=> "a[],b[],c"
      +Binary.replace("a,b,c", ",", "[]", global: true, insert_replaced: [1,1]) #=> "a[,,]b[,,]c"
      +
      +
      + Source +
      +

      + rstrip(string, char // 32) +

      +

      Returns a string where trailing char have been +removed. If no char is passed spaceis used.

      + +

      Examples

      + +
      String.rstrip("   abc  ")      #=> "   abc"
      +String.rstrip("   abc _", ?_)  #=> "   abc "
      +
      +
      + Source +
      +

      + split(binary, pattern // " ", options // []) +

      +

      Divides a string into sub string based on a pattern, +returning a list of these sub string. The pattern can +be a string, a list of strings or a regular expression.

      + +

      The string is split into two parts by default, unless +global option is true. If a pattern is not specified, +the string is split on whitespace occurrences.

      + +

      It returns a list with the original string if the pattern +can't be matched.

      + +

      Examples

      + +

      String.split("a,b,c", ",") #=> ["a", "b,c"] + String.split("a,b,c", ",", global: true) #=> ["a", "b", "c"] + String.split("foo bar") #=> ["foo", "bar"] + String.split("1,2 3,4", [" ", ","]) #=> ["1", "2 3,4"] + String.split("1,2 3,4", [" ", ","], global: true) #=> ["1", "2", "3", "4"] + String.split("a,b", ".") #=> ["a,b"]

      + +

      String.split("a,b,c", %r{,}) #=> ["a", "b,c"] + String.split("a,b,c", %r{,}, global: true) #=> ["a", "b", "c"] + String.split("a,b", %r{.}) #=> ["a,b"]

      +
      + Source +
      +

      + strip(string, char // 32) +

      +

      Returns a string where leading/trailing char have been +removed. If no char is passed spaceis used.

      + +

      Examples

      + +
      String.strip("   abc  ")       #=> "abc"
      +String.strip("a  abc  a", ?a)  #=> "  abc  "
      +
      +
      + Source +
      +

      + upcase(arg1) +

      +

      Convert all characters on the given string to upper case.

      + +

      Examples

      + +
      String.upcase("abcd") #=> "ABCD"
      +String.upcase("ab 123 xpto") #=> "AB 123 XPTO"
      +String.upcase("josé") #=> "JOSÉ"
      +
      +
      + Source +
      +
      + + + + + +
      + + diff --git a/docs/master/SyntaxError.html b/docs/master/SyntaxError.html index 7bd12d3da..91e896297 100644 --- a/docs/master/SyntaxError.html +++ b/docs/master/SyntaxError.html @@ -143,6 +143,8 @@

      Functions summary

      + +

      Functions

      @@ -240,6 +242,8 @@

      Functions

      + +
      diff --git a/docs/master/System.html b/docs/master/System.html index 5e3e1a499..40d78eb5a 100644 --- a/docs/master/System.html +++ b/docs/master/System.html @@ -110,6 +110,8 @@

      Functions summary

      + +

      Functions

      @@ -227,6 +229,8 @@

      Functions

      + +
      diff --git a/docs/master/SystemLimitError.html b/docs/master/SystemLimitError.html index 7bc143ff3..9588485e2 100644 --- a/docs/master/SystemLimitError.html +++ b/docs/master/SystemLimitError.html @@ -96,6 +96,8 @@

      Functions summary

      + +

      Functions

      @@ -151,6 +153,8 @@

      Functions

      + +
      diff --git a/docs/master/TokenMissingError.html b/docs/master/TokenMissingError.html index a273d1e53..f01262b56 100644 --- a/docs/master/TokenMissingError.html +++ b/docs/master/TokenMissingError.html @@ -143,6 +143,8 @@

      Functions summary

      + +

      Functions

      @@ -240,6 +242,8 @@

      Functions

      + +
      diff --git a/docs/master/Tuple.html b/docs/master/Tuple.html index d248ac3e6..9b0c84738 100644 --- a/docs/master/Tuple.html +++ b/docs/master/Tuple.html @@ -40,6 +40,10 @@

      + + + +

      diff --git a/docs/master/URI.FTP.html b/docs/master/URI.FTP.html index 27de39a0c..52ed99a34 100644 --- a/docs/master/URI.FTP.html +++ b/docs/master/URI.FTP.html @@ -53,6 +53,8 @@

      Functions summary

      + +

      Functions

      @@ -72,6 +74,8 @@

      Functions

      + +
      diff --git a/docs/master/URI.HTTP.html b/docs/master/URI.HTTP.html index 3b0d4b01d..04d64bdc3 100644 --- a/docs/master/URI.HTTP.html +++ b/docs/master/URI.HTTP.html @@ -53,6 +53,8 @@

      Functions summary

      + +

      Functions

      @@ -72,6 +74,8 @@

      Functions

      + +
      diff --git a/docs/master/URI.HTTPS.html b/docs/master/URI.HTTPS.html index 348178ef3..9cc348b3f 100644 --- a/docs/master/URI.HTTPS.html +++ b/docs/master/URI.HTTPS.html @@ -53,6 +53,8 @@

      Functions summary

      + +

      Functions

      @@ -72,6 +74,8 @@

      Functions

      + +
      diff --git a/docs/master/URI.LDAP.html b/docs/master/URI.LDAP.html index 05e503e68..1e79fbe19 100644 --- a/docs/master/URI.LDAP.html +++ b/docs/master/URI.LDAP.html @@ -53,6 +53,8 @@

      Functions summary

      + +

      Functions

      @@ -72,6 +74,8 @@

      Functions

      + +
      diff --git a/docs/master/URI.Parser.html b/docs/master/URI.Parser.html index 2c21ee238..2a02c4f7f 100644 --- a/docs/master/URI.Parser.html +++ b/docs/master/URI.Parser.html @@ -23,6 +23,8 @@

      URI.Parser + behaviour +

      @@ -40,7 +42,11 @@

      -

      Functions summary

      + + + + +

      Callbacks summary

      • @@ -59,8 +65,10 @@

        Functions summary

        -
        -

        Functions

        + + +
        +

        Callbacks

        default_port() @@ -78,8 +86,6 @@

        Functions

        - -
        diff --git a/docs/master/URI.SFTP.html b/docs/master/URI.SFTP.html index 0c58261db..56ed7c888 100644 --- a/docs/master/URI.SFTP.html +++ b/docs/master/URI.SFTP.html @@ -53,6 +53,8 @@

        Functions summary

        + +

        Functions

        @@ -72,6 +74,8 @@

        Functions

        + +
        diff --git a/docs/master/URI.TFTP.html b/docs/master/URI.TFTP.html index 7f95f0af5..bc0eabf70 100644 --- a/docs/master/URI.TFTP.html +++ b/docs/master/URI.TFTP.html @@ -53,6 +53,8 @@

        Functions summary

        + +

        Functions

        @@ -72,6 +74,8 @@

        Functions

        + +
        diff --git a/docs/master/URI.html b/docs/master/URI.html index c8c26acf1..e20371e2a 100644 --- a/docs/master/URI.html +++ b/docs/master/URI.html @@ -78,6 +78,8 @@

        Functions summary

        + +

        Functions

        @@ -151,6 +153,8 @@

        Functions

        + +
        diff --git a/docs/master/UndefinedFunctionError.html b/docs/master/UndefinedFunctionError.html index f993a2fa4..c55c131df 100644 --- a/docs/master/UndefinedFunctionError.html +++ b/docs/master/UndefinedFunctionError.html @@ -143,6 +143,8 @@

        Functions summary

        + +

        Functions

        @@ -240,6 +242,8 @@

        Functions

        + +
        diff --git a/docs/master/js/full_list.js b/docs/master/js/full_list.js index 786876676..e1418474d 100644 --- a/docs/master/js/full_list.js +++ b/docs/master/js/full_list.js @@ -28,11 +28,6 @@ function fullListSearch() { searchString = this.value; caseSensitiveMatch = searchString.match(/[A-Z]/) != null; regexSearchString = RegExp.escape(searchString); - if (caseSensitiveMatch) { - regexSearchString += "|" + - $.map(searchString.split(''), function(e) { return RegExp.escape(e); }). - join('.+?'); - } if (searchString === "") { clearTimeout(inSearch); inSearch = null; @@ -67,7 +62,7 @@ var lastRowClass = ''; function searchItem() { for (var i = 0; i < searchCache.length / 50; i++) { var item = searchCache[searchIndex]; - var searchName = (searchString.indexOf('::') != -1 ? item.fullName : item.name); + var searchName = (searchString.indexOf('.') != -1 ? item.fullName : item.name); var matchString = regexSearchString; var matchRegexp = new RegExp(matchString, caseSensitiveMatch ? "" : "i"); if (searchName.match(matchRegexp) == null) { diff --git a/docs/master/modules_list.html b/docs/master/modules_list.html index 75ea27825..508b2b27e 100644 --- a/docs/master/modules_list.html +++ b/docs/master/modules_list.html @@ -36,9 +36,7 @@

      • - - Behaviour - + Behaviour Behaviour
      • @@ -56,19 +54,7 @@

      • - - Binary - - - Binary -
      • - - - -
      • - - escape/2 - - Binary -
      • - -
      • - - part/2 - - Binary -
      • - -
      • - - part/3 - - Binary -
      • - -
      • - - printable?/1 - - Binary -
      • - -
      • - - split/3 - - Binary -
      • - -
      • - - unescape/1 - - Binary -
      • - -
      • - - unescape/2 - - Binary -
      • - -
      • - - unescape_tokens/1 - - Binary -
      • - -
      • - - unescape_tokens/2 - - Binary -
      • -

    1118. - - Bitwise - + Bitwise Bitwise
    1119. @@ -354,9 +272,7 @@

    1120. - - Code - + Code Code
    1121. @@ -391,6 +307,13 @@

      Code +
    1122. + + delete_path/1 + + Code +
    1123. +
    1124. ensure_compiled/1 @@ -398,6 +321,13 @@

      Code

    1125. +
    1126. + + ensure_compiled?/1 + + Code +
    1127. +
    1128. ensure_loaded/1 @@ -405,6 +335,13 @@

      Code

    1129. +
    1130. + + ensure_loaded?/1 + + Code +
    1131. +
    1132. eval/3 @@ -472,9 +409,7 @@

    1133. - - Dict - + Dict Dict
    1134. @@ -576,9 +511,7 @@

    1135. - - EEx - + EEx EEx
    1136. @@ -586,9 +519,7 @@

    1137. - - AssignsEngine - + AssignsEngine EEx.AssignsEngine
    1138. @@ -599,9 +530,7 @@

    1139. - - Engine - + Engine EEx.Engine
    1140. @@ -633,9 +562,7 @@

    1141. - - SmartEngine - + SmartEngine EEx.SmartEngine
    1142. @@ -660,9 +587,7 @@

    1143. - - TransformerEngine - + TransformerEngine EEx.TransformerEngine
    1144. @@ -718,9 +643,7 @@

    1145. - - Enum - + Enum Enum
    1146. @@ -741,6 +664,13 @@

      Enum

    1147. +
    1148. + + at!/2 + + Enum +
    1149. +
    1150. count/1 @@ -853,13 +783,6 @@

      Enum

    1151. -
    1152. - - nth!/2 - - Enum -
    1153. -
    1154. partition/2 @@ -934,9 +857,7 @@

    1155. - - ExUnit - + ExUnit ExUnit
    1156. @@ -944,9 +865,7 @@

    1157. - - Assertions - + Assertions ExUnit.Assertions
    1158. @@ -1055,9 +974,7 @@

    1159. - - Case - + Case ExUnit.Case
    1160. @@ -1074,6 +991,13 @@

      +
    1161. + + after_spawn/1 + + ExUnit +
    1162. +
    1163. configure/1 @@ -1099,9 +1023,7 @@

    1164. - - Exception - + Exception Exception
    1165. @@ -1138,14 +1060,7 @@

    1166. - formatted_stacktrace/0 - - Exception -
    1167. - -
    1168. - - normalize/1 + formatted_stacktrace/1 Exception
    1169. @@ -1154,9 +1069,7 @@

    1170. - - File - + File File
    1171. @@ -1545,29 +1458,18 @@

    1172. - - GenServer.Behaviour - + GenServer.Behaviour GenServer.Behaviour
    1173. - - HashDict - + HashDict HashDict
    1174. @@ -1683,9 +1585,7 @@

    1175. - - IEx - + IEx IEx
    1176. @@ -1693,9 +1593,7 @@

    1177. - - Autocomplete - + Autocomplete IEx.Autocomplete
    1178. @@ -1713,9 +1611,7 @@

    1179. - - Helpers - + Helpers IEx.Helpers
    1180. @@ -1796,9 +1692,7 @@

    1181. - - Remsh - + Remsh IEx.Remsh
    1182. @@ -1816,9 +1710,7 @@

    1183. - - UnicodeIO - + UnicodeIO IEx.UnicodeIO
    1184. @@ -1849,6 +1741,13 @@

      +
    1185. + + after_spawn/1 + + IEx +
    1186. +
    1187. cli/0 @@ -1856,6 +1755,13 @@

      IEx

    1188. +
    1189. + + preload/0 + + IEx +
    1190. +
    1191. run/1 @@ -1881,9 +1787,7 @@

    1192. - - IO - + IO IO
    1193. @@ -1943,9 +1847,7 @@

    1194. - - Kernel - + Kernel Kernel
    1195. @@ -1953,9 +1855,7 @@

    1196. - - ParallelCompiler - + ParallelCompiler Kernel.ParallelCompiler
    1197. @@ -1980,9 +1880,7 @@

    1198. - - ParallelRequire - + ParallelRequire Kernel.ParallelRequire
    1199. @@ -2000,9 +1898,7 @@

    1200. - - SpecialForms - + SpecialForms Kernel.SpecialForms
    1201. @@ -2132,9 +2028,7 @@

    1202. - - Typespec - + Typespec Kernel.Typespec
    1203. @@ -3205,9 +3099,7 @@

    1204. - - Keyword - + Keyword Keyword
    1205. @@ -3330,9 +3222,7 @@

    1206. - - List - + List List
    1207. @@ -3504,9 +3394,7 @@

    1208. - - Macro - + Macro Macro
    1209. @@ -3548,13 +3436,39 @@

      Macro

    1210. +
    1211. + + unescape_binary/1 + + Macro +
    1212. + +
    1213. + + unescape_binary/2 + + Macro +
    1214. + +
    1215. + + unescape_tokens/1 + + Macro +
    1216. + +
    1217. + + unescape_tokens/2 + + Macro +
    1218. +
    1219. - - Mix - + Mix Mix
    1220. @@ -3562,9 +3476,7 @@

    1221. - - Deps - + Deps Mix.Deps
    1222. @@ -3645,9 +3557,7 @@

    1223. - - Deps.Lock - + Deps.Lock Mix.Deps.Lock
    1224. @@ -3656,21 +3566,21 @@

    1225. - read/0 + read/1 Mix.Deps.Lock
    1226. - update_lock/2 + update_lock/3 Mix.Deps.Lock
    1227. - write/1 + write/2 Mix.Deps.Lock
    1228. @@ -3679,9 +3589,7 @@

    1229. - - Generator - + Generator Mix.Generator
    1230. @@ -3727,9 +3635,7 @@

    1231. - - Local - + Local Mix.Local
    1232. @@ -3761,9 +3667,7 @@

    1233. - - Project - + Project Mix.Project
    1234. @@ -3772,7 +3676,7 @@

    1235. - behaviour_info/1 + config/0 Mix.Project
    1236. @@ -3795,9 +3699,7 @@

    1237. - - SCM - + SCM Mix.SCM
    1238. @@ -3818,13 +3720,6 @@

      Mix.SCM

    1239. -
    1240. - - behaviour_info/1 - - Mix.SCM -
    1241. -
    1242. check?/2 @@ -3885,9 +3780,7 @@

    1243. - - Shell - + Shell Mix.Shell
    1244. @@ -3926,9 +3819,7 @@

    1245. - - Shell.Process - + Shell.Process Mix.Shell.Process
    1246. @@ -3967,9 +3858,7 @@

    1247. - - Task - + Task Mix.Task
    1248. @@ -3983,13 +3872,6 @@

      Mix.Task

    1249. -
    1250. - - behaviour_info/1 - - Mix.Task -
    1251. -
    1252. clear/0 @@ -4057,9 +3939,7 @@

    1253. - - Tasks.Clean - + Tasks.Clean Mix.Tasks.Clean
    1254. @@ -4077,9 +3957,7 @@

    1255. - - Tasks.Compile - + Tasks.Compile Mix.Tasks.Compile
    1256. @@ -4097,9 +3975,7 @@

    1257. - - Tasks.Compile.App - + Tasks.Compile.App Mix.Tasks.Compile.App
    1258. @@ -4117,9 +3993,7 @@

    1259. - - Tasks.Compile.Elixir - + Tasks.Compile.Elixir Mix.Tasks.Compile.Elixir
    1260. @@ -4137,9 +4011,7 @@

    1261. - - Tasks.Deps - + Tasks.Deps Mix.Tasks.Deps
    1262. @@ -4157,9 +4029,7 @@

    1263. - - Tasks.Deps.Check - + Tasks.Deps.Check Mix.Tasks.Deps.Check
    1264. @@ -4177,9 +4047,7 @@

    1265. - - Tasks.Deps.Clean - + Tasks.Deps.Clean Mix.Tasks.Deps.Clean
    1266. @@ -4197,9 +4065,7 @@

    1267. - - Tasks.Deps.Compile - + Tasks.Deps.Compile Mix.Tasks.Deps.Compile
    1268. @@ -4217,9 +4083,7 @@

    1269. - - Tasks.Deps.Get - + Tasks.Deps.Get Mix.Tasks.Deps.Get
    1270. @@ -4237,9 +4101,7 @@

    1271. - - Tasks.Deps.Loadpaths - + Tasks.Deps.Loadpaths Mix.Tasks.Deps.Loadpaths
    1272. @@ -4257,9 +4119,7 @@

    1273. - - Tasks.Deps.Unlock - + Tasks.Deps.Unlock Mix.Tasks.Deps.Unlock
    1274. @@ -4277,9 +4137,7 @@

    1275. - - Tasks.Deps.Update - + Tasks.Deps.Update Mix.Tasks.Deps.Update
    1276. @@ -4297,9 +4155,7 @@

    1277. - - Tasks.Do - + Tasks.Do Mix.Tasks.Do
    1278. @@ -4317,9 +4173,25 @@

    1279. - - Tasks.Help - + Tasks.Escriptize + + Mix.Tasks.Escriptize +
    1280. +
        + + +
      • + + run/1 + + Mix.Tasks.Escriptize +
      • + +
      +
    1281. + + + Tasks.Help Mix.Tasks.Help
    1282. @@ -4337,9 +4209,7 @@

    1283. - - Tasks.Iex - + Tasks.Iex Mix.Tasks.Iex
    1284. @@ -4357,9 +4227,7 @@

    1285. - - Tasks.Loadpaths - + Tasks.Loadpaths Mix.Tasks.Loadpaths
    1286. @@ -4377,9 +4245,7 @@

    1287. - - Tasks.Local - + Tasks.Local Mix.Tasks.Local
    1288. @@ -4397,9 +4263,7 @@

    1289. - - Tasks.Local.Install - + Tasks.Local.Install Mix.Tasks.Local.Install
    1290. @@ -4417,9 +4281,7 @@

    1291. - - Tasks.Local.Uninstall - + Tasks.Local.Uninstall Mix.Tasks.Local.Uninstall
    1292. @@ -4437,9 +4299,7 @@

    1293. - - Tasks.New - + Tasks.New Mix.Tasks.New
    1294. @@ -4457,9 +4317,7 @@

    1295. - - Tasks.Run - + Tasks.Run Mix.Tasks.Run
    1296. @@ -4477,9 +4335,7 @@

    1297. - - Tasks.Test - + Tasks.Test Mix.Tasks.Test
    1298. @@ -4497,9 +4353,7 @@

    1299. - - Utils - + Utils Mix.Utils
    1300. @@ -4534,6 +4388,27 @@

      Mix.Utils

    1301. +
    1302. + + exclude_files/1 + + Mix.Utils +
    1303. + +
    1304. + + extract_files/2 + + Mix.Utils +
    1305. + +
    1306. + + extract_files/3 + + Mix.Utils +
    1307. +
    1308. module_name_to_command/2 @@ -4625,9 +4500,7 @@

    1309. - - Module - + Module Module
    1310. @@ -4753,13 +4626,18 @@

      Module

    1311. +
    1312. + + split/1 + + Module +
    1313. +
    1314. - - Node - + Node Node
    1315. @@ -4847,9 +4725,7 @@

    1316. - - OptionParser - + OptionParser OptionParser
    1317. @@ -4874,9 +4750,7 @@

    1318. - - Orddict - + Orddict Orddict
    1319. @@ -4992,9 +4866,7 @@

    1320. - - Port - + Port Port
    1321. @@ -5068,9 +4940,7 @@

    1322. - - Process - + Process Process
    1323. @@ -5291,9 +5161,7 @@

    1324. - - Record - + Record Record
    1325. @@ -5332,9 +5200,7 @@

    1326. - - Regex - + Regex Regex
    1327. @@ -5446,20 +5312,85 @@

      Regex

    1328. + +
    1329. + + + String + + String +
    1330. +
    1331. - - System - + System System
    1332. @@ -5554,9 +5485,7 @@

    1333. - - Tuple - + Tuple Tuple
    1334. @@ -5567,9 +5496,7 @@

    1335. - - URI - + URI URI
    1336. @@ -5577,9 +5504,7 @@

    1337. - - FTP - + FTP URI.FTP
    1338. @@ -5604,9 +5529,7 @@

    1339. - - HTTP - + HTTP URI.HTTP
    1340. @@ -5631,9 +5554,7 @@

    1341. - - HTTPS - + HTTPS URI.HTTPS
    1342. @@ -5658,9 +5579,7 @@

    1343. - - LDAP - + LDAP URI.LDAP
    1344. @@ -5685,9 +5604,7 @@

    1345. - - Parser - + Parser URI.Parser
    1346. @@ -5712,9 +5629,7 @@

    1347. - - SFTP - + SFTP URI.SFTP
    1348. @@ -5739,9 +5654,7 @@

    1349. - - TFTP - + TFTP URI.TFTP
    1350. diff --git a/docs/master/protocols_list.html b/docs/master/protocols_list.html index 7fa7fd5ce..d1e56a24e 100644 --- a/docs/master/protocols_list.html +++ b/docs/master/protocols_list.html @@ -36,9 +36,7 @@

    1351. - - Access - + Access Access
    1352. @@ -46,9 +44,7 @@

    1353. - - Atom - + Atom Access.Atom
    1354. @@ -66,29 +62,18 @@

    1355. - - Binary.Dict - + Binary.Dict Access.Binary.Dict
      • -
      • - - access/2 - - Access.Binary.Dict -
      • -
    1356. - - Function - + Function Access.Function
    1357. @@ -106,29 +91,18 @@

    1358. - - HashDict - + HashDict Access.HashDict
      • -
      • - - access/2 - - Access.HashDict -
      • -
    1359. - - List - + List Access.List
    1360. @@ -146,22 +120,13 @@

    1361. - - Orddict - + Orddict Access.Orddict
    1362. @@ -176,9 +141,7 @@

    1363. - - Binary.Chars - + Binary.Chars Binary.Chars
    1364. @@ -186,9 +149,7 @@

    1365. - - Atom - + Atom Binary.Chars.Atom
    1366. @@ -206,9 +167,7 @@

    1367. - - BitString - + BitString Binary.Chars.BitString
    1368. @@ -226,9 +185,7 @@

    1369. - - List - + List Binary.Chars.List
    1370. @@ -246,9 +203,7 @@

    1371. - - Number - + Number Binary.Chars.Number
    1372. @@ -276,726 +231,364 @@

    1373. - - Binary.Inspect - + Enum.Iterator - Binary.Inspect + Enum.Iterator
    1374. - - Enum.Iterator - + Enum.OrdIterator - Enum.Iterator + Enum.OrdIterator
    1375. - - Enum.OrdIterator - + List.Chars - Enum.OrdIterator + List.Chars
    1376. - - Range - + Range.Iterator - Enum.OrdIterator.Range + Range.Iterator +
    1377. +
    1378. - - IEx.Autocomplete.Entry.IEx.Autocomplete.Fun - + String.Inspect - IEx.Autocomplete.Entry.IEx.Autocomplete.Fun + String.Inspect
      • - - -
      • - - to_entries/1 - - IEx.Autocomplete.Entry.IEx.Autocomplete.Fun -
      • - -
      • - - to_hint/2 - - IEx.Autocomplete.Entry.IEx.Autocomplete.Fun -
      • - -
      -
    1379. +
    1380. - - IEx.Autocomplete.Entry.IEx.Autocomplete.Mod - + Any - IEx.Autocomplete.Entry.IEx.Autocomplete.Mod + String.Inspect.Any
      • -
      • - - to_entries/1 - - IEx.Autocomplete.Entry.IEx.Autocomplete.Mod -
      • - -
      • - - to_hint/2 - - IEx.Autocomplete.Entry.IEx.Autocomplete.Mod -
      • -
    1381. - - List.Chars - + Atom - List.Chars + String.Inspect.Atom
    1382. - - Range.Iterator - + Regex - Range.Iterator + String.Inspect.Regex
      • -
      • + + +
      +
    1383. - - Number - + Tuple - Range.Iterator.Number + String.Inspect.Tuple
      • -
      • - - count/2 - - Range.Iterator.Number -
      • - -
      • - - iterator/2 - - Range.Iterator.Number -
      • -
    1384. - count/2 - - Range.Iterator -
    1385. - -
    1386. - - iterator/2 + inspect/1 - Range.Iterator + String.Inspect
    1387. diff --git a/docs/master/records_list.html b/docs/master/records_list.html index 431e86ef9..a24b0591b 100644 --- a/docs/master/records_list.html +++ b/docs/master/records_list.html @@ -36,9 +36,7 @@

    1388. - - ArgumentError - + ArgumentError ArgumentError
    1389. @@ -105,9 +103,7 @@

    1390. - - ArithmeticError - + ArithmeticError ArithmeticError
    1391. @@ -174,9 +170,7 @@

    1392. - - BadArityError - + BadArityError BadArityError
    1393. @@ -271,9 +265,7 @@

    1394. - - BadFunctionError - + BadFunctionError BadFunctionError
    1395. @@ -347,9 +339,7 @@

    1396. - - CaseClauseError - + CaseClauseError CaseClauseError
    1397. @@ -423,9 +413,7 @@

    1398. - - CompileError - + CompileError CompileError
    1399. @@ -541,9 +529,7 @@

    1400. - - EEx.SyntaxError - + EEx.SyntaxError EEx.SyntaxError
    1401. @@ -610,9 +596,7 @@

    1402. - - Enum.OutOfBoundsError - + Enum.OutOfBoundsError Enum.OutOfBoundsError
    1403. @@ -679,9 +663,7 @@

    1404. - - ErlangError - + ErlangError ErlangError
    1405. @@ -755,9 +737,7 @@

    1406. - - ExUnit.AssertionError - + ExUnit.AssertionError ExUnit.AssertionError
    1407. @@ -824,9 +804,7 @@

    1408. - - File.CopyError - + File.CopyError File.CopyError
    1409. @@ -963,9 +941,7 @@

    1410. - - File.Error - + File.Error File.Error
    1411. @@ -1081,9 +1057,7 @@

    1412. - - File.IteratorError - + File.IteratorError File.IteratorError
    1413. @@ -1157,9 +1131,7 @@

    1414. - - File.Stat - + File.Stat File.Stat
    1415. @@ -1464,9 +1436,7 @@

    1416. - - FunctionClauseError - + FunctionClauseError FunctionClauseError
    1417. @@ -1582,9 +1552,7 @@

    1418. - - Keyword.KeyError - + Keyword.KeyError Keyword.KeyError
    1419. @@ -1658,9 +1626,7 @@

    1420. - - Macro.Env - + Macro.Env Macro.Env
    1421. @@ -1769,9 +1735,7 @@

    1422. - - MatchError - + MatchError MatchError
    1423. @@ -1845,9 +1809,7 @@

    1424. - - Mix.Dep - + Mix.Dep Mix.Dep
    1425. @@ -1984,9 +1946,7 @@

    1426. - - Mix.Error - + Mix.Error Mix.Error
    1427. @@ -2053,9 +2013,7 @@

    1428. - - Mix.InvalidTaskError - + Mix.InvalidTaskError Mix.InvalidTaskError
    1429. @@ -2129,9 +2087,7 @@

    1430. - - Mix.NoProjectError - + Mix.NoProjectError Mix.NoProjectError
    1431. @@ -2198,9 +2154,7 @@

    1432. - - Mix.NoTaskError - + Mix.NoTaskError Mix.NoTaskError
    1433. @@ -2274,9 +2228,7 @@

    1434. - - Mix.OutOfDateDepsError - + Mix.OutOfDateDepsError Mix.OutOfDateDepsError
    1435. @@ -2343,9 +2295,7 @@

    1436. - - Protocol.UndefinedError - + Protocol.UndefinedError Protocol.UndefinedError
    1437. @@ -2440,9 +2390,7 @@

    1438. - - Range - + Range Range
    1439. @@ -2502,9 +2450,7 @@

    1440. - - Regex.CompileError - + Regex.CompileError Regex.CompileError
    1441. @@ -2571,9 +2517,7 @@

    1442. - - RuntimeError - + RuntimeError RuntimeError
    1443. @@ -2640,9 +2584,7 @@

    1444. - - SyntaxError - + SyntaxError SyntaxError
    1445. @@ -2758,9 +2700,7 @@

    1446. - - SystemLimitError - + SystemLimitError SystemLimitError
    1447. @@ -2827,9 +2767,7 @@

    1448. - - TokenMissingError - + TokenMissingError TokenMissingError
    1449. @@ -2945,9 +2883,7 @@

    1450. - - UndefinedFunctionError - + UndefinedFunctionError UndefinedFunctionError
    1451. From 0b54d1c7830e683a9cafe38532c0384aeea3b486 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Thu, 13 Sep 2012 14:50:47 +0300 Subject: [PATCH 234/437] Fix the erlang precompiled package link MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thanks to @ralph-moeritz  --- getting_started/1.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/getting_started/1.markdown b/getting_started/1.markdown index feb709b9e..1412701c9 100644 --- a/getting_started/1.markdown +++ b/getting_started/1.markdown @@ -12,7 +12,7 @@ Keep in mind that Elixir is still in development so if at any point you receive ## 1.1 Installation -The only prerequisite for Elixir is Erlang, version R15B later. You can find the source code for [Erlang here](http://www.erlang.org/download.html) or use one of the [precompiled packages](http://www.erlang-solutions.com/section/132/erlang-otp-packages). +The only prerequisite for Elixir is Erlang, version R15B or later. You can find the source code for [Erlang here](http://www.erlang.org/download.html) or use one of the [precompiled packages](https://www.erlang-solutions.com/downloads/download-erlang-otp). For Windows developers, we recommend the precompiled package. Those on the UNIX platform can probably get Erlang installed via one of the many package management tools. From 18f3aac32d03554e85c9cae1a0602bf3a234056e Mon Sep 17 00:00:00 2001 From: Richard Ramsden Date: Thu, 13 Sep 2012 20:15:32 -0700 Subject: [PATCH 235/437] fix broken links --- getting_started/3.markdown | 4 ++-- getting_started/6.markdown | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/getting_started/3.markdown b/getting_started/3.markdown index a0247ad45..01e744914 100644 --- a/getting_started/3.markdown +++ b/getting_started/3.markdown @@ -314,7 +314,7 @@ In addition to the built-in attributes outlined above, customer attributes may a IO.inspect @my_data #=> 13 end -Unlike Erlang, user defined attributes are not stored in the module by default since it is common in Elixir to use such attributes to store temporary data. A developer can configure an attribute to behave closer to Erlang by calling [`Module.register_attribute/2`](/docs/Module.html#register_attribute/2). +Unlike Erlang, user defined attributes are not stored in the module by default since it is common in Elixir to use such attributes to store temporary data. A developer can configure an attribute to behave closer to Erlang by calling [`Module.register_attribute/2`](/docs/stable/Module.html#register_attribute/2). Finally, notice that attributes can also be read inside functions: @@ -328,7 +328,7 @@ Finally, notice that attributes can also be read inside functions: MyServer.first_data #=> 11 MyServer.second_data #=> 13 -Notice that reading an attribute inside a function takes a snapshot of its current value. In other words, the value is read at compilation time and not at runtime. Check [the documentation for the module `Module` documentation](/docs/Module.html) for other functions to manipulate module attributes. +Notice that reading an attribute inside a function takes a snapshot of its current value. In other words, the value is read at compilation time and not at runtime. Check [the documentation for the module `Module` documentation](/docs/stable/Module.html) for other functions to manipulate module attributes. ## 3.7 Nesting diff --git a/getting_started/6.markdown b/getting_started/6.markdown index 5f81485c8..8e617b8f8 100644 --- a/getting_started/6.markdown +++ b/getting_started/6.markdown @@ -19,7 +19,7 @@ Sigils starting with an uppercase letter never escape characters or do interpola %b-another binary- -Internally, `%b` is translated as a function call to `__b__`. For instance, the docs for `%b` are available [in the function `__b__/1` defined in `Kernel` module](/docs/Kernel.html#__b__/1). +Internally, `%b` is translated as a function call to `__b__`. For instance, the docs for `%b` are available [in the function `__b__/1` defined in `Kernel` module](/docs/stable/Kernel.html#__b__/1). The sigils defined in Elixir by default are: From 51b961e43547be4efb2b5acba58b51a6a9baa00d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Fri, 14 Sep 2012 15:22:07 +0200 Subject: [PATCH 236/437] Add a section about exceptions --- getting_started/2.markdown | 88 ++++++++++++++++++++++---------------- 1 file changed, 51 insertions(+), 37 deletions(-) diff --git a/getting_started/2.markdown b/getting_started/2.markdown index d7e3387c0..b7e80cd18 100644 --- a/getting_started/2.markdown +++ b/getting_started/2.markdown @@ -512,43 +512,7 @@ The common strategy is to explicitly make all arguments that are required after x #=> returns the value of x or nil for failures -### 2.7.7 Rescue - -For catching exceptions in Elixir, we can use `rescue` instead of `catch`. In addition to allowing the same pattern matching rules as `catch`, `rescue` also allows a developer to easily rescue an exception by its name and not by its internal contents. Consider the following examples: - - # rescue only runtime error - try do - raise "some error" - rescue - RuntimeError -> "rescued" - end - - # rescue runtime and argument errors - try do - raise "some error" - rescue - [RuntimeError, ArgumentError] -> "rescued" - end - - # rescue and assign to x - try do - raise "some error" - rescue - x in [RuntimeError] -> - # all exceptions respond to message - x.message - end - - # rescue all (discouraged) and assign to x - try do - raise ArgumentError, message: "unexpected argument" - rescue - x -> x.message - end - -Custom exceptions can be defined using the `defexception` macro. You can check a list of defined exceptions in [our documentations page](/docs/stable/), by clicking "Records" in the upper left corner. - -### 2.7.8 Receive +### 2.7.7 Receive The last control-flow mechanism we are going to discuss is essential to Elixir's and Erlang's actor mechanism. In Elixir, the code is run in separate processes that exchange messages between them. Those processes are not Operating System processes (they are actually quite light-weight) but are called so since they do not share state with each other. @@ -583,6 +547,56 @@ You may not see exactly `<0.36.0>` back, but something similar. If there are no Notice we spawned a new function using the `spawn` function passing another function as argument. Elixir also supports `spawn_link`, which spawns a child process but keeps the parent and child connected. This way, if the child dies unexpectedly, the parent receives a notification. [`Process`](/docs/stable/Process.html) and [`Node`](/docs/stable/Node.html) modules contains many functions to manage processes, including spawning and get information about processes running in other nodes in the network. +## 2.8 Exceptions + +Elixir provides the concept of exceptions. An exception can be raised using the function `raise` and rescued inside a `try` block with the `rescue` keyword: + + # rescue only runtime error + try do + raise "some error" + rescue + RuntimeError -> "rescued" + end + + # rescue runtime and argument errors + try do + raise "some error" + rescue + [RuntimeError, ArgumentError] -> "rescued" + end + + # rescue and assign to x + try do + raise "some error" + rescue + x in [RuntimeError] -> + # all exceptions respond to message + x.message + end + +In general, idiomatic Elixir avoids raising exceptions unless you are truly in an exceptional scenario. In such cases, your code nor anyone integrating with your code can recover from the exception and continue. + +For example, if you write a software that does log partitioning and log rotation over the network, you may face network issues or an eventual instability when accessing the file system. These scenarios are not exceptional in this particular software and must be handled accordingly. Therefore, a developer can read some file using `File.read`: + + case File.read(file) do + { :ok, contents } -> + # we could access the file + # proceed as expected + { :error, reason } -> + # Ops, something went wrong + # We need to handle the error accordingly + end + +Notice `File.read` does not raise an exception in case something goes wrong, it returns a tuple containing `:ok` in case of success and `{ :error, reason }` in case of failures. This is approach is commonly called **sideband data** as we annotate the result. + +On the other hand, a CLI interface that needs to access or manipulate a file given by the user, you may necessarily expect a file to be there, if it isn't there is nothing you can do then fail. Then you may use `File.read!` which raises an exception: + + contents = File.read!(file) + +We can sum this up in few words: don't use exceptions for control-flow. If you feel like you need to rescue an exception in order to change how the code behaves, you should probably be using sideband data. + +Custom exceptions can be defined using the `defexception` macro. You can check a list of defined exceptions in [our documentations page](/docs/stable/), by clicking "Records" in the upper left corner. + ## 2.8 Built-in functions Elixir ships with many built-in functions automatically available in the current scope. In addition to the control flow expressions seen above, Elixir also adds: `elem` and `setelem` to read and set values in tuples, `inspect` that returns the representation of a given data type as a string, and many others. All of these functions imported by default are available in [`Kernel`](/docs/stable/Kernel.html) and [Elixir special forms are available in `Kernel.SpecialForms`](/docs/stable/Kernel.SpecialForms.html). From 92c9a0e1e7e9595e43cd3e16550454de99ce1465 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Tue, 25 Sep 2012 14:40:22 -0500 Subject: [PATCH 237/437] Improve partial application and function retrieval docs Thanks to @technomancy --- getting_started/6.markdown | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/getting_started/6.markdown b/getting_started/6.markdown index 8e617b8f8..56cf9655d 100644 --- a/getting_started/6.markdown +++ b/getting_started/6.markdown @@ -145,28 +145,33 @@ The documentation for built-in functions can also be accessed directly or direct iex> d(Kernel.is_atom/1) ... -## 6.5 Partial application +## 6.5 Function retrieval and partial application -Elixir also supports partial application. Let's suppose we have a list of strings and we want to calculate the size for each of them. We could do it in the following way: +Elixir supports a convenient syntax for retrieving functions. Let's suppose we have a list of binaries and we want to calculate the size of each of them. We could do it in the following way: iex> list = ["foo", "bar", "baz"] ["foo","bar","baz"] iex> Enum.map list, fn(x) -> size(x) end [3,3,3] -However, with partial application, we could also do: +We could also write this as: iex> Enum.map list, size(&1) [3,3,3] -In the example above, we have invoked the function `size` passing `&1` as an argument asking Elixir to generate a function that expects one argument and that argument will be passed to `size`. +The example above works as if `size(&1)` translates directly to `fn(x) -> size(x) end`. Since operators are also function calls, they can also benefit of the same syntax: -Since operators are also function calls they can also be partially applied: + iex> Enum.reduce [1,2,3], 0, &1 * &2 + 6 + +In this case, `&1 * &2` translates to `fn(x, y) -> x * y end`. The values `&1` and `&2` maps to the argument order in the generated function. + +This syntax can also be used to do partial application in Elixir. For instance, if we want to multiply each item in a list per two, we could write it as: iex> Enum.map [1,2,3], &1 * 2 [2,4,6] -All functions can be partially applied, except [Elixir's special forms](/docs/stable/Kernel.SpecialForms.html). +All functions and macros can be retrieved and partially applied, except [Elixir's special forms](/docs/stable/Kernel.SpecialForms.html). ## 6.6 Use From b24b78477eec2e37ca12c5f94e168785951b341e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Thu, 27 Sep 2012 16:59:30 -0700 Subject: [PATCH 238/437] Update docs --- docs/master/Access.Binary.Dict.html | 2 +- docs/master/Access.Orddict.html | 2 +- docs/master/Behaviour.html | 2 +- ...spect.Any.html => Binary.Inspect.Any.html} | 6 +- ...ect.Atom.html => Binary.Inspect.Atom.html} | 6 +- ...ing.html => Binary.Inspect.BitString.html} | 6 +- ...ect.List.html => Binary.Inspect.List.html} | 6 +- ...Number.html => Binary.Inspect.Number.html} | 6 +- ...t.Regex.html => Binary.Inspect.Regex.html} | 6 +- ...t.Tuple.html => Binary.Inspect.Tuple.html} | 6 +- ...tring.Inspect.html => Binary.Inspect.html} | 38 ++-- docs/master/Dict.html | 97 ++++++--- docs/master/Enum.Iterator.Function.html | 2 +- docs/master/Enum.Iterator.List.html | 2 +- docs/master/Enum.OrdIterator.Binary.Dict.html | 51 ----- docs/master/Enum.OrdIterator.Function.html | 51 ----- docs/master/Enum.OrdIterator.List.html | 51 ----- docs/master/Enum.OrdIterator.Orddict.html | 51 ----- docs/master/Enum.OrdIterator.Range.html | 51 ----- docs/master/Enum.OrdIterator.html | 143 ------------- docs/master/Enum.html | 74 +++---- docs/master/GenServer.Behaviour.html | 13 +- docs/master/HashDict.html | 2 +- docs/master/IEx.UnicodeIO.html | 106 ---------- docs/master/IEx.html | 44 +++- docs/master/IO.html | 6 +- docs/master/Kernel.SpecialForms.html | 28 +-- docs/master/Kernel.html | 114 +++++++---- docs/master/Keyword.html | 35 ++-- docs/master/Mix.Dep.html | 40 ++++ docs/master/Mix.Deps.Lock.html | 32 ++- docs/master/Mix.Deps.html | 83 ++++---- docs/master/Mix.Error.html | 18 +- docs/master/Mix.OutOfDateDepsError.html | 18 +- docs/master/Mix.Project.html | 38 ++-- docs/master/Mix.SCM.html | 63 +++--- docs/master/Mix.Tasks.Deps.Loadpaths.html | 2 +- docs/master/Module.html | 78 ++++---- docs/master/Orddict.html | 2 +- docs/master/Process.html | 2 +- docs/master/Range.Iterator.Number.html | 2 +- docs/master/Record.html | 21 +- docs/master/String.html | 109 +++++++++- docs/master/modules_list.html | 136 +++++++++---- docs/master/protocols_list.html | 188 +++++------------- docs/master/records_list.html | 21 ++ 46 files changed, 814 insertions(+), 1046 deletions(-) rename docs/master/{String.Inspect.Any.html => Binary.Inspect.Any.html} (89%) rename docs/master/{String.Inspect.Atom.html => Binary.Inspect.Atom.html} (91%) rename docs/master/{String.Inspect.BitString.html => Binary.Inspect.BitString.html} (89%) rename docs/master/{String.Inspect.List.html => Binary.Inspect.List.html} (92%) rename docs/master/{String.Inspect.Number.html => Binary.Inspect.Number.html} (88%) rename docs/master/{String.Inspect.Regex.html => Binary.Inspect.Regex.html} (89%) rename docs/master/{String.Inspect.Tuple.html => Binary.Inspect.Tuple.html} (90%) rename docs/master/{String.Inspect.html => Binary.Inspect.html} (70%) delete mode 100644 docs/master/Enum.OrdIterator.Binary.Dict.html delete mode 100644 docs/master/Enum.OrdIterator.Function.html delete mode 100644 docs/master/Enum.OrdIterator.List.html delete mode 100644 docs/master/Enum.OrdIterator.Orddict.html delete mode 100644 docs/master/Enum.OrdIterator.Range.html delete mode 100644 docs/master/Enum.OrdIterator.html delete mode 100644 docs/master/IEx.UnicodeIO.html diff --git a/docs/master/Access.Binary.Dict.html b/docs/master/Access.Binary.Dict.html index 524b1eec5..09a3ed345 100644 --- a/docs/master/Access.Binary.Dict.html +++ b/docs/master/Access.Binary.Dict.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/master/Access.Orddict.html b/docs/master/Access.Orddict.html index 7b5e8b3f2..f55da081a 100644 --- a/docs/master/Access.Orddict.html +++ b/docs/master/Access.Orddict.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/master/Behaviour.html b/docs/master/Behaviour.html index 5573d69a7..ddce0d3bc 100644 --- a/docs/master/Behaviour.html +++ b/docs/master/Behaviour.html @@ -42,7 +42,7 @@

      defcallback parse(arg) @doc "Defines a default port" - defcallback default_port(arg) + defcallback default_port() end diff --git a/docs/master/String.Inspect.Any.html b/docs/master/Binary.Inspect.Any.html similarity index 89% rename from docs/master/String.Inspect.Any.html rename to docs/master/Binary.Inspect.Any.html index 9e4457f7f..8963bc2ba 100644 --- a/docs/master/String.Inspect.Any.html +++ b/docs/master/Binary.Inspect.Any.html @@ -1,7 +1,7 @@ - String.Inspect.Any + Binary.Inspect.Any @@ -21,7 +21,7 @@

      - String.Inspect.Any + Binary.Inspect.Any impl @@ -40,7 +40,7 @@

      Examples

      - Source + Source diff --git a/docs/master/String.Inspect.Atom.html b/docs/master/Binary.Inspect.Atom.html similarity index 91% rename from docs/master/String.Inspect.Atom.html rename to docs/master/Binary.Inspect.Atom.html index 68f1fff15..2bb354b3d 100644 --- a/docs/master/String.Inspect.Atom.html +++ b/docs/master/Binary.Inspect.Atom.html @@ -1,7 +1,7 @@ - String.Inspect.Atom + Binary.Inspect.Atom @@ -21,7 +21,7 @@

      - String.Inspect.Atom + Binary.Inspect.Atom impl @@ -46,7 +46,7 @@

      Examples

      - Source + Source diff --git a/docs/master/String.Inspect.BitString.html b/docs/master/Binary.Inspect.BitString.html similarity index 89% rename from docs/master/String.Inspect.BitString.html rename to docs/master/Binary.Inspect.BitString.html index 6d264f0a4..2ace9f3d4 100644 --- a/docs/master/String.Inspect.BitString.html +++ b/docs/master/Binary.Inspect.BitString.html @@ -1,7 +1,7 @@ - String.Inspect.BitString + Binary.Inspect.BitString @@ -21,7 +21,7 @@

      - String.Inspect.BitString + Binary.Inspect.BitString impl @@ -41,7 +41,7 @@

      Examples

      - Source + Source diff --git a/docs/master/String.Inspect.List.html b/docs/master/Binary.Inspect.List.html similarity index 92% rename from docs/master/String.Inspect.List.html rename to docs/master/Binary.Inspect.List.html index 8df9da367..730b02454 100644 --- a/docs/master/String.Inspect.List.html +++ b/docs/master/Binary.Inspect.List.html @@ -1,7 +1,7 @@ - String.Inspect.List + Binary.Inspect.List @@ -21,7 +21,7 @@

      - String.Inspect.List + Binary.Inspect.List impl @@ -49,7 +49,7 @@

      Examples

      - Source + Source diff --git a/docs/master/String.Inspect.Number.html b/docs/master/Binary.Inspect.Number.html similarity index 88% rename from docs/master/String.Inspect.Number.html rename to docs/master/Binary.Inspect.Number.html index 76246afd4..7b972c4c5 100644 --- a/docs/master/String.Inspect.Number.html +++ b/docs/master/Binary.Inspect.Number.html @@ -1,7 +1,7 @@ - String.Inspect.Number + Binary.Inspect.Number @@ -21,7 +21,7 @@

      - String.Inspect.Number + Binary.Inspect.Number impl @@ -39,7 +39,7 @@

      Examples

      - Source + Source diff --git a/docs/master/String.Inspect.Regex.html b/docs/master/Binary.Inspect.Regex.html similarity index 89% rename from docs/master/String.Inspect.Regex.html rename to docs/master/Binary.Inspect.Regex.html index 6bc60ab80..48f9d511f 100644 --- a/docs/master/String.Inspect.Regex.html +++ b/docs/master/Binary.Inspect.Regex.html @@ -1,7 +1,7 @@ - String.Inspect.Regex + Binary.Inspect.Regex @@ -21,7 +21,7 @@

      - String.Inspect.Regex + Binary.Inspect.Regex impl @@ -39,7 +39,7 @@

      Examples

      - Source + Source diff --git a/docs/master/String.Inspect.Tuple.html b/docs/master/Binary.Inspect.Tuple.html similarity index 90% rename from docs/master/String.Inspect.Tuple.html rename to docs/master/Binary.Inspect.Tuple.html index ad6bb6a96..341565fb8 100644 --- a/docs/master/String.Inspect.Tuple.html +++ b/docs/master/Binary.Inspect.Tuple.html @@ -1,7 +1,7 @@ - String.Inspect.Tuple + Binary.Inspect.Tuple @@ -21,7 +21,7 @@

      - String.Inspect.Tuple + Binary.Inspect.Tuple impl @@ -41,7 +41,7 @@

      Examples

      - Source + Source diff --git a/docs/master/String.Inspect.html b/docs/master/Binary.Inspect.html similarity index 70% rename from docs/master/String.Inspect.html rename to docs/master/Binary.Inspect.html index bbce7cafa..96a6e7e57 100644 --- a/docs/master/String.Inspect.html +++ b/docs/master/Binary.Inspect.html @@ -1,7 +1,7 @@ - String.Inspect + Binary.Inspect @@ -21,7 +21,7 @@

      - String.Inspect + Binary.Inspect protocol @@ -29,18 +29,18 @@

      -

      The String.Inspect protocol is responsible for -converting any structure to a string (i.e. an utf-8 -binary) for textual representation. All basic data -structures (tuple, list, function, pid, etc) implement -the inspect protocol. Other structures are adviced to +

      The Binary.Inspect protocol is responsible for +converting any structure to a binary for textual +representation. All basic data structures +(tuple, list, function, pid, etc) implement the +inspect protocol. Other structures are advised to implement the protocol in order to provide pretty printing.

      - Source + Source

      Implementations

      @@ -48,43 +48,43 @@

      Implementations

    1452. - Any + Any
    1453. - Atom + Atom
    1454. - BitString + BitString
    1455. - List + List
    1456. - Number + Number
    1457. - Regex + Regex
    1458. - Tuple + Tuple
    1459. @@ -98,7 +98,7 @@

      Functions summary

      • - inspect/1 + inspect/2
      • @@ -113,11 +113,11 @@

        Functions summary

        Functions

        -

        - inspect(thing) +

        + inspect(thing, opts)

        - Source + Source
        diff --git a/docs/master/Dict.html b/docs/master/Dict.html index 643337aaf..f61086f56 100644 --- a/docs/master/Dict.html +++ b/docs/master/Dict.html @@ -31,8 +31,28 @@

        This module specifies the Dict API expected to be implemented by different dictionaries. It also provides -functions that redirect to the target based on the tuple -signature.

        +functions that redirect to the underlying Dict based on +the tuple signature.

        + +

        The keyword list used throughout Elixir cannot be +manipulated via the Dict module, you must use the +Keyword module instead. This distinction is intentional: +the Dict module is meant to work on structures that work +as storage.

        + +

        To create a new dict, use the new functions defined +by each dict type:

        + +
        Orddict.new [{:a, 1}, {:b, 2}]
        +HashDict.new  #=> creates an empty HashDict
        +
        + +

        For simplicity's sake, in the examples below everytime +new is used, it implies one of the module-specific +calls like the two above. Likewise, when the result of +a function invocation is shown in the form [a: 1, b: 2], +it implies that the returned value is actually of the +same dict type as the input one.

        @@ -131,18 +151,21 @@

        Functions

        Examples

        -
        Dict.delete [a: 1, b: 2], :a  #=> [b: 2]
        -Dict.delete [b: 2], :a        #=> [b: 2]
        +
        d = new [a: 1, b: 2]
        +Dict.delete d, :a      #=> [b: 2]
        +
        +d = new [b: 2]
        +Dict.delete d, :a      #=> [b: 2]
         
      - Source + Source

      empty(dict)

      Returns an empty dict of the same type as dict.

      - Source + Source

      get(dict, key, default // nil) @@ -152,12 +175,13 @@

      Examples

      Examples

      -
      Dict.get [a: 1], :a     #=> 1
      -Dict.get [a: 1], :b     #=> nil
      -Dict.get [a: 1], :b, 3  #=> 3
      +
      d = new [a: 1]
      +Dict.get d, :a     #=> 1
      +Dict.get d, :b     #=> nil
      +Dict.get d, :b, 3  #=> 3
       
      - Source + Source

      has_key?(dict, key) @@ -166,11 +190,12 @@

      Examples

      Examples

      -
      Dict.has_key?([a: 1], :a)  #=> true
      -Dict.has_key?([a: 1], :b)  #=> false
      +
      d = new [a: 1]
      +Dict.has_key?(d, :a)  #=> true
      +Dict.has_key?(d, :b)  #=> false
       
      - Source + Source

      keys(dict) @@ -181,10 +206,11 @@

      Examples

      Examples

      -
      Dict.keys [a: 1, b: 2]  #=> [:a,:b]
      +
      d = new [a: 1, b: 2]
      +Dict.keys d  #=> [:a,:b]
       
      - Source + Source

      merge(dict1, dict2) @@ -196,11 +222,13 @@

      Examples

      Examples

      -
      Dict.merge [a: 1, b: 2], [a: 3, d: 4]
      -#=> [a:3, b:2, d: 4]
      +
      d1 = new [a: 1, b: 2]
      +d2 = new [a: 3, d: 4]
      +Dict.merge d1, d2
      +#=> [a: 3, b: 2, d: 4]
       
      - Source + Source

      merge(dict1, dict2, fun) @@ -210,13 +238,15 @@

      Examples

      Examples

      -
      Dict.merge [a: 1, b: 2], [a: 3, d: 4], fn _k, v1, v2 ->
      +
      d1 = new [a: 1, b: 2]
      +d2 = new [a: 3, d: 4]
      +Dict.merge d1, d2, fn _k, v1, v2 ->
         v1 + v2
       end
       #=> [a: 4, b: 2, d: 4]
       
      - Source + Source

      put(dict, key, val) @@ -226,11 +256,12 @@

      Examples

      Examples

      -
      Dict.put [a: 1, b: 2], :a, 3
      +
      d = new [a: 1, b: 2]
      +Dict.put d, :a, 3
       #=> [a: 3, b: 2]
       
      - Source + Source

      size(dict) @@ -239,10 +270,11 @@

      Examples

      Examples

      -
      Dict.size [a: 1, b: 2]  #=> 2
      +
      d = new [a: 1, b: 2]
      +Dict.size d  #=> 2
       
      - Source + Source

      to_list(dict) @@ -250,7 +282,7 @@

      Examples

      Returns a list of key-value pairs stored in dict. No particular order is enforced.

      - Source + Source

      update(dict, key, fun) @@ -260,11 +292,12 @@

      Examples

      Examples

      -
      Dict.update [a: 1, b: 2], :a, fn val -> -val end
      +
      d = new [a: 1, b: 2]
      +Dict.update d, :a, fn val -> -val end
       #=> [a: -1, b: 2]
       
      - Source + Source

      update(dict, key, initial, fun) @@ -275,11 +308,12 @@

      Examples

      Examples

      -
      Dict.update [a: 1, b: 2], :c, 3, fn val -> -val end
      +
      d = new [a: 1, b: 2]
      +Dict.update d, :c, 3, fn val -> -val end
       #=> [a: 1, b: 2, c: 3]
       
      - Source + Source

      values(dict) @@ -288,10 +322,11 @@

      Examples

      Examples

      -
      Dict.values [a: 1, b: 2]  #=> [1,2]
      +
      d = new [a: 1, b: 2]
      +Dict.values d  #=> [1,2]
       
      - Source + Source
      diff --git a/docs/master/Enum.Iterator.Function.html b/docs/master/Enum.Iterator.Function.html index 0990ecbfd..95e6b3caa 100644 --- a/docs/master/Enum.Iterator.Function.html +++ b/docs/master/Enum.Iterator.Function.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/master/Enum.Iterator.List.html b/docs/master/Enum.Iterator.List.html index 40235005f..aab4ce354 100644 --- a/docs/master/Enum.Iterator.List.html +++ b/docs/master/Enum.Iterator.List.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/master/Enum.OrdIterator.Binary.Dict.html b/docs/master/Enum.OrdIterator.Binary.Dict.html deleted file mode 100644 index f5de9bc5d..000000000 --- a/docs/master/Enum.OrdIterator.Binary.Dict.html +++ /dev/null @@ -1,51 +0,0 @@ - - - - Enum.OrdIterator.Binary.Dict - - - - - - - - - - - - -
      -

      - Enum.OrdIterator.Binary.Dict - - impl - -

      - - - - Source - - - - - - - - - - - - - - - - -
      - - diff --git a/docs/master/Enum.OrdIterator.Function.html b/docs/master/Enum.OrdIterator.Function.html deleted file mode 100644 index 052172bbf..000000000 --- a/docs/master/Enum.OrdIterator.Function.html +++ /dev/null @@ -1,51 +0,0 @@ - - - - Enum.OrdIterator.Function - - - - - - - - - - - - -
      -

      - Enum.OrdIterator.Function - - impl - -

      - - - - Source - - - - - - - - - - - - - - - - -
      - - diff --git a/docs/master/Enum.OrdIterator.List.html b/docs/master/Enum.OrdIterator.List.html deleted file mode 100644 index e6afc9432..000000000 --- a/docs/master/Enum.OrdIterator.List.html +++ /dev/null @@ -1,51 +0,0 @@ - - - - Enum.OrdIterator.List - - - - - - - - - - - - -
      -

      - Enum.OrdIterator.List - - impl - -

      - - - - Source - - - - - - - - - - - - - - - - -
      - - diff --git a/docs/master/Enum.OrdIterator.Orddict.html b/docs/master/Enum.OrdIterator.Orddict.html deleted file mode 100644 index 2221eb90c..000000000 --- a/docs/master/Enum.OrdIterator.Orddict.html +++ /dev/null @@ -1,51 +0,0 @@ - - - - Enum.OrdIterator.Orddict - - - - - - - - - - - - -
      -

      - Enum.OrdIterator.Orddict - - impl - -

      - - - - Source - - - - - - - - - - - - - - - - -
      - - diff --git a/docs/master/Enum.OrdIterator.Range.html b/docs/master/Enum.OrdIterator.Range.html deleted file mode 100644 index f0832e392..000000000 --- a/docs/master/Enum.OrdIterator.Range.html +++ /dev/null @@ -1,51 +0,0 @@ - - - - Enum.OrdIterator.Range - - - - - - - - - - - - -
      -

      - Enum.OrdIterator.Range - - impl - -

      - - - - Source - - - - - - - - - - - - - - - - -
      - - diff --git a/docs/master/Enum.OrdIterator.html b/docs/master/Enum.OrdIterator.html deleted file mode 100644 index fba1fc6cd..000000000 --- a/docs/master/Enum.OrdIterator.html +++ /dev/null @@ -1,143 +0,0 @@ - - - - Enum.OrdIterator - - - - - - - - - - - - -
      -

      - Enum.OrdIterator - - protocol - -

      - - -
      -

      This protocol is invoked by some functions in Enum which -requires an ordered collection to function correctly. For -instance, Enum.split_with/2, Enum.take_while all rely -on this protocol.

      - -

      An ordered collection does not mean the items are ordered -according to the Elixir ordering but simply that any two -distinct instances of the same collection with exactly -the same items always yield the same order when iterated.

      - -
      - - - Source - - -

      Implementations

      - - - - - - -

      Functions summary

      - - - - - - - - -
      -

      Functions

      -
      -

      - iterator(collection) -

      -

      Must return a tuple under the same conditions as -Enum.Iterator.iterator.

      -
      - Source -
      -

      - to_list(xA, iterator) -

      -

      On each step, the iterator function returned by iterator/1 -returns a tuple with two elements. This function receives -those two elements as a tuple and must return a list back.

      - -

      This is used in order to quicky return a list from any point -during iteration. For example, consider the function Enum.drop. -Enum.drop collection, 3 should drop 3 items and return a list -back. While we could loop over the remaining items to get a list -back, this function is invoked allowing us to get a result -back without a need to loop the remaining items.

      -
      - Source -
      -
      - - - - - -
      - - diff --git a/docs/master/Enum.html b/docs/master/Enum.html index 2ec3c061d..374722e4a 100644 --- a/docs/master/Enum.html +++ b/docs/master/Enum.html @@ -42,7 +42,7 @@

      - Source + Source @@ -173,7 +173,7 @@

      Functions summary

    1460. - split_with/2 + split_while/2
    1461. @@ -233,7 +233,7 @@

      Examples

      Enum.all? [1,nil,3] #=> false
    1462. - Source + Source

      any?(collection, fun // fn x -> @@ -259,7 +259,7 @@

      Examples

      Enum.any? [false,true,false] #=> true
      - Source + Source

      at!(collection, n) @@ -277,7 +277,7 @@

      Examples

      Enum.at! [2,4,6], 4 #=> raises Enum.OutOfBoundsError
      - Source + Source

      count(collection) @@ -289,14 +289,14 @@

      Examples

      Enum.count [1,2,3] #=> 3
       
      - Source + Source

      count(collection, fun)

      Counts for how many items the function returns true.

      - Source + Source

      drop(collection, count) @@ -311,7 +311,7 @@

      Examples

      Enum.drop [1,2,3], 0 #=> [1,2,3]
      - Source + Source

      drop_while(collection, fun) @@ -325,7 +325,7 @@

      Examples

      #=> [3,4,5]
      - Source + Source

      each(collection, fun) @@ -338,7 +338,7 @@

      Examples

      Enum.each ['some', 'example'], fn(x) -> IO.puts x end
       
      - Source + Source

      empty?(collection) @@ -351,7 +351,7 @@

      Examples

      Enum.empty? [1,2,3] #=> false
      - Source + Source

      filter(collection, fun) @@ -365,7 +365,7 @@

      Examples

      #=> [2]
      - Source + Source

      filter_map(collection, filter, mapper) @@ -378,7 +378,7 @@

      Examples

      #=> [4]
      - Source + Source

      find(collection, ifnone // nil, fun) @@ -398,7 +398,7 @@

      Examples

      #=> 3
      - Source + Source

      find_index(collection, fun) @@ -417,7 +417,7 @@

      Examples

      #=> 2
      - Source + Source

      find_value(collection, ifnone // nil, fun) @@ -434,7 +434,7 @@

      Examples

      #=> true
      - Source + Source

      first(collection) @@ -447,7 +447,7 @@

      Examples

      Enum.first [1,2,3] #=> 1
      - Source + Source

      join(collection, joiner // "") @@ -468,7 +468,7 @@

      Examples

      Enum.join([1,2,3], ' = ') #=> '1 = 2 = 3'
      - Source + Source

      map(collection, fun) @@ -486,7 +486,7 @@

      Examples

      #=> [a: -1, b: -2]
      - Source + Source

      map_join(collection, joiner // "", mapper) @@ -507,7 +507,7 @@

      Examples

      Enum.map_join([1,2,3], &1 * 2, ' = ') #=> '2 = 4 = 6'
      - Source + Source

      map_reduce(collection, acc, f) @@ -526,7 +526,7 @@

      Examples

      #=> { [2, 4, 6], 6 }
      - Source + Source

      partition(collection, fun) @@ -541,7 +541,7 @@

      Examples

      #=> { [2], [1,3] }
      - Source + Source

      qsort(collection) @@ -553,13 +553,13 @@

      Examples

      Enum.qsort [3,2,1] #=> [1,2,3]
       
      - Source + Source

      reduce(collection, acc, fun)

      -

      Invokes fun for each element in the collection passing the accumulator -acc and the element as arguments. The return value is stored in acc. +

      Invokes fun for each element in the collection passing that element and the +accumulator acc as arguments. fun's return value is stored in acc. Returns the accumulator.

      Examples

      @@ -568,20 +568,22 @@

      Examples

      #=> 6
      - Source + Source

      reverse(collection)

      Reverses the collection.

      +

      Expects an ordered collection.

      +

      Examples

      Enum.reverse [1, 2, 3]
       #=> [3, 2, 1]
       
      - Source + Source

      split(collection, count) @@ -601,21 +603,21 @@

      Examples

      Enum.split [1,2,3], -5 #=> { [], [1,2,3] }
      - Source + Source
      -

      - split_with(collection, fun) +

      + split_while(collection, fun)

      Splits collection at the first element, for which fun returns true. Expects an ordered collection.

      Examples

      -
      Enum.split_with [1,2,3,4], fn x -> x == 2 end
      +
      Enum.split_while [1,2,3,4], fn x -> x == 2 end
       #=> { [1], [2, 3, 4] }
       
      - Source + Source

      take(collection, count) @@ -630,7 +632,7 @@

      Examples

      Enum.take [1,2,3], 0 #=> []
      - Source + Source

      take_while(collection, fun) @@ -644,7 +646,7 @@

      Examples

      #=> [1, 2]
      - Source + Source

      times(times, function) @@ -660,7 +662,7 @@

      Examples

      3
      - Source + Source

      times(times, acc, function) @@ -675,7 +677,7 @@

      Examples

      #=> 15
      - Source + Source diff --git a/docs/master/GenServer.Behaviour.html b/docs/master/GenServer.Behaviour.html index f7850e180..aae5e9e2b 100644 --- a/docs/master/GenServer.Behaviour.html +++ b/docs/master/GenServer.Behaviour.html @@ -28,11 +28,10 @@

      By using this module, you get default GenServer callbacks -for handle_call, handle_info, handle_cast, terminate -and code_change. init still needs to be implemented by the -developer. Since these functions are defined as overridable, -they can be partially customized and have a general clause -that simply invokes super.

      +for init, handle_call, handle_info, handle_cast, +terminate and code_change. Since these functions are +defined as overridable, they can be customized and fallback +to the default behaviour by calling super.

      This module also tags the behavior as :genserver. For more information on genserver, please refer to the Erlang @@ -48,10 +47,6 @@

      Example

      # Callbacks - def init(state) do - { :ok, state } - end - def handle_call(:peek, _from, [h|_] = state) do { :reply, h, state } end diff --git a/docs/master/HashDict.html b/docs/master/HashDict.html index cdc75b66d..9c02315f7 100644 --- a/docs/master/HashDict.html +++ b/docs/master/HashDict.html @@ -27,7 +27,7 @@

      -

      This module implements a dictionary based on hashing of the keys. +

      This module implements a dictionary type based on hashing of the keys. It is a simple wrapper around Erlang's dict module and exposed via the Dict module.

      diff --git a/docs/master/IEx.UnicodeIO.html b/docs/master/IEx.UnicodeIO.html deleted file mode 100644 index 97a94243c..000000000 --- a/docs/master/IEx.UnicodeIO.html +++ /dev/null @@ -1,106 +0,0 @@ - - - - IEx.UnicodeIO - - - - - - - - - - - - -
      -

      - IEx.UnicodeIO - -

      - - -
      -

      This module implements the API used by IEX to -interact with the console. This API may change -in the future without warnings.

      - -
      - - - Source - - - - - - -

      Functions summary

      - - - - - - - - -
      -

      Functions

      -
      -

      - error(result) -

      -

      Implements the error IO API used by IEx. It prints error -messages.

      -
      - Source -
      -

      - get(config) -

      -

      Implements the get IO API used by IEx. It receives the -code cache, the instructions counter and needs to -return a list with the new characters inserted.

      -
      - Source -
      -

      - put(result) -

      -

      Implements the put IO API used by IEx. It receives the -result and prints it.

      -
      - Source -
      -
      - - - - - -
      - - diff --git a/docs/master/IEx.html b/docs/master/IEx.html index a379707f1..1144a089b 100644 --- a/docs/master/IEx.html +++ b/docs/master/IEx.html @@ -50,6 +50,11 @@

      Functions summary

      • + + after_spawn/0 + +
      • +
      • after_spawn/1 @@ -59,6 +64,16 @@

        Functions summary

        cli/0
      • +
      • + + inspect_opts/0 + +
      • +
      • + + inspect_opts/1 + +
      • preload/0 @@ -91,6 +106,13 @@

        Functions summary

        Functions

        +

        + after_spawn() +

        +

        Returns registered after spawn callbacks.

        +
        + Source +

        after_spawn(fun)

        @@ -105,7 +127,21 @@

        Functions

        Interface to start IEx from CLI.

        - Source + Source +
        +

        + inspect_opts() +

        +

        Returns currently registered inspect options.

        +
        + Source +
        +

        + inspect_opts(opts) +

        +

        Registers options used on inspect.

        +
        + Source

        preload() @@ -122,21 +158,21 @@

        Functions

        Runs IEx checking if tty is available or not. If so, invoke tty, otherwise go with the simple iex.

        - Source + Source

        simple(opts // [])

        Starts IEx simply using the current stdio.

        - Source + Source

        tty(opts // [])

        Starts IEx using a tty server.

        - Source + Source
        diff --git a/docs/master/IO.html b/docs/master/IO.html index 5e9660bc8..c9e793223 100644 --- a/docs/master/IO.html +++ b/docs/master/IO.html @@ -66,7 +66,7 @@

        Functions summary

      • - inspect/2 + inspect/3
      • @@ -132,8 +132,8 @@

        Functions

      Source

      -

      - inspect(device // :stdio, item) +

      + inspect(device // :stdio, item, opts // [])

      Inspects and writes the given argument to the device followed by a new line. Returns the item given.

      diff --git a/docs/master/Kernel.SpecialForms.html b/docs/master/Kernel.SpecialForms.html index 7f67a59bc..0b884af58 100644 --- a/docs/master/Kernel.SpecialForms.html +++ b/docs/master/Kernel.SpecialForms.html @@ -185,7 +185,7 @@

      Examples

      record. In the environment you can access the current filename, line numbers, set up aliases, the current function and others.

      - Source + Source

      __FILE__() @@ -194,7 +194,7 @@

      Examples

      Although the file can be accessed in the ENV, this macro is a convenient shortcut.

      - Source + Source

      __MODULE__() @@ -203,7 +203,7 @@

      Examples

      Although the module can be accessed in the ENV, this macro is a convenient shortcut.

      - Source + Source

      __aliases__(args) @@ -215,7 +215,7 @@

      Examples

      { :__aliases__, 0, [:Foo,:Bar] }
      - Source + Source

      __block__(args) @@ -228,7 +228,7 @@

      Examples

      #=> { :__block__, 0, [1,2,3] }
      - Source + Source

      __scope__(opts, args) @@ -244,7 +244,7 @@

      Examples

      Check quote/1 for more information.

      - Source + Source

      alias(module, opts) @@ -302,7 +302,7 @@

      Lexical scope

      "helloworld"
      - Source + Source

      import(module, opts) @@ -337,7 +337,9 @@

      Examples

      And you can then use only or except to filter the macros being -included.

      +included. By default, Elixir won't import functions or macros that +start with underscore. Underscored functions can be explicitly turned +on by passing underscored: true.

      Lexical scope

      @@ -369,7 +371,7 @@

      Alias/Require shortcut

      also accepts as: as an option so it automatically sets up an alias. Please check alias for more information.

      - Source + Source

      lc(args) @@ -417,7 +419,7 @@

      Alias/Require shortcut

      [{213,45,132},{64,76,32},{76,0,0},{234,32,15}]
      - Source + Source

      quote(opts, list2) @@ -557,7 +559,7 @@

      Stacktrace information

      particular, the macro __FILE__ will always point to GenServer.Behaviour file.

      - Source + Source

      require(module, opts) @@ -617,7 +619,7 @@

      Examples

      #=> { :sum, 0, [1, 13, 3] }
      - Source + Source

      unquote_splicing(expr) @@ -632,7 +634,7 @@

      Examples

      #=> { :sum, 0, [1, 2, 3, 4, 5] }
      - Source + Source

      {}(args) diff --git a/docs/master/Kernel.html b/docs/master/Kernel.html index e92c94e63..41d658ada 100644 --- a/docs/master/Kernel.html +++ b/docs/master/Kernel.html @@ -450,7 +450,7 @@

      Macros summary

    1463. - inspect/1 + inspect/2
    1464. @@ -638,6 +638,11 @@

      Macros summary

      min/2
    1465. +
    1466. + + nil?/1 + +
    1467. node/0 @@ -819,7 +824,7 @@

      Examples

      end
    1468. - Source + Source

      raise(exception, args) @@ -840,7 +845,7 @@

      Examples

      raise ArgumentError, message: "Sample"
       
      - Source + Source @@ -921,7 +926,7 @@

      Examples

      this operator accepts any expression as arguments, not only booleans, however it is not allowed in guards.

      - Source + Source

      *(left, right) @@ -1006,7 +1011,7 @@

      Examples

      3 in 1..3 #=> true
      - Source + Source

      /(left, right) @@ -1042,7 +1047,7 @@

      Examples

      Enum.map(List.flatten([1,[2],3]), &1 * 2)
       
      - Source + Source

      <(left, right) @@ -1104,7 +1109,7 @@

      Examples

      x #=> "bar"
      - Source + Source

      ==(left, right) @@ -1157,7 +1162,7 @@

      Examples

      "abcd" =~ %r/e/ #=> nil
      - Source + Source

      >(left, right) @@ -1233,7 +1238,7 @@

      Examples

      time and not at runtime. Check the module Module for other functions to manipulate module attributes.

      - Source + Source

      __B__(string, list2) @@ -1247,7 +1252,7 @@

      Examples

      %B(f#{o}o) #=> "f\#{o}o"
      - Source + Source

      __C__(arg1, list2) @@ -1261,7 +1266,7 @@

      Examples

      %C(f#{o}o) #=> 'f\#{o}o'
      - Source + Source

      __R__(arg1, options) @@ -1274,7 +1279,7 @@

      Examples

      Regex.match? %R(f#{1,3}o), "f#o"  #=> true
       
      - Source + Source

      __b__(arg1, list2) @@ -1288,7 +1293,7 @@

      Examples

      %b(f#{:o}o) #=> "foo"
      - Source + Source

      __c__(arg1, list2) @@ -1302,7 +1307,7 @@

      Examples

      %c(f#{:o}o) #=> 'foo'
      - Source + Source

      __r__(arg1, options) @@ -1314,7 +1319,7 @@

      Examples

      Regex.match? %r(foo), "foo"  #=> true
       
      - Source + Source

      abs(number) @@ -1403,7 +1408,7 @@

      Examples

      access a, 1 #=> :a
      - Source + Source

      and(left, right) @@ -1456,7 +1461,7 @@

      Examples

      atom_to_binary :my_atom #=> "my_atom"
       
      - Source + Source

      atom_to_binary(atom, encoding) @@ -1521,7 +1526,7 @@

      Examples

      binary_to_atom "my_atom" #=> :my_atom
       
      - Source + Source

      binary_to_atom(binary, encoding) @@ -1550,7 +1555,7 @@

      Examples

      binary_to_existing_atom "my_atom" #=> :my_atom
      - Source + Source

      binary_to_existing_atom(binary, encoding) @@ -1704,7 +1709,7 @@

      Examples

      end
      - Source + Source

      cond(list1) @@ -1724,7 +1729,7 @@

      Examples

      end
      - Source + Source

      def(name, list2) @@ -1884,7 +1889,7 @@

      Examples

      #=> [3,2,1]
      - Source + Source

      defexception(name, values, opts // [], do_block // []) @@ -2225,7 +2230,7 @@

      Examples

      the first value from the right side. Otherwise, it will raise a CaseClauseError.

      - Source + Source

      div(left, right) @@ -2239,7 +2244,7 @@

      Examples

      div 5, 2 #=> 2
       
      - Source + Source

      elem(tuple, index) @@ -2254,7 +2259,7 @@

      Example

      tuple = { :foo, :bar, 3 } elem(tuple, 1) #=> :bar

      - Source + Source

      exit(reason) @@ -2371,7 +2376,7 @@

      Function retrieval

      f.([1,[2],3]) #=> [1,2,3]
      - Source + Source

      function_exported?(module, function, arity) @@ -2383,7 +2388,7 @@

      Function retrieval

      it is not loaded. Check Code.ensure_loaded/1 for more information.

      - Source + Source

      halt() @@ -2479,7 +2484,7 @@

      Blocks examples

      If you want to compare more than two clauses, you can use the cond/1 macro.

      - Source + Source

      in(left, right) @@ -2521,12 +2526,23 @@

      Clauses

      In this case, Elixir will automatically expand it and define the variable for us.

      - Source + Source
      -

      - inspect(arg) +

      + inspect(arg, opts // [])

      -

      Inspect the given arguments according to the String.Inspect protocol.

      +

      Inspect the given arguments according to the Binary.Inspect protocol.

      + +

      Options

      + +

      The following options are supported:

      + +
        +
      • :raw - tuples are not formatted as the inspect protocol, they are +always shown as tuples, defaults to false;

      • +
      • :limit - the limit of items that are shown in tuples, bitstrings and +lists. Do not apply to strings;

      • +

      Examples

      @@ -2534,7 +2550,7 @@

      Examples

      #=> ":foo"
      - Source + Source

      integer_to_list(number) @@ -2948,7 +2964,7 @@

      Examples

      Enum.filter list, match?({:a, x } when x < 2, &1)
      - Source + Source

      max(first, second) @@ -2977,6 +2993,20 @@

      Examples

      Source +
      +

      + nil?(x) +

      +

      Checks if the given argument is nil or not. +Allowed in guard clauses.

      + +

      Examples

      + +
      nil? 1    #=> false
      +nil? nil  #=> true
      +
      +
      + Source

      node() @@ -3089,7 +3119,7 @@

      Examples

      will occur immediately.

      - Source + Source

      rem(left, right) @@ -3103,7 +3133,7 @@

      Examples

      rem 5, 2 #=> 1
       
      - Source + Source

      round(number) @@ -3139,7 +3169,7 @@

      Example

      tuple = { :foo, :bar, 3 } setelem(tuple, 0, :baz) #=> { :baz, :bar, 3 }

      - Source + Source

      size(arg) @@ -3274,7 +3304,7 @@

      Examples

      #=> "foo"
      - Source + Source

      to_char_list(arg) @@ -3287,7 +3317,7 @@

      Examples

      #=> 'foo'
      - Source + Source

      trunc(number) @@ -3408,7 +3438,7 @@

      Catching exits and Erlang errors

      Although the second form should be avoided in favor of raise/rescue control mechanisms.

      - Source + Source

      tuple_size(tuple) @@ -3431,7 +3461,7 @@

      Catching exits and Erlang errors

      unless a value evalutes to true. Check if for examples and documentation.

      - Source + Source

      use(module, args // []) @@ -3508,7 +3538,7 @@

      Examples

      this operator accepts any expression as arguments, not only booleans, however it is not allowed in guards.

      - Source + Source diff --git a/docs/master/Keyword.html b/docs/master/Keyword.html index d653c4c61..0f64d5beb 100644 --- a/docs/master/Keyword.html +++ b/docs/master/Keyword.html @@ -40,9 +40,6 @@

      Keyword.put and Keyword.delete ensure all duplicated entries for a given key are removed when invoked.

      -

      This module uses == as operator to check if two keys -are equal or not.

      - @@ -161,7 +158,7 @@

      Examples

      Keyword.delete [b: 2], :a #=> [b: 2] - Source + Source

      from_enum(enum) @@ -170,7 +167,7 @@

      Examples

      that behaves as a dict, Keyword.from_enum do not remove duplicated entries.

      - Source + Source

      get(keywords, key, default // nil) @@ -190,7 +187,7 @@

      Examples

      Keyword.get [a: 1], :b, 3 #=> 3
      - Source + Source

      get!(list1, key) @@ -204,7 +201,7 @@

      Examples

      Keyword.get! [a: 1], :b #=> raises KeyError[key: :b]
      - Source + Source

      get_values(list1, key) @@ -217,7 +214,7 @@

      Examples

      #=> [1,2]
      - Source + Source

      key?(list1, key) @@ -232,7 +229,7 @@

      Examples

      #=> false
      - Source + Source

      keys(keywords) @@ -245,7 +242,7 @@

      Examples

      Keyword.keys [a: 1, b: 2] #=> [:a,:b]
       
      - Source + Source

      merge(d1, d2) @@ -259,7 +256,7 @@

      Examples

      #=> [a:3, b:2, d: 4]
      - Source + Source

      merge(d1, d2, fun) @@ -275,14 +272,14 @@

      Examples

      #=> [a:4, b:2, d: 4]
      - Source + Source

      new()

      Returns an empty keyword list, i.e. an empty list.

      - Source + Source

      new(pairs) @@ -296,7 +293,7 @@

      Examples

      #=> [a: 2, b: 1]
      - Source + Source

      new(pairs, transform) @@ -311,7 +308,7 @@

      Examples

      #=> [a: :a, b: :b]
      - Source + Source

      put(list1, key, value) @@ -330,7 +327,7 @@

      Examples

      #=> [a: 3, b: 2]
      - Source + Source

      update(list1, key, fun) @@ -346,7 +343,7 @@

      Examples

      #=> Keyword.KeyError
      - Source + Source

      update(list1, key, initial, fun) @@ -362,7 +359,7 @@

      Examples

      #=> [a: 1, b: 11]
      - Source + Source

      values(keywords) @@ -374,7 +371,7 @@

      Examples

      Keyword.values [a: 1, b: 2] #=> [1,2]
       
      - Source + Source diff --git a/docs/master/Mix.Dep.html b/docs/master/Mix.Dep.html index 6a5ed974f..0a5f52536 100644 --- a/docs/master/Mix.Dep.html +++ b/docs/master/Mix.Dep.html @@ -38,6 +38,7 @@

    1469. requirements - a binary or regexp with the deps requirement;
    1470. status - the current status of dependency, check Mix.Deps.format_status/1 for more info;
    1471. opts - the options given by the developer
    1472. +
    1473. project - the Mix.Project for the dependency
    1474. @@ -63,6 +64,12 @@

      Fields (and defaults)

      +
    1475. + + project: nil + +
    1476. +
    1477. requirement: nil @@ -117,6 +124,16 @@

      Functions summary

      opts/2
    1478. +
    1479. + + project/1 + +
    1480. +
    1481. + + project/2 + +
    1482. requirement/1 @@ -162,6 +179,11 @@

      Functions summary

      update_opts/2
    1483. +
    1484. + + update_project/2 + +
    1485. update_requirement/2 @@ -224,6 +246,18 @@

      Functions

      Source +
      +

      + project(record) +

      +
      + Source +
      +

      + project(value, record) +

      +
      + Source

      requirement(record) @@ -278,6 +312,12 @@

      Functions

      Source +
      +

      + update_project(function, record) +

      +
      + Source

      update_requirement(function, record) diff --git a/docs/master/Mix.Deps.Lock.html b/docs/master/Mix.Deps.Lock.html index a974d315f..c7b0b2874 100644 --- a/docs/master/Mix.Deps.Lock.html +++ b/docs/master/Mix.Deps.Lock.html @@ -43,12 +43,12 @@

      Functions summary

      • - read/1 + lockfile/0
      • - update_lock/3 + read/1
      • @@ -68,33 +68,27 @@

        Functions summary

        Functions

        -

        - read(file // access(Mix.project(), :lockfile)) +

        + lockfile()

        -

        Read the file, returns a keyword list containing -the app name and its current lock information.

        +

        Returns the lockfile path.

        - Source + Source
        -

        - update_lock(file // access(Mix.project(), :lockfile), deps, callback) +

        + read(file // lockfile)

        -

        Loop the given dependencies triggering the callback. -The callback receives the dependency and its current lock -(may be nil). The callback must return a lock or nil in -case a lock could not be retrieved.

        - -

        This function returns a list with the app names in the -given dependencies that got a lock.

        +

        Read the file, returns a keyword list containing +the app name and its current lock information.

        - Source + Source

        - write(file // access(Mix.project(), :lockfile), dict) + write(file // lockfile, dict)

        Receives a keyword list and writes it to the disk.

        - Source + Source
        diff --git a/docs/master/Mix.Deps.html b/docs/master/Mix.Deps.html index cba950982..1b8c23951 100644 --- a/docs/master/Mix.Deps.html +++ b/docs/master/Mix.Deps.html @@ -32,7 +32,7 @@

        - Source + Source @@ -48,22 +48,22 @@

        Functions summary

      • - all/1 + all/2
      • - by_name/1 + available?/1
      • - check_lock/2 + by_name!/1
      • - deps_path/0 + check_lock/2
      • @@ -81,6 +81,11 @@

        Functions summary

        format_status/1
      • +
      • + + ok?/1 + +
      • out_of_date?/1 @@ -88,7 +93,7 @@

        Functions summary

      • - update_status/1 + update/1
      • @@ -106,86 +111,88 @@

        Functions

        all()

        -

        Returns all dependencies in as Mix.Dep record.

        +

        Returns all dependencies recursively as Mix.Dep record.

        Exceptions

        This function raises an exception in case the developer provides a dependency in the wrong format.

        - -

        Statuses

        - -

        The status element in the tuple returns the current -situation of the repository. Check format_status/1 -for more information.

        - Source + Source
        -

        - all(status) +

        + all(acc, callback)

        -

        Get all dependencies that match the specific status.

        +

        Returns all dependencies but with a custom callback and +accumulator.

        - Source + Source
        -

        - by_name(given) +

        + available?(arg1) +

        +

        Check if a dependency is available.

        +
        + Source +
        +

        + by_name!(given)

        Receives a list of deps names and returns deps records. Raises an error if the dependency does not exist.

        - Source + Source

        check_lock(dep, lock)

        Checks the lock for the given dependency and update its status accordingly.

        - Source -
        -

        - deps_path() -

        -

        The default path for dependencies.

        -
        - Source + Source

        deps_path(arg1)

        Returns the path for the given dependency.

        - Source + Source

        format_dep(arg1)

        Format the dependency for printing.

        - Source + Source

        format_status(arg1)

        Formats the status of a dependency.

        - Source + Source +
        +

        + ok?(arg1) +

        +

        Check if a dependency is ok.

        +
        + Source

        - out_of_date?(arg1) + out_of_date?(dep)

        Check if a dependency is out of date or not, considering its lock status. Therefore, be sure to call check_lock before invoking this function.

        - Source + Source
        -

        - update_status(arg1) +

        + update(dep)

        -

        Receives a dependency and update its status

        +

        Updates the dependency inside the given project.

        - Source + Source
        diff --git a/docs/master/Mix.Error.html b/docs/master/Mix.Error.html index 1675dfc36..2083acd18 100644 --- a/docs/master/Mix.Error.html +++ b/docs/master/Mix.Error.html @@ -29,7 +29,7 @@

        - Source + Source @@ -105,49 +105,49 @@

        Functions

        exception(args)

        - Source + Source

        exception(args, self)

        - Source + Source

        message(record)

        - Source + Source

        message(value, record)

        - Source + Source

        new()

        - Source + Source

        new(opts)

        - Source + Source

        to_keywords(record)

        - Source + Source

        update_message(function, record)

        - Source + Source
      diff --git a/docs/master/Mix.OutOfDateDepsError.html b/docs/master/Mix.OutOfDateDepsError.html index ec9c7c2f6..db9d66947 100644 --- a/docs/master/Mix.OutOfDateDepsError.html +++ b/docs/master/Mix.OutOfDateDepsError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -105,49 +105,49 @@

      Functions

      exception(args)

      - Source + Source

      exception(args, self)

      - Source + Source

      message(record)

      - Source + Source

      message(value, record)

      - Source + Source

      new()

      - Source + Source

      new(opts)

      - Source + Source

      to_keywords(record)

      - Source + Source

      update_message(function, record)

      - Source + Source
      diff --git a/docs/master/Mix.Project.html b/docs/master/Mix.Project.html index ed69b1981..396d92802 100644 --- a/docs/master/Mix.Project.html +++ b/docs/master/Mix.Project.html @@ -56,7 +56,7 @@

      Examples

      even without a project.

      In case the developer needs a project or want to access a special -function in the project, he can access Mix.Project.current/0 +function in the project, he can access Mix.Project.get!/0 which fails with Mix.NoProjectError in case a project is not defined.

      @@ -79,12 +79,17 @@

      Functions summary

    1486. - current/0 + get/0
    1487. - defined?/0 + get!/0 + +
    1488. +
    1489. + + refresh/0
    1490. @@ -105,10 +110,10 @@

      Functions

      Returns the project configuration already considering the current environment.

      - Source + Source
      -

      - current() +

      + get()

      Retrieves the current project.

      @@ -118,17 +123,24 @@

      Functions

      function raises Mix.NoProjectError in case no project is available.

      -

      Use defined?/0 if you need to check if a project is -defined or not without raising an exception.

      +

      Returns nil if no project./

      +
      + Source +
      +

      + get!() +

      +

      Same as get/0 but raises an exception if no project.

      - Source + Source
      -

      - defined?() +

      + refresh()

      -

      Returns true if a current project is defined.

      +

      Refresh the project configuration. Usually required +when the environment changes during a task.

      - Source + Source
      diff --git a/docs/master/Mix.SCM.html b/docs/master/Mix.SCM.html index 97e57026e..1f0ba27bc 100644 --- a/docs/master/Mix.SCM.html +++ b/docs/master/Mix.SCM.html @@ -78,6 +78,11 @@

      Callbacks summary

      check?/2 +
    1491. + + checkout/2 + +
    1492. clean/2 @@ -90,12 +95,12 @@

      Callbacks summary

    1493. - get/2 + key/0
    1494. - key/0 + match?/2
    1495. @@ -116,21 +121,21 @@

      Functions

      Returns all available SCM.

      - Source + Source

      register(mod)

      Register the scm repository with the given key and mod.

      - Source + Source

      register_builtin()

      Register builtin SCMs.

      - Source + Source
      @@ -157,14 +162,26 @@

      Callbacks

      SCMs do not require a lock, for such, this function can simply return true.

      - Source + Source +
      +

      + checkout(path, opts) +

      +

      This behavior function checks out dependencies.

      + +

      If the dependency is locked, a lock is received in opts +and the repository must be check out at the lock. Otherwise, +no lock is given and the repository can be checked out +to the latest version.

      +
      + Source

      clean(path, opts)

      This behavior function should clean the given dependency.

      - Source + Source

      consumes?(opts) @@ -183,18 +200,6 @@

      Callbacks

      while other SCMs would simply return nil.

      Source -
      -

      - get(path, opts) -

      -

      This behavior function gets unchecked dependencies. -If the dependency is locked, it receives the lock under the -:lock key in opts. In case no lock is given, it must -return a new lock (if one exists). If a lock is given, -it must preferably return the same lock, but can return -a different one in case of failure.

      -
      - Source

      key() @@ -205,16 +210,28 @@

      Callbacks

      the requested dependency.

      Source +
      +

      + match?(opts1, opts2) +

      +

      Receives two options and must return true if the refer to the +same repository.

      +
      + Source

      update(path, opts)

      This behavior function updates dependencies. It may be -called either directly via deps.update or implicitly -by deps.get. In the first scenario, no lock is received, -while one is given in the second.

      +called by deps.get or deps.update.

      + +

      In the first scenario, a lock is received in opts and +the repository must be updated to the lock. In the second, +no lock is given and the repository can be updated freely.

      + +

      It must return the current lock.

      - Source + Source
      diff --git a/docs/master/Mix.Tasks.Deps.Loadpaths.html b/docs/master/Mix.Tasks.Deps.Loadpaths.html index 86502c3a8..7977a449c 100644 --- a/docs/master/Mix.Tasks.Deps.Loadpaths.html +++ b/docs/master/Mix.Tasks.Deps.Loadpaths.html @@ -60,7 +60,7 @@

      Functions summary

      Functions

      - run(_args) + run(args)

      Source diff --git a/docs/master/Module.html b/docs/master/Module.html index 4aa57a5a2..6c30c14b9 100644 --- a/docs/master/Module.html +++ b/docs/master/Module.html @@ -49,11 +49,6 @@

      Functions summary

      • - - add_attribute/3 - -
      • -
      • add_doc/6 @@ -98,6 +93,11 @@

        Functions summary

        eval_quoted/4
      • +
      • + + get_attribute/2 + +
      • make_overridable/2 @@ -115,7 +115,7 @@

        Functions summary

      • - read_attribute/2 + put_attribute/3
      • @@ -150,22 +150,6 @@

        Functions summary

        Functions

        -

        - add_attribute(module, key, value) -

        -

        Adds an Erlang attribute to the given module with the given -key and value. The semantics of adding the attribute depends -if the attribute was registered or not via register_attribute/2.

        - -

        Examples

        - -
        defmodule MyModule do
        -  Module.add_attribute __MODULE__, :custom_threshold_for_lib, 10
        -end
        -
        -
        - Source -

        add_doc(module, line, kind, tuple, signature, doc)

        @@ -290,12 +274,12 @@

        Examples

        Examples

        defmodule MyModule do
        -  Module.add_attribute __MODULE__, :custom_threshold_for_lib, 10
        +  Module.put_attribute __MODULE__, :custom_threshold_for_lib, 10
           Module.delete_attribute __MODULE__, :custom_threshold_for_lib
         end
         
        - Source + Source

        eval_quoted(env, quoted, binding // [], opts // []) @@ -336,6 +320,27 @@

        Examples

        Source +
      +

      + get_attribute(module, key) +

      +

      Gets the given attribute from a module. If the attribute +was marked as accumulate with Module.register_attribute, +a list is always returned.

      + +

      Examples

      + +
      defmodule Foo do
      +  Module.put_attribute __MODULE__, :value, 1
      +  Module.get_attribute __MODULE__, :value #=> 1
      +
      +  Module.register_attribute __MODULE__, :value, accumulate: true
      +  Module.put_attribute __MODULE__, :value, 1
      +  Module.get_attribute __MODULE__, :value #=> [1]
      +end
      +
      +
      + Source

      make_overridable(module, tuples) @@ -361,26 +366,21 @@

      Examples

      Source
      -

      - read_attribute(module, key) +

      + put_attribute(module, key, value)

      -

      Reads the given attribute from a module. If the attribute -was marked as accumulate with Module.register_attribute, -a list is always returned.

      +

      Puts an Erlang attribute to the given module with the given +key and value. The semantics of putting the attribute depends +if the attribute was registered or not via register_attribute/2.

      Examples

      -
      defmodule Foo do
      -  Module.add_attribute __MODULE__, :value, 1
      -  Module.read_attribute __MODULE__, :value #=> 1
      -
      -  Module.register_attribute __MODULE__, :value, accumulate: true
      -  Module.add_attribute __MODULE__, :value, 1
      -  Module.read_attribute __MODULE__, :value #=> [1]
      +
      defmodule MyModule do
      +  Module.put_attribute __MODULE__, :custom_threshold_for_lib, 10
       end
       
      - Source + Source

      register_attribute(module, new, opts // []) @@ -417,7 +417,7 @@

      Examples

      end
      - Source + Source

      safe_concat(list) @@ -468,7 +468,7 @@

      Examples

      #=> ["Very", "Long", "Module", "Name", "And", "Even", "Longer"]
      - Source + Source diff --git a/docs/master/Orddict.html b/docs/master/Orddict.html index ef8f15efd..13d1c88dc 100644 --- a/docs/master/Orddict.html +++ b/docs/master/Orddict.html @@ -27,7 +27,7 @@

      -

      This module implements a dictionary based that stores items +

      This module implements a dictionary type that stores items as a list of tuples. It is a simple wrapper around Erlang's orddict module and exposed via the Dict module.

      diff --git a/docs/master/Process.html b/docs/master/Process.html index 6cff42845..c9d620e54 100644 --- a/docs/master/Process.html +++ b/docs/master/Process.html @@ -391,7 +391,7 @@

      Examples

      Source

      - register(name, pid) + register(pid, name)

      Associates the name with a pid or a port identifier. name, which must be an atom, can be used instead of the pid / port identifier in the diff --git a/docs/master/Range.Iterator.Number.html b/docs/master/Range.Iterator.Number.html index 0daf2d6a5..0c1fe9718 100644 --- a/docs/master/Range.Iterator.Number.html +++ b/docs/master/Range.Iterator.Number.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/master/Record.html b/docs/master/Record.html index 66f359b3f..791714924 100644 --- a/docs/master/Record.html +++ b/docs/master/Record.html @@ -93,7 +93,7 @@

      Examples

      defmacros(env, name, values)

      -

      Defines two macros for reading and writing records values. +

      Defines three macros for reading and writing records values. These macros are private to the current module and are basically a simple mechanism for manipulating tuples when there isn't an interest in exposing the record as a whole. @@ -112,10 +112,27 @@

      Examples

      def name(user, name) do _user(user, name: name) end + + def age(user) do + _user(user, :age) + end + + def to_keywords(user) do + _user(user) + end + + def name_and_age(user) do + _user(user, [:name, :age]) + end + + def age_and_name(user) do + _user(user, [:age, :name]) + end + end
      - Source + Source

      defrecord(name, values, opts) diff --git a/docs/master/String.html b/docs/master/String.html index e9680877f..864203e83 100644 --- a/docs/master/String.html +++ b/docs/master/String.html @@ -47,6 +47,16 @@

      Functions summary

      • + + at/2 + +
      • +
      • + + codepoints/1 + +
      • +
      • downcase/1 @@ -56,6 +66,21 @@

        Functions summary

        duplicate/2
      • +
      • + + first/1 + +
      • +
      • + + last/1 + +
      • +
      • + + length/1 + +
      • lstrip/2 @@ -103,6 +128,37 @@

        Functions summary

        Functions

        +

        + at(string, position) +

        +

        Returns the codepoint in the position of the given utf8 string. +If position is greater than string length, than it returns nil.

        + +

        Examples

        + +
        String.at("elixir", 0) #=> "1"
        +String.at("elixir", 1) #=> "l"
        +String.at("elixir", 10) #=> nil
        +String.at("elixir", -1) #=> "r"
        +String.at("elixir", -10) #=> "nil"
        +
        +
        + Source +
        +

        + codepoints(string) +

        +

        Returns a list with codepoints from an utf8 string.

        + +

        Examples

        + +
        String.codepoints("josé")         #=> ["j", "o", "s", "é"]
        +String.codepoints("оптими зации") #=> ["о","п","т","и","м","и"," ","з","а","ц","и","и"]
        +String.codepoints("ἅἪῼ")          #=> ["ἅ","Ἢ","ῼ"]
        +
        +
        + Source +

        downcase(arg1)

        @@ -124,11 +180,50 @@

        Examples

        Examples

        -
        Binary.duplicate("abc", 1) #=> "abc"
        -Binary.duplicate("abc", 2) #=> "abcabc"
        +
        String.duplicate("abc", 1) #=> "abc"
        +String.duplicate("abc", 2) #=> "abcabc"
         
        Source +
        +

        + first(string) +

        +

        Returns the first codepoint from an utf8 string.

        + +

        Examples

        + +
        String.first("elixir")  #=> "e"
        +String.first("եոգլի") #=> "ե"
        +
        +
        + Source +
        +

        + last(string) +

        +

        Returns the last codepoint from an utf8 string.

        + +

        Examples

        + +
        String.last("elixir")  #=> "r"
        +String.last("եոգլի") #=> "ի"
        +
        +
        + Source +
        +

        + length(string) +

        +

        Returns the number of codepoint in an utf8 string.

        + +

        Examples

        + +
        String.length("elixir")  #=> 6
        +String.length("եոգլի") #=> 5
        +
        +
        + Source

        lstrip(string, char // 32) @@ -171,11 +266,11 @@

        Examples

        Examples

        -
        Binary.replace("a,b,c", ",", "-") #=> "a-b,c"
        -Binary.replace("a,b,c", ",", "-", global: true) #=> "a-b-c"
        -Binary.replace("a,b,c", "b", "[]", insert_replaced: 1) #=> "a,[b],c"
        -Binary.replace("a,b,c", ",", "[]", global: true, insert_replaced: 2) #=> "a[],b[],c"
        -Binary.replace("a,b,c", ",", "[]", global: true, insert_replaced: [1,1]) #=> "a[,,]b[,,]c"
        +
        String.replace("a,b,c", ",", "-") #=> "a-b,c"
        +String.replace("a,b,c", ",", "-", global: true) #=> "a-b-c"
        +String.replace("a,b,c", "b", "[]", insert_replaced: 1) #=> "a,[b],c"
        +String.replace("a,b,c", ",", "[]", global: true, insert_replaced: 2) #=> "a[],b[],c"
        +String.replace("a,b,c", ",", "[]", global: true, insert_replaced: [1,1]) #=> "a[,,]b[,,]c"
         
        Source diff --git a/docs/master/modules_list.html b/docs/master/modules_list.html index 508b2b27e..62a088a69 100644 --- a/docs/master/modules_list.html +++ b/docs/master/modules_list.html @@ -820,7 +820,7 @@

      • - split_with/2 + split_while/2 Enum
      • @@ -1707,50 +1707,39 @@

      -
    1496. - - - UnicodeIO - - IEx.UnicodeIO -
    1497. - - -
    1498. - after_spawn/1 + inspect_opts/0 IEx
    1499. - cli/0 + inspect_opts/1 IEx
    1500. @@ -1810,7 +1799,7 @@

    1501. - inspect/2 + inspect/3 IO
    1502. @@ -2607,7 +2596,7 @@

    1503. - inspect/1 + inspect/2 Kernel
    1504. @@ -2871,6 +2860,13 @@

      Kernel

    1505. +
    1506. + + nil?/1 + + Kernel +
    1507. +
    1508. node/0 @@ -3492,28 +3488,28 @@

    1509. - all/1 + all/2 Mix.Deps
    1510. - by_name/1 + available?/1 Mix.Deps
    1511. - check_lock/2 + by_name!/1 Mix.Deps
    1512. - deps_path/0 + check_lock/2 Mix.Deps
    1513. @@ -3539,6 +3535,13 @@

      Mix.Deps

    1514. +
    1515. + + ok?/1 + + Mix.Deps +
    1516. +
    1517. out_of_date?/1 @@ -3548,7 +3551,7 @@

    1518. - update_status/1 + update/1 Mix.Deps
    1519. @@ -3566,14 +3569,14 @@

    1520. - read/1 + lockfile/0 Mix.Deps.Lock
    1521. - update_lock/3 + read/1 Mix.Deps.Lock
    1522. @@ -3683,14 +3686,21 @@

    1523. - current/0 + get/0 Mix.Project
    1524. - defined?/0 + get!/0 + + Mix.Project +
    1525. + +
    1526. + + refresh/0 Mix.Project
    1527. @@ -3727,6 +3737,13 @@

      Mix.SCM

    1528. +
    1529. + + checkout/2 + + Mix.SCM +
    1530. +
    1531. clean/2 @@ -3743,14 +3760,14 @@

    1532. - get/2 + key/0 Mix.SCM
    1533. - key/0 + match?/2 Mix.SCM
    1534. @@ -4507,13 +4524,6 @@

      - Source + Source

      write!(path, content, modes // [])

      Same as write/3 but raises an exception if it fails, returns :ok otherwise.

      - Source + Source

      write_stat(path, stat, opts // []) diff --git a/docs/master/FunctionClauseError.html b/docs/master/FunctionClauseError.html index 2a263ceb7..558807f47 100644 --- a/docs/master/FunctionClauseError.html +++ b/docs/master/FunctionClauseError.html @@ -39,7 +39,7 @@

      Fields (and defaults)

    1535. - arity: nil + module: nil
    1536. @@ -51,7 +51,7 @@

      Fields (and defaults)

    1537. - module: nil + arity: nil
    1538. @@ -121,6 +121,11 @@

      Functions summary

      to_keywords/1

    1539. +
    1540. + + update/2 + +
    1541. update_arity/2 @@ -219,6 +224,12 @@

      Functions

      Source +
      +

      + update(keywords, record) +

      +
      + Source

      update_arity(function, record) diff --git a/docs/master/HashDict.html b/docs/master/HashDict.html index 9c02315f7..9a4ba49da 100644 --- a/docs/master/HashDict.html +++ b/docs/master/HashDict.html @@ -27,8 +27,9 @@

      -

      This module implements a dictionary type based on hashing of the keys. -It is a simple wrapper around Erlang's dict module +

      This module implements a dictionary type based on +hashing of the keys. It is a simple wrapper around +Erlang's dict module and exposed via the Dict module.

      Check the Dict module for examples and documentation.

      @@ -46,36 +47,6 @@

      Functions summary

      @@ -132,48 +73,12 @@

      Functions summary

      Functions

      -

      - delete(arg1, key) -

      -
      - Source -
      -

      - empty(_) -

      -
      - Source -
      -

      - get(arg1, key, default) -

      -
      - Source -
      -

      - has_key?(arg1, key) -

      -
      - Source -
      -

      - keys(arg1) -

      -
      - Source -
      -

      - merge(d1, d2, fun) -

      -
      - Source -

      new()

      Creates a new empty dict.

      - Source + Source

      new(pairs) @@ -186,7 +91,7 @@

      Examples

      #=> [a: 1, b: 2]
      - Source + Source

      new(list, transform) @@ -200,43 +105,7 @@

      Examples

      #=> ["a": "a", "b": "b"]
      - Source -
      -

      - put(arg1, key, value) -

      -
      - Source -
      -

      - size(arg1) -

      -
      - Source -
      -

      - to_list(arg1) -

      -
      - Source -
      -

      - update(arg1, key, fun) -

      -
      - Source -
      -

      - update(arg1, key, initial, fun) -

      -
      - Source -
      -

      - values(arg1) -

      -
      - Source + Source

      diff --git a/docs/master/IEx.Helpers.html b/docs/master/IEx.Helpers.html index e6f8e78f0..a93df9bef 100644 --- a/docs/master/IEx.Helpers.html +++ b/docs/master/IEx.Helpers.html @@ -30,18 +30,26 @@

      A bunch of helpers available in IEx.

        -
      • c - compiles a file in the given path
      • -
      • d - prints documentation
      • -
      • h - prints history
      • -
      • m - prints loaded modules
      • -
      • r - recompiles and reloads the given module's source file
      • -
      • v - retrieves nth value from console
      • +
      • c/2 - compiles a file in the given path
      • +
      • h/0,h/1, h/2 - prints help/documentation
      • +
      • m/0 - prints loaded modules
      • +
      • r/0 - recompiles and reloads the given module's source file
      • +
      • v/0 - prints all commands and values
      • +
      • v/1 - retrieves nth value from console
      -

      Documentation for functions in this module can be consulted +

      Help for functions in this module can be consulted directly from the command line, as an example, try:

      -

      d(:c, 1)

      +
      h(c/2)
      +
      + +

      You can also retrieve the documentation for any module +or function. Try these:

      + +
      h(Enum)
      +h(Enum.reverse/1)
      +
      @@ -62,37 +70,37 @@

      Functions summary

    1542. - d/0 + h/0
    1543. - d/2 + h/2
    1544. - d/3 + h/3
    1545. - h/0 + m/0
    1546. - m/0 + r/0
    1547. - r/0 + r/1
    1548. - r/1 + v/0
    1549. @@ -109,7 +117,7 @@

      Macros summary

      • - d/1 + h/1
      • @@ -135,52 +143,45 @@

        Examples

        #=> Foo - Source + Source
        -

        - d() +

        + h()

        Shows the documentation for IEx.Helpers.

        - Source + Source
        -

        - d(function, arity) +

        + h(function, arity)

        Prints the documentation for the given function and arity.

        The function may either be a function defined inside IEx.Helpers or in Kernel. To see functions from other module, use -d/3 instead.

        +h/3 instead.

        Examples

        -
        d(:d, 2)
        +
        h(:h, 2)
         #=> Prints documentation for this function
         
        - Source + Source
        -

        - d(module, function, arity) +

        + h(module, function, arity)

        Shows the documentation for the function/arity in module.

        - Source -
        -

        - h() -

        -

        Prints commands history and their result.

        -
        - Source + Source

        m()

        Returns the name and module of all modules loaded.

        - Source + Source

        r() @@ -188,7 +189,7 @@

        Examples

        Reloads all modules that were already reloaded at some point with r/1.

        - Source + Source

        r(module) @@ -198,7 +199,14 @@

        Examples

        Please note that all the modules defined in the specified files are recompiled and reloaded.

        - Source + Source +
        +

        + v() +

        +

        Prints commands history and their result.

        +
        + Source

        v(n) @@ -207,7 +215,7 @@

        Examples

        values to lookup query's value from latest to earliest. For instance, v(-1) returns the latest result.

        - Source + Source @@ -216,26 +224,26 @@

        Examples

        Macros

        -

        - d(other) +

        + h(other)

        Shows the documentation for the given module or for the given function/arity pair.

        Examples

        -
        d(Enum)
        +
        h(Enum)
         #=> Prints documentation for Enum
         

        It also accepts functions in the format fun/arity and module.fun/arity, for example:

        -
        d receive/1
        -d Enum.all?/2
        +
        h receive/1
        +h Enum.all?/2
         
        - Source + Source
        diff --git a/docs/master/IO.html b/docs/master/IO.html index c9e793223..1e0f6873b 100644 --- a/docs/master/IO.html +++ b/docs/master/IO.html @@ -27,19 +27,24 @@

        -

        Module responsible for doing IO. The function in this -module expects an iodata as argument encoded in UTF-8. -An iodata can be:

        +

        Module responsible for doing IO. Many functions in this +module expects an IO device and an io data encoded in UTF-8.

        + +

        An IO device must be a pid is an atom representing a process. +For convenience, Elixir provides :stdio and :stderr as +shortcut to Erlang's :standard_io and :standard_error.

        + +

        An io data can be:

          -
        • A list of integers representing a string. Any unicode +
        • A list of integers representing a string. Any unicode character must be represented with one entry in the list, -this entry being an integer with the codepoint value;

        • -
        • A binary in which unicode characters are represented -with many bytes (Elixir's default representation);
        • -
        • A list of binaries or a list of char lists (as described above);
        • -
        • If none of the above, to_binary is invoked in the -given argument;
        • +this entry being an integer with the codepoint value;

          +
        • A binary in which unicode characters are represented +with many bytes (Elixir's default representation);

        • +
        • A list of binaries or a list of char lists (as described above);

        • +
        • If none of the above, to_binary is invoked in the +given argument;

        @@ -114,7 +119,7 @@

        Functions

        NFS file system.

      - Source + Source

      gets(device // :stdio, prompt) @@ -130,7 +135,7 @@

      Functions

      NFS file system.

    1550. - Source + Source

      inspect(device // :stdio, item, opts // []) @@ -138,7 +143,7 @@

      Functions

      Inspects and writes the given argument to the device followed by a new line. Returns the item given.

      - Source + Source

      puts(device // :stdio, item) @@ -147,7 +152,7 @@

      Functions

      but adds a new line at the end. The argument is expected to be a chardata.

      - Source + Source

      read(device // :stdio, count) @@ -162,7 +167,7 @@

      Functions

      NFS file system.

      - Source + Source

      readline(device // :stdio) @@ -180,7 +185,7 @@

      Functions

      This function does the same as gets/2, except the prompt is not required as argument.

      - Source + Source

      write(device // :stdio, item) @@ -201,7 +206,7 @@

      Examples

      #=> "error"
      - Source + Source diff --git a/docs/master/Kernel.SpecialForms.html b/docs/master/Kernel.SpecialForms.html index b47325445..46855ca5e 100644 --- a/docs/master/Kernel.SpecialForms.html +++ b/docs/master/Kernel.SpecialForms.html @@ -185,7 +185,7 @@

      Examples

      record. In the environment you can access the current filename, line numbers, set up aliases, the current function and others.

      - Source + Source

      __FILE__() @@ -194,7 +194,7 @@

      Examples

      Although the file can be accessed in the ENV, this macro is a convenient shortcut.

      - Source + Source

      __MODULE__() @@ -203,7 +203,7 @@

      Examples

      Although the module can be accessed in the ENV, this macro is a convenient shortcut.

      - Source + Source

      __aliases__(args) @@ -215,7 +215,7 @@

      Examples

      { :__aliases__, 0, [:Foo,:Bar] }
      - Source + Source

      __block__(args) @@ -228,7 +228,7 @@

      Examples

      #=> { :__block__, 0, [1,2,3] }
      - Source + Source

      __scope__(opts, args) @@ -239,12 +239,12 @@

      Examples

      it belonged to another file.

      quote location: :keep, do: 1
      -#=> { :__scope__, 1,[[file: "iex"],[do: 1]] }
      +#=> { :__scope__, 1,[[file: "iex"], 1] }
       

      Check quote/1 for more information.

      - Source + Source

      alias(module, opts) @@ -302,7 +302,7 @@

      Lexical scope

      "helloworld"
      - Source + Source

      import(module, opts) @@ -312,34 +312,43 @@

      Lexical scope

      Examples

      -

      If you want to use the values function from Keyword several times -in your module and you don't want to always type Keyword.values, -you can simply import it:

      +

      If you are using several functions from a given module, you can +import those functions and reference them as local functions, +for example:

      -
      defmodule Math do
      -  import Keyword, only: [values: 1]
      +
      import List
      +flatten([1,[2],3]) #=> [1,2,3]
      +
      - def some_function do - # call values(orddict) - end -end +

      Selector

      + +

      By default, Elixir imports functions and macros from the given +module, except the ones starting with underscore (which are +usually callbacks):

      + +
      import List
       
      -

      In this case, we are importing only the function values (with arity 1) -from Keyword. Although only is optional, its usage is recommended. -except could also be given as an option. If no option is given, all -functions and macros are imported.

      +

      A developer can change this behavior to include all macros and +functions, regardless if it starts with underscore, by passing +:all as first argument:

      + +
      import :all, List
      +
      -

      In case you want to import only functions or macros, you can pass a -first argument selecting the scope:

      +

      It can also be customized to import only functions or only +macros:

      -
      import :macros, MyMacros
      +
      import :functions, List
      +import :macros, List
       
      -

      And you can then use only or except to filter the macros being -included. By default, Elixir won't import functions or macros that -start with underscore. Underscored functions can be explicitly turned -on by passing underscored: true.

      +

      Alternatively, Elixir allows a developer to specify :only +or :except as a fine grained control on what to import (or +not):

      + +
      import List, only: [flatten: 1]
      +

      Lexical scope

      @@ -360,10 +369,10 @@

      Lexical scope

      end
      -

      In the example above, we imported macros from MyMacros, replacing -the original if/2 implementation by our own during that -specific function. All other functions in that module will still -be able to use the original one.

      +

      In the example above, we imported macros from MyMacros, +replacing the original if/2 implementation by our own +during that specific function. All other functions in that +module will still be able to use the original one.

      Alias/Require shortcut

      @@ -371,7 +380,7 @@

      Alias/Require shortcut

      also accepts as: as an option so it automatically sets up an alias. Please check alias for more information.

      - Source + Source

      lc(args) @@ -419,7 +428,7 @@

      Alias/Require shortcut

      [{213,45,132},{64,76,32},{76,0,0},{234,32,15}]
      - Source + Source

      quote(opts, list2) @@ -432,11 +441,11 @@

      Examples

      #=> { :sum, 0, [1, 2, 3] } -

      Macros

      +

      Homoiconicity

      -

      Any Elixir program can be +

      Elixir is an homoiconic language. Any Elixir program can be represented using its own data structures. The building block -of Elixir is a tuple with three elements, for example:

      +of Elixir homoiconicity is a tuple with three elements, for example:

      { :sum, 1, [1, 2, 3] }
       
      @@ -454,7 +463,7 @@

      Macros

      that it may be a variable. -

      Literals

      +

      Macro literals

      Besides the tuple described above, Elixir has a few literals that when quoted return themselves. They are:

      @@ -559,7 +568,7 @@

      Stacktrace information

      particular, the macro __FILE__ will always point to GenServer.Behaviour file.

      - Source + Source

      require(module, opts) @@ -619,7 +628,7 @@

      Examples

      #=> { :sum, 0, [1, 13, 3] }
      - Source + Source

      unquote_splicing(expr) @@ -634,7 +643,7 @@

      Examples

      #=> { :sum, 0, [1, 2, 3, 4, 5] }
      - Source + Source

      {}(args) diff --git a/docs/master/Kernel.html b/docs/master/Kernel.html index 63988f751..1e6010df6 100644 --- a/docs/master/Kernel.html +++ b/docs/master/Kernel.html @@ -58,714 +58,744 @@

      Functions summary

      - - - -

      Macros summary

      - + + + +

      Macros summary

      +
        +
      • - hd/1 + !/1
      • - if/2 + !=/2
      • - in/2 + !==/2
      • - inspect/2 + &&/2
      • - integer_to_list/1 + */2
      • - integer_to_list/2 + +/2
      • - iolist_size/1 + ++/2
      • - iolist_to_binary/1 + -/2
      • - is_alive/0 + --/2
      • - is_atom/1 + ../2
      • - is_binary/1 + //2
      • - is_bitstring/1 + />/2
      • - is_boolean/1 + </2
      • - is_exception/1 + <-/2
      • - is_float/1 + <=/2
      • - is_function/1 + <>/2
      • - is_function/2 + ==/2
      • - is_integer/1 + ===/2
      • - is_list/1 + =~/2
      • - is_number/1 + >/2
      • - is_pid/1 + >=/2
      • - is_port/1 + @/1
      • - is_range/1 + __B__/2
      • - is_record/2 + __C__/2
      • - is_reference/1 + __R__/2
      • - is_regex/1 + __b__/2
      • - is_tuple/1 + __c__/2
      • - length/1 + __r__/2
      • - list_to_atom/1 + access/2
      • - list_to_binary/1 + and/2
      • - list_to_bitstring/1 + atom_to_binary/1
      • - list_to_existing_atom/1 + binary_to_atom/1
      • - list_to_float/1 + binary_to_existing_atom/1
      • - list_to_integer/1 + binary_to_float/1
      • - list_to_integer/2 + binary_to_integer/1
      • - list_to_pid/1 + binary_to_integer/2
      • - list_to_tuple/1 + case/2
      • - make_ref/0 + cond/1
      • - match?/2 + def/2
      • - max/2 + def/4
      • - min/2 + defdelegate/2
      • - nil?/1 + defexception/4
      • - node/0 + defimpl/3
      • - node/1 + defmodule/2
      • - not/1 + defoverridable/1
      • - or/2 + defp/2
      • - pid_to_list/1 + defp/4
      • - receive/1 + defprotocol/2
      • - rem/2 + defrecord/4
      • - round/1 + destructure/2
      • - self/0 + div/2
      • - setelem/3 + elem/2
      • - size/1 + float_to_binary/1
      • - spawn/1 + function/1
      • - spawn/3 + if/2
      • - spawn_link/1 + in/2
      • - spawn_link/3 + inspect/2
      • - term_to_binary/1 + integer_to_binary/1
      • - term_to_binary/2 + integer_to_binary/2
      • - throw/1 + is_exception/1
      • - tl/1 + is_range/1
      • - to_binary/1 + is_record/2
      • - to_char_list/1 + is_regex/1
      • - trunc/1 + match?/2
      • - try/1 + nil?/1
      • - tuple_size/1 + not/1
      • - tuple_to_list/1 + or/2 + +
      • +
      • + + receive/1 + +
      • +
      • + + rem/2 + +
      • +
      • + + setelem/3 + +
      • +
      • + + to_binary/1 + +
      • +
      • + + to_char_list/1 + +
      • +
      • + + try/1
      • @@ -803,2141 +833,2454 @@

        Macros summary

        Functions

        -

        - raise(msg) +

        + abs(number)

        -

        Raises an error.

        +

        Returns an integer or float which is the arithmetical absolute value of number.

        -

        If the argument is a binary, it raises RuntimeError with the message. -If anything else, becomes a call to raise(argument, []).

        +

        Allowed in guard tests.

        Examples

        -
        raise "Given values do not match"
        -
        -try do
        -  1 + :foo
        -rescue
        -  x in [BadargError] ->
        -    IO.puts "that was expected"
        -    raise x
        -end
        +
        abs(-3.33) #=> 3.33
        +abs(-3)    #=> 3
         
        - Source + Source
        -

        - raise(exception, args) +

        + apply(fun, args)

        -

        Raises an error.

        - -

        It calls .exception on the given argument passing -the args in order to retrieve the appropriate exception -structure.

        - -

        Any module defined via defexception automatically -defines exception(args) that returns a new instance -of the record and a exception(args, current) that -works as no-op.

        +

        Invokes the given fun with the array of arguments args.

        Examples

        -
        raise ArgumentError, message: "Sample"
        +
        apply fn x -> x * 2 end, [2]
        +#=> 4
         
        - Source -
        -
        - - - -
        -

        Macros

        -
        -

        - !(arg) + Source +

        +

        + apply(module, fun, args)

        -

        It receives any argument and returns true if it is false -or nil. Returns false otherwise. Not allowed in guard -clauses.

        +

        Invokes the given fun from module with the array of arguments args.

        Examples

        -

        !1 #=> false - ![1,2,3] #=> false - !false #=> true - !nil #=> true

        +
        apply List, reverse, [[1,2,3]]
        +#=> [3,2,1]
        +
        - Source + Source
        -

        - !=(left, right) +

        + atom_to_binary(atom, encoding)

        -

        Returns true if the two items are not equal.

        - -

        This operator considers 1 and 1.0 to be equal. For strict -comparison, use !== instead.

        - -

        As Erlang, Elixir can compare any term. Allowed in guard clauses.

        +

        Returns a binary which corresponds to the text representation of atom. +If encoding is latin1, there will be one byte for each character in the text +representation. If encoding is utf8 or unicode, the characters will be encoded +using UTF-8 (meaning that characters from 16#80 up to 0xFF will be encoded in +two bytes).

        Examples

        -
        1 != 2
        -#=> true
        -1 != 1.0
        -#=> false
        +
        atom_to_binary(:elixir, :utf8) #=> "elixir"
         
        - Source + Source
        -

        - !==(left, right) +

        + atom_to_list(atom)

        -

        Returns true if the two items are strictly not equal. -As Erlang, Elixir can compare any term. Allowed in guard clauses.

        +

        Returns a string which corresponds to the text representation of atom.

        Examples

        -
        1 !== 2
        -#=> true
        -
        -1 !== 1.0
        -#=> true
        +
        atom_to_list(:elixir) #=> 'elixir'
         
        - Source + Source
        -

        - &&(left, right) +

        + binary_part(binary, start, length)

        -

        Provides a short-circuit operator that executes the second -expression only if the first one evalutes to true (i.e. it is -not nil nor false). Returns the first expression otherwise.

        +

        Extracts the part of the binary starting at start with length length. +Binaries are zero-indexed.

        + +

        If start or length references in any way outside the binary, an +ArgumentError exception is raised.

        + +

        Allowed in guard tests.

        Examples

        -
        true && true         #=> true
        -nil && true          #=> nil
        -true && 1            #=> 1
        -false && error(:bad) #=> false
        +
        binary_part "foo", 1, 2 #=> "oo"
         
        -

        Notice that, differently from Erlang and operator, -this operator accepts any expression as arguments, -not only booleans, however it is not allowed in guards.

        +

        A negative length can be used to extract bytes at the end of a binary:

        + +
        binary_part "foo", 3, -1 #=> 1
        +
        - Source + Source
        -

        - *(left, right) +

        + binary_to_atom(binary, encoding)

        -

        Arithmetic multiplication. Allowed in guard clauses.

        +

        Returns the atom whose text representation is binary. If encoding is latin1, +no translation of bytes in the binary is done. If encoding is utf8 or unicode, +the binary must contain valid UTF-8 sequences; furthermore, only Unicode +characters up to 0xFF are allowed.

        Examples

        -
        1 * 2 #=> 2
        +
        binary_to_atom("elixir", :utf8) #=> :elixir
         
        - Source + Source
        -

        - +(left, right) +

        + binary_to_existing_atom(binary, encoding)

        -

        Arithmetic plus. Allowed in guard clauses.

        - -

        Examples

        - -
        1 + 2 #=> 3
        -
        +

        Works like binary_to_atom/2, but the atom must already exist.

        - Source + Source
        -

        - ++(left, right) +

        + binary_to_list(binary)

        -

        Concatenates two lists. Allowed in guard clauses.

        - -

        Examples

        - -
        [1] ++ [2,3]
        -#=> [1,2,3]
        -
        -'foo' ++ 'bar'
        -#=> 'foobar'
        -
        +

        Returns a list of integers which correspond to the bytes of binary.

        - Source + Source
        -

        - -(left, right) +

        + binary_to_list(binary, start, stop)

        -

        Arithmetic minus. Allowed in guard clauses.

        +

        As binarytolist/1, but returns a list of integers corresponding to the bytes +from position start to position stop in binary. Positions in the binary +are numbered starting from 1.

        +
        + Source +
        +

        + binary_to_term(binary) +

        +

        Returns an Erlang term which is the result of decoding the binary +object binary, which must be encoded according to the Erlang external +term format.

        Examples

        -
        1 - 2 #=> -1
        +
        binary_to_term(term_to_binary("foo")) #=> "foo"
         
        - Source + Source
        -

        - --(left, right) +

        + binary_to_term(binary, options)

        -

        Removes the first occorrence of an item on the left -for each item on the right. Allowed in guard clauses.

        - -

        Examples

        +

        As binary_to_term/1, but accepts a safe option useful when receiving +binaries from an untrusted source.

        -
        [1,2,3] -- [1,2]
        -#=> [3]
        +

        When enabled, it prevents decoding data that may be used to attack the +Erlang system. In the event of receiving unsafe data, decoding fails +with a badarg error.

        -[1,2,3,2,1] -- [1,2,2] -#=> [3,1] -
        -
        - Source -
        -

        - ..(first, last) -

        -

        Returns a range with the specified start and end. -Includes both ends.

        +

        Currently, this prevents creation of new atoms directly, creation of +new atoms indirectly (as they are embedded in certain structures like pids, +refs, funs, etc), and creation of new external function references. None +of those resources are currently garbage collected, so unchecked creation +of them can exhaust available memory.

        Examples

        -
        0 in 1..3 #=> false
        -1 in 1..3 #=> true
        -2 in 1..3 #=> true
        -3 in 1..3 #=> true
        +
        binary_to_term(term_to_binary("foo"), [:safe])
         
        - Source + Source
        -

        - /(left, right) +

        + bit_size(bitstring)

        -

        Arithmetic division. Differently from other languages, -the result is always a float. Use div and rem if you want -a natural division or the remainder. Allowed in guard clauses.

        +

        Returns an integer which is the size in bits of bitstring.

        + +

        Allowed in guard tests.

        Examples

        -
        1 / 2 #=> 0.5
        -2 / 1 #=> 2.0
        +
        bit_size(<<433|16,3|3>>) #=> 19
        +bit_size(<<1,2,3>>) #=> 24
         
        - Source + Source
        -

        - />(left, right) +

        + bitstring_to_list(bitstring)

        -

        /> is called the pipeline operator as it is useful -to write pipeline style expressions. This operator -tntroduces the expression on the left as the first -argument to the expression on the right.

        - -

        Examples

        - -
        [1,[2],3] /> List.flatten /> Enum.map(&1 * 2)
        -#=> [2,4,6]
        -
        - -

        The expression above is simply translated to:

        - -
        Enum.map(List.flatten([1,[2],3]), &1 * 2)
        -
        +

        Returns a list of integers which correspond to the bytes of bitstring. If the +number of bits in the binary is not divisible by 8, the last element of the list will +be a bitstring containing the remaining bits (1 up to 7 bits).

        - Source + Source
        -

        - <(left, right) +

        + byte_size(bitstring)

        -

        Return true if left is less than right. -As Erlang, Elixir can compare any term. Allowed in guard clauses.

        +

        Returns an integer which is the number of bytes needed to contain bitstring. +(That is, if the number of bits in Bitstring is not divisible by 8, the resulting +number of bytes will be rounded up.)

        + +

        Allowed in guard tests.

        Examples

        -
        1 < 2
        -#=> true
        +
        byte_size(<<433|16,3|3>>) #=> 3
        +byte_size(<<1,2,3>>) #=> 3
         
        - Source + Source
        -

        - <-(pid, msg) +

        + exit(reason)

        -

        Sends a message to the process identified on the left. -A process can be identified bu its PID or, if it is registered, -by an atom.

        +

        Stops the execution of the calling process with the given reason. +Since evaluating this function causes the process to terminate, +it has no return value.

        Examples

        -
        process = Process.self
        -process <- { :ok, "Sending myself a message" }
        +
        exit(:normal)
        +exit(:seems_bad)
         
        - Source + Source
        -

        - <=(left, right) +

        + float(number)

        -

        Return true if left is less than or equal to right. -As Erlang, Elixir can compare any term. Allowed in guard clauses.

        - -

        Examples

        - -
        1 <= 2
        -#=> true
        -
        +

        Converts the given number to a float. Allowed in guard clauses.

        - Source + Source
        -

        - <>(left, right) +

        + float_to_list(number)

        -

        Concatenates two binaries. Allowed in guard clauses.

        +

        Returns a char list which corresponds to the text representation of the given float.

        Examples

        -
        "foo" <> "bar" #=> "foobar"
        +
        float_to_list(7.0)
        +#=> '7.00000000000000000000e+00'
         
        +
        + Source +
        +

        + function_exported?(module, function, arity) +

        +

        Returns true if the module is loaded and contains a +public function with the given arity, otherwise false.

        -

        The <> operator can also be used in guard clauses as -long as the first part is a literal binary:

        +

        In case a tuple module is given, the arity is automatically +increased by one.

        -
        "foo" <> x = "foobar"
        -x #=> "bar"
        -
        +

        Notice that this function does not load the module in case +it is not loaded. Check Code.ensure_loaded/1 for more +information.

        - Source + Source
        -

        - ==(left, right) +

        + halt()

        -

        Returns true if the two items are equal.

        +

        The same as halt(0, []).

        +
        + Source +
        +

        + halt(status) +

        +

        The same as halt(status, []).

        +
        + Source +
        +

        + halt(status, options) +

        +

        Halts the Erlang runtime system where the first argument status must be a +non-negative integer, a char list, or the atom :abort.

        -

        This operator considers 1 and 1.0 to be equal. For strict -comparison, use === instead.

        +
          +
        • If an integer, the runtime system exits with the integer value which +is returned to the Operating System;

        • +
        • If a char list, an erlang crash dump is produced with status as slogan, +and then the runtime system exits with status code 1;

        • +
        • If :abort, the runtime system aborts producing a core dump, if that is +enabled in the operating system.

        • +
        -

        As Erlang, Elixir can compare any term. Allowed in guard clauses.

        +

        Note that on many platforms, only the status codes 0-255 are supported +by the operating system.

        -

        Examples

        +

        For integer status, Erlang runtime system closes all ports and allows async +threads to finish their operations before exiting. To exit without such +flushing, pass options [flush: false] instead.

        -
        1 == 2
        -#=> false
        +

        Examples

        -1 == 1.0 -#=> true +
        halt(0)
        +halt(1, flush: false)
        +halt(:abort)
         
        - Source + Source
        -

        - ===(left, right) +

        + hd(list)

        -

        Returns true if the two items are strictly equal. -As Erlang, Elixir can compare any term. Allowed in guard clauses.

        +

        Returns the head of a list, raises badarg if the list is empty.

        +
        + Source +
        +

        + integer_to_list(number) +

        +

        Returns a char list which corresponds to the text representation of the given integer.

        Examples

        -
        1 === 2
        -#=> false
        -
        -1 === 1.0
        -#=> false
        +
        integer_to_list(7)
        +#=> '7'
         
        - Source + Source
        -

        - =~(left, right) +

        + integer_to_list(number, base)

        -

        Matches the term on the left against the regular expression -on the right. It returns nil if not match happened or the -first match otherwise.

        +

        Returns a char list which corresponds to the text representation of the +given integer in the given case.

        Examples

        -
        "abcd" =~ %r/c(d)/  #=> 2
        -"abcd" =~ %r/e/     #=> nil
        +
        integer_to_list(1023, 16).
        +#=> "3FF"
         
        - Source + Source
        -

        - >(left, right) +

        + iolist_size(item)

        -

        Return true if left is more than right. -As Erlang, Elixir can compare any term. Allowed in guard clauses.

        +

        Returns the size of an iolist.

        Examples

        -
        1 > 2
        -#=> false
        +
        iolist_size([1,2|<<3,4>>])
        +#=> 4
         
        - Source + Source
        -

        - >=(left, right) +

        + iolist_to_binary(item)

        -

        Return true if left is more than or equal to right. -As Erlang, Elixir can compare any term. Allowed in guard clauses.

        +

        Returns a binary which is made from the integers and binaries in iolist.

        Examples

        -
        1 >= 2
        -#=> false
        +
        bin1 = <<1,2,3>>
        +bin2 = <<4,5>>
        +bin3 = <<6>>
        +
        +iolist_to_binary([bin1,1,[2,3,bin2],4|bin3])
        +#=> <<1,2,3,1,2,3,4,5,4,6>>
         
        - Source + Source
        -

        - @(expr) +

        + is_alive()

        -

        This macro is a shortcut to read and add attributes to the module -being compiled. Elixir module attributes are similar to Erlang's with -some differences. The canonical example for attributes is annotating -that a module implements the OTP behavior called gen_server:

        - -
        defmodule MyServer do
        -  @behavior :gen_server
        -  # ... callbacks ...
        -end
        -
        +

        Returns true if the local node is alive; that is, +if the node can be part of a distributed system.

        +
        + Source +
        +

        + is_atom(term) +

        +

        Returns true if term is an atom; otherwise returns false.

        -

        Elixir supports by default all Erlang module attributes but any developer -can also add custom attributes:

        +

        Allowed in guard tests.

        +
        + Source +
        +

        + is_binary(term) +

        +

        Returns true if term is a binary; otherwise returns false.

        -
        defmodule MyServer do
        -  @my_data 13
        -  IO.inspect @my_data #=> 13
        -end
        -
        +

        A binary always contains a complete number of bytes.

        -

        Differently from Erlang, such attributes are not stored in the module by -default since it is common in Elixir to use such attributes to store -temporary data. A developer can configure an attribute to behave closer -to Erlang by calling Module.register_attribute/2.

        +

        Allowed in guard tests.

        +
        + Source +
        +

        + is_bitstring(term) +

        +

        Returns true if term is a bitstring (including a binary); otherwise returns false.

        -

        Finally notice that attributes can also be read inside functions:

        +

        Allowed in guard tests.

        +
        + Source +
        +

        + is_boolean(term) +

        +

        Returns true if term is either the atom true or the atom false (i.e. a boolean); +otherwise returns false.

        -
        defmodule MyServer do
        -  @my_data 11
        -  def first_data, do: @my_data
        -  @my_data 13
        -  def second_data, do: @my_data
        -end
        +

        Allowed in guard tests.

        +
        + Source +
        +

        + is_float(term) +

        +

        Returns true if term is a floating point number; otherwise returns false.

        -MyServer.first_data #=> 11 -MyServer.second_data #=> 13 -
        +

        Allowed in guard tests.

        +
        + Source +
        +

        + is_function(term) +

        +

        Returns true if term is a function; otherwise returns false.

        -

        It is important to note that reading an attribute takes a snapshot of -its current value. In other words, the value is read at compilation -time and not at runtime. Check the module Module for other functions -to manipulate module attributes.

        +

        Allowed in guard tests.

        - Source + Source
        -

        - __B__(string, list2) +

        + is_function(term, arity)

        -

        Handles the sigil %B. It simples returns a binary -without escaping characters and without interpolations.

        +

        Returns true if term is a function that can be applied with arity number of arguments; +otherwise returns false.

        -

        Examples

        +

        Allowed in guard tests.

        +
        + Source +
        +

        + is_integer(term) +

        +

        Returns true if term is an integer; otherwise returns false.

        -
        %B(foo)      #=> "foo"
        -%B(f#{o}o)  #=> "f\#{o}o"
        -
        +

        Allowed in guard tests.

        - Source + Source
        -

        - __C__(arg1, list2) +

        + is_list(term)

        -

        Handles the sigil %C. It simples returns a char list -without escaping characters and without interpolations.

        +

        Returns true if term is a list with zero or more elements; otherwise returns false.

        + +

        Allowed in guard tests.

        +
        + Source +
        +

        + is_number(term) +

        +

        Returns true if term is either an integer or a floating point number; +otherwise returns false.

        + +

        Allowed in guard tests.

        +
        + Source +
        +

        + is_pid(term) +

        +

        Returns true if term is a pid (process identifier); otherwise returns false.

        + +

        Allowed in guard tests.

        +
        + Source +
        +

        + is_port(term) +

        +

        Returns true if term is a port identifier; otherwise returns false.

        + +

        Allowed in guard tests.

        +
        + Source +
        +

        + is_reference(term) +

        +

        Returns true if term is a reference; otherwise returns false.

        + +

        Allowed in guard tests.

        +
        + Source +
        +

        + is_tuple(term) +

        +

        Returns true if term is a tuple; otherwise returns false.

        + +

        Allowed in guard tests.

        +
        + Source +
        +

        + length(list) +

        +

        Returns the length of list.

        + +

        Allowed in guard tests.

        Examples

        -
        %C(foo)      #=> 'foo'
        -%C(f#{o}o)  #=> 'f\#{o}o'
        +
        length([1,2,3,4,5,6,7,8,9]) #=> 9
         
        - Source + Source
        -

        - __R__(arg1, options) +

        + list_to_atom(char_list)

        -

        Handles the sigil %R. It returns a Regex pattern without escaping -nor interpreating interpolations.

        +

        Returns the atom whose text representation is char_list.

        Examples

        -
        Regex.match? %R(f#{1,3}o), "f#o"  #=> true
        +
        list_to_atom('elixir') #=> :elixir
         
        - Source + Source
        -

        - __b__(arg1, list2) +

        + list_to_binary(char_list)

        -

        Handles the sigil %b. It returns a binary as if it was double quoted -string, unescaping characters and replacing interpolations.

        +

        Returns a binary which is made from the content of char_list.

        Examples

        -
        %b(foo)       #=> "foo"
        -%b(f#{:o}o)  #=> "foo"
        +
        list_to_binary('Elixir') #=> "Elixir"
         
        - Source + Source
        -

        - __c__(arg1, list2) +

        + list_to_bitstring(bitstring_list)

        -

        Handles the sigil %c. It returns a char list as if it was a single -quoted string, unescaping characters and replacing interpolations.

        +

        Returns a bitstring which is made from the integers and bitstrings in bitstring_list. +(the last tail in bitstring_list is allowed to be a bitstring.)

        Examples

        -
        %c(foo)       #=> 'foo'
        -%c(f#{:o}o)  #=> 'foo'
        +
        bin1 = <<1,2,3>>
        +bin2 = <<4,5>>
        +bin3 = <<6,7|4>>
        +
        +list_to_bitstring([bin1,1,[2,3,bin2],4|bin3])
        +#=> <<1,2,3,1,2,3,4,5,4,6,7|4>>
         
        - Source + Source
        -

        - __r__(arg1, options) +

        + list_to_existing_atom(char_list)

        -

        Handles the sigil %r. It returns a Regex pattern.

        +

        Returns the atom whose text representation is char_list, but only if there already +exists such atom.

        +
        + Source +
        +

        + list_to_float(char_list) +

        +

        Returns the float whose text representation is char_list.

        Examples

        -
        Regex.match? %r(foo), "foo"  #=> true
        +
        list_to_float('2.2017764e+0') #=> 2.2017764
         
        - Source + Source
        -

        - abs(number) +

        + list_to_integer(char_list)

        -

        Returns an integer or float which is the arithmetical absolute value of number.

        - -

        Allowed in guard tests.

        +

        Returns an integer whose text representation is char_list.

        Examples

        -
        abs(-3.33) #=> 3.33
        -abs(-3)    #=> 3
        +
        list_to_integer('123') #=> 123
         
        - Source + Source
        -

        - access(element, args) +

        + list_to_integer(char_list, base)

        -

        Access the given element using the qualifier according -to the Access protocol. All calls in the form foo[bar] -are translated to access(foo, bar).

        +

        Returns an integer whose text representation in base base is char_list.

        -

        The usage of this protocol is to access a raw value in a -keyword list.

        +

        Examples

        -
        sample = [a: 1, b: 2, c: 3]
        -sample[:b] #=> 2
        +
        list_to_integer('3FF', 16) #=> 1023
         
        +
        + Source +
        +

        + list_to_pid(char_list) +

        +

        Returns a pid whose text representation is char_list.

        -

        Atoms

        +

        Warning:

        -

        Whenever invoked on an atom, the access protocol is expanded -at compilation time rather than on runtime. This feature is used -by records to allow a developer to match against an specific part -of a record:

        +

        This function is intended for debugging and for use in the Erlang +operating system.

        -
        def increment(State[counter: counter, other: 13] = state) do
        -  state.counter(counter + 1)
        -end
        -
        +

        It should not be used in application programs.

        -

        In the example above, we use the Access protocol to match the -counter field in the record State. Considering the record -definition is as follows:

        +

        Examples

        -
        defrecord State, counter: 0, other: nil
        -
        - -

        The clause above is translated to:

        - -
        def increment({ State, counter, 13 } = state) do
        -  state.counter(counter + 1)
        -end
        -
        - -

        The same pattern can be used to create a new record:

        - -
        def new_state(counter) do
        -  State[counter: counter]
        -end
        -
        - -

        The example above is slightly faster than State.new(counter: :counter) -because the record is expanded at compilation time and not at runtime. -If a field is not specified on creation, it will have its default value.

        - -

        Finally, as in Erlang, Elixir also allows the following syntax:

        - -
        new_uri = State[_: 1]
        -
        - -

        In this case all fields will be set to 1. Notice that, -as in Erlang, in case an expression is given, it will be -evaluated multiple times:

        - -
        new_uri = State[_: IO.puts "Hello"]
        -
        - -

        In this case, "Hello" will be printed twice (one per each field).

        - -

        Examples

        - -
        a = { :a, :b, :c }
        -a[1] #=> :a
        -access a, 1 #=> :a
        +
        list_to_pid('<0.41>') #=> <0.4.1>
         
        - Source + Source
        -

        - and(left, right) +

        + list_to_tuple(list)

        -

        Boolean and. Arguments needs to necessarily be booleans. -Allowed in guard clauses.

        +

        Returns a tuple which corresponds to list. list can contain any Erlang terms.

        Examples

        -
        true and false
        -#=> false
        +
        list_to_tuple([:share, [:elixir, 163]]). #=> {:share, [:elixir, 163]}
         
        - Source + Source
        -

        - apply(fun, args) +

        + make_ref()

        -

        Invokes the given fun with the array of arguments args.

        +

        Returns an almost unique reference.

        + +

        The returned reference will re-occur after approximately 2^82 calls; +therefore it is unique enough for practical purposes.

        Examples

        -
        apply fn x -> x * 2 end, [2]
        -#=> 4
        +
        make_ref()
        +#=> #Ref<0.0.0.135>
         
        - Source + Source
        -

        - apply(module, fun, args) +

        + max(first, second)

        -

        Invokes the given fun from module with the array of arguments args.

        +

        Return the biggest of the two given terms according to +Erlang's term ordering. If the terms compare equal, the +first one is returned.

        Examples

        -
        apply List, reverse, [[1,2,3]]
        -#=> [3,2,1]
        +
        max(1, 2) #=> 2
         
        - Source + Source
        -

        - atom_to_binary(some_atom) +

        + min(first, second)

        -

        Returns a binary which corresponds to the text representation -of some_atom in UTF8 encoding. Allowed in guard clauses.

        +

        Return the smallest of the two given terms according to +Erlang's term ordering. If the terms compare equal, the +first one is returned.

        Examples

        -
        atom_to_binary :my_atom #=> "my_atom"
        +
        min(1, 2) #=> 1
         
        - Source + Source
        -

        - atom_to_binary(atom, encoding) +

        + node()

        -

        Returns a binary which corresponds to the text representation of atom. -If encoding is latin1, there will be one byte for each character in the text -representation. If encoding is utf8 or unicode, the characters will be encoded -using UTF-8 (meaning that characters from 16#80 up to 0xFF will be encoded in -two bytes).

        - -

        Examples

        +

        Returns an atom representing the name of the local node. +If the node is not alive, nonode@nohost is returned instead.

        -
        atom_to_binary(:elixir, utf8) #=> "elixir"
        -
        +

        Allowed in guard tests.

        - Source + Source
        -

        - atom_to_list(atom) +

        + node(arg)

        -

        Returns a string which corresponds to the text representation of atom.

        - -

        Examples

        +

        Returns the node where the given argmuent is located. +The argument can be a pid, a reference, or a port. +If the local node is not alive, nonode@nohost is returned.

        -
        atom_to_list(:elixir) #=> 'elixir'
        -
        +

        Allowed in guard tests.

        - Source + Source
        -

        - binary_part(binary, start, length) +

        + pid_to_list(pid)

        -

        Extracts the part of the binary starting at start with length length. -Binaries are zero-indexed.

        - -

        If start or length references in any way outside the binary, an -ArgumentError exception is raised.

        - -

        Allowed in guard tests.

        - -

        Examples

        +

        Returns a char list which corresponds to the text representation of pid. +This function is intended for debugging and for use in the Erlang operating +system. It should not be used in application programs.

        -
        binary_part "foo", 1, 2 #=> "oo"
        -
        +

        Warning:

        -

        A negative length can be used to extract bytes at the end of a binary:

        +

        This function is intended for debugging and for use in the Erlang +operating system.

        -
        binary_part "foo", 3, -1 #=> 1
        -
        +

        It should not be used in application programs.

        - Source + Source
        -

        - binary_to_atom(some_binary) +

        + raise(msg)

        -

        Returns the atom whose text representation is -some_binary in UTF8 encoding. -Allowed in guard clauses.

        +

        Raises an error.

        + +

        If the argument is a binary, it raises RuntimeError with the message. +If anything else, becomes a call to raise(argument, []).

        Examples

        -
        binary_to_atom "my_atom" #=> :my_atom
        +
        raise "Given values do not match"
        +
        +try do
        +  1 + :foo
        +rescue
        +  x in [BadargError] ->
        +    IO.puts "that was expected"
        +    raise x
        +end
         
        - Source + Source
        -

        - binary_to_atom(binary, encoding) +

        + raise(exception, args)

        -

        Returns the atom whose text representation is binary. If encoding is latin1, -no translation of bytes in the binary is done. If encoding is utf8 or unicode, -the binary must contain valid UTF-8 sequences; furthermore, only Unicode -characters up to 0xFF are allowed.

        +

        Raises an error.

        + +

        It calls .exception on the given argument passing +the args in order to retrieve the appropriate exception +structure.

        + +

        Any module defined via defexception automatically +defines exception(args) that returns a new instance +of the record and a exception(args, current) that +works as no-op.

        Examples

        -
        binary_to_atom("elixir", :utf8) #=> :elixir
        +
        raise ArgumentError, message: "Sample"
         
        - Source + Source
        -

        - binary_to_existing_atom(some_binary) +

        + round(number)

        -

        Works like binary_to_atom but the atom must exist. -Allowed in guard clauses.

        +

        Returns an integer by rounding the given number. +Allowed in guard tests.

        Examples

        -
        :my_atom                          #=> :my_atom
        -binary_to_existing_atom "my_atom" #=> :my_atom
        +
        round(5.5) #=> 6
         
        - Source -
        -

        - binary_to_existing_atom(binary, encoding) -

        -

        Works like binary_to_atom/2, but the atom must already exist.

        -
        - Source + Source
        -

        - binary_to_list(binary) +

        + self()

        -

        Returns a list of integers which correspond to the bytes of binary.

        +

        Returns the pid (process identifier) of the calling process. +Allowed in guard clauses.

        - Source + Source
        -

        - binary_to_list(binary, start, stop) +

        + size(arg)

        -

        As binarytolist/1, but returns a list of integers corresponding to the bytes -from position start to position stop in binary. Positions in the binary -are numbered starting from 1.

        +

        Returns the size of the given argument, which must be a tuple +or a binary. If possible, please use tuplesize or binarysize.

        - Source + Source
        -

        - binary_to_term(binary) +

        + spawn(fun)

        -

        Returns an Erlang term which is the result of decoding the binary -object binary, which must be encoded according to the Erlang external -term format.

        +

        Spawns the given function and returns its pid.

        + +

        Check the modules Process and Node for other functions +to handle processes, including spawning functions in nodes.

        Examples

        -
        binary_to_term(term_to_binary("foo")) #=> "foo"
        +
        current = Process.self
        +child   = spawn(fn -> current <- { Process.self, 1 + 2 } end)
        +
        +receive
        +  { ^child, 3 } -> IO.puts "Received 3 back"
        +end
         
        - Source + Source
        -

        - binary_to_term(binary, options) +

        + spawn(module, fun, args)

        -

        As binary_to_term/1, but accepts a safe option useful when receiving -binaries from an untrusted source.

        - -

        When enabled, it prevents decoding data that may be used to attack the -Erlang system. In the event of receiving unsafe data, decoding fails -with a badarg error.

        +

        Spawns the given module and function passing the given args +and returns its pid.

        -

        Currently, this prevents creation of new atoms directly, creation of -new atoms indirectly (as they are embedded in certain structures like pids, -refs, funs, etc), and creation of new external function references. None -of those resources are currently garbage collected, so unchecked creation -of them can exhaust available memory.

        +

        Check the modules Process and Node for other functions +to handle processes, including spawning functions in nodes.

        Examples

        -
        binary_to_term(term_to_binary("foo"), [:safe])
        +
        spawn(SomeModule, :function, [1,2,3])
         
        - Source + Source
        -

        - bit_size(bitstring) +

        + spawn_link(fun)

        -

        Returns an integer which is the size in bits of bitstring.

        +

        Spawns the given function, links it to the current process and returns its pid.

        -

        Allowed in guard tests.

        +

        Check the modules Process and Node for other functions +to handle processes, including spawning functions in nodes.

        Examples

        -
        bit_size(<<433|16,3|3>>) #=> 19
        -bit_size(<<1,2,3>>) #=> 24
        +
        current = Process.self
        +child   = spawn_link(fn -> current <- { Process.self, 1 + 2 } end)
        +
        +receive
        +  { ^child, 3 } ->
        +    IO.puts "Received 3 back"
        +end
         
        - Source + Source
        -

        - bitstring_to_list(bitstring) +

        + spawn_link(module, fun, args)

        -

        Returns a list of integers which correspond to the bytes of bitstring. If the -number of bits in the binary is not divisible by 8, the last element of the list will -be a bitstring containing the remaining bits (1 up to 7 bits).

        +

        Spawns the given module and function passing the given args, +links it to the current process and returns its pid.

        + +

        Check the modules Process and Node for other functions +to handle processes, including spawning functions in nodes.

        + +

        Examples

        + +
        spawn_link(SomeModule, :function, [1,2,3])
        +
        - Source + Source
        -

        - byte_size(bitstring) +

        + term_to_binary(term)

        -

        Returns an integer which is the number of bytes needed to contain bitstring. -(That is, if the number of bits in Bitstring is not divisible by 8, the resulting -number of bytes will be rounded up.)

        +

        Returns a binary data which is the result of encoding the given term +according to the Erlang external term format.

        -

        Allowed in guard tests.

        +

        This can be used for a variety of purposes, for example, writing a term +to a file in an efficient way, or sending an Erlang term to some type +of communications channel not supported by distributed :

        +
        + Source +
        +

        + term_to_binary(term, opts) +

        +

        The same as term_to_binary/1 but also supports two options:

        + + +
        + Source +
        +

        + throw(term) +

        +

        A non-local return from a function. Check try/2 for more information.

        +
        + Source +
        +

        + tl(list) +

        +

        Returns the tail of a list. Raises ArgumentError if the list is empty.

        +
        + Source +
        +

        + trunc(number) +

        +

        Returns an integer by the truncating the given number. +Allowed in guard clauses.

        Examples

        -
        byte_size(<<433|16,3|3>>) #=> 3
        -byte_size(<<1,2,3>>) #=> 3
        +
        trunc(5.5) #=> 5
         
        - Source + Source
        -

        - case(condition, blocks) +

        + tuple_size(tuple)

        -

        Matches the given condition against the match clauses.

        +

        Returns the size of a tuple.

        +
        + Source +
        +

        + tuple_to_list(tuple) +

        +

        Converts a tuple to a list.

        +
        + Source +
        +
        + + + +
        +

        Macros

        +
        +

        + !(arg) +

        +

        It receives any argument and returns true if it is false +or nil. Returns false otherwise. Not allowed in guard +clauses.

        Examples

        -
        case thing do
        -  { :selector, i, value } when is_integer(i) ->
        -    value
        -  value -> value
        -end
        +
        !1        #=> false
        +![1,2,3]  #=> false
        +!false    #=> true
        +!nil      #=> true
         
        +
        + Source +
        +

        + !=(left, right) +

        +

        Returns true if the two items are not equal.

        -

        In the example above, we compare thing with each given -match clause and execute the first one that matches. If no -clause matches, an error is raised.

        - -

        Since Elixir variables can be assigned more than once, variables -in a match clause will always be assigned instead of matching with -its previous values. For example:

        +

        This operator considers 1 and 1.0 to be equal. For strict +comparison, use !== instead.

        -
        i = 1
        -case 10 do
        -  i -> i * 2
        -end
        -
        +

        As Erlang, Elixir can compare any term. Allowed in guard clauses.

        -

        The example above will return 20, because i is assgined to 10 -and then multiplied by 2. If you desire to match the value of i -against the given condition, you need to use the ^ operator:

        +

        Examples

        -
        i = 1
        -case 10 do
        -  ^i -> i * 2
        -end
        +
        1 != 2
        +#=> true
        +1 != 1.0
        +#=> false
         
        +
        + Source +
        +

        + !==(left, right) +

        +

        Returns true if the two items are strictly not equal. +As Erlang, Elixir can compare any term. Allowed in guard clauses.

        -

        The example above will actually fail because 10 does not match 1.

        +

        Examples

        -

        Finally, case accepts an else: branch as a fallback if none -of the clauses match:

        +
        1 !== 2
        +#=> true
         
        -
        case thing do
        -  { :selector, i, value } when is_integer(i) ->
        -    value
        -  _ ->
        -    thing
        -end
        +1 !== 1.0
        +#=> true
         
        - Source + Source
        -

        - cond(list1) +

        + &&(left, right)

        -

        Execute the first clause where the condition returns true, -raises an error otherwise.

        +

        Provides a short-circuit operator that executes the second +expression only if the first one evalutes to true (i.e. it is +not nil nor false). Returns the first expression otherwise.

        Examples

        -
        cond do
        -  1 + 1 == 2 ->
        -    "This will never match"
        -  2 * 2 != 4 ->
        -    "Nor this"
        -  true ->
        -    "This will"
        -end
        +
        true && true         #=> true
        +nil && true          #=> nil
        +true && 1            #=> 1
        +false && error(:bad) #=> false
         
        + +

        Notice that, differently from Erlang and operator, +this operator accepts any expression as arguments, +not only booleans, however it is not allowed in guards.

        - Source + Source
        -

        - def(name, list2) +

        + *(left, right)

        -

        Defines a function with the given name and contents.

        +

        Arithmetic multiplication. Allowed in guard clauses.

        Examples

        -
        defmodule Foo do
        -  def bar, do: :baz
        -end
        -
        -Foo.bar #=> :baz
        +
        1 * 2 #=> 2
         
        +
        + Source +
        +

        + +(left, right) +

        +

        Arithmetic plus. Allowed in guard clauses.

        -

        A function that expects arguments can be defined as follow:

        +

        Examples

        -
        defmodule Foo do
        -  def sum(a, b) do
        -    a + b
        -  end
        -end
        +
        1 + 2 #=> 3
         
        +
        + Source +
        +

        + ++(left, right) +

        +

        Concatenates two lists. Allowed in guard clauses.

        -

        In the example above, we defined a function sum that receives -two arguments and sum them.

        - -

        Dynamic generation with atoms

        +

        Examples

        -

        Elixir follows the same rule as Erlang when it comes to -function invocations. Calling a function is the same thing -as "invoking at atom". That said, we could invoke a function -named sum in these two equivalent ways:

        +
        [1] ++ [2,3]
        +#=> [1,2,3]
         
        -
        sum(1, 2)
        -:sum.(1, 2)
        +'foo' ++ 'bar'
        +#=> 'foobar'
         
        +
        + Source +
        +

        + -(left, right) +

        +

        Arithmetic minus. Allowed in guard clauses.

        -

        We can also use the atom format to define functions:

        +

        Examples

        -
        defmodule Foo do
        -  def :sum.(a, b) do
        -    a + b
        -  end
        -end
        +
        1 - 2 #=> -1
         
        +
        + Source +
        +

        + --(left, right) +

        +

        Removes the first occorrence of an item on the left +for each item on the right. Allowed in guard clauses.

        -

        In general, a developer never needs to use the format above -except when he wants to dynamically define functions with macros. -In such scenarios, the name needs to be given dynamically via -the unquoting mechanism.

        - -

        Imagine a macro that receives keywords and defines a function -for each entry in the keyword, using the key as function name -and the value as the value returned by the function:

        - -
        defmacro defkv(keywords) do
        -  Enum.map keywords, fn {k,v} ->
        -    quote do
        -      def unquote(k).() do
        -        unquote(v)
        -      end
        -    end
        -  end
        -end
        -
        +

        Examples

        -

        This macro could be invoked as:

        +
        [1,2,3] -- [1,2]
        +#=> [3]
         
        -
        defkv one: 1, two: 2
        +[1,2,3,2,1] -- [1,2,2]
        +#=> [3,1]
         
        - -

        Notice in the example above, we define the function as def unquote(k).() -because each entry k is a an atom and invoking def unquote(k)() -would be invalid Elixir syntax.

        - Source + Source
        -

        - def(name, args, guards, list4) +

        + ..(first, last)

        -

        This macro allows a function to be defined more explicitly -by accepting the name, args and guards as different entries.

        - -

        Differently from def/2, the macro arguments are evaluated -and therefore requires quoting.

        - -

        The name must be an atom, the arguments a list where each -element represents another argument and guards a list of -clauses, where each clause is disjunct.

        +

        Returns a range with the specified start and end. +Includes both ends.

        Examples

        -

        The most common mistake when using this macro is to pass the -arguments without quoting:

        - -
        def :some_function, [first_arg, second_arg], is_list(first_arg) do
        -  # ...
        -end
        +
        0 in 1..3 #=> false
        +1 in 1..3 #=> true
        +2 in 1..3 #=> true
        +3 in 1..3 #=> true
         
        +
        + Source +
        +

        + /(left, right) +

        +

        Arithmetic division. Differently from other languages, +the result is always a float. Use div and rem if you want +a natural division or the remainder. Allowed in guard clauses.

        -

        However, the example above will fail because it will attempt to -evaluate [first_arg, second_arg] and fail because the variable -first_arg is not defined. Therefore, we need to use quote:

        - -
        name   = :some_function
        -args   = quote(do: [first_arg, second_arg])
        -guards = quote(do: is_list(first_arg))
        -exprs  = quote(do: ...)
        +

        Examples

        -def name, args, guards, do: exprs +
        1 / 2 #=> 0.5
        +2 / 1 #=> 2.0
         
        - Source + Source
        -

        - defdelegate(funs, opts) +

        + />(left, right)

        -

        Defines the given functions in the current module that will -delegate to the given target. Functions defined with -defdelegate are public and are allowed to be invoked -from external. If you find yourself wishing to define a -delegation as private, you should likely use import -instead.

        - -

        Delegation only works with functions, delegating to macros -is not supported.

        - -

        Options

        - -
          -
        • :to - The expression to delegate to. Any expression -is allowed and its results will be calculated on runtime;

        • -
        • :as - The function to call on the target given in :to. -This parameter is optional and defaults to the name being -delegated.

        • -
        • :append_first - If true, when delegated, first argument -passed to the delegate will be relocated to the end of the -arguments when dispatched to the target. The motivation behind -this is a disparity between conventions used in Elixir and Erlang. -Elixir's convention is to pass the "handle" as a first argument, -while in Erlang the convention is to pass it as the last argument

        • -
        +

        /> is called the pipeline operator as it is useful +to write pipeline style expressions. This operator +tntroduces the expression on the left as the first +argument to the expression on the right.

        Examples

        -
        defmodule MyList do
        -  defdelegate reverse(list), to: :lists
        -  defdelegate [reverse(list), map(callback, list)], to: :lists
        -  defdelegate other_reverse(list), to: :lists, as: :reverse
        -end
        +
        [1,[2],3] /> List.flatten /> Enum.map(&1 * 2)
        +#=> [2,4,6]
        +
        -My:lists.reverse([1,2,3]) -#=> [3,2,1] +

        The expression above is simply translated to:

        -MyList.other_reverse([1,2,3]) -#=> [3,2,1] +
        Enum.map(List.flatten([1,[2],3]), &1 * 2)
         
        - Source + Source
        -

        - defexception(name, values, opts // [], do_block // []) +

        + <(left, right)

        -

        Defines an exception.

        +

        Return true if left is less than right. +As Erlang, Elixir can compare any term. Allowed in guard clauses.

        -

        Exceptions are simply records and therefore defexception/4 has -the same API and similar behavior to defrecord/4 with two notable -differences:

        +

        Examples

        -

        1) Differently from records, exceptions are documented by default; -2) Exceptions must implement message/1 as API and return a - binary as result;

        +
        1 < 2
        +#=> true
        +
        - Source + Source
        -

        - defimpl(name, opts, do_block // []) +

        + <-(pid, msg)

        -

        Defines an implementation for the given protocol. See -defprotocol/2 for examples.

        +

        Sends a message to the process identified on the left. +A process can be identified bu its PID or, if it is registered, +by an atom.

        + +

        Examples

        + +
        process = Process.self
        +process <- { :ok, "Sending myself a message" }
        +
        - Source + Source
        -

        - defmodule(name, list2) +

        + <=(left, right)

        -

        Defines a module given by name with the given contents.

        - -

        It returns the module name, the module binary and the -block contents result.

        +

        Return true if left is less than or equal to right. +As Erlang, Elixir can compare any term. Allowed in guard clauses.

        Examples

        -
        defmodule Foo do
        -  def bar, do: :baz
        -end
        -
        -Foo.bar #=> :baz
        +
        1 <= 2
        +#=> true
         
        +
        + Source +
        +

        + <>(left, right) +

        +

        Concatenates two binaries.

        -

        Nesting

        - -

        Nesting a module inside the other affects its name:

        +

        Examples

        -
        defmodule Foo do
        -  defmodule Bar do
        -  end
        -end
        +
        "foo" <> "bar" #=> "foobar"
         
        -

        In the example above, two modules Foo and Foo.Bar. The -second can be accessed as Bar inside Foo in the same -lexical scope. If the module Bar is moved away to another -file, it needs to be referenced via the full name or an -alias need to be set with the help of Kernel.SpecialForms.alias/2.

        - -

        Dynamic names

        - -

        Elixir module names can be dynamically generated. This is very -useful for macros. For instance, one could write:

        +

        The <> operator can also be used in guard clauses as +long as the first part is a literal binary:

        -
        defmodule binary_to_atom("Foo#{1}", :utf8) do
        -  # contents ...
        -end
        +
        "foo" <> x = "foobar"
        +x #=> "bar"
         
        - -

        Elixir will accept any module name as long as the expression -returns an atom.

        -
        - Source -
        -

        - defoverridable(tuples) -

        -

        Makes the given functions in the current module overridable. -An overridable function is lazily defined, allowing a -developer to customize it.

        - Source + Source
        -

        - defp(name, list2) +

        + ==(left, right)

        -

        Defines a function that is private. Private functions -can only be accessible from the same module it is defined.

        +

        Returns true if the two items are equal.

        -

        Check def/2 for more information

        +

        This operator considers 1 and 1.0 to be equal. For strict +comparison, use === instead.

        + +

        As Erlang, Elixir can compare any term. Allowed in guard clauses.

        Examples

        -
        defmodule Foo do
        -  def bar do
        -    sum(1, 2)
        -  end
        +
        1 == 2
        +#=> false
         
        -  defp sum(a, b), do: a + b
        -end
        +1 == 1.0
        +#=> true
         
        - -

        In the example above, sum is private and accessing it -through Foo.sum will raise an error.

        - Source + Source
        -

        - defp(name, args, guards, list4) +

        + ===(left, right)

        -

        The same as def/4 but generates a private function.

        -
        - Source -
        -

        - defprotocol(name, list2) -

        -

        Defines the current module as a protocol and specifies the API -that should be implemented.

        +

        Returns true if the two items are strictly equal. +As Erlang, Elixir can compare any term. Allowed in guard clauses.

        Examples

        -

        In Elixir, only false and nil are considered falsy values. -Everything else evaluates to true in if clauses. Depending -on the application, it may be important to specify a blank? -protocol that returns a boolean for other data types that should -be considered blank?. For instance, an empty list or an empty -binary could be considered blanks.

        - -

        We could implement this protocol as follow:

        +
        1 === 2
        +#=> false
         
        -
        defprotocol Blank do
        -  @doc "Returns true if data is considered blank/empty"
        -  def blank?(data)
        -end
        +1 === 1.0
        +#=> false
         
        +
        + Source +
        +

        + =~(left, right) +

        +

        Matches the term on the left against the regular expression +on the right. It returns nil if not match happened or the +first match otherwise.

        -

        Now that the protocol is defined, we can implement it. We need -to implement the protocol for each Elixir type. For example:

        - -
        # Numbers are never blank
        -defimpl Blank, for: Number do
        -  def blank?(number), do: false
        -end
        -
        -# Just empty list is blank
        -defimpl Blank, for: List do
        -  def blank?([]), do: true
        -  def blank?(_),  do: false
        -end
        +

        Examples

        -# Just the atoms false and nil are blank -defimpl Blank, for: Atom do - def blank?(false), do: true - def blank?(nil), do: true - def blank?(_), do: false -end +
        "abcd" =~ %r/c(d)/  #=> 2
        +"abcd" =~ %r/e/     #=> nil
         
        +
        + Source +
        +

        + >(left, right) +

        +

        Return true if left is more than right. +As Erlang, Elixir can compare any term. Allowed in guard clauses.

        -

        And we would have to define the implementation for all types. -The types available are:

        - -
          -
        • Record
        • -
        • Tuple
        • -
        • Atom
        • -
        • List
        • -
        • BitString
        • -
        • Number
        • -
        • Function
        • -
        • PID
        • -
        • Port
        • -
        • Reference
        • -
        • Any
        • -
        +

        Examples

        -

        Selecting implementations

        +
        1 > 2
        +#=> false
        +
        +
        + Source +
        +

        + >=(left, right) +

        +

        Return true if left is more than or equal to right. +As Erlang, Elixir can compare any term. Allowed in guard clauses.

        -

        Implementing the protocol for all default types can be cumbersome. -Even more, if you consider that Number, Function, PID, Port and -Reference are never going to be blank, it would be easier if we -could simply provide a default implementation.

        +

        Examples

        -

        This can be achieved with Elixir as follows:

        +
        1 >= 2
        +#=> false
        +
        +
        + Source +
        +

        + @(expr) +

        +

        This macro is a shortcut to read and add attributes to the module +being compiled. Elixir module attributes are similar to Erlang's with +some differences. The canonical example for attributes is annotating +that a module implements the OTP behavior called gen_server:

        -
        defprotocol Blank do
        -  @only [Atom, Tuple, List, BitString, Any]
        -  def blank?(data)
        +
        defmodule MyServer do
        +  @behavior :gen_server
        +  # ... callbacks ...
         end
         
        -

        If the protocol is invoked with a data type that is not an Atom, -nor Tuple, nor List, nor BitString, Elixir will now dispatch to -Any. That said, the default behavior could be implemented as:

        +

        Elixir supports by default all Erlang module attributes but any developer +can also add custom attributes:

        -
        defimpl Blank, for: Any do
        -  def blank?(_), do: false
        +
        defmodule MyServer do
        +  @my_data 13
        +  IO.inspect @my_data #=> 13
         end
         
        -

        Now, all data types that we have not specified will be -automatically considered non blank.

        - -

        Protocols + Records

        +

        Differently from Erlang, such attributes are not stored in the module by +default since it is common in Elixir to use such attributes to store +temporary data. A developer can configure an attribute to behave closer +to Erlang by calling Module.register_attribute/2.

        -

        The real benefit of protocols comes when mixed with records. For instance, -imagine we have a module called RedBlack that provides an API to create -and manipulate Red-Black trees. This module represents such trees via a -record named RedBlack.Tree and we want this tree to be considered blank -in case it has no items. To achieve this, the developer just needs to -implement the protocol for RedBlack.Tree:

        +

        Finally notice that attributes can also be read inside functions:

        -
        defimpl Blank, for: RedBlack.Tree do
        -  def blank?(tree), do: RedBlack.empty?(tree)
        +
        defmodule MyServer do
        +  @my_data 11
        +  def first_data, do: @my_data
        +  @my_data 13
        +  def second_data, do: @my_data
         end
        -
        -

        In the example above, we have implemented blank? for RedBlack.Tree -that simply delegates to RedBlack.empty? passing the tree as argument. -This implementation doesn't need to be defined inside the RedBlack -tree or inside the record, but anywhere in the code.

        +MyServer.first_data #=> 11 +MyServer.second_data #=> 13 +
        -

        Finally, since records are simply tuples, one can add a default protocol -implementation to any record by defining a default implementation for tuples.

        +

        It is important to note that reading an attribute takes a snapshot of +its current value. In other words, the value is read at compilation +time and not at runtime. Check the module Module for other functions +to manipulate module attributes.

        - Source + Source
        -

        - defrecord(name, values, opts // [], do_block // []) +

        + __B__(string, list2)

        -

        Define a record given by name and values.

        +

        Handles the sigil %B. It simples returns a binary +without escaping characters and without interpolations.

        Examples

        -
        defrecord FileInfo, atime: nil, mtime: nil
        +
        %B(foo)      #=> "foo"
        +%B(f#{o}o)  #=> "f\#{o}o"
         
        +
        + Source +
        +

        + __C__(arg1, list2) +

        +

        Handles the sigil %C. It simply returns a char list +without escaping characters and without interpolations.

        -

        The line above will define a module named FileInfo which -contains a function named new that returns a new record -and other functions to read and set the values in the -record. Therefore, we can do:

        +

        Examples

        -
        file_info = FileInfo.new(atime: now())
        -file_info.atime         #=> Returns the value of atime
        -file_info.atime(now())  #=> Updates the value of atime
        +
        %C(foo)      #=> 'foo'
        +%C(f#{o}o)  #=> 'f\#{o}o'
         
        +
        + Source +
        +

        + __R__(arg1, options) +

        +

        Handles the sigil %R. It returns a Regex pattern without escaping +nor interpreting interpolations.

        -

        Internally, a record is simply a tuple where the first element is -the record module name. This can be noticed if we print the record:

        +

        Examples

        -
        IO.inspect FileInfo.new
        -{ FileInfo, nil, nil }
        +
        Regex.match? %R(f#{1,3}o), "f#o"  #=> true
         
        +
        + Source +
        +

        + __b__(arg1, list2) +

        +

        Handles the sigil %b. It returns a binary as if it was double quoted +string, unescaping characters and replacing interpolations.

        -

        Extensions

        - -

        Besides defining readers and writers for each attribute. Elixir will -define extensions functions for each attribute. By default, it will -define an update_#{attribute} function to update the value. Such -functions expect a function as argument that receives the current value -and must return the new one:

        +

        Examples

        -
        file_info.update_atime(fn(_old) -> now() end) #=> Updates the value of atime
        +
        %b(foo)       #=> "foo"
        +%b(f#{:o}o)  #=> "foo"
         
        +
        + Source +
        +

        + __c__(arg1, list2) +

        +

        Handles the sigil %c. It returns a char list as if it was a single +quoted string, unescaping characters and replacing interpolations.

        -

        Besides, Elixir may define new functions depending on the default value. -For example, ExUnit defines a record which keeps track of how many tests -were executed and the failures that happened. The record definition is -similar to:

        +

        Examples

        -
        defrecord Config, counter: 0, failures: []
        +
        %c(foo)       #=> 'foo'
        +%c(f#{:o}o)  #=> 'foo'
         
        +
        + Source +
        +

        + __r__(arg1, options) +

        +

        Handles the sigil %r. It returns a Regex pattern.

        -

        Since counter is an integer, Elixir automatically defines a helper -named increment_counter that will increase the counter value:

        +

        Examples

        -
        Config.new.increment_counter.counter #=> 1
        +
        Regex.match? %r(foo), "foo"  #=> true
         
        +
        + Source +
        +

        + access(element, args) +

        +

        Access the given element using the qualifier according +to the Access protocol. All calls in the form foo[bar] +are translated to access(foo, bar).

        -

        increment_counter also accepts a number of increment as argument:

        +

        The usage of this protocol is to access a raw value in a +keyword list.

        -
        Config.new.increment_counter(10).counter #=> 10
        +
        sample = [a: 1, b: 2, c: 3]
        +sample[:b] #=> 2
         
        -

        Besides, if the default is a list, Elixir will define two helpers:

        +

        Atoms

        -
          -
        • merge_field - Receives keywords and merge it into the current value;
        • -
        • prepend_field - Receives another list and prepend its values
        • -
        +

        Whenever invoked on an atom, the access protocol is expanded +at compilation time rather than on runtime. This feature is used +by records to allow a developer to match against an specific part +of a record:

        -

        You can define your own extensions or disable them using the except -option:

        +
        def increment(State[counter: counter, other: 13] = state) do
        +  state.counter(counter + 1)
        +end
        +
        -
        defrecord Config, [counter: 0, failures: []], except: [:extensions]
        +

        In the example above, we use the Access protocol to match the +counter field in the record State. Considering the record +definition is as follows:

        + +
        defrecord State, counter: 0, other: nil
         
        -

        Documentation

        +

        The clause above is translated to:

        -

        By default records are not documented and have @moduledoc set to false.

        -
        - Source -
        -

        - destructure(left, right) -

        -

        Allows you to destructure two lists, assigning each -term in the right to the left. Differently from pattern -matching via =, if the sizes of the left and right -lists don't match,, structuring simply stops instead -of raising an error.

        +
        def increment({ State, counter, 13 } = state) do
        +  state.counter(counter + 1)
        +end
        +
        -

        Examples

        +

        The same pattern can be used to create a new record:

        -
        destructure [x,y,z], [1,2,3,4,5]
        -x #=> 1
        -y #=> 2
        -z #=> 3
        +
        def new_state(counter) do
        +  State[counter: counter]
        +end
         
        -

        Notice in the example above, even though the right -size has more entries than the left, structuring works -fine. If the right size is smaller, the remaining items -are simply assigned to nil:

        +

        The example above is slightly faster than State.new(counter: :counter) +because the record is expanded at compilation time and not at runtime. +If a field is not specified on creation, it will have its default value.

        -
        destructure [x,y,z], [1]
        -x #=> 1
        -y #=> nil
        -z #=> nil
        +

        Finally, as in Erlang, Elixir also allows the following syntax:

        + +
        new_uri = State[_: 1]
         
        -

        The left side supports any expression you would use -on the left side of a match:

        +

        In this case all fields will be set to 1. Notice that, +as in Erlang, in case an expression is given, it will be +evaluated multiple times:

        -
        x = 1
        -destructure [^x,y,z], [1,2,3]
        +
        new_uri = State[_: IO.puts "Hello"]
         
        -

        The example above will only work if x matches -the first value from the right side. Otherwise, -it will raise a CaseClauseError.

        +

        In this case, "Hello" will be printed twice (one per each field).

        + +

        Examples

        + +
        a = { :a, :b, :c }
        +a[1] #=> :a
        +access a, 1 #=> :a
        +
        - Source + Source
        -

        - div(left, right) +

        + and(left, right)

        -

        Provides an integer division macro according to Erlang semantics. -Raises an error if one of the arguments is not an integer. -Can be used in guard tests.

        +

        Boolean and. Arguments needs to necessarily be booleans. +Allowed in guard clauses.

        Examples

        -
        div 5, 2 #=> 2
        +
        true and false
        +#=> false
         
        - Source + Source
        -

        - elem(tuple, index) +

        + atom_to_binary(some_atom)

        -

        Define elem to get Tuple element according to Elixir conventions -(i.e. it expects the tuple as first argument, zero-index based).

        - -

        It is implemented as a macro so it can be used in guards.

        +

        Returns a binary which corresponds to the text representation +of some_atom in UTF8 encoding.

        -

        Example

        +

        Examples

        -

        tuple = { :foo, :bar, 3 } - elem(tuple, 1) #=> :bar

        +
        atom_to_binary :my_atom #=> "my_atom"
        +
        - Source + Source
        -

        - exit(reason) +

        + binary_to_atom(some_binary)

        -

        Stops the execution of the calling process with the given reason. -Since evaluating this function causes the process to terminate, -it has no return value.

        +

        Returns the atom whose text representation is +some_binary in UTF8 encoding.

        Examples

        -
        exit(:normal)
        -exit(:seems_bad)
        +
        binary_to_atom "my_atom" #=> :my_atom
         
        - Source + Source
        -

        - float(number) +

        + binary_to_existing_atom(some_binary)

        -

        Converts the given number to a float. Allowed in guard clauses.

        +

        Works like binary_to_atom but the atom must exist.

        + +

        Examples

        + +
        :my_atom                          #=> :my_atom
        +binary_to_existing_atom "my_atom" #=> :my_atom
        +
        - Source + Source
        -

        - float_to_list(number) +

        + binary_to_float(some_binary)

        -

        Returns a char list which corresponds to the text representation of the given float.

        +

        Returns a float whose text representation is some_binary.

        Examples

        -
        float_to_list(7.0)
        -#=> '7.00000000000000000000e+00'
        +
        binary_to_float "2.2017764e+0" #=> 2.2017764
         
        - Source + Source
        -

        - function(args) +

        + binary_to_integer(some_binary)

        -

        Returns an anonymous function based on the given arguments.

        +

        Returns a integer whose text representation is some_binary.

        Examples

        -
        sum = function do
        -  (x, y) -> x + y
        -end
        -
        -sum.(1, 2) #=> 3
        +
        binary_to_integer "123" #=> 123
         
        +
        + Source +
        +

        + binary_to_integer(some_binary, base) +

        +

        Returns an integer whose text representation in base base +is some_binary.

        -

        Notice that a function needs to be invoked using the dot between -the function and the arguments.

        +

        Examples

        -

        Multiple clauses can be specified as in case, receive and -similar macros:

        +
        binary_to_integer("3FF", 16) #=> 1023
        +
        +
        + Source +
        +

        + case(condition, blocks) +

        +

        Matches the given condition against the match clauses.

        -
        sum = function do
        -  x, y when y > 0 -> x + y
        -  x, y -> x - y
        -end
        +

        Examples

        -sum.(1, 2) #=> 3 +
        case thing do
        +  { :selector, i, value } when is_integer(i) ->
        +    value
        +  value -> value
        +end
         
        -

        Shortcut syntax

        +

        In the example above, we compare thing with each given +match clause and execute the first one that matches. If no +clause matches, an error is raised.

        -

        In order to reduce verbosity, functions in Elixir can be written -using a shortcut syntax via fn:

        +

        Since Elixir variables can be assigned more than once, variables +in a match clause will always be assigned instead of matching with +its previous values. For example:

        -
        Enum.map [1,2,3], fn x ->
        -  x * 2
        +
        i = 1
        +case 10 do
        +  i -> i * 2
         end
         
        -

        Not only the example is shorter, it solves ambiguity issues. Since -do/end always matches the furthest call, if we used the function -macro as below:

        +

        The example above will return 20, because i is assigned to 10 +and then multiplied by 2. If you desire to match the value of i +against the given condition, you need to use the ^ operator:

        -
        Enum.map [1,2,3], function(x) do
        -  x * 2
        +
        i = 1
        +case 10 do
        +  ^i -> i * 2
         end
         
        -

        It would be parsed as:

        +

        The example above will actually fail because 10 does not match 1.

        -
        Enum.map([1,2,3], function(x)) do
        -  x * 2
        +

        Finally, case accepts an else: branch as a fallback if none +of the clauses match:

        + +
        case thing do
        +  { :selector, i, value } when is_integer(i) ->
        +    value
        +  _ ->
        +    thing
         end
         
        +
        + Source +
        +

        + cond(list1) +

        +

        Execute the first clause where the condition returns true, +raises an error otherwise.

        -

        The stab shortcut syntax has the proper precedence:

        +

        Examples

        -
        Enum.map [1,2,3], fn x ->
        -  x * 2
        +
        cond do
        +  1 + 1 == 2 ->
        +    "This will never match"
        +  2 * 2 != 4 ->
        +    "Nor this"
        +  true ->
        +    "This will"
         end
         
        +
        + Source +
        +

        + def(name, list2) +

        +

        Defines a function with the given name and contents.

        -

        Which is handled as:

        +

        Examples

        -
        Enum.map([1,2,3], fn x ->
        -  x * 2
        -end)
        +
        defmodule Foo do
        +  def bar, do: :baz
        +end
        +
        +Foo.bar #=> :baz
         
        -

        Function retrieval

        +

        A function that expects arguments can be defined as follow:

        -

        The function macro can also be used to retrieve local or remote -functions:

        +
        defmodule Foo do
        +  def sum(a, b) do
        +    a + b
        +  end
        +end
        +
        -
        f = function(:is_atom, 2)
        -f.(:foo) #=> true
        +

        In the example above, we defined a function sum that receives +two arguments and sum them.

        -f = function(List, :flatten, 1) -f.([1,[2],3]) #=> [1,2,3] -
        -
        - Source -
        -

        - function_exported?(module, function, arity) -

        -

        Returns true if the module is loaded and contains a -public function with the given arity, otherwise false.

        - -

        Notice that this function does not load the module in case -it is not loaded. Check Code.ensure_loaded/1 for more -information.

        -
        - Source -
        -

        - halt() -

        -

        The same as halt(0, []).

        -
        - Source -
        -

        - halt(status) -

        -

        The same as halt(status, []).

        -
        - Source -
        -

        - halt(status, options) -

        -

        Halts the Erlang runtime system where the first argument status must be a -non-negative integer, a char list, or the atom :abort.

        - -
          -
        • If an integer, the runtime system exits with the integer value which -is returned to the Operating System;

        • -
        • If a char list, an erlang crash dump is produced with status as slogan, -and then the runtime system exits with status code 1;

        • -
        • If :abort, the runtime system aborts producing a core dump, if that is -enabled in the operating system.

        • -
        - -

        Note that on many platforms, only the status codes 0-255 are supported -by the operating system.

        - -

        For integer status, Erlang runtime system closes all ports and allows async -threads to finish their operations before exiting. To exit without such -flushing, pass options [flush: false] instead.

        - -

        Examples

        - -
        halt(0)
        -halt(1, flush: false)
        -halt(:abort)
        -
        -
        - Source -
        -

        - hd(list) -

        -

        Returns the head of a list, raises badarg if the list is empty.

        -
        - Source -
        -

        - if(condition, list2) -

        -

        Provides an if macro. This macro expects the first argument to -be a condition and the rest are keyword arguments.

        +

        Dynamic generation with atoms

        -

        One-liner examples

        +

        Elixir follows the same rule as Erlang when it comes to +function invocations. Calling a function is the same thing +as "invoking at atom". That said, we could invoke a function +named sum in these two equivalent ways:

        -
        if(foo, do: bar)
        +
        sum(1, 2)
        +:sum.(1, 2)
         
        -

        In the example above, bar will be returned if foo evalutes to -true (i.e. it is not false nor nil). Otherwise, nil will be returned.

        - -

        An else option can be given to specify the opposite:

        +

        We can also use the atom format to define functions:

        -
        if(foo, do: bar, else: bar)
        +
        defmodule Foo do
        +  def :sum.(a, b) do
        +    a + b
        +  end
        +end
         
        -

        Blocks examples

        +

        In general, a developer never needs to use the format above +except when he wants to dynamically define functions with macros. +In such scenarios, the name needs to be given dynamically via +the unquoting mechanism.

        -

        Elixir also allows you to pass a block to the if macro. The first -example above would be translated to:

        +

        Imagine a macro that receives keywords and defines a function +for each entry in the keyword, using the key as function name +and the value as the value returned by the function:

        -
        if foo do
        -  bar
        +
        defmacro defkv(keywords) do
        +  Enum.map keywords, fn {k,v} ->
        +    quote do
        +      def unquote(k).() do
        +        unquote(v)
        +      end
        +    end
        +  end
         end
         
        -

        Notice that do/end becomes delimiters. The second example would -then translate do:

        +

        This macro could be invoked as:

        -
        if foo do
        -  bar
        -else
        -  baz
        -end
        +
        defkv one: 1, two: 2
         
        -

        If you want to compare more than two clauses, you can use the cond/1 -macro.

        +

        Notice in the example above, we define the function as def unquote(k).() +because each entry k is a an atom and invoking def unquote(k)() +would be invalid Elixir syntax.

        - Source + Source
        -

        - in(left, right) +

        + def(name, args, guards, list4)

        -

        Returns true if the element on the left is equal (==) to -any of the items in the right. For now, it only accepts -a list as the right argument.

        - -

        Examples

        - -
        x = 1
        -x in [1,2,3] #=> true
        -
        +

        This macro allows a function to be defined more explicitly +by accepting the name, args and guards as different entries.

        -

        This macro simply translates the expression above to:

        +

        Differently from def/2, the macro arguments are evaluated +and therefore requires quoting.

        -
        x == 1 or x == 2 or x == 3
        -
        +

        The name must be an atom, the arguments a list where each +element represents another argument and guards a list of +clauses, where each clause is disjunct.

        -

        Clauses

        +

        Examples

        -

        Whenever used inside a function or a case clause, you can -optionally omit the variable declaration, for example:

        +

        The most common mistake when using this macro is to pass the +arguments without quoting:

        -
        case 3 do
        -  x when x in [1,2] -> x * 2
        -  _ -> 0
        +
        def :some_function, [first_arg, second_arg], is_list(first_arg) do
        +  # ...
         end
         
        -

        Could be rewritten as:

        +

        However, the example above will fail because it will attempt to +evaluate [first_arg, second_arg] and fail because the variable +first_arg is not defined. Therefore, we need to use quote:

        -
        case 3 do
        -  x in [1,2] -> x * 2
        -  _ -> 0
        -end
        -
        +
        name   = :some_function
        +args   = quote(do: [first_arg, second_arg])
        +guards = quote(do: is_list(first_arg))
        +exprs  = quote(do: ...)
         
        -

        In this case, Elixir will automatically expand it and define -the variable for us.

        +def name, args, guards, do: exprs +
        - Source + Source
        -

        - inspect(arg, opts // []) +

        + defdelegate(funs, opts)

        -

        Inspect the given arguments according to the Binary.Inspect protocol.

        +

        Defines the given functions in the current module that will +delegate to the given target. Functions defined with +defdelegate are public and are allowed to be invoked +from external. If you find yourself wishing to define a +delegation as private, you should likely use import +instead.

        -

        Options

        +

        Delegation only works with functions, delegating to macros +is not supported.

        -

        The following options are supported:

        +

        Options

          -
        • :raw - tuples are not formatted as the inspect protocol, they are -always shown as tuples, defaults to false;

        • -
        • :limit - the limit of items that are shown in tuples, bitstrings and -lists. Do not apply to strings;

        • +
        • :to - The expression to delegate to. Any expression +is allowed and its results will be calculated on runtime;

        • +
        • :as - The function to call on the target given in :to. +This parameter is optional and defaults to the name being +delegated.

        • +
        • :append_first - If true, when delegated, first argument +passed to the delegate will be relocated to the end of the +arguments when dispatched to the target. The motivation behind +this is a disparity between conventions used in Elixir and : +Elixir's convention is to pass the "handle" as a first argument, +while in Erlang the convention is to pass it as the last argument

        Examples

        -
        inspect(:foo)
        -#=> ":foo"
        +
        defmodule MyList do
        +  defdelegate reverse(list), to: :lists
        +  defdelegate [reverse(list), map(callback, list)], to: :lists
        +  defdelegate other_reverse(list), to: :lists, as: :reverse
        +end
        +
        +My:lists.reverse([1,2,3])
        +#=> [3,2,1]
        +
        +MyList.other_reverse([1,2,3])
        +#=> [3,2,1]
         
        - Source + Source
        -

        - integer_to_list(number) +

        + defexception(name, values, opts // [], do_block // [])

        -

        Returns a char list which corresponds to the text representation of the given integer.

        +

        Defines an exception.

        -

        Examples

        +

        Exceptions are simply records and therefore defexception/4 has +the same API and similar behavior to defrecord/4 with two notable +differences:

        -
        integer_to_list(7)
        -#=> '7'
        -
        +

        1) Differently from records, exceptions are documented by default; +2) Exceptions must implement message/1 as API and return a + binary as result;

        - Source + Source
        -

        - integer_to_list(number, base) +

        + defimpl(name, opts, do_block // [])

        -

        Returns a char list which corresponds to the text representation of the -given integer in the given case.

        - -

        Examples

        - -
        integer_to_list(1023, 16).
        -#=> "3FF"
        -
        +

        Defines an implementation for the given protocol. See +defprotocol/2 for examples.

        - Source + Source
        -

        - iolist_size(item) +

        + defmodule(name, list2)

        -

        Returns the size of an iolist.

        +

        Defines a module given by name with the given contents.

        + +

        It returns the module name, the module binary and the +block contents result.

        Examples

        -
        iolist_size([1,2|<<3,4>>])
        -#=> 4
        +
        defmodule Foo do
        +  def bar, do: :baz
        +end
        +
        +Foo.bar #=> :baz
         
        -
        - Source -
        -

        - iolist_to_binary(item) -

        -

        Returns a binary which is made from the integers and binaries in iolist.

        -

        Examples

        +

        Nesting

        -
        bin1 = <<1,2,3>>
        -bin2 = <<4,5>>
        -bin3 = <<6>>
        +

        Nesting a module inside the other affects its name:

        -iolist_to_binary([bin1,1,[2,3,bin2],4|bin3]) -#=> <<1,2,3,1,2,3,4,5,4,6>> +
        defmodule Foo do
        +  defmodule Bar do
        +  end
        +end
         
        + +

        In the example above, two modules Foo and Foo.Bar. The +second can be accessed as Bar inside Foo in the same +lexical scope. If the module Bar is moved away to another +file, it needs to be referenced via the full name or an +alias need to be set with the help of Kernel.SpecialForms.alias/2.

        + +

        Dynamic names

        + +

        Elixir module names can be dynamically generated. This is very +useful for macros. For instance, one could write:

        + +
        defmodule binary_to_atom("Foo#{1}", :utf8) do
        +  # contents ...
        +end
        +
        + +

        Elixir will accept any module name as long as the expression +returns an atom.

        - Source + Source
        -

        - is_alive() +

        + defoverridable(tuples)

        -

        Returns true if the local node is alive; that is, -if the node can be part of a distributed system.

        +

        Makes the given functions in the current module overridable. +An overridable function is lazily defined, allowing a +developer to customize it.

        - Source + Source
        -

        - is_atom(term) +

        + defp(name, list2)

        -

        Returns true if term is an atom; otherwise returns false.

        +

        Defines a function that is private. Private functions +can only be accessible from the same module it is defined.

        -

        Allowed in guard tests.

        -
        - Source -
        -

        - is_binary(term) -

        -

        Returns true if term is a binary; otherwise returns false.

        +

        Check def/2 for more information

        -

        A binary always contains a complete number of bytes.

        +

        Examples

        -

        Allowed in guard tests.

        -
        - Source -
        -

        - is_bitstring(term) -

        -

        Returns true if term is a bitstring (including a binary); otherwise returns false.

        +
        defmodule Foo do
        +  def bar do
        +    sum(1, 2)
        +  end
         
        -

        Allowed in guard tests.

        + defp sum(a, b), do: a + b +end +
        + +

        In the example above, sum is private and accessing it +through Foo.sum will raise an error.

        - Source + Source
        -

        - is_boolean(term) +

        + defp(name, args, guards, list4)

        -

        Returns true if term is either the atom true or the atom false (i.e. a boolean); -otherwise returns false.

        - -

        Allowed in guard tests.

        +

        The same as def/4 but generates a private function.

        - Source + Source
        -

        - is_exception(thing) +

        + defprotocol(name, list2)

        -

        Check if the given structure is an exception.

        +

        Defines the current module as a protocol and specifies the API +that should be implemented.

        Examples

        -
        is_exception(Error.new) #=> true
        -is_exception(1)         #=> false
        +

        In Elixir, only false and nil are considered falsy values. +Everything else evaluates to true in if clauses. Depending +on the application, it may be important to specify a blank? +protocol that returns a boolean for other data types that should +be considered blank?. For instance, an empty list or an empty +binary could be considered blanks.

        + +

        We could implement this protocol as follow:

        + +
        defprotocol Blank do
        +  @doc "Returns true if data is considered blank/empty"
        +  def blank?(data)
        +end
         
        -
        - Source -
        -

        - is_float(term) -

        -

        Returns true if term is a floating point number; otherwise returns false.

        -

        Allowed in guard tests.

        -
        - Source -
        -

        - is_function(term) -

        -

        Returns true if term is a function; otherwise returns false.

        +

        Now that the protocol is defined, we can implement it. We need +to implement the protocol for each Elixir type. For example:

        -

        Allowed in guard tests.

        -
        - Source -
        -

        - is_function(term, arity) -

        -

        Returns true if term is a function that can be applied with arity number of arguments; -otherwise returns false.

        +
        # Numbers are never blank
        +defimpl Blank, for: Number do
        +  def blank?(number), do: false
        +end
         
        -

        Allowed in guard tests.

        -
        - Source -
        -

        - is_integer(term) -

        -

        Returns true if term is an integer; otherwise returns false.

        +# Just empty list is blank +defimpl Blank, for: List do + def blank?([]), do: true + def blank?(_), do: false +end -

        Allowed in guard tests.

        -
        - Source -
        -

        - is_list(term) -

        -

        Returns true if term is a list with zero or more elements; otherwise returns false.

        +# Just the atoms false and nil are blank +defimpl Blank, for: Atom do + def blank?(false), do: true + def blank?(nil), do: true + def blank?(_), do: false +end +
        -

        Allowed in guard tests.

        -
        - Source -
        -

        - is_number(term) -

        -

        Returns true if term is either an integer or a floating point number; -otherwise returns false.

        +

        And we would have to define the implementation for all types. +The types available are:

        -

        Allowed in guard tests.

        -
        - Source -
        -

        - is_pid(term) -

        -

        Returns true if term is a pid (process identifier); otherwise returns false.

        +
          +
        • Record
        • +
        • Tuple
        • +
        • Atom
        • +
        • List
        • +
        • BitString
        • +
        • Number
        • +
        • Function
        • +
        • PID
        • +
        • Port
        • +
        • Reference
        • +
        • Any
        • +
        -

        Allowed in guard tests.

        -
        - Source -
        -

        - is_port(term) -

        -

        Returns true if term is a port identifier; otherwise returns false.

        +

        Selecting implementations

        -

        Allowed in guard tests.

        +

        Implementing the protocol for all default types can be cumbersome. +Even more, if you consider that Number, Function, PID, Port and +Reference are never going to be blank, it would be easier if we +could simply provide a default implementation.

        + +

        This can be achieved with Elixir as follows:

        + +
        defprotocol Blank do
        +  @only [Atom, Tuple, List, BitString, Any]
        +  def blank?(data)
        +end
        +
        + +

        If the protocol is invoked with a data type that is not an Atom, +nor Tuple, nor List, nor BitString, Elixir will now dispatch to +Any. That said, the default behavior could be implemented as:

        + +
        defimpl Blank, for: Any do
        +  def blank?(_), do: false
        +end
        +
        + +

        Now, all data types that we have not specified will be +automatically considered non blank.

        + +

        Protocols + Records

        + +

        The real benefit of protocols comes when mixed with records. For instance, +imagine we have a module called RedBlack that provides an API to create +and manipulate Red-Black trees. This module represents such trees via a +record named RedBlack.Tree and we want this tree to be considered blank +in case it has no items. To achieve this, the developer just needs to +implement the protocol for RedBlack.Tree:

        + +
        defimpl Blank, for: RedBlack.Tree do
        +  def blank?(tree), do: RedBlack.empty?(tree)
        +end
        +
        + +

        In the example above, we have implemented blank? for RedBlack.Tree +that simply delegates to RedBlack.empty? passing the tree as argument. +This implementation doesn't need to be defined inside the RedBlack +tree or inside the record, but anywhere in the code.

        + +

        Finally, since records are simply tuples, one can add a default protocol +implementation to any record by defining a default implementation for tuples.

        - Source + Source
        -

        - is_range(thing) +

        + defrecord(name, values, opts // [], do_block // [])

        -

        Check if the given argument is a range.

        +

        Define a record given by name and values.

        + +

        Examples

        + +
        defrecord FileInfo, atime: nil, mtime: nil
        +
        + +

        The line above will define a module named FileInfo which +contains a function named new that returns a new record +and other functions to read and set the values in the +record. Therefore, we can do:

        + +
        file_info = FileInfo.new(atime: now())
        +file_info.atime         #=> Returns the value of atime
        +file_info.atime(now())  #=> Updates the value of atime
        +
        + +

        Internally, a record is simply a tuple where the first element is +the record module name. This can be noticed if we print the record:

        + +
        IO.inspect FileInfo.new
        +{ FileInfo, nil, nil }
        +
        + +

        Extensions

        + +

        Besides defining readers and writers for each attribute. Elixir will +define extensions functions for each attribute. By default, it will +define an update_#{attribute} function to update the value. Such +functions expect a function as argument that receives the current value +and must return the new one:

        + +
        file_info.update_atime(fn(_old) -> now() end) #=> Updates the value of atime
        +
        + +

        Besides, Elixir may define new functions depending on the default value. +For example, ExUnit defines a record which keeps track of how many tests +were executed and the failures that happened. The record definition is +similar to:

        + +
        defrecord Config, counter: 0, failures: []
        +
        + +

        Since counter is an integer, Elixir automatically defines a helper +named increment_counter that will increase the counter value:

        + +
        Config.new.increment_counter.counter #=> 1
        +
        + +

        increment_counter also accepts a number of increment as argument:

        + +
        Config.new.increment_counter(10).counter #=> 10
        +
        + +

        Besides, if the default is a list, Elixir will define two helpers:

        + +
          +
        • merge_field - Receives keywords and merge it into the current value;
        • +
        • prepend_field - Receives another list and prepend its values
        • +
        + +

        You can define your own extensions or disable them using the except +option:

        + +
        defrecord Config, [counter: 0, failures: []], except: [:extensions]
        +
        + +

        Documentation

        + +

        By default records are not documented and have @moduledoc set to false.

        - Source + Source
        -

        - is_record(thing, kind) +

        + destructure(left, right)

        -

        Check if the given structure is a record. It is basically -a convenient macro that checks the structure is a tuple and -the first element matches the given kind.

        +

        Allows you to destructure two lists, assigning each +term in the right to the left. Differently from pattern +matching via =, if the sizes of the left and right +lists don't match,, structuring simply stops instead +of raising an error.

        Examples

        -
        defrecord Config, sample: nil
        +
        destructure [x,y,z], [1,2,3,4,5]
        +x #=> 1
        +y #=> 2
        +z #=> 3
        +
        + +

        Notice in the example above, even though the right +size has more entries than the left, structuring works +fine. If the right size is smaller, the remaining items +are simply assigned to nil:

        + +
        destructure [x,y,z], [1]
        +x #=> 1
        +y #=> nil
        +z #=> nil
        +
        + +

        The left side supports any expression you would use +on the left side of a match:

        -is_record(Config.new, Config) #=> true -is_record(Config.new, List) #=> false +
        x = 1
        +destructure [^x,y,z], [1,2,3]
         
        -
        - Source -
        -

        - is_reference(term) -

        -

        Returns true if term is a reference; otherwise returns false.

        -

        Allowed in guard tests.

        -
        - Source -
        -

        - is_regex(thing) -

        -

        Check if the given argument is a regex.

        +

        The example above will only work if x matches +the first value from the right side. Otherwise, +it will raise a CaseClauseError.

        - Source + Source
        -

        - is_tuple(term) +

        + div(left, right)

        -

        Returns true if term is a tuple; otherwise returns false.

        +

        Provides an integer division macro according to Erlang semantics. +Raises an error if one of the arguments is not an integer. +Can be used in guard tests.

        -

        Allowed in guard tests.

        +

        Examples

        + +
        div 5, 2 #=> 2
        +
        - Source + Source
        -

        - length(list) +

        + elem(tuple, index)

        -

        Returns the length of list.

        +

        Define elem to get Tuple element according to Elixir conventions +(i.e. it expects the tuple as first argument, zero-index based).

        -

        Allowed in guard tests.

        +

        It is implemented as a macro so it can be used in guards.

        -

        Examples

        +

        Example

        -
        length([1,2,3,4,5,6,7,8,9]) #=> 9
        +
        tuple = { :foo, :bar, 3 }
        +elem(tuple, 1) #=> :bar
         
        - Source + Source
        -

        - list_to_atom(char_list) +

        + float_to_binary(some_float)

        -

        Returns the atom whose text representation is char_list.

        +

        Returns a binary which corresponds to the text representation +of some_float.

        Examples

        -
        list_to_atom('elixir') #=> :elixir
        +
        float_to_binary 7.0 #=> "7.00000000000000000000e+00"
         
        - Source + Source
        -

        - list_to_binary(char_list) +

        + function(args)

        -

        Returns a binary which is made from the content of char_list.

        +

        Returns an anonymous function based on the given arguments.

        Examples

        -
        list_to_binary('Elixir') #=> "Elixir"
        +
        sum = function do
        +  (x, y) -> x + y
        +end
        +
        +sum.(1, 2) #=> 3
         
        -
        - Source -
        -

        - list_to_bitstring(bitstring_list) -

        -

        Returns a bitstring which is made from the integers and bitstrings in bitstring_list. -(the last tail in bitstring_list is allowed to be a bitstring.)

        -

        Examples

        +

        Notice that a function needs to be invoked using the dot between +the function and the arguments.

        -
        bin1 = <<1,2,3>>
        -bin2 = <<4,5>>
        -bin3 = <<6,7|4>>
        +

        Multiple clauses can be specified as in case, receive and +similar macros:

        -list_to_bitstring([bin1,1,[2,3,bin2],4|bin3]) -#=> <<1,2,3,1,2,3,4,5,4,6,7|4>> +
        sum = function do
        +  x, y when y > 0 -> x + y
        +  x, y -> x - y
        +end
        +
        +sum.(1, 2) #=> 3
        +
        + +

        Shortcut syntax

        + +

        In order to reduce verbosity, functions in Elixir can be written +using a shortcut syntax via fn:

        + +
        Enum.map [1,2,3], fn x ->
        +  x * 2
        +end
        +
        + +

        Not only the example is shorter, it solves ambiguity issues. Since +do/end always matches the furthest call, if we used the function +macro as below:

        + +
        Enum.map [1,2,3], function(x) do
        +  x * 2
        +end
        +
        + +

        It would be parsed as:

        + +
        Enum.map([1,2,3], function(x)) do
        +  x * 2
        +end
        +
        + +

        The stab shortcut syntax has the proper precedence:

        + +
        Enum.map [1,2,3], fn x ->
        +  x * 2
        +end
        +
        + +

        Which is handled as:

        + +
        Enum.map([1,2,3], fn x ->
        +  x * 2
        +end)
        +
        + +

        Function retrieval

        + +

        The function macro can also be used to retrieve local or remote +functions:

        + +
        f = function(:is_atom, 2)
        +f.(:foo) #=> true
        +
        +f = function(List, :flatten, 1)
        +f.([1,[2],3]) #=> [1,2,3]
         
        - Source + Source
        -

        - list_to_existing_atom(char_list) +

        + if(condition, clauses)

        -

        Returns the atom whose text representation is char_list, but only if there already -exists such atom.

        +

        Provides an if macro. This macro expects the first argument to +be a condition and the rest are keyword arguments.

        + +

        One-liner examples

        + +
        if(foo, do: bar)
        +
        + +

        In the example above, bar will be returned if foo evalutes to +true (i.e. it is not false nor nil). Otherwise, nil will be returned.

        + +

        An else option can be given to specify the opposite:

        + +
        if(foo, do: bar, else: bar)
        +
        + +

        Blocks examples

        + +

        Elixir also allows you to pass a block to the if macro. The first +example above would be translated to:

        + +
        if foo do
        +  bar
        +end
        +
        + +

        Notice that do/end becomes delimiters. The second example would +then translate do:

        + +
        if foo do
        +  bar
        +else
        +  baz
        +end
        +
        + +

        If you want to compare more than two clauses, you can use the cond/1 +macro.

        - Source + Source
        -

        - list_to_float(char_list) +

        + in(left, right)

        -

        Returns the float whose text representation is char_list.

        +

        Returns true if the element on the left is equal (==) to +any of the items in the right. For now, it only accepts +a list as the right argument.

        Examples

        -
        list_to_float('2.2017764e+0') #=> 2.2017764
        +
        x = 1
        +x in [1,2,3] #=> true
        +
        + +

        This macro simply translates the expression above to:

        + +
        x == 1 or x == 2 or x == 3
        +
        + +

        Clauses

        + +

        Whenever used inside a function or a case clause, you can +optionally omit the variable declaration, for example:

        + +
        case 3 do
        +  x when x in [1,2] -> x * 2
        +  _ -> 0
        +end
        +
        + +

        Could be rewritten as:

        + +
        case 3 do
        +  x in [1,2] -> x * 2
        +  _ -> 0
        +end
         
        + +

        In this case, Elixir will automatically expand it and define +the variable for us.

        - Source + Source
        -

        - list_to_integer(char_list) +

        + inspect(arg, opts // [])

        -

        Returns an integer whose text representation is char_list.

        +

        Inspect the given arguments according to the Binary.Inspect protocol.

        + +

        Options

        + +

        The following options are supported:

        + +
          +
        • :raw - tuples are not formatted as the inspect protocol, they are +always shown as tuples, defaults to false;

        • +
        • :limit - the limit of items that are shown in tuples, bitstrings and +lists. Do not apply to strings;

        • +

        Examples

        -
        list_to_integer('123') #=> 123
        +
        inspect(:foo)
        +#=> ":foo"
         
        - Source + Source
        -

        - list_to_integer(char_list, base) +

        + integer_to_binary(some_integer)

        -

        Returns an integer whose text representation in base base is char_list.

        +

        Returns a binary which corresponds to the text representation +of some_integer.

        Examples

        -
        > list_to_integer('3FF', 16) #=> 1023
        +
        integer_to_binary 123 #=> "123"
         
        - Source + Source
        -

        - list_to_pid(char_list) +

        + integer_to_binary(some_integer, base)

        -

        Returns a pid whose text representation is char_list.

        - -

        Warning:

        - -

        This function is intended for debugging and for use in the Erlang -operating system.

        - -

        It should not be used in application programs.

        +

        Returns a binary which corresponds to the text representation +of some_integer in base base.

        Examples

        -
        list_to_pid('<0.41>') #=> <0.4.1>
        +
        integer_to_binary 77 #=> "77"
         
        - Source + Source
        -

        - list_to_tuple(list) +

        + is_exception(thing)

        -

        Returns a tuple which corresponds to list. list can contain any Erlang terms.

        +

        Check if the given structure is an exception.

        Examples

        -
        list_to_tuple([share, [:elixir, 163]]). #=> {share, [:elixir, 163]}
        +
        is_exception(Error.new) #=> true
        +is_exception(1)         #=> false
         
        - Source + Source
        -

        - make_ref() +

        + is_range(thing)

        -

        Returns an almost unique reference.

        - -

        The returned reference will re-occur after approximately 2^82 calls; -therefore it is unique enough for practical purposes.

        +

        Check if the given argument is a range.

        +
        + Source +
        +

        + is_record(thing, kind) +

        +

        Check if the given structure is a record. It is basically +a convenient macro that checks the structure is a tuple and +the first element matches the given kind.

        Examples

        -
        make_ref()
        -#=> #Ref<0.0.0.135>
        +
        defrecord Config, sample: nil
        +
        +is_record(Config.new, Config) #=> true
        +is_record(Config.new, List)   #=> false
         
        - Source + Source +
        +

        + is_regex(thing) +

        +

        Check if the given argument is a regex.

        +
        + Source

        match?(left, right) @@ -2964,35 +3307,7 @@

        Examples

        Enum.filter list, match?({:a, x } when x < 2, &1)
        - Source -
        -

        - max(first, second) -

        -

        Return the biggest of the two given terms according to -Erlang's term ordering. If the terms compare equal, the -first one is returned.

        - -

        Examples

        - -
        max(1, 2) #=> 2
        -
        -
        - Source -
        -

        - min(first, second) -

        -

        Return the smallest of the two given terms according to -Erlang's term ordering. If the terms compare equal, the -first one is returned.

        - -

        Examples

        - -
        min(1, 2) #=> 1
        -
        -
        - Source + Source

        nil?(x) @@ -3006,28 +3321,7 @@

        Examples

        nil? nil #=> true
        - Source -
        -

        - node() -

        -

        Returns an atom representing the name of the local node. -If the node is not alive, nonode@nohost is returned instead.

        - -

        Allowed in guard tests.

        -
        - Source -
        -

        - node(arg) -

        -

        Returns the node where the given argmuent is located. -The argument can be a pid, a reference, or a port. -If the local node is not alive, nonode@nohost is returned.

        - -

        Allowed in guard tests.

        -
        - Source + Source

        not(arg) @@ -3056,22 +3350,6 @@

        Examples

        Source -
        -

        - pid_to_list(pid) -

        -

        Returns a char list which corresponds to the text representation of pid. -This function is intended for debugging and for use in the Erlang operating -system. It should not be used in application programs.

        - -

        Warning:

        - -

        This function is intended for debugging and for use in the Erlang -operating system.

        - -

        It should not be used in application programs.

        -
        - Source

        receive(args) @@ -3119,7 +3397,7 @@

        Examples

        will occur immediately.

      - Source + Source

      rem(left, right) @@ -3133,28 +3411,7 @@

      Examples

      rem 5, 2 #=> 1
       
      - Source -
      -

      - round(number) -

      -

      Returns an integer by rounding the given number. -Allowed in guard tests.

      - -

      Examples

      - -
      round(5.5) #=> 6
      -
      -
      - Source -
      -

      - self() -

      -

      Returns the pid (process identifier) of the calling process. -Allowed in guard clauses.

      -
      - Source + Source

      setelem(tuple, index, value) @@ -3166,131 +3423,11 @@

      Examples

      Example

      -

      tuple = { :foo, :bar, 3 } - setelem(tuple, 0, :baz) #=> { :baz, :bar, 3 }

      -
      - Source -
      -

      - size(arg) -

      -

      Returns the size of the given argument, which must be a tuple -or a binary. If possible, please use tuplesize or binarysize.

      -
      - Source -
      -

      - spawn(fun) -

      -

      Spawns the given function and returns its pid.

      - -

      Check the modules Process and Node for other functions -to handle processes, including spawning functions in nodes.

      - -

      Examples

      - -
      current = Process.self
      -child   = spawn(fn -> current <- { Process.self, 1 + 2 } end)
      -
      -receive
      -  { ^child, 3 } -> IO.puts "Received 3 back"
      -end
      -
      -
      - Source -
      -

      - spawn(module, fun, args) -

      -

      Spawns the given module and function passing the given args -and returns its pid.

      - -

      Check the modules Process and Node for other functions -to handle processes, including spawning functions in nodes.

      - -

      Examples

      - -
      spawn(SomeModule, :function, [1,2,3])
      -
      -
      - Source -
      -

      - spawn_link(fun) -

      -

      Spawns the given function, links it to the current process and returns its pid.

      - -

      Check the modules Process and Node for other functions -to handle processes, including spawning functions in nodes.

      - -

      Examples

      - -
      current = Process.self
      -child   = spawn_link(fn -> current <- { Process.self, 1 + 2 } end)
      -
      -receive
      -  { ^child, 3 } ->
      -    IO.puts "Received 3 back"
      -end
      -
      -
      - Source -
      -

      - spawn_link(module, fun, args) -

      -

      Spawns the given module and function passing the given args, -links it to the current process and returns its pid.

      - -

      Check the modules Process and Node for other functions -to handle processes, including spawning functions in nodes.

      - -

      Examples

      - -
      spawn_link(SomeModule, :function, [1,2,3])
      +
      tuple = { :foo, :bar, 3 }
      +setelem(tuple, 0, :baz) #=> { :baz, :bar, 3 }
       
      - Source -
      -

      - term_to_binary(term) -

      -

      Returns a binary data which is the result of encoding the given term -according to the Erlang external term format.

      - -

      This can be used for a variety of purposes, for example, writing a term -to a file in an efficient way, or sending an Erlang term to some type -of communications channel not supported by distributed Erlang.

      -
      - Source -
      -

      - term_to_binary(term, opts) -

      -

      The same as term_to_binary/1 but also supports two options:

      - - -
      - Source -
      -

      - throw(term) -

      -

      A non-local return from a function. Check try/2 for more information.

      -
      - Source -
      -

      - tl(list) -

      -

      Returns the tail of a list. Raises ArgumentError if the list is empty.

      -
      - Source + Source

      to_binary(arg) @@ -3304,7 +3441,7 @@

      Examples

      #=> "foo"
      - Source + Source

      to_char_list(arg) @@ -3317,20 +3454,7 @@

      Examples

      #=> 'foo'
      - Source -
      -

      - trunc(number) -

      -

      Returns an integer by the truncating the given number. -Allowed in guard clauses.

      - -

      Examples

      - -
      trunc(5.5) #=> 5
      -
      -
      - Source + Source

      try(args) @@ -3418,7 +3542,7 @@

      Variable visibility

      Catching exits and Erlang errors

      -

      The catch clause works exactly the same as in Erlang. Therefore, +

      The catch clause works exactly the same as in : Therefore, one can also handle exits/errors coming from Erlang as below:

      try do
      @@ -3438,21 +3562,7 @@ 

      Catching exits and Erlang errors

      Although the second form should be avoided in favor of raise/rescue control mechanisms.

      - Source -
      -

      - tuple_size(tuple) -

      -

      Returns the size of a tuple.

      -
      - Source -
      -

      - tuple_to_list(tuple) -

      -

      Converts a tuple to a list.

      -
      - Source + Source

      unless(clause, options) @@ -3461,16 +3571,19 @@

      Catching exits and Erlang errors

      unless a value evalutes to true. Check if for examples and documentation.

      - Source + Source

      use(module, args // [])

      -

      use is a simple mechanism for extending the current module with the -given module.

      +

      use is a simple mechanism for using a given module into +the current context.

      Examples

      +

      For example, in other to write tests using the ExUnit framework, +a developers should use the ExUnit.Case module:

      +
      defmodule AssertionTest do
         use ExUnit.Case, async: true
       
      @@ -3481,8 +3594,9 @@ 

      Examples

      By calling use, a hook called __using__ will be invoked in -ExUnit.Case which will then do the proper setup. In other words, -use is simply a translation to:

      +ExUnit.Case which will then do the proper setup.

      + +

      Simply put, use is simply a translation to:

      defmodule AssertionTest do
         require ExUnit.Case
      @@ -3494,7 +3608,7 @@ 

      Examples

      end
      - Source + Source

      var!(var) @@ -3538,7 +3652,7 @@

      Examples

      this operator accepts any expression as arguments, not only booleans, however it is not allowed in guards.

      - Source + Source
      diff --git a/docs/master/Keyword.KeyError.html b/docs/master/Keyword.KeyError.html index cd20b0ddd..1168bcd2e 100644 --- a/docs/master/Keyword.KeyError.html +++ b/docs/master/Keyword.KeyError.html @@ -89,6 +89,11 @@

      Functions summary

      to_keywords/1 +
    1551. + + update/2 + +
    1552. update_key/2 @@ -153,6 +158,12 @@

      Functions

      Source +
      +

      + update(keywords, record) +

      +
      + Source

      update_key(function, record) diff --git a/docs/master/Keyword.html b/docs/master/Keyword.html index 0f64d5beb..a151742da 100644 --- a/docs/master/Keyword.html +++ b/docs/master/Keyword.html @@ -29,8 +29,7 @@

      A keyword is a list of tuples where the first element of the tuple is an atom and the second element can be -any value. The list is sorted by the first element of -each tuple.

      +any value.

      A keyword may have duplicated keys, so it is not strictly a dictionary. However most of the functions in this module @@ -57,6 +56,11 @@

      Functions summary

      delete/2

    1553. +
    1554. + + equal?/2 + +
    1555. from_enum/1 @@ -79,7 +83,7 @@

      Functions summary

    1556. - key?/2 + has_key?/2
    1557. @@ -158,16 +162,30 @@

      Examples

      Keyword.delete [b: 2], :a #=> [b: 2]
      - Source + Source +
      +

      + equal?(left, right) +

      +

      Checks if two keywords are equal. I.e. they contain +the same keys and those keys contain the same values.

      + +

      Examples

      + +
      Keyword.equal? [a: 1, b: 2], [b: 2, a: 1]
      +#=> true
      +
      +
      + Source

      from_enum(enum)

      Creates a Keyword from enum. Differently from Keyword.new -that behaves as a dict, Keyword.from_enum do not remove +which behaves as a dict, Keyword.from_enum do not remove duplicated entries.

      - Source + Source

      get(keywords, key, default // nil) @@ -187,10 +205,10 @@

      Examples

      Keyword.get [a: 1], :b, 3 #=> 3
      - Source + Source

      - get!(list1, key) + get!(keywords, key)

      Gets the value for specific key. If key does not exist, an error is raised.

      @@ -201,10 +219,10 @@

      Examples

      Keyword.get! [a: 1], :b #=> raises KeyError[key: :b]
      - Source + Source

      - get_values(list1, key) + get_values(keywords, key)

      Gets all values for a specific key.

      @@ -214,22 +232,22 @@

      Examples

      #=> [1,2]
      - Source + Source
      -

      - key?(list1, key) +

      + has_key?(keywords, key)

      Returns whether a given key exists in the given keywords.

      Examples

      -
      Keyword.key?([a: 1], :a)
      +
      Keyword.has_key?([a: 1], :a)
       #=> true
      -Keyword.key?([a: 1], :b)
      +Keyword.has_key?([a: 1], :b)
       #=> false
       
      - Source + Source

      keys(keywords) @@ -242,7 +260,7 @@

      Examples

      Keyword.keys [a: 1, b: 2] #=> [:a,:b]
       
      - Source + Source

      merge(d1, d2) @@ -256,7 +274,7 @@

      Examples

      #=> [a:3, b:2, d: 4]
      - Source + Source

      merge(d1, d2, fun) @@ -272,14 +290,14 @@

      Examples

      #=> [a:4, b:2, d: 4]
      - Source + Source

      new()

      Returns an empty keyword list, i.e. an empty list.

      - Source + Source

      new(pairs) @@ -293,7 +311,7 @@

      Examples

      #=> [a: 2, b: 1]
      - Source + Source

      new(pairs, transform) @@ -308,26 +326,23 @@

      Examples

      #=> [a: :a, b: :b]
      - Source + Source

      - put(list1, key, value) + put(list, key, value)

      Sets the given value under key.

      If a previous value is already stored, all entries are removed and the value is overriden.

      -

      Use put_other/3 to add a new value for an existing key -without removing previous ones.

      -

      Examples

      Keyword.put [a: 1, b: 2], :a, 3
       #=> [a: 3, b: 2]
       
      - Source + Source

      update(list1, key, fun) @@ -343,7 +358,7 @@

      Examples

      #=> Keyword.KeyError
      - Source + Source

      update(list1, key, initial, fun) @@ -359,7 +374,7 @@

      Examples

      #=> [a: 1, b: 11]
      - Source + Source

      values(keywords) @@ -371,7 +386,7 @@

      Examples

      Keyword.values [a: 1, b: 2] #=> [1,2]
       
      - Source + Source diff --git a/docs/master/List.html b/docs/master/List.html index 023c775dd..90855ded3 100644 --- a/docs/master/List.html +++ b/docs/master/List.html @@ -158,11 +158,6 @@

      Functions summary

      zip/1
    1558. -
    1559. - - zip/2 - -
    1560. @@ -494,7 +489,7 @@

      Examples

      #=> [[1, 2, 3], [:a, :b, :c]] - Source + Source

      wrap(list) @@ -524,25 +519,7 @@

      Examples

      #=> [{1, 3, 5}]
      - Source -
      -

      - zip(item1, item2) -

      -

      Zips corresponding elements from two lists (or tuples) into one list of tuples. The -number of elements in the resulting list is equal to the length of the -shortest list among the given ones.

      - -

      Examples

      - -
      List.zip [1, 2, 3], [4, 5, 6]
      -#=> [{1, 4}, {2, 5}, {3, 6}]
      -
      -List.zip [1, 2], [4, 5, 6]
      -#=> [{1, 4}, {2, 5}]
      -
      -
      - Source + Source
      diff --git a/docs/master/Macro.Env.html b/docs/master/Macro.Env.html index 2b38ce70c..2bd367c00 100644 --- a/docs/master/Macro.Env.html +++ b/docs/master/Macro.Env.html @@ -102,21 +102,41 @@

      Functions summary

      aliases/1 +
    1561. + + aliases/2 + +
    1562. context/1
    1563. +
    1564. + + context/2 + +
    1565. file/1
    1566. +
    1567. + + file/2 + +
    1568. function/1
    1569. +
    1570. + + function/2 + +
    1571. in_guard?/1 @@ -132,6 +152,11 @@

      Functions summary

      line/1
    1572. +
    1573. + + line/2 + +
    1574. location/1 @@ -142,11 +167,21 @@

      Functions summary

      macros/1
    1575. +
    1576. + + macros/2 + +
    1577. module/1
    1578. +
    1579. + + module/2 + +
    1580. new/0 @@ -162,11 +197,61 @@

      Functions summary

      requires/1
    1581. +
    1582. + + requires/2 + +
    1583. to_keywords/1
    1584. +
    1585. + + update/2 + +
    1586. +
    1587. + + update_aliases/2 + +
    1588. +
    1589. + + update_context/2 + +
    1590. +
    1591. + + update_file/2 + +
    1592. +
    1593. + + update_function/2 + +
    1594. +
    1595. + + update_line/2 + +
    1596. +
    1597. + + update_macros/2 + +
    1598. +
    1599. + + update_module/2 + +
    1600. +
    1601. + + update_requires/2 + +
    1602. @@ -186,6 +271,12 @@

      Functions

      item is the aliased name and the second the actual name.

      Source +
      +

      + aliases(value, record) +

      +
      + Source

      context(record) @@ -194,6 +285,12 @@

      Functions

      (default context), inside a guard or inside an assign.

      Source +
      +

      + context(value, record) +

      +
      + Source

      file(record) @@ -201,6 +298,12 @@

      Functions

      Returns the current file name as a binary.

      Source +
      +

      + file(value, record) +

      +
      + Source

      function(record) @@ -210,6 +313,12 @@

      Functions

      if not inside a function.

      Source +
      +

      + function(value, record) +

      +
      + Source

      in_guard?(record) @@ -233,6 +342,12 @@

      Functions

      Returns the current line as an integer.

      Source +
      +

      + line(value, record) +

      +
      + Source

      location(record) @@ -248,6 +363,12 @@

      Functions

      Returns a list of macros imported from each module.

      Source +
      +

      + macros(value, record) +

      +
      + Source

      module(record) @@ -255,6 +376,12 @@

      Functions

      Returns the current module name.

      Source +
      +

      + module(value, record) +

      +
      + Source

      new() @@ -274,12 +401,72 @@

      Functions

      Returns the list of required modules.

      Source +
      +

      + requires(value, record) +

      +
      + Source

      to_keywords(record)

      Source +
      +

      + update(keywords, record) +

      +
      + Source +
      +

      + update_aliases(function, record) +

      +
      + Source +
      +

      + update_context(function, record) +

      +
      + Source +
      +

      + update_file(function, record) +

      +
      + Source +
      +

      + update_function(function, record) +

      +
      + Source +
      +

      + update_line(function, record) +

      +
      + Source +
      +

      + update_macros(function, record) +

      +
      + Source +
      +

      + update_module(function, record) +

      +
      + Source +
      +

      + update_requires(function, record) +

      +
      + Source
      diff --git a/docs/master/Macro.html b/docs/master/Macro.html index 7ec2b7b65..d2b594e3f 100644 --- a/docs/master/Macro.html +++ b/docs/master/Macro.html @@ -42,6 +42,11 @@

      Functions summary

      • + + do_safe_term/1 + +
      • +
      • escape/1 @@ -51,6 +56,11 @@

        Functions summary

        expand/2
      • +
      • + + safe_term/1 + +
      • to_binary/1 @@ -103,6 +113,12 @@

        Macros summary

        Functions

        +

        + do_safe_term(terms) +

        +
        + Source +

        escape(tuple)

        @@ -216,6 +232,16 @@

        Examples

        Source +
        +

        + safe_term(terms) +

        +

        Recurs the quoted expression checking if all sub terms are +safe (i.e. they represented data structured and don't actually +evaluate code) and returns :ok unless a given term is unsafe, +which is returned as { :unsafe, term }.

        +
        + Source

        to_binary(tree) diff --git a/docs/master/MatchError.html b/docs/master/MatchError.html index 1ca9a662b..b85947f52 100644 --- a/docs/master/MatchError.html +++ b/docs/master/MatchError.html @@ -89,6 +89,11 @@

        Functions summary

        to_keywords/1
      • +
      • + + update/2 + +
      • update_actual/2 @@ -153,6 +158,12 @@

        Functions

        Source +
        +

        + update(keywords, record) +

        +
        + Source

        update_actual(function, record) diff --git a/docs/master/Mix.Dep.html b/docs/master/Mix.Dep.html index 0a5f52536..dc90515ee 100644 --- a/docs/master/Mix.Dep.html +++ b/docs/master/Mix.Dep.html @@ -54,37 +54,37 @@

        Fields (and defaults)

      • - app: nil + scm: nil
      • - opts: nil + app: nil
      • - project: nil + requirement: nil
      • - requirement: nil + status: nil
      • - scm: nil + opts: nil
      • - status: nil + project: nil
      • @@ -169,6 +169,11 @@

        Functions summary

        to_keywords/1 +
      • + + update/2 + +
      • update_app/2 @@ -300,6 +305,12 @@

        Functions

        Source +
        +

        + update(keywords, record) +

        +
        + Source

        update_app(function, record) diff --git a/docs/master/Mix.Deps.html b/docs/master/Mix.Deps.html index 1b8c23951..06675fa1e 100644 --- a/docs/master/Mix.Deps.html +++ b/docs/master/Mix.Deps.html @@ -133,7 +133,7 @@

        Exceptions

        Check if a dependency is available.

        - Source + Source

        by_name!(given) @@ -148,35 +148,35 @@

        Exceptions

        Checks the lock for the given dependency and update its status accordingly.

        - Source + Source

        deps_path(arg1)

        Returns the path for the given dependency.

        - Source + Source

        format_dep(arg1)

        Format the dependency for printing.

        - Source + Source

        format_status(arg1)

        Formats the status of a dependency.

        - Source + Source

        ok?(arg1)

        Check if a dependency is ok.

        - Source + Source

        out_of_date?(dep) @@ -185,14 +185,14 @@

        Exceptions

        lock status. Therefore, be sure to call check_lock before invoking this function.

        - Source + Source

        update(dep)

        Updates the dependency inside the given project.

        - Source + Source
        diff --git a/docs/master/Mix.Error.html b/docs/master/Mix.Error.html index 2083acd18..cc8400d65 100644 --- a/docs/master/Mix.Error.html +++ b/docs/master/Mix.Error.html @@ -84,6 +84,11 @@

        Functions summary

        to_keywords/1
      • +
      • + + update/2 + +
      • update_message/2 @@ -142,6 +147,12 @@

        Functions

        Source +
        +

        + update(keywords, record) +

        +
        + Source

        update_message(function, record) diff --git a/docs/master/Mix.InvalidTaskError.html b/docs/master/Mix.InvalidTaskError.html index d4290fbf4..dd83e7d79 100644 --- a/docs/master/Mix.InvalidTaskError.html +++ b/docs/master/Mix.InvalidTaskError.html @@ -89,6 +89,11 @@

        Functions summary

        to_keywords/1
      • +
      • + + update/2 + +
      • update_task/2 @@ -153,6 +158,12 @@

        Functions

        Source +
        +

        + update(keywords, record) +

        +
        + Source

        update_task(function, record) diff --git a/docs/master/Mix.NoProjectError.html b/docs/master/Mix.NoProjectError.html index 3c35cde33..fb0721644 100644 --- a/docs/master/Mix.NoProjectError.html +++ b/docs/master/Mix.NoProjectError.html @@ -84,6 +84,11 @@

        Functions summary

        to_keywords/1
      • +
      • + + update/2 + +
      • update_message/2 @@ -142,6 +147,12 @@

        Functions

        Source +
        +

        + update(keywords, record) +

        +
        + Source

        update_message(function, record) diff --git a/docs/master/Mix.NoTaskError.html b/docs/master/Mix.NoTaskError.html index 9164c6433..41b7814f1 100644 --- a/docs/master/Mix.NoTaskError.html +++ b/docs/master/Mix.NoTaskError.html @@ -89,6 +89,11 @@

        Functions summary

        to_keywords/1
      • +
      • + + update/2 + +
      • update_task/2 @@ -153,6 +158,12 @@

        Functions

        Source +
        +

        + update(keywords, record) +

        +
        + Source

        update_task(function, record) diff --git a/docs/master/Mix.OutOfDateDepsError.html b/docs/master/Mix.OutOfDateDepsError.html index db9d66947..df647aec7 100644 --- a/docs/master/Mix.OutOfDateDepsError.html +++ b/docs/master/Mix.OutOfDateDepsError.html @@ -39,7 +39,7 @@

        Fields (and defaults)

      • - message: "Some dependencies are out of date, please run `mix deps.get` to proceed" + env: nil
      • @@ -51,22 +51,27 @@

        Functions summary

        • - exception/1 + env/1
        • - exception/2 + env/2
        • - message/1 + exception/1 + +
        • +
        • + + exception/2
        • - message/2 + message/1
        • @@ -86,7 +91,12 @@

          Functions summary

        • - update_message/2 + update/2 + +
        • +
        • + + update_env/2
        • @@ -101,29 +111,35 @@

          Functions summary

          Functions

          -

          - exception(args) +

          + env(record)

          Source
          -

          - exception(args, self) +

          + env(value, record)

          Source
          -

          - message(record) +

          + exception(args)

          Source
          -

          - message(value, record) +

          + exception(args, self)

          Source +
          +

          + message(exception) +

          +
          + Source

          new() @@ -143,8 +159,14 @@

          Functions

          Source
          -

          - update_message(function, record) +

          + update(keywords, record) +

          +
          + Source +
          +

          + update_env(function, record)

          Source diff --git a/docs/master/Mix.Tasks.Compile.Elixir.html b/docs/master/Mix.Tasks.Compile.Elixir.html index fd1785912..01606d896 100644 --- a/docs/master/Mix.Tasks.Compile.Elixir.html +++ b/docs/master/Mix.Tasks.Compile.Elixir.html @@ -47,26 +47,10 @@

          Configuration

            -
          • :source_paths - directories to find source files. -Defaults to ["lib"], can be configured as:

            - -

            [source_paths: ["lib", "other"]]

          • -
          • :compile_path - directory to output compiled files. -Defaults to "ebin", can be configured as:

            - -

            [compile_path: "ebin"]

          • -
          • :compile_first - which files need to be compiled first. -Defaults to an empty list, can be configured as:

            - -

            [compile_first: ["lib/foo.ex" "lib/bar.ex"]]

          • -
          • :compile_exts - extensions to watch and, when any of -the files with the given extension changes, forces -recompilation:

            - -

            [compile_exts: [:ex, :eex]

          • -
          • :elixirc_options - compilation options that applies +

          • :elixirc_options - compilation options that applies to Elixir's compiler, they are: :ignore_module_conflict, -:docs and :debug_info. They all default to false.

          • +:docs and :debug_info. By default, uses the same +behaviour as Elixir

          Command line options

          @@ -108,7 +92,7 @@

          Functions

          run(args)

          - Source + Source
          diff --git a/docs/master/Mix.Tasks.Compile.html b/docs/master/Mix.Tasks.Compile.html index 480aeeea0..a92b08255 100644 --- a/docs/master/Mix.Tasks.Compile.html +++ b/docs/master/Mix.Tasks.Compile.html @@ -44,10 +44,37 @@

          Configuration

          [compilers: [:elixir, :mycompiler, :app]]
           
          +

          Common configuration

          + +

          The following options are usually shared by different compilers:

          + +
            +
          • :source_paths - directories to find source files. +Defaults to ["lib"], can be configured as:

            + +

            [source_paths: ["lib", "other"]]

          • +
          • :compile_path - directory to output compiled files. +Defaults to "ebin", can be configured as:

            + +

            [compile_path: "ebin"]

          • +
          • :compile_first - which files need to be compiled first. +They need to be a subset of the files found in source_paths.

            + +

            [compile_first: ["lib/foo.ex", "lib/bar.ex"]]

          • +
          • :watch_exts - extensions to watch in order to trigger +a compilation:

            + +

            [watch_exts: [:ex, :eex]]

          • +
          • :compile_exts - extensions to compile whenever there +is a change:

            + +

            [compile_exts: [:ex]]

          • +
          +

          Command line options

            -
          • --list - List all enabled compilers.
          • +
          • --list - List all enabled compilers.
          @@ -83,7 +110,7 @@

          Functions

          run(args)

          - Source + Source diff --git a/docs/master/Mix.Tasks.Deps.Get.html b/docs/master/Mix.Tasks.Deps.Get.html index 22a9aa2b6..d1e7797ea 100644 --- a/docs/master/Mix.Tasks.Deps.Get.html +++ b/docs/master/Mix.Tasks.Deps.Get.html @@ -28,7 +28,7 @@

          Get all out of date dependencies, i.e. dependencies -that are not available or have a wrong lock.

          +that are not available or have an invalid lock.

          diff --git a/docs/master/Mix.Tasks.Escriptize.html b/docs/master/Mix.Tasks.Escriptize.html index 8efedd05e..b30333f2b 100644 --- a/docs/master/Mix.Tasks.Escriptize.html +++ b/docs/master/Mix.Tasks.Escriptize.html @@ -37,7 +37,7 @@

        • escript_main_module - the module containing the main/1 function. Defaults to Project

        • escript_embed_elixir - if true embed elixir in the escript file. -Defaults to false

        • +Defaults to true

        • escript_embed_extra_apps - embed additional Elixir applications if escript_embed_elixir is true. Defaults to []

        • diff --git a/docs/master/Mix.Utils.html b/docs/master/Mix.Utils.html index 67f778d4d..ecc4fbfb6 100644 --- a/docs/master/Mix.Utils.html +++ b/docs/master/Mix.Utils.html @@ -134,7 +134,7 @@

          Examples

          Mix.Utils.camelize "foo_bar" #=> "FooBar"
           
          - Source + Source

          command_to_module(command, at // Elixir) @@ -152,7 +152,7 @@

          Examples

          #=> { :module, Mix.Tasks.Compile }
          - Source + Source

          command_to_module_name(s) @@ -165,7 +165,7 @@

          Examples

          #=> "Compile.Elixir"
          - Source + Source

          config_merge(old, new) @@ -173,14 +173,14 @@

          Examples

          Merges two configs recursively, merging keyword lists and concatenating normal lists.

          - Source + Source

          exclude_files(files)

          Filtering out files which start with "."

          - Source + Source

          extract_files(paths, exts) @@ -189,7 +189,7 @@

          Examples

          the given extension. It ignores files which start with "."

          - Source + Source

          extract_files(paths, files, exts) @@ -200,7 +200,7 @@

          Examples

          files and the extracted files. It ignores files which start with "."

          - Source + Source

          module_name_to_command(module, nesting // 0) @@ -218,7 +218,7 @@

          Examples

          #=> "compile.elixir"
          - Source + Source

          source(module) @@ -233,7 +233,7 @@

          Examples

          Returns true if any of target is stale compared to source. If target or source is a binary, it is expanded using File.wildcard.

          - Source + Source

          underscore(atom) @@ -257,7 +257,7 @@

          Examples

          Mix.Utils.camelize "sap_example" #=> "SapExample"
          - Source + Source

          user_home() diff --git a/docs/master/Module.html b/docs/master/Module.html index 6c30c14b9..519f6ba73 100644 --- a/docs/master/Module.html +++ b/docs/master/Module.html @@ -63,6 +63,11 @@

          Functions summary

          concat/2 +
        • + + create/3 + +
        • defines?/2 @@ -167,7 +172,7 @@

          Examples

          end
        • - Source + Source

          concat(list) @@ -182,7 +187,7 @@

          Examples

          Module.concat [Foo, 'Bar'] #=> Foo.Bar
          - Source + Source

          concat(left, right) @@ -197,7 +202,42 @@

          Examples

          Module.concat Foo, 'Bar' #=> Foo.Bar
          - Source + Source +
          +

          + create(module, quoted, opts // []) +

          +

          Creates a module with the given name and given by +the given quoted expressions. The line where the module +is defined and its file can be given as options.

          + +

          Examples

          + +
          contents =
          +  quote do
          +    def world, do: true
          +  end
          +
          +Module.create(Hello, contents, __ENV__)
          +
          +Hello.world #=> true
          +
          + +

          Differences with defmodule

          + +

          Module.create works similarly to defmodule and +return the same results. While one could also use +defmodule to define modules dynamically, this +function is preferred when the module body is given +by a quoted expression.

          + +

          Another important distinction is that defmodule +blends into the scope it is invoked, allowing you +to access all variables, imports and requires from +the module. Module.create, on the other hand, creates +a new scope so imports, requires, etc are not inherited.

          +
          + Source

          defines?(module, tuple) @@ -214,7 +254,7 @@

          Examples

          end
          - Source + Source

          defines?(module, tuple, kind) @@ -232,7 +272,7 @@

          Examples

          end
          - Source + Source

          definitions_in(module) @@ -247,7 +287,7 @@

          Examples

          end
          - Source + Source

          definitions_in(module, kind) @@ -264,7 +304,7 @@

          Examples

          end
          - Source + Source

          delete_attribute(module, key) @@ -279,7 +319,7 @@

          Examples

          end
          - Source + Source

          eval_quoted(env, quoted, binding // [], opts // []) @@ -309,7 +349,8 @@

          Examples

          This function also accepts a Macro.Env as first argument. This -is useful to evalute the quoted contents inside an existing environment:

          +is useful to evalute the quoted contents inside an existing +environment (considering the environemnt module, line and file):

          defmodule Foo do
             contents = quote do: (def sum(a, b), do: a + b)
          @@ -319,7 +360,7 @@ 

          Examples

          Foo.sum(1, 2) #=> 3
          - Source + Source

          get_attribute(module, key) @@ -340,7 +381,7 @@

          Examples

          end
          - Source + Source

          make_overridable(module, tuples) @@ -349,7 +390,7 @@

          Examples

          An overridable function is lazily defined, allowing a developer to customize it.

          - Source + Source

          open?(module) @@ -364,7 +405,7 @@

          Examples

          Returns true if the given tuple in module is marked as overridable.

          - Source + Source

          put_attribute(module, key, value) @@ -380,7 +421,7 @@

          Examples

          end
          - Source + Source

          register_attribute(module, new, opts // []) @@ -402,7 +443,7 @@

          Options

          By default, both options are true. Which means that registering an attribute without passing any options will revert the attribute -behavior to exactly the same expected in Erlang.

          +behavior to exactly the same expected in :

          Examples

          @@ -417,7 +458,7 @@

          Examples

          end
          - Source + Source

          safe_concat(list) @@ -436,7 +477,7 @@

          Examples

          #=> List.Chars
          - Source + Source

          safe_concat(left, right) @@ -455,7 +496,7 @@

          Examples

          #=> List.Chars
          - Source + Source

          split(module) @@ -468,7 +509,7 @@

          Examples

          #=> ["Very", "Long", "Module", "Name", "And", "Even", "Longer"]
          - Source + Source diff --git a/docs/master/Orddict.html b/docs/master/Orddict.html index 13d1c88dc..e0f10ee22 100644 --- a/docs/master/Orddict.html +++ b/docs/master/Orddict.html @@ -1,7 +1,7 @@ - Orddict + OrdDict @@ -21,7 +21,7 @@

          - Orddict + OrdDict

          @@ -37,7 +37,7 @@

          - Source + Source @@ -47,36 +47,6 @@

          Functions summary

          @@ -133,48 +73,12 @@

          Functions summary

          Functions

          -

          - delete(arg1, key) -

          -
          - Source -
          -

          - empty(_) -

          -
          - Source -
          -

          - get(arg1, key, default) -

          -
          - Source -
          -

          - has_key?(arg1, key) -

          -
          - Source -
          -

          - keys(arg1) -

          -
          - Source -
          -

          - merge(d1, d2, fun) -

          -
          - Source -

          new()

          Creates a new empty dict.

          - Source + Source

          new(pairs) @@ -183,11 +87,11 @@

          Functions

          Examples

          -
          Orddict.new [{:b,1},{:a,2}]
          +
          OrdDict.new [{:b,1},{:a,2}]
           #=> [a: 1, b: 2]
           
          - Source + Source

          new(list, transform) @@ -197,47 +101,11 @@

          Examples

          Examples

          -
          Orddict.new ["a", "b"], fn x -> {x, x} end
          +
          OrdDict.new ["a", "b"], fn x -> {x, x} end
           #=> ["a": "a", "b": "b"]
           
          - Source -
          -

          - put(arg1, key, value) -

          -
          - Source -
          -

          - size(arg1) -

          -
          - Source -
          -

          - to_list(arg1) -

          -
          - Source -
          -

          - update(arg1, key, fun) -

          -
          - Source -
          -

          - update(arg1, key, initial, fun) -

          -
          - Source -
          -

          - values(arg1) -

          -
          - Source + Source
          diff --git a/docs/master/Protocol.UndefinedError.html b/docs/master/Protocol.UndefinedError.html index e2ba34005..3f5cd15dd 100644 --- a/docs/master/Protocol.UndefinedError.html +++ b/docs/master/Protocol.UndefinedError.html @@ -105,6 +105,11 @@

          Functions summary

          to_keywords/1 +
        • + + update/2 + +
        • update_protocol/2 @@ -186,6 +191,12 @@

          Functions

          Source +
          +

          + update(keywords, record) +

          +
          + Source

          update_protocol(function, record) diff --git a/docs/master/Range.html b/docs/master/Range.html index ed6928af4..24fa0c8d9 100644 --- a/docs/master/Range.html +++ b/docs/master/Range.html @@ -95,6 +95,21 @@

          Functions summary

          to_keywords/1
        • +
        • + + update/2 + +
        • +
        • + + update_first/2 + +
        • +
        • + + update_last/2 + +
        @@ -148,6 +163,24 @@

        Functions

        Source +
        +

        + update(keywords, record) +

        +
        + Source +
        +

        + update_first(function, record) +

        +
        + Source +
        +

        + update_last(function, record) +

        +
        + Source
        diff --git a/docs/master/Record.html b/docs/master/Record.html index 791714924..ad46fb822 100644 --- a/docs/master/Record.html +++ b/docs/master/Record.html @@ -74,7 +74,7 @@

        Functions summary

        Functions

        - deffunctions(env, values, opts) + deffunctions(values, opts // [], env)

        Defines record functions skipping the module definition. This is called directly by defrecord. It expects the @@ -84,14 +84,14 @@

        Functions

        Examples

        defmodule CustomRecord do
        -  Record.deffunctions __ENV__, [:name, :age]
        +  Record.deffunctions [:name, :age], __ENV__
         end
         
        Source

        - defmacros(env, name, values) + defmacros(name, values, env)

        Defines three macros for reading and writing records values. These macros are private to the current module and are @@ -103,7 +103,7 @@

        Examples

        Examples

        defmodule CustomModule do
        -  Record.defmacros __ENV__, :_user, [:name, :age]
        +  Record.defmacros :_user, [:name, :age], __ENV__
         
           def new(name, age) do
             _user(name: name, age: age)
        @@ -128,11 +128,10 @@ 

        Examples

        def age_and_name(user) do _user(user, [:age, :name]) end - end
        - Source + Source

        defrecord(name, values, opts) diff --git a/docs/master/Regex.CompileError.html b/docs/master/Regex.CompileError.html index ad637f8c4..04db72f15 100644 --- a/docs/master/Regex.CompileError.html +++ b/docs/master/Regex.CompileError.html @@ -84,6 +84,11 @@

        Functions summary

        to_keywords/1 +
      • + + update/2 + +
      • update_message/2 @@ -142,6 +147,12 @@

        Functions

        Source +
      • +

        + update(keywords, record) +

        +
        + Source

        update_message(function, record) diff --git a/docs/master/Regex.html b/docs/master/Regex.html index 2addcec63..0d76f3a26 100644 --- a/docs/master/Regex.html +++ b/docs/master/Regex.html @@ -133,12 +133,7 @@

        Functions summary

      • - replace/3 - -
      • -
      • - - replace_all/3 + replace/4
      • @@ -278,14 +273,16 @@

        Examples

      • Source
        -

        - replace(arg1, string, replacement) +

        + replace(arg1, string, replacement, options // [])

        -

        Receives a string and a replacement and returns a string where the -first match of the regular expressions is replaced by replacement. -Inside the replacement, you can either give "&" to access the whole -regular expression or \N, where N is in integer to access an specific -matching parens.

        +

        Receives a regex, a binary and a replacement and returns a new +binary where the all matches are replaced by replacement.

        + +

        Inside the replacement, you can either give "&" to access the +whole regular expression or \N, where N is in integer to access +a specific matching parens. You can also set global to false +if you want to replace just the first occurrence.

        Examples

        @@ -295,15 +292,6 @@

        Examples

        Regex.replace(%r/b/, "abc", "[\\&]") #=> "a[&]c" Regex.replace(%r/(b)/, "abc", "[\\1]") #=> "a[b]c"
        -
        - Source -
        -

        - replace_all(arg1, string, replacement) -

        -

        The same as replace, but replaces all parts where the regular -expressions matches in the string. Please read replace/3 for -documentation and examples.

        Source
        @@ -353,8 +341,8 @@

        Examples

        split(regex, string, options // [])

        -

        Split the given target in the number of parts specified. If no ammount -of parts is given, it defaults to :infinity.

        +

        Split the given target in the number of parts specified. +If no ammount of parts is given, it defaults to :infinity.

        Source
        diff --git a/docs/master/RuntimeError.html b/docs/master/RuntimeError.html index 31bbc8264..2ccdfdec5 100644 --- a/docs/master/RuntimeError.html +++ b/docs/master/RuntimeError.html @@ -84,6 +84,11 @@

        Functions summary

        to_keywords/1 +
      • + + update/2 + +
      • update_message/2 @@ -142,6 +147,12 @@

        Functions

        Source +
      • +

        + update(keywords, record) +

        +
        + Source

        update_message(function, record) diff --git a/docs/master/String.html b/docs/master/String.html index 864203e83..665f5d55b 100644 --- a/docs/master/String.html +++ b/docs/master/String.html @@ -143,7 +143,7 @@

        Examples

        String.at("elixir", -10) #=> "nil"
        - Source + Source

        codepoints(string) @@ -157,7 +157,7 @@

        Examples

        String.codepoints("ἅἪῼ") #=> ["ἅ","Ἢ","ῼ"]
        - Source + Source

        downcase(arg1) @@ -171,7 +171,7 @@

        Examples

        String.downcase("JOSÉ") #=> "josé"
        - Source + Source

        duplicate(subject, n) @@ -184,7 +184,7 @@

        Examples

        String.duplicate("abc", 2) #=> "abcabc"
        - Source + Source

        first(string) @@ -197,7 +197,7 @@

        Examples

        String.first("եոգլի") #=> "ե"
        - Source + Source

        last(string) @@ -210,7 +210,7 @@

        Examples

        String.last("եոգլի") #=> "ի"
        - Source + Source

        length(string) @@ -223,7 +223,7 @@

        Examples

        String.length("եոգլի") #=> 5
        - Source + Source

        lstrip(string, char // 32) @@ -237,7 +237,7 @@

        Examples

        String.lstrip("_ abc _", ?_) #=> " abc _"
        - Source + Source

        printable?(arg1) @@ -253,7 +253,7 @@

        Examples

        Source

        - replace(subject, pattern, replacement, raw_options // []) + replace(subject, pattern, replacement, options // [])

        Returns a new binary based on subject by replacing the parts matching pattern for replacement. If options is specified @@ -266,14 +266,14 @@

        Examples

        Examples

        -
        String.replace("a,b,c", ",", "-") #=> "a-b,c"
        -String.replace("a,b,c", ",", "-", global: true) #=> "a-b-c"
        +
        String.replace("a,b,c", ",", "-") #=> "a-b-c"
        +String.replace("a,b,c", ",", "-", global: false) #=> "a-b,c"
         String.replace("a,b,c", "b", "[]", insert_replaced: 1) #=> "a,[b],c"
        -String.replace("a,b,c", ",", "[]", global: true, insert_replaced: 2) #=> "a[],b[],c"
        -String.replace("a,b,c", ",", "[]", global: true, insert_replaced: [1,1]) #=> "a[,,]b[,,]c"
        +String.replace("a,b,c", ",", "[]", insert_replaced: 2) #=> "a[],b[],c"
        +String.replace("a,b,c", ",", "[]", insert_replaced: [1,1]) #=> "a[,,]b[,,]c"
         
        - Source + Source

        rstrip(string, char // 32) @@ -287,7 +287,7 @@

        Examples

        String.rstrip(" abc _", ?_) #=> " abc "
        - Source + Source

        split(binary, pattern // " ", options // []) @@ -305,18 +305,18 @@

        Examples

        Examples

        -

        String.split("a,b,c", ",") #=> ["a", "b,c"] - String.split("a,b,c", ",", global: true) #=> ["a", "b", "c"] - String.split("foo bar") #=> ["foo", "bar"] - String.split("1,2 3,4", [" ", ","]) #=> ["1", "2 3,4"] - String.split("1,2 3,4", [" ", ","], global: true) #=> ["1", "2", "3", "4"] - String.split("a,b", ".") #=> ["a,b"]

        +
        String.split("a,b,c", ",")  #=> ["a", "b", "c"]
        +String.split("a,b,c", ",", global: false)  #=> ["a", "b,c"]
         
        -

        String.split("a,b,c", %r{,}) #=> ["a", "b,c"] - String.split("a,b,c", %r{,}, global: true) #=> ["a", "b", "c"] - String.split("a,b", %r{.}) #=> ["a,b"]

        +String.split("foo bar") #=> ["foo", "bar"] +String.split("1,2 3,4", [" ", ","]) #=> ["1", "2", "3", "4"] + +String.split("a,b,c", %r{,}) #=> ["a", "b", "c"] +String.split("a,b,c", %r{,}, global: false) #=> ["a", "b,c"] +String.split("a,b", %r{.}) #=> ["a,b"] +
        - Source + Source

        strip(string, char // 32) @@ -330,7 +330,7 @@

        Examples

        String.strip("a abc a", ?a) #=> " abc "
        - Source + Source

        upcase(arg1) @@ -344,7 +344,7 @@

        Examples

        String.upcase("josé") #=> "JOSÉ"
        - Source + Source diff --git a/docs/master/SyntaxError.html b/docs/master/SyntaxError.html index 91e896297..742e6a727 100644 --- a/docs/master/SyntaxError.html +++ b/docs/master/SyntaxError.html @@ -39,19 +39,19 @@

        Fields (and defaults)

      • - description: "syntax error" + file: nil
      • - file: nil + line: nil
      • - line: nil + description: "syntax error"
      • @@ -121,6 +121,11 @@

        Functions summary

        to_keywords/1 +
      • + + update/2 + +
      • update_description/2 @@ -219,6 +224,12 @@

        Functions

        Source +
        +

        + update(keywords, record) +

        +
        + Source

        update_description(function, record) diff --git a/docs/master/System.html b/docs/master/System.html index 40d78eb5a..b8e219696 100644 --- a/docs/master/System.html +++ b/docs/master/System.html @@ -120,7 +120,7 @@

        Functions

        Returns the list of command-line arguments passed to the program.

        - Source + Source

        at_exit(fun) @@ -132,17 +132,14 @@

        Functions

        The function must expect the exit status code as argument.

        - Source + Source

        build_info()

        -

        Returns a tuple { Elixir version, commit sha-1, build date }.

        - -

        The format of the return value may change in a future release. Please -make sure your code doesn't depend on it.

        +

        Returns a keywords list with version, git tag info and date.

        - Source + Source

        cmd(command) @@ -154,7 +151,7 @@

        Functions

        If command is a char list, a char list is returned. Returns a binary otherwise.

        - Source + Source

        find_executable(command) @@ -166,7 +163,7 @@

        Functions

        If command is a char list, a char list is returned. Returns a binary otherwise.

        - Source + Source

        get_env() @@ -175,7 +172,7 @@

        Functions

        given as a single string of the format "VarName=Value", where VarName is the name of the variable and Value its value.

        - Source + Source

        get_env(varname) @@ -184,7 +181,7 @@

        Functions

        varname as a binary, or nil if the environment variable is undefined.

        - Source + Source

        get_pid() @@ -194,7 +191,7 @@

        Functions

        See http://www.erlang.org/doc/man/os.html#getpid-0 for more info.

        - Source + Source

        put_env(dict) @@ -202,21 +199,21 @@

        Functions

        Sets a new value for each environment variable corresponding to each key in dict.

        - Source + Source

        put_env(varname, value)

        Sets a new value for the environment variable varname.

        - Source + Source

        stacktrace()

        Get the stacktrace.

        - Source + Source

        version() diff --git a/docs/master/SystemLimitError.html b/docs/master/SystemLimitError.html index 9588485e2..c601d7de2 100644 --- a/docs/master/SystemLimitError.html +++ b/docs/master/SystemLimitError.html @@ -84,6 +84,11 @@

        Functions summary

        to_keywords/1
      • +
      • + + update/2 + +
      • update_message/2 @@ -142,6 +147,12 @@

        Functions

        Source +
        +

        + update(keywords, record) +

        +
        + Source

        update_message(function, record) diff --git a/docs/master/TokenMissingError.html b/docs/master/TokenMissingError.html index f01262b56..518048f14 100644 --- a/docs/master/TokenMissingError.html +++ b/docs/master/TokenMissingError.html @@ -39,19 +39,19 @@

        Fields (and defaults)

      • - description: "expression is incomplete" + file: nil
      • - file: nil + line: nil
      • - line: nil + description: "expression is incomplete"
      • @@ -121,6 +121,11 @@

        Functions summary

        to_keywords/1 +
      • + + update/2 + +
      • update_description/2 @@ -219,6 +224,12 @@

        Functions

        Source +
        +

        + update(keywords, record) +

        +
        + Source

        update_description(function, record) diff --git a/docs/master/URI.html b/docs/master/URI.html index e20371e2a..ececf5633 100644 --- a/docs/master/URI.html +++ b/docs/master/URI.html @@ -91,7 +91,7 @@

        Functions

        Source

        - decode_query(q, dict // Orddict.new()) + decode_query(q, dict // OrdDict.new())

        Given a query string of the form "key1=value1&key=value2...", produces an orddict with one entry for each key-value pair. Each key and value will be a diff --git a/docs/master/UndefinedFunctionError.html b/docs/master/UndefinedFunctionError.html index c55c131df..da4dad5c5 100644 --- a/docs/master/UndefinedFunctionError.html +++ b/docs/master/UndefinedFunctionError.html @@ -39,7 +39,7 @@

        Fields (and defaults)

      • - arity: nil + module: nil
      • @@ -51,7 +51,7 @@

        Fields (and defaults)

      • - module: nil + arity: nil
      • @@ -121,6 +121,11 @@

        Functions summary

        to_keywords/1 +
      • + + update/2 + +
      • update_arity/2 @@ -219,6 +224,12 @@

        Functions

        Source +
        +

        + update(keywords, record) +

        +
        + Source

        update_arity(function, record) diff --git a/docs/master/modules_list.html b/docs/master/modules_list.html index 62a088a69..528290c64 100644 --- a/docs/master/modules_list.html +++ b/docs/master/modules_list.html @@ -16,7 +16,7 @@

      • +
      • + + zip/2 + + Enum +
      • +
    1603. @@ -1476,48 +1483,6 @@

    1604. @@ -1627,56 +1550,56 @@

    1605. - d/0 + h/0 IEx.Helpers
    1606. - d/1 + h/1 IEx.Helpers
    1607. - d/2 + h/2 IEx.Helpers
    1608. - d/3 + h/3 IEx.Helpers
    1609. - h/0 + m/0 IEx.Helpers
    1610. - m/0 + r/0 IEx.Helpers
    1611. - r/0 + r/1 IEx.Helpers
    1612. - r/1 + v/0 IEx.Helpers
    1613. @@ -2356,6 +2279,27 @@

      Kernel

    1614. +
    1615. + + binary_to_float/1 + + Kernel +
    1616. + +
    1617. + + binary_to_integer/1 + + Kernel +
    1618. + +
    1619. + + binary_to_integer/2 + + Kernel +
    1620. +
    1621. binary_to_list/1 @@ -2531,6 +2475,13 @@

      Kernel

    1622. +
    1623. + + float_to_binary/1 + + Kernel +
    1624. +
    1625. float_to_list/1 @@ -2601,6 +2552,20 @@

      Kernel

    1626. +
    1627. + + integer_to_binary/1 + + Kernel +
    1628. + +
    1629. + + integer_to_binary/2 + + Kernel +
    1630. +
    1631. integer_to_list/1 @@ -3109,6 +3074,13 @@

      Keyword

    1632. +
    1633. + + equal?/2 + + Keyword +
    1634. +
    1635. from_enum/1 @@ -3139,7 +3111,7 @@

    1636. - key?/2 + has_key?/2 Keyword
    1637. @@ -3379,13 +3351,6 @@

      List

    1638. -
    1639. - - zip/2 - - List -
    1640. -
    1641. @@ -3404,6 +3369,13 @@

      Macro

    1642. +
    1643. + + do_safe_term/1 + + Macro +
    1644. +
    1645. escape/1 @@ -3418,6 +3390,13 @@

      Macro

    1646. +
    1647. + + safe_term/1 + + Macro +
    1648. +
    1649. to_binary/1 @@ -4545,6 +4524,13 @@

      Module

    1650. +
    1651. + + create/3 + + Module +
    1652. +
    1653. defines?/2 @@ -4767,116 +4753,32 @@

    1654. - Orddict + OrdDict - Orddict + OrdDict
    1655. @@ -5289,14 +5191,7 @@

    1656. - replace/3 - - Regex -
    1657. - -
    1658. - - replace_all/3 + replace/4 Regex
    1659. diff --git a/docs/master/protocols_list.html b/docs/master/protocols_list.html index ca8128d2f..b442a119e 100644 --- a/docs/master/protocols_list.html +++ b/docs/master/protocols_list.html @@ -16,7 +16,7 @@

      - Elixir v0.7.0.dev + Elixir v0.7.0

      + +
      diff --git a/docs/stable/Access.Binary.Dict.html b/docs/stable/Access.Binary.Dict.html new file mode 100644 index 000000000..09a3ed345 --- /dev/null +++ b/docs/stable/Access.Binary.Dict.html @@ -0,0 +1,51 @@ + + + + Access.Binary.Dict + + + + + + + + + + + + +
      +

      + Access.Binary.Dict + + impl + +

      + + + + Source + + + + + + + + + + + + + + + + +
      + + diff --git a/docs/stable/Access.Function.html b/docs/stable/Access.Function.html index 3fd5a2014..a8a20886d 100644 --- a/docs/stable/Access.Function.html +++ b/docs/stable/Access.Function.html @@ -29,7 +29,7 @@

      - Source + Source @@ -50,6 +50,8 @@

      Functions summary

      + +

      Functions

      @@ -61,12 +63,14 @@

      Functions

      is useful because it allows a function to be passed as argument in places a dict would also fit.

      - Source + Source
      + + diff --git a/docs/stable/Access.HashDict.html b/docs/stable/Access.HashDict.html new file mode 100644 index 000000000..a67f39f44 --- /dev/null +++ b/docs/stable/Access.HashDict.html @@ -0,0 +1,51 @@ + + + + Access.HashDict + + + + + + + + + + + + +
      +

      + Access.HashDict + + impl + +

      + + + + Source + + + + + + + + + + + + + + + + +
      + + diff --git a/docs/stable/Access.List.html b/docs/stable/Access.List.html index 52c885f9b..8b0824e50 100644 --- a/docs/stable/Access.List.html +++ b/docs/stable/Access.List.html @@ -50,13 +50,15 @@

      Functions summary

      + +

      Functions

      access(list, atom)

      -

      Access the given key in a keywords list.

      +

      Access the given key in a keyword list.

      Examples

      @@ -70,6 +72,8 @@

      Examples

      + +
      diff --git a/docs/stable/Access.OrdDict.html b/docs/stable/Access.OrdDict.html new file mode 100644 index 000000000..4c528af5e --- /dev/null +++ b/docs/stable/Access.OrdDict.html @@ -0,0 +1,51 @@ + + + + Access.OrdDict + + + + + + + + + + + + +
      +

      + Access.OrdDict + + impl + +

      + + + + Source + + + + + + + + + + + + + + + + +
      + + diff --git a/docs/stable/Access.html b/docs/stable/Access.html index a2fe7b890..fab96371c 100644 --- a/docs/stable/Access.html +++ b/docs/stable/Access.html @@ -35,7 +35,7 @@

      invokes Access.access protocol.

      This protocol is limited and is implemented only for the -following built-in types: keywords, tuples, atoms and +following built-in types: keywords, records, atoms and functions.

      @@ -53,18 +53,36 @@

      Implementations

    1660. +
    1661. + + Binary.Dict + +
    1662. +
    1663. Function
    1664. +
    1665. + + HashDict + +
    1666. +
    1667. List
    1668. +
    1669. + + OrdDict + +
    1670. + @@ -85,11 +103,13 @@

      Functions summary

      + +

      Functions

      - access(xA, xB) + access(element, qualifier)

      Receives the element being accessed and the access item.

      @@ -99,6 +119,8 @@

      Functions

      + +
      diff --git a/docs/stable/ArgumentError.html b/docs/stable/ArgumentError.html index 934d4c77e..99da265b4 100644 --- a/docs/stable/ArgumentError.html +++ b/docs/stable/ArgumentError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -84,6 +84,11 @@

      Functions summary

      to_keywords/1
    1671. +
    1672. + + update/2 + +
    1673. update_message/2 @@ -96,6 +101,8 @@

      Functions summary

      + +

      Functions

      @@ -103,54 +110,62 @@

      Functions

      exception(args)

      - Source + Source

      exception(args, self)

      - Source + Source

      message(record)

      - Source + Source

      message(value, record)

      - Source + Source

      new()

      - Source + Source

      new(opts)

      - Source + Source

      to_keywords(record)

      - Source + Source +
      +

      + update(keywords, record) +

      +
      + Source

      update_message(function, record)

      - Source + Source
      + + diff --git a/docs/stable/ArithmeticError.html b/docs/stable/ArithmeticError.html index b7483a548..8be9f9383 100644 --- a/docs/stable/ArithmeticError.html +++ b/docs/stable/ArithmeticError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -84,6 +84,11 @@

      Functions summary

      to_keywords/1
    1674. +
    1675. + + update/2 + +
    1676. update_message/2 @@ -96,6 +101,8 @@

      Functions summary

      + +

      Functions

      @@ -103,54 +110,62 @@

      Functions

      exception(args)

      - Source + Source

      exception(args, self)

      - Source + Source

      message(record)

      - Source + Source

      message(value, record)

      - Source + Source

      new()

      - Source + Source

      new(opts)

      - Source + Source

      to_keywords(record)

      - Source + Source +
      +

      + update(keywords, record) +

      +
      + Source

      update_message(function, record)

      - Source + Source
      + + diff --git a/docs/stable/BadArityError.html b/docs/stable/BadArityError.html index 44d289472..768e24227 100644 --- a/docs/stable/BadArityError.html +++ b/docs/stable/BadArityError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -39,13 +39,13 @@

      Fields (and defaults)

    1677. - args: nil + function: nil
    1678. - function: nil + args: nil
    1679. @@ -105,6 +105,11 @@

      Functions summary

      to_keywords/1 +
    1680. + + update/2 + +
    1681. update_args/2 @@ -122,6 +127,8 @@

      Functions summary

      + +

      Functions

      @@ -129,78 +136,86 @@

      Functions

      args(record)

      - Source + Source

      args(value, record)

      - Source + Source

      exception(args)

      - Source + Source

      exception(args, self)

      - Source + Source

      function(record)

      - Source + Source

      function(value, record)

      - Source + Source

      message(exception)

      - Source + Source

      new()

      - Source + Source

      new(opts)

      - Source + Source

      to_keywords(record)

      - Source + Source +
      +

      + update(keywords, record) +

      +
      + Source

      update_args(function, record)

      - Source + Source

      update_function(function, record)

      - Source + Source
      + + diff --git a/docs/stable/BadFunctionError.html b/docs/stable/BadFunctionError.html index c71393de3..5c40a2c5d 100644 --- a/docs/stable/BadFunctionError.html +++ b/docs/stable/BadFunctionError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -89,6 +89,11 @@

      Functions summary

      to_keywords/1
    1682. +
    1683. + + update/2 + +
    1684. update_actual/2 @@ -101,6 +106,8 @@

      Functions summary

      + +

      Functions

      @@ -108,60 +115,68 @@

      Functions

      actual(record)

      - Source + Source

      actual(value, record)

      - Source + Source

      exception(args)

      - Source + Source

      exception(args, self)

      - Source + Source

      message(exception)

      - Source + Source

      new()

      - Source + Source

      new(opts)

      - Source + Source

      to_keywords(record)

      - Source + Source +
      +

      + update(keywords, record) +

      +
      + Source

      update_actual(function, record)

      - Source + Source
      + + diff --git a/docs/stable/Behaviour.html b/docs/stable/Behaviour.html new file mode 100644 index 000000000..ddce0d3bc --- /dev/null +++ b/docs/stable/Behaviour.html @@ -0,0 +1,117 @@ + + + + Behaviour + + + + + + + + + + + + +
      +

      + Behaviour + +

      + + +
      +

      A convenience module for defining behaviours. +Behaviours can be referenced by other modules +in order to ensure they implement the proper +callbacks.

      + +

      For example, you can specify the URI.Parser +behaviour as follow:

      + +
      defmodule URI.Parser do
      +  use Behaviour
      +
      +  @doc "Parses the given URL"
      +  defcallback parse(arg)
      +
      +  @doc "Defines a default port"
      +  defcallback default_port()
      +end
      +
      + +

      And then a specific protocol may use it as:

      + +
      defmodule URI.HTTP do
      +  @behaviour URI.Parser
      +  def default_port(), do: 80
      +  def parse(info), do: info
      +end
      +
      + +

      In case the behaviour changes or URI.HTTP does +not implement one of the callbacks, a warning +will be raised.

      + +

      Implementation

      + +

      Internally, Erlang call behaviour_info(:callbacks) +to obtain all functions that a behaviour should +implemented. Therefore, all this module does is +to define behaviour_info(:callbacks) with the +defcallback definitions.

      + +
      + + + Source + + + + + + + + +

      Macros summary

      + + + + + + + + +
      +

      Macros

      +
      +

      + defcallback(fun) +

      +

      Annotates the given function is a callback. defcallback is +slightly different than simple using def because, even if +defcallback contains default values, a default function +won't be generated, which would happen with def.

      +
      + Source +
      +
      + + + +
      + + diff --git a/docs/stable/Binary.Chars.Atom.html b/docs/stable/Binary.Chars.Atom.html index b394c9311..0a7726df0 100644 --- a/docs/stable/Binary.Chars.Atom.html +++ b/docs/stable/Binary.Chars.Atom.html @@ -50,6 +50,8 @@

      Functions summary

      + +

      Functions

      @@ -65,6 +67,8 @@

      Functions

      + +
      diff --git a/docs/stable/Binary.Chars.BitString.html b/docs/stable/Binary.Chars.BitString.html index 8d4b3a8b3..2e297c089 100644 --- a/docs/stable/Binary.Chars.BitString.html +++ b/docs/stable/Binary.Chars.BitString.html @@ -50,6 +50,8 @@

      Functions summary

      + +

      Functions

      @@ -64,6 +66,8 @@

      Functions

      + +
      diff --git a/docs/stable/Binary.Chars.List.html b/docs/stable/Binary.Chars.List.html index b480a7b3e..f1276dc7d 100644 --- a/docs/stable/Binary.Chars.List.html +++ b/docs/stable/Binary.Chars.List.html @@ -50,6 +50,8 @@

      Functions summary

      + +

      Functions

      @@ -73,6 +75,8 @@

      Examples

      + +
      diff --git a/docs/stable/Binary.Chars.Number.html b/docs/stable/Binary.Chars.Number.html index 9d4b24298..8880de46d 100644 --- a/docs/stable/Binary.Chars.Number.html +++ b/docs/stable/Binary.Chars.Number.html @@ -50,6 +50,8 @@

      Functions summary

      + +

      Functions

      @@ -64,6 +66,8 @@

      Functions

      + +
      diff --git a/docs/stable/Binary.Chars.html b/docs/stable/Binary.Chars.html index f25f13800..c2bccad36 100644 --- a/docs/stable/Binary.Chars.html +++ b/docs/stable/Binary.Chars.html @@ -93,11 +93,13 @@

      Functions summary

      + +

      Functions

      - to_binary(xA) + to_binary(thing)

      Source @@ -106,6 +108,8 @@

      Functions

      + +
      diff --git a/docs/stable/Dict.HashDict.html b/docs/stable/Binary.Dict.html similarity index 61% rename from docs/stable/Dict.HashDict.html rename to docs/stable/Binary.Dict.html index 73d4230f5..94bbad5c9 100644 --- a/docs/stable/Dict.HashDict.html +++ b/docs/stable/Binary.Dict.html @@ -1,7 +1,7 @@ - Dict.HashDict + Binary.Dict @@ -21,15 +21,22 @@

      - Dict.HashDict - - impl + Binary.Dict

      +
      +

      This module implements a dictionary that forces the keys to be +converted to binaries on insertion. Currently it is implemented +using an OrdDict, but this may change in the future.

      + +

      Check the Dict module for examples and documentation.

      + +
      + - Source + Source @@ -65,12 +72,22 @@

      Functions summary

    1685. - merge/2 + merge/3
    1686. - merge/3 + new/0 + +
    1687. +
    1688. + + new/1 + +
    1689. +
    1690. + + new/2
    1691. @@ -110,6 +127,8 @@

      Functions summary

      + +

      Functions

      @@ -117,84 +136,114 @@

      Functions

      delete(arg1, key)

      - Source + Source

      empty(_)

      - Source + Source

      - get(arg1, key, default // nil) + get(arg1, key, default)

      - Source + Source

      has_key?(arg1, key)

      - Source + Source

      keys(arg1)

      - Source + Source
      -

      - merge(arg1, arg2) +

      + merge(d1, d2, fun)

      - Source + Source
      -

      - merge(arg1, arg2, fun) +

      + new()

      -
      - Source +

      Creates a new empty dict.

      +
      + Source +
      +

      + new(pairs) +

      +

      Creates a new dict from a list of pairs.

      + +

      Examples

      + +
      Binary.Dict.new [{:b,1},{:a,2}]
      +#=> [a: 1, b: 2]
      +
      +
      + Source +
      +

      + new(list, transform) +

      +

      Creates a new dict from a list of elements with the +help of the transformation function.

      + +

      Examples

      + +
      Binary.Dict.new ["a", "b"], fn x -> {x, x} end
      +#=> ["a": "a", "b": "b"]
      +
      +
      + Source

      put(arg1, key, value)

      - Source + Source

      size(arg1)

      - Source + Source

      to_list(arg1)

      - Source + Source

      update(arg1, key, fun)

      - Source + Source

      update(arg1, key, initial, fun)

      - Source + Source

      values(arg1)

      - Source + Source
      + + diff --git a/docs/stable/Binary.Inspect.Any.html b/docs/stable/Binary.Inspect.Any.html index 8bd40dd40..09580d5ef 100644 --- a/docs/stable/Binary.Inspect.Any.html +++ b/docs/stable/Binary.Inspect.Any.html @@ -28,45 +28,32 @@

      +
      +

      For all other terms not implemented, we use the default +Erlang representation.

      - Source +

      Examples

      +
      inspect Process.self #=> "<0.35.0>"
      +
      + +
      + Source + -

      Functions summary

      - + -
      -

      Functions

      -
      -

      - inspect(thing) -

      -

      For all other terms not implemented, we use the default -Erlang representation.

      -

      Examples

      + -
      inspect Process.self #=> "<0.35.0>"
      -
      -
      - Source -
      -
      diff --git a/docs/stable/Binary.Inspect.Atom.html b/docs/stable/Binary.Inspect.Atom.html index 1e80c80b7..1afa443d7 100644 --- a/docs/stable/Binary.Inspect.Atom.html +++ b/docs/stable/Binary.Inspect.Atom.html @@ -28,51 +28,38 @@

      +
      +

      Represents the atom as an Elixir term. The atoms false, true +and nil are simply quoted. Modules are properly represented +as modules using the dot notation.

      - Source +

      Notice that in Elixir, all operators can be represented using +literal atoms (:+, :-, etc).

      - +

      Examples

      +
      inspect(:foo)    #=> ":foo"
      +inspect(nil)     #=> "nil"
      +inspect(Foo.Bar) #=> "Foo.Bar"
      +
      + +
      + Source + -

      Functions summary

      - + -
      -

      Functions

      -
      -

      - inspect(atom) -

      -

      Represents the atom as an Elixir term. The atoms false, true -and nil are simply quoted. Modules are properly represented -as modules using the dot notation.

      -

      Notice that in Elixir, all operators can be represented using -literal atoms (:+, :-, etc).

      + -

      Examples

      + -
      inspect(:foo)    #=> ":foo"
      -inspect(nil)     #=> "nil"
      -inspect(Foo.Bar) #=> "Foo.Bar"
      -
      -
      - Source -
      -
      diff --git a/docs/stable/Binary.Inspect.BitString.html b/docs/stable/Binary.Inspect.BitString.html index b927a4052..72dccdf84 100644 --- a/docs/stable/Binary.Inspect.BitString.html +++ b/docs/stable/Binary.Inspect.BitString.html @@ -28,46 +28,33 @@

      +
      +

      Represents the string as itself escaping +all necessary characters.

      + +

      Examples

      - Source +
      inspect("bar")   #=> "bar"
      +inspect("f\"oo") #=> "f\"oo"
      +
      +
      + Source + -

      Functions summary

      - + -
      -

      Functions

      -
      -

      - inspect(thing) -

      -

      Represents the string as itself escaping -all necessary characters.

      -

      Examples

      + -
      inspect("bar")   #=> "bar"
      -inspect("f\"oo") #=> "f\"oo"
      -
      -
      - Source -
      -
      diff --git a/docs/stable/Binary.Inspect.List.html b/docs/stable/Binary.Inspect.List.html index f737fe5bb..730b02454 100644 --- a/docs/stable/Binary.Inspect.List.html +++ b/docs/stable/Binary.Inspect.List.html @@ -28,46 +28,8 @@

      - - Source - - - - - - -

      Functions summary

      - - - - - - -
      -

      Functions

      -
      -

      - container_join(list1, acc, last) -

      -
      - Source -
      -

      - inspect(thing) -

      -

      Represents a list checking if it can be printed or not. +

      +

      Represents a list checking if it can be printed or not. If so, a single-quoted representation is returned, otherwise the brackets syntax is used.

      @@ -83,12 +45,26 @@

      Examples

      inspect([0|'bar']) #=> "[0,98,97,114]" inspect([:foo,:bar]) #=> "[:foo, :bar]" -
      - Source -
      +
      + Source + + + + + + + + + + + + + + +
      diff --git a/docs/stable/Binary.Inspect.Number.html b/docs/stable/Binary.Inspect.Number.html index 4b3591776..0586aeb29 100644 --- a/docs/stable/Binary.Inspect.Number.html +++ b/docs/stable/Binary.Inspect.Number.html @@ -28,44 +28,31 @@

      +
      +

      Represents the number as a binary.

      - Source +

      Examples

      + +
      inspect(1) #=> "1"
      +
      +
      + Source + -

      Functions summary

      - + -
      -

      Functions

      -
      -

      - inspect(thing) -

      -

      Represents the number as a binary.

      -

      Examples

      + -
      inspect(1) #=> "1"
      -
      -
      - Source -
      -
      diff --git a/docs/stable/Binary.Inspect.Regex.html b/docs/stable/Binary.Inspect.Regex.html index 009614b88..95c197203 100644 --- a/docs/stable/Binary.Inspect.Regex.html +++ b/docs/stable/Binary.Inspect.Regex.html @@ -28,44 +28,31 @@

      +
      +

      Represents the Regex using the %r"" syntax.

      - Source +

      Examples

      + +
      inspect(%r/foo/m) #=> "%r\"foo\"m"
      +
      +
      + Source + -

      Functions summary

      - + -
      -

      Functions

      -
      -

      - inspect(thing) -

      -

      Represents the Regex using the %r"" syntax.

      -

      Examples

      + -
      inspect(%r/foo/m) #=> "%r\"foo\"m"
      -
      -
      - Source -
      -
      diff --git a/docs/stable/Binary.Inspect.Tuple.html b/docs/stable/Binary.Inspect.Tuple.html index 19410ccab..24f94ce40 100644 --- a/docs/stable/Binary.Inspect.Tuple.html +++ b/docs/stable/Binary.Inspect.Tuple.html @@ -28,46 +28,33 @@

      +
      +

      Inspect tuples. If the tuple represents a record, +it shows it nicely formatted using the access syntax.

      + +

      Examples

      - Source +
      inspect({1,2,3})            #=> "{1,2,3}"
      +inspect(ArgumentError.new)  #=> ArgumentError[message: "argument error"]
      +
      +
      + Source + -

      Functions summary

      - + -
      -

      Functions

      -
      -

      - inspect(exception) -

      -

      Inspect tuples. If the tuple represents a record, -it shows it nicely formatted using the access syntax.

      -

      Examples

      + -
      inspect({1,2,3})            #=> "{1,2,3}"
      -inspect(ArgumentError.new)  #=> ArgumentError[message: "argument error"]
      -
      -
      - Source -
      -
      diff --git a/docs/stable/Binary.Inspect.html b/docs/stable/Binary.Inspect.html index c83349a8c..96a6e7e57 100644 --- a/docs/stable/Binary.Inspect.html +++ b/docs/stable/Binary.Inspect.html @@ -30,11 +30,12 @@

      The Binary.Inspect protocol is responsible for -converting any structure to a Binary for textual -representation. All basic data structures (tuple, -list, function, pid, etc) implement the inspect -protocol. Other structures are adviced to implement -the protocol in order to provide pretty printing.

      +converting any structure to a binary for textual +representation. All basic data structures +(tuple, list, function, pid, etc) implement the +inspect protocol. Other structures are advised to +implement the protocol in order to provide pretty +printing.

      @@ -97,7 +98,7 @@

      Functions summary

      • - inspect/1 + inspect/2
      • @@ -107,19 +108,23 @@

        Functions summary

        + +

        Functions

        -

        - inspect(xA) +

        + inspect(thing, opts)

        - Source + Source
        + + diff --git a/docs/stable/Binary.html b/docs/stable/Binary.html deleted file mode 100644 index d9925ff26..000000000 --- a/docs/stable/Binary.html +++ /dev/null @@ -1,202 +0,0 @@ - - - - Binary - - - - - - - - - - - - -
        -

        - Binary - -

        - - -
        -

        Functions for working with binaries.

        - -
        - - - Source - - - - - - -

        Functions summary

        - - - - - - -
        -

        Functions

        -
        -

        - escape(other, char) -

        -

        Receives a char list and escapes all special chars (like \n) -and interpolation markers. A last argument is given and wraps -the whole char list given.

        - -

        Examples

        - -
        Binary.escape "foo", ?'
        -#=> "'foo'"
        -
        -
        - Source -
        -

        - printable?(arg1) -

        -

        Check if a binary is printable considering it is encoded -as UTF-8. Returns true if so, false otherwise.

        - -

        Examples

        - -
        Binary.printable?("abc") #=> true
        -
        -
        - Source -
        -

        - unescape(chars) -

        -

        Unescape the given chars. The unescaping is driven by the same -rules as single- and double-quoted strings. Check unescape/2 -for information on how to customize the escaping map.

        - -

        In this setup, Elixir will escape the following: \b, \d, -\e, \f, \n, \r, \s, \t and \v. Octals are also -escaped according to the latin1 set they represent.

        - -

        Examples

        - -
        Binary.unescape "example\\n"
        -#=> "example\n"
        -
        - -

        In the example above, we pass a string with \n escaped -and we return a version with it unescaped.

        -
        - Source -
        -

        - unescape(chars, map) -

        -

        Unescape the given chars according to the map given. -Check unescape/1 if you want to use the same map as Elixir -single- and double-quoted strings.

        - -

        Map

        - -

        The map must be a function. The function receives an integer -representing the number of the characters it wants to unescape. -Here is the default mapping function implemented by Elixir:

        - -
        def unescape_map(?b), do: ?\b
        -def unescape_map(?d), do: ?\d
        -def unescape_map(?e), do: ?\e
        -def unescape_map(?f), do: ?\f
        -def unescape_map(?n), do: ?\n
        -def unescape_map(?r), do: ?\r
        -def unescape_map(?s), do: ?\s
        -def unescape_map(?t), do: ?\t
        -def unescape_map(?v), do: ?\v
        -def unescape_map(e), do: e
        -
        - -

        If the unescape_map function returns false. The char is -not escaped and \ is kept in the char list.

        - -

        Octals

        - -

        Octals will by default be escaped unless the map function -returns false for ?0.

        - -

        Examples

        - -

        Using the unescape_map defined above is easy:

        - -
        Binary.unescape "example\\n", unescape_map(&1)
        -
        -
        - Source -
        -

        - unescape_tokens(tokens) -

        -

        Unescape the given tokens according to the default map. -Check unescape/1 and unescape/2 for more information -about unescaping. Only tokens that are char lists are -unescaped, all others are ignored. This method is useful -when implementing your own sigils. Check the implementation -of Kernel.__b__ for examples.

        -
        - Source -
        -

        - unescape_tokens(tokens, map) -

        -

        Unescape the given tokens according to the given map. -Check unescape_tokens/1 and unescaped/2 for more information.

        -
        - Source -
        -
        - - - -
        - - diff --git a/docs/stable/Bitwise.html b/docs/stable/Bitwise.html index 5a8664906..74c9f0353 100644 --- a/docs/stable/Bitwise.html +++ b/docs/stable/Bitwise.html @@ -131,6 +131,8 @@

        Macros summary

        + +

        Macros

        @@ -233,6 +235,8 @@

        Macros

        + + diff --git a/docs/stable/CaseClauseError.html b/docs/stable/CaseClauseError.html index e2732e8dc..127001e4e 100644 --- a/docs/stable/CaseClauseError.html +++ b/docs/stable/CaseClauseError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -89,6 +89,11 @@

        Functions summary

        to_keywords/1 +
      • + + update/2 + +
      • update_actual/2 @@ -101,6 +106,8 @@

        Functions summary

        + +

        Functions

        @@ -108,60 +115,68 @@

        Functions

        actual(record)

        - Source + Source

        actual(value, record)

        - Source + Source

        exception(args)

        - Source + Source

        exception(args, self)

        - Source + Source

        message(exception)

        - Source + Source

        new()

        - Source + Source

        new(opts)

        - Source + Source

        to_keywords(record)

        - Source + Source +
        +

        + update(keywords, record) +

        +
        + Source

        update_actual(function, record)

        - Source + Source
        + + diff --git a/docs/stable/Code.html b/docs/stable/Code.html index 3db072753..8e5d83e99 100644 --- a/docs/stable/Code.html +++ b/docs/stable/Code.html @@ -65,16 +65,31 @@

        Functions summary

        compiler_options/1
      • +
      • + + delete_path/1 + +
      • ensure_compiled/1
      • +
      • + + ensure_compiled?/1 + +
      • ensure_loaded/1
      • +
      • + + ensure_loaded?/1 + +
      • eval/3 @@ -115,6 +130,11 @@

        Functions summary

        string_to_ast!/2
      • +
      • + + unload_files/1 + +
      @@ -122,6 +142,8 @@

      Functions summary

      + +

      Functions

      @@ -131,7 +153,7 @@

      Functions

      Appends a path to Erlang VM code path. The path is expanded with File.expand_path before added.

      - Source + Source

      compile_string(string, file // "nofile") @@ -142,7 +164,7 @@

      Functions

      For compiling many files at once, check Kernel.ParallelCompiler.

      - Source + Source

      compiler_options() @@ -150,7 +172,7 @@

      Functions

      Loads the compilation options from the code server. Check compiler_options/1 for more information.

      - Source + Source

      compiler_options(opts) @@ -170,7 +192,15 @@

      Functions

      without raising errors, false by default;
    1692. - Source + Source +
      +

      + delete_path(path) +

      +

      Deletes a path from Erlang VM code path. +The path is expanded with File.expand_path before deleted.

      +
      + Source

      ensure_compiled(module) @@ -187,7 +217,15 @@

      Functions

      Check ensure_loaded/1 for more information on module loading and when to use ensure_loaded/1 or ensure_compiled/1.

      - Source + Source +
      +

      + ensure_compiled?(module) +

      +

      Similar to ensure_compiled/1, but returns a boolean in case +it could be ensured or not.

      +
      + Source

      ensure_loaded(module) @@ -210,8 +248,8 @@

      Code loading on the Erlang VM

      Therefore, this function is useful to check if a module is loaded before using it and react accordingly. For example, the URI module -uses this function to check if a specific parser exists and is for the -given URI scheme.

      +uses this function to check if a specific parser exists for a given +URI scheme.

      Code.ensure_compiled

      @@ -229,7 +267,15 @@

      Code.ensure_compiled

      must be used just in same rare conditions, usually involving macros that needs to invoke a module for callback information.

      - Source + Source +
      +

      + ensure_loaded?(module) +

      +

      Similar to ensure_loaded/1, but returns a boolean in case +it could be ensured or not.

      +
      + Source

      eval(string, binding // [], opts // []) @@ -252,13 +298,13 @@

      Examples

      When passing the ENV's file and line, we could simply get -the location which already returns both fields as a keyword lists:

      +the location which already returns both fields as a keyword list:

      Code.eval "a + b", [a: 1, b: 2], __ENV__.location
       #=> { 3, [ {:a, 1}, {:b, 2} ] }
       
      - Source + Source

      eval_quoted(quoted, binding // [], opts // []) @@ -284,26 +330,30 @@

      Examples

      #=> { 3, [ {:a, 1}, {:b, 2} ] } -

      When passing the ENV's file and line, we could simply get -the location which already returns both fields as a keyword lists:

      +

      For convenience, you can also pass the current ENV and +the proper information will be extracted:

      -
      Code.eval_quoted contents, [a: 1, b: 2], __ENV__.location
      +
      Code.eval_quoted contents, [a: 1, b: 2], __ENV__
       #=> { 3, [ {:a, 1}, {:b, 2} ] }
       
      - Source + Source

      load_file(file, relative_to // nil)

      -

      Loads the given file. Accepts relative_to as an argument to tell -where the file is located. If the file was already required/loaded, -loads it again. It returns the full path of the loaded file.

      - -

      When loading a file, you may skip passing .exs as extension as Elixir -automatically adds it for you.

      +

      Loads the given file. Accepts relative_to as an argument +to tell where the file is located. If the file was already +required/loaded, loads it again. It returns all the modules +defined in the file.

      + +

      Notice that if load_file is invoked by different processes +concurrently, the target file will be invoked concurrently +in many times. I.e. if load_file is called N times with +a given file, the given file will be loaded N times. Check +require_file if you don't want a file to be loaded concurrently.

      - Source + Source

      loaded_files() @@ -318,19 +368,24 @@

      Examples

      Prepends a path to Erlang VM code path. The path is expanded with File.expand_path before added.

      - Source + Source

      require_file(file, relative_to // nil)

      -

      Requires the given file. Accepts relative_to as an argument to tell -where the file is located. If the file was already required/loaded, -returns nil, otherwise the full path of the loaded file.

      - -

      When requiring a file, you may skip passing .exs as extension as -Elixir automatically adds it for you.

      +

      Requires the given file. Accepts relative_to as an argument +to tell where the file is located. If the file was already +required/loaded, loads it again. It returns all the modules +defined in the file.

      + +

      Notice that if require_file is invoked by different processes +concurrently, the first process to invoke require_file acquires +a lock and the remaining ones will block until the file is +available. I.e. if require_file is called N times with a given +file, the given file will be loaded only once. Check load_file +if you want a file to be loaded concurrently.

      - Source + Source

      string_to_ast(string, opts // []) @@ -344,9 +399,11 @@

      Options

    1693. :file - The filename to be used in stacktraces and the file reported in the ENV variable.

    1694. :line - The line reported in the ENV variable.

    1695. +
    1696. :existing_atoms_only - When true, raises an error +when non-existing atoms are found by the tokenizer.

    1697. - Source + Source

      string_to_ast!(string, opts // []) @@ -356,20 +413,26 @@

      Options

      in case a token is missing (usually because the expression is incomplete), SyntaxError otherwise.

      -

      Options

      - -
        -
      • :file - The filename to be used in stacktraces -and the file reported in the ENV variable.

      • -
      • :line - The line reported in the ENV variable.

      • -
      +

      Check Code.string_to_ast/2 for options information.

      - Source + Source +
      +

      + unload_files(files) +

      +

      Removes the given files from the loaded files list. +The modules defined in the file are not removed, +calling this function only removes it from the list, +allowing it to be required again.

      +
      + Source
      + + diff --git a/docs/stable/CompileError.html b/docs/stable/CompileError.html index 2af7d7487..f0d7b502c 100644 --- a/docs/stable/CompileError.html +++ b/docs/stable/CompileError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -39,19 +39,19 @@

      Fields (and defaults)

    1698. - description: "compile error" + file: nil
    1699. - file: nil + line: nil
    1700. - line: nil + description: "compile error"
    1701. @@ -121,6 +121,11 @@

      Functions summary

      to_keywords/1 +
    1702. + + update/2 + +
    1703. update_description/2 @@ -143,6 +148,8 @@

      Functions summary

      + +

      Functions

      @@ -150,96 +157,104 @@

      Functions

      description(record)

      - Source + Source

      description(value, record)

      - Source + Source

      exception(args)

      - Source + Source

      exception(args, self)

      - Source + Source

      file(record)

      - Source + Source

      file(value, record)

      - Source + Source

      line(record)

      - Source + Source

      line(value, record)

      - Source + Source

      message(exception)

      - Source + Source

      new()

      - Source + Source

      new(opts)

      - Source + Source

      to_keywords(record)

      - Source + Source +
      +

      + update(keywords, record) +

      +
      + Source

      update_description(function, record)

      - Source + Source

      update_file(function, record)

      - Source + Source

      update_line(function, record)

      - Source + Source
      + + diff --git a/docs/stable/Dict.Orddict.html b/docs/stable/Dict.Orddict.html deleted file mode 100644 index 5de22fa0f..000000000 --- a/docs/stable/Dict.Orddict.html +++ /dev/null @@ -1,200 +0,0 @@ - - - - Dict.Orddict - - - - - - - - - - - - -
      -

      - Dict.Orddict - - impl - -

      - - - - Source - - - - - - -

      Functions summary

      - - - - - - -
      -

      Functions

      -
      -

      - delete(arg1, key) -

      -
      - Source -
      -

      - empty(_) -

      -
      - Source -
      -

      - get(arg1, key, default // nil) -

      -
      - Source -
      -

      - has_key?(arg1, key) -

      -
      - Source -
      -

      - keys(arg1) -

      -
      - Source -
      -

      - merge(arg1, arg2) -

      -
      - Source -
      -

      - merge(arg1, arg2, fun) -

      -
      - Source -
      -

      - put(arg1, key, value) -

      -
      - Source -
      -

      - size(arg1) -

      -
      - Source -
      -

      - to_list(arg1) -

      -
      - Source -
      -

      - update(arg1, key, fun) -

      -
      - Source -
      -

      - update(arg1, key, initial, fun) -

      -
      - Source -
      -

      - values(arg1) -

      -
      - Source -
      -
      - - - -
      - - diff --git a/docs/stable/Dict.html b/docs/stable/Dict.html index ac36c91fe..668fa5c4e 100644 --- a/docs/stable/Dict.html +++ b/docs/stable/Dict.html @@ -23,15 +23,36 @@

      Dict - protocol + behaviour

      -

      This module provides the Dict protocol -with the goal of being a common API -to work with dictionaries.

      +

      This module specifies the Dict API expected to be +implemented by different dictionaries. It also provides +functions that redirect to the underlying Dict based on +the tuple signature.

      + +

      The keyword list used throughout Elixir cannot be +manipulated via the Dict module, you must use the +Keyword module instead. This distinction is intentional: +the Dict module is meant to work on structures that work +as storage.

      + +

      To create a new dict, use the new functions defined +by each dict type:

      + +
      OrdDict.new [{:a, 1}, {:b, 2}]
      +HashDict.new  #=> creates an empty HashDict
      +
      + +

      For simplicity's sake, in the examples below everytime +new is used, it implies one of the module-specific +calls like the two above. Likewise, when the result of +a function invocation is shown in the form [a: 1, b: 2], +it implies that the returned value is actually of the +same dict type as the input one.

      @@ -39,23 +60,6 @@

      Source -

      Implementations

      - - @@ -72,11 +76,6 @@

      Functions summary

      empty/1
    1704. -
    1705. - - get/2 - -
    1706. get/3 @@ -139,66 +138,67 @@

      Functions summary

      + +

      Functions

      - delete(xA, xB) + delete(dict, key)

      Removes the entry stored under the given key from dict. If dict does not contain key, returns the dictionary unchanged.

      Examples

      -
      Dict.delete [a: 1, b: 2], :a  #=> [b: 2]
      -Dict.delete [b: 2], :a        #=> [b: 2]
      +
      d = new [a: 1, b: 2]
      +Dict.delete d, :a      #=> [b: 2]
      +
      +d = new [b: 2]
      +Dict.delete d, :a      #=> [b: 2]
       
      - Source + Source

      - empty(xA) + empty(dict)

      Returns an empty dict of the same type as dict.

      - Source + Source
      -

      - get(xA, xB) +

      + get(dict, key, default // nil)

      Returns the value associated with key in dict. If dict does not contain key, returns default (or nil if not provided).

      Examples

      -
      Dict.get [a: 1], :a     #=> 1
      -Dict.get [a: 1], :b     #=> nil
      -Dict.get [a: 1], :b, 3  #=> 3
      +
      d = new [a: 1]
      +Dict.get d, :a     #=> 1
      +Dict.get d, :b     #=> nil
      +Dict.get d, :b, 3  #=> 3
       
      - Source -
      -

      - get(xA, xB, xC) -

      -
      - Source + Source

      - has_key?(xA, xB) + has_key?(dict, key)

      Returns whether the given key exists in the given dict.

      Examples

      -
      Dict.has_key?([a: 1], :a)  #=> true
      -Dict.has_key?([a: 1], :b)  #=> false
      +
      d = new [a: 1]
      +Dict.has_key?(d, :a)  #=> true
      +Dict.has_key?(d, :b)  #=> false
       
      - Source + Source

      - keys(xA) + keys(dict)

      Returns a list containing all dict's keys. The keys are not guaranteed to be sorted, unless @@ -206,91 +206,101 @@

      Examples

      Examples

      -
      Dict.keys [a: 1, b: 2]  #=> [:a,:b]
      +
      d = new [a: 1, b: 2]
      +Dict.keys d  #=> [:a,:b]
       
      - Source + Source

      - merge(xA, xB) + merge(dict1, dict2)

      -

      Merges two dicts into one. If the dicts have duplicated entries, the one -given as second argument wins.

      +

      Merges two dicts into one. If the dicts have duplicated entries, +the one given as second argument wins. In case the second argument +is not of the same kind as the first one, it is converted to the +same kind before merging as long as it implements the Enum protocol.

      Examples

      -
      Dict.merge [a: 1, b: 2], [a: 3, d: 4]
      -#=> [a:3, b:2, d: 4]
      +
      d1 = new [a: 1, b: 2]
      +d2 = new [a: 3, d: 4]
      +Dict.merge d1, d2
      +#=> [a: 3, b: 2, d: 4]
       
      - Source + Source

      - merge(xA, xB, xC) + merge(dict1, dict2, fun)

      Merges two dicts into one. If the dicts have duplicated entries, the given function is invoked to solve conflicts.

      Examples

      -
      Dict.merge [a: 1, b: 2], [a: 3, d: 4], fn _k, v1, v2 ->
      +
      d1 = new [a: 1, b: 2]
      +d2 = new [a: 3, d: 4]
      +Dict.merge d1, d2, fn _k, v1, v2 ->
         v1 + v2
       end
       #=> [a: 4, b: 2, d: 4]
       
      - Source + Source

      - put(xA, xB, xC) + put(dict, key, val)

      Stores the given value under key in dict. If dict already has key, the stored value is replaced by the new one.

      Examples

      -
      Dict.put [a: 1, b: 2], :a, 3
      +
      d = new [a: 1, b: 2]
      +Dict.put d, :a, 3
       #=> [a: 3, b: 2]
       
      - Source + Source

      - size(xA) + size(dict)

      Returns the number of elements in dict.

      Examples

      -
      Dict.size [a: 1, b: 2]  #=> 2
      +
      d = new [a: 1, b: 2]
      +Dict.size d  #=> 2
       
      - Source + Source

      - to_list(xA) + to_list(dict)

      Returns a list of key-value pairs stored in dict. No particular order is enforced.

      - Source + Source

      - update(xA, xB, xC) + update(dict, key, fun)

      Update a value in dict by calling fun on the value to get a new value. An exception is generated if key is not present in the dict.

      Examples

      -
      Dict.update [a: 1, b: 2], :a, fn val -> -val end
      +
      d = new [a: 1, b: 2]
      +Dict.update d, :a, fn val -> -val end
       #=> [a: -1, b: 2]
       
      - Source + Source

      - update(xA, xB, xC, xD) + update(dict, key, initial, fun)

      Update a value in dict by calling fun on the value to get a new value. If key is not present in dict then initial will be stored as the first @@ -298,28 +308,32 @@

      Examples

      Examples

      -
      Dict.update [a: 1, b: 2], :c, 3, fn val -> -val end
      +
      d = new [a: 1, b: 2]
      +Dict.update d, :c, 3, fn val -> -val end
       #=> [a: 1, b: 2, c: 3]
       
      - Source + Source

      - values(xA) + values(dict)

      Returns a list containing all dict's values.

      Examples

      -
      Dict.values [a: 1, b: 2]  #=> [1,2]
      +
      d = new [a: 1, b: 2]
      +Dict.values d  #=> [1,2]
       
      - Source + Source
      + +
      diff --git a/docs/stable/EEx.AssignsEngine.html b/docs/stable/EEx.AssignsEngine.html index 3e98b63fb..a204623a9 100644 --- a/docs/stable/EEx.AssignsEngine.html +++ b/docs/stable/EEx.AssignsEngine.html @@ -66,6 +66,10 @@

      Examples

      + + + + diff --git a/docs/stable/EEx.Engine.html b/docs/stable/EEx.Engine.html index d5fe1e0ec..dce427e5e 100644 --- a/docs/stable/EEx.Engine.html +++ b/docs/stable/EEx.Engine.html @@ -23,6 +23,8 @@

      EEx.Engine + behaviour +

      @@ -83,6 +85,8 @@

      Functions summary

      + +

      Functions

      @@ -90,7 +94,7 @@

      Functions

      behaviour_info(atom1)

      - Source + Source

      handle_expr(buffer, list2, expr) @@ -116,6 +120,8 @@

      Functions

      + +
      diff --git a/docs/stable/EEx.SmartEngine.html b/docs/stable/EEx.SmartEngine.html index aa28a9bba..4ae1cf5de 100644 --- a/docs/stable/EEx.SmartEngine.html +++ b/docs/stable/EEx.SmartEngine.html @@ -60,6 +60,8 @@

      Functions summary

      + +

      Functions

      @@ -79,6 +81,8 @@

      Functions

      + +
      diff --git a/docs/stable/EEx.SyntaxError.html b/docs/stable/EEx.SyntaxError.html index d03b26618..88579ae62 100644 --- a/docs/stable/EEx.SyntaxError.html +++ b/docs/stable/EEx.SyntaxError.html @@ -84,6 +84,11 @@

      Functions summary

      to_keywords/1
    1707. +
    1708. + + update/2 + +
    1709. update_message/2 @@ -96,6 +101,8 @@

      Functions summary

      + +

      Functions

      @@ -140,6 +147,12 @@

      Functions

      Source +
      +

      + update(keywords, record) +

      +
      + Source

      update_message(function, record) @@ -151,6 +164,8 @@

      Functions

      + +
      diff --git a/docs/stable/EEx.TransformerEngine.html b/docs/stable/EEx.TransformerEngine.html index c1658e032..0cac9fa92 100644 --- a/docs/stable/EEx.TransformerEngine.html +++ b/docs/stable/EEx.TransformerEngine.html @@ -52,6 +52,10 @@

      + + + +

      diff --git a/docs/stable/EEx.html b/docs/stable/EEx.html index ea71a9af9..8b5bc787f 100644 --- a/docs/stable/EEx.html +++ b/docs/stable/EEx.html @@ -67,6 +67,8 @@

      Tags

      <% Elixir expression - inline with output %>
       <%= Elixir expression - replace with result %>
      +<%% EEx quotation - returns the contents inside %>
      +<%# Comments - they are discarded from source %>
       

      All expressions that output something to the template @@ -158,6 +160,8 @@

      Macros summary

      + +

      Functions

      @@ -167,7 +171,7 @@

      Functions

      Get a filename and generate a quoted expression that can be evaluated by Elixir or compiled to a function.

      - Source + Source

      compile_string(source, options // []) @@ -175,7 +179,7 @@

      Functions

      Get a string source and generate a quoted expression that can be evaluated by Elixir or compiled to a function.

      - Source + Source

      eval_file(filename, bindings // [], options // []) @@ -192,7 +196,7 @@

      Examples

      #=> "foo baz"
      - Source + Source

      eval_string(source, bindings // [], options // []) @@ -205,7 +209,7 @@

      Examples

      #=> "foo baz"
      - Source + Source @@ -239,7 +243,7 @@

      Examples

      Sample.sample(1, 2) #=> "3" - Source + Source

      function_from_string(kind, name, source, args // [], options // []) @@ -258,10 +262,12 @@

      Examples

      Sample.sample(1, 2) #=> "3"
      - Source + Source + + diff --git a/docs/stable/Enum.Iterator.Binary.Dict.html b/docs/stable/Enum.Iterator.Binary.Dict.html new file mode 100644 index 000000000..7f3720980 --- /dev/null +++ b/docs/stable/Enum.Iterator.Binary.Dict.html @@ -0,0 +1,51 @@ + + + + Enum.Iterator.Binary.Dict + + + + + + + + + + + + +
      +

      + Enum.Iterator.Binary.Dict + + impl + +

      + + + + Source + + + + + + + + + + + + + + + + +
      + + diff --git a/docs/stable/Enum.Iterator.Function.html b/docs/stable/Enum.Iterator.Function.html index b6bc368fd..6dbbb462d 100644 --- a/docs/stable/Enum.Iterator.Function.html +++ b/docs/stable/Enum.Iterator.Function.html @@ -29,48 +29,20 @@

      - Source + Source -

      Functions summary

      - -
      -

      Functions

      -
      -

      - count(function) -

      -
      - Source -
      -

      - iterator(function) -

      -
      - Source -
      -
      + diff --git a/docs/stable/Enum.Iterator.HashDict.html b/docs/stable/Enum.Iterator.HashDict.html index e0edca8b3..1055b6c04 100644 --- a/docs/stable/Enum.Iterator.HashDict.html +++ b/docs/stable/Enum.Iterator.HashDict.html @@ -29,48 +29,20 @@

      - Source + Source -

      Functions summary

      - -
      -

      Functions

      -
      -

      - count(arg1) -

      -
      - Source -
      -

      - iterator(arg1) -

      -
      - Source -
      -
      + diff --git a/docs/stable/Enum.Iterator.List.html b/docs/stable/Enum.Iterator.List.html index 0cf75b7b6..a65de417b 100644 --- a/docs/stable/Enum.Iterator.List.html +++ b/docs/stable/Enum.Iterator.List.html @@ -29,48 +29,20 @@

      - Source + Source -

      Functions summary

      - -
      -

      Functions

      -
      -

      - count(list) -

      -
      - Source -
      -

      - iterator(list) -

      -
      - Source -
      -
      + diff --git a/docs/stable/Enum.Iterator.Orddict.html b/docs/stable/Enum.Iterator.Orddict.html index ab52a0d1a..041698cc9 100644 --- a/docs/stable/Enum.Iterator.Orddict.html +++ b/docs/stable/Enum.Iterator.Orddict.html @@ -1,7 +1,7 @@ - Enum.Iterator.Orddict + Enum.Iterator.OrdDict @@ -21,7 +21,7 @@

      - Enum.Iterator.Orddict + Enum.Iterator.OrdDict impl @@ -29,48 +29,20 @@

      - Source + Source -

      Functions summary

      - -
      -

      Functions

      -
      -

      - count(arg1) -

      -
      - Source -
      -

      - iterator(arg1) -

      -
      - Source -
      -
      + diff --git a/docs/stable/Enum.Iterator.Range.html b/docs/stable/Enum.Iterator.Range.html index 8b757bfe7..6284c9fd7 100644 --- a/docs/stable/Enum.Iterator.Range.html +++ b/docs/stable/Enum.Iterator.Range.html @@ -29,48 +29,20 @@

      - Source + Source -

      Functions summary

      - -
      -

      Functions

      -
      -

      - count(range) -

      -
      - Source -
      -

      - iterator(range) -

      -
      - Source -
      -
      + diff --git a/docs/stable/Enum.Iterator.html b/docs/stable/Enum.Iterator.html index c076be032..4847353f7 100644 --- a/docs/stable/Enum.Iterator.html +++ b/docs/stable/Enum.Iterator.html @@ -51,6 +51,12 @@

      Implementations

        +
      • + + Binary.Dict + +
      • +
      • Function @@ -71,7 +77,7 @@

        Implementations

      • - Orddict + OrdDict
      • @@ -106,18 +112,20 @@

        Functions summary

        + +

        Functions

        - count(xA) + count(collection)

        The function used to retrieve the collection size.

        Source

        - iterator(xA) + iterator(collection)

        Iteration in Elixir happens with the help of a iterator function. Every time this function is called, it must @@ -154,6 +162,8 @@

        Iterating lists

        + +
        diff --git a/docs/stable/Enum.OrdIterator.Function.html b/docs/stable/Enum.OrdIterator.Function.html deleted file mode 100644 index 583820a96..000000000 --- a/docs/stable/Enum.OrdIterator.Function.html +++ /dev/null @@ -1,79 +0,0 @@ - - - - Enum.OrdIterator.Function - - - - - - - - - - - - -
        -

        - Enum.OrdIterator.Function - - impl - -

        - - - - Source - - - - - - -

        Functions summary

        - - - - - - -
        -

        Functions

        -
        -

        - iterator(function) -

        -
        - Source -
        -

        - to_list(arg1, function) -

        -
        - Source -
        -
        - - - -
        - - diff --git a/docs/stable/Enum.OrdIterator.List.html b/docs/stable/Enum.OrdIterator.List.html deleted file mode 100644 index 6370c349d..000000000 --- a/docs/stable/Enum.OrdIterator.List.html +++ /dev/null @@ -1,79 +0,0 @@ - - - - Enum.OrdIterator.List - - - - - - - - - - - - -
        -

        - Enum.OrdIterator.List - - impl - -

        - - - - Source - - - - - - -

        Functions summary

        - - - - - - -
        -

        Functions

        -
        -

        - iterator(list) -

        -
        - Source -
        -

        - to_list(arg1, _) -

        -
        - Source -
        -
        - - - -
        - - diff --git a/docs/stable/Enum.OrdIterator.Orddict.html b/docs/stable/Enum.OrdIterator.Orddict.html deleted file mode 100644 index a186f26bc..000000000 --- a/docs/stable/Enum.OrdIterator.Orddict.html +++ /dev/null @@ -1,79 +0,0 @@ - - - - Enum.OrdIterator.Orddict - - - - - - - - - - - - -
        -

        - Enum.OrdIterator.Orddict - - impl - -

        - - - - Source - - - - - - -

        Functions summary

        - - - - - - -
        -

        Functions

        -
        -

        - iterator(arg1) -

        -
        - Source -
        -

        - to_list(arg1, _) -

        -
        - Source -
        -
        - - - -
        - - diff --git a/docs/stable/Enum.OrdIterator.Range.html b/docs/stable/Enum.OrdIterator.Range.html deleted file mode 100644 index c59ad03e1..000000000 --- a/docs/stable/Enum.OrdIterator.Range.html +++ /dev/null @@ -1,79 +0,0 @@ - - - - Enum.OrdIterator.Range - - - - - - - - - - - - -
        -

        - Enum.OrdIterator.Range - - impl - -

        - - - - Source - - - - - - -

        Functions summary

        - - - - - - -
        -

        Functions

        -
        -

        - iterator(range) -

        -
        - Source -
        -

        - to_list(arg1, iterator) -

        -
        - Source -
        -
        - - - -
        - - diff --git a/docs/stable/Enum.OrdIterator.html b/docs/stable/Enum.OrdIterator.html deleted file mode 100644 index e6b0e98e2..000000000 --- a/docs/stable/Enum.OrdIterator.html +++ /dev/null @@ -1,133 +0,0 @@ - - - - Enum.OrdIterator - - - - - - - - - - - - -
        -

        - Enum.OrdIterator - - protocol - -

        - - -
        -

        This protocol is invoked by some functions in Enum which -requires an ordered collection to function correctly. For -instance, Enum.split_with/2, Enum.take_while all rely -on this protocol.

        - -

        An ordered collection does not mean the items are ordered -according to the Elixir ordering but simply that any two -distinct instances of the same collection with exactly -the same items always yield the same order when iterated.

        - -
        - - - Source - - -

        Implementations

        - - - - - - -

        Functions summary

        - - - - - - -
        -

        Functions

        -
        -

        - iterator(xA) -

        -

        Must return a tuple under the same conditions as -Enum.Iterator.iterator.

        -
        - Source -
        -

        - to_list(xA, xB) -

        -

        On each step, the iterator function returned by iterator/1 -returns a tuple with two elements. This function receives -those two elements as a tuple and must return a list back.

        - -

        This is used in order to quicky return a list from any point -during iteration. For example, consider the function Enum.drop. -Enum.drop collection, 3 should drop 3 items and return a list -back. While we could loop over the remaining items to get a list -back, this function is invoked allowing us to get a result -back without a need to loop the remaining items.

        -
        - Source -
        -
        - - - -
        - - diff --git a/docs/stable/Enum.OutOfBoundsError.html b/docs/stable/Enum.OutOfBoundsError.html index be05279cb..b0d788706 100644 --- a/docs/stable/Enum.OutOfBoundsError.html +++ b/docs/stable/Enum.OutOfBoundsError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -84,6 +84,11 @@

        Functions summary

        to_keywords/1 +
      • + + update/2 + +
      • update_message/2 @@ -96,6 +101,8 @@

        Functions summary

        + +

        Functions

        @@ -103,54 +110,62 @@

        Functions

        exception(args)

        - Source + Source

        exception(args, self)

        - Source + Source

        message(record)

        - Source + Source

        message(value, record)

        - Source + Source

        new()

        - Source + Source

        new(opts)

        - Source + Source

        to_keywords(record)

        - Source + Source +
        +

        + update(keywords, record) +

        +
        + Source

        update_message(function, record)

        - Source + Source
        + +
      • diff --git a/docs/stable/Enum.html b/docs/stable/Enum.html index 2a76fb9d3..96be07fa0 100644 --- a/docs/stable/Enum.html +++ b/docs/stable/Enum.html @@ -42,7 +42,7 @@

        - Source + Source @@ -61,11 +61,21 @@

        Functions summary

        any?/2 +
      • + + at!/2 + +
      • count/1
      • +
      • + + count/2 + +
      • drop/2 @@ -138,22 +148,22 @@

        Functions summary

      • - nth!/2 + partition/2
      • - partition/2 + qsort/1
      • - qsort/1 + reduce/3
      • - reduce/3 + reverse/1
      • @@ -163,7 +173,7 @@

        Functions summary

      • - split_with/2 + split_while/2
      • @@ -186,6 +196,11 @@

        Functions summary

        times/3
      • +
      • + + zip/2 + +
      @@ -193,6 +208,8 @@

      Functions summary

      + +

      Functions

      @@ -221,7 +238,7 @@

      Examples

      Enum.all? [1,nil,3] #=> false
      - Source + Source

      any?(collection, fun // fn x -> @@ -247,7 +264,25 @@

      Examples

      Enum.any? [false,true,false] #=> true
      - Source + Source +
      +

      + at!(collection, n) +

      +

      Finds the element at the given index (zero-based). +Raises out of bounds error in case the given position +is outside the range of the collection.

      + +

      Expects an ordered collection.

      + +

      ## Examples

      + +
        Enum.at! [2,4,6], 0 #=> 2
      +  Enum.at! [2,4,6], 2 #=> 6
      +  Enum.at! [2,4,6], 4 #=> raises Enum.OutOfBoundsError
      +
      +
      + Source

      count(collection) @@ -259,7 +294,14 @@

      Examples

      Enum.count [1,2,3] #=> 3
       
      - Source + Source +
      +

      + count(collection, fun) +

      +

      Counts for how many items the function returns true.

      +
      + Source

      drop(collection, count) @@ -274,7 +316,7 @@

      Examples

      Enum.drop [1,2,3], 0 #=> [1,2,3]
      - Source + Source

      drop_while(collection, fun) @@ -288,7 +330,7 @@

      Examples

      #=> [3,4,5]
      - Source + Source

      each(collection, fun) @@ -301,7 +343,7 @@

      Examples

      Enum.each ['some', 'example'], fn(x) -> IO.puts x end
       
      - Source + Source

      empty?(collection) @@ -314,7 +356,7 @@

      Examples

      Enum.empty? [1,2,3] #=> false
      - Source + Source

      filter(collection, fun) @@ -328,7 +370,7 @@

      Examples

      #=> [2]
      - Source + Source

      filter_map(collection, filter, mapper) @@ -341,7 +383,7 @@

      Examples

      #=> [4]
      - Source + Source

      find(collection, ifnone // nil, fun) @@ -361,26 +403,26 @@

      Examples

      #=> 3
      - Source + Source

      find_index(collection, fun)

      -

      Similar to find, but returns the index (count starts with 1) +

      Similar to find, but returns the index (count starts with 0) of the item instead of the element itself.

      Expects an ordered collection.

      -

      ## Examples

      +

      Examples

      -
        Enum.find_index [2,4,6], fn(x) -> rem(x, 2) == 1 end
      -  #=> nil
      +
      Enum.find_index [2,4,6], fn(x) -> rem(x, 2) == 1 end
      +#=> nil
       
      -  Enum.find_index [2,3,4], fn(x) -> rem(x, 2) == 1 end
      -  #=> 2
      +Enum.find_index [2,3,4], fn(x) -> rem(x, 2) == 1 end
      +#=> 2
       
      - Source + Source

      find_value(collection, ifnone // nil, fun) @@ -388,16 +430,16 @@

      Examples

      Similar to find, but returns the value of the function invocation instead of the element itself.

      -

      ## Examples

      +

      Examples

      -
        Enum.find_value [2,4,6], fn(x) -> rem(x, 2) == 1 end
      -  #=> nil
      +
      Enum.find_value [2,4,6], fn(x) -> rem(x, 2) == 1 end
      +#=> nil
       
      -  Enum.find_value [2,3,4], fn(x) -> rem(x, 2) == 1 end
      -  #=> true
      +Enum.find_value [2,3,4], fn(x) -> rem(x, 2) == 1 end
      +#=> true
       
      - Source + Source

      first(collection) @@ -410,7 +452,7 @@

      Examples

      Enum.first [1,2,3] #=> 1
      - Source + Source

      join(collection, joiner // "") @@ -431,7 +473,7 @@

      Examples

      Enum.join([1,2,3], ' = ') #=> '1 = 2 = 3'
      - Source + Source

      map(collection, fun) @@ -449,7 +491,7 @@

      Examples

      #=> [a: -1, b: -2]
      - Source + Source

      map_join(collection, joiner // "", mapper) @@ -470,7 +512,7 @@

      Examples

      Enum.map_join([1,2,3], &1 * 2, ' = ') #=> '2 = 4 = 6'
      - Source + Source

      map_reduce(collection, acc, f) @@ -489,24 +531,7 @@

      Examples

      #=> { [2, 4, 6], 6 }
      - Source -
      -

      - nth!(collection, n) -

      -

      Finds the element at the nth index. Returns nil in case -the given index is outside the range of the collection.

      - -

      Expects an ordered collection.

      - -

      ## Examples

      - -
        Enum.nth! [2,4,6], 1 #=> 2
      -  Enum.nth! [2,4,6], 3 #=> 6
      -  Enum.nth! [2,4,6], 5 #=> raises Enum.OutOfBoundsError
      -
      -
      - Source + Source

      partition(collection, fun) @@ -521,7 +546,7 @@

      Examples

      #=> { [2], [1,3] }
      - Source + Source

      qsort(collection) @@ -533,13 +558,13 @@

      Examples

      Enum.qsort [3,2,1] #=> [1,2,3]
       
      - Source + Source

      reduce(collection, acc, fun)

      -

      Invokes fun for each element in the collection passing the accumulator -acc and the element as arguments. The return value is stored in acc. +

      Invokes fun for each element in the collection passing that element and the +accumulator acc as arguments. fun's return value is stored in acc. Returns the accumulator.

      Examples

      @@ -548,36 +573,56 @@

      Examples

      #=> 6
      - Source + Source +
      +

      + reverse(collection) +

      +

      Reverses the collection.

      + +

      Expects an ordered collection.

      + +

      Examples

      + +
      Enum.reverse [1, 2, 3]
      +#=> [3, 2, 1]
      +
      +
      + Source

      split(collection, count)

      Splits the enumerable into two collections, leaving count elements in the -first one. Expects an ordered collection.

      +first one. If count is a negative number, it starts couting from the back +to the beginning of the collection. Be aware that a negative count +implies in an iteration through the whole collection. +Expects an ordered collection.

      Examples

      Enum.split [1,2,3], 2  #=> { [1,2], [3] }
       Enum.split [1,2,3], 10 #=> { [1,2,3], [] }
       Enum.split [1,2,3], 0  #=> { [], [1,2,3] }
      +Enum.split [1,2,3], -1 #=> { [1,2], [3] }
      +Enum.split [1,2,3], -5 #=> { [], [1,2,3] }
       
      - Source + Source
      -

      - split_with(collection, fun) +

      + split_while(collection, fun)

      Splits collection at the first element, for which fun returns true. Expects an ordered collection.

      Examples

      -
      Enum.split_with [1,2,3,4], fn x -> x == 2 end
      +
      Enum.split_while [1,2,3,4], fn x -> x == 2 end
       #=> { [1], [2, 3, 4] }
       
      - Source + Source

      take(collection, count) @@ -592,7 +637,7 @@

      Examples

      Enum.take [1,2,3], 0 #=> []
      - Source + Source

      take_while(collection, fun) @@ -606,23 +651,23 @@

      Examples

      #=> [1, 2]
      - Source + Source

      times(times, function)

      -

      Iterates the given function n times, passing values from 1 -to n.

      +

      Iterates the given function n times, passing values +from 0 to n - 1.

      Examples

      Enum.times 3, fn(x) -> IO.inspect x end
      +0
       1
       2
      -3
       
      - Source + Source

      times(times, acc, function) @@ -637,12 +682,24 @@

      Examples

      #=> 15
      - Source + Source +
      +

      + zip(coll1, coll2) +

      +

      Zips corresponding elements from two collections into one list +of tuples. The number of elements in the resulting list is +dictated by the first enum. In case the second list is shorter, +values are filled with nil.

      +
      + Source
      + + diff --git a/docs/stable/ErlangError.html b/docs/stable/ErlangError.html index 6420f55d1..19e722328 100644 --- a/docs/stable/ErlangError.html +++ b/docs/stable/ErlangError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -89,6 +89,11 @@

      Functions summary

      to_keywords/1
    1710. +
    1711. + + update/2 + +
    1712. update_original/2 @@ -101,6 +106,8 @@

      Functions summary

      + +

      Functions

      @@ -108,60 +115,68 @@

      Functions

      exception(args)

      - Source + Source

      exception(args, self)

      - Source + Source

      message(exception)

      - Source + Source

      new()

      - Source + Source

      new(opts)

      - Source + Source

      original(record)

      - Source + Source

      original(value, record)

      - Source + Source

      to_keywords(record)

      - Source + Source +
      +

      + update(keywords, record) +

      +
      + Source

      update_original(function, record)

      - Source + Source
      + + diff --git a/docs/stable/ExUnit.AssertionError.html b/docs/stable/ExUnit.AssertionError.html index da50116b6..deffaeb0b 100644 --- a/docs/stable/ExUnit.AssertionError.html +++ b/docs/stable/ExUnit.AssertionError.html @@ -84,6 +84,11 @@

      Functions summary

      to_keywords/1
    1713. +
    1714. + + update/2 + +
    1715. update_message/2 @@ -96,6 +101,8 @@

      Functions summary

      + +

      Functions

      @@ -140,6 +147,12 @@

      Functions

      Source +
      +

      + update(keywords, record) +

      +
      + Source

      update_message(function, record) @@ -151,6 +164,8 @@

      Functions

      + +
      diff --git a/docs/stable/ExUnit.Assertions.html b/docs/stable/ExUnit.Assertions.html index b4caf637c..10720b9a1 100644 --- a/docs/stable/ExUnit.Assertions.html +++ b/docs/stable/ExUnit.Assertions.html @@ -137,6 +137,8 @@

      Macros summary

      + +

      Functions

      @@ -182,7 +184,7 @@

      Examples

      Source

      - assert_raise(exception, expected_message, function) + assert_raise(exception, message, function)

      Asserts the exception is raised during function execution with the expected_message. Returns the rescued exception, fails otherwise.

      @@ -354,6 +356,8 @@

      Examples

      + +
      diff --git a/docs/stable/ExUnit.Case.html b/docs/stable/ExUnit.Case.html index ea0ddf86a..3a1845126 100644 --- a/docs/stable/ExUnit.Case.html +++ b/docs/stable/ExUnit.Case.html @@ -40,11 +40,22 @@

      Callbacks

      -

      This module defines four callbacks. setup_all() and -teardown_all() which are executed before and after -all tests respectively and setup(test) and teardown(test) -which are executed before and after each test, receiving -the test name as argument.

      +

      ExUnit.Case defines four callbacks:

      + +
        +
      • setup_all() and teardown_all(context) which are executed +before and after all tests respectively;
      • +
      • setup(context, test) and teardown(context, test) which are +executed before and after each test, receiving the test name +as argument;
      • +
      + +

      Such callbacks are useful to clean up any side-effect a test may cause, +as for example, state in genservers, data on filesystem, or entries in +a database. Data can be passed in between such callbacks as context, +the context value returned by setup_all is passed down to all other +callbacks. The value can then be updated in setup which is passed +down to teardown.

      Examples

      @@ -83,6 +94,8 @@

      Macros summary

      + +

      Macros

      @@ -103,10 +116,12 @@

      Examples

      end
      - Source + Source
      + + diff --git a/docs/stable/ExUnit.html b/docs/stable/ExUnit.html index ffa43d8c2..ee35114f1 100644 --- a/docs/stable/ExUnit.html +++ b/docs/stable/ExUnit.html @@ -79,6 +79,11 @@

      Assertions

      Functions summary

      • + + after_spawn/1 + +
      • +
      • configure/1 @@ -100,9 +105,19 @@

        Functions summary

        + +

        Functions

        +

        + after_spawn(callback) +

        +

        Register a callback to be invoked every time a +new ExUnit process is spawned.

        +
        + Source +

        configure(options)

        @@ -125,7 +140,7 @@

        Options

        API used to run the tests. A developer does not need to call it directly.

        - Source + Source

        start(options // []) @@ -140,6 +155,8 @@

        Options

        + +
        diff --git a/docs/stable/Exception.html b/docs/stable/Exception.html index c95850d2d..98fc0b6a8 100644 --- a/docs/stable/Exception.html +++ b/docs/stable/Exception.html @@ -62,6 +62,11 @@

        Functions summary

        format_stacktrace/1
      • +
      • + + formatted_stacktrace/1 + +
      @@ -69,6 +74,8 @@

      Functions summary

      + +

      Functions

      @@ -76,16 +83,16 @@

      Functions

      format_file_line(file_line)

      Formats file and line information present in stacktraces. -Expect them to be given in a keywords list.

      +Expect them to be given in a keyword list.

      - Source + Source

      format_file_line(file, line)

      Formats the given file and line.

      - Source + Source

      format_module_fun_arity(module, fun, arity) @@ -101,12 +108,21 @@

      Functions

      Formats each line in the stacktrace.

      - Source + Source +
      +

      + formatted_stacktrace(trace // System.stacktrace()) +

      +

      Returns the stacktrace as a binary formatted as per format_stacktrace/1.

      +
      + Source
      + + diff --git a/docs/stable/File.CopyError.html b/docs/stable/File.CopyError.html index c495764e5..81eda9de4 100644 --- a/docs/stable/File.CopyError.html +++ b/docs/stable/File.CopyError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -39,25 +39,25 @@

      Fields (and defaults)

    1716. - action: "" + reason: nil
    1717. - destination: nil + action: ""
    1718. - reason: nil + source: nil
    1719. - source: nil + destination: nil
    1720. @@ -137,6 +137,11 @@

      Functions summary

      to_keywords/1 +
    1721. + + update/2 + +
    1722. update_action/2 @@ -164,6 +169,8 @@

      Functions summary

      + +

      Functions

      @@ -171,114 +178,122 @@

      Functions

      action(record)

      - Source + Source

      action(value, record)

      - Source + Source

      destination(record)

      - Source + Source

      destination(value, record)

      - Source + Source

      exception(args)

      - Source + Source

      exception(args, self)

      - Source + Source

      message(exception)

      - Source + Source

      new()

      - Source + Source

      new(opts)

      - Source + Source

      reason(record)

      - Source + Source

      reason(value, record)

      - Source + Source

      source(record)

      - Source + Source

      source(value, record)

      - Source + Source

      to_keywords(record)

      - Source + Source +
      +

      + update(keywords, record) +

      +
      + Source

      update_action(function, record)

      - Source + Source

      update_destination(function, record)

      - Source + Source

      update_reason(function, record)

      - Source + Source

      update_source(function, record)

      - Source + Source
      + + diff --git a/docs/stable/File.Error.html b/docs/stable/File.Error.html index b0cd6526b..785ade120 100644 --- a/docs/stable/File.Error.html +++ b/docs/stable/File.Error.html @@ -29,7 +29,7 @@

      - Source + Source @@ -39,19 +39,19 @@

      Fields (and defaults)

    1723. - action: "" + reason: nil
    1724. - path: nil + action: ""
    1725. - reason: nil + path: nil
    1726. @@ -121,6 +121,11 @@

      Functions summary

      to_keywords/1 +
    1727. + + update/2 + +
    1728. update_action/2 @@ -143,6 +148,8 @@

      Functions summary

      + +

      Functions

      @@ -150,96 +157,104 @@

      Functions

      action(record)

      - Source + Source

      action(value, record)

      - Source + Source

      exception(args)

      - Source + Source

      exception(args, self)

      - Source + Source

      message(exception)

      - Source + Source

      new()

      - Source + Source

      new(opts)

      - Source + Source

      path(record)

      - Source + Source

      path(value, record)

      - Source + Source

      reason(record)

      - Source + Source

      reason(value, record)

      - Source + Source

      to_keywords(record)

      - Source + Source +
      +

      + update(keywords, record) +

      +
      + Source

      update_action(function, record)

      - Source + Source

      update_path(function, record)

      - Source + Source

      update_reason(function, record)

      - Source + Source
      + + diff --git a/docs/stable/File.IteratorError.html b/docs/stable/File.IteratorError.html index 8e15528c0..9d97e9e25 100644 --- a/docs/stable/File.IteratorError.html +++ b/docs/stable/File.IteratorError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -89,6 +89,11 @@

      Functions summary

      to_keywords/1
    1729. +
    1730. + + update/2 + +
    1731. update_reason/2 @@ -101,6 +106,8 @@

      Functions summary

      + +

      Functions

      @@ -108,60 +115,68 @@

      Functions

      exception(args)

      - Source + Source

      exception(args, self)

      - Source + Source

      message(exception)

      - Source + Source

      new()

      - Source + Source

      new(opts)

      - Source + Source

      reason(record)

      - Source + Source

      reason(value, record)

      - Source + Source

      to_keywords(record)

      - Source + Source +
      +

      + update(keywords, record) +

      +
      + Source

      update_reason(function, record)

      - Source + Source
      + + diff --git a/docs/stable/File.Stat.html b/docs/stable/File.Stat.html index 4a2162c50..28e04801f 100644 --- a/docs/stable/File.Stat.html +++ b/docs/stable/File.Stat.html @@ -300,6 +300,11 @@

      Functions summary

      uid/2
    1732. +
    1733. + + update/2 + +
    1734. update_access/2 @@ -372,6 +377,8 @@

      Functions summary

      + +

      Functions

      @@ -548,6 +555,12 @@

      Functions

      Source +
      +

      + update(keywords, record) +

      +
      + Source

      update_access(function, record) @@ -631,6 +644,8 @@

      Functions

      + +
      diff --git a/docs/stable/File.html b/docs/stable/File.html index ecdd79ab5..eb35d1aa8 100644 --- a/docs/stable/File.html +++ b/docs/stable/File.html @@ -62,10 +62,15 @@

      to fail in case the file cannot be read (i.e. it is literally an exception).

      +

      Finally, the functions in this module accept either +a char lists or a binary. When manipulating paths, a char +list is returned if one is given as argument. However, +when reading files, binaries are always returned.

      +

      - Source + Source @@ -249,16 +254,6 @@

      Functions summary

      read!/1
    1735. -
    1736. - - read_info/2 - -
    1737. -
    1738. - - read_info!/2 - -
    1739. regular?/1 @@ -361,6 +356,8 @@

      Functions summary

      + +

      Functions

      @@ -385,7 +382,7 @@

      Examples

      #=> ""
      - Source + Source

      basename(path, extension) @@ -407,7 +404,7 @@

      Examples

      #=> "bar.old"
      - Source + Source

      cd(path) @@ -415,14 +412,14 @@

      Examples

      Sets the current working directory. Returns :ok if successful, { :error, reason } otherwise.

      - Source + Source

      cd!(path)

      The same as cd/0, but raises an exception if it fails.

      - Source + Source

      cd!(path, function) @@ -434,7 +431,7 @@

      Examples

      Raises an error if retrieving or changing the current directory fails.

      - Source + Source

      close(io_device) @@ -446,7 +443,7 @@

      Examples

      close/1 might return an old write error and not even try to close the file. See open/2.

      - Source + Source

      copy(source, destination, bytes_count // :infinity) @@ -465,7 +462,7 @@

      Examples

      Typical error reasons are the same as in open/2, read/1 and write/2.

      - Source + Source

      copy!(source, destination, bytes_count // :infinity) @@ -473,7 +470,7 @@

      Examples

      The same as copy/3 but raises an File.CopyError if it fails. Returns the bytes_copied otherwise.

      - Source + Source

      cp(source, destination, callback // fn _, _ -> @@ -498,7 +495,7 @@

      Examples

      It returns :ok in case of success, returns { :error, reason } otherwise.

      - Source + Source

      cp!(source, destination, callback // fn _, _ -> @@ -508,7 +505,7 @@

      Examples

      The same as cp/3, but raises File.CopyError if it fails. Returns the list of copied files otherwise.

      - Source + Source

      cp_r(source, destination, callback // fn _, _ -> @@ -560,7 +557,7 @@

      Examples

      end
      - Source + Source

      cp_r!(source, destination, callback // fn _, _ -> @@ -570,7 +567,7 @@

      Examples

      The same as cp_r/3, but raises File.CopyError if it fails. Returns the list of copied files otherwise.

      - Source + Source

      cwd() @@ -580,21 +577,21 @@

      Examples

      directories of the current directory. For this reason, returns { :ok, cwd } in case of success, { :error, reason } otherwise.

      - Source + Source

      cwd!()

      The same as cwd/0, but raises an exception if it fails.

      - Source + Source

      dir?(path)

      Returns true if the path is a directory.

      - Source + Source

      dirname(path) @@ -610,7 +607,7 @@

      Examples

      #=> "foo"
      - Source + Source

      exists?(path) @@ -631,7 +628,7 @@

      Examples

      #=> true
      - Source + Source

      expand_path(path) @@ -647,7 +644,7 @@

      Examples

      File.expand_path("/foo/bar/../bar") == "/foo/bar"
       
      - Source + Source

      expand_path(path, relative_to) @@ -665,7 +662,7 @@

      Examples

      File.expand_path("/foo/bar/../bar", "/baz") == "/foo/bar"
      - Source + Source

      extname(path) @@ -683,7 +680,7 @@

      Examples

      #=> ""
      - Source + Source

      iterator(device) @@ -702,12 +699,12 @@

      Examples

      source = File.iterator("README.md")
       File.open "NEWREADME.md", [:write], fn(target) ->
         Enum.each source, fn(line) ->
      -    IO.write target, Regex.replace_all(%r/"/, line, "'")
      +    IO.write target, Regex.replace(%r/"/, line, "'")
         end
       end
       
      - Source + Source

      iterator(file, mode) @@ -716,7 +713,7 @@

      Examples

      returns its iterator. Fails for the same reasons as File.open.

      - Source + Source

      iterator!(file, mode // []) @@ -724,7 +721,7 @@

      Examples

      Same as iterator/2 but raises if the file cannot be opened.

      - Source + Source

      join(paths) @@ -745,7 +742,7 @@

      Examples

      #=> "/foo/bar"
      - Source + Source

      join(left, right) @@ -761,7 +758,7 @@

      Examples

      #=> "foo/bar"
      - Source + Source

      mkdir(path) @@ -780,14 +777,14 @@

      Examples

      On some platforms, :enoent is returned instead.
    1740. - Source + Source

      mkdir!(path)

      Same as mkdir, but raises an exception in case of failure. Otherwise :ok.

      - Source + Source

      mkdir_p(path) @@ -803,14 +800,14 @@

      Examples

    1741. :enotdir - A component of path is not a directory.
    1742. - Source + Source

      mkdir_p!(path)

      Same as mkdir_p, but raises an exception in case of failure. Otherwise :ok.

      - Source + Source

      open(path, modes // []) @@ -860,7 +857,7 @@

      Examples

      File.close(file)
      - Source + Source

      open(path, modes, function) @@ -880,11 +877,12 @@

      Examples

      Examples

      -

      File.open!("foo.txt", [:read, :write], fn(file) -> - IO.readline(file) - end)

      +
      File.open!("foo.txt", [:read, :write], fn(file) ->
      +  IO.readline(file)
      +end)
      +
      - Source + Source

      open!(path, modes // []) @@ -892,7 +890,7 @@

      Examples

      Same as open/2 but raises an error if file could not be opened. Returns the io_device otherwise.

      - Source + Source

      open!(path, modes, function) @@ -900,7 +898,7 @@

      Examples

      Same as open/3 but raises an error if file could not be opened. Returns the function result otherwise.

      - Source + Source

      read(path) @@ -922,7 +920,7 @@

      Examples

      You can use :file.format_error(reason) to get a descriptive string of the error.

      - Source + Source

      read!(path) @@ -930,19 +928,7 @@

      Examples

      Returns binary with the contents of the given filename or raises File.Error if an error occurs.

      - Source -
      -

      - read_info(path, opts // []) -

      -
      - Source -
      -

      - read_info!(path, opts // []) -

      -
      - Source + Source

      regular?(path) @@ -954,7 +940,7 @@

      Examples

      File.regular? __FILE__ #=> true
       
      - Source + Source

      rm(path) @@ -982,14 +968,14 @@

      Examples

      #=> {:error, :eperm}
      - Source + Source

      rm!(path)

      Same as rm, but raises an exception in case of failure. Otherwise :ok.

      - Source + Source

      rm_rf(path) @@ -1011,7 +997,7 @@

      Examples

      #=> { :ok, [] }
      - Source + Source

      rm_rf!(path) @@ -1019,7 +1005,7 @@

      Examples

      Same as rm_rf/1 but raises File.Error in case of failures, otherwise the list of files or directories removed.

      - Source + Source

      rmdir(path) @@ -1036,14 +1022,14 @@

      Examples

      #=> {:error, :enotdir}
      - Source + Source

      rmdir!(path)

      Same as rmdir/1, but raises an exception in case of failure. Otherwise :ok.

      - Source + Source

      rootname(path) @@ -1061,7 +1047,7 @@

      Examples

      #=> "/foo/bar"
      - Source + Source

      rootname(path, extension) @@ -1080,7 +1066,7 @@

      Examples

      #=> "/foo/bar.erl"
      - Source + Source

      split(path) @@ -1098,7 +1084,7 @@

      Examples

      #=> ["/", "foo", "bar"]
      - Source + Source

      stat(path, opts // []) @@ -1117,7 +1103,7 @@

      Options

      Default is local.
      - Source + Source

      stat!(path, opts // []) @@ -1125,7 +1111,7 @@

      Options

      Same as stat but returns the File.Stat directly and throws File.Error if an error is returned.

      - Source + Source

      touch(path, time // calendar.local_time()) @@ -1133,7 +1119,7 @@

      Options

      Updates modification time (mtime) and access time (atime) of the given file. File is created if it doesn’t exist.

      - Source + Source

      touch!(path, time // calendar.local_time()) @@ -1141,7 +1127,7 @@

      Options

      Same as touch/1 but raises an exception if it fails. Returns :ok otherwise.

      - Source + Source

      wildcard(glob) @@ -1181,7 +1167,7 @@

      Examples

      File.wildcard("projects/*/ebin/**/*.{beam,app}")
       
      - Source + Source

      write(path, content, modes // []) @@ -1201,14 +1187,14 @@

      Examples

    1743. :eisdir - The named file is a directory.
    1744. - Source + Source

      write!(path, content, modes // [])

      Same as write/3 but raises an exception if it fails, returns :ok otherwise.

      - Source + Source

      write_stat(path, stat, opts // []) @@ -1216,7 +1202,7 @@

      Examples

      Writes the given File.Stat back to the filesystem at the given path. Returns :ok or { :error, reason }.

      - Source + Source

      write_stat!(path, stat, opts // []) @@ -1224,12 +1210,14 @@

      Examples

      Same as write_stat/3 but raises an exception if it fails. Returns :ok otherwise.

      - Source + Source
      + + diff --git a/docs/stable/FunctionClauseError.html b/docs/stable/FunctionClauseError.html index 65884f6c5..558807f47 100644 --- a/docs/stable/FunctionClauseError.html +++ b/docs/stable/FunctionClauseError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -39,7 +39,7 @@

      Fields (and defaults)

    1745. - arity: nil + module: nil
    1746. @@ -51,7 +51,7 @@

      Fields (and defaults)

    1747. - module: nil + arity: nil
    1748. @@ -121,6 +121,11 @@

      Functions summary

      to_keywords/1 +
    1749. + + update/2 + +
    1750. update_arity/2 @@ -143,6 +148,8 @@

      Functions summary

      + +

      Functions

      @@ -150,96 +157,104 @@

      Functions

      arity(record)

      - Source + Source

      arity(value, record)

      - Source + Source

      exception(args)

      - Source + Source

      exception(args, self)

      - Source + Source

      function(record)

      - Source + Source

      function(value, record)

      - Source + Source

      message(exception)

      - Source + Source

      module(record)

      - Source + Source

      module(value, record)

      - Source + Source

      new()

      - Source + Source

      new(opts)

      - Source + Source

      to_keywords(record)

      - Source + Source +
      +

      + update(keywords, record) +

      +
      + Source

      update_arity(function, record)

      - Source + Source

      update_function(function, record)

      - Source + Source

      update_module(function, record)

      - Source + Source
      + + diff --git a/docs/stable/GenServer.Behavior.html b/docs/stable/GenServer.Behaviour.html similarity index 51% rename from docs/stable/GenServer.Behavior.html rename to docs/stable/GenServer.Behaviour.html index 4db52d446..aae5e9e2b 100644 --- a/docs/stable/GenServer.Behavior.html +++ b/docs/stable/GenServer.Behaviour.html @@ -1,7 +1,7 @@ - GenServer.Behavior + GenServer.Behaviour @@ -21,59 +21,71 @@

      - GenServer.Behavior + GenServer.Behaviour

      +
      +

      By using this module, you get default GenServer callbacks +for init, handle_call, handle_info, handle_cast, +terminate and code_change. Since these functions are +defined as overridable, they can be customized and fallback +to the default behaviour by calling super.

      - Source +

      This module also tags the behavior as :genserver. For more +information on genserver, please refer to the Erlang +documentation:

      + +

      http://www.erlang.org/doc/man/gen_server.html +http://www.erlang.org/doc/design_principles/gen_server_concepts.html

      + +

      Example

      + +
      defmodule MyServer do
      +  use GenServer.Behaviour
      +
      +  # Callbacks
      +
      +  def handle_call(:peek, _from, [h|_] = state) do
      +    { :reply, h, state }
      +  end
      +
      +  # Default behaviour
      +  def handle_call(request, from, config) do
      +    super(request, from, config)
      +  end
      +
      +  def handle_cast({ :push, item }, state) do
      +    { :noreply, [item|state] }
      +  end
       
      +  # Default cast behaviour
      +  def handle_cast(request, config) do
      +    super(request, config)
      +  end
      +end
      +
      + +
      + Source + -

      Macros summary

      - + -
      -

      Macros

      -
      -

      - __using__(_) -

      -

      By using this module, you get default GenServer callbacks -for handle_call, handle_info, handle_cast, terminate -and code_change. init still needs to be implemented by the -developer. Since these functions are defined as overridable, -they can be partially customized and have a global clause -that simply invokes super. See ExUnit.Server for some -code examples.

      -

      This module also tags the behavior as :genserver. For more -information on genserver, please refer to the Erlang -documentation:

      + -

      http://www.erlang.org/doc/man/gen_server.html -http://www.erlang.org/doc/design_principles/gen_server_concepts.html

      -
      - Source -
      -
      diff --git a/docs/stable/HashDict.html b/docs/stable/HashDict.html index 4ce626f19..9a4ba49da 100644 --- a/docs/stable/HashDict.html +++ b/docs/stable/HashDict.html @@ -27,14 +27,17 @@

      -

      This module implements a dictionary based on hashing of the keys. -It is a simple wrapper around Erlang's dict module -and exposed via the Dict protocol.

      +

      This module implements a dictionary type based on +hashing of the keys. It is a simple wrapper around +Erlang's dict module +and exposed via the Dict module.

      + +

      Check the Dict module for examples and documentation.

      - Source + Source @@ -65,6 +68,8 @@

      Functions summary

      + +

      Functions

      @@ -73,7 +78,7 @@

      Functions

      Creates a new empty dict.

      - Source + Source

      new(pairs) @@ -86,7 +91,7 @@

      Examples

      #=> [a: 1, b: 2]
      - Source + Source

      new(list, transform) @@ -100,12 +105,14 @@

      Examples

      #=> ["a": "a", "b": "b"]
      - Source + Source + + diff --git a/docs/stable/IEx.Autocomplete.Entry.IEx.Autocomplete.Fun.html b/docs/stable/IEx.Autocomplete.Entry.IEx.Autocomplete.Fun.html deleted file mode 100644 index fb85bdef1..000000000 --- a/docs/stable/IEx.Autocomplete.Entry.IEx.Autocomplete.Fun.html +++ /dev/null @@ -1,79 +0,0 @@ - - - - IEx.Autocomplete.Entry.IEx.Autocomplete.Fun - - - - - - - - - - - - -
      -

      - IEx.Autocomplete.Entry.IEx.Autocomplete.Fun - - impl - -

      - - - - Source - - - - - - -

      Functions summary

      - - - - - - -
      -

      Functions

      -
      -

      - to_entries(fun) -

      -
      - Source -
      -

      - to_hint(arg1, hint) -

      -
      - Source -
      -
      - - - -
      - - diff --git a/docs/stable/IEx.Autocomplete.Entry.IEx.Autocomplete.Mod.html b/docs/stable/IEx.Autocomplete.Entry.IEx.Autocomplete.Mod.html deleted file mode 100644 index 53bcba396..000000000 --- a/docs/stable/IEx.Autocomplete.Entry.IEx.Autocomplete.Mod.html +++ /dev/null @@ -1,79 +0,0 @@ - - - - IEx.Autocomplete.Entry.IEx.Autocomplete.Mod - - - - - - - - - - - - -
      -

      - IEx.Autocomplete.Entry.IEx.Autocomplete.Mod - - impl - -

      - - - - Source - - - - - - -

      Functions summary

      - - - - - - -
      -

      Functions

      -
      -

      - to_entries(mod) -

      -
      - Source -
      -

      - to_hint(arg1, hint) -

      -
      - Source -
      -
      - - - -
      - - diff --git a/docs/stable/IEx.Autocomplete.html b/docs/stable/IEx.Autocomplete.html index 28a1ec869..52a8465c6 100644 --- a/docs/stable/IEx.Autocomplete.html +++ b/docs/stable/IEx.Autocomplete.html @@ -32,7 +32,7 @@

      - Source + Source @@ -53,6 +53,8 @@

      Functions summary

      + +

      Functions

      @@ -60,12 +62,14 @@

      Functions

      expand(expr)

      - Source + Source
      + + diff --git a/docs/stable/IEx.Helpers.html b/docs/stable/IEx.Helpers.html index 1412891f2..a93df9bef 100644 --- a/docs/stable/IEx.Helpers.html +++ b/docs/stable/IEx.Helpers.html @@ -30,23 +30,31 @@

      A bunch of helpers available in IEx.

        -
      • c - compiles a file in the given path
      • -
      • d - prints documentation
      • -
      • h - prints history
      • -
      • m - prints loaded modules
      • -
      • r - recompiles and reloads the given module's source file
      • -
      • v - retrieves nth value from console
      • +
      • c/2 - compiles a file in the given path
      • +
      • h/0,h/1, h/2 - prints help/documentation
      • +
      • m/0 - prints loaded modules
      • +
      • r/0 - recompiles and reloads the given module's source file
      • +
      • v/0 - prints all commands and values
      • +
      • v/1 - retrieves nth value from console
      -

      Documentation for functions in this module can be consulted +

      Help for functions in this module can be consulted directly from the command line, as an example, try:

      -

      d(:c, 1)

      +
      h(c/2)
      +
      + +

      You can also retrieve the documentation for any module +or function. Try these:

      + +
      h(Enum)
      +h(Enum.reverse/1)
      +
      - Source + Source @@ -62,37 +70,37 @@

      Functions summary

    1751. - d/0 + h/0
    1752. - d/2 + h/2
    1753. - d/3 + h/3
    1754. - h/0 + m/0
    1755. - m/0 + r/0
    1756. - r/0 + r/1
    1757. - r/1 + v/0
    1758. @@ -109,7 +117,7 @@

      Macros summary

      • - d/1 + h/1
      • @@ -117,6 +125,8 @@

        Macros summary

        + +

        Functions

        @@ -133,52 +143,45 @@

        Examples

        #=> Foo
        - Source + Source
        -

        - d() +

        + h()

        Shows the documentation for IEx.Helpers.

        - Source + Source
        -

        - d(function, arity) +

        + h(function, arity)

        Prints the documentation for the given function and arity.

        The function may either be a function defined inside IEx.Helpers or in Kernel. To see functions from other module, use -d/3 instead.

        +h/3 instead.

        Examples

        -
        d(:d, 2)
        +
        h(:h, 2)
         #=> Prints documentation for this function
         
        - Source + Source
        -

        - d(module, function, arity) +

        + h(module, function, arity)

        Shows the documentation for the function/arity in module.

        - Source -
        -

        - h() -

        -

        Prints commands history and their result.

        -
        - Source + Source

        m()

        Returns the name and module of all modules loaded.

        - Source + Source

        r() @@ -186,7 +189,7 @@

        Examples

        Reloads all modules that were already reloaded at some point with r/1.

        - Source + Source

        r(module) @@ -196,7 +199,14 @@

        Examples

        Please note that all the modules defined in the specified files are recompiled and reloaded.

        - Source + Source +
        +

        + v() +

        +

        Prints commands history and their result.

        +
        + Source

        v(n) @@ -205,7 +215,7 @@

        Examples

        values to lookup query's value from latest to earliest. For instance, v(-1) returns the latest result.

        - Source + Source @@ -214,29 +224,31 @@

        Examples

        Macros

        -

        - d(other) +

        + h(other)

        Shows the documentation for the given module or for the given function/arity pair.

        Examples

        -
        d(Enum)
        +
        h(Enum)
         #=> Prints documentation for Enum
         

        It also accepts functions in the format fun/arity and module.fun/arity, for example:

        -
        d receive/1
        -d Enum.all?/2
        +
        h receive/1
        +h Enum.all?/2
         
        - Source + Source
        + + diff --git a/docs/stable/IEx.Remsh.html b/docs/stable/IEx.Remsh.html index 4f5151f20..dccec5b12 100644 --- a/docs/stable/IEx.Remsh.html +++ b/docs/stable/IEx.Remsh.html @@ -45,7 +45,7 @@

        - Source + Source @@ -66,6 +66,8 @@

        Functions summary

        + +

        Functions

        @@ -73,12 +75,14 @@

        Functions

        expand(node)

        - Source + Source
        + + diff --git a/docs/stable/IEx.UnicodeIO.html b/docs/stable/IEx.UnicodeIO.html deleted file mode 100644 index 4e93074ed..000000000 --- a/docs/stable/IEx.UnicodeIO.html +++ /dev/null @@ -1,102 +0,0 @@ - - - - IEx.UnicodeIO - - - - - - - - - - - - -
        -

        - IEx.UnicodeIO - -

        - - -
        -

        This module implements the API used by IEX to -interact with the console. This API may change -in the future without warnings.

        - -
        - - - Source - - - - - - -

        Functions summary

        - - - - - - -
        -

        Functions

        -
        -

        - error(result) -

        -

        Implements the error IO API used by IEx. It prints error -messages.

        -
        - Source -
        -

        - get(config) -

        -

        Implements the get IO API used by IEx. It receives the -code cache, the instructions counter and needs to -return a list with the new characters inserted.

        -
        - Source -
        -

        - put(result) -

        -

        Implements the put IO API used by IEx. It receives the -result and prints it.

        -
        - Source -
        -
        - - - -
        - - diff --git a/docs/stable/IEx.html b/docs/stable/IEx.html index d104f4fc4..1144a089b 100644 --- a/docs/stable/IEx.html +++ b/docs/stable/IEx.html @@ -40,7 +40,7 @@

        - Source + Source @@ -50,10 +50,35 @@

        Functions summary

        • + + after_spawn/0 + +
        • +
        • + + after_spawn/1 + +
        • +
        • cli/0
        • +
        • + + inspect_opts/0 + +
        • +
        • + + inspect_opts/1 + +
        • +
        • + + preload/0 + +
        • run/1 @@ -76,15 +101,56 @@

          Functions summary

          + +

          Functions

          +

          + after_spawn() +

          +

          Returns registered after spawn callbacks.

          +
          + Source +
          +

          + after_spawn(fun) +

          +

          Registers a function to be invoked after IEx +process is spawned. Requires IEx.preload to +be invoked.

          +
          + Source +

          cli()

          Interface to start IEx from CLI.

          - Source + Source +
          +

          + inspect_opts() +

          +

          Returns currently registered inspect options.

          +
          + Source +
          +

          + inspect_opts(opts) +

          +

          Registers options used on inspect.

          +
          + Source +
          +

          + preload() +

          +

          Simply loads IEx application. Most of the times it is +preloaded on demand, but if you want to pre-configure +IEx, you need to preload it.

          +
          + Source

          run(opts // []) @@ -92,26 +158,28 @@

          Functions

          Runs IEx checking if tty is available or not. If so, invoke tty, otherwise go with the simple iex.

          - Source + Source

          simple(opts // [])

          Starts IEx simply using the current stdio.

          - Source + Source

          tty(opts // [])

          Starts IEx using a tty server.

          - Source + Source
          + + diff --git a/docs/stable/IO.html b/docs/stable/IO.html index 87b1d23d0..1e0f6873b 100644 --- a/docs/stable/IO.html +++ b/docs/stable/IO.html @@ -27,19 +27,24 @@

          -

          Module responsible for doing IO. The function in this -module expects an iodata as argument encoded in UTF-8. -An iodata can be:

          +

          Module responsible for doing IO. Many functions in this +module expects an IO device and an io data encoded in UTF-8.

          + +

          An IO device must be a pid is an atom representing a process. +For convenience, Elixir provides :stdio and :stderr as +shortcut to Erlang's :standard_io and :standard_error.

          + +

          An io data can be:

            -
          • A list of integers representing a string. Any unicode +
          • A list of integers representing a string. Any unicode character must be represented with one entry in the list, -this entry being an integer with the codepoint value;

          • -
          • A binary in which unicode characters are represented -with many bytes (Elixir's default representation);
          • -
          • A list of binaries or a list of char lists (as described above);
          • -
          • If none of the above, to_binary is invoked in the -given argument;
          • +this entry being an integer with the codepoint value;

            +
          • A binary in which unicode characters are represented +with many bytes (Elixir's default representation);

          • +
          • A list of binaries or a list of char lists (as described above);

          • +
          • If none of the above, to_binary is invoked in the +given argument;

          @@ -66,12 +71,7 @@

          Functions summary

        • - inspect/2 - -
        • -
        • - - print/2 + inspect/3
        • @@ -101,6 +101,8 @@

          Functions summary

          + +

          Functions

          @@ -117,7 +119,7 @@

          Functions

          NFS file system.

        - Source + Source

        gets(device // :stdio, prompt) @@ -133,21 +135,15 @@

        Functions

        NFS file system.

      - Source + Source
      -

      - inspect(device // :stdio, item) +

      + inspect(device // :stdio, item, opts // [])

      Inspects and writes the given argument to the device followed by a new line. Returns the item given.

      - Source -
      -

      - print(device // :stdio, item) -

      -
      - Source + Source

      puts(device // :stdio, item) @@ -156,7 +152,7 @@

      Functions

      but adds a new line at the end. The argument is expected to be a chardata.

      - Source + Source

      read(device // :stdio, count) @@ -171,7 +167,7 @@

      Functions

      NFS file system.

    1759. - Source + Source

      readline(device // :stdio) @@ -189,7 +185,7 @@

      Functions

      This function does the same as gets/2, except the prompt is not required as argument.

      - Source + Source

      write(device // :stdio, item) @@ -210,12 +206,14 @@

      Examples

      #=> "error"
      - Source + Source + + diff --git a/docs/stable/Kernel.ParallelCompiler.html b/docs/stable/Kernel.ParallelCompiler.html index ae4645c69..3fd745332 100644 --- a/docs/stable/Kernel.ParallelCompiler.html +++ b/docs/stable/Kernel.ParallelCompiler.html @@ -58,6 +58,8 @@

      Functions summary

      + +

      Functions

      @@ -88,6 +90,8 @@

      Functions

      + +
      diff --git a/docs/stable/Kernel.ParallelRequire.html b/docs/stable/Kernel.ParallelRequire.html index b3ae3d4d9..1c441f715 100644 --- a/docs/stable/Kernel.ParallelRequire.html +++ b/docs/stable/Kernel.ParallelRequire.html @@ -53,6 +53,8 @@

      Functions summary

      + +

      Functions

      @@ -70,6 +72,8 @@

      Functions

      + +
      diff --git a/docs/stable/Kernel.SpecialForms.html b/docs/stable/Kernel.SpecialForms.html index ac4f9af88..46855ca5e 100644 --- a/docs/stable/Kernel.SpecialForms.html +++ b/docs/stable/Kernel.SpecialForms.html @@ -147,6 +147,8 @@

      Macros summary

      + +

      Macros

      @@ -183,7 +185,7 @@

      Examples

      record. In the environment you can access the current filename, line numbers, set up aliases, the current function and others.

      - Source + Source

      __FILE__() @@ -192,7 +194,7 @@

      Examples

      Although the file can be accessed in the ENV, this macro is a convenient shortcut.

      - Source + Source

      __MODULE__() @@ -201,7 +203,7 @@

      Examples

      Although the module can be accessed in the ENV, this macro is a convenient shortcut.

      - Source + Source

      __aliases__(args) @@ -213,7 +215,7 @@

      Examples

      { :__aliases__, 0, [:Foo,:Bar] }
      - Source + Source

      __block__(args) @@ -226,7 +228,7 @@

      Examples

      #=> { :__block__, 0, [1,2,3] }
      - Source + Source

      __scope__(opts, args) @@ -237,12 +239,12 @@

      Examples

      it belonged to another file.

      quote location: :keep, do: 1
      -#=> { :__scope__, 1,[[file: "iex"],[do: 1]] }
      +#=> { :__scope__, 1,[[file: "iex"], 1] }
       

      Check quote/1 for more information.

      - Source + Source

      alias(module, opts) @@ -300,7 +302,7 @@

      Lexical scope

      "helloworld"
      - Source + Source

      import(module, opts) @@ -310,32 +312,43 @@

      Lexical scope

      Examples

      -

      If you want to use the values function from Keyword several times -in your module and you don't want to always type Keyword.values, -you can simply import it:

      +

      If you are using several functions from a given module, you can +import those functions and reference them as local functions, +for example:

      -
      defmodule Math do
      -  import Keyword, only: [values: 1]
      +
      import List
      +flatten([1,[2],3]) #=> [1,2,3]
      +
      - def some_function do - # call values(orddict) - end -end +

      Selector

      + +

      By default, Elixir imports functions and macros from the given +module, except the ones starting with underscore (which are +usually callbacks):

      + +
      import List
       
      -

      In this case, we are importing only the function values (with arity 1) -from Keyword. Although only is optional, its usage is recommended. -except could also be given as an option. If no option is given, all -functions and macros are imported.

      +

      A developer can change this behavior to include all macros and +functions, regardless if it starts with underscore, by passing +:all as first argument:

      + +
      import :all, List
      +
      -

      In case you want to import only functions or macros, you can pass a -first argument selecting the scope:

      +

      It can also be customized to import only functions or only +macros:

      -
      import :macros, MyMacros
      +
      import :functions, List
      +import :macros, List
       
      -

      And you can then use only or except to filter the macros being -included.

      +

      Alternatively, Elixir allows a developer to specify :only +or :except as a fine grained control on what to import (or +not):

      + +
      import List, only: [flatten: 1]
      +

      Lexical scope

      @@ -356,10 +369,10 @@

      Lexical scope

      end
      -

      In the example above, we imported macros from MyMacros, replacing -the original if/2 implementation by our own during that -specific function. All other functions in that module will still -be able to use the original one.

      +

      In the example above, we imported macros from MyMacros, +replacing the original if/2 implementation by our own +during that specific function. All other functions in that +module will still be able to use the original one.

      Alias/Require shortcut

      @@ -367,7 +380,7 @@

      Alias/Require shortcut

      also accepts as: as an option so it automatically sets up an alias. Please check alias for more information.

      - Source + Source

      lc(args) @@ -415,7 +428,7 @@

      Alias/Require shortcut

      [{213,45,132},{64,76,32},{76,0,0},{234,32,15}]
      - Source + Source

      quote(opts, list2) @@ -428,11 +441,11 @@

      Examples

      #=> { :sum, 0, [1, 2, 3] } -

      Macros

      +

      Homoiconicity

      -

      Any Elixir program can be +

      Elixir is an homoiconic language. Any Elixir program can be represented using its own data structures. The building block -of Elixir is a tuple with three elements, for example:

      +of Elixir homoiconicity is a tuple with three elements, for example:

      { :sum, 1, [1, 2, 3] }
       
      @@ -450,7 +463,7 @@

      Macros

      that it may be a variable. -

      literals

      +

      Macro literals

      Besides the tuple described above, Elixir has a few literals that when quoted return themselves. They are:

      @@ -532,14 +545,14 @@

      Stacktrace information

      is defining new functions. Consider this example:

      defmodule MyServer do
      -  use GenServer.Behavior
      +  use GenServer.Behaviour
       end
       
      -

      GenServer.Behavior defines new functions in our MyServer module. +

      GenServer.Behaviour defines new functions in our MyServer module. However, if there is an exception in any of these functions, we want -the stacktrace to point to the GenServer.Behavior and not the line -that calls use GenServer.Behavior. For this reason, there is an +the stacktrace to point to the GenServer.Behaviour and not the line +that calls use GenServer.Behaviour. For this reason, there is an option called :location that when set to :keep keeps these proper semantics:

      @@ -551,11 +564,11 @@

      Stacktrace information

      It is important to warn though that location: :keep evaluates the -code as if it was defined inside GenServer.Behavior file, in +code as if it was defined inside GenServer.Behaviour file, in particular, the macro __FILE__ will always point to -GenServer.Behavior file.

      +GenServer.Behaviour file.

      - Source + Source

      require(module, opts) @@ -615,7 +628,7 @@

      Examples

      #=> { :sum, 0, [1, 13, 3] }
      - Source + Source

      unquote_splicing(expr) @@ -630,7 +643,7 @@

      Examples

      #=> { :sum, 0, [1, 2, 3, 4, 5] }
      - Source + Source

      {}(args) @@ -647,6 +660,8 @@

      Examples

      + + diff --git a/docs/stable/Kernel.Typespec.html b/docs/stable/Kernel.Typespec.html index 4fcedf60c..218e10160 100644 --- a/docs/stable/Kernel.Typespec.html +++ b/docs/stable/Kernel.Typespec.html @@ -86,6 +86,8 @@

      Macros summary

      + +

      Functions

      @@ -142,6 +144,8 @@

      Macros

      + + diff --git a/docs/stable/Kernel.html b/docs/stable/Kernel.html index 6e09ffd1c..1e6010df6 100644 --- a/docs/stable/Kernel.html +++ b/docs/stable/Kernel.html @@ -58,699 +58,744 @@

      Functions summary

      - - - -

      Macros summary

      - + + + +

      Macros summary

      +
        +
      • - hd/1 + !/1
      • - if/2 + !=/2
      • - in/2 + !==/2
      • - inspect/1 + &&/2
      • - integer_to_list/1 + */2
      • - integer_to_list/2 + +/2
      • - iolist_size/1 + ++/2
      • - iolist_to_binary/1 + -/2
      • - is_atom/1 + --/2
      • - is_binary/1 + ../2
      • - is_bitstring/1 + //2
      • - is_boolean/1 + />/2
      • - is_exception/1 + </2
      • - is_float/1 + <-/2
      • - is_function/1 + <=/2
      • - is_function/2 + <>/2
      • - is_integer/1 + ==/2
      • - is_list/1 + ===/2
      • - is_number/1 + =~/2
      • - is_pid/1 + >/2
      • - is_port/1 + >=/2
      • - is_record/2 + @/1
      • - is_reference/1 + __B__/2
      • - is_regex/1 + __C__/2
      • - is_tuple/1 + __R__/2
      • - length/1 + __b__/2
      • - list_to_atom/1 + __c__/2
      • - list_to_binary/1 + __r__/2
      • - list_to_bitstring/1 + access/2
      • - list_to_existing_atom/1 + and/2
      • - list_to_float/1 + atom_to_binary/1
      • - list_to_integer/1 + binary_to_atom/1
      • - list_to_integer/2 + binary_to_existing_atom/1
      • - list_to_pid/1 + binary_to_float/1
      • - list_to_tuple/1 + binary_to_integer/1
      • - make_ref/0 + binary_to_integer/2
      • - match?/2 + case/2
      • - max/2 + cond/1
      • - min/2 + def/2
      • - node/0 + def/4
      • - node/1 + defdelegate/2
      • - not/1 + defexception/4
      • - or/2 + defimpl/3
      • - pid_to_list/1 + defmodule/2
      • - receive/1 + defoverridable/1
      • - rem/2 + defp/2
      • - round/1 + defp/4
      • - self/0 + defprotocol/2
      • - setelem/3 + defrecord/4
      • - size/1 + destructure/2
      • - spawn/1 + div/2
      • - spawn/3 + elem/2
      • - spawn_link/1 + float_to_binary/1
      • - spawn_link/3 + function/1
      • - term_to_binary/1 + if/2
      • - term_to_binary/2 + in/2
      • - throw/1 + inspect/2
      • - tl/1 + integer_to_binary/1
      • - to_binary/1 + integer_to_binary/2
      • - to_char_list/1 + is_exception/1
      • - trunc/1 + is_range/1
      • - try/1 + is_record/2
      • - tuple_size/1 + is_regex/1
      • - tuple_to_list/1 + match?/2 + +
      • +
      • + + nil?/1 + +
      • +
      • + + not/1 + +
      • +
      • + + or/2 + +
      • +
      • + + receive/1 + +
      • +
      • + + rem/2 + +
      • +
      • + + setelem/3 + +
      • +
      • + + to_binary/1 + +
      • +
      • + + to_char_list/1 + +
      • +
      • + + try/1
      • @@ -783,2103 +828,2459 @@

        Macros summary

        + +

        Functions

        -

        - raise(msg) +

        + abs(number)

        -

        Raises an error.

        +

        Returns an integer or float which is the arithmetical absolute value of number.

        -

        If the argument is a binary, it raises RuntimeError with the message. -If anything else, becomes a call to raise(argument, []).

        +

        Allowed in guard tests.

        Examples

        -
        raise "Given values do not match"
        -
        -try do
        -  1 + :foo
        -rescue
        -  x in [BadargError] ->
        -    IO.puts "that was expected"
        -    raise x
        -end
        +
        abs(-3.33) #=> 3.33
        +abs(-3)    #=> 3
         
        - Source + Source
        -

        - raise(exception, args) +

        + apply(fun, args)

        -

        Raises an error.

        - -

        It calls .exception on the given argument passing -the args in order to retrieve the appropriate exception -structure.

        - -

        Any module defined via defexception automatically -defines exception(args) that returns a new instance -of the record and a exception(args, current) that -works as no-op.

        +

        Invokes the given fun with the array of arguments args.

        Examples

        -
        raise ArgumentError, message: "Sample"
        +
        apply fn x -> x * 2 end, [2]
        +#=> 4
         
        - Source -
        -
        - - - -
        -

        Macros

        -
        -

        - !(arg) + Source +

        +

        + apply(module, fun, args)

        -

        It receives any argument and returns true if it is false -or nil. Returns false otherwise. Not allowed in guard -clauses.

        +

        Invokes the given fun from module with the array of arguments args.

        Examples

        -

        !1 #=> false - ![1,2,3] #=> false - !false #=> true - !nil #=> true

        +
        apply List, reverse, [[1,2,3]]
        +#=> [3,2,1]
        +
        - Source + Source
        -

        - !=(left, right) +

        + atom_to_binary(atom, encoding)

        -

        Returns true if the two items are not equal.

        - -

        This operator considers 1 and 1.0 to be equal. For strict -comparison, use !== instead.

        - -

        As Erlang, Elixir can compare any term. Allowed in guard clauses.

        +

        Returns a binary which corresponds to the text representation of atom. +If encoding is latin1, there will be one byte for each character in the text +representation. If encoding is utf8 or unicode, the characters will be encoded +using UTF-8 (meaning that characters from 16#80 up to 0xFF will be encoded in +two bytes).

        Examples

        -
        1 != 2
        -#=> true
        -1 != 1.0
        -#=> false
        +
        atom_to_binary(:elixir, :utf8) #=> "elixir"
         
        - Source + Source
        -

        - !==(left, right) +

        + atom_to_list(atom)

        -

        Returns true if the two items are strictly not equal. -As Erlang, Elixir can compare any term. Allowed in guard clauses.

        +

        Returns a string which corresponds to the text representation of atom.

        Examples

        -
        1 !== 2
        -#=> true
        -
        -1 !== 1.0
        -#=> true
        +
        atom_to_list(:elixir) #=> 'elixir'
         
        - Source + Source
        -

        - &&(left, right) +

        + binary_part(binary, start, length)

        -

        Provides a short-circuit operator that executes the second -expression only if the first one evalutes to true (i.e. it is -not nil nor false). Returns the first expression otherwise.

        +

        Extracts the part of the binary starting at start with length length. +Binaries are zero-indexed.

        + +

        If start or length references in any way outside the binary, an +ArgumentError exception is raised.

        + +

        Allowed in guard tests.

        Examples

        -
        true && true         #=> true
        -nil && true          #=> nil
        -true && 1            #=> 1
        -false && error(:bad) #=> false
        +
        binary_part "foo", 1, 2 #=> "oo"
         
        -

        Notice that, differently from Erlang and operator, -this operator accepts any expression as arguments, -not only booleans, however it is not allowed in guards.

        +

        A negative length can be used to extract bytes at the end of a binary:

        + +
        binary_part "foo", 3, -1 #=> 1
        +
        - Source + Source
        -

        - *(left, right) +

        + binary_to_atom(binary, encoding)

        -

        Arithmetic multiplication. Allowed in guard clauses.

        +

        Returns the atom whose text representation is binary. If encoding is latin1, +no translation of bytes in the binary is done. If encoding is utf8 or unicode, +the binary must contain valid UTF-8 sequences; furthermore, only Unicode +characters up to 0xFF are allowed.

        Examples

        -
        1 * 2 #=> 2
        +
        binary_to_atom("elixir", :utf8) #=> :elixir
         
        - Source + Source
        -

        - +(left, right) +

        + binary_to_existing_atom(binary, encoding)

        -

        Arithmetic plus. Allowed in guard clauses.

        - -

        Examples

        - -
        1 + 2 #=> 3
        -
        +

        Works like binary_to_atom/2, but the atom must already exist.

        - Source + Source
        -

        - ++(left, right) +

        + binary_to_list(binary)

        -

        Concatenates two lists. Allowed in guard clauses.

        - -

        Examples

        - -
        [1] ++ [2,3]
        -#=> [1,2,3]
        -
        -'foo' ++ 'bar'
        -#=> 'foobar'
        -
        +

        Returns a list of integers which correspond to the bytes of binary.

        - Source + Source
        -

        - -(left, right) +

        + binary_to_list(binary, start, stop)

        -

        Arithmetic minus. Allowed in guard clauses.

        +

        As binarytolist/1, but returns a list of integers corresponding to the bytes +from position start to position stop in binary. Positions in the binary +are numbered starting from 1.

        +
        + Source +
        +

        + binary_to_term(binary) +

        +

        Returns an Erlang term which is the result of decoding the binary +object binary, which must be encoded according to the Erlang external +term format.

        Examples

        -
        1 - 2 #=> -1
        +
        binary_to_term(term_to_binary("foo")) #=> "foo"
         
        - Source + Source
        -

        - --(left, right) +

        + binary_to_term(binary, options)

        -

        Removes the first occorrence of an item on the left -for each item on the right. Allowed in guard clauses.

        +

        As binary_to_term/1, but accepts a safe option useful when receiving +binaries from an untrusted source.

        -

        Examples

        +

        When enabled, it prevents decoding data that may be used to attack the +Erlang system. In the event of receiving unsafe data, decoding fails +with a badarg error.

        -
        [1,2,3] -- [1,2]
        -#=> [3]
        +

        Currently, this prevents creation of new atoms directly, creation of +new atoms indirectly (as they are embedded in certain structures like pids, +refs, funs, etc), and creation of new external function references. None +of those resources are currently garbage collected, so unchecked creation +of them can exhaust available memory.

        -[1,2,3,2,1] -- [1,2,2] -#=> [3,1] +

        Examples

        + +
        binary_to_term(term_to_binary("foo"), [:safe])
         
        - Source + Source
        -

        - ..(first, last) +

        + bit_size(bitstring)

        -

        Returns a range with the specified start and end. -Includes both ends.

        +

        Returns an integer which is the size in bits of bitstring.

        + +

        Allowed in guard tests.

        Examples

        -
        0 in 1..3 #=> false
        -1 in 1..3 #=> true
        -2 in 1..3 #=> true
        -3 in 1..3 #=> true
        +
        bit_size(<<433|16,3|3>>) #=> 19
        +bit_size(<<1,2,3>>) #=> 24
         
        - Source + Source
        -

        - /(left, right) +

        + bitstring_to_list(bitstring)

        -

        Arithmetic division. Differently from other languages, -the result is always a float. Use div and rem if you want -a natural division or the remainder. Allowed in guard clauses.

        - -

        Examples

        - -
        1 / 2 #=> 0.5
        -2 / 1 #=> 2.0
        -
        +

        Returns a list of integers which correspond to the bytes of bitstring. If the +number of bits in the binary is not divisible by 8, the last element of the list will +be a bitstring containing the remaining bits (1 up to 7 bits).

        - Source + Source
        -

        - />(left, right) +

        + byte_size(bitstring)

        -

        /> is called the pipeline operator as it is useful -to write pipeline style expressions. This operator -tntroduces the expression on the left as the first -argument to the expression on the right.

        - -

        Examples

        +

        Returns an integer which is the number of bytes needed to contain bitstring. +(That is, if the number of bits in Bitstring is not divisible by 8, the resulting +number of bytes will be rounded up.)

        -
        [1,[2],3] /> List.flatten /> Enum.map(&1 * 2)
        -#=> [2,4,6]
        -
        +

        Allowed in guard tests.

        -

        The expression above is simply translated to:

        +

        Examples

        -
        Enum.map(List.flatten([1,[2],3]), &1 * 2)
        +
        byte_size(<<433|16,3|3>>) #=> 3
        +byte_size(<<1,2,3>>) #=> 3
         
        - Source + Source
        -

        - <(left, right) +

        + exit(reason)

        -

        Return true if left is less than right. -As Erlang, Elixir can compare any term. Allowed in guard clauses.

        +

        Stops the execution of the calling process with the given reason. +Since evaluating this function causes the process to terminate, +it has no return value.

        Examples

        -
        1 < 2
        -#=> true
        +
        exit(:normal)
        +exit(:seems_bad)
         
        - Source + Source
        -

        - <-(pid, msg) +

        + float(number)

        -

        Sends a message to the process identified on the left. -A process can be identified bu its PID or, if it is registered, -by an atom.

        - -

        Examples

        - -
        process = Process.self
        -process <- { :ok, "Sending myself a message" }
        -
        +

        Converts the given number to a float. Allowed in guard clauses.

        - Source + Source
        -

        - <=(left, right) +

        + float_to_list(number)

        -

        Return true if left is less than or equal to right. -As Erlang, Elixir can compare any term. Allowed in guard clauses.

        +

        Returns a char list which corresponds to the text representation of the given float.

        Examples

        -
        1 <= 2
        -#=> true
        +
        float_to_list(7.0)
        +#=> '7.00000000000000000000e+00'
         
        - Source + Source
        -

        - <>(left, right) +

        + function_exported?(module, function, arity)

        -

        Concatenates two binaries. Allowed in guard clauses.

        - -

        Examples

        - -
        "foo" <> "bar" #=> "foobar"
        -
        +

        Returns true if the module is loaded and contains a +public function with the given arity, otherwise false.

        -

        The <> operator can also be used in guard clauses as -long as the first part is a literal binary:

        +

        In case a tuple module is given, the arity is automatically +increased by one.

        -
        "foo" <> x = "foobar"
        -x #=> "bar"
        -
        +

        Notice that this function does not load the module in case +it is not loaded. Check Code.ensure_loaded/1 for more +information.

        - Source + Source
        -

        - ==(left, right) +

        + halt()

        -

        Returns true if the two items are equal.

        +

        The same as halt(0, []).

        +
        + Source +
        +

        + halt(status) +

        +

        The same as halt(status, []).

        +
        + Source +
        +

        + halt(status, options) +

        +

        Halts the Erlang runtime system where the first argument status must be a +non-negative integer, a char list, or the atom :abort.

        -

        This operator considers 1 and 1.0 to be equal. For strict -comparison, use === instead.

        +
          +
        • If an integer, the runtime system exits with the integer value which +is returned to the Operating System;

        • +
        • If a char list, an erlang crash dump is produced with status as slogan, +and then the runtime system exits with status code 1;

        • +
        • If :abort, the runtime system aborts producing a core dump, if that is +enabled in the operating system.

        • +
        -

        As Erlang, Elixir can compare any term. Allowed in guard clauses.

        +

        Note that on many platforms, only the status codes 0-255 are supported +by the operating system.

        -

        Examples

        +

        For integer status, Erlang runtime system closes all ports and allows async +threads to finish their operations before exiting. To exit without such +flushing, pass options [flush: false] instead.

        -
        1 == 2
        -#=> false
        +

        Examples

        -1 == 1.0 -#=> true +
        halt(0)
        +halt(1, flush: false)
        +halt(:abort)
         
        - Source + Source
        -

        - ===(left, right) +

        + hd(list)

        -

        Returns true if the two items are strictly equal. -As Erlang, Elixir can compare any term. Allowed in guard clauses.

        +

        Returns the head of a list, raises badarg if the list is empty.

        +
        + Source +
        +

        + integer_to_list(number) +

        +

        Returns a char list which corresponds to the text representation of the given integer.

        Examples

        -
        1 === 2
        -#=> false
        -
        -1 === 1.0
        -#=> false
        +
        integer_to_list(7)
        +#=> '7'
         
        - Source + Source
        -

        - =~(left, right) +

        + integer_to_list(number, base)

        -

        Matches the term on the left against the regular expression -on the right. It returns nil if not match happened or the -first match otherwise.

        +

        Returns a char list which corresponds to the text representation of the +given integer in the given case.

        Examples

        -
        "abcd" =~ %r/c(d)/  #=> 2
        -"abcd" =~ %r/e/     #=> nil
        +
        integer_to_list(1023, 16).
        +#=> "3FF"
         
        - Source + Source
        -

        - >(left, right) +

        + iolist_size(item)

        -

        Return true if left is more than right. -As Erlang, Elixir can compare any term. Allowed in guard clauses.

        +

        Returns the size of an iolist.

        Examples

        -
        1 > 2
        -#=> false
        +
        iolist_size([1,2|<<3,4>>])
        +#=> 4
         
        - Source + Source
        -

        - >=(left, right) +

        + iolist_to_binary(item)

        -

        Return true if left is more than or equal to right. -As Erlang, Elixir can compare any term. Allowed in guard clauses.

        +

        Returns a binary which is made from the integers and binaries in iolist.

        Examples

        -
        1 >= 2
        -#=> false
        +
        bin1 = <<1,2,3>>
        +bin2 = <<4,5>>
        +bin3 = <<6>>
        +
        +iolist_to_binary([bin1,1,[2,3,bin2],4|bin3])
        +#=> <<1,2,3,1,2,3,4,5,4,6>>
         
        - Source + Source
        -

        - @(expr) +

        + is_alive()

        -

        This macro is a shortcut to read and add attributes to the module -being compiled. Elixir module attributes are similar to Erlang's with -some differences. The canonical example for attributes is annotating -that a module implements the OTP behavior called gen_server:

        +

        Returns true if the local node is alive; that is, +if the node can be part of a distributed system.

        +
        + Source +
        +

        + is_atom(term) +

        +

        Returns true if term is an atom; otherwise returns false.

        -
        defmodule MyServer do
        -  @behavior :gen_server
        -  # ... callbacks ...
        -end
        -
        +

        Allowed in guard tests.

        +
        + Source +
        +

        + is_binary(term) +

        +

        Returns true if term is a binary; otherwise returns false.

        -

        Elixir supports by default all Erlang module attributes but any developer -can also add custom attributes:

        +

        A binary always contains a complete number of bytes.

        -
        defmodule MyServer do
        -  @my_data 13
        -  IO.inspect @my_data #=> 13
        -end
        -
        +

        Allowed in guard tests.

        +
        + Source +
        +

        + is_bitstring(term) +

        +

        Returns true if term is a bitstring (including a binary); otherwise returns false.

        -

        Differently from Erlang, such attributes are not stored in the module by -default since it is common in Elixir to use such attributes to store -temporary data. A developer can configure an attribute to behave closer -to Erlang by calling Module.register_attribute/2.

        +

        Allowed in guard tests.

        +
        + Source +
        +

        + is_boolean(term) +

        +

        Returns true if term is either the atom true or the atom false (i.e. a boolean); +otherwise returns false.

        -

        Finally notice that attributes can also be read inside functions:

        +

        Allowed in guard tests.

        +
        + Source +
        +

        + is_float(term) +

        +

        Returns true if term is a floating point number; otherwise returns false.

        -
        defmodule MyServer do
        -  @my_data 11
        -  def first_data, do: @my_data
        -  @my_data 13
        -  def second_data, do: @my_data
        -end
        +

        Allowed in guard tests.

        +
        + Source +
        +

        + is_function(term) +

        +

        Returns true if term is a function; otherwise returns false.

        -MyServer.first_data #=> 11 -MyServer.second_data #=> 13 -
        +

        Allowed in guard tests.

        +
        + Source +
        +

        + is_function(term, arity) +

        +

        Returns true if term is a function that can be applied with arity number of arguments; +otherwise returns false.

        -

        It is important to note that reading an attribute takes a snapshot of -its current value. In other words, the value is read at compilation -time and not at runtime. Check the module Module for other functions -to manipulate module attributes.

        +

        Allowed in guard tests.

        - Source + Source
        -

        - __B__(string, list2) +

        + is_integer(term)

        -

        Handles the sigil %B. It simples returns a binary -without escaping characters and without interpolations.

        +

        Returns true if term is an integer; otherwise returns false.

        -

        Examples

        +

        Allowed in guard tests.

        +
        + Source +
        +

        + is_list(term) +

        +

        Returns true if term is a list with zero or more elements; otherwise returns false.

        -
        %B(foo)      #=> "foo"
        -%B(f#{o}o)  #=> "f\#{o}o"
        -
        +

        Allowed in guard tests.

        - Source + Source
        -

        - __C__(arg1, list2) +

        + is_number(term)

        -

        Handles the sigil %C. It simples returns a char list -without escaping characters and without interpolations.

        +

        Returns true if term is either an integer or a floating point number; +otherwise returns false.

        + +

        Allowed in guard tests.

        +
        + Source +
        +

        + is_pid(term) +

        +

        Returns true if term is a pid (process identifier); otherwise returns false.

        + +

        Allowed in guard tests.

        +
        + Source +
        +

        + is_port(term) +

        +

        Returns true if term is a port identifier; otherwise returns false.

        + +

        Allowed in guard tests.

        +
        + Source +
        +

        + is_reference(term) +

        +

        Returns true if term is a reference; otherwise returns false.

        + +

        Allowed in guard tests.

        +
        + Source +
        +

        + is_tuple(term) +

        +

        Returns true if term is a tuple; otherwise returns false.

        + +

        Allowed in guard tests.

        +
        + Source +
        +

        + length(list) +

        +

        Returns the length of list.

        + +

        Allowed in guard tests.

        Examples

        -
        %C(foo)      #=> 'foo'
        -%C(f#{o}o)  #=> 'f\#{o}o'
        +
        length([1,2,3,4,5,6,7,8,9]) #=> 9
         
        - Source + Source
        -

        - __R__(arg1, options) +

        + list_to_atom(char_list)

        -

        Handles the sigil %R. It returns a Regex pattern without escaping -nor interpreating interpolations.

        +

        Returns the atom whose text representation is char_list.

        Examples

        -
        Regex.match? %R(f#{1,3}o), "f#o"  #=> true
        +
        list_to_atom('elixir') #=> :elixir
         
        - Source + Source
        -

        - __b__(arg1, list2) +

        + list_to_binary(char_list)

        -

        Handles the sigil %b. It returns a binary as if it was double quoted -string, unescaping characters and replacing interpolations.

        +

        Returns a binary which is made from the content of char_list.

        Examples

        -
        %b(foo)       #=> "foo"
        -%b(f#{:o}o)  #=> "foo"
        +
        list_to_binary('Elixir') #=> "Elixir"
         
        - Source + Source
        -

        - __c__(arg1, list2) +

        + list_to_bitstring(bitstring_list)

        -

        Handles the sigil %c. It returns a char list as if it was a single -quoted string, unescaping characters and replacing interpolations.

        +

        Returns a bitstring which is made from the integers and bitstrings in bitstring_list. +(the last tail in bitstring_list is allowed to be a bitstring.)

        Examples

        -
        %c(foo)       #=> 'foo'
        -%c(f#{:o}o)  #=> 'foo'
        +
        bin1 = <<1,2,3>>
        +bin2 = <<4,5>>
        +bin3 = <<6,7|4>>
        +
        +list_to_bitstring([bin1,1,[2,3,bin2],4|bin3])
        +#=> <<1,2,3,1,2,3,4,5,4,6,7|4>>
         
        - Source + Source
        -

        - __r__(arg1, options) +

        + list_to_existing_atom(char_list)

        -

        Handles the sigil %r. It returns a Regex pattern.

        +

        Returns the atom whose text representation is char_list, but only if there already +exists such atom.

        +
        + Source +
        +

        + list_to_float(char_list) +

        +

        Returns the float whose text representation is char_list.

        Examples

        -
        Regex.match? %r(foo), "foo"  #=> true
        +
        list_to_float('2.2017764e+0') #=> 2.2017764
         
        - Source + Source
        -

        - abs(number) +

        + list_to_integer(char_list)

        -

        Returns an integer or float which is the arithmetical absolute value of number.

        - -

        Allowed in guard tests.

        +

        Returns an integer whose text representation is char_list.

        Examples

        -
        abs(-3.33) #=> 3.33
        -abs(-3)    #=> 3
        +
        list_to_integer('123') #=> 123
         
        - Source + Source
        -

        - access(element, args) +

        + list_to_integer(char_list, base)

        -

        Access the given element using the qualifier according -to the Access protocol. All calls in the form foo[bar] -are translated to access(foo, bar).

        +

        Returns an integer whose text representation in base base is char_list.

        -

        The usage of this protocol is to access a raw value in a -keywords list.

        +

        Examples

        -
        sample = [a: 1, b: 2, c: 3]
        -sample[:b] #=> 2
        +
        list_to_integer('3FF', 16) #=> 1023
         
        +
        + Source +
        +

        + list_to_pid(char_list) +

        +

        Returns a pid whose text representation is char_list.

        -

        Atoms

        +

        Warning:

        -

        Whenever invoked on an atom, the access protocol is expanded -at compilation time rather than on runtime. This feature is used -by records to allow a developer to match against an specific part -of a record:

        +

        This function is intended for debugging and for use in the Erlang +operating system.

        -
        def increment(State[counter: counter, other: 13] = state) do
        -  state.counter(counter + 1)
        -end
        -
        +

        It should not be used in application programs.

        -

        In the example above, we use the Access protocol to match the -counter field in the record State. Considering the record -definition is as follows:

        +

        Examples

        -
        defrecord State, counter: 0, other: nil
        +
        list_to_pid('<0.41>') #=> <0.4.1>
         
        +
        + Source +
        +

        + list_to_tuple(list) +

        +

        Returns a tuple which corresponds to list. list can contain any Erlang terms.

        -

        The clause above is translated to:

        +

        Examples

        -
        def increment({ State, counter, 13 } = state) do
        -  state.counter(counter + 1)
        -end
        +
        list_to_tuple([:share, [:elixir, 163]]). #=> {:share, [:elixir, 163]}
         
        +
        + Source +
        +

        + make_ref() +

        +

        Returns an almost unique reference.

        -

        The same pattern can be used to create a new record:

        - -
        def new_state(counter) do
        -  State[counter: counter]
        -end
        -
        - -

        The example above is slightly faster than State.new(counter: :counter) -because the record is expanded at compilation time and not at runtime. -If a field is not specified on creation, it will have its default value.

        - -

        Finally, as in Erlang, Elixir also allows the following syntax:

        - -
        new_uri = State[_: 1]
        -
        - -

        In this case all fields will be set to 1. Notice that, -as in Erlang, in case an expression is given, it will be -evaluated multiple times:

        - -
        new_uri = State[_: IO.puts "Hello"]
        -
        - -

        In this case, "Hello" will be printed twice (one per each field).

        +

        The returned reference will re-occur after approximately 2^82 calls; +therefore it is unique enough for practical purposes.

        Examples

        -
        a = { :a, :b, :c }
        -a[1] #=> :a
        -access a, 1 #=> :a
        +
        make_ref()
        +#=> #Ref<0.0.0.135>
         
        - Source + Source
        -

        - and(left, right) +

        + max(first, second)

        -

        Boolean and. Arguments needs to necessarily be booleans. -Allowed in guard clauses.

        +

        Return the biggest of the two given terms according to +Erlang's term ordering. If the terms compare equal, the +first one is returned.

        Examples

        -
        true and false
        -#=> false
        +
        max(1, 2) #=> 2
         
        - Source + Source
        -

        - apply(fun, args) +

        + min(first, second)

        -

        Invokes the given fun with the array of arguments args.

        +

        Return the smallest of the two given terms according to +Erlang's term ordering. If the terms compare equal, the +first one is returned.

        Examples

        -
        apply fn x -> x * 2 end, [2]
        -#=> 4
        +
        min(1, 2) #=> 1
         
        - Source + Source
        -

        - apply(module, fun, args) +

        + node()

        -

        Invokes the given fun from module with the array of arguments args.

        - -

        Examples

        +

        Returns an atom representing the name of the local node. +If the node is not alive, nonode@nohost is returned instead.

        -
        apply List, reverse, [[1,2,3]]
        -#=> [3,2,1]
        -
        +

        Allowed in guard tests.

        - Source + Source
        -

        - atom_to_binary(some_atom) +

        + node(arg)

        -

        Returns a binary which corresponds to the text representation -of some_atom in UTF8 encoding. Allowed in guard clauses.

        - -

        Examples

        +

        Returns the node where the given argmuent is located. +The argument can be a pid, a reference, or a port. +If the local node is not alive, nonode@nohost is returned.

        -
        atom_to_binary :my_atom #=> "my_atom"
        -
        +

        Allowed in guard tests.

        - Source + Source
        -

        - atom_to_binary(atom, encoding) +

        + pid_to_list(pid)

        -

        Returns a binary which corresponds to the text representation of atom. -If encoding is latin1, there will be one byte for each character in the text -representation. If encoding is utf8 or unicode, the characters will be encoded -using UTF-8 (meaning that characters from 16#80 up to 0xFF will be encoded in -two bytes).

        - -

        Examples

        +

        Returns a char list which corresponds to the text representation of pid. +This function is intended for debugging and for use in the Erlang operating +system. It should not be used in application programs.

        -
        atom_to_binary(:elixir, utf8) #=> "elixir"
        -
        -
        - Source -
        -

        - atom_to_list(atom) -

        -

        Returns a string which corresponds to the text representation of atom.

        +

        Warning:

        -

        Examples

        +

        This function is intended for debugging and for use in the Erlang +operating system.

        -
        atom_to_list(:elixir) #=> 'elixir'
        -
        +

        It should not be used in application programs.

        - Source + Source
        -

        - binary_part(binary, start, length) +

        + raise(msg)

        -

        Extracts the part of the binary starting at start with length length. -Binaries are zero-indexed.

        - -

        If start or length references in any way outside the binary, an -ArgumentError exception is raised.

        +

        Raises an error.

        -

        Allowed in guard tests.

        +

        If the argument is a binary, it raises RuntimeError with the message. +If anything else, becomes a call to raise(argument, []).

        Examples

        -
        binary_part "foo", 1, 2 #=> "oo"
        -
        - -

        A negative length can be used to extract bytes at the end of a binary:

        +
        raise "Given values do not match"
         
        -
        binary_part "foo", 3, -1 #=> 1
        +try do
        +  1 + :foo
        +rescue
        +  x in [BadargError] ->
        +    IO.puts "that was expected"
        +    raise x
        +end
         
        - Source + Source
        -

        - binary_to_atom(some_binary) +

        + raise(exception, args)

        -

        Returns the atom whose text representation is -some_binary in UTF8 encoding. -Allowed in guard clauses.

        +

        Raises an error.

        -

        Examples

        +

        It calls .exception on the given argument passing +the args in order to retrieve the appropriate exception +structure.

        -
        binary_to_atom "my_atom" #=> :my_atom
        -
        -
        - Source -
        -

        - binary_to_atom(binary, encoding) -

        -

        Returns the atom whose text representation is binary. If encoding is latin1, -no translation of bytes in the binary is done. If encoding is utf8 or unicode, -the binary must contain valid UTF-8 sequences; furthermore, only Unicode -characters up to 0xFF are allowed.

        +

        Any module defined via defexception automatically +defines exception(args) that returns a new instance +of the record and a exception(args, current) that +works as no-op.

        Examples

        -
        binary_to_atom("elixir", :utf8) #=> :elixir
        +
        raise ArgumentError, message: "Sample"
         
        - Source + Source
        -

        - binary_to_existing_atom(some_binary) +

        + round(number)

        -

        Works like binary_to_atom but the atom must exist. -Allowed in guard clauses.

        +

        Returns an integer by rounding the given number. +Allowed in guard tests.

        Examples

        -
        :my_atom                          #=> :my_atom
        -binary_to_existing_atom "my_atom" #=> :my_atom
        +
        round(5.5) #=> 6
         
        - Source -
        -

        - binary_to_existing_atom(binary, encoding) -

        -

        Works like binary_to_atom/2, but the atom must already exist.

        -
        - Source + Source
        -

        - binary_to_list(binary) +

        + self()

        -

        Returns a list of integers which correspond to the bytes of binary.

        +

        Returns the pid (process identifier) of the calling process. +Allowed in guard clauses.

        - Source + Source
        -

        - binary_to_list(binary, start, stop) +

        + size(arg)

        -

        As binarytolist/1, but returns a list of integers corresponding to the bytes -from position start to position stop in binary. Positions in the binary -are numbered starting from 1.

        +

        Returns the size of the given argument, which must be a tuple +or a binary. If possible, please use tuplesize or binarysize.

        - Source + Source
        -

        - binary_to_term(binary) +

        + spawn(fun)

        -

        Returns an Erlang term which is the result of decoding the binary -object binary, which must be encoded according to the Erlang external -term format.

        +

        Spawns the given function and returns its pid.

        + +

        Check the modules Process and Node for other functions +to handle processes, including spawning functions in nodes.

        Examples

        -
        binary_to_term(term_to_binary("foo")) #=> "foo"
        +
        current = Process.self
        +child   = spawn(fn -> current <- { Process.self, 1 + 2 } end)
        +
        +receive
        +  { ^child, 3 } -> IO.puts "Received 3 back"
        +end
         
        - Source + Source
        -

        - binary_to_term(binary, options) +

        + spawn(module, fun, args)

        -

        As binary_to_term/1, but accepts a safe option useful when receiving -binaries from an untrusted source.

        - -

        When enabled, it prevents decoding data that may be used to attack the -Erlang system. In the event of receiving unsafe data, decoding fails -with a badarg error.

        +

        Spawns the given module and function passing the given args +and returns its pid.

        -

        Currently, this prevents creation of new atoms directly, creation of -new atoms indirectly (as they are embedded in certain structures like pids, -refs, funs, etc), and creation of new external function references. None -of those resources are currently garbage collected, so unchecked creation -of them can exhaust available memory.

        +

        Check the modules Process and Node for other functions +to handle processes, including spawning functions in nodes.

        Examples

        -
        binary_to_term(term_to_binary("foo"), [:safe])
        +
        spawn(SomeModule, :function, [1,2,3])
         
        - Source + Source
        -

        - bit_size(bitstring) +

        + spawn_link(fun)

        -

        Returns an integer which is the size in bits of bitstring.

        +

        Spawns the given function, links it to the current process and returns its pid.

        -

        Allowed in guard tests.

        +

        Check the modules Process and Node for other functions +to handle processes, including spawning functions in nodes.

        Examples

        -
        bit_size(<<433|16,3|3>>) #=> 19
        -bit_size(<<1,2,3>>) #=> 24
        +
        current = Process.self
        +child   = spawn_link(fn -> current <- { Process.self, 1 + 2 } end)
        +
        +receive
        +  { ^child, 3 } ->
        +    IO.puts "Received 3 back"
        +end
         
        - Source + Source
        -

        - bitstring_to_list(bitstring) -

        -

        Returns a list of integers which correspond to the bytes of bitstring. If the -number of bits in the binary is not divisible by 8, the last element of the list will -be a bitstring containing the remaining bits (1 up to 7 bits).

        +

        + spawn_link(module, fun, args) +

        +

        Spawns the given module and function passing the given args, +links it to the current process and returns its pid.

        + +

        Check the modules Process and Node for other functions +to handle processes, including spawning functions in nodes.

        + +

        Examples

        + +
        spawn_link(SomeModule, :function, [1,2,3])
        +
        - Source + Source
        -

        - byte_size(bitstring) +

        + term_to_binary(term)

        -

        Returns an integer which is the number of bytes needed to contain bitstring. -(That is, if the number of bits in Bitstring is not divisible by 8, the resulting -number of bytes will be rounded up.)

        +

        Returns a binary data which is the result of encoding the given term +according to the Erlang external term format.

        -

        Allowed in guard tests.

        +

        This can be used for a variety of purposes, for example, writing a term +to a file in an efficient way, or sending an Erlang term to some type +of communications channel not supported by distributed :

        +
        + Source +
        +

        + term_to_binary(term, opts) +

        +

        The same as term_to_binary/1 but also supports two options:

        + + +
        + Source +
        +

        + throw(term) +

        +

        A non-local return from a function. Check try/2 for more information.

        +
        + Source +
        +

        + tl(list) +

        +

        Returns the tail of a list. Raises ArgumentError if the list is empty.

        +
        + Source +
        +

        + trunc(number) +

        +

        Returns an integer by the truncating the given number. +Allowed in guard clauses.

        Examples

        -
        byte_size(<<433|16,3|3>>) #=> 3
        -byte_size(<<1,2,3>>) #=> 3
        +
        trunc(5.5) #=> 5
         
        - Source + Source
        -

        - case(condition, blocks) +

        + tuple_size(tuple) +

        +

        Returns the size of a tuple.

        +
        + Source +
        +

        + tuple_to_list(tuple) +

        +

        Converts a tuple to a list.

        +
        + Source +
        +
        + + + +
        +

        Macros

        +
        +

        + !(arg) +

        +

        It receives any argument and returns true if it is false +or nil. Returns false otherwise. Not allowed in guard +clauses.

        + +

        Examples

        + +
        !1        #=> false
        +![1,2,3]  #=> false
        +!false    #=> true
        +!nil      #=> true
        +
        +
        + Source +
        +

        + !=(left, right) +

        +

        Returns true if the two items are not equal.

        + +

        This operator considers 1 and 1.0 to be equal. For strict +comparison, use !== instead.

        + +

        As Erlang, Elixir can compare any term. Allowed in guard clauses.

        + +

        Examples

        + +
        1 != 2
        +#=> true
        +1 != 1.0
        +#=> false
        +
        +
        + Source +
        +

        + !==(left, right) +

        +

        Returns true if the two items are strictly not equal. +As Erlang, Elixir can compare any term. Allowed in guard clauses.

        + +

        Examples

        + +
        1 !== 2
        +#=> true
        +
        +1 !== 1.0
        +#=> true
        +
        +
        + Source +
        +

        + &&(left, right) +

        +

        Provides a short-circuit operator that executes the second +expression only if the first one evalutes to true (i.e. it is +not nil nor false). Returns the first expression otherwise.

        + +

        Examples

        + +
        true && true         #=> true
        +nil && true          #=> nil
        +true && 1            #=> 1
        +false && error(:bad) #=> false
        +
        + +

        Notice that, differently from Erlang and operator, +this operator accepts any expression as arguments, +not only booleans, however it is not allowed in guards.

        +
        + Source +
        +

        + *(left, right) +

        +

        Arithmetic multiplication. Allowed in guard clauses.

        + +

        Examples

        + +
        1 * 2 #=> 2
        +
        +
        + Source +
        +

        + +(left, right) +

        +

        Arithmetic plus. Allowed in guard clauses.

        + +

        Examples

        + +
        1 + 2 #=> 3
        +
        +
        + Source +
        +

        + ++(left, right) +

        +

        Concatenates two lists. Allowed in guard clauses.

        + +

        Examples

        + +
        [1] ++ [2,3]
        +#=> [1,2,3]
        +
        +'foo' ++ 'bar'
        +#=> 'foobar'
        +
        +
        + Source +
        +

        + -(left, right) +

        +

        Arithmetic minus. Allowed in guard clauses.

        + +

        Examples

        + +
        1 - 2 #=> -1
        +
        +
        + Source +
        +

        + --(left, right) +

        +

        Removes the first occorrence of an item on the left +for each item on the right. Allowed in guard clauses.

        + +

        Examples

        + +
        [1,2,3] -- [1,2]
        +#=> [3]
        +
        +[1,2,3,2,1] -- [1,2,2]
        +#=> [3,1]
        +
        +
        + Source +
        +

        + ..(first, last) +

        +

        Returns a range with the specified start and end. +Includes both ends.

        + +

        Examples

        + +
        0 in 1..3 #=> false
        +1 in 1..3 #=> true
        +2 in 1..3 #=> true
        +3 in 1..3 #=> true
        +
        +
        + Source +
        +

        + /(left, right) +

        +

        Arithmetic division. Differently from other languages, +the result is always a float. Use div and rem if you want +a natural division or the remainder. Allowed in guard clauses.

        + +

        Examples

        + +
        1 / 2 #=> 0.5
        +2 / 1 #=> 2.0
        +
        +
        + Source +
        +

        + />(left, right) +

        +

        /> is called the pipeline operator as it is useful +to write pipeline style expressions. This operator +tntroduces the expression on the left as the first +argument to the expression on the right.

        + +

        Examples

        + +
        [1,[2],3] /> List.flatten /> Enum.map(&1 * 2)
        +#=> [2,4,6]
        +
        + +

        The expression above is simply translated to:

        + +
        Enum.map(List.flatten([1,[2],3]), &1 * 2)
        +
        +
        + Source +
        +

        + <(left, right) +

        +

        Return true if left is less than right. +As Erlang, Elixir can compare any term. Allowed in guard clauses.

        + +

        Examples

        + +
        1 < 2
        +#=> true
        +
        +
        + Source +
        +

        + <-(pid, msg) +

        +

        Sends a message to the process identified on the left. +A process can be identified bu its PID or, if it is registered, +by an atom.

        + +

        Examples

        + +
        process = Process.self
        +process <- { :ok, "Sending myself a message" }
        +
        +
        + Source +
        +

        + <=(left, right) +

        +

        Return true if left is less than or equal to right. +As Erlang, Elixir can compare any term. Allowed in guard clauses.

        + +

        Examples

        + +
        1 <= 2
        +#=> true
        +
        +
        + Source +
        +

        + <>(left, right)

        -

        Matches the given condition against the match clauses.

        +

        Concatenates two binaries.

        Examples

        -
        case thing do
        -  { :selector, i, value } when is_integer(i) ->
        -    value
        -  value -> value
        -end
        +
        "foo" <> "bar" #=> "foobar"
         
        -

        In the example above, we compare thing with each given -match clause and execute the first one that matches. If no -clause matches, an error is raised.

        - -

        Since Elixir variables can be assigned more than once, variables -in a match clause will always be assigned instead of matching with -its previous values. For example:

        +

        The <> operator can also be used in guard clauses as +long as the first part is a literal binary:

        -
        i = 1
        -case 10 do
        -  i -> i * 2
        -end
        +
        "foo" <> x = "foobar"
        +x #=> "bar"
         
        +
        + Source +
        +

        + ==(left, right) +

        +

        Returns true if the two items are equal.

        -

        The example above will return 20, because i is assgined to 10 -and then multiplied by 2. If you desire to match the value of i -against the given condition, you need to use the ^ operator:

        +

        This operator considers 1 and 1.0 to be equal. For strict +comparison, use === instead.

        -
        i = 1
        -case 10 do
        -  ^i -> i * 2
        -end
        -
        +

        As Erlang, Elixir can compare any term. Allowed in guard clauses.

        -

        The example above will actually fail because 10 does not match 1.

        +

        Examples

        -

        Finally, case accepts an else: branch as a fallback if none -of the clauses match:

        +
        1 == 2
        +#=> false
         
        -
        case thing do
        -  { :selector, i, value } when is_integer(i) ->
        -    value
        -  _ ->
        -    thing
        -end
        +1 == 1.0
        +#=> true
         
        - Source + Source
        -

        - cond(list1) +

        + ===(left, right)

        -

        Execute the first clause where the condition returns true, -raises an error otherwise.

        +

        Returns true if the two items are strictly equal. +As Erlang, Elixir can compare any term. Allowed in guard clauses.

        Examples

        -
        cond do
        -  1 + 1 == 2 ->
        -    "This will never match"
        -  2 * 2 != 4 ->
        -    "Nor this"
        -  true ->
        -    "This will"
        -end
        +
        1 === 2
        +#=> false
        +
        +1 === 1.0
        +#=> false
         
        - Source + Source
        -

        - def(name, list2) +

        + =~(left, right)

        -

        Defines a function with the given name and contents.

        +

        Matches the term on the left against the regular expression +on the right. It returns nil if not match happened or the +first match otherwise.

        Examples

        -
        defmodule Foo do
        -  def bar, do: :baz
        -end
        -
        -Foo.bar #=> :baz
        +
        "abcd" =~ %r/c(d)/  #=> 2
        +"abcd" =~ %r/e/     #=> nil
         
        +
        + Source +
        +

        + >(left, right) +

        +

        Return true if left is more than right. +As Erlang, Elixir can compare any term. Allowed in guard clauses.

        -

        A function that expects arguments can be defined as follow:

        +

        Examples

        -
        defmodule Foo do
        -  def sum(a, b) do
        -    a + b
        -  end
        -end
        +
        1 > 2
        +#=> false
         
        +
        + Source +
        +

        + >=(left, right) +

        +

        Return true if left is more than or equal to right. +As Erlang, Elixir can compare any term. Allowed in guard clauses.

        -

        In the example above, we defined a function sum that receives -two arguments and sum them.

        - -

        Dynamic generation with atoms

        +

        Examples

        -

        Elixir follows the same rule as Erlang when it comes to -function invocations. Calling a function is the same thing -as "invoking at atom". That said, we could invoke a function -named sum in these two equivalent ways:

        +
        1 >= 2
        +#=> false
        +
        +
        + Source +
        +

        + @(expr) +

        +

        This macro is a shortcut to read and add attributes to the module +being compiled. Elixir module attributes are similar to Erlang's with +some differences. The canonical example for attributes is annotating +that a module implements the OTP behavior called gen_server:

        -
        sum(1, 2)
        -:sum.(1, 2)
        +
        defmodule MyServer do
        +  @behavior :gen_server
        +  # ... callbacks ...
        +end
         
        -

        We can also use the atom format to define functions:

        +

        Elixir supports by default all Erlang module attributes but any developer +can also add custom attributes:

        -
        defmodule Foo do
        -  def :sum.(a, b) do
        -    a + b
        -  end
        +
        defmodule MyServer do
        +  @my_data 13
        +  IO.inspect @my_data #=> 13
         end
         
        -

        In general, a developer never needs to use the format above -except when he wants to dynamically define functions with macros. -In such scenarios, the name needs to be given dynamically via -the unquoting mechanism.

        +

        Differently from Erlang, such attributes are not stored in the module by +default since it is common in Elixir to use such attributes to store +temporary data. A developer can configure an attribute to behave closer +to Erlang by calling Module.register_attribute/2.

        -

        Imagine a macro that receives keywords and defines a function -for each entry in the keyword, using the key as function name -and the value as the value returned by the function:

        +

        Finally notice that attributes can also be read inside functions:

        -
        defmacro defkv(keywords) do
        -  Enum.map keywords, fn {k,v} ->
        -    quote do
        -      def unquote(k).() do
        -        unquote(v)
        -      end
        -    end
        -  end
        +
        defmodule MyServer do
        +  @my_data 11
        +  def first_data, do: @my_data
        +  @my_data 13
        +  def second_data, do: @my_data
         end
        -
        -

        This macro could be invoked as:

        - -
        defkv one: 1, two: 2
        +MyServer.first_data #=> 11
        +MyServer.second_data #=> 13
         
        -

        Notice in the example above, we define the function as def unquote(k).() -because each entry k is a an atom and invoking def unquote(k)() -would be invalid Elixir syntax.

        +

        It is important to note that reading an attribute takes a snapshot of +its current value. In other words, the value is read at compilation +time and not at runtime. Check the module Module for other functions +to manipulate module attributes.

        - Source + Source
        -

        - def(name, args, guards, list4) +

        + __B__(string, list2)

        -

        This macro allows a function to be defined more explicitly -by accepting the name, args and guards as different entries.

        - -

        Differently from def/2, the macro arguments are evaluated -and therefore requires quoting.

        - -

        The name must be an atom, the arguments a list where each -element represents another argument and guards a list of -clauses, where each clause is disjunct.

        +

        Handles the sigil %B. It simples returns a binary +without escaping characters and without interpolations.

        Examples

        -

        The most common mistake when using this macro is to pass the -arguments without quoting:

        - -
        def :some_function, [first_arg, second_arg], is_list(first_arg) do
        -  # ...
        -end
        -
        - -

        However, the example above will fail because it will attempt to -evaluate [first_arg, second_arg] and fail because the variable -first_arg is not defined. Therefore, we need to use quote:

        - -
        name   = :some_function
        -args   = quote(do: [first_arg, second_arg])
        -guards = quote(do: is_list(first_arg))
        -
        -def name, args, guards do
        -  # ...
        -end
        +
        %B(foo)      #=> "foo"
        +%B(f#{o}o)  #=> "f\#{o}o"
         
        - Source + Source
        -

        - defdelegate(funs, opts) +

        + __C__(arg1, list2)

        -

        Defines the given functions in the current module that will -delegate to the given target. Functions defined with -defdelegate are public and are allowed to be invoked -from external. If you find yourself wishing to define a -delegation as private, you should likely use import -instead.

        - -

        Delegation only works with functions, delegating to macros -is not supported.

        - -

        Options

        - -
          -
        • :to - The expression to delegate to. Any expression -is allowed and its results will be calculated on runtime;

        • -
        • :as - The function to call on the target given in :to. -This parameter is optional and defaults to the name being -delegated.

        • -
        • :append_first - If true, when delegated, first argument -passed to the delegate will be relocated to the end of the -arguments when dispatched to the target. The motivation behind -this is a disparity between conventions used in Elixir and Erlang. -Elixir's convention is to pass the "handle" as a first argument, -while in Erlang the convention is to pass it as the last argument

        • -
        +

        Handles the sigil %C. It simply returns a char list +without escaping characters and without interpolations.

        Examples

        -
        defmodule MyList do
        -  defdelegate reverse(list), to: :lists
        -  defdelegate [reverse(list), map(callback, list)], to: :lists
        -  defdelegate other_reverse(list), to: :lists, as: :reverse
        -end
        +
        %C(foo)      #=> 'foo'
        +%C(f#{o}o)  #=> 'f\#{o}o'
        +
        +
        + Source +
        +

        + __R__(arg1, options) +

        +

        Handles the sigil %R. It returns a Regex pattern without escaping +nor interpreting interpolations.

        -MyList.reverse([1,2,3]) -#=> [3,2,1] +

        Examples

        -MyList.other_reverse([1,2,3]) -#=> [3,2,1] +
        Regex.match? %R(f#{1,3}o), "f#o"  #=> true
         
        - Source + Source
        -

        - defexception(name, values, opts // [], do_block // []) +

        + __b__(arg1, list2)

        -

        Defines an exception.

        +

        Handles the sigil %b. It returns a binary as if it was double quoted +string, unescaping characters and replacing interpolations.

        -

        Exceptions are simply records and therefore defexception/4 has -the same API and similar behavior to defrecord/4 with two notable -differences:

        +

        Examples

        -

        1) Differently from records, exceptions are documented by default; -2) Exceptions must implement message/1 as API and return a - binary as result;

        +
        %b(foo)       #=> "foo"
        +%b(f#{:o}o)  #=> "foo"
        +
        - Source + Source
        -

        - defimpl(name, opts, do_block // []) +

        + __c__(arg1, list2)

        -

        Defines an implementation for the given protocol. See -defprotocol/2 for examples.

        +

        Handles the sigil %c. It returns a char list as if it was a single +quoted string, unescaping characters and replacing interpolations.

        + +

        Examples

        + +
        %c(foo)       #=> 'foo'
        +%c(f#{:o}o)  #=> 'foo'
        +
        - Source + Source
        -

        - defmodule(name, list2) +

        + __r__(arg1, options)

        -

        Defines a module given by name with the given contents.

        +

        Handles the sigil %r. It returns a Regex pattern.

        Examples

        -
        defmodule Foo do
        -  def bar, do: :baz
        -end
        +
        Regex.match? %r(foo), "foo"  #=> true
        +
        +
        + Source +
        +

        + access(element, args) +

        +

        Access the given element using the qualifier according +to the Access protocol. All calls in the form foo[bar] +are translated to access(foo, bar).

        -Foo.bar #=> :baz +

        The usage of this protocol is to access a raw value in a +keyword list.

        + +
        sample = [a: 1, b: 2, c: 3]
        +sample[:b] #=> 2
         
        -

        Nesting

        +

        Atoms

        -

        Nesting a module inside the other affects its name:

        +

        Whenever invoked on an atom, the access protocol is expanded +at compilation time rather than on runtime. This feature is used +by records to allow a developer to match against an specific part +of a record:

        -
        defmodule Foo do
        -  defmodule Bar do
        -  end
        +
        def increment(State[counter: counter, other: 13] = state) do
        +  state.counter(counter + 1)
         end
         
        -

        In the example above, two modules Foo and Foo.Bar. The -second can be accessed as Bar inside Foo in the same -lexical scope. If the module Bar is moved away to another -file, it needs to be referenced via the full name or an -alias need to be set with the help of Kernel.SpecialForms.alias/2.

        +

        In the example above, we use the Access protocol to match the +counter field in the record State. Considering the record +definition is as follows:

        -

        Dynamic names

        +
        defrecord State, counter: 0, other: nil
        +
        -

        Elixir module names can be dynamically generated. This is very -useful for macros. For instance, one could write:

        +

        The clause above is translated to:

        -
        defmodule binary_to_atom("Foo#{1}", :utf8) do
        -  # contents ...
        +
        def increment({ State, counter, 13 } = state) do
        +  state.counter(counter + 1)
         end
         
        -

        Elixir will accept any module name as long as the expression -returns an atom.

        -
        - Source -
        -

        - defoverridable(tuples) -

        -

        Makes the given functions in the current module overridable. -An overridable function is lazily defined, allowing a -developer to customize it.

        -
        - Source -
        -

        - defp(name, list2) -

        -

        Defines a function that is private. Private functions -can only be accessible from the same module it is defined.

        +

        The same pattern can be used to create a new record:

        -

        Check def/2 for more information

        +
        def new_state(counter) do
        +  State[counter: counter]
        +end
        +
        -

        Examples

        +

        The example above is slightly faster than State.new(counter: :counter) +because the record is expanded at compilation time and not at runtime. +If a field is not specified on creation, it will have its default value.

        -
        defmodule Foo do
        -  def bar do
        -    sum(1, 2)
        -  end
        +

        Finally, as in Erlang, Elixir also allows the following syntax:

        - defp sum(a, b), do: a + b -end +
        new_uri = State[_: 1]
         
        -

        In the example above, sum is private and accessing it -through Foo.sum will raise an error.

        +

        In this case all fields will be set to 1. Notice that, +as in Erlang, in case an expression is given, it will be +evaluated multiple times:

        + +
        new_uri = State[_: IO.puts "Hello"]
        +
        + +

        In this case, "Hello" will be printed twice (one per each field).

        + +

        Examples

        + +
        a = { :a, :b, :c }
        +a[1] #=> :a
        +access a, 1 #=> :a
        +
        - Source + Source
        -

        - defp(name, args, guards, list4) +

        + and(left, right)

        -

        The same as def/4 but generates a private function.

        +

        Boolean and. Arguments needs to necessarily be booleans. +Allowed in guard clauses.

        + +

        Examples

        + +
        true and false
        +#=> false
        +
        - Source + Source
        -

        - defprotocol(name, list2) +

        + atom_to_binary(some_atom)

        -

        Defines the current module as a protocol and specifies the API -that should be implemented.

        +

        Returns a binary which corresponds to the text representation +of some_atom in UTF8 encoding.

        Examples

        -

        In Elixir, only false and nil are considered falsy values. -Everything else evaluates to true in if clauses. Depending -on the application, it may be important to specify a blank? -protocol that returns a boolean for other data types that should -be considered blank?. For instance, an empty list or an empty -binary could be considered blanks.

        - -

        We could implement this protocol as follow:

        - -
        defprotocol Blank do
        -  @doc "Returns true if data is considered blank/empty"
        -  def blank?(data)
        -end
        +
        atom_to_binary :my_atom #=> "my_atom"
         
        +
        + Source +
        +

        + binary_to_atom(some_binary) +

        +

        Returns the atom whose text representation is +some_binary in UTF8 encoding.

        -

        Now that the protocol is defined, we can implement it. We need -to implement the protocol for each Elixir type. For example:

        +

        Examples

        -
        # Numbers are never blank
        -defimpl Blank, for: Number do
        -  def blank?(number), do: false
        -end
        +
        binary_to_atom "my_atom" #=> :my_atom
        +
        +
        + Source +
        +

        + binary_to_existing_atom(some_binary) +

        +

        Works like binary_to_atom but the atom must exist.

        -# Just empty list is blank -defimpl Blank, for: List do - def blank?([]), do: true - def blank?(_), do: false -end +

        Examples

        -# Just the atoms false and nil are blank -defimpl Blank, for: Atom do - def blank?(false), do: true - def blank?(nil), do: true - def blank?(_), do: false -end +
        :my_atom                          #=> :my_atom
        +binary_to_existing_atom "my_atom" #=> :my_atom
         
        +
        + Source +
        +

        + binary_to_float(some_binary) +

        +

        Returns a float whose text representation is some_binary.

        -

        And we would have to define the implementation for all types. -The types available are:

        +

        Examples

        -
          -
        • Record
        • -
        • Tuple
        • -
        • Atom
        • -
        • List
        • -
        • BitString
        • -
        • Number
        • -
        • Function
        • -
        • PID
        • -
        • Port
        • -
        • Reference
        • -
        • Any
        • -
        +
        binary_to_float "2.2017764e+0" #=> 2.2017764
        +
        +
        + Source +
        +

        + binary_to_integer(some_binary) +

        +

        Returns a integer whose text representation is some_binary.

        -

        Selecting implementations

        +

        Examples

        -

        Implementing the protocol for all default types can be cumbersome. -Even more, if you consider that Number, Function, PID, Port and -Reference are never going to be blank, it would be easier if we -could simply provide a default implementation.

        +
        binary_to_integer "123" #=> 123
        +
        +
        + Source +
        +

        + binary_to_integer(some_binary, base) +

        +

        Returns an integer whose text representation in base base +is some_binary.

        -

        This can be achieved with Elixir as follows:

        +

        Examples

        -
        defprotocol Blank do
        -  @only [Atom, Tuple, List, BitString, Any]
        -  def blank?(data)
        -end
        +
        binary_to_integer("3FF", 16) #=> 1023
         
        +
        + Source +
        +

        + case(condition, blocks) +

        +

        Matches the given condition against the match clauses.

        -

        If the protocol is invoked with a data type that is not an Atom, -nor Tuple, nor List, nor BitString, Elixir will now dispatch to -Any. That said, the default behavior could be implemented as:

        +

        Examples

        -
        defimpl Blank, for: Any do
        -  def blank?(_), do: false
        +
        case thing do
        +  { :selector, i, value } when is_integer(i) ->
        +    value
        +  value -> value
         end
         
        -

        Now, all data types that we have not specified will be -automatically considered non blank.

        +

        In the example above, we compare thing with each given +match clause and execute the first one that matches. If no +clause matches, an error is raised.

        -

        Protocols + Records

        +

        Since Elixir variables can be assigned more than once, variables +in a match clause will always be assigned instead of matching with +its previous values. For example:

        -

        The real benefit of protocols comes when mixed with records. For instance, -imagine we have a module called RedBlack that provides an API to create -and manipulate Red-Black trees. This module represents such trees via a -record named RedBlack.Tree and we want this tree to be considered blank -in case it has no items. To achieve this, the developer just needs to -implement the protocol for RedBlack.Tree:

        +
        i = 1
        +case 10 do
        +  i -> i * 2
        +end
        +
        -
        defimpl Blank, for: RedBlack.Tree do
        -  def blank?(tree), do: RedBlack.empty?(tree)
        +

        The example above will return 20, because i is assigned to 10 +and then multiplied by 2. If you desire to match the value of i +against the given condition, you need to use the ^ operator:

        + +
        i = 1
        +case 10 do
        +  ^i -> i * 2
         end
         
        -

        In the example above, we have implemented blank? for RedBlack.Tree -that simply delegates to RedBlack.empty? passing the tree as argument. -This implementation doesn't need to be defined inside the RedBlack -tree or inside the record, but anywhere in the code.

        +

        The example above will actually fail because 10 does not match 1.

        -

        Finally, since records are simply tuples, one can add a default protocol -implementation to any record by defining a default implementation for tuples.

        +

        Finally, case accepts an else: branch as a fallback if none +of the clauses match:

        + +
        case thing do
        +  { :selector, i, value } when is_integer(i) ->
        +    value
        +  _ ->
        +    thing
        +end
        +
        - Source + Source
        -

        - defrecord(name, values, opts // [], do_block // []) +

        + cond(list1)

        -

        Define a record given by name and values.

        +

        Execute the first clause where the condition returns true, +raises an error otherwise.

        Examples

        -
        defrecord FileInfo, atime: nil, mtime: nil
        +
        cond do
        +  1 + 1 == 2 ->
        +    "This will never match"
        +  2 * 2 != 4 ->
        +    "Nor this"
        +  true ->
        +    "This will"
        +end
         
        +
        + Source +
        +

        + def(name, list2) +

        +

        Defines a function with the given name and contents.

        -

        The line above will define a module named FileInfo which -contains a function named new that returns a new record -and other functions to read and set the values in the -record. Therefore, we can do:

        +

        Examples

        -
        file_info = FileInfo.new(atime: now())
        -file_info.atime         #=> Returns the value of atime
        -file_info.atime(now())  #=> Updates the value of atime
        +
        defmodule Foo do
        +  def bar, do: :baz
        +end
        +
        +Foo.bar #=> :baz
         
        -

        Internally, a record is simply a tuple where the first element is -the record module name. This can be noticed if we print the record:

        +

        A function that expects arguments can be defined as follow:

        -
        IO.inspect FileInfo.new
        -{ FileInfo, nil, nil }
        +
        defmodule Foo do
        +  def sum(a, b) do
        +    a + b
        +  end
        +end
         
        -

        Default based functions

        - -

        Depending on the default value, Elixir will define helpers to interact -with the record. For example, ExUnit defines a record which keeps -track of how many tests were executed and the failures that happened -The record definition is similar to:

        +

        In the example above, we defined a function sum that receives +two arguments and sum them.

        -
        defrecord Config, counter: 0, failures: []
        -
        +

        Dynamic generation with atoms

        -

        Since counter is an integer, Elixir automatically defines a helper -named increment_counter that will increase the counter value:

        +

        Elixir follows the same rule as Erlang when it comes to +function invocations. Calling a function is the same thing +as "invoking at atom". That said, we could invoke a function +named sum in these two equivalent ways:

        -
        Config.new.increment_counter.counter #=> 1
        +
        sum(1, 2)
        +:sum.(1, 2)
         
        -

        increment_counter also accepts a number of increment as argument:

        +

        We can also use the atom format to define functions:

        -
        Config.new.increment_counter(10).counter #=> 10
        +
        defmodule Foo do
        +  def :sum.(a, b) do
        +    a + b
        +  end
        +end
         
        -

        Besides, if the default is a list, Elixir will define three helpers:

        +

        In general, a developer never needs to use the format above +except when he wants to dynamically define functions with macros. +In such scenarios, the name needs to be given dynamically via +the unquoting mechanism.

        -
          -
        • merge_field - Receives keywords and merge it into the current value;
        • -
        • prepend_field - Receives another list and prepend its values
        • -
        +

        Imagine a macro that receives keywords and defines a function +for each entry in the keyword, using the key as function name +and the value as the value returned by the function:

        -

        Documentation

        +
        defmacro defkv(keywords) do
        +  Enum.map keywords, fn {k,v} ->
        +    quote do
        +      def unquote(k).() do
        +        unquote(v)
        +      end
        +    end
        +  end
        +end
        +
        -

        By default records are not documented and have @moduledoc set to false. -This can be changed by passing a moduledoc option after values:

        +

        This macro could be invoked as:

        -
        defrecord Config, [counter: 0, failures: []], moduledoc: "A simple record"
        +
        defkv one: 1, two: 2
         
        + +

        Notice in the example above, we define the function as def unquote(k).() +because each entry k is a an atom and invoking def unquote(k)() +would be invalid Elixir syntax.

        - Source + Source
        -

        - destructure(left, right) +

        + def(name, args, guards, list4)

        -

        Allows you to destructure two lists, assigning each -term in the right to the left. Differently from pattern -matching via =, if the sizes of the left and right -lists don't match,, structuring simply stops instead -of raising an error.

        +

        This macro allows a function to be defined more explicitly +by accepting the name, args and guards as different entries.

        -

        Examples

        +

        Differently from def/2, the macro arguments are evaluated +and therefore requires quoting.

        -
        destructure [x,y,z], [1,2,3,4,5]
        -x #=> 1
        -y #=> 2
        -z #=> 3
        -
        +

        The name must be an atom, the arguments a list where each +element represents another argument and guards a list of +clauses, where each clause is disjunct.

        -

        Notice in the example above, even though the right -size has more entries than the left, structuring works -fine. If the right size is smaller, the remaining items -are simply assigned to nil:

        +

        Examples

        -
        destructure [x,y,z], [1]
        -x #=> 1
        -y #=> nil
        -z #=> nil
        +

        The most common mistake when using this macro is to pass the +arguments without quoting:

        + +
        def :some_function, [first_arg, second_arg], is_list(first_arg) do
        +  # ...
        +end
         
        -

        The left side supports any expression you would use -on the left side of a match:

        +

        However, the example above will fail because it will attempt to +evaluate [first_arg, second_arg] and fail because the variable +first_arg is not defined. Therefore, we need to use quote:

        -
        x = 1
        -destructure [^x,y,z], [1,2,3]
        -
        +
        name   = :some_function
        +args   = quote(do: [first_arg, second_arg])
        +guards = quote(do: is_list(first_arg))
        +exprs  = quote(do: ...)
         
        -

        The example above will only work if x matches -the first value from the right side. Otherwise, -it will raise a CaseClauseError.

        +def name, args, guards, do: exprs +
        - Source + Source
        -

        - div(left, right) +

        + defdelegate(funs, opts)

        -

        Provides an integer division macro according to Erlang semantics. -Raises an error if one of the arguments is not an integer. -Can be used in guard tests.

        +

        Defines the given functions in the current module that will +delegate to the given target. Functions defined with +defdelegate are public and are allowed to be invoked +from external. If you find yourself wishing to define a +delegation as private, you should likely use import +instead.

        + +

        Delegation only works with functions, delegating to macros +is not supported.

        + +

        Options

        + +
          +
        • :to - The expression to delegate to. Any expression +is allowed and its results will be calculated on runtime;

        • +
        • :as - The function to call on the target given in :to. +This parameter is optional and defaults to the name being +delegated.

        • +
        • :append_first - If true, when delegated, first argument +passed to the delegate will be relocated to the end of the +arguments when dispatched to the target. The motivation behind +this is a disparity between conventions used in Elixir and : +Elixir's convention is to pass the "handle" as a first argument, +while in Erlang the convention is to pass it as the last argument

        • +
        + +

        Examples

        + +
        defmodule MyList do
        +  defdelegate reverse(list), to: :lists
        +  defdelegate [reverse(list), map(callback, list)], to: :lists
        +  defdelegate other_reverse(list), to: :lists, as: :reverse
        +end
         
        -

        Examples

        +My:lists.reverse([1,2,3]) +#=> [3,2,1] -
        div 5, 2 #=> 2
        +MyList.other_reverse([1,2,3])
        +#=> [3,2,1]
         
        - Source -
        -

        - elem(tuple, index) -

        -

        Define elem to get Tuple element according to Elixir conventions. -We need to implement it as a macro to it can be used in guards.

        - -

        Example

        - -

        tuple = { :foo, :bar, 3 } - elem(tuple, 1) #=> :foo

        -
        - Source + Source
        -

        - exit(reason) +

        + defexception(name, values, opts // [], do_block // [])

        -

        Stops the execution of the calling process with the given reason. -Since evaluating this function causes the process to terminate, -it has no return value.

        +

        Defines an exception.

        -

        Examples

        +

        Exceptions are simply records and therefore defexception/4 has +the same API and similar behavior to defrecord/4 with two notable +differences:

        -
        exit(:normal)
        -exit(:seems_bad)
        -
        +

        1) Differently from records, exceptions are documented by default; +2) Exceptions must implement message/1 as API and return a + binary as result;

        - Source + Source
        -

        - float(number) +

        + defimpl(name, opts, do_block // [])

        -

        Converts the given number to a float. Allowed in guard clauses.

        +

        Defines an implementation for the given protocol. See +defprotocol/2 for examples.

        - Source + Source
        -

        - float_to_list(number) +

        + defmodule(name, list2)

        -

        Returns a char list which corresponds to the text representation of the given float.

        - -

        Examples

        +

        Defines a module given by name with the given contents.

        -
        float_to_list(7.0)
        -#=> '7.00000000000000000000e+00'
        -
        -
        - Source -
        -

        - function(args) -

        -

        Returns an anonymous function based on the given arguments.

        +

        It returns the module name, the module binary and the +block contents result.

        Examples

        -
        sum = function do
        -  (x, y) -> x + y
        -end
        -
        -sum.(1, 2) #=> 3
        -
        - -

        Notice that a function needs to be invoked using the dot between -the function and the arguments.

        - -

        Multiple clauses can be specified as in case, receive and -similar macros:

        - -
        sum = function do
        -  x, y when y > 0 -> x + y
        -  x, y -> x - y
        +
        defmodule Foo do
        +  def bar, do: :baz
         end
         
        -sum.(1, 2) #=> 3
        +Foo.bar #=> :baz
         
        -

        Shortcut syntax

        - -

        In order to reduce verbosity, functions in Elixir can be written -using a shortcut syntax via fn:

        - -
        Enum.map [1,2,3], fn x ->
        -  x * 2
        -end
        -
        +

        Nesting

        -

        Not only the example is shorter, it solves ambiguity issues. Since -do/end always matches the furthest call, if we used the function -macro as below:

        +

        Nesting a module inside the other affects its name:

        -
        Enum.map [1,2,3], function(x) do
        -  x * 2
        +
        defmodule Foo do
        +  defmodule Bar do
        +  end
         end
         
        -

        It would be parsed as:

        +

        In the example above, two modules Foo and Foo.Bar. The +second can be accessed as Bar inside Foo in the same +lexical scope. If the module Bar is moved away to another +file, it needs to be referenced via the full name or an +alias need to be set with the help of Kernel.SpecialForms.alias/2.

        -
        Enum.map([1,2,3], function(x)) do
        -  x * 2
        -end
        -
        +

        Dynamic names

        -

        The stab shortcut syntax has the proper precedence:

        +

        Elixir module names can be dynamically generated. This is very +useful for macros. For instance, one could write:

        -
        Enum.map [1,2,3], fn x ->
        -  x * 2
        +
        defmodule binary_to_atom("Foo#{1}", :utf8) do
        +  # contents ...
         end
         
        -

        Which is handled as:

        - -
        Enum.map([1,2,3], fn x ->
        -  x * 2
        -end)
        -
        - -

        Function retrieval

        - -

        The function macro can also be used to retrieve local or remote -functions:

        - -
        f = function(:is_atom, 2)
        -f.(:foo) #=> true
        -
        -f = function(List, :flatten, 1)
        -f.([1,[2],3]) #=> [1,2,3]
        -
        +

        Elixir will accept any module name as long as the expression +returns an atom.

        - Source + Source
        -

        - function_exported?(module, function, arity) +

        + defoverridable(tuples)

        -

        Returns true if the module is loaded and contains a -public function with the given arity, otherwise false.

        - -

        Notice that this function does not load the module in case -it is not loaded. Check Code.ensure_loaded/1 for more -information.

        +

        Makes the given functions in the current module overridable. +An overridable function is lazily defined, allowing a +developer to customize it.

        - Source + Source
        -

        - halt() +

        + defp(name, list2)

        -

        The same as halt(0, []).

        +

        Defines a function that is private. Private functions +can only be accessible from the same module it is defined.

        + +

        Check def/2 for more information

        + +

        Examples

        + +
        defmodule Foo do
        +  def bar do
        +    sum(1, 2)
        +  end
        +
        +  defp sum(a, b), do: a + b
        +end
        +
        + +

        In the example above, sum is private and accessing it +through Foo.sum will raise an error.

        - Source + Source
        -

        - halt(status) +

        + defp(name, args, guards, list4)

        -

        The same as halt(status, []).

        +

        The same as def/4 but generates a private function.

        - Source + Source
        -

        - halt(status, options) +

        + defprotocol(name, list2)

        -

        Halts the Erlang runtime system where the first argument status must be a -non-negative integer, a char list, or the atom :abort.

        +

        Defines the current module as a protocol and specifies the API +that should be implemented.

        -
          -
        • If an integer, the runtime system exits with the integer value which -is returned to the Operating System;

        • -
        • If a char list, an erlang crash dump is produced with status as slogan, -and then the runtime system exits with status code 1;

        • -
        • If :abort, the runtime system aborts producing a core dump, if that is -enabled in the operating system.

        • -
        +

        Examples

        -

        Note that on many platforms, only the status codes 0-255 are supported -by the operating system.

        +

        In Elixir, only false and nil are considered falsy values. +Everything else evaluates to true in if clauses. Depending +on the application, it may be important to specify a blank? +protocol that returns a boolean for other data types that should +be considered blank?. For instance, an empty list or an empty +binary could be considered blanks.

        -

        For integer status, Erlang runtime system closes all ports and allows async -threads to finish their operations before exiting. To exit without such -flushing, pass options [flush: false] instead.

        +

        We could implement this protocol as follow:

        -

        Examples

        +
        defprotocol Blank do
        +  @doc "Returns true if data is considered blank/empty"
        +  def blank?(data)
        +end
        +
        -
        halt(0)
        -halt(1, flush: false)
        -halt(:abort)
        +

        Now that the protocol is defined, we can implement it. We need +to implement the protocol for each Elixir type. For example:

        + +
        # Numbers are never blank
        +defimpl Blank, for: Number do
        +  def blank?(number), do: false
        +end
        +
        +# Just empty list is blank
        +defimpl Blank, for: List do
        +  def blank?([]), do: true
        +  def blank?(_),  do: false
        +end
        +
        +# Just the atoms false and nil are blank
        +defimpl Blank, for: Atom do
        +  def blank?(false), do: true
        +  def blank?(nil),   do: true
        +  def blank?(_),     do: false
        +end
         
        -
        - Source -
        -

        - hd(list) -

        -

        Returns the head of a list, raises badarg if the list is empty.

        -
        - Source -
        -

        - if(condition, list2) -

        -

        Provides an if macro. This macro expects the first argument to -be a condition and the rest are keywords arguments.

        -

        One-liner examples

        +

        And we would have to define the implementation for all types. +The types available are:

        + +
          +
        • Record
        • +
        • Tuple
        • +
        • Atom
        • +
        • List
        • +
        • BitString
        • +
        • Number
        • +
        • Function
        • +
        • PID
        • +
        • Port
        • +
        • Reference
        • +
        • Any
        • +
        -
        if(foo, do: bar)
        -
        +

        Selecting implementations

        -

        In the example above, bar will be returned if foo evalutes to -true (i.e. it is not false nor nil). Otherwise, nil will be returned.

        +

        Implementing the protocol for all default types can be cumbersome. +Even more, if you consider that Number, Function, PID, Port and +Reference are never going to be blank, it would be easier if we +could simply provide a default implementation.

        -

        An else option can be given to specify the opposite:

        +

        This can be achieved with Elixir as follows:

        -
        if(foo, do: bar, else: bar)
        +
        defprotocol Blank do
        +  @only [Atom, Tuple, List, BitString, Any]
        +  def blank?(data)
        +end
         
        -

        Blocks examples

        - -

        Elixir also allows you to pass a block to the if macro. The first -example above would be translated to:

        +

        If the protocol is invoked with a data type that is not an Atom, +nor Tuple, nor List, nor BitString, Elixir will now dispatch to +Any. That said, the default behavior could be implemented as:

        -
        if foo do
        -  bar
        +
        defimpl Blank, for: Any do
        +  def blank?(_), do: false
         end
         
        -

        Notice that do/end becomes delimiters. The second example would -then translate do:

        +

        Now, all data types that we have not specified will be +automatically considered non blank.

        -
        if foo do
        -  bar
        -else
        -  baz
        +

        Protocols + Records

        + +

        The real benefit of protocols comes when mixed with records. For instance, +imagine we have a module called RedBlack that provides an API to create +and manipulate Red-Black trees. This module represents such trees via a +record named RedBlack.Tree and we want this tree to be considered blank +in case it has no items. To achieve this, the developer just needs to +implement the protocol for RedBlack.Tree:

        + +
        defimpl Blank, for: RedBlack.Tree do
        +  def blank?(tree), do: RedBlack.empty?(tree)
         end
         
        -

        If you want to compare more than two clauses, you can use the cond/1 -macro.

        +

        In the example above, we have implemented blank? for RedBlack.Tree +that simply delegates to RedBlack.empty? passing the tree as argument. +This implementation doesn't need to be defined inside the RedBlack +tree or inside the record, but anywhere in the code.

        + +

        Finally, since records are simply tuples, one can add a default protocol +implementation to any record by defining a default implementation for tuples.

        - Source + Source
        -

        - in(left, right) +

        + defrecord(name, values, opts // [], do_block // [])

        -

        Returns true if the element on the left is equal (==) to -any of the items in the right. For now, it only accepts -a list as the right argument.

        +

        Define a record given by name and values.

        Examples

        -
        x = 1
        -x in [1,2,3] #=> true
        -
        - -

        This macro simply translates the expression above to:

        - -
        x == 1 or x == 2 or x == 3
        +
        defrecord FileInfo, atime: nil, mtime: nil
         
        -

        Clauses

        - -

        Whenever used inside a function or a case clause, you can -optionally omit the variable declaration, for example:

        +

        The line above will define a module named FileInfo which +contains a function named new that returns a new record +and other functions to read and set the values in the +record. Therefore, we can do:

        -
        case 3 do
        -  x when x in [1,2] -> x * 2
        -  _ -> 0
        -end
        +
        file_info = FileInfo.new(atime: now())
        +file_info.atime         #=> Returns the value of atime
        +file_info.atime(now())  #=> Updates the value of atime
         
        -

        Could be rewritten as:

        +

        Internally, a record is simply a tuple where the first element is +the record module name. This can be noticed if we print the record:

        -
        case 3 do
        -  x in [1,2] -> x * 2
        -  _ -> 0
        -end
        +
        IO.inspect FileInfo.new
        +{ FileInfo, nil, nil }
         
        -

        In this case, Elixir will automatically expand it and define -the variable for us.

        -
        - Source -
        -

        - inspect(arg) -

        -

        Inspect the given arguments according to the Binary.Inspect protocol.

        +

        Extensions

        -

        Examples

        +

        Besides defining readers and writers for each attribute. Elixir will +define extensions functions for each attribute. By default, it will +define an update_#{attribute} function to update the value. Such +functions expect a function as argument that receives the current value +and must return the new one:

        -
        inspect(:foo)
        -#=> ":foo"
        +
        file_info.update_atime(fn(_old) -> now() end) #=> Updates the value of atime
         
        -
        - Source -
        -

        - integer_to_list(number) -

        -

        Returns a char list which corresponds to the text representation of the given integer.

        -

        Examples

        +

        Besides, Elixir may define new functions depending on the default value. +For example, ExUnit defines a record which keeps track of how many tests +were executed and the failures that happened. The record definition is +similar to:

        -
        integer_to_list(7)
        -#=> '7'
        +
        defrecord Config, counter: 0, failures: []
         
        -
        - Source -
        -

        - integer_to_list(number, base) -

        -

        Returns a char list which corresponds to the text representation of the -given integer in the given case.

        -

        Examples

        +

        Since counter is an integer, Elixir automatically defines a helper +named increment_counter that will increase the counter value:

        -
        integer_to_list(1023, 16).
        -#=> "3FF"
        +
        Config.new.increment_counter.counter #=> 1
         
        -
        - Source -
        -

        - iolist_size(item) -

        -

        Returns the size of an iolist.

        -

        Examples

        +

        increment_counter also accepts a number of increment as argument:

        -
        iolist_size([1,2|<<3,4>>])
        -#=> 4
        +
        Config.new.increment_counter(10).counter #=> 10
         
        -
        - Source -
        -

        - iolist_to_binary(item) -

        -

        Returns a binary which is made from the integers and binaries in iolist.

        -

        Examples

        - -
        bin1 = <<1,2,3>>
        -bin2 = <<4,5>>
        -bin3 = <<6>>
        -
        -iolist_to_binary([bin1,1,[2,3,bin2],4|bin3])
        -#=> <<1,2,3,1,2,3,4,5,4,6>>
        -
        -
        - Source -
        -

        - is_atom(term) -

        -

        Returns true if term is an atom; otherwise returns false.

        +

        Besides, if the default is a list, Elixir will define two helpers:

        -

        Allowed in guard tests.

        -
        - Source -
        -

        - is_binary(term) -

        -

        Returns true if term is a binary; otherwise returns false.

        +
          +
        • merge_field - Receives keywords and merge it into the current value;
        • +
        • prepend_field - Receives another list and prepend its values
        • +
        -

        A binary always contains a complete number of bytes.

        +

        You can define your own extensions or disable them using the except +option:

        -

        Allowed in guard tests.

        -
        - Source -
        -

        - is_bitstring(term) -

        -

        Returns true if term is a bitstring (including a binary); otherwise returns false.

        +
        defrecord Config, [counter: 0, failures: []], except: [:extensions]
        +
        -

        Allowed in guard tests.

        -
        - Source -
        -

        - is_boolean(term) -

        -

        Returns true if term is either the atom true or the atom false (i.e. a boolean); -otherwise returns false.

        +

        Documentation

        -

        Allowed in guard tests.

        +

        By default records are not documented and have @moduledoc set to false.

        - Source + Source
        -

        - is_exception(thing) +

        + destructure(left, right)

        -

        Check if the given structure is an exception.

        +

        Allows you to destructure two lists, assigning each +term in the right to the left. Differently from pattern +matching via =, if the sizes of the left and right +lists don't match,, structuring simply stops instead +of raising an error.

        Examples

        -
        is_exception(Error.new) #=> true
        -is_exception(1)         #=> false
        +
        destructure [x,y,z], [1,2,3,4,5]
        +x #=> 1
        +y #=> 2
        +z #=> 3
         
        -
        - Source -
        -

        - is_float(term) -

        -

        Returns true if term is a floating point number; otherwise returns false.

        -

        Allowed in guard tests.

        -
        - Source -
        -

        - is_function(term) -

        -

        Returns true if term is a function; otherwise returns false.

        +

        Notice in the example above, even though the right +size has more entries than the left, structuring works +fine. If the right size is smaller, the remaining items +are simply assigned to nil:

        -

        Allowed in guard tests.

        -
        - Source -
        -

        - is_function(term, arity) -

        -

        Returns true if term is a function that can be applied with arity number of arguments; -otherwise returns false.

        +
        destructure [x,y,z], [1]
        +x #=> 1
        +y #=> nil
        +z #=> nil
        +
        -

        Allowed in guard tests.

        -
        - Source -
        -

        - is_integer(term) -

        -

        Returns true if term is an integer; otherwise returns false.

        +

        The left side supports any expression you would use +on the left side of a match:

        -

        Allowed in guard tests.

        -
        - Source -
        -

        - is_list(term) -

        -

        Returns true if term is a list with zero or more elements; otherwise returns false.

        +
        x = 1
        +destructure [^x,y,z], [1,2,3]
        +
        -

        Allowed in guard tests.

        +

        The example above will only work if x matches +the first value from the right side. Otherwise, +it will raise a CaseClauseError.

        - Source + Source
        -

        - is_number(term) +

        + div(left, right)

        -

        Returns true if term is either an integer or a floating point number; -otherwise returns false.

        +

        Provides an integer division macro according to Erlang semantics. +Raises an error if one of the arguments is not an integer. +Can be used in guard tests.

        -

        Allowed in guard tests.

        +

        Examples

        + +
        div 5, 2 #=> 2
        +
        - Source + Source
        -

        - is_pid(term) +

        + elem(tuple, index)

        -

        Returns true if term is a pid (process identifier); otherwise returns false.

        +

        Define elem to get Tuple element according to Elixir conventions +(i.e. it expects the tuple as first argument, zero-index based).

        -

        Allowed in guard tests.

        +

        It is implemented as a macro so it can be used in guards.

        + +

        Example

        + +
        tuple = { :foo, :bar, 3 }
        +elem(tuple, 1) #=> :bar
        +
        - Source + Source
        -

        - is_port(term) +

        + float_to_binary(some_float)

        -

        Returns true if term is a port identifier; otherwise returns false.

        +

        Returns a binary which corresponds to the text representation +of some_float.

        -

        Allowed in guard tests.

        +

        Examples

        + +
        float_to_binary 7.0 #=> "7.00000000000000000000e+00"
        +
        - Source + Source
        -

        - is_record(thing, kind) +

        + function(args)

        -

        Check if the given structure is a record. It is basically -a convenient macro that checks the structure is a tuple and -the first element matches the given kind.

        +

        Returns an anonymous function based on the given arguments.

        Examples

        -
        defrecord Config, sample: nil
        +
        sum = function do
        +  (x, y) -> x + y
        +end
         
        -is_record(Config.new, Config) #=> true
        -is_record(Config.new, List)   #=> false
        +sum.(1, 2) #=> 3
         
        -
        - Source -
        -

        - is_reference(term) -

        -

        Returns true if term is a reference; otherwise returns false.

        -

        Allowed in guard tests.

        -
        - Source -
        -

        - is_regex(thing) -

        -

        Check if the given argument is a regex.

        -
        - Source -
        -

        - is_tuple(term) -

        -

        Returns true if term is a tuple; otherwise returns false.

        +

        Notice that a function needs to be invoked using the dot between +the function and the arguments.

        -

        Allowed in guard tests.

        -
        - Source -
        -

        - length(list) -

        -

        Returns the length of list.

        +

        Multiple clauses can be specified as in case, receive and +similar macros:

        -

        Allowed in guard tests.

        +
        sum = function do
        +  x, y when y > 0 -> x + y
        +  x, y -> x - y
        +end
         
        -

        Examples

        +sum.(1, 2) #=> 3 +
        -
        length([1,2,3,4,5,6,7,8,9]) #=> 9
        +

        Shortcut syntax

        + +

        In order to reduce verbosity, functions in Elixir can be written +using a shortcut syntax via fn:

        + +
        Enum.map [1,2,3], fn x ->
        +  x * 2
        +end
         
        -
        - Source -
        -

        - list_to_atom(char_list) -

        -

        Returns the atom whose text representation is char_list.

        -

        Examples

        +

        Not only the example is shorter, it solves ambiguity issues. Since +do/end always matches the furthest call, if we used the function +macro as below:

        -
        list_to_atom('elixir') #=> :elixir
        +
        Enum.map [1,2,3], function(x) do
        +  x * 2
        +end
         
        -
        - Source -
        -

        - list_to_binary(char_list) -

        -

        Returns a binary which is made from the content of char_list.

        -

        Examples

        +

        It would be parsed as:

        -
        list_to_binary('Elixir') #=> "Elixir"
        +
        Enum.map([1,2,3], function(x)) do
        +  x * 2
        +end
         
        -
        - Source -
        -

        - list_to_bitstring(bitstring_list) -

        -

        Returns a bitstring which is made from the integers and bitstrings in bitstring_list. -(the last tail in bitstring_list is allowed to be a bitstring.)

        -

        Examples

        +

        The stab shortcut syntax has the proper precedence:

        -
        bin1 = <<1,2,3>>
        -bin2 = <<4,5>>
        -bin3 = <<6,7|4>>
        +
        Enum.map [1,2,3], fn x ->
        +  x * 2
        +end
        +
        -list_to_bitstring([bin1,1,[2,3,bin2],4|bin3]) -#=> <<1,2,3,1,2,3,4,5,4,6,7|4>> +

        Which is handled as:

        + +
        Enum.map([1,2,3], fn x ->
        +  x * 2
        +end)
        +
        + +

        Function retrieval

        + +

        The function macro can also be used to retrieve local or remote +functions:

        + +
        f = function(:is_atom, 2)
        +f.(:foo) #=> true
        +
        +f = function(List, :flatten, 1)
        +f.([1,[2],3]) #=> [1,2,3]
         
        - Source -
        -

        - list_to_existing_atom(char_list) -

        -

        Returns the atom whose text representation is char_list, but only if there already -exists such atom.

        -
        - Source + Source
        -

        - list_to_float(char_list) +

        + if(condition, clauses)

        -

        Returns the float whose text representation is char_list.

        +

        Provides an if macro. This macro expects the first argument to +be a condition and the rest are keyword arguments.

        -

        Examples

        +

        One-liner examples

        -
        list_to_float('2.2017764e+0') #=> 2.2017764
        +
        if(foo, do: bar)
        +
        + +

        In the example above, bar will be returned if foo evalutes to +true (i.e. it is not false nor nil). Otherwise, nil will be returned.

        + +

        An else option can be given to specify the opposite:

        + +
        if(foo, do: bar, else: bar)
        +
        + +

        Blocks examples

        + +

        Elixir also allows you to pass a block to the if macro. The first +example above would be translated to:

        + +
        if foo do
        +  bar
        +end
        +
        + +

        Notice that do/end becomes delimiters. The second example would +then translate do:

        + +
        if foo do
        +  bar
        +else
        +  baz
        +end
         
        + +

        If you want to compare more than two clauses, you can use the cond/1 +macro.

        - Source + Source
        -

        - list_to_integer(char_list) +

        + in(left, right)

        -

        Returns an integer whose text representation is char_list.

        +

        Returns true if the element on the left is equal (==) to +any of the items in the right. For now, it only accepts +a list as the right argument.

        Examples

        -
        list_to_integer('123') #=> 123
        +
        x = 1
        +x in [1,2,3] #=> true
        +
        + +

        This macro simply translates the expression above to:

        + +
        x == 1 or x == 2 or x == 3
        +
        + +

        Clauses

        + +

        Whenever used inside a function or a case clause, you can +optionally omit the variable declaration, for example:

        + +
        case 3 do
        +  x when x in [1,2] -> x * 2
        +  _ -> 0
        +end
        +
        + +

        Could be rewritten as:

        + +
        case 3 do
        +  x in [1,2] -> x * 2
        +  _ -> 0
        +end
         
        + +

        In this case, Elixir will automatically expand it and define +the variable for us.

        - Source + Source
        -

        - list_to_integer(char_list, base) +

        + inspect(arg, opts // [])

        -

        Returns an integer whose text representation in base base is char_list.

        +

        Inspect the given arguments according to the Binary.Inspect protocol.

        + +

        Options

        + +

        The following options are supported:

        + +
          +
        • :raw - tuples are not formatted as the inspect protocol, they are +always shown as tuples, defaults to false;

        • +
        • :limit - the limit of items that are shown in tuples, bitstrings and +lists. Do not apply to strings;

        • +

        Examples

        -
        > list_to_integer('3FF', 16) #=> 1023
        +
        inspect(:foo)
        +#=> ":foo"
         
        - Source + Source
        -

        - list_to_pid(char_list) +

        + integer_to_binary(some_integer)

        -

        Returns a pid whose text representation is char_list.

        - -

        Warning:

        +

        Returns a binary which corresponds to the text representation +of some_integer.

        -

        This function is intended for debugging and for use in the Erlang -operating system.

        +

        Examples

        -

        It should not be used in application programs.

        +
        integer_to_binary 123 #=> "123"
        +
        +
        + Source +
        +

        + integer_to_binary(some_integer, base) +

        +

        Returns a binary which corresponds to the text representation +of some_integer in base base.

        Examples

        -
        list_to_pid('<0.41>') #=> <0.4.1>
        +
        integer_to_binary 77 #=> "77"
         
        - Source + Source
        -

        - list_to_tuple(list) +

        + is_exception(thing)

        -

        Returns a tuple which corresponds to list. list can contain any Erlang terms.

        +

        Check if the given structure is an exception.

        Examples

        -
        list_to_tuple([share, [:elixir, 163]]). #=> {share, [:elixir, 163]}
        +
        is_exception(Error.new) #=> true
        +is_exception(1)         #=> false
         
        - Source + Source
        -

        - make_ref() +

        + is_range(thing)

        -

        Returns an almost unique reference.

        - -

        The returned reference will re-occur after approximately 2^82 calls; -therefore it is unique enough for practical purposes.

        +

        Check if the given argument is a range.

        +
        + Source +
        +

        + is_record(thing, kind) +

        +

        Check if the given structure is a record. It is basically +a convenient macro that checks the structure is a tuple and +the first element matches the given kind.

        Examples

        -
        make_ref()
        -#=> #Ref<0.0.0.135>
        +
        defrecord Config, sample: nil
        +
        +is_record(Config.new, Config) #=> true
        +is_record(Config.new, List)   #=> false
         
        - Source + Source +
        +

        + is_regex(thing) +

        +

        Check if the given argument is a regex.

        +
        + Source

        match?(left, right) @@ -2906,56 +3307,21 @@

        Examples

        Enum.filter list, match?({:a, x } when x < 2, &1)
        - Source -
        -

        - max(first, second) -

        -

        Return the biggest of the two given terms according to -Erlang's term ordering. If the terms compare equal, the -first one is returned.

        - -

        Examples

        - -
        max(1, 2) #=> 2
        -
        -
        - Source + Source
        -

        - min(first, second) +

        + nil?(x)

        -

        Return the smallest of the two given terms according to -Erlang's term ordering. If the terms compare equal, the -first one is returned.

        +

        Checks if the given argument is nil or not. +Allowed in guard clauses.

        Examples

        -
        min(1, 2) #=> 1
        +
        nil? 1    #=> false
        +nil? nil  #=> true
         
        - Source -
        -

        - node() -

        -

        Returns an atom representing the name of the local node. -If the node is not alive, nonode@nohost is returned instead.

        - -

        Allowed in guard tests.

        -
        - Source -
        -

        - node(arg) -

        -

        Returns the node where the given argmuent is located. -The argument can be a pid, a reference, or a port. -If the local node is not alive, nonode@nohost is returned.

        - -

        Allowed in guard tests.

        -
        - Source + Source

        not(arg) @@ -2984,22 +3350,6 @@

        Examples

        Source -
        -

        - pid_to_list(pid) -

        -

        Returns a char list which corresponds to the text representation of pid. -This function is intended for debugging and for use in the Erlang operating -system. It should not be used in application programs.

        - -

        Warning:

        - -

        This function is intended for debugging and for use in the Erlang -operating system.

        - -

        It should not be used in application programs.

        -
        - Source

        receive(args) @@ -3047,7 +3397,7 @@

        Examples

        will occur immediately.

      - Source + Source

      rem(left, right) @@ -3061,162 +3411,23 @@

      Examples

      rem 5, 2 #=> 1
       
      - Source -
      -

      - round(number) -

      -

      Returns an integer by rounding the given number. -Allowed in guard tests.

      - -

      Examples

      - -
      round(5.5) #=> 6
      -
      -
      - Source -
      -

      - self() -

      -

      Returns the pid (process identifier) of the calling process. -Allowed in guard clauses.

      -
      - Source + Source

      setelem(tuple, index, value)

      -

      Define setelem to set Tuple element according to Elixir conventions. -We need to implement it as a macro to it can be used in guards.

      - -

      Example

      - -

      tuple = { :foo, :bar, 3 } - setelem(tuple, 1, :baz) #=> { :baz, :bar, 3 }

      -
      - Source -
      -

      - size(arg) -

      -

      Returns the size of the given argument, which must be a tuple -or a binary. If possible, please use tuplesize or binarysize.

      -
      - Source -
      -

      - spawn(fun) -

      -

      Spawns the given function and returns its pid.

      - -

      Check the modules Process and Node for other functions -to handle processes, including spawning functions in nodes.

      - -

      Examples

      - -
      current = Process.self
      -child   = spawn(fn -> current <- { Process.self, 1 + 2 } end)
      -
      -receive
      -  { ^child, 3 } -> IO.puts "Received 3 back"
      -end
      -
      -
      - Source -
      -

      - spawn(module, fun, args) -

      -

      Spawns the given module and function passing the given args -and returns its pid.

      - -

      Check the modules Process and Node for other functions -to handle processes, including spawning functions in nodes.

      - -

      Examples

      - -
      spawn(SomeModule, :function, [1,2,3])
      -
      -
      - Source -
      -

      - spawn_link(fun) -

      -

      Spawns the given function, links it to the current process and returns its pid.

      - -

      Check the modules Process and Node for other functions -to handle processes, including spawning functions in nodes.

      - -

      Examples

      - -
      current = Process.self
      -child   = spawn_link(fn -> current <- { Process.self, 1 + 2 } end)
      -
      -receive
      -  { ^child, 3 } ->
      -    IO.puts "Received 3 back"
      -end
      -
      -
      - Source -
      -

      - spawn_link(module, fun, args) -

      -

      Spawns the given module and function passing the given args, -links it to the current process and returns its pid.

      +

      Define setelem to set Tuple element according to Elixir conventions +(i.e. it expects the tuple as first argument, zero-index based).

      -

      Check the modules Process and Node for other functions -to handle processes, including spawning functions in nodes.

      +

      It is implemented as a macro so it can be used in guards.

      -

      Examples

      +

      Example

      -
      spawn_link(SomeModule, :function, [1,2,3])
      +
      tuple = { :foo, :bar, 3 }
      +setelem(tuple, 0, :baz) #=> { :baz, :bar, 3 }
       
      - Source -
      -

      - term_to_binary(term) -

      -

      Returns a binary data which is the result of encoding the given term -according to the Erlang external term format.

      - -

      This can be used for a variety of purposes, for example, writing a term -to a file in an efficient way, or sending an Erlang term to some type -of communications channel not supported by distributed Erlang.

      -
      - Source -
      -

      - term_to_binary(term, opts) -

      -

      The same as term_to_binary/1 but also supports two options:

      - - -
      - Source -
      -

      - throw(term) -

      -

      A non-local return from a function. Check try/2 for more information.

      -
      - Source -
      -

      - tl(list) -

      -

      Returns the tail of a list. Raises ArgumentError if the list is empty.

      -
      - Source + Source

      to_binary(arg) @@ -3230,7 +3441,7 @@

      Examples

      #=> "foo"
      - Source + Source

      to_char_list(arg) @@ -3243,20 +3454,7 @@

      Examples

      #=> 'foo'
      - Source -
      -

      - trunc(number) -

      -

      Returns an integer by the truncating the given number. -Allowed in guard clauses.

      - -

      Examples

      - -
      trunc(5.5) #=> 5
      -
      -
      - Source + Source

      try(args) @@ -3344,7 +3542,7 @@

      Variable visibility

      Catching exits and Erlang errors

      -

      The catch clause works exactly the same as in Erlang. Therefore, +

      The catch clause works exactly the same as in : Therefore, one can also handle exits/errors coming from Erlang as below:

      try do
      @@ -3364,21 +3562,7 @@ 

      Catching exits and Erlang errors

      Although the second form should be avoided in favor of raise/rescue control mechanisms.

      - Source -
      -

      - tuple_size(tuple) -

      -

      Returns the size of a tuple.

      -
      - Source -
      -

      - tuple_to_list(tuple) -

      -

      Converts a tuple to a list.

      -
      - Source + Source

      unless(clause, options) @@ -3387,16 +3571,19 @@

      Catching exits and Erlang errors

      unless a value evalutes to true. Check if for examples and documentation.

      - Source + Source

      use(module, args // [])

      -

      use is a simple mechanism for extending the current module with the -given module.

      +

      use is a simple mechanism for using a given module into +the current context.

      Examples

      +

      For example, in other to write tests using the ExUnit framework, +a developers should use the ExUnit.Case module:

      +
      defmodule AssertionTest do
         use ExUnit.Case, async: true
       
      @@ -3407,8 +3594,9 @@ 

      Examples

      By calling use, a hook called __using__ will be invoked in -ExUnit.Case which will then do the proper setup. In other words, -use is simply a translation to:

      +ExUnit.Case which will then do the proper setup.

      + +

      Simply put, use is simply a translation to:

      defmodule AssertionTest do
         require ExUnit.Case
      @@ -3420,7 +3608,7 @@ 

      Examples

      end
      - Source + Source

      var!(var) @@ -3464,10 +3652,12 @@

      Examples

      this operator accepts any expression as arguments, not only booleans, however it is not allowed in guards.

      - Source + Source
      + + diff --git a/docs/stable/Keyword.KeyError.html b/docs/stable/Keyword.KeyError.html index bb74ca1f6..1168bcd2e 100644 --- a/docs/stable/Keyword.KeyError.html +++ b/docs/stable/Keyword.KeyError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -89,6 +89,11 @@

      Functions summary

      to_keywords/1 +
    1760. + + update/2 + +
    1761. update_key/2 @@ -101,6 +106,8 @@

      Functions summary

      + +

      Functions

      @@ -108,60 +115,68 @@

      Functions

      exception(args)

      - Source + Source

      exception(args, self)

      - Source + Source

      key(record)

      - Source + Source

      key(value, record)

      - Source + Source

      message(exception)

      - Source + Source

      new()

      - Source + Source

      new(opts)

      - Source + Source

      to_keywords(record)

      - Source + Source +
      +

      + update(keywords, record) +

      +
      + Source

      update_key(function, record)

      - Source + Source
      + + diff --git a/docs/stable/Keyword.html b/docs/stable/Keyword.html index 5d75ed6c1..a151742da 100644 --- a/docs/stable/Keyword.html +++ b/docs/stable/Keyword.html @@ -29,8 +29,7 @@

      A keyword is a list of tuples where the first element of the tuple is an atom and the second element can be -any value. The list is sorted by the first element of -each tuple.

      +any value.

      A keyword may have duplicated keys, so it is not strictly a dictionary. However most of the functions in this module @@ -40,9 +39,6 @@

      Keyword.put and Keyword.delete ensure all duplicated entries for a given key are removed when invoked.

      -

      This module uses == as operator to check if two keys -are equal or not.

      -

      @@ -60,6 +56,11 @@

      Functions summary

      delete/2
    1762. +
    1763. + + equal?/2 + +
    1764. from_enum/1 @@ -82,7 +83,7 @@

      Functions summary

    1765. - key?/2 + has_key?/2
    1766. @@ -120,6 +121,16 @@

      Functions summary

      put/3
    1767. +
    1768. + + update/3 + +
    1769. +
    1770. + + update/4 + +
    1771. values/1 @@ -132,6 +143,8 @@

      Functions summary

      + +

      Functions

      @@ -149,16 +162,30 @@

      Examples

      Keyword.delete [b: 2], :a #=> [b: 2]
      - Source + Source +
      +

      + equal?(left, right) +

      +

      Checks if two keywords are equal. I.e. they contain +the same keys and those keys contain the same values.

      + +

      Examples

      + +
      Keyword.equal? [a: 1, b: 2], [b: 2, a: 1]
      +#=> true
      +
      +
      + Source

      from_enum(enum)

      Creates a Keyword from enum. Differently from Keyword.new -that behaves as a dict, Keyword.from_enum do not remove +which behaves as a dict, Keyword.from_enum do not remove duplicated entries.

      - Source + Source

      get(keywords, key, default // nil) @@ -178,10 +205,10 @@

      Examples

      Keyword.get [a: 1], :b, 3 #=> 3
      - Source + Source

      - get!(list1, key) + get!(keywords, key)

      Gets the value for specific key. If key does not exist, an error is raised.

      @@ -192,10 +219,10 @@

      Examples

      Keyword.get! [a: 1], :b #=> raises KeyError[key: :b]
      - Source + Source

      - get_values(list1, key) + get_values(keywords, key)

      Gets all values for a specific key.

      @@ -205,22 +232,22 @@

      Examples

      #=> [1,2]
      - Source + Source
      -

      - key?(list1, key) +

      + has_key?(keywords, key)

      Returns whether a given key exists in the given keywords.

      -

      Examples

      +

      Examples

      -
      Keyword.key?([a: 1], :a)
      +
      Keyword.has_key?([a: 1], :a)
       #=> true
      -Keyword.key?([a: 1], :b)
      +Keyword.has_key?([a: 1], :b)
       #=> false
       
      - Source + Source

      keys(keywords) @@ -233,7 +260,7 @@

      Examples

      Keyword.keys [a: 1, b: 2] #=> [:a,:b]
       
      - Source + Source

      merge(d1, d2) @@ -247,7 +274,7 @@

      Examples

      #=> [a:3, b:2, d: 4]
      - Source + Source

      merge(d1, d2, fun) @@ -263,7 +290,7 @@

      Examples

      #=> [a:4, b:2, d: 4]
      - Source + Source

      new() @@ -299,26 +326,55 @@

      Examples

      #=> [a: :a, b: :b]
      - Source + Source

      - put(list1, key, value) + put(list, key, value)

      Sets the given value under key.

      If a previous value is already stored, all entries are removed and the value is overriden.

      -

      Use put_other/3 to add a new value for an existing key -without removing previous ones.

      -

      Examples

      Keyword.put [a: 1, b: 2], :a, 3
       #=> [a: 3, b: 2]
       
      - Source + Source +
      +

      + update(list1, key, fun) +

      +

      Updates the key with the given function. If the key does +not exist, raises Keyword.KeyError.

      + +

      Examples

      + +
      Keyword.update([a: 1], :a, &1 * 2)
      +#=> [a: 2]
      +Keyword.update([a: 1], :b, &1 * 2)
      +#=> Keyword.KeyError
      +
      +
      + Source +
      +

      + update(list1, key, initial, fun) +

      +

      Updates the key with the given function. If the key does +not exist, inserts the given initial value.

      + +

      Examples

      + +
      Keyword.update([a: 1], :a, 13, &1 * 2)
      +#=> [a: 2]
      +Keyword.update([a: 1], :b, 11, &1 * 2)
      +#=> [a: 1, b: 11]
      +
      +
      + Source

      values(keywords) @@ -330,12 +386,14 @@

      Examples

      Keyword.values [a: 1, b: 2] #=> [1,2]
       
      - Source + Source + + diff --git a/docs/stable/List.Chars.Atom.html b/docs/stable/List.Chars.Atom.html index 6b2c6837d..5939205b2 100644 --- a/docs/stable/List.Chars.Atom.html +++ b/docs/stable/List.Chars.Atom.html @@ -36,30 +36,13 @@

      -

      Functions summary

      - -
      -

      Functions

      -
      -

      - to_char_list(atom) -

      -
      - Source -
      -
      + diff --git a/docs/stable/List.Chars.BitString.html b/docs/stable/List.Chars.BitString.html index 981bf34ee..7230cf1c2 100644 --- a/docs/stable/List.Chars.BitString.html +++ b/docs/stable/List.Chars.BitString.html @@ -36,30 +36,13 @@

      -

      Functions summary

      - -
      -

      Functions

      -
      -

      - to_char_list(bitstring) -

      -
      - Source -
      -
      + diff --git a/docs/stable/List.Chars.List.html b/docs/stable/List.Chars.List.html index 5a8b40ce1..918a04826 100644 --- a/docs/stable/List.Chars.List.html +++ b/docs/stable/List.Chars.List.html @@ -36,30 +36,13 @@

      -

      Functions summary

      - -
      -

      Functions

      -
      -

      - to_char_list(list) -

      -
      - Source -
      -
      + diff --git a/docs/stable/List.Chars.Number.html b/docs/stable/List.Chars.Number.html index 2edf4d347..234e6a32d 100644 --- a/docs/stable/List.Chars.Number.html +++ b/docs/stable/List.Chars.Number.html @@ -36,30 +36,13 @@

      -

      Functions summary

      - -
      -

      Functions

      -
      -

      - to_char_list(integer) -

      -
      - Source -
      -
      + diff --git a/docs/stable/List.Chars.html b/docs/stable/List.Chars.html index e47ec9542..0c725d8a0 100644 --- a/docs/stable/List.Chars.html +++ b/docs/stable/List.Chars.html @@ -90,11 +90,13 @@

      Functions summary

      + +

      Functions

      - to_char_list(xA) + to_char_list(thing)

      Source @@ -103,6 +105,8 @@

      Functions

      + +
      diff --git a/docs/stable/List.html b/docs/stable/List.html index 01c671c83..90855ded3 100644 --- a/docs/stable/List.html +++ b/docs/stable/List.html @@ -105,22 +105,27 @@

      Functions summary

    1772. - last/1 + keyreplace/4
    1773. - member?/2 + keystore/4
    1774. - range/3 + last/1
    1775. - reverse/1 + member?/2 + +
    1776. +
    1777. + + range/3
    1778. @@ -153,11 +158,6 @@

      Functions summary

      zip/1
    1779. -
    1780. - - zip/2 - -
    1781. @@ -165,6 +165,8 @@

      Functions summary

      + +

      Functions

      @@ -227,7 +229,7 @@

      Examples

      #=> [[1,2],[1,2]]
      - Source + Source

      flatten(list) @@ -245,13 +247,13 @@

      Examples

      #=> [1,2,3,4,5]
      - Source + Source

      flatten(list, tail)

      - Source + Source

      foldl(list, acc, function) @@ -268,7 +270,7 @@

      Examples

      #=> 2
      - Source + Source

      foldr(list, acc, function) @@ -282,10 +284,10 @@

      Examples

      #=> -2
      - Source + Source

      - keydelete(list, item, position) + keydelete(list, key, position)

      Receives a list of tuples and deletes the first tuple where the item at position posistion matches with the @@ -293,20 +295,20 @@

      Examples

      Examples

      -
      List.keydelete([a: 1, b: 2], :a, 1)
      +
      List.keydelete([a: 1, b: 2], :a, 0)
       #=> [{ :b, 2 }]
       
      -List.keydelete([a: 1, b: 2], 2, 2)
      +List.keydelete([a: 1, b: 2], 2, 1)
       #=> [{ :a, 1 }]
       
      -List.keydelete([a: 1, b: 2], :c, 1)
      +List.keydelete([a: 1, b: 2], :c, 0)
       #=> [{ :a, 1 }, { :b, 2 }]
       
      - Source + Source

      - keyfind(list, item, position, default // nil) + keyfind(list, key, position, default // nil)

      Receives a list of tuples and returns the first tuple where the item at position posistion matches with the @@ -314,20 +316,20 @@

      Examples

      Examples

      -
      List.keyfind([a: 1, b: 2], :a, 1)
      +
      List.keyfind([a: 1, b: 2], :a, 0)
       #=> { :a, 1 }
       
      -List.keyfind([a: 1, b: 2], 2, 2)
      +List.keyfind([a: 1, b: 2], 2, 1)
       #=> { :b, 2 }
       
      -List.keyfind([a: 1, b: 2], :c, 1)
      +List.keyfind([a: 1, b: 2], :c, 0)
       #=> nil
       
      - Source + Source

      - keymember?(list, item, position) + keymember?(list, key, position)

      Receives a list of tuples and returns true if there is a tuple where the item at position posistion matches @@ -335,17 +337,46 @@

      Examples

      Examples

      -
      List.keymember?([a: 1, b: 2], :a, 1)
      +
      List.keymember?([a: 1, b: 2], :a, 0)
       #=> true
       
      -List.keymember?([a: 1, b: 2], 2, 2)
      +List.keymember?([a: 1, b: 2], 2, 1)
       #=> true
       
      -List.keymember?([a: 1, b: 2], :c, 1)
      +List.keymember?([a: 1, b: 2], :c, 0)
       #=> false
       
      - Source + Source +
      +

      + keyreplace(list, key, position, new_tuple) +

      +

      Receives a list of tuples and replaces the item +identified by key at position pos if it exists.

      + +

      Examples

      + +
      List.keyreplace([a: 1, b: 2], :a, 0, { :a, 3 })
      +#=> [a: 3, b: 2]
      +
      +
      + Source +
      +

      + keystore(list, key, position, new_tuple) +

      +

      Receives a list of tuples and replaces the item +identified by key at position pos. If the item +does not exist, it is added to the end of the list.

      + +

      Examples

      + +
      List.keystore([a: 1, b: 2], :a, 0, { :a, 3 })
      +#=> [a: 3, b: 2]
      +
      +
      + Source

      last(list) @@ -362,7 +393,7 @@

      Examples

      #=> 3
      - Source + Source

      member?(list, term) @@ -380,7 +411,7 @@

      Examples

      #=> false
      - Source + Source

      range(first, last, step // nil) @@ -400,21 +431,7 @@

      Examples

      List.range 5, 1, -2 #=> [5, 3, 1]
      - Source -
      -

      - reverse(list) -

      -

      Reverses the given list. This function simply delegates -to lists:reverse which is implemented in C for performance.

      - -

      Examples

      - -
      List.reverse [1,2,3]
      -#=> [3,2,1]
      -
      -
      - Source + Source

      sort(list) @@ -428,7 +445,7 @@

      Examples

      #=> [1, 2, 3, 4, 7]
      - Source + Source

      sort(list, fun) @@ -442,7 +459,7 @@

      Examples

      #=> [7, 4, 3, 2, 1]
      - Source + Source

      uniq(list) @@ -455,7 +472,7 @@

      Examples

      #=> [1,2,3]
      - Source + Source

      unzip(list) @@ -472,7 +489,7 @@

      Examples

      #=> [[1, 2, 3], [:a, :b, :c]]
      - Source + Source

      wrap(list) @@ -486,7 +503,7 @@

      Examples

      List.wrap [1,2,3] #=> [1,2,3]
       
      - Source + Source

      zip(list_of_lists) @@ -502,30 +519,14 @@

      Examples

      #=> [{1, 3, 5}]
      - Source -
      -

      - zip(item1, item2) -

      -

      Zips corresponding elements from two lists (or tuples) into one list of tuples. The -number of elements in the resulting list is equal to the length of the -shortest list among the given ones.

      - -

      Examples

      - -
      List.zip [1, 2, 3], [4, 5, 6]
      -#=> [{1, 4}, {2, 5}, {3, 6}]
      -
      -List.zip [1, 2], [4, 5, 6]
      -#=> [{1, 4}, {2, 5}]
      -
      -
      - Source + Source
      + + diff --git a/docs/stable/Macro.Env.html b/docs/stable/Macro.Env.html index 3f830967a..2bd367c00 100644 --- a/docs/stable/Macro.Env.html +++ b/docs/stable/Macro.Env.html @@ -28,8 +28,14 @@

      +
      +

      A record that contains compile time environment information, +It can be accessed at any time by calling ENV.

      - Source +
      + + + Source @@ -93,12 +99,22 @@

      Functions summary

      @@ -153,31 +259,51 @@

      Functions summary

      + +

      Functions

      -

      - __access__(caller, args) -

      -

      A record that contains compile time environment information, -It can be accessed at any time by calling ENV.

      -
      - Source -

      aliases(record)

      Returns a list of two item tuples, where the first item is the aliased name and the second the actual name.

      - Source + Source +
      +

      + aliases(value, record) +

      +
      + Source +
      +

      + context(record) +

      +

      Returns the context of the environment. It can be nil +(default context), inside a guard or inside an assign.

      +
      + Source +
      +

      + context(value, record) +

      +
      + Source

      file(record)

      Returns the current file name as a binary.

      - Source + Source +
      +

      + file(value, record) +

      +
      + Source

      function(record) @@ -186,7 +312,13 @@

      Functions

      is the function name and the seconds its arity. Returns nil if not inside a function.

      - Source + Source +
      +

      + function(value, record) +

      +
      + Source

      in_guard?(record) @@ -194,7 +326,7 @@

      Functions

      Returns wether the compilation environment is currently inside a guard.

      - Source + Source

      in_match?(record) @@ -202,48 +334,146 @@

      Functions

      Returns wether the compilation environment is currently inside a match clause.

      - Source + Source

      line(record)

      Returns the current line as an integer.

      - Source + Source +
      +

      + line(value, record) +

      +
      + Source

      location(record)

      -

      Returns a keywords list containing the file and line +

      Returns a keyword list containing the file and line information as keys.

      - Source + Source

      macros(record)

      Returns a list of macros imported from each module.

      - Source + Source +
      +

      + macros(value, record) +

      +
      + Source

      module(record)

      Returns the current module name.

      - Source + Source +
      +

      + module(value, record) +

      +
      + Source +
      +

      + new() +

      +
      + Source +
      +

      + new(opts) +

      +
      + Source

      requires(record)

      Returns the list of required modules.

      - Source + Source +
      +

      + requires(value, record) +

      +
      + Source +
      +

      + to_keywords(record) +

      +
      + Source +
      +

      + update(keywords, record) +

      +
      + Source +
      +

      + update_aliases(function, record) +

      +
      + Source +
      +

      + update_context(function, record) +

      +
      + Source +
      +

      + update_file(function, record) +

      +
      + Source +
      +

      + update_function(function, record) +

      +
      + Source +
      +

      + update_line(function, record) +

      +
      + Source +
      +

      + update_macros(function, record) +

      +
      + Source +
      +

      + update_module(function, record) +

      +
      + Source +
      +

      + update_requires(function, record) +

      +
      + Source
      + + diff --git a/docs/stable/Macro.html b/docs/stable/Macro.html index 1d655ebfb..d2b594e3f 100644 --- a/docs/stable/Macro.html +++ b/docs/stable/Macro.html @@ -42,6 +42,11 @@

      Functions summary

      @@ -78,9 +108,17 @@

      Macros summary

      + +

      Functions

      +

      + do_safe_term(terms) +

      +
      + Source +

      escape(tuple)

      @@ -193,7 +231,17 @@

      Examples

      end
      - Source + Source +
      +

      + safe_term(terms) +

      +

      Recurs the quoted expression checking if all sub terms are +safe (i.e. they represented data structured and don't actually +evaluate code) and returns :ok unless a given term is unsafe, +which is returned as { :unsafe, term }.

      +
      + Source

      to_binary(tree) @@ -206,7 +254,95 @@

      Examples

      #=> "foo.bar(1, 2, 3)"
      - Source + Source +
      +

      + unescape_binary(chars) +

      +

      Unescape the given chars. This is the unescaping behavior +used by default in Elixir single- and double-quoted strings. +Check unescape_binary/2 for information on how to customize +the escaping map.

      + +

      In this setup, Elixir will escape the following: \b, \d, +\e, \f, \n, \r, \s, \t and \v. Octals are also +escaped according to the latin1 set they represent.

      + +

      This function is commonly used on sigil implementations +(like %r, %b and others).

      + +

      Examples

      + +
      Macro.unescape_binary "example\\n"
      +#=> "example\n"
      +
      + +

      In the example above, we pass a string with \n escaped +and we return a version with it unescaped.

      +
      + Source +
      +

      + unescape_binary(chars, map) +

      +

      Unescape the given chars according to the map given. +Check unescape/1 if you want to use the same map as +Elixir single- and double-quoted strings.

      + +

      Map

      + +

      The map must be a function. The function receives an integer +representing the number of the characters it wants to unescape. +Here is the default mapping function implemented by Elixir:

      + +
      def unescape_map(?b), do: ?\b
      +def unescape_map(?d), do: ?\d
      +def unescape_map(?e), do: ?\e
      +def unescape_map(?f), do: ?\f
      +def unescape_map(?n), do: ?\n
      +def unescape_map(?r), do: ?\r
      +def unescape_map(?s), do: ?\s
      +def unescape_map(?t), do: ?\t
      +def unescape_map(?v), do: ?\v
      +def unescape_map(e),  do: e
      +
      + +

      If the unescape_map function returns false. The char is +not escaped and \ is kept in the char list.

      + +

      Octals

      + +

      Octals will by default be escaped unless the map function +returns false for ?0.

      + +

      Examples

      + +

      Using the unescape_map defined above is easy:

      + +
      Macro.unescape_binary "example\\n", unescape_map(&1)
      +
      +
      + Source +
      +

      + unescape_tokens(tokens) +

      +

      Unescape the given tokens according to the default map. +Check unescape/1 and unescape/2 for more information +about unescaping. Only tokens that are binaries are +unescaped, all others are ignored. This method is useful +when implementing your own sigils. Check the implementation +of Kernel.__b__ for examples.

      +
      + Source +
      +

      + unescape_tokens(tokens, map) +

      +

      Unescape the given tokens according to the given map. +Check unescape_tokens/1 and unescaped/2 for more information.

      +
      + Source
      @@ -233,6 +369,8 @@

      Macros

      + + diff --git a/docs/stable/MatchError.html b/docs/stable/MatchError.html index a1aa5f729..b85947f52 100644 --- a/docs/stable/MatchError.html +++ b/docs/stable/MatchError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -89,6 +89,11 @@

      Functions summary

      to_keywords/1 +
    1782. + + update/2 + +
    1783. update_actual/2 @@ -101,6 +106,8 @@

      Functions summary

      + +

      Functions

      @@ -108,60 +115,68 @@

      Functions

      actual(record)

      - Source + Source

      actual(value, record)

      - Source + Source

      exception(args)

      - Source + Source

      exception(args, self)

      - Source + Source

      message(exception)

      - Source + Source

      new()

      - Source + Source

      new(opts)

      - Source + Source

      to_keywords(record)

      - Source + Source +
      +

      + update(keywords, record) +

      +
      + Source

      update_actual(function, record)

      - Source + Source
      + + diff --git a/docs/stable/Mix.Dep.html b/docs/stable/Mix.Dep.html index d28778260..dc90515ee 100644 --- a/docs/stable/Mix.Dep.html +++ b/docs/stable/Mix.Dep.html @@ -38,6 +38,7 @@

    1784. requirements - a binary or regexp with the deps requirement;
    1785. status - the current status of dependency, check Mix.Deps.format_status/1 for more info;
    1786. opts - the options given by the developer
    1787. +
    1788. project - the Mix.Project for the dependency
    1789. @@ -53,13 +54,13 @@

      Fields (and defaults)

    1790. - app: nil + scm: nil
    1791. - opts: nil + app: nil
    1792. @@ -71,13 +72,19 @@

      Fields (and defaults)

    1793. - scm: nil + status: nil
    1794. - status: nil + opts: nil + +
    1795. + +
    1796. + + project: nil
    1797. @@ -117,6 +124,16 @@

      Functions summary

      opts/2 +
    1798. + + project/1 + +
    1799. +
    1800. + + project/2 + +
    1801. requirement/1 @@ -152,6 +169,11 @@

      Functions summary

      to_keywords/1
    1802. +
    1803. + + update/2 + +
    1804. update_app/2 @@ -162,6 +184,11 @@

      Functions summary

      update_opts/2
    1805. +
    1806. + + update_project/2 + +
    1807. update_requirement/2 @@ -184,6 +211,8 @@

      Functions summary

      + +

      Functions

      @@ -222,6 +251,18 @@

      Functions

      Source +
      +

      + project(record) +

      +
      + Source +
      +

      + project(value, record) +

      +
      + Source

      requirement(record) @@ -264,6 +305,12 @@

      Functions

      Source +
      +

      + update(keywords, record) +

      +
      + Source

      update_app(function, record) @@ -276,6 +323,12 @@

      Functions

      Source +
      +

      + update_project(function, record) +

      +
      + Source

      update_requirement(function, record) @@ -299,6 +352,8 @@

      Functions

      + +
      diff --git a/docs/stable/Mix.Deps.Lock.html b/docs/stable/Mix.Deps.Lock.html index 7cbcf7fc7..c7b0b2874 100644 --- a/docs/stable/Mix.Deps.Lock.html +++ b/docs/stable/Mix.Deps.Lock.html @@ -43,17 +43,17 @@

      Functions summary

      • - read/0 + lockfile/0
      • - update_lock/2 + read/1
      • - write/1 + write/2
      • @@ -63,41 +63,39 @@

        Functions summary

        + +

        Functions

        -

        - read() +

        + lockfile()

        -

        Read the file, returns a keywords list containing -the app name and its current lock information.

        +

        Returns the lockfile path.

        - Source + Source
        -

        - update_lock(deps, callback) +

        + read(file // lockfile)

        -

        Loop the given dependencies triggering the callback. -The callback receives the dependency and its current lock -(may be nil). The callback must return a lock or nil in -case a lock could not be retrieved.

        - -

        This function returns a list with the app names in the -given dependencies that got a lock.

        +

        Read the file, returns a keyword list containing +the app name and its current lock information.

        - Source + Source
        -

        - write(dict) +

        + write(file // lockfile, dict)

        -

        Receives a keywords list and writes it to the disk.

        +

        Receives a keyword list and writes it to the disk.

        - Source + Source
        + +
        diff --git a/docs/stable/Mix.Deps.html b/docs/stable/Mix.Deps.html index fe69a1bcb..06675fa1e 100644 --- a/docs/stable/Mix.Deps.html +++ b/docs/stable/Mix.Deps.html @@ -32,7 +32,7 @@

        - Source + Source @@ -48,22 +48,22 @@

        Functions summary

      • - all/1 + all/2
      • - by_name/1 + available?/1
      • - check_lock/2 + by_name!/1
      • - deps_path/0 + check_lock/2
      • @@ -81,6 +81,11 @@

        Functions summary

        format_status/1
      • +
      • + + ok?/1 + +
      • out_of_date?/1 @@ -88,7 +93,7 @@

        Functions summary

      • - update_status/1 + update/1
      • @@ -98,97 +103,103 @@

        Functions summary

        + +

        Functions

        all()

        -

        Returns all dependencies in as Mix.Dep record.

        +

        Returns all dependencies recursively as Mix.Dep record.

        Exceptions

        This function raises an exception in case the developer provides a dependency in the wrong format.

        - -

        Statuses

        - -

        The status element in the tuple returns the current -situation of the repository. Check format_status/1 -for more information.

        - Source + Source
        -

        - all(status) +

        + all(acc, callback)

        -

        Get all dependencies that match the specific status.

        +

        Returns all dependencies but with a custom callback and +accumulator.

        - Source + Source
        -

        - by_name(given) +

        + available?(arg1) +

        +

        Check if a dependency is available.

        +
        + Source +
        +

        + by_name!(given)

        Receives a list of deps names and returns deps records. Raises an error if the dependency does not exist.

        - Source + Source

        check_lock(dep, lock)

        Checks the lock for the given dependency and update its status accordingly.

        - Source -
        -

        - deps_path() -

        -

        The default path for dependencies.

        -
        - Source + Source

        deps_path(arg1)

        Returns the path for the given dependency.

        - Source + Source

        format_dep(arg1)

        Format the dependency for printing.

        - Source + Source

        format_status(arg1)

        Formats the status of a dependency.

        - Source + Source +
        +

        + ok?(arg1) +

        +

        Check if a dependency is ok.

        +
        + Source

        - out_of_date?(arg1) + out_of_date?(dep)

        Check if a dependency is out of date or not, considering its lock status. Therefore, be sure to call check_lock before invoking this function.

        - Source + Source
        -

        - update_status(arg1) +

        + update(dep)

        -

        Receives a dependency and update its status

        +

        Updates the dependency inside the given project.

        - Source + Source
        + +
        diff --git a/docs/stable/Mix.Error.html b/docs/stable/Mix.Error.html index 8e248a5dd..cc8400d65 100644 --- a/docs/stable/Mix.Error.html +++ b/docs/stable/Mix.Error.html @@ -29,7 +29,7 @@

        - Source + Source @@ -84,6 +84,11 @@

        Functions summary

        to_keywords/1 +
      • + + update/2 + +
      • update_message/2 @@ -96,6 +101,8 @@

        Functions summary

        + +

        Functions

        @@ -103,54 +110,62 @@

        Functions

        exception(args)

        - Source + Source

        exception(args, self)

        - Source + Source

        message(record)

        - Source + Source

        message(value, record)

        - Source + Source

        new()

        - Source + Source

        new(opts)

        - Source + Source

        to_keywords(record)

        - Source + Source +
        +

        + update(keywords, record) +

        +
        + Source

        update_message(function, record)

        - Source + Source
        + +
      • diff --git a/docs/stable/Mix.Generator.html b/docs/stable/Mix.Generator.html index 17f4f4bdc..a0e5e8b34 100644 --- a/docs/stable/Mix.Generator.html +++ b/docs/stable/Mix.Generator.html @@ -78,6 +78,8 @@

        Macros summary

        + +

        Functions

        @@ -111,7 +113,7 @@

        Macros

        It will define a private function with the name followed by _template that expects assigns as arguments.

        -

        This function must be invoked passing a keywords list. +

        This function must be invoked passing a keyword list. Each key in the keyword list can be accessed in the template using the @ macro.

        @@ -143,6 +145,8 @@

        Macros

        + +
        diff --git a/docs/stable/Mix.InvalidTaskError.html b/docs/stable/Mix.InvalidTaskError.html index 753eacc94..dd83e7d79 100644 --- a/docs/stable/Mix.InvalidTaskError.html +++ b/docs/stable/Mix.InvalidTaskError.html @@ -89,6 +89,11 @@

        Functions summary

        to_keywords/1 +
      • + + update/2 + +
      • update_task/2 @@ -101,6 +106,8 @@

        Functions summary

        + +

        Functions

        @@ -151,6 +158,12 @@

        Functions

        Source +
        +

        + update(keywords, record) +

        +
        + Source

        update_task(function, record) @@ -162,6 +175,8 @@

        Functions

        + +
        diff --git a/docs/stable/Mix.Local.html b/docs/stable/Mix.Local.html index 4dff0b954..91432f176 100644 --- a/docs/stable/Mix.Local.html +++ b/docs/stable/Mix.Local.html @@ -63,6 +63,8 @@

        Functions summary

        + +

        Functions

        @@ -91,6 +93,8 @@

        Functions

        + +
        diff --git a/docs/stable/Mix.NoProjectError.html b/docs/stable/Mix.NoProjectError.html index 918ab3ecf..fb0721644 100644 --- a/docs/stable/Mix.NoProjectError.html +++ b/docs/stable/Mix.NoProjectError.html @@ -84,6 +84,11 @@

        Functions summary

        to_keywords/1
      • +
      • + + update/2 + +
      • update_message/2 @@ -96,6 +101,8 @@

        Functions summary

        + +

        Functions

        @@ -140,6 +147,12 @@

        Functions

        Source +
        +

        + update(keywords, record) +

        +
        + Source

        update_message(function, record) @@ -151,6 +164,8 @@

        Functions

        + +
        diff --git a/docs/stable/Mix.NoTaskError.html b/docs/stable/Mix.NoTaskError.html index 9b9a65b2a..41b7814f1 100644 --- a/docs/stable/Mix.NoTaskError.html +++ b/docs/stable/Mix.NoTaskError.html @@ -89,6 +89,11 @@

        Functions summary

        to_keywords/1
      • +
      • + + update/2 + +
      • update_task/2 @@ -101,6 +106,8 @@

        Functions summary

        + +

        Functions

        @@ -151,6 +158,12 @@

        Functions

        Source +
        +

        + update(keywords, record) +

        +
        + Source

        update_task(function, record) @@ -162,6 +175,8 @@

        Functions

        + +
        diff --git a/docs/stable/Mix.OutOfDateDepsError.html b/docs/stable/Mix.OutOfDateDepsError.html index b03a3d22d..df647aec7 100644 --- a/docs/stable/Mix.OutOfDateDepsError.html +++ b/docs/stable/Mix.OutOfDateDepsError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -39,7 +39,7 @@

        Fields (and defaults)

      • - message: "Some dependencies are out of date, please run `mix deps.get` to proceed" + env: nil
      • @@ -51,22 +51,27 @@

        Functions summary

        diff --git a/docs/stable/Mix.Project.html b/docs/stable/Mix.Project.html index 90c110473..396d92802 100644 --- a/docs/stable/Mix.Project.html +++ b/docs/stable/Mix.Project.html @@ -23,6 +23,8 @@

        Mix.Project + behaviour +

        @@ -34,7 +36,7 @@

        Examples

        In order to configure Mix, a developer needs to use Mix.Project in a module and define a function named -project that returns a keywords list with configuration.

        +project that returns a keyword list with configuration.

        defmodule MyApp do
           use Mix.Project
        @@ -54,7 +56,7 @@ 

        Examples

        even without a project.

        In case the developer needs a project or want to access a special -function in the project, he can access Mix.Project.current/0 +function in the project, he can access Mix.Project.get!/0 which fails with Mix.NoProjectError in case a project is not defined.

        @@ -72,17 +74,22 @@

        Functions summary

        • - behaviour_info/1 + config/0 + +
        • +
        • + + get/0
        • - current/0 + get!/0
        • - defined?/0 + refresh/0
        • @@ -92,34 +99,55 @@

          Functions summary

          + +

          Functions

          -

          - behaviour_info(atom1) +

          + config()

          -
          - Source +

          Returns the project configuration already +considering the current environment.

          +
          + Source
          -

          - current() +

          + get()

          -

          Retrieves the current project, raises an error -if there is no project set.

          +

          Retrieves the current project.

          + +

          This is usually called by tasks that needs additional +functions on the project to be defined. Since such +tasks usually depends on a project to be defined, this +function raises Mix.NoProjectError in case no project +is available.

          + +

          Returns nil if no project./

          - Source + Source
          -

          - defined?() +

          + get!()

          -

          Returns true if a current project is defined.

          +

          Same as get/0 but raises an exception if no project.

          - Source + Source +
          +

          + refresh() +

          +

          Refresh the project configuration. Usually required +when the environment changes during a task.

          +
          + Source
          + +
          diff --git a/docs/stable/Mix.SCM.html b/docs/stable/Mix.SCM.html index 09d8a2b03..1f0ba27bc 100644 --- a/docs/stable/Mix.SCM.html +++ b/docs/stable/Mix.SCM.html @@ -23,9 +23,17 @@

          Mix.SCM + behaviour +

          +
          +

          This module provides helper functions and defines the +behavior required by any SCM used by mix.

          + +
          + Source @@ -43,47 +51,56 @@

          Functions summary

        • - available?/2 + register/1
        • - behaviour_info/1 + register_builtin/0
        • -
        • + +
        + + + + + +

        Callbacks summary

        +
          +
        • - check?/2 + available?/2
        • - clean/2 + check?/2
        • - consumes?/1 + checkout/2
        • - get/2 + clean/2
        • - key/0 + consumes?/1
        • - register/1 + key/0
        • - register_builtin/0 + match?/2
        • @@ -96,8 +113,6 @@

          Functions summary

          - -

          Functions

          @@ -106,22 +121,38 @@

          Functions

          Returns all available SCM.

          - Source + Source
          +

          + register(mod) +

          +

          Register the scm repository with the given key and mod.

          +
          + Source +
          +

          + register_builtin() +

          +

          Register builtin SCMs.

          +
          + Source +
          +
          + + + + + +
          +

          Callbacks

          +

          available?(path, opts)

          This behavior function receives a path, opts and returns a boolean if the dependency is available.

          - Source -
          -

          - behaviour_info(atom1) -

          -

          Register required callbacks.

          -
          - Source + Source

          check?(path, opts) @@ -131,19 +162,31 @@

          Functions

          SCMs do not require a lock, for such, this function can simply return true.

          - Source + Source +
          +

          + checkout(path, opts) +

          +

          This behavior function checks out dependencies.

          + +

          If the dependency is locked, a lock is received in opts +and the repository must be check out at the lock. Otherwise, +no lock is given and the repository can be checked out +to the latest version.

          +
          + Source

          clean(path, opts)

          This behavior function should clean the given dependency.

          - Source + Source

          consumes?(opts)

          -

          This behavior function receives a keywords list of opts +

          This behavior function receives a keyword list of opts and should return an updated list in case the SCM consumes the available options. For example, when a developer specifies a dependency:

          @@ -156,19 +199,7 @@

          Functions

          sense for the Git SCM, it will return an update list of options while other SCMs would simply return nil.

          - Source -
          -

          - get(path, opts) -

          -

          This behavior function gets unchecked dependencies. -If the dependency is locked, it receives the lock under the -:lock key in opts. In case no lock is given, it must -return a new lock (if one exists). If a lock is given, -it must preferably return the same lock, but can return -a different one in case of failure.

          -
          - Source + Source

          key() @@ -178,36 +209,32 @@

          Functions

          must be found since it is used to print information about the requested dependency.

          - Source + Source
          -

          - register(mod) +

          + match?(opts1, opts2)

          -

          Register the scm repository with the given key and mod.

          +

          Receives two options and must return true if the refer to the +same repository.

          - Source -
          -

          - register_builtin() -

          -

          Register builtin SCMs.

          -
          - Source + Source

          update(path, opts)

          This behavior function updates dependencies. It may be -called either directly via deps.update or implicitly -by deps.get. In the first scenario, no lock is received, -while one is given in the second.

          +called by deps.get or deps.update.

          + +

          In the first scenario, a lock is received in opts and +the repository must be updated to the lock. In the second, +no lock is given and the repository can be updated freely.

          + +

          It must return the current lock.

          - Source + Source
          - -
      diff --git a/docs/stable/Mix.Shell.Process.html b/docs/stable/Mix.Shell.Process.html index aed8ea3ce..f369ad1e5 100644 --- a/docs/stable/Mix.Shell.Process.html +++ b/docs/stable/Mix.Shell.Process.html @@ -81,6 +81,8 @@

      Functions summary

      + +

      Functions

      @@ -131,6 +133,8 @@

      Examples

      + +
      diff --git a/docs/stable/Mix.Shell.html b/docs/stable/Mix.Shell.html index e9b9f0da6..1d9d87cf1 100644 --- a/docs/stable/Mix.Shell.html +++ b/docs/stable/Mix.Shell.html @@ -23,6 +23,8 @@

      Mix.Shell + behaviour +

      @@ -69,6 +71,8 @@

      Functions summary

      + +

      Functions

      @@ -106,6 +110,8 @@

      Functions

      + +
      diff --git a/docs/stable/Mix.Task.html b/docs/stable/Mix.Task.html index 35d17fb87..95590f114 100644 --- a/docs/stable/Mix.Task.html +++ b/docs/stable/Mix.Task.html @@ -23,6 +23,8 @@

      Mix.Task + behaviour +

      @@ -46,11 +48,6 @@

      Functions summary

      all_modules/0
    1808. -
    1809. - - behaviour_info/1 - -
    1810. clear/0 @@ -103,6 +100,8 @@

      Functions summary

      + +

      Functions

      @@ -112,13 +111,7 @@

      Functions

      Returns all loaded modules. Modules that were not yet loaded won't show up. Check load_all/0 if you want to preload all tasks.

      - Source -
      -

      - behaviour_info(atom1) -

      -
      - Source + Source

      clear() @@ -126,7 +119,7 @@

      Functions

      Clears all invoked tasks, allowing them to be reinvoked. Returns an ordset with all the tasks invoked thus far.

      - Source + Source

      get(task) @@ -140,21 +133,21 @@

      Exceptions

    1811. Mix.InvalidTaskError - raised if the task is not a valid Mix.Task
    1812. - Source + Source

      hidden?(module)

      Checks if the task is hidden or not. Returns a boolean.

      - Source + Source

      load_all()

      Loads all tasks in all code paths.

      - Source + Source

      moduledoc(module) @@ -162,14 +155,14 @@

      Exceptions

      Gets the moduledoc for the given module. Returns the moduledoc or nil.

      - Source + Source

      reenable(task)

      Reenables a given task so it can be executed again down the stack.

      - Source + Source

      run(task, args // []) @@ -184,7 +177,7 @@

      Exceptions

      It may raise an exception if the task was not found or it is invalid. Check get/2 for more information.

      - Source + Source

      shortdoc(module) @@ -192,19 +185,21 @@

      Exceptions

      Gets the shortdoc for the given module. Returns the shortdoc or nil.

      - Source + Source

      task_name(module)

      Returns the task name for the given module.

      - Source + Source
      + + diff --git a/docs/stable/Mix.Tasks.Clean.html b/docs/stable/Mix.Tasks.Clean.html index 228bebf3c..d6549952e 100644 --- a/docs/stable/Mix.Tasks.Clean.html +++ b/docs/stable/Mix.Tasks.Clean.html @@ -59,6 +59,8 @@

      Functions summary

      + +

      Functions

      @@ -72,6 +74,8 @@

      Functions

      + +
      diff --git a/docs/stable/Mix.Tasks.Compile.App.html b/docs/stable/Mix.Tasks.Compile.App.html index 1de7f169d..32132466a 100644 --- a/docs/stable/Mix.Tasks.Compile.App.html +++ b/docs/stable/Mix.Tasks.Compile.App.html @@ -35,7 +35,7 @@

      and "elixir" as application dependencies.

      You can optionally define an application/0 function inside your -Mix.Project that returns a keywords list to further configure +Mix.Project that returns a keyword list to further configure your application according to OTP design principles:

      http://www.erlang.org/doc/design_principles/applications.html

      @@ -77,6 +77,8 @@

      Functions summary

      + +

      Functions

      @@ -90,6 +92,8 @@

      Functions

      + +
      diff --git a/docs/stable/Mix.Tasks.Compile.Elixir.html b/docs/stable/Mix.Tasks.Compile.Elixir.html index 07036492f..01606d896 100644 --- a/docs/stable/Mix.Tasks.Compile.Elixir.html +++ b/docs/stable/Mix.Tasks.Compile.Elixir.html @@ -41,24 +41,16 @@

      force compilation regardless of mod times by passing the --force option.

      +

      A list of files can be given after the task +name in order to select the files to compile.

      +

      Configuration

        -
      • :source_paths - directories to find source files. -Defaults to ["lib"], can be configured as:

        - -

        [source_paths: ["lib", "other"]]

      • -
      • :compile_path - directory to output compiled files. -Defaults to "ebin", can be configured as:

        - -

        [compile_path: "ebin"]

      • -
      • :compile_first - which files need to be compiled first. -Defaults to an empty list, can be configured as:

        - -

        [compile_first: ["lib/foo.ex" "lib/bar.ex"]]

      • -
      • :elixirc_options - compilation options that applies +

      • :elixirc_options - compilation options that applies to Elixir's compiler, they are: :ignore_module_conflict, -:docs and :debug_info. They all default to false.

      • +:docs and :debug_info. By default, uses the same +behaviour as Elixir

      Command line options

      @@ -91,6 +83,8 @@

      Functions summary

      + +

      Functions

      @@ -98,12 +92,14 @@

      Functions

      run(args)

      - Source + Source
      + +
      diff --git a/docs/stable/Mix.Tasks.Compile.html b/docs/stable/Mix.Tasks.Compile.html index c9a9ade06..a92b08255 100644 --- a/docs/stable/Mix.Tasks.Compile.html +++ b/docs/stable/Mix.Tasks.Compile.html @@ -44,11 +44,37 @@

      Configuration

      [compilers: [:elixir, :mycompiler, :app]]
       
      +

      Common configuration

      + +

      The following options are usually shared by different compilers:

      + +
        +
      • :source_paths - directories to find source files. +Defaults to ["lib"], can be configured as:

        + +

        [source_paths: ["lib", "other"]]

      • +
      • :compile_path - directory to output compiled files. +Defaults to "ebin", can be configured as:

        + +

        [compile_path: "ebin"]

      • +
      • :compile_first - which files need to be compiled first. +They need to be a subset of the files found in source_paths.

        + +

        [compile_first: ["lib/foo.ex", "lib/bar.ex"]]

      • +
      • :watch_exts - extensions to watch in order to trigger +a compilation:

        + +

        [watch_exts: [:ex, :eex]]

      • +
      • :compile_exts - extensions to compile whenever there +is a change:

        + +

        [compile_exts: [:ex]]

      • +
      +

      Command line options

        -
      • --list - List all enabled compilers.
      • -
      • --no-check - Skip dependencies check before compilation.
      • +
      • --list - List all enabled compilers.
      @@ -75,6 +101,8 @@

      Functions summary

      + +

      Functions

      @@ -82,12 +110,14 @@

      Functions

      run(args)

      - Source + Source
      + + diff --git a/docs/stable/Mix.Tasks.Deps.Check.html b/docs/stable/Mix.Tasks.Deps.Check.html index 0b62a7398..fd6055c8d 100644 --- a/docs/stable/Mix.Tasks.Deps.Check.html +++ b/docs/stable/Mix.Tasks.Deps.Check.html @@ -57,6 +57,8 @@

      Functions summary

      + +

      Functions

      @@ -70,6 +72,8 @@

      Functions

      + +
      diff --git a/docs/stable/Mix.Tasks.Deps.Clean.html b/docs/stable/Mix.Tasks.Deps.Clean.html index d18681e20..f6938f846 100644 --- a/docs/stable/Mix.Tasks.Deps.Clean.html +++ b/docs/stable/Mix.Tasks.Deps.Clean.html @@ -57,6 +57,8 @@

      Functions summary

      + +

      Functions

      @@ -70,6 +72,8 @@

      Functions

      + +
      diff --git a/docs/stable/Mix.Tasks.Deps.Compile.html b/docs/stable/Mix.Tasks.Deps.Compile.html index 9a2a5562a..fcc3e500c 100644 --- a/docs/stable/Mix.Tasks.Deps.Compile.html +++ b/docs/stable/Mix.Tasks.Deps.Compile.html @@ -78,6 +78,8 @@

      Functions summary

      + +

      Functions

      @@ -91,6 +93,8 @@

      Functions

      + +
      diff --git a/docs/stable/Mix.Tasks.Deps.Get.html b/docs/stable/Mix.Tasks.Deps.Get.html index 9e0b1bced..d1e7797ea 100644 --- a/docs/stable/Mix.Tasks.Deps.Get.html +++ b/docs/stable/Mix.Tasks.Deps.Get.html @@ -28,7 +28,7 @@

      Get all out of date dependencies, i.e. dependencies -that are not available or have a wrong lock.

      +that are not available or have an invalid lock.

      @@ -54,6 +54,8 @@

      Functions summary

      + +

      Functions

      @@ -67,6 +69,8 @@

      Functions

      + +
      diff --git a/docs/stable/Mix.Tasks.Deps.Loadpaths.html b/docs/stable/Mix.Tasks.Deps.Loadpaths.html index 22cc8eec8..7977a449c 100644 --- a/docs/stable/Mix.Tasks.Deps.Loadpaths.html +++ b/docs/stable/Mix.Tasks.Deps.Loadpaths.html @@ -27,11 +27,8 @@

      -

      Loads all dependencies. Invokes "deps.check" before -unless --no-check is given.

      - -

      This task is not shown in mix help but it is part -of mix public API and can be depended on.

      +

      Loads all dependencies. This is invoked directly +by "loadpaths" when the CLI boots.

      @@ -57,6 +54,8 @@

      Functions summary

      + +

      Functions

      @@ -64,12 +63,14 @@

      Functions

      run(args)

      - Source + Source
      + +
      diff --git a/docs/stable/Mix.Tasks.Deps.Unlock.html b/docs/stable/Mix.Tasks.Deps.Unlock.html index cf90c64ec..e3d24b718 100644 --- a/docs/stable/Mix.Tasks.Deps.Unlock.html +++ b/docs/stable/Mix.Tasks.Deps.Unlock.html @@ -54,6 +54,8 @@

      Functions summary

      + +

      Functions

      @@ -67,6 +69,8 @@

      Functions

      + +
      diff --git a/docs/stable/Mix.Tasks.Deps.Update.html b/docs/stable/Mix.Tasks.Deps.Update.html index 1b02de7cd..349e3be93 100644 --- a/docs/stable/Mix.Tasks.Deps.Update.html +++ b/docs/stable/Mix.Tasks.Deps.Update.html @@ -57,6 +57,8 @@

      Functions summary

      + +

      Functions

      @@ -70,6 +72,8 @@

      Functions

      + +
      diff --git a/docs/stable/Mix.Tasks.Deps.html b/docs/stable/Mix.Tasks.Deps.html index 0f6615bb9..c0733bdea 100644 --- a/docs/stable/Mix.Tasks.Deps.html +++ b/docs/stable/Mix.Tasks.Deps.html @@ -60,6 +60,8 @@

      Functions summary

      + +

      Functions

      @@ -73,6 +75,8 @@

      Functions

      + +
      diff --git a/docs/stable/Mix.Tasks.Do.html b/docs/stable/Mix.Tasks.Do.html index 87d35adf4..2c6b906fe 100644 --- a/docs/stable/Mix.Tasks.Do.html +++ b/docs/stable/Mix.Tasks.Do.html @@ -61,6 +61,8 @@

      Functions summary

      + +

      Functions

      @@ -74,6 +76,8 @@

      Functions

      + +
      diff --git a/docs/stable/Mix.Tasks.Escriptize.html b/docs/stable/Mix.Tasks.Escriptize.html new file mode 100644 index 000000000..b30333f2b --- /dev/null +++ b/docs/stable/Mix.Tasks.Escriptize.html @@ -0,0 +1,95 @@ + + + + Mix.Tasks.Escriptize + + + + + + + + + + + + +
      +

      + Mix.Tasks.Escriptize + +

      + + +
      +

      Generates an escript for the project.

      + +

      The following options can be specified in your mix.exs file:

      + +
        +
      • escript_name - the name of the generated escript +Defaults to project name

      • +
      • escript_main_module - the module containing the main/1 function. +Defaults to Project

      • +
      • escript_embed_elixir - if true embed elixir in the escript file. +Defaults to true

      • +
      • escript_embed_extra_apps - embed additional Elixir applications +if escript_embed_elixir is true. +Defaults to []

      • +
      • escript_shebang +Defaults to "#! /usr/bin/env escript\n"

      • +
      • escript_comment +Defaults to "%%\n"

      • +
      • escript_emu_args - emulator arguments to embed in the escript file +Defaults to "%%!\n"

      • +
      + +
      + + + Source + + + + + + +

      Functions summary

      + + + + + + + + +
      +

      Functions

      +
      +

      + run(args) +

      +
      + Source +
      +
      + + + + + +
      + + diff --git a/docs/stable/Mix.Tasks.Help.html b/docs/stable/Mix.Tasks.Help.html index 9d19d553f..7dc5a8610 100644 --- a/docs/stable/Mix.Tasks.Help.html +++ b/docs/stable/Mix.Tasks.Help.html @@ -61,6 +61,8 @@

      Functions summary

      + +

      Functions

      @@ -74,6 +76,8 @@

      Functions

      + +
      diff --git a/docs/stable/Mix.Tasks.Iex.html b/docs/stable/Mix.Tasks.Iex.html index 4b8b928c9..bde71a0b6 100644 --- a/docs/stable/Mix.Tasks.Iex.html +++ b/docs/stable/Mix.Tasks.Iex.html @@ -29,8 +29,8 @@

      Starts an iex repl with your project settings.

      -

      Elixir ensures your code is compiled and loaded -before starting IEx.

      +

      Before starting IEx, it invokes the prepare task +which defaults to compile and load your project.

      @@ -56,6 +56,8 @@

      Functions summary

      + +

      Functions

      @@ -69,6 +71,8 @@

      Functions

      + +
      diff --git a/docs/stable/Mix.Tasks.Loadpaths.html b/docs/stable/Mix.Tasks.Loadpaths.html index 11c914bf2..3b0d5ab4a 100644 --- a/docs/stable/Mix.Tasks.Loadpaths.html +++ b/docs/stable/Mix.Tasks.Loadpaths.html @@ -63,11 +63,13 @@

      Functions summary

      + +

      Functions

      - run(_) + run(args)

      Source @@ -76,6 +78,8 @@

      Functions

      + +
      diff --git a/docs/stable/Mix.Tasks.Local.Install.html b/docs/stable/Mix.Tasks.Local.Install.html index 9ac7d4196..627f47f26 100644 --- a/docs/stable/Mix.Tasks.Local.Install.html +++ b/docs/stable/Mix.Tasks.Local.Install.html @@ -64,6 +64,8 @@

      Functions summary

      + +

      Functions

      @@ -77,6 +79,8 @@

      Functions

      + +
      diff --git a/docs/stable/Mix.Tasks.Local.Uninstall.html b/docs/stable/Mix.Tasks.Local.Uninstall.html index e23bda7a6..1e6ffc217 100644 --- a/docs/stable/Mix.Tasks.Local.Uninstall.html +++ b/docs/stable/Mix.Tasks.Local.Uninstall.html @@ -56,6 +56,8 @@

      Functions summary

      + +

      Functions

      @@ -69,6 +71,8 @@

      Functions

      + +
      diff --git a/docs/stable/Mix.Tasks.Local.html b/docs/stable/Mix.Tasks.Local.html index bb8b730c0..f9eee6719 100644 --- a/docs/stable/Mix.Tasks.Local.html +++ b/docs/stable/Mix.Tasks.Local.html @@ -53,6 +53,8 @@

      Functions summary

      + +

      Functions

      @@ -66,6 +68,8 @@

      Functions

      + +
      diff --git a/docs/stable/Mix.Tasks.New.html b/docs/stable/Mix.Tasks.New.html index 3b6d936ad..18b56df2d 100644 --- a/docs/stable/Mix.Tasks.New.html +++ b/docs/stable/Mix.Tasks.New.html @@ -33,10 +33,9 @@

      mix new PATH [--app APP] [--module MODULE]
       
      -

      A project with the given path name will be created, -unless --app is given, allowing you to set the app -name or the --module is given configuring the module -name.

      +

      A project at the given PATH will be created. The +application name and module name will be retrieved +from the path, unless -app or --module is given.

      Examples

      @@ -72,6 +71,8 @@

      Functions summary

      + +

      Functions

      @@ -79,12 +80,14 @@

      Functions

      run(argv)

      - Source + Source
      + +
      diff --git a/docs/stable/Mix.Tasks.Run.html b/docs/stable/Mix.Tasks.Run.html index acb3edadf..b5e151e46 100644 --- a/docs/stable/Mix.Tasks.Run.html +++ b/docs/stable/Mix.Tasks.Run.html @@ -29,6 +29,9 @@

      Run the given expression in the application context.

      +

      Before running the code, it invokes the prepare task +which defaults to compile and load your project.

      +

      Examples

      mix run Hello.world
      @@ -59,6 +62,8 @@ 

      Functions summary

      + +

      Functions

      @@ -66,12 +71,14 @@

      Functions

      run(args)

      - Source + Source
      + +
      diff --git a/docs/stable/Mix.Tasks.Test.html b/docs/stable/Mix.Tasks.Test.html index 3d822553c..257556357 100644 --- a/docs/stable/Mix.Tasks.Test.html +++ b/docs/stable/Mix.Tasks.Test.html @@ -33,7 +33,11 @@

      should do all testing setup and then require all files that matches the given test_pattern in parallel.

      -

      It ensures the project is compiled before executing.

      +

      Before running tests, it invokes the prepare task +which defaults to compile and load your project.

      + +

      A list of files can be given after the task name in +order to select the files to compile.

      Configuration

      @@ -68,19 +72,23 @@

      Functions summary

      + +

      Functions

      - run(_) + run(args)

      - Source + Source
      + +

      diff --git a/docs/stable/Mix.Utils.html b/docs/stable/Mix.Utils.html index 5544255f6..ecc4fbfb6 100644 --- a/docs/stable/Mix.Utils.html +++ b/docs/stable/Mix.Utils.html @@ -72,6 +72,21 @@

      Functions summary

      config_merge/2 +
    1813. + + exclude_files/1 + +
    1814. +
    1815. + + extract_files/2 + +
    1816. +
    1817. + + extract_files/3 + +
    1818. module_name_to_command/2 @@ -104,6 +119,8 @@

      Functions summary

      + +

      Functions

      @@ -117,7 +134,7 @@

      Examples

      Mix.Utils.camelize "foo_bar" #=> "FooBar"
       
      - Source + Source

      command_to_module(command, at // Elixir) @@ -135,7 +152,7 @@

      Examples

      #=> { :module, Mix.Tasks.Compile }
      - Source + Source
    1819. command_to_module_name(s) @@ -148,7 +165,7 @@

      Examples

      #=> "Compile.Elixir"
      - Source + Source

      config_merge(old, new) @@ -156,7 +173,34 @@

      Examples

      Merges two configs recursively, merging keyword lists and concatenating normal lists.

      - Source + Source +
      +

      + exclude_files(files) +

      +

      Filtering out files which start with "."

      +
      + Source +
      +

      + extract_files(paths, exts) +

      +

      Extract the files from the given paths with +the given extension. +It ignores files which start with "."

      +
      + Source +
      +

      + extract_files(paths, files, exts) +

      +

      Extract the files from the given paths with +the given extension in case files is an empty +array. If not, get the common subset between +files and the extracted files. +It ignores files which start with "."

      +
      + Source

      module_name_to_command(module, nesting // 0) @@ -174,7 +218,7 @@

      Examples

      #=> "compile.elixir"
      - Source + Source

      source(module) @@ -189,16 +233,21 @@

      Examples

      Returns true if any of target is stale compared to source. If target or source is a binary, it is expanded using File.wildcard.

      - Source + Source

      - underscore(arg1) + underscore(atom)

      -

      Converts the given string to underscore format.

      +

      Converts the given atom or binary to underscore format.

      + +

      If an atom is given, it is assumed to be an Elixir module, +so it is converted to a binary and then processed.

      Examples

      -
      Mix.Utils.underscore "FooBar" #=> "foo_bar"
      +
      Mix.Utils.underscore "FooBar"  #=> "foo_bar"
      +Mix.Utils.underscore "Foo.Bar" #=> "foo/bar"
      +Mix.Utils.underscore Foo.Bar   #=> "foo/bar"
       

      In general, underscore can be thought as the reverse of @@ -208,7 +257,7 @@

      Examples

      Mix.Utils.camelize "sap_example" #=> "SapExample"
      - Source + Source

      user_home() @@ -221,6 +270,8 @@

      Examples

      + +
      diff --git a/docs/stable/Mix.html b/docs/stable/Mix.html index ec81e79ff..53c298baf 100644 --- a/docs/stable/Mix.html +++ b/docs/stable/Mix.html @@ -50,6 +50,16 @@

      Functions summary

      • + + env/0 + +
      • +
      • + + env/1 + +
      • +
      • loadpaths/0 @@ -81,26 +91,43 @@

        Functions summary

        + +

        Functions

        +

        + env() +

        +

        Returns the mix environment.

        +
        + Source +
        +

        + env(env) +

        +

        Changes the current mix env. Project configuration loaded +per environment is not going to be reloaded.

        +
        + Source +

        loadpaths()

        Starts mix and loads the project and dependencies into one step. Useful when invoking mix from an external tool.

        - Source + Source

        project()

        Retrieves the current project configuration. If there isn't a project defined, this function will simply -return an empty keywords list. This allows many mix +return an empty keyword list. This allows many mix tasks to work without a need for an underlying project.

        - Source + Source

        shell() @@ -112,14 +139,14 @@

        Functions

        allow developers to use a test shell, that simply sends the messages to the current process.

        - Source + Source

        shell(shell)

        Sets the current shell.

        - Source + Source

        start() @@ -132,6 +159,8 @@

        Functions

        + +
        diff --git a/docs/stable/Module.html b/docs/stable/Module.html index 7139589cf..519f6ba73 100644 --- a/docs/stable/Module.html +++ b/docs/stable/Module.html @@ -50,27 +50,22 @@

        Functions summary

        @@ -135,31 +150,11 @@

        Functions summary

        + +

        Functions

        -

        - add_attribute(module, key, value) -

        -

        Adds an Erlang attribute to the given module with the given -key and value. The semantics of adding the attribute depends -if the attribute was registered or not via register_attribute/2.

        - -

        Examples

        - -
        defmodule MyModule do
        -  Module.add_attribute __MODULE__, :custom_threshold_for_lib, 10
        -end
        -
        -
        - Source -
        -

        - add_compile_callback(module, target, fun // :__compiling__) -

        -
        - Source -

        add_doc(module, line, kind, tuple, signature, doc)

        @@ -177,7 +172,7 @@

        Examples

        end
        - Source + Source

        concat(list) @@ -192,7 +187,7 @@

        Examples

        Module.concat [Foo, 'Bar'] #=> Foo.Bar
        - Source + Source

      concat(left, right) @@ -207,7 +202,42 @@

      Examples

      Module.concat Foo, 'Bar' #=> Foo.Bar
      - Source + Source +
      +

      + create(module, quoted, opts // []) +

      +

      Creates a module with the given name and given by +the given quoted expressions. The line where the module +is defined and its file can be given as options.

      + +

      Examples

      + +
      contents =
      +  quote do
      +    def world, do: true
      +  end
      +
      +Module.create(Hello, contents, __ENV__)
      +
      +Hello.world #=> true
      +
      + +

      Differences with defmodule

      + +

      Module.create works similarly to defmodule and +return the same results. While one could also use +defmodule to define modules dynamically, this +function is preferred when the module body is given +by a quoted expression.

      + +

      Another important distinction is that defmodule +blends into the scope it is invoked, allowing you +to access all variables, imports and requires from +the module. Module.create, on the other hand, creates +a new scope so imports, requires, etc are not inherited.

      +
      + Source

      defines?(module, tuple) @@ -224,7 +254,7 @@

      Examples

      end
      - Source + Source

      defines?(module, tuple, kind) @@ -242,7 +272,7 @@

      Examples

      end
      - Source + Source

      definitions_in(module) @@ -257,7 +287,7 @@

      Examples

      end
      - Source + Source

      definitions_in(module, kind) @@ -274,7 +304,7 @@

      Examples

      end
      - Source + Source

      delete_attribute(module, key) @@ -284,12 +314,12 @@

      Examples

      Examples

      defmodule MyModule do
      -  Module.add_attribute __MODULE__, :custom_threshold_for_lib, 10
      +  Module.put_attribute __MODULE__, :custom_threshold_for_lib, 10
         Module.delete_attribute __MODULE__, :custom_threshold_for_lib
       end
       
      - Source + Source

      eval_quoted(env, quoted, binding // [], opts // []) @@ -319,7 +349,8 @@

      Examples

      This function also accepts a Macro.Env as first argument. This -is useful to evalute the quoted contents inside an existing environment:

      +is useful to evalute the quoted contents inside an existing +environment (considering the environemnt module, line and file):

      defmodule Foo do
         contents = quote do: (def sum(a, b), do: a + b)
      @@ -329,7 +360,28 @@ 

      Examples

      Foo.sum(1, 2) #=> 3
      - Source + Source +
      +

      + get_attribute(module, key) +

      +

      Gets the given attribute from a module. If the attribute +was marked as accumulate with Module.register_attribute, +a list is always returned.

      + +

      Examples

      + +
      defmodule Foo do
      +  Module.put_attribute __MODULE__, :value, 1
      +  Module.get_attribute __MODULE__, :value #=> 1
      +
      +  Module.register_attribute __MODULE__, :value, accumulate: true
      +  Module.put_attribute __MODULE__, :value, 1
      +  Module.get_attribute __MODULE__, :value #=> [1]
      +end
      +
      +
      + Source

      make_overridable(module, tuples) @@ -338,28 +390,38 @@

      Examples

      An overridable function is lazily defined, allowing a developer to customize it.

      - Source + Source
      -

      - read_attribute(module, key) +

      + open?(module)

      -

      Reads the given attribute from a module. If the attribute -was marked as accumulate with Module.register_attribute, -a list is always returned.

      +

      Check if a module is open, i.e. it is currently being defined +and its attributes and functions can be modified.

      +
      + Source +
      +

      + overridable?(module, tuple) +

      +

      Returns true if the given tuple in module is marked as overridable.

      +
      + Source +
      +

      + put_attribute(module, key, value) +

      +

      Puts an Erlang attribute to the given module with the given +key and value. The semantics of putting the attribute depends +if the attribute was registered or not via register_attribute/2.

      Examples

      -
      defmodule Foo do
      -  Module.add_attribute __MODULE__, :value, 1
      -  Module.read_attribute __MODULE__, :value #=> 1
      -
      -  Module.register_attribute __MODULE__, :value, accumulate: true
      -  Module.add_attribute __MODULE__, :value, 1
      -  Module.read_attribute __MODULE__, :value #=> [1]
      +
      defmodule MyModule do
      +  Module.put_attribute __MODULE__, :custom_threshold_for_lib, 10
       end
       
      - Source + Source

      register_attribute(module, new, opts // []) @@ -381,7 +443,7 @@

      Options

      By default, both options are true. Which means that registering an attribute without passing any options will revert the attribute -behavior to exactly the same expected in Erlang.

      +behavior to exactly the same expected in :

      Examples

      @@ -396,7 +458,7 @@

      Examples

      end
      - Source + Source

      safe_concat(list) @@ -415,7 +477,7 @@

      Examples

      #=> List.Chars
      - Source + Source

      safe_concat(left, right) @@ -434,12 +496,27 @@

      Examples

      #=> List.Chars
      - Source + Source +
      +

      + split(module) +

      +

      Split the given module name into binary parts.

      + +

      Examples

      + +
      Module.split Very.Long.Module.Name.And.Even.Longer
      +#=> ["Very", "Long", "Module", "Name", "And", "Even", "Longer"]
      +
      +
      + Source
      + + diff --git a/docs/stable/Node.html b/docs/stable/Node.html index cd64c1d1d..1c967e210 100644 --- a/docs/stable/Node.html +++ b/docs/stable/Node.html @@ -103,6 +103,8 @@

      Functions summary

      + +

      Functions

      @@ -221,6 +223,8 @@

      Functions

      + +
      diff --git a/docs/stable/OptionParser.html b/docs/stable/OptionParser.html index 94c1bda9a..cbf2ff5ef 100644 --- a/docs/stable/OptionParser.html +++ b/docs/stable/OptionParser.html @@ -53,6 +53,8 @@

      Functions summary

      + +

      Functions

      @@ -125,6 +127,8 @@

      Example

      + +
      diff --git a/docs/stable/Orddict.html b/docs/stable/Orddict.html index 13598b58e..e0f10ee22 100644 --- a/docs/stable/Orddict.html +++ b/docs/stable/Orddict.html @@ -1,7 +1,7 @@ - Orddict + OrdDict @@ -21,21 +21,23 @@

      - Orddict + OrdDict

      -

      This module implements a dictionary based that stores items +

      This module implements a dictionary type that stores items as a list of tuples. It is a simple wrapper around Erlang's orddict module -and exposed via the Dict protocol.

      +and exposed via the Dict module.

      + +

      Check the Dict module for examples and documentation.

      - Source + Source @@ -66,6 +68,8 @@

      Functions summary

      + +

      Functions

      @@ -74,7 +78,7 @@

      Functions

      Creates a new empty dict.

      - Source + Source

      new(pairs) @@ -83,11 +87,11 @@

      Functions

      Examples

      -
      Orddict.new [{:b,1},{:a,2}]
      +
      OrdDict.new [{:b,1},{:a,2}]
       #=> [a: 1, b: 2]
       
      - Source + Source

      new(list, transform) @@ -97,16 +101,18 @@

      Examples

      Examples

      -
      Orddict.new ["a", "b"], fn x -> {x, x} end
      +
      OrdDict.new ["a", "b"], fn x -> {x, x} end
       #=> ["a": "a", "b": "b"]
       
      - Source + Source
      + +
      diff --git a/docs/stable/Port.html b/docs/stable/Port.html index ccbec0685..534cb3f37 100644 --- a/docs/stable/Port.html +++ b/docs/stable/Port.html @@ -93,6 +93,8 @@

      Functions summary

      + +

      Functions

      @@ -163,6 +165,8 @@

      Functions

      + +
      diff --git a/docs/stable/Process.html b/docs/stable/Process.html index a5b2588aa..c9d620e54 100644 --- a/docs/stable/Process.html +++ b/docs/stable/Process.html @@ -96,6 +96,21 @@

      Functions summary

      get_keys/1 +
    1820. + + group_leader/0 + +
    1821. +
    1822. + + group_leader/2 + +
    1823. +
    1824. + + info/1 + +
    1825. info/2 @@ -188,6 +203,8 @@

      Functions summary

      + +

      Functions

      @@ -261,7 +278,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#process_flag-2 for more info.

      - Source + Source

      flag(pid, flag, value) @@ -272,14 +289,14 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#process_flag-3 for more info.

      - Source + Source
    1826. get()

      Returns all key-values in the dictionary with no specific ordering (i.e. they are -not a keywords list).

      +not a keyword list).

      Source
      @@ -296,6 +313,31 @@

      Examples

      Returns all keys that have the given value.

      Source +
      +

      + group_leader() +

      +

      Returns the pid of the group leader for the process which evaluates the function.

      +
      + Source +
      +

      + group_leader(leader, pid) +

      +

      Sets the group leader of Pid to GroupLeader. Typically, this is used when a processes +started from a certain shell should have another group leader than :init.

      +
      + Source +
      +

      + info(pid) +

      +

      Returns information about the process identified by pid. +Use this only for debugging information.

      + +

      See http://www.erlang.org/doc/man/erlang.html#process_info-1 for more info.

      +
      + Source

      info(pid, spec) @@ -305,7 +347,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#process_info-2 for more info.

      - Source + Source

      link(pid) @@ -349,7 +391,7 @@

      Examples

      Source

      - register(name, pid) + register(pid, name)

      Associates the name with a pid or a port identifier. name, which must be an atom, can be used instead of the pid / port identifier in the @@ -364,7 +406,7 @@

      Examples

      Returns a list of names which have been registered using register/2.

      - Source + Source

      self() @@ -466,6 +508,8 @@

      Examples

      + +
      diff --git a/docs/stable/Protocol.UndefinedError.html b/docs/stable/Protocol.UndefinedError.html index 98e455500..3f5cd15dd 100644 --- a/docs/stable/Protocol.UndefinedError.html +++ b/docs/stable/Protocol.UndefinedError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -105,6 +105,11 @@

      Functions summary

      to_keywords/1 +
    1827. + + update/2 + +
    1828. update_protocol/2 @@ -122,6 +127,8 @@

      Functions summary

      + +

      Functions

      @@ -129,78 +136,86 @@

      Functions

      exception(args)

      - Source + Source

      exception(args, self)

      - Source + Source

      message(exception)

      - Source + Source

      new()

      - Source + Source

      new(opts)

      - Source + Source

      protocol(record)

      - Source + Source

      protocol(value, record)

      - Source + Source

      structure(record)

      - Source + Source

      structure(value, record)

      - Source + Source

      to_keywords(record)

      - Source + Source +
      +

      + update(keywords, record) +

      +
      + Source

      update_protocol(function, record)

      - Source + Source

      update_structure(function, record)

      - Source + Source
      + +
    1829. diff --git a/docs/stable/Range.Iterator.Number.html b/docs/stable/Range.Iterator.Number.html index 7bf6fdb11..0c1fe9718 100644 --- a/docs/stable/Range.Iterator.Number.html +++ b/docs/stable/Range.Iterator.Number.html @@ -29,48 +29,20 @@

      - Source + Source -

      Functions summary

      - -
      -

      Functions

      -
      -

      - count(first, arg2) -

      -
      - Source -
      -

      - iterator(first, arg2) -

      -
      - Source -
      -
      + diff --git a/docs/stable/Range.Iterator.html b/docs/stable/Range.Iterator.html index ee8baa9b1..5527b3806 100644 --- a/docs/stable/Range.Iterator.html +++ b/docs/stable/Range.Iterator.html @@ -29,7 +29,7 @@

      - Source + Source

      Implementations

      @@ -66,18 +66,20 @@

      Functions summary

      + +

      Functions

      - count(xA, xB) + count(first, range)

      Count how many items are in the range.

      - Source + Source

      - iterator(xA, xB) + iterator(first, range)

      How to iterate the range, receives the first and range as arguments. It needs to return a @@ -85,12 +87,14 @@

      Functions

      a tuple with two elements: the given item and the next item in the iteration.

      - Source + Source
      + + diff --git a/docs/stable/Range.html b/docs/stable/Range.html index 19576c884..24fa0c8d9 100644 --- a/docs/stable/Range.html +++ b/docs/stable/Range.html @@ -28,6 +28,11 @@

      +
      +

      Defines a Range.

      + +
      + Source @@ -60,16 +65,51 @@

      Functions summary

      first/1 +
    1830. + + first/2 + +
    1831. last/1
    1832. +
    1833. + + last/2 + +
    1834. +
    1835. + + new/0 + +
    1836. new/1
    1837. +
    1838. + + to_keywords/1 + +
    1839. +
    1840. + + update/2 + +
    1841. +
    1842. + + update_first/2 + +
    1843. +
    1844. + + update_last/2 + +
    1845. @@ -77,39 +117,77 @@

      Functions summary

      + +

      Functions

      - first(range) + first(record)

      -

      Returns the first item of the range.

      -
      - Source +
      + Source +
      +

      + first(value, record) +

      +
      + Source

      - last(range) + last(record)

      -

      Returns the last item of the range.

      -
      - Source +
      + Source +
      +

      + last(value, record) +

      +
      + Source +
      +

      + new() +

      +
      + Source

      - new(options) + new(opts)

      -

      Returns a new range based on the given options.

      - -

      Examples

      - -
      Range.new first: 1, last: 10
      -
      -
      - Source +
      + Source +
      +

      + to_keywords(record) +

      +
      + Source +
      +

      + update(keywords, record) +

      +
      + Source +
      +

      + update_first(function, record) +

      +
      + Source +
      +

      + update_last(function, record) +

      +
      + Source
      + + diff --git a/docs/stable/Record.html b/docs/stable/Record.html index 7d0015e8a..ad46fb822 100644 --- a/docs/stable/Record.html +++ b/docs/stable/Record.html @@ -27,7 +27,7 @@

      -

      Functions to define and interact with Erlang records

      +

      Functions to define Elixir records

      @@ -43,7 +43,12 @@

      Functions summary

      • - access/4 + deffunctions/3 + +
      • +
      • + + defmacros/3
      • @@ -63,26 +68,80 @@

        Functions summary

        + +

        Functions

        -

        - access(caller, atom, fields, keyword) +

        + deffunctions(values, opts // [], env)

        -

        Implements the access macro used by records. -It returns a quoted expression that represents -the access given by the keywords.

        +

        Defines record functions skipping the module definition. +This is called directly by defrecord. It expects the +module environment, the module values and a keyword list +of options.

        + +

        Examples

        + +
        defmodule CustomRecord do
        +  Record.deffunctions [:name, :age], __ENV__
        +end
        +
        - Source + Source +
        +

        + defmacros(name, values, env) +

        +

        Defines three macros for reading and writing records values. +These macros are private to the current module and are +basically a simple mechanism for manipulating tuples when +there isn't an interest in exposing the record as a whole. +In some ways, it is similar to Erlang records, since it is +only available at compilation time.

        + +

        Examples

        + +
        defmodule CustomModule do
        +  Record.defmacros :_user, [:name, :age], __ENV__
        +
        +  def new(name, age) do
        +    _user(name: name, age: age)
        +  end
        +
        +  def name(user, name) do
        +    _user(user, name: name)
        +  end
        +
        +  def age(user) do
        +    _user(user, :age)
        +  end
        +
        +  def to_keywords(user) do
        +    _user(user)
        +  end
        +
        +  def name_and_age(user) do
        +   _user(user, [:name, :age])
        +  end
        +
        +  def age_and_name(user) do
        +   _user(user, [:age, :name])
        +  end
        +end
        +
        +
        + Source

        defrecord(name, values, opts)

        -

        Main entry point for records definition. -This is invoked directly by Kernel.defrecord. -Returns the quoted expression of a module given by name.

        +

        Main entry point for records definition. It defines a module +with the given name and the fields specified in modules. +This is invoked directly by Kernel.defrecord, so check it +for more information and documentation.

        - Source + Source

        extract(name, opts) @@ -101,6 +160,8 @@

        Examples

        + +
        diff --git a/docs/stable/Regex.CompileError.html b/docs/stable/Regex.CompileError.html index d34a75700..04db72f15 100644 --- a/docs/stable/Regex.CompileError.html +++ b/docs/stable/Regex.CompileError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -84,6 +84,11 @@

        Functions summary

        to_keywords/1
      • +
      • + + update/2 + +
      • update_message/2 @@ -96,6 +101,8 @@

        Functions summary

        + +

        Functions

        @@ -103,54 +110,62 @@

        Functions

        exception(args)

        - Source + Source

        exception(args, self)

        - Source + Source

        message(record)

        - Source + Source

        message(value, record)

        - Source + Source

        new()

        - Source + Source

        new(opts)

        - Source + Source

        to_keywords(record)

        - Source + Source +
        +

        + update(keywords, record) +

        +
        + Source

        update_message(function, record)

        - Source + Source
        + + diff --git a/docs/stable/Regex.html b/docs/stable/Regex.html index 45ecb468d..0d76f3a26 100644 --- a/docs/stable/Regex.html +++ b/docs/stable/Regex.html @@ -57,6 +57,7 @@

      • firstline (f) - forces the unanchored pattern to match before or at the first newline, though the matched text may continue over the newline
      • ungreedy (r) - invert the "greediness" of the regexp
      • +
      • groups (g) - compile with info about groups available

      The options not available are:

      @@ -86,6 +87,11 @@

      Functions summary

      • + + captures/3 + +
      • +
      • compile/2 @@ -95,6 +101,11 @@

        Functions summary

        compile!/2
      • +
      • + + groups/1 + +
      • index/2 @@ -122,22 +133,17 @@

        Functions summary

      • - replace/3 + replace/4
      • - replace_all/3 + run/3
      • - run/2 - -
      • -
      • - - scan/2 + scan/3
      • @@ -157,9 +163,23 @@

        Functions summary

        + +

        Functions

        +

        + captures(regex, string, options // []) +

        +

        Returns the given captures as a list of tuples.

        + +

        Examples

        + +
        Regex.captures %r/c(?<foo>d)/g, "abcd"  #=> [{:foo, ["d"]}]
        +
        +
        + Source +

        compile(source, options // "")

        @@ -168,7 +188,7 @@

        Functions

        It returns { :ok, regex } in case of success, { :error, reason } otherwise.

        - Source + Source

        compile!(source, options // "") @@ -176,7 +196,19 @@

        Functions

        Compiles the regular expression according to the given options. Fails with Regex.CompileError if the regex cannot be compiled.

        - Source + Source +
        +

        + groups(arg1) +

        +

        Returns list of named groups in regex.

        + +

        Examples

        + +
        Regex.groups %r/(?<foo>foo)/g #=> ["foo"]
        +
        +
        + Source

        index(arg1, string) @@ -191,7 +223,7 @@

        Examples

        Regex.index %r/e/, "abcd" #=> nil
        - Source + Source

        indexes(arg1, string) @@ -207,7 +239,7 @@

        Examples

        Regex.indexes %r/e/, "abcd" #=> nil
        - Source + Source

        match?(arg1, string) @@ -220,7 +252,7 @@

        Examples

        Regex.match? %r/foo/, "bar" #=> false
        - Source + Source

        opts(arg1) @@ -232,23 +264,25 @@

        Examples

        Regex.opts %r(foo)m #=> 'm'
         
        - Source + Source

        re_pattern(arg1)

        Returns the underlying re_pattern in the regular expression.

        - Source + Source
        -

        - replace(arg1, string, replacement) +

        + replace(arg1, string, replacement, options // [])

        -

        Receives a string and a replacement and returns a string where the -first match of the regular expressions is replaced by replacement. -Inside the replacement, you can either give "&" to access the whole -regular expression or \N, where N is in integer to access an specific -matching parens.

        +

        Receives a regex, a binary and a replacement and returns a new +binary where the all matches are replaced by replacement.

        + +

        Inside the replacement, you can either give "&" to access the +whole regular expression or \N, where N is in integer to access +a specific matching parens. You can also set global to false +if you want to replace just the first occurrence.

        Examples

        @@ -259,19 +293,10 @@

        Examples

        Regex.replace(%r/(b)/, "abc", "[\\1]") #=> "a[b]c"
        - Source -
        -

        - replace_all(arg1, string, replacement) -

        -

        The same as replace, but replaces all parts where the regular -expressions matches in the string. Please read replace/3 for -documentation and examples.

        -
        - Source + Source
        -

        - run(arg1, string) +

        + run(regex, string, options // [])

        Runs the regular expression against the given string. It returns a list with all matches or nil if no match ocurred.

        @@ -282,10 +307,10 @@

        Examples

        Regex.run %r/e/, "abcd" #=> nil
        - Source + Source
        -

        - scan(arg1, string) +

        + scan(regex, string, options // [])

        Same as run, but scans the target several times collecting all matches of the regular expression. A list is returned with each match. If the item in @@ -299,7 +324,7 @@

        Examples

        Regex.scan %r/e/, "abcd" #=> []
        - Source + Source

        source(arg1) @@ -311,20 +336,22 @@

        Examples

        Regex.source %r(foo) #=> "foo"
         
        - Source + Source

        - split(arg1, string, parts // :infinity) + split(regex, string, options // [])

        -

        Split the given target in the number of parts specified. If no ammount -of parts is given, it defaults to :infinity.

        +

        Split the given target in the number of parts specified. +If no ammount of parts is given, it defaults to :infinity.

        - Source + Source
        + + diff --git a/docs/stable/RuntimeError.html b/docs/stable/RuntimeError.html index 46064cdce..2ccdfdec5 100644 --- a/docs/stable/RuntimeError.html +++ b/docs/stable/RuntimeError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -84,6 +84,11 @@

        Functions summary

        to_keywords/1
      • +
      • + + update/2 + +
      • update_message/2 @@ -96,6 +101,8 @@

        Functions summary

        + +

        Functions

        @@ -103,54 +110,62 @@

        Functions

        exception(args)

        - Source + Source

        exception(args, self)

        - Source + Source

        message(record)

        - Source + Source

        message(value, record)

        - Source + Source

        new()

        - Source + Source

        new(opts)

        - Source + Source

        to_keywords(record)

        - Source + Source +
        +

        + update(keywords, record) +

        +
        + Source

        update_message(function, record)

        - Source + Source
        + + diff --git a/docs/stable/String.html b/docs/stable/String.html new file mode 100644 index 000000000..665f5d55b --- /dev/null +++ b/docs/stable/String.html @@ -0,0 +1,357 @@ + + + + String + + + + + + + + + + + + +
        +

        + String + +

        + + +
        +

        A string in Elixir is a utf-8 binary. This module +contains function to work with utf-8 data and its +codepoints.

        + +

        For working with raw binaries, use Erlang's :binary +module.

        + +
        + + + Source + + + + + + +

        Functions summary

        + + + + + + + + +
        +

        Functions

        +
        +

        + at(string, position) +

        +

        Returns the codepoint in the position of the given utf8 string. +If position is greater than string length, than it returns nil.

        + +

        Examples

        + +
        String.at("elixir", 0) #=> "1"
        +String.at("elixir", 1) #=> "l"
        +String.at("elixir", 10) #=> nil
        +String.at("elixir", -1) #=> "r"
        +String.at("elixir", -10) #=> "nil"
        +
        +
        + Source +
        +

        + codepoints(string) +

        +

        Returns a list with codepoints from an utf8 string.

        + +

        Examples

        + +
        String.codepoints("josé")         #=> ["j", "o", "s", "é"]
        +String.codepoints("оптими зации") #=> ["о","п","т","и","м","и"," ","з","а","ц","и","и"]
        +String.codepoints("ἅἪῼ")          #=> ["ἅ","Ἢ","ῼ"]
        +
        +
        + Source +
        +

        + downcase(arg1) +

        +

        Convert all characters on the given string to down case.

        + +

        Examples

        + +
        String.downcase("ABCD") #=> "abcd"
        +String.downcase("AB 123 XPTO") #=> "ab 123 xpto"
        +String.downcase("JOSÉ") #=> "josé"
        +
        +
        + Source +
        +

        + duplicate(subject, n) +

        +

        Returns a binary subject duplicated n times.

        + +

        Examples

        + +
        String.duplicate("abc", 1) #=> "abc"
        +String.duplicate("abc", 2) #=> "abcabc"
        +
        +
        + Source +
        +

        + first(string) +

        +

        Returns the first codepoint from an utf8 string.

        + +

        Examples

        + +
        String.first("elixir")  #=> "e"
        +String.first("եոգլի") #=> "ե"
        +
        +
        + Source +
        +

        + last(string) +

        +

        Returns the last codepoint from an utf8 string.

        + +

        Examples

        + +
        String.last("elixir")  #=> "r"
        +String.last("եոգլի") #=> "ի"
        +
        +
        + Source +
        +

        + length(string) +

        +

        Returns the number of codepoint in an utf8 string.

        + +

        Examples

        + +
        String.length("elixir")  #=> 6
        +String.length("եոգլի") #=> 5
        +
        +
        + Source +
        +

        + lstrip(string, char // 32) +

        +

        Returns a string where leading char have been +removed. If no char is passed spaceis used.

        + +

        Examples

        + +
        String.lstrip("   abc  ")       #=> "abc  "
        +String.lstrip("_  abc  _", ?_)  #=> "  abc  _"
        +
        +
        + Source +
        +

        + printable?(arg1) +

        +

        Checks if a string is printable considering it is encoded +as UTF-8. Returns true if so, false otherwise.

        + +

        Examples

        + +
        String.printable?("abc") #=> true
        +
        +
        + Source +
        +

        + replace(subject, pattern, replacement, options // []) +

        +

        Returns a new binary based on subject by replacing the parts +matching pattern for replacement. If options is specified +with [global: true], then it will replace all matches, otherwise +it will replace just the first one.

        + +

        For the replaced part must be used in replacement, then the +position or the positions where it is to be inserted must be specified by using +the option insert_replaced.

        + +

        Examples

        + +
        String.replace("a,b,c", ",", "-") #=> "a-b-c"
        +String.replace("a,b,c", ",", "-", global: false) #=> "a-b,c"
        +String.replace("a,b,c", "b", "[]", insert_replaced: 1) #=> "a,[b],c"
        +String.replace("a,b,c", ",", "[]", insert_replaced: 2) #=> "a[],b[],c"
        +String.replace("a,b,c", ",", "[]", insert_replaced: [1,1]) #=> "a[,,]b[,,]c"
        +
        +
        + Source +
        +

        + rstrip(string, char // 32) +

        +

        Returns a string where trailing char have been +removed. If no char is passed spaceis used.

        + +

        Examples

        + +
        String.rstrip("   abc  ")      #=> "   abc"
        +String.rstrip("   abc _", ?_)  #=> "   abc "
        +
        +
        + Source +
        +

        + split(binary, pattern // " ", options // []) +

        +

        Divides a string into sub string based on a pattern, +returning a list of these sub string. The pattern can +be a string, a list of strings or a regular expression.

        + +

        The string is split into two parts by default, unless +global option is true. If a pattern is not specified, +the string is split on whitespace occurrences.

        + +

        It returns a list with the original string if the pattern +can't be matched.

        + +

        Examples

        + +
        String.split("a,b,c", ",")  #=> ["a", "b", "c"]
        +String.split("a,b,c", ",", global: false)  #=> ["a", "b,c"]
        +
        +String.split("foo bar")     #=> ["foo", "bar"]
        +String.split("1,2 3,4", [" ", ","]) #=> ["1", "2", "3", "4"]
        +
        +String.split("a,b,c", %r{,}) #=> ["a", "b", "c"]
        +String.split("a,b,c", %r{,}, global: false)  #=> ["a", "b,c"]
        +String.split("a,b", %r{.})   #=> ["a,b"]
        +
        +
        + Source +
        +

        + strip(string, char // 32) +

        +

        Returns a string where leading/trailing char have been +removed. If no char is passed spaceis used.

        + +

        Examples

        + +
        String.strip("   abc  ")       #=> "abc"
        +String.strip("a  abc  a", ?a)  #=> "  abc  "
        +
        +
        + Source +
        +

        + upcase(arg1) +

        +

        Convert all characters on the given string to upper case.

        + +

        Examples

        + +
        String.upcase("abcd") #=> "ABCD"
        +String.upcase("ab 123 xpto") #=> "AB 123 XPTO"
        +String.upcase("josé") #=> "JOSÉ"
        +
        +
        + Source +
        +
        + + + + + +
        + + diff --git a/docs/stable/SyntaxError.html b/docs/stable/SyntaxError.html index 8d1925949..742e6a727 100644 --- a/docs/stable/SyntaxError.html +++ b/docs/stable/SyntaxError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -39,19 +39,19 @@

        Fields (and defaults)

      • - description: "syntax error" + file: nil
      • - file: nil + line: nil
      • - line: nil + description: "syntax error"
      • @@ -121,6 +121,11 @@

        Functions summary

        to_keywords/1 +
      • + + update/2 + +
      • update_description/2 @@ -143,6 +148,8 @@

        Functions summary

        + +

        Functions

        @@ -150,96 +157,104 @@

        Functions

        description(record)

        - Source + Source

        description(value, record)

        - Source + Source

        exception(args)

        - Source + Source

        exception(args, self)

        - Source + Source

        file(record)

        - Source + Source

        file(value, record)

        - Source + Source

        line(record)

        - Source + Source

        line(value, record)

        - Source + Source

        message(exception)

        - Source + Source

        new()

        - Source + Source

        new(opts)

        - Source + Source

        to_keywords(record)

        - Source + Source +
        +

        + update(keywords, record) +

        +
        + Source

        update_description(function, record)

        - Source + Source

        update_file(function, record)

        - Source + Source

        update_line(function, record)

        - Source + Source
        + + diff --git a/docs/stable/System.html b/docs/stable/System.html index 5e3e1a499..b8e219696 100644 --- a/docs/stable/System.html +++ b/docs/stable/System.html @@ -110,6 +110,8 @@

        Functions summary

        + +

        Functions

        @@ -118,7 +120,7 @@

        Functions

        Returns the list of command-line arguments passed to the program.

        - Source + Source

        at_exit(fun) @@ -130,17 +132,14 @@

        Functions

        The function must expect the exit status code as argument.

        - Source + Source

        build_info()

        -

        Returns a tuple { Elixir version, commit sha-1, build date }.

        - -

        The format of the return value may change in a future release. Please -make sure your code doesn't depend on it.

        +

        Returns a keywords list with version, git tag info and date.

        - Source + Source

        cmd(command) @@ -152,7 +151,7 @@

        Functions

        If command is a char list, a char list is returned. Returns a binary otherwise.

        - Source + Source

        find_executable(command) @@ -164,7 +163,7 @@

        Functions

        If command is a char list, a char list is returned. Returns a binary otherwise.

        - Source + Source

        get_env() @@ -173,7 +172,7 @@

        Functions

        given as a single string of the format "VarName=Value", where VarName is the name of the variable and Value its value.

        - Source + Source

        get_env(varname) @@ -182,7 +181,7 @@

        Functions

        varname as a binary, or nil if the environment variable is undefined.

        - Source + Source

        get_pid() @@ -192,7 +191,7 @@

        Functions

        See http://www.erlang.org/doc/man/os.html#getpid-0 for more info.

        - Source + Source

        put_env(dict) @@ -200,21 +199,21 @@

        Functions

        Sets a new value for each environment variable corresponding to each key in dict.

        - Source + Source

        put_env(varname, value)

        Sets a new value for the environment variable varname.

        - Source + Source

        stacktrace()

        Get the stacktrace.

        - Source + Source

        version() @@ -227,6 +226,8 @@

        Functions

        + +
        diff --git a/docs/stable/SystemLimitError.html b/docs/stable/SystemLimitError.html index 44838f29c..c601d7de2 100644 --- a/docs/stable/SystemLimitError.html +++ b/docs/stable/SystemLimitError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -84,6 +84,11 @@

        Functions summary

        to_keywords/1
      • +
      • + + update/2 + +
      • update_message/2 @@ -96,6 +101,8 @@

        Functions summary

        + +

        Functions

        @@ -103,54 +110,62 @@

        Functions

        exception(args)

        - Source + Source

        exception(args, self)

        - Source + Source

        message(record)

        - Source + Source

        message(value, record)

        - Source + Source

        new()

        - Source + Source

        new(opts)

        - Source + Source

        to_keywords(record)

        - Source + Source +
        +

        + update(keywords, record) +

        +
        + Source

        update_message(function, record)

        - Source + Source
        + + diff --git a/docs/stable/TokenMissingError.html b/docs/stable/TokenMissingError.html index 1d9ef120e..518048f14 100644 --- a/docs/stable/TokenMissingError.html +++ b/docs/stable/TokenMissingError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -39,19 +39,19 @@

        Fields (and defaults)

      • - description: "expression is incomplete" + file: nil
      • - file: nil + line: nil
      • - line: nil + description: "expression is incomplete"
      • @@ -121,6 +121,11 @@

        Functions summary

        to_keywords/1 +
      • + + update/2 + +
      • update_description/2 @@ -143,6 +148,8 @@

        Functions summary

        + +

        Functions

        @@ -150,96 +157,104 @@

        Functions

        description(record)

        - Source + Source

        description(value, record)

        - Source + Source

        exception(args)

        - Source + Source

        exception(args, self)

        - Source + Source

        file(record)

        - Source + Source

        file(value, record)

        - Source + Source

        line(record)

        - Source + Source

        line(value, record)

        - Source + Source

        message(exception)

        - Source + Source

        new()

        - Source + Source

        new(opts)

        - Source + Source

        to_keywords(record)

        - Source + Source +
        +

        + update(keywords, record) +

        +
        + Source

        update_description(function, record)

        - Source + Source

        update_file(function, record)

        - Source + Source

        update_line(function, record)

        - Source + Source
        + + diff --git a/docs/stable/Tuple.html b/docs/stable/Tuple.html index d248ac3e6..9b0c84738 100644 --- a/docs/stable/Tuple.html +++ b/docs/stable/Tuple.html @@ -40,6 +40,10 @@

        + + + + diff --git a/docs/stable/URI.FTP.html b/docs/stable/URI.FTP.html index 27de39a0c..52ed99a34 100644 --- a/docs/stable/URI.FTP.html +++ b/docs/stable/URI.FTP.html @@ -53,6 +53,8 @@

        Functions summary

        + +

        Functions

        @@ -72,6 +74,8 @@

        Functions

        + +
        diff --git a/docs/stable/URI.HTTP.html b/docs/stable/URI.HTTP.html index 3b0d4b01d..04d64bdc3 100644 --- a/docs/stable/URI.HTTP.html +++ b/docs/stable/URI.HTTP.html @@ -53,6 +53,8 @@

        Functions summary

        + +

        Functions

        @@ -72,6 +74,8 @@

        Functions

        + +
        diff --git a/docs/stable/URI.HTTPS.html b/docs/stable/URI.HTTPS.html index 348178ef3..9cc348b3f 100644 --- a/docs/stable/URI.HTTPS.html +++ b/docs/stable/URI.HTTPS.html @@ -53,6 +53,8 @@

        Functions summary

        + +

        Functions

        @@ -72,6 +74,8 @@

        Functions

        + +
        diff --git a/docs/stable/URI.LDAP.html b/docs/stable/URI.LDAP.html index 05e503e68..1e79fbe19 100644 --- a/docs/stable/URI.LDAP.html +++ b/docs/stable/URI.LDAP.html @@ -53,6 +53,8 @@

        Functions summary

        + +

        Functions

        @@ -72,6 +74,8 @@

        Functions

        + +
        diff --git a/docs/stable/URI.Parser.html b/docs/stable/URI.Parser.html index a415da2e1..2a02c4f7f 100644 --- a/docs/stable/URI.Parser.html +++ b/docs/stable/URI.Parser.html @@ -23,6 +23,8 @@

        URI.Parser + behaviour +

        @@ -40,11 +42,20 @@

        -

        Functions summary

        + + + + +

        Callbacks summary

        • - behaviour_info/1 + default_port/0 + +
        • +
        • + + parse/1
        • @@ -54,19 +65,27 @@

          Functions summary

          -
          -

          Functions

          + + +
          +

          Callbacks

          -

          - behaviour_info(atom1) +

          + default_port() +

          +

          Responsible for returning the default port.

          +
          + Source +
          +

          + parse(uri_info)

          -
          - Source +

          Responsible for parsing extra URL information.

          +
          + Source
          - -
          diff --git a/docs/stable/URI.SFTP.html b/docs/stable/URI.SFTP.html index 0c58261db..56ed7c888 100644 --- a/docs/stable/URI.SFTP.html +++ b/docs/stable/URI.SFTP.html @@ -53,6 +53,8 @@

          Functions summary

          + +

          Functions

          @@ -72,6 +74,8 @@

          Functions

          + +
          diff --git a/docs/stable/URI.TFTP.html b/docs/stable/URI.TFTP.html index 7f95f0af5..bc0eabf70 100644 --- a/docs/stable/URI.TFTP.html +++ b/docs/stable/URI.TFTP.html @@ -53,6 +53,8 @@

          Functions summary

          + +

          Functions

          @@ -72,6 +74,8 @@

          Functions

          + +
          diff --git a/docs/stable/URI.html b/docs/stable/URI.html index 9ec853acf..ececf5633 100644 --- a/docs/stable/URI.html +++ b/docs/stable/URI.html @@ -66,6 +66,11 @@

          Functions summary

          parse/1 +
        • + + query_decoder/1 + +
        @@ -73,6 +78,8 @@

        Functions summary

        + +

        Functions

        @@ -81,16 +88,16 @@

        Functions

        Unpercent (URL) decodes a URI.

        - Source + Source

        - decode_query(q, dict // Orddict.new()) + decode_query(q, dict // OrdDict.new())

        Given a query string of the form "key1=value1&key=value2...", produces an orddict with one entry for each key-value pair. Each key and value will be a binary. It also does percent-unescaping of both keys and values.

        -

        Returns nil if the query string is malformed.

        +

        Use decoder/1 if you want to customize or iterate each value manually.

        Source
        @@ -99,7 +106,7 @@

        Functions

        Percent (URL) encodes a URI.

        - Source + Source

        encode_query(l) @@ -132,12 +139,22 @@

        Functions

        for that particular scheme. Take a look at URI.HTTPS for an example of one of these extension modules.

        - Source + Source +
        +

        + query_decoder(q) +

        +

        Returns an iterator function over the query string that decodes +the query string in steps.

        +
        + Source
        + +
        diff --git a/docs/stable/UndefinedFunctionError.html b/docs/stable/UndefinedFunctionError.html index fff6816a5..da4dad5c5 100644 --- a/docs/stable/UndefinedFunctionError.html +++ b/docs/stable/UndefinedFunctionError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -39,7 +39,7 @@

        Fields (and defaults)

      • - arity: nil + module: nil
      • @@ -51,7 +51,7 @@

        Fields (and defaults)

      • - module: nil + arity: nil
      • @@ -121,6 +121,11 @@

        Functions summary

        to_keywords/1 +
      • + + update/2 + +
      • update_arity/2 @@ -143,6 +148,8 @@

        Functions summary

        + +

        Functions

        @@ -150,96 +157,104 @@

        Functions

        arity(record)

        - Source + Source

        arity(value, record)

        - Source + Source

        exception(args)

        - Source + Source

        exception(args, self)

        - Source + Source

        function(record)

        - Source + Source

        function(value, record)

        - Source + Source

        message(exception)

        - Source + Source

        module(record)

        - Source + Source

        module(value, record)

        - Source + Source

        new()

        - Source + Source

        new(opts)

        - Source + Source

        to_keywords(record)

        - Source + Source +
        +

        + update(keywords, record) +

        +
        + Source

        update_arity(function, record)

        - Source + Source

        update_function(function, record)

        - Source + Source

        update_module(function, record)

        - Source + Source
        + + diff --git a/docs/stable/js/full_list.js b/docs/stable/js/full_list.js index 786876676..e1418474d 100644 --- a/docs/stable/js/full_list.js +++ b/docs/stable/js/full_list.js @@ -28,11 +28,6 @@ function fullListSearch() { searchString = this.value; caseSensitiveMatch = searchString.match(/[A-Z]/) != null; regexSearchString = RegExp.escape(searchString); - if (caseSensitiveMatch) { - regexSearchString += "|" + - $.map(searchString.split(''), function(e) { return RegExp.escape(e); }). - join('.+?'); - } if (searchString === "") { clearTimeout(inSearch); inSearch = null; @@ -67,7 +62,7 @@ var lastRowClass = ''; function searchItem() { for (var i = 0; i < searchCache.length / 50; i++) { var item = searchCache[searchIndex]; - var searchName = (searchString.indexOf('::') != -1 ? item.fullName : item.name); + var searchName = (searchString.indexOf('.') != -1 ? item.fullName : item.name); var matchString = regexSearchString; var matchRegexp = new RegExp(matchString, caseSensitiveMatch ? "" : "i"); if (searchName.match(matchRegexp) == null) { diff --git a/docs/stable/modules_list.html b/docs/stable/modules_list.html index f220a82af..528290c64 100644 --- a/docs/stable/modules_list.html +++ b/docs/stable/modules_list.html @@ -16,7 +16,7 @@

        - Elixir v0.6.0 + Elixir v0.7.0

      • +
      • + + delete_path/1 + + Code +
      • +
      • ensure_compiled/1 @@ -239,6 +321,13 @@

        Code

      • +
      • + + ensure_compiled?/1 + + Code +
      • +
      • ensure_loaded/1 @@ -246,6 +335,13 @@

        Code

      • +
      • + + ensure_loaded?/1 + + Code +
      • +
      • eval/3 @@ -302,13 +398,120 @@

        Code

      • +
      • + + unload_files/1 + + Code +
      • + +
      +
    1846. + + + Dict + + Dict +
    1847. +
    1848. - - EEx - + EEx EEx
    1849. @@ -316,9 +519,7 @@

    1850. - - AssignsEngine - + AssignsEngine EEx.AssignsEngine
    1851. @@ -329,9 +530,7 @@

    1852. - - Engine - + Engine EEx.Engine
    1853. @@ -363,9 +562,7 @@

    1854. - - SmartEngine - + SmartEngine EEx.SmartEngine
    1855. @@ -390,9 +587,7 @@

    1856. - - TransformerEngine - + TransformerEngine EEx.TransformerEngine
    1857. @@ -448,9 +643,7 @@

    1858. - - Enum - + Enum Enum
    1859. @@ -471,6 +664,13 @@

      Enum +
    1860. + + at!/2 + + Enum +
    1861. +
    1862. count/1 @@ -478,6 +678,13 @@

      Enum

    1863. +
    1864. + + count/2 + + Enum +
    1865. +
    1866. drop/2 @@ -578,28 +785,28 @@

    1867. - nth!/2 + partition/2 Enum
    1868. - partition/2 + qsort/1 Enum
    1869. - qsort/1 + reduce/3 Enum
    1870. - reduce/3 + reverse/1 Enum
    1871. @@ -613,7 +820,7 @@

    1872. - split_with/2 + split_while/2 Enum
    1873. @@ -646,13 +853,18 @@

      Enum

    1874. +
    1875. + + zip/2 + + Enum +
    1876. +
    1877. - - ExUnit - + ExUnit ExUnit
    1878. @@ -660,9 +872,7 @@

    1879. - - Assertions - + Assertions ExUnit.Assertions
    1880. @@ -771,9 +981,7 @@

    1881. - - Case - + Case ExUnit.Case
    1882. @@ -790,6 +998,13 @@

      +
    1883. + + after_spawn/1 + + ExUnit +
    1884. +
    1885. configure/1 @@ -815,9 +1030,7 @@

    1886. - - Exception - + Exception Exception
    1887. @@ -852,13 +1065,18 @@

      Exception

    1888. +
    1889. + + formatted_stacktrace/1 + + Exception +
    1890. +
    1891. - - File - + File File
    1892. @@ -1110,20 +1328,6 @@

      File -
    1893. - - read_info/2 - - File -
    1894. - -
    1895. - - read_info!/2 - - File -
    1896. -
    1897. regular?/1 @@ -1261,29 +1465,18 @@

    1898. - - GenServer.Behavior - + GenServer.Behaviour - GenServer.Behavior + GenServer.Behaviour
    1899. - - HashDict - + HashDict HashDict
    1900. @@ -1315,9 +1508,7 @@

    1901. - - IEx - + IEx IEx
    1902. @@ -1325,9 +1516,7 @@

    1903. - - Autocomplete - + Autocomplete IEx.Autocomplete
    1904. @@ -1345,9 +1534,7 @@

    1905. - - Helpers - + Helpers IEx.Helpers
    1906. @@ -1363,56 +1550,56 @@

    1907. - d/0 + h/0 IEx.Helpers
    1908. - d/1 + h/1 IEx.Helpers
    1909. - d/2 + h/2 IEx.Helpers
    1910. - d/3 + h/3 IEx.Helpers
    1911. - h/0 + m/0 IEx.Helpers
    1912. - m/0 + r/0 IEx.Helpers
    1913. - r/0 + r/1 IEx.Helpers
    1914. - r/1 + v/0 IEx.Helpers
    1915. @@ -1428,9 +1615,7 @@

    1916. - - Remsh - + Remsh IEx.Remsh
    1917. @@ -1445,45 +1630,46 @@

    1918. -
    1919. - - - - UnicodeIO - - - IEx.UnicodeIO -
    1920. - - +
    1921. + + inspect_opts/1 + + IEx +
    1922. - cli/0 + preload/0 IEx
    1923. @@ -1513,9 +1699,7 @@

    1924. - - IO - + IO IO
    1925. @@ -1538,14 +1722,7 @@

    1926. - inspect/2 - - IO -
    1927. - -
    1928. - - print/2 + inspect/3 IO
    1929. @@ -1582,9 +1759,7 @@

    1930. - - Kernel - + Kernel Kernel
    1931. @@ -1592,9 +1767,7 @@

    1932. - - ParallelCompiler - + ParallelCompiler Kernel.ParallelCompiler
    1933. @@ -1619,9 +1792,7 @@

    1934. - - ParallelRequire - + ParallelRequire Kernel.ParallelRequire
    1935. @@ -1639,9 +1810,7 @@

    1936. - - SpecialForms - + SpecialForms Kernel.SpecialForms
    1937. @@ -1771,9 +1940,7 @@

    1938. - - Typespec - + Typespec Kernel.Typespec
    1939. @@ -2114,42 +2281,63 @@

    1940. - binary_to_list/1 + binary_to_float/1 Kernel
    1941. - binary_to_list/3 + binary_to_integer/1 Kernel
    1942. - binary_to_term/1 + binary_to_integer/2 Kernel
    1943. - binary_to_term/2 + binary_to_list/1 Kernel
    1944. - bit_size/1 + binary_to_list/3 Kernel
    1945. - bitstring_to_list/1 + binary_to_term/1 + + Kernel +
    1946. + +
    1947. + + binary_to_term/2 + + Kernel +
    1948. + +
    1949. + + bit_size/1 + + Kernel +
    1950. + +
    1951. + + bitstring_to_list/1 Kernel
    1952. @@ -2287,6 +2475,13 @@

      Kernel +
    1953. + + float_to_binary/1 + + Kernel +
    1954. +
    1955. float_to_list/1 @@ -2352,7 +2547,21 @@

    1956. - inspect/1 + inspect/2 + + Kernel +
    1957. + +
    1958. + + integer_to_binary/1 + + Kernel +
    1959. + +
    1960. + + integer_to_binary/2 Kernel
    1961. @@ -2385,6 +2594,13 @@

      Kernel

    1962. +
    1963. + + is_alive/0 + + Kernel +
    1964. +
    1965. is_atom/1 @@ -2476,6 +2692,13 @@

      Kernel

    1966. +
    1967. + + is_range/1 + + Kernel +
    1968. +
    1969. is_record/2 @@ -2602,6 +2825,13 @@

      Kernel

    1970. +
    1971. + + nil?/1 + + Kernel +
    1972. +
    1973. node/0 @@ -2830,9 +3060,7 @@

    1974. - - Keyword - + Keyword Keyword
    1975. @@ -2846,6 +3074,13 @@

      Keyword

    1976. +
    1977. + + equal?/2 + + Keyword +
    1978. +
    1979. from_enum/1 @@ -2876,7 +3111,7 @@

    1980. - key?/2 + has_key?/2 Keyword
    1981. @@ -2930,6 +3165,20 @@

      Keyword

    1982. +
    1983. + + update/3 + + Keyword +
    1984. + +
    1985. + + update/4 + + Keyword +
    1986. +
    1987. values/1 @@ -2941,9 +3190,7 @@

    1988. - - List - + List List
    1989. @@ -3029,77 +3276,77 @@

    1990. - last/1 + keyreplace/4 List
    1991. - member?/2 + keystore/4 List
    1992. - range/3 + last/1 List
    1993. - reverse/1 + member?/2 List
    1994. - sort/1 + range/3 List
    1995. - sort/2 + sort/1 List
    1996. - uniq/1 + sort/2 List
    1997. - unzip/1 + uniq/1 List
    1998. - wrap/1 + unzip/1 List
    1999. - zip/1 + wrap/1 List
    2000. - zip/2 + zip/1 List
    2001. @@ -3108,9 +3355,7 @@

    2002. - - Macro - + Macro Macro
    2003. @@ -3124,6 +3369,13 @@

      Macro

    2004. +
    2005. + + do_safe_term/1 + + Macro +
    2006. +
    2007. escape/1 @@ -3138,6 +3390,13 @@

      Macro

    2008. +
    2009. + + safe_term/1 + + Macro +
    2010. +
    2011. to_binary/1 @@ -3152,13 +3411,39 @@

      Macro

    2012. +
    2013. + + unescape_binary/1 + + Macro +
    2014. + +
    2015. + + unescape_binary/2 + + Macro +
    2016. + +
    2017. + + unescape_tokens/1 + + Macro +
    2018. + +
    2019. + + unescape_tokens/2 + + Macro +
    2020. +
    2021. - - Mix - + Mix Mix
    2022. @@ -3166,9 +3451,7 @@

    2023. - - Deps - + Deps Mix.Deps
    2024. @@ -3184,28 +3467,28 @@

    2025. - all/1 + all/2 Mix.Deps
    2026. - by_name/1 + available?/1 Mix.Deps
    2027. - check_lock/2 + by_name!/1 Mix.Deps
    2028. - deps_path/0 + check_lock/2 Mix.Deps
    2029. @@ -3231,6 +3514,13 @@

      Mix.Deps +
    2030. + + ok?/1 + + Mix.Deps +
    2031. +
    2032. out_of_date?/1 @@ -3240,7 +3530,7 @@

    2033. - update_status/1 + update/1 Mix.Deps
    2034. @@ -3249,9 +3539,7 @@

    2035. - - Deps.Lock - + Deps.Lock Mix.Deps.Lock
    2036. @@ -3260,21 +3548,21 @@

    2037. - read/0 + lockfile/0 Mix.Deps.Lock
    2038. - update_lock/2 + read/1 Mix.Deps.Lock
    2039. - write/1 + write/2 Mix.Deps.Lock
    2040. @@ -3283,9 +3571,7 @@

    2041. - - Generator - + Generator Mix.Generator
    2042. @@ -3331,9 +3617,7 @@

    2043. - - Local - + Local Mix.Local
    2044. @@ -3365,9 +3649,7 @@

    2045. - - Project - + Project Mix.Project
    2046. @@ -3376,21 +3658,28 @@

    2047. - behaviour_info/1 + config/0 + + Mix.Project +
    2048. + +
    2049. + + get/0 Mix.Project
    2050. - current/0 + get!/0 Mix.Project
    2051. - defined?/0 + refresh/0 Mix.Project
    2052. @@ -3399,9 +3688,7 @@

    2053. - - SCM - + SCM Mix.SCM
    2054. @@ -3424,14 +3711,14 @@

    2055. - behaviour_info/1 + check?/2 Mix.SCM
    2056. - check?/2 + checkout/2 Mix.SCM
    2057. @@ -3452,14 +3739,14 @@

    2058. - get/2 + key/0 Mix.SCM
    2059. - key/0 + match?/2 Mix.SCM
    2060. @@ -3489,9 +3776,7 @@

    2061. - - Shell - + Shell Mix.Shell
    2062. @@ -3530,9 +3815,7 @@

    2063. - - Shell.Process - + Shell.Process Mix.Shell.Process
    2064. @@ -3571,9 +3854,7 @@

    2065. - - Task - + Task Mix.Task
    2066. @@ -3587,13 +3868,6 @@

      Mix.Task

    2067. -
    2068. - - behaviour_info/1 - - Mix.Task -
    2069. -
    2070. clear/0 @@ -3661,9 +3935,7 @@

    2071. - - Tasks.Clean - + Tasks.Clean Mix.Tasks.Clean
    2072. @@ -3681,9 +3953,7 @@

    2073. - - Tasks.Compile - + Tasks.Compile Mix.Tasks.Compile
    2074. @@ -3701,9 +3971,7 @@

    2075. - - Tasks.Compile.App - + Tasks.Compile.App Mix.Tasks.Compile.App
    2076. @@ -3721,9 +3989,7 @@

    2077. - - Tasks.Compile.Elixir - + Tasks.Compile.Elixir Mix.Tasks.Compile.Elixir
    2078. @@ -3741,9 +4007,7 @@

    2079. - - Tasks.Deps - + Tasks.Deps Mix.Tasks.Deps
    2080. @@ -3761,9 +4025,7 @@

    2081. - - Tasks.Deps.Check - + Tasks.Deps.Check Mix.Tasks.Deps.Check
    2082. @@ -3781,9 +4043,7 @@

    2083. - - Tasks.Deps.Clean - + Tasks.Deps.Clean Mix.Tasks.Deps.Clean
    2084. @@ -3801,9 +4061,7 @@

    2085. - - Tasks.Deps.Compile - + Tasks.Deps.Compile Mix.Tasks.Deps.Compile
    2086. @@ -3821,9 +4079,7 @@

    2087. - - Tasks.Deps.Get - + Tasks.Deps.Get Mix.Tasks.Deps.Get
    2088. @@ -3841,9 +4097,7 @@

    2089. - - Tasks.Deps.Loadpaths - + Tasks.Deps.Loadpaths Mix.Tasks.Deps.Loadpaths
    2090. @@ -3861,9 +4115,7 @@

    2091. - - Tasks.Deps.Unlock - + Tasks.Deps.Unlock Mix.Tasks.Deps.Unlock
    2092. @@ -3881,9 +4133,7 @@

    2093. - - Tasks.Deps.Update - + Tasks.Deps.Update Mix.Tasks.Deps.Update
    2094. @@ -3901,9 +4151,7 @@

    2095. - - Tasks.Do - + Tasks.Do Mix.Tasks.Do
    2096. @@ -3921,9 +4169,25 @@

    2097. - - Tasks.Help - + Tasks.Escriptize + + Mix.Tasks.Escriptize +
    2098. +
        + + +
      • + + run/1 + + Mix.Tasks.Escriptize +
      • + +
      +
    2099. + + + Tasks.Help Mix.Tasks.Help
    2100. @@ -3941,9 +4205,7 @@

    2101. - - Tasks.Iex - + Tasks.Iex Mix.Tasks.Iex
    2102. @@ -3961,9 +4223,7 @@

    2103. - - Tasks.Loadpaths - + Tasks.Loadpaths Mix.Tasks.Loadpaths
    2104. @@ -3981,9 +4241,7 @@

    2105. - - Tasks.Local - + Tasks.Local Mix.Tasks.Local
    2106. @@ -4001,9 +4259,7 @@

    2107. - - Tasks.Local.Install - + Tasks.Local.Install Mix.Tasks.Local.Install
    2108. @@ -4021,9 +4277,7 @@

    2109. - - Tasks.Local.Uninstall - + Tasks.Local.Uninstall Mix.Tasks.Local.Uninstall
    2110. @@ -4041,9 +4295,7 @@

    2111. - - Tasks.New - + Tasks.New Mix.Tasks.New
    2112. @@ -4061,9 +4313,7 @@

    2113. - - Tasks.Run - + Tasks.Run Mix.Tasks.Run
    2114. @@ -4081,9 +4331,7 @@

    2115. - - Tasks.Test - + Tasks.Test Mix.Tasks.Test
    2116. @@ -4101,9 +4349,7 @@

    2117. - - Utils - + Utils Mix.Utils
    2118. @@ -4138,6 +4384,27 @@

      Mix.Utils

    2119. +
    2120. + + exclude_files/1 + + Mix.Utils +
    2121. + +
    2122. + + extract_files/2 + + Mix.Utils +
    2123. + +
    2124. + + extract_files/3 + + Mix.Utils +
    2125. +
    2126. module_name_to_command/2 @@ -4176,6 +4443,20 @@

      +
    2127. + + env/0 + + Mix +
    2128. + +
    2129. + + env/1 + + Mix +
    2130. +
    2131. loadpaths/0 @@ -4215,9 +4496,7 @@

    2132. - - Module - + Module Module
    2133. @@ -4226,35 +4505,28 @@

    2134. - add_attribute/3 - - Module -
    2135. - -
    2136. - - add_compile_callback/3 + add_doc/6 Module
    2137. - add_doc/6 + concat/1 Module
    2138. - concat/1 + concat/2 Module
    2139. - concat/2 + create/3 Module
    2140. @@ -4301,6 +4573,13 @@

      Module

    2141. +
    2142. + + get_attribute/2 + + Module +
    2143. +
    2144. make_overridable/2 @@ -4310,7 +4589,21 @@

    2145. - read_attribute/2 + open?/1 + + Module +
    2146. + +
    2147. + + overridable?/2 + + Module +
    2148. + +
    2149. + + put_attribute/3 Module
    2150. @@ -4336,13 +4629,18 @@

      Module

    2151. +
    2152. + + split/1 + + Module +
    2153. +
    2154. - - Node - + Node Node
    2155. @@ -4430,9 +4728,7 @@

    2156. - - OptionParser - + OptionParser OptionParser
    2157. @@ -4457,43 +4753,39 @@

    2158. - - Orddict - + OrdDict - Orddict + OrdDict
    2159. - - Port - + Port Port
    2160. @@ -4567,9 +4859,7 @@

    2161. - - Process - + Process Process
    2162. @@ -4646,6 +4936,27 @@

      Process

    2163. +
    2164. + + group_leader/0 + + Process +
    2165. + +
    2166. + + group_leader/2 + + Process +
    2167. + +
    2168. + + info/1 + + Process +
    2169. +
    2170. info/2 @@ -4769,9 +5080,7 @@

    2171. - - Record - + Record Record
    2172. @@ -4780,7 +5089,14 @@

    2173. - access/4 + deffunctions/3 + + Record +
    2174. + +
    2175. + + defmacros/3 Record
    2176. @@ -4803,15 +5119,20 @@

    2177. - - Regex - + Regex Regex
    2178. +
    2179. + + + String + + String +
    2180. +
    2181. - - System - + System System
    2182. @@ -5004,9 +5432,7 @@

    2183. - - Tuple - + Tuple Tuple
    2184. @@ -5017,9 +5443,7 @@

    2185. - - URI - + URI URI
    2186. @@ -5027,9 +5451,7 @@

    2187. - - FTP - + FTP URI.FTP
    2188. @@ -5054,9 +5476,7 @@

    2189. - - HTTP - + HTTP URI.HTTP
    2190. @@ -5081,9 +5501,7 @@

    2191. - - HTTPS - + HTTPS URI.HTTPS
    2192. @@ -5108,9 +5526,7 @@

    2193. - - LDAP - + LDAP URI.LDAP
    2194. @@ -5135,9 +5551,7 @@

    2195. - - Parser - + Parser URI.Parser
    2196. @@ -5146,7 +5560,14 @@

    2197. - behaviour_info/1 + default_port/0 + + URI.Parser +
    2198. + +
    2199. + + parse/1 URI.Parser
    2200. @@ -5155,9 +5576,7 @@

    2201. - - SFTP - + SFTP URI.SFTP
    2202. @@ -5182,9 +5601,7 @@

    2203. - - TFTP - + TFTP URI.TFTP
    2204. @@ -5243,6 +5660,13 @@

      URI

    2205. +
    2206. + + query_decoder/1 + + URI +
    2207. + diff --git a/docs/stable/protocols_list.html b/docs/stable/protocols_list.html index c946f4d3f..b442a119e 100644 --- a/docs/stable/protocols_list.html +++ b/docs/stable/protocols_list.html @@ -16,7 +16,7 @@

      - Elixir v0.6.0 + Elixir v0.7.0

      - Source + Source

      command_to_module(command, at // Elixir) @@ -152,7 +152,7 @@

      Examples

      #=> { :module, Mix.Tasks.Compile }
      - Source + Source

      command_to_module_name(s) @@ -165,7 +165,7 @@

      Examples

      #=> "Compile.Elixir"
      - Source + Source

      config_merge(old, new) @@ -173,14 +173,14 @@

      Examples

      Merges two configs recursively, merging keyword lists and concatenating normal lists.

      - Source + Source

      exclude_files(files)

      Filtering out files which start with "."

      - Source + Source

      extract_files(paths, exts) @@ -189,7 +189,7 @@

      Examples

      the given extension. It ignores files which start with "."

      - Source + Source

      extract_files(paths, files, exts) @@ -200,7 +200,7 @@

      Examples

      files and the extracted files. It ignores files which start with "."

      - Source + Source

      module_name_to_command(module, nesting // 0) @@ -218,7 +218,7 @@

      Examples

      #=> "compile.elixir"
      - Source + Source

      source(module) @@ -233,7 +233,7 @@

      Examples

      Returns true if any of target is stale compared to source. If target or source is a binary, it is expanded using File.wildcard.

      - Source + Source

      underscore(atom) @@ -257,7 +257,7 @@

      Examples

      Mix.Utils.camelize "sap_example" #=> "SapExample"
      - Source + Source

      user_home() diff --git a/docs/master/modules_list.html b/docs/master/modules_list.html index 528290c64..2a4f90af0 100644 --- a/docs/master/modules_list.html +++ b/docs/master/modules_list.html @@ -16,7 +16,7 @@

      - Elixir v0.7.0 + Elixir v0.7.1.dev

      diff --git a/docs/master/Access.HashDict.html b/docs/master/Access.HashDict.html index a67f39f44..86891033e 100644 --- a/docs/master/Access.HashDict.html +++ b/docs/master/Access.HashDict.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/master/Access.List.html b/docs/master/Access.List.html index 8b0824e50..f538c7d31 100644 --- a/docs/master/Access.List.html +++ b/docs/master/Access.List.html @@ -29,7 +29,7 @@

      - Source + Source @@ -66,7 +66,7 @@

      Examples

      keywords[:a] #=> 1
      - Source + Source diff --git a/docs/master/Access.Orddict.html b/docs/master/Access.Orddict.html index 4c528af5e..4a1609b50 100644 --- a/docs/master/Access.Orddict.html +++ b/docs/master/Access.Orddict.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/master/Access.html b/docs/master/Access.html index fab96371c..7e5b75936 100644 --- a/docs/master/Access.html +++ b/docs/master/Access.html @@ -32,11 +32,10 @@

      The Access protocol is the underlying protocol invoked when the brackets syntax is used. For instance, foo[bar] is translated to access foo, bar which, by default, -invokes Access.access protocol.

      +invokes the Access.access protocol.

      This protocol is limited and is implemented only for the -following built-in types: keywords, records, atoms and -functions.

      +following built-in types: keywords, records and functions.

      @@ -109,11 +108,11 @@

      Functions summary

      Functions

      - access(element, qualifier) + access(container, key)

      Receives the element being accessed and the access item.

      - Source + Source
      diff --git a/docs/master/Behaviour.html b/docs/master/Behaviour.html index ddce0d3bc..c20e5907e 100644 --- a/docs/master/Behaviour.html +++ b/docs/master/Behaviour.html @@ -39,14 +39,14 @@

      use Behaviour @doc "Parses the given URL" - defcallback parse(arg) + defcallback parse(uri_info :: URI.Info.t), do: URI.Info.t @doc "Defines a default port" - defcallback default_port() + defcallback default_port(), do: integer end -

      And then a specific protocol may use it as:

      +

      And then a specific module may use it as:

      defmodule URI.HTTP do
         @behaviour URI.Parser
      @@ -61,11 +61,14 @@ 

      Implementation

      -

      Internally, Erlang call behaviour_info(:callbacks) -to obtain all functions that a behaviour should -implemented. Therefore, all this module does is -to define behaviour_info(:callbacks) with the -defcallback definitions.

      +

      Behaviours since Erlang R15 must be defined via +@callback attributes. defcallback is a simple +mechanism that defines the @callback attribute +according to the type specification and also allows +docs and defines a custom function signature.

      + +

      The callbacks and their documentation can be retrieved +via the __behaviour__ callback function.

      @@ -83,7 +86,7 @@

      Macros summary

      • - defcallback/1 + defcallback/2
      • @@ -98,13 +101,10 @@

        Macros summary

        Macros

        -

        - defcallback(fun) +

        + defcallback(fun, list2)

        -

        Annotates the given function is a callback. defcallback is -slightly different than simple using def because, even if -defcallback contains default values, a default function -won't be generated, which would happen with def.

        +

        Defines a callback according to the given type specification.

        Source
        diff --git a/docs/master/Binary.Dict.html b/docs/master/Binary.Dict.html index 94bbad5c9..4df282f5f 100644 --- a/docs/master/Binary.Dict.html +++ b/docs/master/Binary.Dict.html @@ -60,6 +60,11 @@

        Functions summary

        get/3 +
      • + + get!/2 + +
      • has_key?/2 @@ -136,19 +141,25 @@

        Functions

        delete(arg1, key)

        - Source + Source
      • empty(_)

        - Source + Source

        get(arg1, key, default)

        Source +
        +

        + get!(arg1, key) +

        +
        + Source

        has_key?(arg1, key) @@ -166,7 +177,7 @@

        Functions

        merge(d1, d2, fun)

        - Source + Source

        new() @@ -206,7 +217,7 @@

        Examples

        put(arg1, key, value)

        - Source + Source

        size(arg1) @@ -218,19 +229,19 @@

        Examples

        to_list(arg1)

        - Source + Source

        update(arg1, key, fun)

        - Source + Source

        update(arg1, key, initial, fun)

        - Source + Source

        values(arg1) diff --git a/docs/master/Binary.Inspect.Any.html b/docs/master/Binary.Inspect.Any.html index 09580d5ef..0ad69e6df 100644 --- a/docs/master/Binary.Inspect.Any.html +++ b/docs/master/Binary.Inspect.Any.html @@ -40,7 +40,7 @@

        Examples

        - Source + Source diff --git a/docs/master/Binary.Inspect.BitString.html b/docs/master/Binary.Inspect.BitString.html index 72dccdf84..2ace9f3d4 100644 --- a/docs/master/Binary.Inspect.BitString.html +++ b/docs/master/Binary.Inspect.BitString.html @@ -41,7 +41,7 @@

        Examples

        - Source + Source diff --git a/docs/master/Binary.Inspect.List.html b/docs/master/Binary.Inspect.List.html index 730b02454..dcb0e4509 100644 --- a/docs/master/Binary.Inspect.List.html +++ b/docs/master/Binary.Inspect.List.html @@ -49,7 +49,7 @@

        Examples

        - Source + Source diff --git a/docs/master/Binary.Inspect.Number.html b/docs/master/Binary.Inspect.Number.html index 0586aeb29..c25f348bc 100644 --- a/docs/master/Binary.Inspect.Number.html +++ b/docs/master/Binary.Inspect.Number.html @@ -39,7 +39,7 @@

        Examples

        - Source + Source diff --git a/docs/master/Binary.Inspect.Regex.html b/docs/master/Binary.Inspect.Regex.html index 95c197203..d838cb495 100644 --- a/docs/master/Binary.Inspect.Regex.html +++ b/docs/master/Binary.Inspect.Regex.html @@ -39,7 +39,7 @@

        Examples

        - Source + Source diff --git a/docs/master/Binary.Inspect.Tuple.html b/docs/master/Binary.Inspect.Tuple.html index 24f94ce40..112c245c1 100644 --- a/docs/master/Binary.Inspect.Tuple.html +++ b/docs/master/Binary.Inspect.Tuple.html @@ -41,7 +41,7 @@

        Examples

        - Source + Source diff --git a/docs/master/Code.html b/docs/master/Code.html index 8e5d83e99..9a6c47eef 100644 --- a/docs/master/Code.html +++ b/docs/master/Code.html @@ -164,7 +164,7 @@

        Functions

        For compiling many files at once, check Kernel.ParallelCompiler.

        - Source + Source

        compiler_options() @@ -172,7 +172,7 @@

        Functions

        Loads the compilation options from the code server. Check compiler_options/1 for more information.

        - Source + Source

        compiler_options(opts) @@ -192,7 +192,7 @@

        Functions

        without raising errors, false by default;
      - Source + Source

      delete_path(path) @@ -217,7 +217,7 @@

      Functions

      Check ensure_loaded/1 for more information on module loading and when to use ensure_loaded/1 or ensure_compiled/1.

      - Source + Source

      ensure_compiled?(module) @@ -225,7 +225,7 @@

      Functions

      Similar to ensure_compiled/1, but returns a boolean in case it could be ensured or not.

      - Source + Source

      ensure_loaded(module) @@ -267,7 +267,7 @@

      Code.ensure_compiled

      must be used just in same rare conditions, usually involving macros that needs to invoke a module for callback information.

      - Source + Source

      ensure_loaded?(module) @@ -275,20 +275,26 @@

      Code.ensure_compiled

      Similar to ensure_loaded/1, but returns a boolean in case it could be ensured or not.

      - Source + Source

      eval(string, binding // [], opts // [])

      -

      Evalutes the contents given by string. The second argument is the binding -(which should be a Keyword) followed by a keyword list of options. The -options can be:

      +

      Evalutes the contents given by string. The second argument is the +binding (which should be a keyword) followed by a keyword list of +environment options. Those options can be:

      • :file - the file to be considered in the evaluation
      • :line - the line the script starts
      • +
      • :aliases - a list of tuples with the alias and its target
      • +
      • :requires - a list of modules required
      • +
      • :functions - a list of tuples where the first element is a module +and the second a list of imported function names and arity
      • +
      • :macros - a list of tuples where the first element is a module +and the second a list of imported macro names and arity
      • :delegate_locals_to - delegate local calls to the given module, -otherwise functions are evaluated inside Erlang's default scope.
      • +the default is to not delegate

      Examples

      @@ -297,30 +303,23 @@

      Examples

      #=> { 3, [ {:a, 1}, {:b, 2} ] }
      -

      When passing the ENV's file and line, we could simply get -the location which already returns both fields as a keyword list:

      +

      For convenience, you can my pass __ENV__ as argument and +all imports, requires and aliases will be automatically carried +over:

      -
      Code.eval "a + b", [a: 1, b: 2], __ENV__.location
      +
      Code.eval "a + b", [a: 1, b: 2], __ENV__
       #=> { 3, [ {:a, 1}, {:b, 2} ] }
       
      - Source + Source

      eval_quoted(quoted, binding // [], opts // [])

      Evalutes the quoted contents.

      -

      Options

      - -

      This function accepts a list of options. The supported -options are:

      - -
        -
      • :file - The filename to be used in stacktraces -and the file reported in the ENV variable.

      • -
      • :line - The line reported in the ENV variable.

      • -
      +

      This function accepts a list of environment options. +Check Code.eval for more information.

      Examples

      @@ -330,14 +329,14 @@

      Examples

      #=> { 3, [ {:a, 1}, {:b, 2} ] }
      -

      For convenience, you can also pass the current ENV and -the proper information will be extracted:

      +

      For convenience, you can my pass __ENV__ as argument and +all options will be automatically extracted from the environment:

      Code.eval_quoted contents, [a: 1, b: 2], __ENV__
       #=> { 3, [ {:a, 1}, {:b, 2} ] }
       
      - Source + Source

      load_file(file, relative_to // nil) @@ -353,7 +352,7 @@

      Examples

      a given file, the given file will be loaded N times. Check require_file if you don't want a file to be loaded concurrently.

      - Source + Source

      loaded_files() @@ -385,7 +384,7 @@

      Examples

      file, the given file will be loaded only once. Check load_file if you want a file to be loaded concurrently.

      - Source + Source

      string_to_ast(string, opts // []) @@ -403,7 +402,7 @@

      Options

      when non-existing atoms are found by the tokenizer.

      - Source + Source

      string_to_ast!(string, opts // []) @@ -415,7 +414,7 @@

      Options

      Check Code.string_to_ast/2 for options information.

      - Source + Source

      unload_files(files) diff --git a/docs/master/Dict.html b/docs/master/Dict.html index 668fa5c4e..c90c74616 100644 --- a/docs/master/Dict.html +++ b/docs/master/Dict.html @@ -81,6 +81,11 @@

      Functions summary

      get/3 +
    2208. + + get!/2 + +
    2209. has_key?/2 @@ -158,14 +163,14 @@

      Examples

      Dict.delete d, :a #=> [b: 2]
    2210. - Source + Source

      empty(dict)

      Returns an empty dict of the same type as dict.

      - Source + Source

      get(dict, key, default // nil) @@ -181,7 +186,22 @@

      Examples

      Dict.get d, :b, 3 #=> 3
      - Source + Source +
      +

      + get!(dict, key) +

      +

      Returns the value associated with key in dict. If dict does not +contain key, it raises KeyError.

      + +

      Examples

      + +
      d = new [a: 1]
      +Dict.get d, :a     #=> 1
      +Dict.get d, :b     #=> raises KeyError[key: :b]
      +
      +
      + Source

      has_key?(dict, key) @@ -195,7 +215,7 @@

      Examples

      Dict.has_key?(d, :b) #=> false
      - Source + Source

      keys(dict) @@ -210,7 +230,7 @@

      Examples

      Dict.keys d #=> [:a,:b]
      - Source + Source

      merge(dict1, dict2) @@ -228,7 +248,7 @@

      Examples

      #=> [a: 3, b: 2, d: 4]
      - Source + Source

      merge(dict1, dict2, fun) @@ -246,7 +266,7 @@

      Examples

      #=> [a: 4, b: 2, d: 4]
      - Source + Source

      put(dict, key, val) @@ -261,7 +281,7 @@

      Examples

      #=> [a: 3, b: 2]
      - Source + Source

      size(dict) @@ -274,7 +294,7 @@

      Examples

      Dict.size d #=> 2
      - Source + Source

      to_list(dict) @@ -282,7 +302,7 @@

      Examples

      Returns a list of key-value pairs stored in dict. No particular order is enforced.

      - Source + Source

      update(dict, key, fun) @@ -297,7 +317,7 @@

      Examples

      #=> [a: -1, b: 2]
      - Source + Source

      update(dict, key, initial, fun) @@ -313,7 +333,7 @@

      Examples

      #=> [a: 1, b: 2, c: 3]
      - Source + Source

      values(dict) @@ -326,7 +346,7 @@

      Examples

      Dict.values d #=> [1,2]
      - Source + Source diff --git a/docs/master/Enum.Iterator.Binary.Dict.html b/docs/master/Enum.Iterator.Binary.Dict.html index 7f3720980..7d805ed84 100644 --- a/docs/master/Enum.Iterator.Binary.Dict.html +++ b/docs/master/Enum.Iterator.Binary.Dict.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/master/Enum.Iterator.Function.html b/docs/master/Enum.Iterator.Function.html index 6dbbb462d..29c254865 100644 --- a/docs/master/Enum.Iterator.Function.html +++ b/docs/master/Enum.Iterator.Function.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/master/Enum.Iterator.HashDict.html b/docs/master/Enum.Iterator.HashDict.html index 1055b6c04..356652169 100644 --- a/docs/master/Enum.Iterator.HashDict.html +++ b/docs/master/Enum.Iterator.HashDict.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/master/Enum.Iterator.List.html b/docs/master/Enum.Iterator.List.html index a65de417b..2c3a4cd46 100644 --- a/docs/master/Enum.Iterator.List.html +++ b/docs/master/Enum.Iterator.List.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/master/Enum.Iterator.Orddict.html b/docs/master/Enum.Iterator.Orddict.html index 041698cc9..eff971109 100644 --- a/docs/master/Enum.Iterator.Orddict.html +++ b/docs/master/Enum.Iterator.Orddict.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/master/Enum.html b/docs/master/Enum.html index 96be07fa0..2e3b6006b 100644 --- a/docs/master/Enum.html +++ b/docs/master/Enum.html @@ -186,16 +186,6 @@

      Functions summary

      take_while/2 -
    2211. - - times/2 - -
    2212. -
    2213. - - times/3 - -
    2214. zip/2 @@ -219,7 +209,7 @@

      Functions

      end)

      Invokes the given fun for each item in the collection and returns true if -each invocation returns true as well, otherwise it shirt-circuits and returns +each invocation returns true as well, otherwise it short-circuits and returns false.

      Examples

      @@ -238,7 +228,7 @@

      Examples

      Enum.all? [1,nil,3] #=> false
      - Source + Source

      any?(collection, fun // fn x -> @@ -264,7 +254,7 @@

      Examples

      Enum.any? [false,true,false] #=> true
      - Source + Source

      at!(collection, n) @@ -282,7 +272,7 @@

      Examples

      Enum.at! [2,4,6], 4 #=> raises Enum.OutOfBoundsError
      - Source + Source

      count(collection) @@ -294,14 +284,14 @@

      Examples

      Enum.count [1,2,3] #=> 3
       
      - Source + Source

      count(collection, fun)

      Counts for how many items the function returns true.

      - Source + Source

      drop(collection, count) @@ -316,7 +306,7 @@

      Examples

      Enum.drop [1,2,3], 0 #=> [1,2,3]
      - Source + Source

      drop_while(collection, fun) @@ -330,7 +320,7 @@

      Examples

      #=> [3,4,5]
      - Source + Source

      each(collection, fun) @@ -343,7 +333,7 @@

      Examples

      Enum.each ['some', 'example'], fn(x) -> IO.puts x end
       
      - Source + Source

      empty?(collection) @@ -356,7 +346,7 @@

      Examples

      Enum.empty? [1,2,3] #=> false
      - Source + Source

      filter(collection, fun) @@ -370,7 +360,7 @@

      Examples

      #=> [2]
      - Source + Source

      filter_map(collection, filter, mapper) @@ -383,7 +373,7 @@

      Examples

      #=> [4]
      - Source + Source

      find(collection, ifnone // nil, fun) @@ -403,7 +393,7 @@

      Examples

      #=> 3
      - Source + Source

      find_index(collection, fun) @@ -422,7 +412,7 @@

      Examples

      #=> 2
      - Source + Source

      find_value(collection, ifnone // nil, fun) @@ -439,7 +429,7 @@

      Examples

      #=> true
      - Source + Source

      first(collection) @@ -452,7 +442,7 @@

      Examples

      Enum.first [1,2,3] #=> 1
      - Source + Source

      join(collection, joiner // "") @@ -473,7 +463,7 @@

      Examples

      Enum.join([1,2,3], ' = ') #=> '1 = 2 = 3'
      - Source + Source

      map(collection, fun) @@ -491,7 +481,7 @@

      Examples

      #=> [a: -1, b: -2]
      - Source + Source

      map_join(collection, joiner // "", mapper) @@ -508,11 +498,11 @@

      Examples

      Examples

      Enum.map_join([1,2,3], &1 * 2)        #=> "246"
      -Enum.map_join([1,2,3], &1 * 2, " = ") #=> "2 = 4 = 6"
      -Enum.map_join([1,2,3], &1 * 2, ' = ') #=> '2 = 4 = 6'
      +Enum.map_join([1,2,3], " = ", &1 * 2) #=> "2 = 4 = 6"
      +Enum.map_join([1,2,3], ' = ', &1 * 2) #=> '2 = 4 = 6'
       
      - Source + Source

      map_reduce(collection, acc, f) @@ -531,7 +521,7 @@

      Examples

      #=> { [2, 4, 6], 6 }
      - Source + Source

      partition(collection, fun) @@ -546,7 +536,7 @@

      Examples

      #=> { [2], [1,3] }
      - Source + Source

      qsort(collection) @@ -558,7 +548,7 @@

      Examples

      Enum.qsort [3,2,1] #=> [1,2,3]
       
      - Source + Source

      reduce(collection, acc, fun) @@ -573,22 +563,20 @@

      Examples

      #=> 6
      - Source + Source

      reverse(collection)

      Reverses the collection.

      -

      Expects an ordered collection.

      -

      Examples

      Enum.reverse [1, 2, 3]
       #=> [3, 2, 1]
       
      - Source + Source

      split(collection, count) @@ -608,7 +596,7 @@

      Examples

      Enum.split [1,2,3], -5 #=> { [], [1,2,3] }
      - Source + Source

      split_while(collection, fun) @@ -622,7 +610,7 @@

      Examples

      #=> { [1], [2, 3, 4] }
      - Source + Source

      take(collection, count) @@ -637,7 +625,7 @@

      Examples

      Enum.take [1,2,3], 0 #=> []
      - Source + Source

      take_while(collection, fun) @@ -651,38 +639,7 @@

      Examples

      #=> [1, 2]
      - Source -
      -

      - times(times, function) -

      -

      Iterates the given function n times, passing values -from 0 to n - 1.

      - -

      Examples

      - -
      Enum.times 3, fn(x) -> IO.inspect x end
      -0
      -1
      -2
      -
      -
      - Source -
      -

      - times(times, acc, function) -

      -

      Iterates the given function n times, passing values from 1 -to n. Also has an accumulator similar to reduce to store the -value between computations.

      - -

      Examples

      - -
      Enum.times 5, 0, fn(x, acc) -> acc + x end
      -#=> 15
      -
      -
      - Source + Source

      zip(coll1, coll2) @@ -692,7 +649,7 @@

      Examples

      dictated by the first enum. In case the second list is shorter, values are filled with nil.

      - Source + Source diff --git a/docs/master/ExUnit.Assertions.html b/docs/master/ExUnit.Assertions.html index 10720b9a1..344ccbefa 100644 --- a/docs/master/ExUnit.Assertions.html +++ b/docs/master/ExUnit.Assertions.html @@ -153,7 +153,7 @@

      Examples

      assert false, "it will never be true"
       
      - Source + Source

      assert_in_delta(expected, received, delta, message // nil) @@ -166,7 +166,7 @@

      Examples

      assert_in_delta 10, 15, 4
      - Source + Source

      assert_raise(exception, function) @@ -181,7 +181,7 @@

      Examples

      end
      - Source + Source

      assert_raise(exception, message, function) @@ -196,7 +196,7 @@

      Examples

      end
      - Source + Source

      flunk(message // "Epic Fail!") @@ -208,7 +208,7 @@

      Examples

      flunk "This should raise an error"
       
      - Source + Source

      refute(not_expected, message) @@ -221,7 +221,7 @@

      Examples

      refute true, "This will obviously fail"
       
      - Source + Source

      refute_in_delta(expected, received, delta, message // nil) @@ -234,7 +234,7 @@

      Examples

      refute_in_delta 10, 11, 2
      - Source + Source @@ -282,7 +282,7 @@

      Examples

      assert_received { :hello, _ } - Source + Source

      catch_error(expression) @@ -295,7 +295,7 @@

      Examples

      assert catch_error(error 1) == 1
       
      - Source + Source

      catch_exit(expression) @@ -308,7 +308,7 @@

      Examples

      assert catch_exit(exit 1) == 1
       
      - Source + Source

      catch_throw(expression) @@ -321,7 +321,7 @@

      Examples

      assert catch_throw(throw 1) == 1
       
      - Source + Source

      refute(expected) @@ -352,7 +352,7 @@

      Examples

      refute_received :bye
      - Source + Source diff --git a/docs/master/Calendar.html b/docs/master/ExUnit.CLIFormatter.html similarity index 52% rename from docs/master/Calendar.html rename to docs/master/ExUnit.CLIFormatter.html index 33953a53a..8a2b18544 100644 --- a/docs/master/Calendar.html +++ b/docs/master/ExUnit.CLIFormatter.html @@ -1,7 +1,7 @@ - Calendar + ExUnit.CLIFormatter @@ -21,13 +21,19 @@

      - Calendar + ExUnit.CLIFormatter

      +
      +

      Formatter responsible for printing raw text +on the CLI

      - Source +
      + + + Source @@ -38,67 +44,62 @@

      Functions summary

      configure(options) @@ -132,7 +132,7 @@

      Options

    2215. :max_cases - Maximum number of cases to run in parallel
    2216. - Source + Source

      run() @@ -140,7 +140,7 @@

      Options

      API used to run the tests. A developer does not need to call it directly.

      - Source + Source

      start(options // []) @@ -148,8 +148,26 @@

      Options

      Start ExUnit. Required to be invoked before loading any file that uses ExUnit.Case. Check configure/1 to see the supported options.

      + +

      This function will also try to read a user config from the following +locations, in this order:

      + +
        +
      • $EXUNIT_CONFIG environment variable
      • +
      • $HOME/.ex_unit.exs
      • +
      + +

      If none found, no user config will be read.

      + +

      User config is an elixir file which should return a keyword list +with ex_unit options. Please note that explicit options passed to start/1 +will take precedence over user options.

      + +

      User config example (~/.ex_unit.exs)

      + +

      [formatter: ExUnit.Formatter.ANSI]

      - Source + Source
      diff --git a/docs/master/File.Stat.html b/docs/master/File.Stat.html index 28e04801f..fd721bf67 100644 --- a/docs/master/File.Stat.html +++ b/docs/master/File.Stat.html @@ -73,79 +73,79 @@

      Fields (and defaults)

    2217. - size: nil + size: :undefined
    2218. - type: nil + type: :undefined
    2219. - access: nil + access: :undefined
    2220. - atime: nil + atime: :undefined
    2221. - mtime: nil + mtime: :undefined
    2222. - ctime: nil + ctime: :undefined
    2223. - mode: nil + mode: :undefined
    2224. - links: nil + links: :undefined
    2225. - major_device: nil + major_device: :undefined
    2226. - minor_device: nil + minor_device: :undefined
    2227. - inode: nil + inode: :undefined
    2228. - uid: nil + uid: :undefined
    2229. - gid: nil + gid: :undefined
    2230. diff --git a/docs/master/File.html b/docs/master/File.html index eb35d1aa8..6d223ea38 100644 --- a/docs/master/File.html +++ b/docs/master/File.html @@ -32,8 +32,16 @@

      that interact with the filesystem have their naming based on its UNIX variants. For example, deleting a file is done with File.rm. Getting its stats with -File.stat. If you want to read or write to a file -in chunks, check the IO module.

      +File.stat.

      + +

      In order to write and read files, one must use the +functions in the IO module. By default, a file is +opened on binary mode which requires the functions +IO.binread, IO.binwrite and IO.binreadline to +interact with the file. A developer may pass :utf8 +as an option when opening the file and then all other +functions from IO are available, since they work directly +with Unicode data.

      Most of the functions in this module return :ok or { :ok, result } in case of success, { :error, reason } @@ -382,7 +390,7 @@

      Examples

      #=> "" - Source + Source

      basename(path, extension) @@ -404,7 +412,7 @@

      Examples

      #=> "bar.old"
      - Source + Source

      cd(path) @@ -412,14 +420,14 @@

      Examples

      Sets the current working directory. Returns :ok if successful, { :error, reason } otherwise.

      - Source + Source

      cd!(path)

      The same as cd/0, but raises an exception if it fails.

      - Source + Source

      cd!(path, function) @@ -431,7 +439,7 @@

      Examples

      Raises an error if retrieving or changing the current directory fails.

      - Source + Source

      close(io_device) @@ -443,7 +451,7 @@

      Examples

      close/1 might return an old write error and not even try to close the file. See open/2.

      - Source + Source

      copy(source, destination, bytes_count // :infinity) @@ -462,7 +470,7 @@

      Examples

      Typical error reasons are the same as in open/2, read/1 and write/2.

      - Source + Source

      copy!(source, destination, bytes_count // :infinity) @@ -470,7 +478,7 @@

      Examples

      The same as copy/3 but raises an File.CopyError if it fails. Returns the bytes_copied otherwise.

      - Source + Source

      cp(source, destination, callback // fn _, _ -> @@ -495,7 +503,7 @@

      Examples

      It returns :ok in case of success, returns { :error, reason } otherwise.

      - Source + Source

      cp!(source, destination, callback // fn _, _ -> @@ -505,7 +513,7 @@

      Examples

      The same as cp/3, but raises File.CopyError if it fails. Returns the list of copied files otherwise.

      - Source + Source

      cp_r(source, destination, callback // fn _, _ -> @@ -557,7 +565,7 @@

      Examples

      end
      - Source + Source

      cp_r!(source, destination, callback // fn _, _ -> @@ -567,7 +575,7 @@

      Examples

      The same as cp_r/3, but raises File.CopyError if it fails. Returns the list of copied files otherwise.

      - Source + Source

      cwd() @@ -577,21 +585,21 @@

      Examples

      directories of the current directory. For this reason, returns { :ok, cwd } in case of success, { :error, reason } otherwise.

      - Source + Source

      cwd!()

      The same as cwd/0, but raises an exception if it fails.

      - Source + Source

      dir?(path)

      Returns true if the path is a directory.

      - Source + Source

      dirname(path) @@ -607,7 +615,7 @@

      Examples

      #=> "foo"
      - Source + Source

      exists?(path) @@ -628,7 +636,7 @@

      Examples

      #=> true
      - Source + Source

      expand_path(path) @@ -644,7 +652,7 @@

      Examples

      File.expand_path("/foo/bar/../bar") == "/foo/bar"
       
      - Source + Source

      expand_path(path, relative_to) @@ -662,7 +670,7 @@

      Examples

      File.expand_path("/foo/bar/../bar", "/baz") == "/foo/bar"
      - Source + Source

      extname(path) @@ -680,7 +688,7 @@

      Examples

      #=> ""
      - Source + Source

      iterator(device) @@ -704,7 +712,7 @@

      Examples

      end
      - Source + Source

      iterator(file, mode) @@ -713,7 +721,7 @@

      Examples

      returns its iterator. Fails for the same reasons as File.open.

      - Source + Source

      iterator!(file, mode // []) @@ -721,7 +729,7 @@

      Examples

      Same as iterator/2 but raises if the file cannot be opened.

      - Source + Source

      join(paths) @@ -742,7 +750,7 @@

      Examples

      #=> "/foo/bar"
      - Source + Source

      join(left, right) @@ -758,7 +766,7 @@

      Examples

      #=> "foo/bar"
      - Source + Source

      mkdir(path) @@ -777,14 +785,14 @@

      Examples

      On some platforms, :enoent is returned instead.
      - Source + Source

      mkdir!(path)

      Same as mkdir, but raises an exception in case of failure. Otherwise :ok.

      - Source + Source

      mkdir_p(path) @@ -800,14 +808,14 @@

      Examples

    2231. :enotdir - A component of path is not a directory.
    2232. - Source + Source

      mkdir_p!(path)

      Same as mkdir_p, but raises an exception in case of failure. Otherwise :ok.

      - Source + Source

      open(path, modes // []) @@ -831,6 +839,11 @@

      Examples

      The compressed option must be combined with either read or write, but not both. Note that the file size obtained with stat/1 will most probably not match the number of bytes that can be read from a compressed file.

      +
    2233. :utf8 - This option denotes how data is actually stored in the disk file and + makes the file perform automatic translation of characters to and from utf-8. + If data is sent to a file in a format that cannot be converted to the utf-8 + or if data is read by a function that returns data in a format that cannot cope + with the character range of the data, an error occurs and the file will be closed.

    2234. If a function is given to modes (instead of a list), it dispatches to open/3.

      @@ -857,7 +870,7 @@

      Examples

      File.close(file)
      - Source + Source

      open(path, modes, function) @@ -882,7 +895,7 @@

      Examples

      end)
      - Source + Source

      open!(path, modes // []) @@ -890,7 +903,7 @@

      Examples

      Same as open/2 but raises an error if file could not be opened. Returns the io_device otherwise.

      - Source + Source

      open!(path, modes, function) @@ -898,7 +911,7 @@

      Examples

      Same as open/3 but raises an error if file could not be opened. Returns the function result otherwise.

      - Source + Source

      read(path) @@ -920,7 +933,7 @@

      Examples

      You can use :file.format_error(reason) to get a descriptive string of the error.

      - Source + Source

      read!(path) @@ -928,7 +941,7 @@

      Examples

      Returns binary with the contents of the given filename or raises File.Error if an error occurs.

      - Source + Source

      regular?(path) @@ -940,7 +953,7 @@

      Examples

      File.regular? __FILE__ #=> true
       
      - Source + Source

      rm(path) @@ -968,14 +981,14 @@

      Examples

      #=> {:error, :eperm}
      - Source + Source

      rm!(path)

      Same as rm, but raises an exception in case of failure. Otherwise :ok.

      - Source + Source

      rm_rf(path) @@ -997,7 +1010,7 @@

      Examples

      #=> { :ok, [] }
      - Source + Source

      rm_rf!(path) @@ -1005,7 +1018,7 @@

      Examples

      Same as rm_rf/1 but raises File.Error in case of failures, otherwise the list of files or directories removed.

      - Source + Source

      rmdir(path) @@ -1022,14 +1035,14 @@

      Examples

      #=> {:error, :enotdir}
      - Source + Source

      rmdir!(path)

      Same as rmdir/1, but raises an exception in case of failure. Otherwise :ok.

      - Source + Source

      rootname(path) @@ -1047,7 +1060,7 @@

      Examples

      #=> "/foo/bar"
      - Source + Source

      rootname(path, extension) @@ -1066,7 +1079,7 @@

      Examples

      #=> "/foo/bar.erl"
      - Source + Source

      split(path) @@ -1084,7 +1097,7 @@

      Examples

      #=> ["/", "foo", "bar"]
      - Source + Source

      stat(path, opts // []) @@ -1103,7 +1116,7 @@

      Options

      Default is local.
      - Source + Source

      stat!(path, opts // []) @@ -1111,23 +1124,23 @@

      Options

      Same as stat but returns the File.Stat directly and throws File.Error if an error is returned.

      - Source + Source

      - touch(path, time // calendar.local_time()) + touch(path, time // :calendar.local_time())

      Updates modification time (mtime) and access time (atime) of the given file. File is created if it doesn’t exist.

      - Source + Source

      - touch!(path, time // calendar.local_time()) + touch!(path, time // :calendar.local_time())

      Same as touch/1 but raises an exception if it fails. Returns :ok otherwise.

      - Source + Source

      wildcard(glob) @@ -1167,7 +1180,7 @@

      Examples

      File.wildcard("projects/*/ebin/**/*.{beam,app}")
       
      - Source + Source

      write(path, content, modes // []) @@ -1187,14 +1200,14 @@

      Examples

    2235. :eisdir - The named file is a directory.
    2236. - Source + Source

      write!(path, content, modes // [])

      Same as write/3 but raises an exception if it fails, returns :ok otherwise.

      - Source + Source

      write_stat(path, stat, opts // []) @@ -1202,7 +1215,7 @@

      Examples

      Writes the given File.Stat back to the filesystem at the given path. Returns :ok or { :error, reason }.

      - Source + Source

      write_stat!(path, stat, opts // []) @@ -1210,7 +1223,7 @@

      Examples

      Same as write_stat/3 but raises an exception if it fails. Returns :ok otherwise.

      - Source + Source
      diff --git a/docs/master/GenServer.Behaviour.html b/docs/master/GenServer.Behaviour.html index aae5e9e2b..156591578 100644 --- a/docs/master/GenServer.Behaviour.html +++ b/docs/master/GenServer.Behaviour.html @@ -70,7 +70,7 @@

      Example

      - Source + Source diff --git a/docs/master/IEx.Autocomplete.html b/docs/master/IEx.Autocomplete.html index 52a8465c6..1adbb5e45 100644 --- a/docs/master/IEx.Autocomplete.html +++ b/docs/master/IEx.Autocomplete.html @@ -62,7 +62,7 @@

      Functions

      expand(expr)

      - Source + Source diff --git a/docs/master/IEx.Helpers.html b/docs/master/IEx.Helpers.html index a93df9bef..16e20fb2d 100644 --- a/docs/master/IEx.Helpers.html +++ b/docs/master/IEx.Helpers.html @@ -27,11 +27,22 @@

      -

      A bunch of helpers available in IEx.

      +

      Welcome to Interactive Elixir. You are currently +seeing the documentation for the module IEx.Helpers +which provides many helpers to make Elixir's shell +more joyful to work with.

      + +

      This message was triggered by invoking the helper +h(), usually referred as h/0 (since it expects 0 +arguments).

      + +

      There are many other helpers available:

      • c/2 - compiles a file in the given path
      • h/0,h/1, h/2 - prints help/documentation
      • +
      • t/1, t/3 — prints type information
      • +
      • s/1, s/3 — prints spec information
      • m/0 - prints loaded modules
      • r/0 - recompiles and reloads the given module's source file
      • v/0 - prints all commands and values
      • @@ -98,6 +109,11 @@

        Functions summary

        r/1 +
      • + + s/3 + +
      • v/0 @@ -120,6 +136,16 @@

        Macros summary

        h/1
      • +
      • + + s/1 + +
      • +
      • + + t/1 + +
      @@ -143,14 +169,14 @@

      Examples

      #=> Foo
      - Source + Source

      h()

      Shows the documentation for IEx.Helpers.

      - Source + Source

      h(function, arity) @@ -167,21 +193,21 @@

      Examples

      #=> Prints documentation for this function
      - Source + Source

      h(module, function, arity)

      Shows the documentation for the function/arity in module.

      - Source + Source

      m()

      Returns the name and module of all modules loaded.

      - Source + Source

      r() @@ -189,7 +215,7 @@

      Examples

      Reloads all modules that were already reloaded at some point with r/1.

      - Source + Source

      r(module) @@ -199,14 +225,27 @@

      Examples

      Please note that all the modules defined in the specified files are recompiled and reloaded.

      - Source + Source +
      +

      + s(module, function, arity) +

      +

      Prints the specs for a given function.

      + +

      Examples

      + +
      s(Enum.all?/2)
      +s(Enum.t/0)
      +
      +
      + Source

      v()

      Prints commands history and their result.

      - Source + Source

      v(n) @@ -215,7 +254,7 @@

      Examples

      values to lookup query's value from latest to earliest. For instance, v(-1) returns the latest result.

      - Source + Source @@ -243,7 +282,33 @@

      Examples

      h Enum.all?/2 - Source + Source +
      +

      + s(module) +

      +

      Prints all specs from a given module.

      + +

      Examples

      + +
      s(Enum)
      +
      +
      + Source +
      +

      + t(module) +

      +

      Prints all types for the given module or prints out a specified type's +specification

      + +

      Examples

      + +
      t(Enum)
      +t(Enum.t/0)
      +
      +
      + Source
      diff --git a/docs/master/IO.html b/docs/master/IO.html index 1e0f6873b..794b3fb4c 100644 --- a/docs/master/IO.html +++ b/docs/master/IO.html @@ -30,7 +30,7 @@

      Module responsible for doing IO. Many functions in this module expects an IO device and an io data encoded in UTF-8.

      -

      An IO device must be a pid is an atom representing a process. +

      An IO device must be a pid or an atom representing a process. For convenience, Elixir provides :stdio and :stderr as shortcut to Erlang's :standard_io and :standard_error.

      @@ -60,6 +60,21 @@

      Functions summary

      • + + binread/2 + +
      • +
      • + + binreadline/1 + +
      • +
      • + + binwrite/2 + +
      • +
      • getb/3 @@ -106,6 +121,36 @@

        Functions summary

        Functions

        +

        + binread(device // :stdio, count) +

        +

        Reads count bytes from the IO device as binary, +no unicode conversion happens.

        + +

        Check read/2 for more information.

        +
        + Source +
        +

        + binreadline(device // :stdio) +

        +

        Reads a line from the IO device as binary, +no unicode conversion happens.

        + +

        Check readline/1 for more information.

        +
        + Source +
        +

        + binwrite(device // :stdio, item) +

        +

        Writes the given argument to the given device +as a binary, no unicode conversion happens.

        + +

        Check write/2 for more information.

        +
        + Source +

        getb(device // :stdio, prompt, count // 1)

        @@ -119,7 +164,7 @@

        Functions

        NFS file system.

      - Source + Source

      gets(device // :stdio, prompt) @@ -135,7 +180,7 @@

      Functions

      NFS file system.

      - Source + Source

      inspect(device // :stdio, item, opts // []) @@ -143,7 +188,7 @@

      Functions

      Inspects and writes the given argument to the device followed by a new line. Returns the item given.

      - Source + Source

      puts(device // :stdio, item) @@ -152,7 +197,7 @@

      Functions

      but adds a new line at the end. The argument is expected to be a chardata.

      - Source + Source

      read(device // :stdio, count) @@ -172,7 +217,7 @@

      Functions

      readline(device // :stdio)

      -

      Read a line from the IO device. It returns:

      +

      Reads a line from the IO device. It returns:

      • data - The input characters.

      • @@ -185,7 +230,7 @@

        Functions

        This function does the same as gets/2, except the prompt is not required as argument.

      - Source + Source

      write(device // :stdio, item) @@ -206,7 +251,7 @@

      Examples

      #=> "error"
      - Source + Source
      diff --git a/docs/master/Kernel.SpecialForms.html b/docs/master/Kernel.SpecialForms.html index 46855ca5e..eb539af75 100644 --- a/docs/master/Kernel.SpecialForms.html +++ b/docs/master/Kernel.SpecialForms.html @@ -209,13 +209,44 @@

      Examples

      __aliases__(args)

      This is the special form used to hold aliases information. -At compilation time, it is usually compiled to an atom:

      +It is usually compiled to an atom:

      quote do: Foo.Bar
       { :__aliases__, 0, [:Foo,:Bar] }
       
      + +

      Elixir represents Foo.Bar as __aliases__ so calls can be +unambiguously identified by the operator :.. For example:

      + +
      quote do: Foo.bar
      +{{:.,0,[{:__aliases__,0,[:Foo]},:bar]},0,[]}
      +
      + +

      Whenever an expression iterator sees a :. as the tuple key, +it can be sure that it represents a call and the second element +of the arguments list is an atom.

      + +

      On the other hand, aliases holds some properties:

      + +

      1) The head element of aliases can be any term;

      + +

      2) The tail elements of aliases are guaranteed to always be atoms;

      + +

      3) When the head element of aliases is the atom :Elixir, no expansion happen;

      + +

      4) When the head element of aliases is not an atom, it is expanded at runtime:

      + +
        quote do: some_var.Foo
      +  {:__aliases__,0,[{:some_var,0,:quoted},:Bar]}
      +
      + +

      Since some_var is not available at compilation time, the compiler + expands such expression to:

      + +
        Module.concat [some_var, Foo]
      +
      - Source + Source

      __block__(args) @@ -239,7 +270,7 @@

      Examples

      it belonged to another file.

      quote location: :keep, do: 1
      -#=> { :__scope__, 1,[[file: "iex"], 1] }
      +#=> { :__scope__, 1,[[file: "iex"],[do: 1]] }
       

      Check quote/1 for more information.

      @@ -336,8 +367,8 @@

      Selector

      import :all, List
       
      -

      It can also be customized to import only functions or only -macros:

      +

      It can also be customized to import only all functions or +all macros:

      import :functions, List
       import :macros, List
      diff --git a/docs/master/Kernel.Typespec.html b/docs/master/Kernel.Typespec.html
      index 218e10160..8c1e96032 100644
      --- a/docs/master/Kernel.Typespec.html
      +++ b/docs/master/Kernel.Typespec.html
      @@ -27,10 +27,14 @@ 

      -

      This is the module that converts Elixir typespecs -to Erlang typespecs syntax. Everytime @spec, @type -and @typep are used they proxy to the functions -in this module.

      +

      Holds macros and functions for working with typespecs.

      + +

      The attributes @type, @opaque, @typep, @spec and +@callback available in modules are handled by the equivalent +macros defined by this module.

      + +

      See http://www.erlang.org/doc/reference_manual/typespec.html +for more information.

      @@ -46,12 +50,57 @@

      Functions summary

      • - get_specs/1 + beam_callbacks/1 + +
      • +
      • + + beam_specs/1 + +
      • +
      • + + beam_types/1 + +
      • +
      • + + define_callback/3 + +
      • +
      • + + define_spec/3 + +
      • +
      • + + define_type/3 + +
      • +
      • + + defines_callback?/3 + +
      • +
      • + + defines_spec?/3 + +
      • +
      • + + defines_type?/3
      • - get_types/1 + spec_to_ast/1 + +
      • +
      • + + type_to_ast/1
      • @@ -66,6 +115,11 @@

        Macros summary

        defcallback/2 +
      • + + defopaque/1 + +
      • defspec/2 @@ -73,7 +127,7 @@

        Macros summary

      • - deftype/2 + deftype/1
      • @@ -91,25 +145,105 @@

        Macros summary

        Functions

        -

        - get_specs(module) +

        + beam_callbacks(module) +

        +

        Returns all callbacks available from the beam.

        + +

        It is returned as a list of tuples where the first +element is spec name and arity and the second is the spec.

        + +

        The module has to have a corresponding beam file +on the file system.

        +
        + Source +
        +

        + beam_specs(module) +

        +

        Returns all specs available from the beam.

        + +

        It is returned as a list of tuples where the first +element is spec name and arity and the second is the spec.

        + +

        The module has to have a corresponding beam file +on the file system.

        +
        + Source +
        +

        + beam_types(module) +

        +

        Returns all types available from the beam.

        + +

        It is returned as a list of tuples where the first +element is the type (:typep, :type and :opaque).

        + +

        The module has to have a corresponding beam file +on the file system.

        +
        + Source +
        +

        + define_callback(module, tuple, definition) +

        +

        Defines a callback by receiving Erlang's typespec.

        +
        + Source +
        +

        + define_spec(module, tuple, definition) +

        +

        Defines a spec by receiving Erlang's typespec.

        +
        + Source +
        +

        + define_type(module, kind, type) +

        +

        Defines a type, typep or opaque by receiving Erlang's typespec.

        +
        + Source +
        +

        + defines_callback?(module, name, arity) +

        +

        Returns true if the current module defines a callback. +This function is only available for modules being compiled.

        +
        + Source +
        +

        + defines_spec?(module, name, arity)

        -

        Get the specs defined for the given module. This function -is only available for modules being compiled. If the module -was already compiled, you need to loop its attributes -to get such information.

        +

        Returns true if the current module defines a given spec. +This function is only available for modules being compiled.

        - Source + Source
        -

        - get_types(module) +

        + defines_type?(module, name, arity)

        -

        Get the types defined for the given module. This function -is only available for modules being compiled. If the module -was already compiled, you need to loop its attributes -to get such information.

        +

        Returns true if the current module defines a given type +(private, opaque or not). This function is only available +for modules being compiled.

        - Source + Source +
        +

        + spec_to_ast(arg1) +

        +

        Converts a spec clause back to Elixir AST. +Returns a 2-items tuple with the spec arguments and return result.

        +
        + Source +
        +

        + type_to_ast(arg1) +

        +

        Converts a type clause back to Elixir AST.

        +
        + Source
        @@ -121,26 +255,67 @@

        Macros

        defcallback(spec, block)

        -
        - Source +

        Defines a callback. +This macro is the one responsible to handle the attribute @callback.

        + +

        Examples

        + +
        @callback add(number, number), do: number
        +
        +
        + Source +
        +

        + defopaque(type) +

        +

        Defines an opaque type. +This macro is the one responsible to handle the attribute @opaque.

        + +

        Examples

        + +
        @opaque my_type :: atom
        +
        +
        + Source

        defspec(spec, block)

        -
        - Source +

        Defines a spec. +This macro is the one responsible to handle the attribute @spec.

        + +

        Examples

        + +
        @spec add(number, number), do: number
        +
        +
        + Source
        -

        - deftype(name, options // []) +

        + deftype(type)

        -
        - Source +

        Defines a type. +This macro is the one responsible to handle the attribute @type.

        + +

        Examples

        + +
        @type my_type :: atom
        +
        +
        + Source

        - deftypep(name) + deftypep(type)

        -
        - Source +

        Defines a private type. +This macro is the one responsible to handle the attribute @typep.

        + +

        Examples

        + +
        @typep my_type :: atom
        +
        +
        + Source
        diff --git a/docs/master/Kernel.html b/docs/master/Kernel.html index 1e6010df6..fdd6d4f40 100644 --- a/docs/master/Kernel.html +++ b/docs/master/Kernel.html @@ -151,21 +151,6 @@

        Functions summary

        function_exported?/3
      • -
      • - - halt/0 - -
      • -
      • - - halt/1 - -
      • -
      • - - halt/2 - -
      • hd/1 @@ -678,6 +663,11 @@

        Macros summary

        defrecord/4
      • +
      • + + defrecordp/2 + +
      • destructure/2 @@ -1089,59 +1079,14 @@

        Examples

        it is not loaded. Check Code.ensure_loaded/1 for more information.

      - Source -
      -

      - halt() -

      -

      The same as halt(0, []).

      -
      - Source -
      -

      - halt(status) -

      -

      The same as halt(status, []).

      -
      - Source -
      -

      - halt(status, options) -

      -

      Halts the Erlang runtime system where the first argument status must be a -non-negative integer, a char list, or the atom :abort.

      - -
        -
      • If an integer, the runtime system exits with the integer value which -is returned to the Operating System;

      • -
      • If a char list, an erlang crash dump is produced with status as slogan, -and then the runtime system exits with status code 1;

      • -
      • If :abort, the runtime system aborts producing a core dump, if that is -enabled in the operating system.

      • -
      - -

      Note that on many platforms, only the status codes 0-255 are supported -by the operating system.

      - -

      For integer status, Erlang runtime system closes all ports and allows async -threads to finish their operations before exiting. To exit without such -flushing, pass options [flush: false] instead.

      - -

      Examples

      - -
      halt(0)
      -halt(1, flush: false)
      -halt(:abort)
      -
      -
      - Source + Source

      hd(list)

      Returns the head of a list, raises badarg if the list is empty.

      - Source + Source

      integer_to_list(number) @@ -1154,7 +1099,7 @@

      Examples

      #=> '7'
      - Source + Source

      integer_to_list(number, base) @@ -1168,7 +1113,7 @@

      Examples

      #=> "3FF"
      - Source + Source

      iolist_size(item) @@ -1181,7 +1126,7 @@

      Examples

      #=> 4
      - Source + Source

      iolist_to_binary(item) @@ -1198,7 +1143,7 @@

      Examples

      #=> <<1,2,3,1,2,3,4,5,4,6>>
      - Source + Source

      is_alive() @@ -1206,7 +1151,7 @@

      Examples

      Returns true if the local node is alive; that is, if the node can be part of a distributed system.

      - Source + Source

      is_atom(term) @@ -1215,7 +1160,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      is_binary(term) @@ -1226,7 +1171,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      is_bitstring(term) @@ -1235,7 +1180,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      is_boolean(term) @@ -1245,7 +1190,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      is_float(term) @@ -1254,7 +1199,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      is_function(term) @@ -1263,7 +1208,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      is_function(term, arity) @@ -1273,7 +1218,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      is_integer(term) @@ -1282,7 +1227,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      is_list(term) @@ -1291,7 +1236,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      is_number(term) @@ -1301,7 +1246,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      is_pid(term) @@ -1310,7 +1255,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      is_port(term) @@ -1319,7 +1264,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      is_reference(term) @@ -1328,7 +1273,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      is_tuple(term) @@ -1337,7 +1282,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      length(list) @@ -1351,7 +1296,7 @@

      Examples

      length([1,2,3,4,5,6,7,8,9]) #=> 9
       
      - Source + Source

      list_to_atom(char_list) @@ -1363,7 +1308,7 @@

      Examples

      list_to_atom('elixir') #=> :elixir
       
      - Source + Source

      list_to_binary(char_list) @@ -1375,7 +1320,7 @@

      Examples

      list_to_binary('Elixir') #=> "Elixir"
       
      - Source + Source

      list_to_bitstring(bitstring_list) @@ -1393,7 +1338,7 @@

      Examples

      #=> <<1,2,3,1,2,3,4,5,4,6,7|4>>
      - Source + Source

      list_to_existing_atom(char_list) @@ -1401,7 +1346,7 @@

      Examples

      Returns the atom whose text representation is char_list, but only if there already exists such atom.

      - Source + Source

      list_to_float(char_list) @@ -1413,7 +1358,7 @@

      Examples

      list_to_float('2.2017764e+0') #=> 2.2017764
       
      - Source + Source

      list_to_integer(char_list) @@ -1425,7 +1370,7 @@

      Examples

      list_to_integer('123') #=> 123
       
      - Source + Source

      list_to_integer(char_list, base) @@ -1437,7 +1382,7 @@

      Examples

      list_to_integer('3FF', 16) #=> 1023
       
      - Source + Source

      list_to_pid(char_list) @@ -1456,7 +1401,7 @@

      Examples

      list_to_pid('<0.41>') #=> <0.4.1>
       
      - Source + Source

      list_to_tuple(list) @@ -1468,7 +1413,7 @@

      Examples

      list_to_tuple([:share, [:elixir, 163]]). #=> {:share, [:elixir, 163]}
       
      - Source + Source

      make_ref() @@ -1484,7 +1429,7 @@

      Examples

      #=> #Ref<0.0.0.135>
      - Source + Source

      max(first, second) @@ -1498,7 +1443,7 @@

      Examples

      max(1, 2) #=> 2
       
      - Source + Source

      min(first, second) @@ -1512,7 +1457,7 @@

      Examples

      min(1, 2) #=> 1
       
      - Source + Source

      node() @@ -1522,7 +1467,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      node(arg) @@ -1533,7 +1478,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      pid_to_list(pid) @@ -1549,7 +1494,7 @@

      Warning:

      It should not be used in application programs.

      - Source + Source

      raise(msg) @@ -1572,7 +1517,7 @@

      Examples

      end
      - Source + Source

      raise(exception, args) @@ -1593,7 +1538,7 @@

      Examples

      raise ArgumentError, message: "Sample"
       
      - Source + Source

      round(number) @@ -1606,7 +1551,7 @@

      Examples

      round(5.5) #=> 6
       
      - Source + Source

      self() @@ -1614,7 +1559,7 @@

      Examples

      Returns the pid (process identifier) of the calling process. Allowed in guard clauses.

      - Source + Source

      size(arg) @@ -1622,7 +1567,7 @@

      Examples

      Returns the size of the given argument, which must be a tuple or a binary. If possible, please use tuplesize or binarysize.

      - Source + Source

      spawn(fun) @@ -1642,7 +1587,7 @@

      Examples

      end
      - Source + Source

      spawn(module, fun, args) @@ -1658,7 +1603,7 @@

      Examples

      spawn(SomeModule, :function, [1,2,3])
       
      - Source + Source

      spawn_link(fun) @@ -1679,7 +1624,7 @@

      Examples

      end
      - Source + Source

      spawn_link(module, fun, args) @@ -1695,7 +1640,7 @@

      Examples

      spawn_link(SomeModule, :function, [1,2,3])
       
      - Source + Source

      term_to_binary(term) @@ -1707,7 +1652,7 @@

      Examples

      to a file in an efficient way, or sending an Erlang term to some type of communications channel not supported by distributed :

      - Source + Source

      term_to_binary(term, opts) @@ -1721,21 +1666,21 @@

      Examples

      for more details
      - Source + Source

      throw(term)

      A non-local return from a function. Check try/2 for more information.

      - Source + Source

      tl(list)

      Returns the tail of a list. Raises ArgumentError if the list is empty.

      - Source + Source

      trunc(number) @@ -1748,21 +1693,21 @@

      Examples

      trunc(5.5) #=> 5
       
      - Source + Source

      tuple_size(tuple)

      Returns the size of a tuple.

      - Source + Source

      tuple_to_list(tuple)

      Converts a tuple to a list.

      - Source + Source
      @@ -1844,7 +1789,7 @@

      Examples

      this operator accepts any expression as arguments, not only booleans, however it is not allowed in guards.

      - Source + Source

      *(left, right) @@ -1929,7 +1874,7 @@

      Examples

      3 in 1..3 #=> true
      - Source + Source

      /(left, right) @@ -1965,7 +1910,7 @@

      Examples

      Enum.map(List.flatten([1,[2],3]), &1 * 2)
       
      - Source + Source

      <(left, right) @@ -2027,7 +1972,7 @@

      Examples

      x #=> "bar"
      - Source + Source

      ==(left, right) @@ -2080,7 +2025,7 @@

      Examples

      "abcd" =~ %r/e/ #=> nil
      - Source + Source

      >(left, right) @@ -2156,7 +2101,7 @@

      Examples

      time and not at runtime. Check the module Module for other functions to manipulate module attributes.

      - Source + Source

      __B__(string, list2) @@ -2170,7 +2115,7 @@

      Examples

      %B(f#{o}o) #=> "f\#{o}o"
      - Source + Source

      __C__(arg1, list2) @@ -2184,7 +2129,7 @@

      Examples

      %C(f#{o}o) #=> 'f\#{o}o'
      - Source + Source

      __R__(arg1, options) @@ -2197,7 +2142,7 @@

      Examples

      Regex.match? %R(f#{1,3}o), "f#o"  #=> true
       
      - Source + Source

      __b__(arg1, list2) @@ -2211,7 +2156,7 @@

      Examples

      %b(f#{:o}o) #=> "foo"
      - Source + Source

      __c__(arg1, list2) @@ -2225,7 +2170,7 @@

      Examples

      %c(f#{:o}o) #=> 'foo'
      - Source + Source

      __r__(arg1, options) @@ -2237,7 +2182,7 @@

      Examples

      Regex.match? %r(foo), "foo"  #=> true
       
      - Source + Source

      access(element, args) @@ -2311,7 +2256,7 @@

      Examples

      access a, 1 #=> :a
      - Source + Source

      and(left, right) @@ -2338,7 +2283,7 @@

      Examples

      atom_to_binary :my_atom #=> "my_atom"
       
      - Source + Source

      binary_to_atom(some_binary) @@ -2351,7 +2296,7 @@

      Examples

      binary_to_atom "my_atom" #=> :my_atom
       
      - Source + Source

      binary_to_existing_atom(some_binary) @@ -2364,7 +2309,7 @@

      Examples

      binary_to_existing_atom "my_atom" #=> :my_atom
      - Source + Source

      binary_to_float(some_binary) @@ -2376,7 +2321,7 @@

      Examples

      binary_to_float "2.2017764e+0" #=> 2.2017764
       
      - Source + Source

      binary_to_integer(some_binary) @@ -2388,7 +2333,7 @@

      Examples

      binary_to_integer "123" #=> 123
       
      - Source + Source

      binary_to_integer(some_binary, base) @@ -2401,7 +2346,7 @@

      Examples

      binary_to_integer("3FF", 16) #=> 1023
       
      - Source + Source

      case(condition, blocks) @@ -2454,7 +2399,7 @@

      Examples

      end
      - Source + Source

      cond(list1) @@ -2474,7 +2419,7 @@

      Examples

      end
      - Source + Source

      def(name, list2) @@ -2551,7 +2496,7 @@

      Dynamic generation with atoms

      because each entry k is a an atom and invoking def unquote(k)() would be invalid Elixir syntax.

      - Source + Source

      def(name, args, guards, list4) @@ -2588,7 +2533,7 @@

      Examples

      def name, args, guards, do: exprs
      - Source + Source

      defdelegate(funs, opts) @@ -2627,17 +2572,17 @@

      Examples

      defdelegate other_reverse(list), to: :lists, as: :reverse end -My:lists.reverse([1,2,3]) +MyList.reverse([1,2,3]) #=> [3,2,1] MyList.other_reverse([1,2,3]) #=> [3,2,1]
      - Source + Source

      - defexception(name, values, opts // [], do_block // []) + defexception(name, fields, opts // [], do_block // [])

      Defines an exception.

      @@ -2646,10 +2591,10 @@

      Examples

      differences:

      1) Differently from records, exceptions are documented by default; -2) Exceptions must implement message/1 as API and return a +2) Exceptions must implement message/1 as API that return a binary as result;

      - Source + Source

      defimpl(name, opts, do_block // []) @@ -2657,7 +2602,7 @@

      Examples

      Defines an implementation for the given protocol. See defprotocol/2 for examples.

      - Source + Source

      defmodule(name, list2) @@ -2705,7 +2650,7 @@

      Dynamic names

      Elixir will accept any module name as long as the expression returns an atom.

      - Source + Source

      defoverridable(tuples) @@ -2714,7 +2659,7 @@

      Dynamic names

      An overridable function is lazily defined, allowing a developer to customize it.

      - Source + Source

      defp(name, list2) @@ -2738,14 +2683,14 @@

      Examples

      In the example above, sum is private and accessing it through Foo.sum will raise an error.

      - Source + Source

      defp(name, args, guards, list4)

      The same as def/4 but generates a private function.

      - Source + Source

      defprotocol(name, list2) @@ -2816,7 +2761,7 @@

      Selecting implementations

      Reference are never going to be blank, it would be easier if we could simply provide a default implementation.

      -

      This can be achieved with Elixir as follows:

      +

      This can be achieved in Elixir as follows:

      defprotocol Blank do
         @only [Atom, Tuple, List, BitString, Any]
      @@ -2857,13 +2802,32 @@ 

      Protocols + Records

      Finally, since records are simply tuples, one can add a default protocol implementation to any record by defining a default implementation for tuples.

      + +

      Types

      + +

      As in records, defining a protocol automatically defines a type named t, +which can be used as:

      + +
      @spec present?(Blank.t), do: boolean
      +def present?(blank) do
      +  not Blank.blank?(blank)
      +end
      +
      + +

      The @spec above expresses that all types allowed to implement the +given protocol are valid argument types for the given function.

      - Source + Source

      - defrecord(name, values, opts // [], do_block // []) + defrecord(name, fields, opts // [], do_block // [])

      -

      Define a record given by name and values.

      +

      Defines a record.

      + +

      A record is a tagged tuple which contains one or more elements +and the first element is a module. This macro defines a module +that generates accessors to manipulate the record at both +compilation and runtime.

      Examples

      @@ -2873,18 +2837,18 @@

      Examples

      The line above will define a module named FileInfo which contains a function named new that returns a new record and other functions to read and set the values in the -record. Therefore, we can do:

      +record:

      file_info = FileInfo.new(atime: now())
       file_info.atime         #=> Returns the value of atime
       file_info.atime(now())  #=> Updates the value of atime
       
      -

      Internally, a record is simply a tuple where the first element is -the record module name. This can be noticed if we print the record:

      +

      A record is simply a tuple where the first element is the record +module name. We can get the record raw representation as follow:

      -
      IO.inspect FileInfo.new
      -{ FileInfo, nil, nil }
      +
      inspect FileInfo.new, raw: true
      +#=> { FileInfo, nil, nil }
       

      Extensions

      @@ -2892,8 +2856,8 @@

      Extensions

      Besides defining readers and writers for each attribute. Elixir will define extensions functions for each attribute. By default, it will define an update_#{attribute} function to update the value. Such -functions expect a function as argument that receives the current value -and must return the new one:

      +functions expect a function as argument that receives the current +value and must return the new one:

      file_info.update_atime(fn(_old) -> now() end) #=> Updates the value of atime
       
      @@ -2921,20 +2885,82 @@

      Extensions

      • merge_field - Receives keywords and merge it into the current value;
      • -
      • prepend_field - Receives another list and prepend its values
      • +
      • prepend_field - Receives another list and prepend its values;
      -

      You can define your own extensions or disable them using the except -option:

      +

      Documentation

      + +

      By default records are not documented and have @moduledoc set to false.

      -
      defrecord Config, [counter: 0, failures: []], except: [:extensions]
      +

      Types

      + +

      Every record defines a type named t that can be accessed in typespecs. +For example, assuming the Config record defined above, it could be used +in typespecs as follow:

      + +
      @spec handle_config(Config.t), do: boolean()
       
      -

      Documentation

      +

      Inside the record definition, a developer can define his own types too:

      -

      By default records are not documented and have @moduledoc set to false.

      +
      defrecord Config, counter: 0, failures: [] do
      +  @type kind :: term
      +  record_type counter: integer, failures: [kind]
      +end
      +
      + +

      When defining a type, all the fields not mentioned in the type are +assumed to have type term.

      - Source + Source +
      +

      + defrecordp(name, fields) +

      +

      Defines a record with a set of private macros to manipulate it.

      + +

      A record is a tagged tuple which contains one or more elements +and the first element is a module. This macro defines a set of +macros private to the current module to manipulate the record +exclusively at compilation time.

      + +

      defrecordp must be used instead of defrecord when there is +no interest in exposing the record as a whole. In many ways, +it is similar to Erlang records, since it is only available at +compilation time.

      + +

      Examples

      + +
      defmodule User do
      +  defrecordp :user, [name: "José", age: "25"]
      +end
      +
      + +

      In the example above, a set of macros named user but with different +arities will be defined to manipulate the underlying record:

      + +
      # To create records
      +user()        #=> { User, "José", 25 }
      +user(age: 26) #=> { User, "José", 26 }
      +
      +# To get a field from the record
      +user(record, :name) #=> "José"
      +
      +# To get many fields from the record
      +user(record, [:name, :age]) #=> ["José", 25]
      +
      +# To update the record
      +user(record, age: 26) #=> { User, "José", 26 }
      +
      +# To convert the record to keywords
      +user(record) #=> [name: "José", age: 25]
      +
      +# To match against the record
      +user(name: name) = record
      +name #=> "José"
      +
      +
      + Source

      destructure(left, right) @@ -2975,7 +3001,7 @@

      Examples

      the first value from the right side. Otherwise, it will raise a CaseClauseError.

      - Source + Source

      div(left, right) @@ -2989,7 +3015,7 @@

      Examples

      div 5, 2 #=> 2
       
      - Source + Source

      elem(tuple, index) @@ -3005,7 +3031,7 @@

      Example

      elem(tuple, 1) #=> :bar
      - Source + Source

      float_to_binary(some_float) @@ -3018,7 +3044,7 @@

      Examples

      float_to_binary 7.0 #=> "7.00000000000000000000e+00"
       
      - Source + Source

      function(args) @@ -3100,7 +3126,7 @@

      Function retrieval

      f.([1,[2],3]) #=> [1,2,3]
      - Source + Source

      if(condition, clauses) @@ -3144,7 +3170,7 @@

      Blocks examples

      If you want to compare more than two clauses, you can use the cond/1 macro.

      - Source + Source

      in(left, right) @@ -3186,7 +3212,7 @@

      Clauses

      In this case, Elixir will automatically expand it and define the variable for us.

      - Source + Source

      inspect(arg, opts // []) @@ -3210,7 +3236,7 @@

      Examples

      #=> ":foo"
      - Source + Source

      integer_to_binary(some_integer) @@ -3223,7 +3249,7 @@

      Examples

      integer_to_binary 123 #=> "123"
       
      - Source + Source

      integer_to_binary(some_integer, base) @@ -3236,7 +3262,7 @@

      Examples

      integer_to_binary 77 #=> "77"
       
      - Source + Source

      is_exception(thing) @@ -3249,14 +3275,14 @@

      Examples

      is_exception(1) #=> false
      - Source + Source

      is_range(thing)

      Check if the given argument is a range.

      - Source + Source

      is_record(thing, kind) @@ -3273,14 +3299,14 @@

      Examples

      is_record(Config.new, List) #=> false
      - Source + Source

      is_regex(thing)

      Check if the given argument is a regex.

      - Source + Source

      match?(left, right) @@ -3307,7 +3333,7 @@

      Examples

      Enum.filter list, match?({:a, x } when x < 2, &1)
      - Source + Source

      nil?(x) @@ -3321,7 +3347,7 @@

      Examples

      nil? nil #=> true
      - Source + Source

      not(arg) @@ -3397,7 +3423,7 @@

      Examples

      will occur immediately.

      - Source + Source

      rem(left, right) @@ -3411,7 +3437,7 @@

      Examples

      rem 5, 2 #=> 1
       
      - Source + Source

      setelem(tuple, index, value) @@ -3427,7 +3453,7 @@

      Example

      setelem(tuple, 0, :baz) #=> { :baz, :bar, 3 }
      - Source + Source

      to_binary(arg) @@ -3441,7 +3467,7 @@

      Examples

      #=> "foo"
      - Source + Source

      to_char_list(arg) @@ -3454,7 +3480,7 @@

      Examples

      #=> 'foo'
      - Source + Source

      try(args) @@ -3562,7 +3588,7 @@

      Catching exits and Erlang errors

      Although the second form should be avoided in favor of raise/rescue control mechanisms.

      - Source + Source

      unless(clause, options) @@ -3571,7 +3597,7 @@

      Catching exits and Erlang errors

      unless a value evalutes to true. Check if for examples and documentation.

      - Source + Source

      use(module, args // []) @@ -3608,7 +3634,7 @@

      Examples

      end
      - Source + Source

      var!(var) @@ -3652,7 +3678,7 @@

      Examples

      this operator accepts any expression as arguments, not only booleans, however it is not allowed in guards.

      - Source + Source diff --git a/docs/master/Keyword.KeyError.html b/docs/master/KeyError.html similarity index 98% rename from docs/master/Keyword.KeyError.html rename to docs/master/KeyError.html index 1168bcd2e..0d290fde0 100644 --- a/docs/master/Keyword.KeyError.html +++ b/docs/master/KeyError.html @@ -1,7 +1,7 @@ - Keyword.KeyError + KeyError @@ -21,7 +21,7 @@

      - Keyword.KeyError + KeyError exception diff --git a/docs/master/Keyword.html b/docs/master/Keyword.html index a151742da..9ba61189e 100644 --- a/docs/master/Keyword.html +++ b/docs/master/Keyword.html @@ -91,6 +91,11 @@

      Functions summary

      keys/1 +
    2237. + + keyword?/1 + +
    2238. merge/2 @@ -162,7 +167,7 @@

      Examples

      Keyword.delete [b: 2], :a #=> [b: 2]
    2239. - Source + Source

      equal?(left, right) @@ -176,7 +181,7 @@

      Examples

      #=> true
      - Source + Source

      from_enum(enum) @@ -185,7 +190,7 @@

      Examples

      which behaves as a dict, Keyword.from_enum do not remove duplicated entries.

      - Source + Source

      get(keywords, key, default // nil) @@ -205,7 +210,7 @@

      Examples

      Keyword.get [a: 1], :b, 3 #=> 3
      - Source + Source

      get!(keywords, key) @@ -219,7 +224,7 @@

      Examples

      Keyword.get! [a: 1], :b #=> raises KeyError[key: :b]
      - Source + Source

      get_values(keywords, key) @@ -232,7 +237,7 @@

      Examples

      #=> [1,2]
      - Source + Source

      has_key?(keywords, key) @@ -247,7 +252,7 @@

      Examples

      #=> false
      - Source + Source

      keys(keywords) @@ -260,7 +265,14 @@

      Examples

      Keyword.keys [a: 1, b: 2] #=> [:a,:b]
       
      - Source + Source +
      +

      + keyword?(arg1) +

      +

      Checks if the given argument is a keywords list or not

      +
      + Source

      merge(d1, d2) @@ -274,7 +286,7 @@

      Examples

      #=> [a:3, b:2, d: 4]
      - Source + Source

      merge(d1, d2, fun) @@ -290,14 +302,14 @@

      Examples

      #=> [a:4, b:2, d: 4]
      - Source + Source

      new()

      Returns an empty keyword list, i.e. an empty list.

      - Source + Source

      new(pairs) @@ -311,7 +323,7 @@

      Examples

      #=> [a: 2, b: 1]
      - Source + Source

      new(pairs, transform) @@ -326,10 +338,10 @@

      Examples

      #=> [a: :a, b: :b]
      - Source + Source

      - put(list, key, value) + put(keywords, key, value)

      Sets the given value under key.

      @@ -342,23 +354,23 @@

      Examples

      #=> [a: 3, b: 2]
      - Source + Source

      update(list1, key, fun)

      Updates the key with the given function. If the key does -not exist, raises Keyword.KeyError.

      +not exist, raises KeyError.

      Examples

      Keyword.update([a: 1], :a, &1 * 2)
       #=> [a: 2]
       Keyword.update([a: 1], :b, &1 * 2)
      -#=> Keyword.KeyError
      +#=> KeyError
       
      - Source + Source

      update(list1, key, initial, fun) @@ -374,7 +386,7 @@

      Examples

      #=> [a: 1, b: 11]
      - Source + Source

      values(keywords) @@ -386,7 +398,7 @@

      Examples

      Keyword.values [a: 1, b: 2] #=> [1,2]
       
      - Source + Source diff --git a/docs/master/List.html b/docs/master/List.html index 90855ded3..520c0f061 100644 --- a/docs/master/List.html +++ b/docs/master/List.html @@ -305,7 +305,7 @@

      Examples

      #=> [{ :a, 1 }, { :b, 2 }]
      - Source + Source

      keyfind(list, key, position, default // nil) @@ -326,7 +326,7 @@

      Examples

      #=> nil
      - Source + Source

      keymember?(list, key, position) @@ -347,7 +347,7 @@

      Examples

      #=> false
      - Source + Source

      keyreplace(list, key, position, new_tuple) @@ -361,7 +361,7 @@

      Examples

      #=> [a: 3, b: 2]
      - Source + Source

      keystore(list, key, position, new_tuple) @@ -376,7 +376,7 @@

      Examples

      #=> [a: 3, b: 2]
      - Source + Source

      last(list) @@ -393,7 +393,7 @@

      Examples

      #=> 3
      - Source + Source

      member?(list, term) @@ -411,7 +411,7 @@

      Examples

      #=> false
      - Source + Source

      range(first, last, step // nil) @@ -431,7 +431,7 @@

      Examples

      List.range 5, 1, -2 #=> [5, 3, 1]
      - Source + Source

      sort(list) @@ -445,7 +445,7 @@

      Examples

      #=> [1, 2, 3, 4, 7]
      - Source + Source

      sort(list, fun) @@ -459,7 +459,7 @@

      Examples

      #=> [7, 4, 3, 2, 1]
      - Source + Source

      uniq(list) @@ -472,7 +472,7 @@

      Examples

      #=> [1,2,3]
      - Source + Source

      unzip(list) @@ -489,7 +489,7 @@

      Examples

      #=> [[1, 2, 3], [:a, :b, :c]]
      - Source + Source

      wrap(list) @@ -503,7 +503,7 @@

      Examples

      List.wrap [1,2,3] #=> [1,2,3]
       
      - Source + Source

      zip(list_of_lists) @@ -519,7 +519,7 @@

      Examples

      #=> [{1, 3, 5}]
      - Source + Source diff --git a/docs/master/Macro.Env.html b/docs/master/Macro.Env.html index 2bd367c00..5ddaf60db 100644 --- a/docs/master/Macro.Env.html +++ b/docs/master/Macro.Env.html @@ -85,6 +85,12 @@

      Fields (and defaults)

      +
    2240. + + functions: nil + +
    2241. +
    2242. macros: nil @@ -137,6 +143,16 @@

      Functions summary

      function/2
    2243. +
    2244. + + functions/1 + +
    2245. +
    2246. + + functions/2 + +
    2247. in_guard?/1 @@ -232,6 +248,11 @@

      Functions summary

      update_function/2
    2248. +
    2249. + + update_functions/2 + +
    2250. update_line/2 @@ -319,6 +340,19 @@

      Functions

      Source +
      +

      + functions(record) +

      +

      Returns a list of functions imported from each module.

      +
      + Source +
      +

      + functions(value, record) +

      +
      + Source

      in_guard?(record) @@ -326,7 +360,7 @@

      Functions

      Returns wether the compilation environment is currently inside a guard.

      - Source + Source

      in_match?(record) @@ -334,7 +368,7 @@

      Functions

      Returns wether the compilation environment is currently inside a match clause.

      - Source + Source

      line(record) @@ -355,7 +389,7 @@

      Functions

      Returns a keyword list containing the file and line information as keys.

      - Source + Source

      macros(record) @@ -443,6 +477,12 @@

      Functions

      Source +
      +

      + update_functions(function, record) +

      +
      + Source

      update_line(function, record) diff --git a/docs/master/Macro.html b/docs/master/Macro.html index d2b594e3f..6a2fb12ab 100644 --- a/docs/master/Macro.html +++ b/docs/master/Macro.html @@ -117,7 +117,7 @@

      Functions

      do_safe_term(terms)

      - Source + Source

      escape(tuple) @@ -231,7 +231,7 @@

      Examples

      end
      - Source + Source

      safe_term(terms) @@ -241,7 +241,7 @@

      Examples

      evaluate code) and returns :ok unless a given term is unsafe, which is returned as { :unsafe, term }.

      - Source + Source

      to_binary(tree) diff --git a/docs/master/Mix.Deps.html b/docs/master/Mix.Deps.html index 06675fa1e..018965bc1 100644 --- a/docs/master/Mix.Deps.html +++ b/docs/master/Mix.Deps.html @@ -66,11 +66,6 @@

      Functions summary

      check_lock/2
    2251. -
    2252. - - deps_path/1 - -
    2253. format_dep/1 @@ -149,13 +144,6 @@

      Exceptions

      Checks the lock for the given dependency and update its status accordingly.

      Source -
      -

      - deps_path(arg1) -

      -

      Returns the path for the given dependency.

      -
      - Source

      format_dep(arg1) diff --git a/docs/master/Mix.Project.html b/docs/master/Mix.Project.html index 396d92802..b6549ba48 100644 --- a/docs/master/Mix.Project.html +++ b/docs/master/Mix.Project.html @@ -23,8 +23,6 @@

      Mix.Project - behaviour -

      @@ -110,7 +108,7 @@

      Functions

      Returns the project configuration already considering the current environment.

      - Source + Source

      get() @@ -125,14 +123,14 @@

      Functions

      Returns nil if no project./

      - Source + Source

      get!()

      Same as get/0 but raises an exception if no project.

      - Source + Source

      refresh() @@ -140,7 +138,7 @@

      Functions

      Refresh the project configuration. Usually required when the environment changes during a task.

      - Source + Source
      diff --git a/docs/master/Mix.SCM.html b/docs/master/Mix.SCM.html index 1f0ba27bc..29c52be27 100644 --- a/docs/master/Mix.SCM.html +++ b/docs/master/Mix.SCM.html @@ -66,51 +66,6 @@

      Functions summary

      -

      Callbacks summary

      - -
      @@ -121,21 +76,21 @@

      Functions

      Returns all available SCM.

      - Source + Source

      register(mod)

      Register the scm repository with the given key and mod.

      - Source + Source

      register_builtin()

      Register builtin SCMs.

      - Source + Source
      @@ -143,98 +98,6 @@

      Functions

      -
      -

      Callbacks

      -
      -

      - available?(path, opts) -

      -

      This behavior function receives a path, opts and returns -a boolean if the dependency is available.

      -
      - Source -
      -

      - check?(path, opts) -

      -

      This behavior function checks if the dependency is locked and -the current repository version matches the lock. Note that some -SCMs do not require a lock, for such, this function can simply -return true.

      -
      - Source -
      -

      - checkout(path, opts) -

      -

      This behavior function checks out dependencies.

      - -

      If the dependency is locked, a lock is received in opts -and the repository must be check out at the lock. Otherwise, -no lock is given and the repository can be checked out -to the latest version.

      -
      - Source -
      -

      - clean(path, opts) -

      -

      This behavior function should clean the given dependency.

      -
      - Source -
      -

      - consumes?(opts) -

      -

      This behavior function receives a keyword list of opts -and should return an updated list in case the SCM consumes -the available options. For example, when a developer specifies -a dependency:

      - -
      { "foo", "0.1.0", github: "foo/bar" }
      -
      - -

      Each registered SCM will be asked if they consume this dependency, -receiving [github: "foo/bar"] as argument. Since this option makes -sense for the Git SCM, it will return an update list of options -while other SCMs would simply return nil.

      -
      - Source -
      -

      - key() -

      -

      This behavior function should retrieve an atom representing -the SCM key. In the dependency opts, a value for the given -must be found since it is used to print information about -the requested dependency.

      -
      - Source -
      -

      - match?(opts1, opts2) -

      -

      Receives two options and must return true if the refer to the -same repository.

      -
      - Source -
      -

      - update(path, opts) -

      -

      This behavior function updates dependencies. It may be -called by deps.get or deps.update.

      - -

      In the first scenario, a lock is received in opts and -the repository must be updated to the lock. In the second, -no lock is given and the repository can be updated freely.

      - -

      It must return the current lock.

      -
      - Source -
      -
      - diff --git a/docs/master/Mix.Shell.IO.html b/docs/master/Mix.Shell.IO.html new file mode 100644 index 000000000..2a5bf04ac --- /dev/null +++ b/docs/master/Mix.Shell.IO.html @@ -0,0 +1,103 @@ + + + + Mix.Shell.IO + + + + + + + + + + + + +
      +

      + Mix.Shell.IO + +

      + + +
      +

      This is Mix's default shell. +It simply prints messages to stdio and stderr.

      + +
      + + + Source + + + + + + +

      Functions summary

      + + + + + + + + +
      +

      Functions

      +
      +

      + error(message) +

      +

      Writes an error message to the shell followed by new line.

      +
      + Source +
      +

      + info(message) +

      +

      Writes a message to the shell followed by new line.

      +
      + Source +
      +

      + yes?(message) +

      +

      Receives a message and asks the user if he wants to proceed. +He must press enter or type anything that matches the a "yes" +regex %r/^Y(es)?$/i.

      +
      + Source +
      +
      + + + + + +
      + + diff --git a/docs/master/Mix.Shell.html b/docs/master/Mix.Shell.html index 1d9d87cf1..859c46af2 100644 --- a/docs/master/Mix.Shell.html +++ b/docs/master/Mix.Shell.html @@ -29,8 +29,7 @@

      -

      This is Mix's default shell. -It simply prints messages to stdio and stderr.

      +

      Defines Mix.Shell contract.

      @@ -42,30 +41,7 @@

      -

      Functions summary

      - @@ -73,43 +49,6 @@

      Functions summary

      -
      -

      Functions

      -
      -

      - behaviour_info(atom1) -

      -

      Define Mix.Shell callbacks.

      -
      - Source -
      -

      - error(message) -

      -

      Writes an error message to the shell followed by new line.

      -
      - Source -
      -

      - info(message) -

      -

      Writes a message to the shell followed by new line.

      -
      - Source -
      -

      - yes?(message) -

      -

      Receives a message and asks the user if he wants to proceed. -He must press enter or type anything that matches the a "yes" -regex %r/^Y(es)?$/i.

      -
      - Source -
      -
      - - - diff --git a/docs/master/Mix.Task.html b/docs/master/Mix.Task.html index 95590f114..028a6b6c7 100644 --- a/docs/master/Mix.Task.html +++ b/docs/master/Mix.Task.html @@ -111,7 +111,7 @@

      Functions

      Returns all loaded modules. Modules that were not yet loaded won't show up. Check load_all/0 if you want to preload all tasks.

      - Source + Source

      clear() @@ -119,7 +119,7 @@

      Functions

      Clears all invoked tasks, allowing them to be reinvoked. Returns an ordset with all the tasks invoked thus far.

      - Source + Source

      get(task) @@ -133,21 +133,21 @@

      Exceptions

    2254. Mix.InvalidTaskError - raised if the task is not a valid Mix.Task
    2255. - Source + Source

      hidden?(module)

      Checks if the task is hidden or not. Returns a boolean.

      - Source + Source

      load_all()

      Loads all tasks in all code paths.

      - Source + Source

      moduledoc(module) @@ -155,14 +155,14 @@

      Exceptions

      Gets the moduledoc for the given module. Returns the moduledoc or nil.

      - Source + Source

      reenable(task)

      Reenables a given task so it can be executed again down the stack.

      - Source + Source

      run(task, args // []) @@ -177,7 +177,7 @@

      Exceptions

      It may raise an exception if the task was not found or it is invalid. Check get/2 for more information.

      - Source + Source

      shortdoc(module) @@ -185,14 +185,14 @@

      Exceptions

      Gets the shortdoc for the given module. Returns the shortdoc or nil.

      - Source + Source

      task_name(module)

      Returns the task name for the given module.

      - Source + Source
      diff --git a/docs/master/Mix.Tasks.Compile.Elixir.html b/docs/master/Mix.Tasks.Compile.Elixir.html index 01606d896..0e8732754 100644 --- a/docs/master/Mix.Tasks.Compile.Elixir.html +++ b/docs/master/Mix.Tasks.Compile.Elixir.html @@ -41,8 +41,12 @@

      force compilation regardless of mod times by passing the --force option.

      -

      A list of files can be given after the task -name in order to select the files to compile.

      +

      Note it is important to recompile all files because +often there are compilation time dependencies between +the files (macros and etc). However, in some cases it +is useful to compile just the changed files for quick +development cycles, for such, a developer can pass +the --quick otion.

      Configuration

      @@ -56,7 +60,8 @@

      Configuration

      Command line options

        -
      • --force - forces compilation regardless of mod times;
      • +
      • --force - forces compilation regardless of module times;
      • +
      • --quick, -q - only compile files that changed;
      @@ -92,7 +97,7 @@

      Functions

      run(args)

      - Source + Source diff --git a/docs/master/Mix.Tasks.Compile.html b/docs/master/Mix.Tasks.Compile.html index a92b08255..29f4467a9 100644 --- a/docs/master/Mix.Tasks.Compile.html +++ b/docs/master/Mix.Tasks.Compile.html @@ -57,10 +57,6 @@

      Common configuration

      Defaults to "ebin", can be configured as:

      [compile_path: "ebin"]

      -
    2256. :compile_first - which files need to be compiled first. -They need to be a subset of the files found in source_paths.

      - -

      [compile_first: ["lib/foo.ex", "lib/bar.ex"]]

    2257. :watch_exts - extensions to watch in order to trigger a compilation:

      @@ -110,7 +106,7 @@

      Functions

      run(args)

      - Source + Source diff --git a/docs/master/Mix.Tasks.Deps.Get.html b/docs/master/Mix.Tasks.Deps.Get.html index d1e7797ea..477547303 100644 --- a/docs/master/Mix.Tasks.Deps.Get.html +++ b/docs/master/Mix.Tasks.Deps.Get.html @@ -63,7 +63,7 @@

      Functions

      run(args)

      - Source + Source diff --git a/docs/master/Mix.Tasks.Test.html b/docs/master/Mix.Tasks.Test.html index 257556357..c5a2433c6 100644 --- a/docs/master/Mix.Tasks.Test.html +++ b/docs/master/Mix.Tasks.Test.html @@ -42,8 +42,10 @@

      Configuration

        +
      • :test_paths - path containing tests. +Defaults to ["test"].

      • :test_pattern - a pattern to load test files. -Defaults to test/**/*_test.exs.

      • +Defaults to *_test.exs.

      • :test_helper - a file that sets up whatever is necessary for testing. Defaults to test/test_helper.exs.

      @@ -81,7 +83,7 @@

      Functions

      run(args)

      - Source + Source diff --git a/docs/master/Mix.Utils.html b/docs/master/Mix.Utils.html index 71883c0f7..861071dde 100644 --- a/docs/master/Mix.Utils.html +++ b/docs/master/Mix.Utils.html @@ -74,22 +74,27 @@

      Functions summary

    2258. - exclude_files/1 + extract_files/2
    2259. - extract_files/2 + extract_stale/2
    2260. - extract_files/3 + module_name_to_command/2
    2261. - module_name_to_command/2 + preserving_mtime/2 + +
    2262. +
    2263. + + relative_to_cwd/1
    2264. @@ -165,7 +170,7 @@

      Examples

      #=> "Compile.Elixir" - Source + Source

      config_merge(old, new) @@ -174,33 +179,25 @@

      Examples

      and concatenating normal lists.

      Source -
      -

      - exclude_files(files) -

      -

      Filtering out files which start with "."

      -
      - Source

      extract_files(paths, exts)

      -

      Extract the files from the given paths with -the given extension. -It ignores files which start with "."

      +

      Extract files from a list of paths or from a wildcard.

      + +

      If the list of paths contains a directory, the directory +is expanded according to the given pattern.

      + +

      It ignores files which start with "."

      - Source + Source
      -

      - extract_files(paths, files, exts) +

      + extract_stale(sources, targets)

      -

      Extract the files from the given paths with -the given extension in case files is an empty -array. If not, get the common subset between -files and the extracted files. -It ignores files which start with "."

      +

      Extract all stale sources compared to the given targets.

      - Source + Source

      module_name_to_command(module, nesting // 0) @@ -218,7 +215,23 @@

      Examples

      #=> "compile.elixir"
      - Source + Source +
      +

      + preserving_mtime(path, fun) +

      +

      Executes a function but preserves the given path +mtime properties.

      +
      + Source +
      +

      + relative_to_cwd(path) +

      +

      Returns the given path string relative to the current +working directory.

      +
      + Source

      source(module) @@ -228,12 +241,11 @@

      Examples

      Source

      - stale?(source, target) + stale?(sources, targets)

      -

      Returns true if any of target is stale compared to source. -If target or source is a binary, it is expanded using File.wildcard.

      +

      Returns true if any of the sources are stale compared to the given target.

      - Source + Source

      underscore(atom) diff --git a/docs/master/Module.html b/docs/master/Module.html index 519f6ba73..1305c5b87 100644 --- a/docs/master/Module.html +++ b/docs/master/Module.html @@ -143,6 +143,11 @@

      Functions summary

      split/1
    2265. +
    2266. + + to_binary/1 + +
    2267. @@ -172,7 +177,7 @@

      Examples

      end - Source + Source

      concat(list) @@ -187,7 +192,7 @@

      Examples

      Module.concat [Foo, 'Bar'] #=> Foo.Bar
      - Source + Source

      concat(left, right) @@ -202,7 +207,7 @@

      Examples

      Module.concat Foo, 'Bar' #=> Foo.Bar
      - Source + Source

      create(module, quoted, opts // []) @@ -218,7 +223,7 @@

      Examples

      def world, do: true end -Module.create(Hello, contents, __ENV__) +Module.create(Hello, contents, __ENV__.location) Hello.world #=> true @@ -231,13 +236,12 @@

      Differences with defmodule

      function is preferred when the module body is given by a quoted expression.

      -

      Another important distinction is that defmodule -blends into the scope it is invoked, allowing you -to access all variables, imports and requires from -the module. Module.create, on the other hand, creates -a new scope so imports, requires, etc are not inherited.

      +

      Another important distinction is that Module.create +allows you to control the environment variables used +when defining the module, while defmodule automatically +shares the same environment.

      - Source + Source

      defines?(module, tuple) @@ -254,7 +258,7 @@

      Examples

      end
      - Source + Source

      defines?(module, tuple, kind) @@ -272,7 +276,7 @@

      Examples

      end
      - Source + Source

      definitions_in(module) @@ -287,7 +291,7 @@

      Examples

      end
      - Source + Source

      definitions_in(module, kind) @@ -304,7 +308,7 @@

      Examples

      end
      - Source + Source

      delete_attribute(module, key) @@ -319,48 +323,40 @@

      Examples

      end
      - Source + Source

      - eval_quoted(env, quoted, binding // [], opts // []) + eval_quoted(module, quoted, binding // [], opts // [])

      -

      Evalutes the quotes contents in the given module context. -Raises an error if the module was already compiled.

      +

      Evalutes the quotes contents in the given module context.

      -

      Options

      +

      A list of environment options can also be given as argument. +Check Code.eval for more information.

      -

      This function accepts a list of options. The supported -options are:

      - -
        -
      • :file - The filename to be used in stacktraces -and the file reported in the ENV variable.

      • -
      • :line - The line reported in the ENV variable.

      • -
      +

      Raises an error if the module was already compiled.

      Examples

      defmodule Foo do
         contents = quote do: (def sum(a, b), do: a + b)
      -  Module.eval_quoted __MODULE__, contents, []
      +  Module.eval_quoted __MODULE__, contents
       end
       
       Foo.sum(1, 2) #=> 3
       
      -

      This function also accepts a Macro.Env as first argument. This -is useful to evalute the quoted contents inside an existing -environment (considering the environemnt module, line and file):

      +

      For convenience, you can my pass __ENV__ as argument and +all options will be automatically extracted from the environment:

      defmodule Foo do
         contents = quote do: (def sum(a, b), do: a + b)
      -  Module.eval_quoted __ENV__, contents, []
      +  Module.eval_quoted __MODULE__, contents, [], __ENV__
       end
       
       Foo.sum(1, 2) #=> 3
       
      - Source + Source

      get_attribute(module, key) @@ -381,7 +377,7 @@

      Examples

      end
      - Source + Source

      make_overridable(module, tuples) @@ -390,7 +386,7 @@

      Examples

      An overridable function is lazily defined, allowing a developer to customize it.

      - Source + Source

      open?(module) @@ -405,7 +401,7 @@

      Examples

      Returns true if the given tuple in module is marked as overridable.

      - Source + Source

      put_attribute(module, key, value) @@ -421,7 +417,7 @@

      Examples

      end
      - Source + Source

      register_attribute(module, new, opts // []) @@ -458,7 +454,7 @@

      Examples

      end
      - Source + Source

      safe_concat(list) @@ -477,7 +473,7 @@

      Examples

      #=> List.Chars
      - Source + Source

      safe_concat(left, right) @@ -496,7 +492,7 @@

      Examples

      #=> List.Chars
      - Source + Source

      split(module) @@ -509,7 +505,14 @@

      Examples

      #=> ["Very", "Long", "Module", "Name", "And", "Even", "Longer"]
      - Source + Source +
      +

      + to_binary(module) +

      +

      Convert a module name to binary without the Elixir prefix.

      +
      + Source
      diff --git a/docs/master/Node.html b/docs/master/Node.html index 1c967e210..987b310f8 100644 --- a/docs/master/Node.html +++ b/docs/master/Node.html @@ -76,11 +76,21 @@

      Functions summary

      self/0 +
    2268. + + spawn/2 + +
    2269. spawn/3
    2270. +
    2271. + + spawn/4 + +
    2272. spawn/5 @@ -174,28 +184,51 @@

      Functions

      Source
      -

      - spawn(node, fun, opts // []) +

      + spawn(node, fun)

      Returns the pid of a new process started by the application of fun on node. If node does not exist, a useless pid is returned.

      -

      Check http://www.erlang.org/doc/man/erlang.html#spawn_opt-4 for +

      Check http://www.erlang.org/doc/man/erlang.html#spawn-2 for the list of available options.

      Source +
      +

      + spawn(node, fun, opts) +

      +

      Returns the pid of a new process started by the application of fun +on node. If node does not exist, a useless pid is returned.

      + +

      Check http://www.erlang.org/doc/man/erlang.html#spawn_opt-3 for +the list of available options.

      +
      + Source +
      +

      + spawn(node, module, fun, args) +

      +

      Returns the pid of a new process started by the application of +module.function(args) on node. If node does not exists, +a useless pid is returned.

      + +

      Check http://www.erlang.org/doc/man/erlang.html#spawn-4 for +the list of available options.

      +
      + Source

      - spawn(node, module, fun, args, opts // []) + spawn(node, module, fun, args, opts)

      Returns the pid of a new process started by the application of -module.function(args) on node. If node does not exists, a useless -pid is returned.

      +module.function(args) on node. If node does not exists, +a useless pid is returned.

      -

      Check http://www.erlang.org/doc/man/erlang.html#spawn_opt-4 for +

      Check http://www.erlang.org/doc/man/erlang.html#spawn_opt-5 for the list of available options.

      - Source + Source

      spawn_link(node, fun) @@ -206,7 +239,7 @@

      Functions

      (and due to the link, an exit signal with exit reason :noconnection will be received).

      - Source + Source

      spawn_link(node, module, fun, args) @@ -217,7 +250,7 @@

      Functions

      pid is returned (and due to the link, an exit signal with exit reason :noconnection will be received).

      - Source + Source diff --git a/docs/master/OptionParser.html b/docs/master/OptionParser.html index cbf2ff5ef..de952d0fd 100644 --- a/docs/master/OptionParser.html +++ b/docs/master/OptionParser.html @@ -121,7 +121,7 @@

      Example

      #=> { [source: "lib"], ["test/enum_test.exs", "--verbose"] } - Source + Source diff --git a/docs/master/Process.html b/docs/master/Process.html index c9d620e54..2550ec82b 100644 --- a/docs/master/Process.html +++ b/docs/master/Process.html @@ -151,11 +151,21 @@

      Functions summary

      self/0
    2273. +
    2274. + + spawn/1 + +
    2275. spawn/2
    2276. +
    2277. + + spawn/3 + +
    2278. spawn/4 @@ -241,7 +251,7 @@

      Functions

      See http://www.erlang.org/doc/man/erlang.html#demonitor-2 for more info.

      - Source + Source

      exit(pid, status) @@ -278,7 +288,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#process_flag-2 for more info.

      - Source + Source

      flag(pid, flag, value) @@ -289,7 +299,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#process_flag-3 for more info.

      - Source + Source

      get() @@ -319,7 +329,7 @@

      Examples

      Returns the pid of the group leader for the process which evaluates the function.

      - Source + Source

      group_leader(leader, pid) @@ -327,7 +337,7 @@

      Examples

      Sets the group leader of Pid to GroupLeader. Typically, this is used when a processes started from a certain shell should have another group leader than :init.

      - Source + Source

      info(pid) @@ -337,7 +347,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#process_info-1 for more info.

      - Source + Source

      info(pid, spec) @@ -347,7 +357,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#process_info-2 for more info.

      - Source + Source

      link(pid) @@ -357,7 +367,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#link-1 for more info.

      - Source + Source

      list() @@ -371,7 +381,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#processes-0 for more info.

      - Source + Source

      monitor(item) @@ -381,7 +391,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#monitor-2 for more info.

      - Source + Source

      put(key, value) @@ -399,14 +409,14 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#register-2 for more info.

      - Source + Source

      registered()

      Returns a list of names which have been registered using register/2.

      - Source + Source

      self() @@ -414,30 +424,47 @@

      Examples

      Returns the current process.

      Source +
      +

      + spawn(fun) +

      +

      Returns the pid of a new process started by the application of fun. +It behaves exactly the same as Kernel.spawn/1.

      +
      + Source

      - spawn(fun, opts // []) + spawn(fun, opts)

      Returns the pid of a new process started by the application of fun.

      -

      It behaves exactly the same as the Kernel.spawn/1 function except -it also accepts extra options, for the list of available options -check http://www.erlang.org/doc/man/erlang.html#spawn_opt-4

      +

      It also accepts extra options, for the list of available options +check http://www.erlang.org/doc/man/erlang.html#spawn_opt-2

      +
      + Source +
      +

      + spawn(mod, fun, args) +

      +

      Returns the pid of a new process started by the application of +module.function(args). The new process created will be placed in the system +scheduler queue and be run some time later.

      + +

      It behaves exactly the same as the Kernel.spawn/3 function.

      - Source + Source

      - spawn(mod, fun, args, opts // []) + spawn(mod, fun, args, opts)

      Returns the pid of a new process started by the application of module.function(args). The new process created will be placed in the system scheduler queue and be run some time later.

      -

      It behaves exactly the same as the Kernel.spawn/3 function except -it also accepts extra options, for the list of available options +

      It also accepts extra options, for the list of available options check http://www.erlang.org/doc/man/erlang.html#spawn_opt-4

      - Source + Source

      spawn_link(fun) @@ -446,7 +473,7 @@

      Examples

      A link is created between the calling process and the new process, atomically.

      - Source + Source

      spawn_link(mod, fun, args) @@ -455,7 +482,7 @@

      Examples

      module.function(args). A link is created between the calling process and the new process, atomically. Otherwise works like spawn/3.

      - Source + Source

      spawn_monitor(fun) @@ -463,7 +490,7 @@

      Examples

      Returns the pid of a new process started by the application of fun and reference for a monitor created to the new process.

      - Source + Source

      spawn_monitor(mod, fun, args) @@ -472,7 +499,7 @@

      Examples

      and the process is monitored at the same time. Returns the pid and a reference for the monitor. Otherwise works like spawn/3.

      - Source + Source

      unlink(pid) @@ -483,7 +510,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#unlink-1 for more info.

      - Source + Source

      unregister(name) @@ -492,7 +519,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#unregister-1 for more info.

      - Source + Source

      whereis(name) @@ -502,7 +529,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#whereis-1 for more info.

      - Source + Source diff --git a/docs/master/Record.html b/docs/master/Record.html index ad46fb822..3dc1395e7 100644 --- a/docs/master/Record.html +++ b/docs/master/Record.html @@ -56,6 +56,16 @@

      Functions summary

      defrecord/3
    2279. +
    2280. + + defrecordp/2 + +
    2281. +
    2282. + + deftypes/4 + +
    2283. extract/2 @@ -77,71 +87,61 @@

      Functions

      deffunctions(values, opts // [], env)

      Defines record functions skipping the module definition. -This is called directly by defrecord. It expects the -module environment, the module values and a keyword list -of options.

      +This is called directly by defrecord. It expects the record +values, a set of options and the module environment.

      Examples

      defmodule CustomRecord do
         Record.deffunctions [:name, :age], __ENV__
      +  Record.deftypes [:name, :age], __ENV__
       end
       
      - Source + Source

      defmacros(name, values, env)

      -

      Defines three macros for reading and writing records values. -These macros are private to the current module and are -basically a simple mechanism for manipulating tuples when -there isn't an interest in exposing the record as a whole. -In some ways, it is similar to Erlang records, since it is -only available at compilation time.

      +

      Defines macros for manipulating records. This is called +directly by defrecordp. It expects the macro name, the +record values and the environment.

      Examples

      -
      defmodule CustomModule do
      -  Record.defmacros :_user, [:name, :age], __ENV__
      -
      -  def new(name, age) do
      -    _user(name: name, age: age)
      -  end
      -
      -  def name(user, name) do
      -    _user(user, name: name)
      -  end
      -
      -  def age(user) do
      -    _user(user, :age)
      -  end
      -
      -  def to_keywords(user) do
      -    _user(user)
      -  end
      -
      -  def name_and_age(user) do
      -   _user(user, [:name, :age])
      -  end
      -
      -  def age_and_name(user) do
      -   _user(user, [:age, :name])
      -  end
      +
      defmodule CustomRecord do
      +  Record.defmacros :user, [:name, :age], __ENV__
       end
       
      - Source + Source

      defrecord(name, values, opts)

      Main entry point for records definition. It defines a module -with the given name and the fields specified in modules. +with the given name and the fields specified in values. This is invoked directly by Kernel.defrecord, so check it for more information and documentation.

      Source +
      +

      + defrecordp(name, fields) +

      +

      Main entry point for private records definition. It defines +a set of macros with the given name and the fields specified +in values. This is invoked directly by Kernel.defrecordp, +so check it for more information and documentation.

      +
      + Source +
      +

      + deftypes(values, types, opts // [], env) +

      +

      Defines types and specs for the record.

      +
      + Source

      extract(name, opts) diff --git a/docs/master/Regex.CompileError.html b/docs/master/Regex.CompileError.html index 04db72f15..4b8e3454a 100644 --- a/docs/master/Regex.CompileError.html +++ b/docs/master/Regex.CompileError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -110,55 +110,55 @@

      Functions

      exception(args)

      - Source + Source

      exception(args, self)

      - Source + Source

      message(record)

      - Source + Source

      message(value, record)

      - Source + Source

      new()

      - Source + Source

      new(opts)

      - Source + Source

      to_keywords(record)

      - Source + Source

      update(keywords, record)

      - Source + Source

      update_message(function, record)

      - Source + Source
      diff --git a/docs/master/Regex.html b/docs/master/Regex.html index 0d76f3a26..d1484e700 100644 --- a/docs/master/Regex.html +++ b/docs/master/Regex.html @@ -111,11 +111,6 @@

      Functions summary

      index/2
    2284. -
    2285. - - indexes/2 - -
    2286. match?/2 @@ -178,7 +173,7 @@

      Examples

      Regex.captures %r/c(?<foo>d)/g, "abcd"  #=> [{:foo, ["d"]}]
       
      - Source + Source

      compile(source, options // "") @@ -188,7 +183,7 @@

      Examples

      It returns { :ok, regex } in case of success, { :error, reason } otherwise.

      - Source + Source

      compile!(source, options // "") @@ -196,7 +191,7 @@

      Examples

      Compiles the regular expression according to the given options. Fails with Regex.CompileError if the regex cannot be compiled.

      - Source + Source

      groups(arg1) @@ -208,7 +203,7 @@

      Examples

      Regex.groups %r/(?<foo>foo)/g #=> ["foo"]
       
      - Source + Source

      index(arg1, string) @@ -223,23 +218,7 @@

      Examples

      Regex.index %r/e/, "abcd" #=> nil
      - Source -
      -

      - indexes(arg1, string) -

      -

      Returns a list with the match indexes in the given string. -The matches are tuples where the first element is the index -(zero indexed) the match happened and the second is the length -of the match.

      - -

      Examples

      - -
      Regex.indexes %r/c(d)/, "abcd"  #=> [{2,2},{3,1}]
      -Regex.indexes %r/e/, "abcd"     #=> nil
      -
      -
      - Source + Source

      match?(arg1, string) @@ -252,7 +231,7 @@

      Examples

      Regex.match? %r/foo/, "bar" #=> false
      - Source + Source

      opts(arg1) @@ -264,14 +243,14 @@

      Examples

      Regex.opts %r(foo)m #=> 'm'
       
      - Source + Source

      re_pattern(arg1)

      Returns the underlying re_pattern in the regular expression.

      - Source + Source

      replace(arg1, string, replacement, options // []) @@ -293,7 +272,7 @@

      Examples

      Regex.replace(%r/(b)/, "abc", "[\\1]") #=> "a[b]c"
      - Source + Source

      run(regex, string, options // []) @@ -307,7 +286,7 @@

      Examples

      Regex.run %r/e/, "abcd" #=> nil
      - Source + Source

      scan(regex, string, options // []) @@ -324,7 +303,7 @@

      Examples

      Regex.scan %r/e/, "abcd" #=> []
      - Source + Source

      source(arg1) @@ -336,7 +315,7 @@

      Examples

      Regex.source %r(foo) #=> "foo"
       
      - Source + Source

      split(regex, string, options // []) @@ -344,7 +323,7 @@

      Examples

      Split the given target in the number of parts specified. If no ammount of parts is given, it defaults to :infinity.

      - Source + Source
      diff --git a/docs/master/String.html b/docs/master/String.html index 665f5d55b..9a91d2bdd 100644 --- a/docs/master/String.html +++ b/docs/master/String.html @@ -28,8 +28,14 @@

      A string in Elixir is a utf-8 binary. This module -contains function to work with utf-8 data and its -codepoints.

      +contains function to work with utf-8 data, its +codepoints and graphemes.

      + +

      Notice that graphemes is a superset of UTF-8 codepoints +which also contains named sequences as defined per +http://www.unicode.org/reports/tr34/. In short, graphemes +also contain multiple characters that are "perceived as +a single character" by readers.

      For working with raw binaries, use Erlang's :binary module.

      @@ -71,6 +77,11 @@

      Functions summary

      first/1

    2287. +
    2288. + + graphemes/1 + +
    2289. last/1 @@ -86,6 +97,16 @@

      Functions summary

      lstrip/2
    2290. +
    2291. + + next_codepoint/1 + +
    2292. +
    2293. + + next_grapheme/1 + +
    2294. printable?/1 @@ -131,7 +152,7 @@

      Functions

      at(string, position)

      -

      Returns the codepoint in the position of the given utf8 string. +

      Returns the grapheme in the position of the given utf8 string. If position is greater than string length, than it returns nil.

      Examples

      @@ -140,10 +161,10 @@

      Examples

      String.at("elixir", 1) #=> "l" String.at("elixir", 10) #=> nil String.at("elixir", -1) #=> "r" -String.at("elixir", -10) #=> "nil" +String.at("elixir", -10) #=> nil
      - Source + Source

      codepoints(string) @@ -157,12 +178,16 @@

      Examples

      String.codepoints("ἅἪῼ") #=> ["ἅ","Ἢ","ῼ"]
      - Source + Source

      - downcase(arg1) + downcase(binary)

      -

      Convert all characters on the given string to down case.

      +

      Convert all characters on the given string to downcase.

      + +

      This function relies on the simple lowercase mapping +available in Unicode 6.2.0, check http://unicode.org/reports/tr44/ +for more information.

      Examples

      @@ -171,7 +196,7 @@

      Examples

      String.downcase("JOSÉ") #=> "josé"
      - Source + Source

      duplicate(subject, n) @@ -184,12 +209,12 @@

      Examples

      String.duplicate("abc", 2) #=> "abcabc"
      - Source + Source

      first(string)

      -

      Returns the first codepoint from an utf8 string.

      +

      Returns the first grapheme from an utf8 string.

      Examples

      @@ -197,12 +222,23 @@

      Examples

      String.first("եոգլի") #=> "ե"
      - Source + Source +
      +

      + graphemes(string) +

      +

      Returns unicode graphemes in the string

      + +

      Examples

      + +

      String.graphemes("Ā̀stute") # => ["Ā̀","s","t","u","t","e"]

      +
      + Source

      last(string)

      -

      Returns the last codepoint from an utf8 string.

      +

      Returns the last grapheme from an utf8 string.

      Examples

      @@ -210,12 +246,12 @@

      Examples

      String.last("եոգլի") #=> "ի"
      - Source + Source

      length(string)

      -

      Returns the number of codepoint in an utf8 string.

      +

      Returns the number of unicode graphemes in an utf8 string.

      Examples

      @@ -223,7 +259,7 @@

      Examples

      String.length("եոգլի") #=> 5
      - Source + Source

      lstrip(string, char // 32) @@ -237,7 +273,39 @@

      Examples

      String.lstrip("_ abc _", ?_) #=> " abc _"
      - Source + Source +
      +

      + next_codepoint(string) +

      +

      Returns the next codepoint in a String.

      + +

      The result is a tuple with the codepoint and the +remaining of the string or :no_codepoint in case +the String reached its end.

      + +

      Examples

      + +
      String.next_codepoint("josé") #=> { "j", "osé" }
      +
      +
      + Source +
      +

      + next_grapheme(string) +

      +

      Returns the next grapheme in a String.

      + +

      The result is a tuple with the grapheme and the +remaining of the string or :no_grapheme in case +the String reached its end.

      + +

      Examples

      + +
      String.next_grapheme("josé") #=> { "j", "osé" }
      +
      +
      + Source

      printable?(arg1) @@ -250,7 +318,7 @@

      Examples

      String.printable?("abc") #=> true
       
      - Source + Source

      replace(subject, pattern, replacement, options // []) @@ -273,7 +341,7 @@

      Examples

      String.replace("a,b,c", ",", "[]", insert_replaced: [1,1]) #=> "a[,,]b[,,]c"
      - Source + Source

      rstrip(string, char // 32) @@ -316,7 +384,7 @@

      Examples

      String.split("a,b", %r{.}) #=> ["a,b"]
      - Source + Source

      strip(string, char // 32) @@ -330,12 +398,16 @@

      Examples

      String.strip("a abc a", ?a) #=> " abc "
      - Source + Source

      - upcase(arg1) + upcase(binary)

      -

      Convert all characters on the given string to upper case.

      +

      Convert all characters on the given string to upcase.

      + +

      This function relies on the simple uppercase mapping +available in Unicode 6.2.0, check http://unicode.org/reports/tr44/ +for more information.

      Examples

      @@ -344,7 +416,7 @@

      Examples

      String.upcase("josé") #=> "JOSÉ"
      - Source + Source
      diff --git a/docs/master/System.html b/docs/master/System.html index b8e219696..d35f14197 100644 --- a/docs/master/System.html +++ b/docs/master/System.html @@ -83,6 +83,11 @@

      Functions summary

      get_pid/0
    2295. +
    2296. + + halt/2 + +
    2297. put_env/1 @@ -192,6 +197,40 @@

      Functions

      See http://www.erlang.org/doc/man/os.html#getpid-0 for more info.

      Source +
      +

      + halt(status // 0, options // []) +

      +

      Halts the Erlang runtime system where the first argument status must be a +non-negative integer, the atom :abort or any type that can be converted +to a char list.

      + +
        +
      • If an integer, the runtime system exits with the integer value which +is returned to the Operating System;

      • +
      • If :abort, the runtime system aborts producing a core dump, if that is +enabled in the operating system;

      • +
      • If a char list, an erlang crash dump is produced with status as slogan, +and then the runtime system exits with status code 1;

      • +
      + +

      Note that on many platforms, only the status codes 0-255 are supported +by the operating system.

      + +

      For integer status, Erlang runtime system closes all ports and allows async +threads to finish their operations before exiting. To exit without such +flushing, pass options [flush: false] instead.

      + +

      For more information, check: http://www.erlang.org/doc/man/erlang.html#halt-2

      + +

      Examples

      + +
      System.halt(0)
      +System.halt(1, flush: false)
      +System.halt(:abort)
      +
      +
      + Source

      put_env(dict) diff --git a/docs/master/URI.Parser.html b/docs/master/URI.Parser.html index 2a02c4f7f..d1bca10fe 100644 --- a/docs/master/URI.Parser.html +++ b/docs/master/URI.Parser.html @@ -46,46 +46,12 @@

      -

      Callbacks summary

      - - - -
      -

      Callbacks

      -
      -

      - default_port() -

      -

      Responsible for returning the default port.

      -
      - Source -
      -

      - parse(uri_info) -

      -

      Responsible for parsing extra URL information.

      -
      - Source -
      -
      -
      diff --git a/docs/master/modules_list.html b/docs/master/modules_list.html index 2a4f90af0..ed4264833 100644 --- a/docs/master/modules_list.html +++ b/docs/master/modules_list.html @@ -16,7 +16,7 @@
    2298. +
    2299. + + get!/2 + + Binary.Dict +
    2300. +
    2301. has_key?/2 @@ -268,108 +275,6 @@

      Bitwise

    2302. - -
    2303. - - - Calendar - - Calendar -
    2304. -
    2305. @@ -539,6 +444,13 @@

      Dict

    2306. +
    2307. + + get!/2 + + Dict +
    2308. +
    2309. has_key?/2 @@ -941,20 +853,6 @@

      Enum

    2310. -
    2311. - - times/2 - - Enum -
    2312. - -
    2313. - - times/3 - - Enum -
    2314. -
    2315. zip/2 @@ -1079,6 +977,101 @@

      ExUnit.Assertions

    2316. + +
    2317. + + + CLIFormatter + + ExUnit.CLIFormatter +
    2318. +
    2319. @@ -1097,6 +1090,17 @@

      ExUnit.Case

    2320. + +
    2321. + + + Formatter + + ExUnit.Formatter +
    2322. +
        + +
      @@ -1699,6 +1703,27 @@

      IEx.Helpers +
    2323. + + s/1 + + IEx.Helpers +
    2324. + +
    2325. + + s/3 + + IEx.Helpers +
    2326. + +
    2327. + + t/1 + + IEx.Helpers +
    2328. +
    2329. v/0 @@ -1808,6 +1833,27 @@

    2330. @@ -4798,6 +4862,13 @@

      Node

    2331. +
    2332. + + spawn/2 + + Node +
    2333. +
    2334. spawn/3 @@ -4805,6 +4876,13 @@

      Node

    2335. +
    2336. + + spawn/4 + + Node +
    2337. +
    2338. spawn/5 @@ -5115,6 +5193,13 @@

      Process

    2339. +
    2340. + + spawn/1 + + Process +
    2341. +
    2342. spawn/2 @@ -5122,6 +5207,13 @@

      Process

    2343. +
    2344. + + spawn/3 + + Process +
    2345. +
    2346. spawn/4 @@ -5210,6 +5302,20 @@

      Record

    2347. +
    2348. + + defrecordp/2 + + Record +
    2349. + +
    2350. + + deftypes/4 + + Record +
    2351. +
    2352. extract/2 @@ -5263,13 +5369,6 @@

      Regex

    2353. -
    2354. - - indexes/2 - - Regex -
    2355. -
    2356. match?/2 @@ -5372,6 +5471,13 @@

      String

    2357. +
    2358. + + graphemes/1 + + String +
    2359. +
    2360. last/1 @@ -5393,6 +5499,20 @@

      String

    2361. +
    2362. + + next_codepoint/1 + + String +
    2363. + +
    2364. + + next_grapheme/1 + + String +
    2365. +
    2366. printable?/1 @@ -5502,6 +5622,13 @@

      System

    2367. +
    2368. + + halt/2 + + System +
    2369. +
    2370. put_env/1 @@ -5660,20 +5787,6 @@

    2371. diff --git a/docs/master/protocols_list.html b/docs/master/protocols_list.html index 36d1f9ee6..7767530d3 100644 --- a/docs/master/protocols_list.html +++ b/docs/master/protocols_list.html @@ -16,7 +16,7 @@

      - Elixir v0.7.1.dev + Elixir v0.7.1

    2372. +
    2373. + + functions/1 + + Macro.Env +
    2374. + +
    2375. + + functions/2 + + Macro.Env +
    2376. +
    2377. in_guard?/1 @@ -1934,6 +1948,13 @@

      Macro.Env

    2378. +
    2379. + + update_functions/2 + + Macro.Env +
    2380. +
    2381. update_line/2 diff --git a/docs/stable/Access.Atom.html b/docs/stable/Access.Atom.html index f66916aff..6c366febb 100644 --- a/docs/stable/Access.Atom.html +++ b/docs/stable/Access.Atom.html @@ -29,7 +29,7 @@

      - Source + Source @@ -62,7 +62,7 @@

      Functions

      at compilation time. If we reach this, we should raise an exception.

      - Source + Source diff --git a/docs/stable/Access.Binary.Dict.html b/docs/stable/Access.Binary.Dict.html index 09a3ed345..64bb67f7e 100644 --- a/docs/stable/Access.Binary.Dict.html +++ b/docs/stable/Access.Binary.Dict.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/stable/Access.Function.html b/docs/stable/Access.Function.html index a8a20886d..7ee7625c8 100644 --- a/docs/stable/Access.Function.html +++ b/docs/stable/Access.Function.html @@ -29,7 +29,7 @@

      - Source + Source @@ -63,7 +63,7 @@

      Functions

      is useful because it allows a function to be passed as argument in places a dict would also fit.

      - Source + Source diff --git a/docs/stable/Access.HashDict.html b/docs/stable/Access.HashDict.html index a67f39f44..86891033e 100644 --- a/docs/stable/Access.HashDict.html +++ b/docs/stable/Access.HashDict.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/stable/Access.List.html b/docs/stable/Access.List.html index 8b0824e50..f538c7d31 100644 --- a/docs/stable/Access.List.html +++ b/docs/stable/Access.List.html @@ -29,7 +29,7 @@

      - Source + Source @@ -66,7 +66,7 @@

      Examples

      keywords[:a] #=> 1 - Source + Source diff --git a/docs/stable/Access.OrdDict.html b/docs/stable/Access.OrdDict.html index 4c528af5e..4a1609b50 100644 --- a/docs/stable/Access.OrdDict.html +++ b/docs/stable/Access.OrdDict.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/stable/Access.html b/docs/stable/Access.html index fab96371c..7e5b75936 100644 --- a/docs/stable/Access.html +++ b/docs/stable/Access.html @@ -32,11 +32,10 @@

      The Access protocol is the underlying protocol invoked when the brackets syntax is used. For instance, foo[bar] is translated to access foo, bar which, by default, -invokes Access.access protocol.

      +invokes the Access.access protocol.

      This protocol is limited and is implemented only for the -following built-in types: keywords, records, atoms and -functions.

      +following built-in types: keywords, records and functions.

      @@ -109,11 +108,11 @@

      Functions summary

      Functions

      - access(element, qualifier) + access(container, key)

      Receives the element being accessed and the access item.

      - Source + Source
      diff --git a/docs/stable/Behaviour.html b/docs/stable/Behaviour.html index ddce0d3bc..c20e5907e 100644 --- a/docs/stable/Behaviour.html +++ b/docs/stable/Behaviour.html @@ -39,14 +39,14 @@

      use Behaviour @doc "Parses the given URL" - defcallback parse(arg) + defcallback parse(uri_info :: URI.Info.t), do: URI.Info.t @doc "Defines a default port" - defcallback default_port() + defcallback default_port(), do: integer end -

      And then a specific protocol may use it as:

      +

      And then a specific module may use it as:

      defmodule URI.HTTP do
         @behaviour URI.Parser
      @@ -61,11 +61,14 @@ 

      Implementation

      -

      Internally, Erlang call behaviour_info(:callbacks) -to obtain all functions that a behaviour should -implemented. Therefore, all this module does is -to define behaviour_info(:callbacks) with the -defcallback definitions.

      +

      Behaviours since Erlang R15 must be defined via +@callback attributes. defcallback is a simple +mechanism that defines the @callback attribute +according to the type specification and also allows +docs and defines a custom function signature.

      + +

      The callbacks and their documentation can be retrieved +via the __behaviour__ callback function.

      @@ -83,7 +86,7 @@

      Macros summary

      • - defcallback/1 + defcallback/2
      • @@ -98,13 +101,10 @@

        Macros summary

        Macros

        -

        - defcallback(fun) +

        + defcallback(fun, list2)

        -

        Annotates the given function is a callback. defcallback is -slightly different than simple using def because, even if -defcallback contains default values, a default function -won't be generated, which would happen with def.

        +

        Defines a callback according to the given type specification.

        Source
        diff --git a/docs/stable/Binary.Dict.html b/docs/stable/Binary.Dict.html index 94bbad5c9..4df282f5f 100644 --- a/docs/stable/Binary.Dict.html +++ b/docs/stable/Binary.Dict.html @@ -60,6 +60,11 @@

        Functions summary

        get/3 +
      • + + get!/2 + +
      • has_key?/2 @@ -136,19 +141,25 @@

        Functions

        delete(arg1, key)

        - Source + Source
      • empty(_)

        - Source + Source

        get(arg1, key, default)

        Source +
        +

        + get!(arg1, key) +

        +
        + Source

        has_key?(arg1, key) @@ -166,7 +177,7 @@

        Functions

        merge(d1, d2, fun)

        - Source + Source

        new() @@ -206,7 +217,7 @@

        Examples

        put(arg1, key, value)

        - Source + Source

        size(arg1) @@ -218,19 +229,19 @@

        Examples

        to_list(arg1)

        - Source + Source

        update(arg1, key, fun)

        - Source + Source

        update(arg1, key, initial, fun)

        - Source + Source

        values(arg1) diff --git a/docs/stable/Binary.Inspect.Any.html b/docs/stable/Binary.Inspect.Any.html index 09580d5ef..0ad69e6df 100644 --- a/docs/stable/Binary.Inspect.Any.html +++ b/docs/stable/Binary.Inspect.Any.html @@ -40,7 +40,7 @@

        Examples

        - Source + Source diff --git a/docs/stable/Binary.Inspect.BitString.html b/docs/stable/Binary.Inspect.BitString.html index 72dccdf84..2ace9f3d4 100644 --- a/docs/stable/Binary.Inspect.BitString.html +++ b/docs/stable/Binary.Inspect.BitString.html @@ -41,7 +41,7 @@

        Examples

        - Source + Source diff --git a/docs/stable/Binary.Inspect.List.html b/docs/stable/Binary.Inspect.List.html index 730b02454..dcb0e4509 100644 --- a/docs/stable/Binary.Inspect.List.html +++ b/docs/stable/Binary.Inspect.List.html @@ -49,7 +49,7 @@

        Examples

        - Source + Source diff --git a/docs/stable/Binary.Inspect.Number.html b/docs/stable/Binary.Inspect.Number.html index 0586aeb29..c25f348bc 100644 --- a/docs/stable/Binary.Inspect.Number.html +++ b/docs/stable/Binary.Inspect.Number.html @@ -39,7 +39,7 @@

        Examples

        - Source + Source diff --git a/docs/stable/Binary.Inspect.Regex.html b/docs/stable/Binary.Inspect.Regex.html index 95c197203..d838cb495 100644 --- a/docs/stable/Binary.Inspect.Regex.html +++ b/docs/stable/Binary.Inspect.Regex.html @@ -39,7 +39,7 @@

        Examples

        - Source + Source diff --git a/docs/stable/Binary.Inspect.Tuple.html b/docs/stable/Binary.Inspect.Tuple.html index 24f94ce40..112c245c1 100644 --- a/docs/stable/Binary.Inspect.Tuple.html +++ b/docs/stable/Binary.Inspect.Tuple.html @@ -41,7 +41,7 @@

        Examples

        - Source + Source diff --git a/docs/stable/Code.html b/docs/stable/Code.html index 8e5d83e99..9a6c47eef 100644 --- a/docs/stable/Code.html +++ b/docs/stable/Code.html @@ -164,7 +164,7 @@

        Functions

        For compiling many files at once, check Kernel.ParallelCompiler.

        - Source + Source

        compiler_options() @@ -172,7 +172,7 @@

        Functions

        Loads the compilation options from the code server. Check compiler_options/1 for more information.

        - Source + Source

        compiler_options(opts) @@ -192,7 +192,7 @@

        Functions

        without raising errors, false by default;
      - Source + Source

      delete_path(path) @@ -217,7 +217,7 @@

      Functions

      Check ensure_loaded/1 for more information on module loading and when to use ensure_loaded/1 or ensure_compiled/1.

      - Source + Source

      ensure_compiled?(module) @@ -225,7 +225,7 @@

      Functions

      Similar to ensure_compiled/1, but returns a boolean in case it could be ensured or not.

      - Source + Source

      ensure_loaded(module) @@ -267,7 +267,7 @@

      Code.ensure_compiled

      must be used just in same rare conditions, usually involving macros that needs to invoke a module for callback information.

      - Source + Source

      ensure_loaded?(module) @@ -275,20 +275,26 @@

      Code.ensure_compiled

      Similar to ensure_loaded/1, but returns a boolean in case it could be ensured or not.

      - Source + Source

      eval(string, binding // [], opts // [])

      -

      Evalutes the contents given by string. The second argument is the binding -(which should be a Keyword) followed by a keyword list of options. The -options can be:

      +

      Evalutes the contents given by string. The second argument is the +binding (which should be a keyword) followed by a keyword list of +environment options. Those options can be:

      • :file - the file to be considered in the evaluation
      • :line - the line the script starts
      • +
      • :aliases - a list of tuples with the alias and its target
      • +
      • :requires - a list of modules required
      • +
      • :functions - a list of tuples where the first element is a module +and the second a list of imported function names and arity
      • +
      • :macros - a list of tuples where the first element is a module +and the second a list of imported macro names and arity
      • :delegate_locals_to - delegate local calls to the given module, -otherwise functions are evaluated inside Erlang's default scope.
      • +the default is to not delegate

      Examples

      @@ -297,30 +303,23 @@

      Examples

      #=> { 3, [ {:a, 1}, {:b, 2} ] }
      -

      When passing the ENV's file and line, we could simply get -the location which already returns both fields as a keyword list:

      +

      For convenience, you can my pass __ENV__ as argument and +all imports, requires and aliases will be automatically carried +over:

      -
      Code.eval "a + b", [a: 1, b: 2], __ENV__.location
      +
      Code.eval "a + b", [a: 1, b: 2], __ENV__
       #=> { 3, [ {:a, 1}, {:b, 2} ] }
       
      - Source + Source

      eval_quoted(quoted, binding // [], opts // [])

      Evalutes the quoted contents.

      -

      Options

      - -

      This function accepts a list of options. The supported -options are:

      - -
        -
      • :file - The filename to be used in stacktraces -and the file reported in the ENV variable.

      • -
      • :line - The line reported in the ENV variable.

      • -
      +

      This function accepts a list of environment options. +Check Code.eval for more information.

      Examples

      @@ -330,14 +329,14 @@

      Examples

      #=> { 3, [ {:a, 1}, {:b, 2} ] }
      -

      For convenience, you can also pass the current ENV and -the proper information will be extracted:

      +

      For convenience, you can my pass __ENV__ as argument and +all options will be automatically extracted from the environment:

      Code.eval_quoted contents, [a: 1, b: 2], __ENV__
       #=> { 3, [ {:a, 1}, {:b, 2} ] }
       
      - Source + Source

      load_file(file, relative_to // nil) @@ -353,7 +352,7 @@

      Examples

      a given file, the given file will be loaded N times. Check require_file if you don't want a file to be loaded concurrently.

      - Source + Source

      loaded_files() @@ -385,7 +384,7 @@

      Examples

      file, the given file will be loaded only once. Check load_file if you want a file to be loaded concurrently.

      - Source + Source

      string_to_ast(string, opts // []) @@ -403,7 +402,7 @@

      Options

      when non-existing atoms are found by the tokenizer.

    2382. - Source + Source

      string_to_ast!(string, opts // []) @@ -415,7 +414,7 @@

      Options

      Check Code.string_to_ast/2 for options information.

      - Source + Source

      unload_files(files) diff --git a/docs/stable/Dict.html b/docs/stable/Dict.html index 668fa5c4e..c90c74616 100644 --- a/docs/stable/Dict.html +++ b/docs/stable/Dict.html @@ -81,6 +81,11 @@

      Functions summary

      get/3

    2383. +
    2384. + + get!/2 + +
    2385. has_key?/2 @@ -158,14 +163,14 @@

      Examples

      Dict.delete d, :a #=> [b: 2] - Source + Source

      empty(dict)

      Returns an empty dict of the same type as dict.

      - Source + Source

      get(dict, key, default // nil) @@ -181,7 +186,22 @@

      Examples

      Dict.get d, :b, 3 #=> 3
      - Source + Source +
      +

      + get!(dict, key) +

      +

      Returns the value associated with key in dict. If dict does not +contain key, it raises KeyError.

      + +

      Examples

      + +
      d = new [a: 1]
      +Dict.get d, :a     #=> 1
      +Dict.get d, :b     #=> raises KeyError[key: :b]
      +
      +
      + Source

      has_key?(dict, key) @@ -195,7 +215,7 @@

      Examples

      Dict.has_key?(d, :b) #=> false
      - Source + Source

      keys(dict) @@ -210,7 +230,7 @@

      Examples

      Dict.keys d #=> [:a,:b]
      - Source + Source

      merge(dict1, dict2) @@ -228,7 +248,7 @@

      Examples

      #=> [a: 3, b: 2, d: 4]
      - Source + Source

      merge(dict1, dict2, fun) @@ -246,7 +266,7 @@

      Examples

      #=> [a: 4, b: 2, d: 4]
      - Source + Source

      put(dict, key, val) @@ -261,7 +281,7 @@

      Examples

      #=> [a: 3, b: 2]
      - Source + Source

      size(dict) @@ -274,7 +294,7 @@

      Examples

      Dict.size d #=> 2
      - Source + Source

      to_list(dict) @@ -282,7 +302,7 @@

      Examples

      Returns a list of key-value pairs stored in dict. No particular order is enforced.

      - Source + Source

      update(dict, key, fun) @@ -297,7 +317,7 @@

      Examples

      #=> [a: -1, b: 2]
      - Source + Source

      update(dict, key, initial, fun) @@ -313,7 +333,7 @@

      Examples

      #=> [a: 1, b: 2, c: 3]
      - Source + Source

      values(dict) @@ -326,7 +346,7 @@

      Examples

      Dict.values d #=> [1,2]
      - Source + Source diff --git a/docs/stable/Enum.Iterator.Binary.Dict.html b/docs/stable/Enum.Iterator.Binary.Dict.html index 7f3720980..7d805ed84 100644 --- a/docs/stable/Enum.Iterator.Binary.Dict.html +++ b/docs/stable/Enum.Iterator.Binary.Dict.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/stable/Enum.Iterator.Function.html b/docs/stable/Enum.Iterator.Function.html index 6dbbb462d..29c254865 100644 --- a/docs/stable/Enum.Iterator.Function.html +++ b/docs/stable/Enum.Iterator.Function.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/stable/Enum.Iterator.HashDict.html b/docs/stable/Enum.Iterator.HashDict.html index 1055b6c04..356652169 100644 --- a/docs/stable/Enum.Iterator.HashDict.html +++ b/docs/stable/Enum.Iterator.HashDict.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/stable/Enum.Iterator.List.html b/docs/stable/Enum.Iterator.List.html index a65de417b..2c3a4cd46 100644 --- a/docs/stable/Enum.Iterator.List.html +++ b/docs/stable/Enum.Iterator.List.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/stable/Enum.Iterator.Orddict.html b/docs/stable/Enum.Iterator.Orddict.html index 041698cc9..eff971109 100644 --- a/docs/stable/Enum.Iterator.Orddict.html +++ b/docs/stable/Enum.Iterator.Orddict.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/stable/Enum.html b/docs/stable/Enum.html index 96be07fa0..2e3b6006b 100644 --- a/docs/stable/Enum.html +++ b/docs/stable/Enum.html @@ -186,16 +186,6 @@

      Functions summary

      take_while/2
    2386. -
    2387. - - times/2 - -
    2388. -
    2389. - - times/3 - -
    2390. zip/2 @@ -219,7 +209,7 @@

      Functions

      end)

      Invokes the given fun for each item in the collection and returns true if -each invocation returns true as well, otherwise it shirt-circuits and returns +each invocation returns true as well, otherwise it short-circuits and returns false.

      Examples

      @@ -238,7 +228,7 @@

      Examples

      Enum.all? [1,nil,3] #=> false
      - Source + Source

      any?(collection, fun // fn x -> @@ -264,7 +254,7 @@

      Examples

      Enum.any? [false,true,false] #=> true
      - Source + Source

      at!(collection, n) @@ -282,7 +272,7 @@

      Examples

      Enum.at! [2,4,6], 4 #=> raises Enum.OutOfBoundsError
      - Source + Source

      count(collection) @@ -294,14 +284,14 @@

      Examples

      Enum.count [1,2,3] #=> 3
       
      - Source + Source

      count(collection, fun)

      Counts for how many items the function returns true.

      - Source + Source

      drop(collection, count) @@ -316,7 +306,7 @@

      Examples

      Enum.drop [1,2,3], 0 #=> [1,2,3]
      - Source + Source

      drop_while(collection, fun) @@ -330,7 +320,7 @@

      Examples

      #=> [3,4,5]
      - Source + Source

      each(collection, fun) @@ -343,7 +333,7 @@

      Examples

      Enum.each ['some', 'example'], fn(x) -> IO.puts x end
       
      - Source + Source

      empty?(collection) @@ -356,7 +346,7 @@

      Examples

      Enum.empty? [1,2,3] #=> false
      - Source + Source

      filter(collection, fun) @@ -370,7 +360,7 @@

      Examples

      #=> [2]
      - Source + Source

      filter_map(collection, filter, mapper) @@ -383,7 +373,7 @@

      Examples

      #=> [4]
      - Source + Source

      find(collection, ifnone // nil, fun) @@ -403,7 +393,7 @@

      Examples

      #=> 3
      - Source + Source

      find_index(collection, fun) @@ -422,7 +412,7 @@

      Examples

      #=> 2
      - Source + Source

      find_value(collection, ifnone // nil, fun) @@ -439,7 +429,7 @@

      Examples

      #=> true
      - Source + Source

      first(collection) @@ -452,7 +442,7 @@

      Examples

      Enum.first [1,2,3] #=> 1
      - Source + Source

      join(collection, joiner // "") @@ -473,7 +463,7 @@

      Examples

      Enum.join([1,2,3], ' = ') #=> '1 = 2 = 3'
      - Source + Source

      map(collection, fun) @@ -491,7 +481,7 @@

      Examples

      #=> [a: -1, b: -2]
      - Source + Source

      map_join(collection, joiner // "", mapper) @@ -508,11 +498,11 @@

      Examples

      Examples

      Enum.map_join([1,2,3], &1 * 2)        #=> "246"
      -Enum.map_join([1,2,3], &1 * 2, " = ") #=> "2 = 4 = 6"
      -Enum.map_join([1,2,3], &1 * 2, ' = ') #=> '2 = 4 = 6'
      +Enum.map_join([1,2,3], " = ", &1 * 2) #=> "2 = 4 = 6"
      +Enum.map_join([1,2,3], ' = ', &1 * 2) #=> '2 = 4 = 6'
       
      - Source + Source

      map_reduce(collection, acc, f) @@ -531,7 +521,7 @@

      Examples

      #=> { [2, 4, 6], 6 }
      - Source + Source

      partition(collection, fun) @@ -546,7 +536,7 @@

      Examples

      #=> { [2], [1,3] }
      - Source + Source

      qsort(collection) @@ -558,7 +548,7 @@

      Examples

      Enum.qsort [3,2,1] #=> [1,2,3]
       
      - Source + Source

      reduce(collection, acc, fun) @@ -573,22 +563,20 @@

      Examples

      #=> 6
      - Source + Source

      reverse(collection)

      Reverses the collection.

      -

      Expects an ordered collection.

      -

      Examples

      Enum.reverse [1, 2, 3]
       #=> [3, 2, 1]
       
      - Source + Source

      split(collection, count) @@ -608,7 +596,7 @@

      Examples

      Enum.split [1,2,3], -5 #=> { [], [1,2,3] }
      - Source + Source

      split_while(collection, fun) @@ -622,7 +610,7 @@

      Examples

      #=> { [1], [2, 3, 4] }
      - Source + Source

      take(collection, count) @@ -637,7 +625,7 @@

      Examples

      Enum.take [1,2,3], 0 #=> []
      - Source + Source

      take_while(collection, fun) @@ -651,38 +639,7 @@

      Examples

      #=> [1, 2]
      - Source -
      -

      - times(times, function) -

      -

      Iterates the given function n times, passing values -from 0 to n - 1.

      - -

      Examples

      - -
      Enum.times 3, fn(x) -> IO.inspect x end
      -0
      -1
      -2
      -
      -
      - Source -
      -

      - times(times, acc, function) -

      -

      Iterates the given function n times, passing values from 1 -to n. Also has an accumulator similar to reduce to store the -value between computations.

      - -

      Examples

      - -
      Enum.times 5, 0, fn(x, acc) -> acc + x end
      -#=> 15
      -
      -
      - Source + Source

      zip(coll1, coll2) @@ -692,7 +649,7 @@

      Examples

      dictated by the first enum. In case the second list is shorter, values are filled with nil.

      - Source + Source diff --git a/docs/stable/ExUnit.Assertions.html b/docs/stable/ExUnit.Assertions.html index 10720b9a1..344ccbefa 100644 --- a/docs/stable/ExUnit.Assertions.html +++ b/docs/stable/ExUnit.Assertions.html @@ -153,7 +153,7 @@

      Examples

      assert false, "it will never be true"
       
      - Source + Source

      assert_in_delta(expected, received, delta, message // nil) @@ -166,7 +166,7 @@

      Examples

      assert_in_delta 10, 15, 4
      - Source + Source

      assert_raise(exception, function) @@ -181,7 +181,7 @@

      Examples

      end
      - Source + Source

      assert_raise(exception, message, function) @@ -196,7 +196,7 @@

      Examples

      end
      - Source + Source

      flunk(message // "Epic Fail!") @@ -208,7 +208,7 @@

      Examples

      flunk "This should raise an error"
       
      - Source + Source

      refute(not_expected, message) @@ -221,7 +221,7 @@

      Examples

      refute true, "This will obviously fail"
       
      - Source + Source

      refute_in_delta(expected, received, delta, message // nil) @@ -234,7 +234,7 @@

      Examples

      refute_in_delta 10, 11, 2
      - Source + Source @@ -282,7 +282,7 @@

      Examples

      assert_received { :hello, _ } - Source + Source

      catch_error(expression) @@ -295,7 +295,7 @@

      Examples

      assert catch_error(error 1) == 1
       
      - Source + Source

      catch_exit(expression) @@ -308,7 +308,7 @@

      Examples

      assert catch_exit(exit 1) == 1
       
      - Source + Source

      catch_throw(expression) @@ -321,7 +321,7 @@

      Examples

      assert catch_throw(throw 1) == 1
       
      - Source + Source

      refute(expected) @@ -352,7 +352,7 @@

      Examples

      refute_received :bye
      - Source + Source diff --git a/docs/stable/ExUnit.CLIFormatter.html b/docs/stable/ExUnit.CLIFormatter.html new file mode 100644 index 000000000..8a2b18544 --- /dev/null +++ b/docs/stable/ExUnit.CLIFormatter.html @@ -0,0 +1,197 @@ + + + + ExUnit.CLIFormatter + + + + + + + + + + + + +
      +

      + ExUnit.CLIFormatter + +

      + + +
      +

      Formatter responsible for printing raw text +on the CLI

      + +
      + + + Source + + + + + + +

      Functions summary

      + + + + + + + + +
      +

      Functions

      +
      +

      + case_finished(_) +

      +
      + Source +
      +

      + case_started(_) +

      +
      + Source +
      +

      + code_change(_old, state, _extra) +

      +
      + Source +
      +

      + handle_call(arg1, arg2, state) +

      +
      + Source +
      +

      + handle_cast(arg1, state) +

      +
      + Source +
      +

      + handle_info(_msg, state) +

      +
      + Source +
      +

      + init(args) +

      +
      + Source +
      +

      + suite_finished() +

      +
      + Source +
      +

      + suite_started() +

      +
      + Source +
      +

      + terminate(reason, state) +

      +
      + Source +
      +

      + test_finished(test_case, test, result) +

      +
      + Source +
      +

      + test_started(_test_case, _test) +

      +
      + Source +
      +
      + + + + + +
      + + diff --git a/docs/stable/ExUnit.Formatter.html b/docs/stable/ExUnit.Formatter.html new file mode 100644 index 000000000..60beb3b08 --- /dev/null +++ b/docs/stable/ExUnit.Formatter.html @@ -0,0 +1,57 @@ + + + + ExUnit.Formatter + + + + + + + + + + + + +
      +

      + ExUnit.Formatter + + behaviour + +

      + + +
      +

      This module simply defines the callbacks +expected by an ExUnit.Formatter.

      + +
      + + + Source + + + + + + + + + + + + + + + + +
      + + diff --git a/docs/stable/ExUnit.html b/docs/stable/ExUnit.html index ee35114f1..a351ff27d 100644 --- a/docs/stable/ExUnit.html +++ b/docs/stable/ExUnit.html @@ -116,7 +116,7 @@

      Functions

      Register a callback to be invoked every time a new ExUnit process is spawned.

      - Source + Source

      configure(options) @@ -132,7 +132,7 @@

      Options

    2391. :max_cases - Maximum number of cases to run in parallel
    2392. - Source + Source

      run() @@ -140,7 +140,7 @@

      Options

      API used to run the tests. A developer does not need to call it directly.

      - Source + Source

      start(options // []) @@ -148,8 +148,26 @@

      Options

      Start ExUnit. Required to be invoked before loading any file that uses ExUnit.Case. Check configure/1 to see the supported options.

      + +

      This function will also try to read a user config from the following +locations, in this order:

      + +
        +
      • $EXUNIT_CONFIG environment variable
      • +
      • $HOME/.ex_unit.exs
      • +
      + +

      If none found, no user config will be read.

      + +

      User config is an elixir file which should return a keyword list +with ex_unit options. Please note that explicit options passed to start/1 +will take precedence over user options.

      + +

      User config example (~/.ex_unit.exs)

      + +

      [formatter: ExUnit.Formatter.ANSI]

      - Source + Source
      diff --git a/docs/stable/File.Stat.html b/docs/stable/File.Stat.html index 28e04801f..fd721bf67 100644 --- a/docs/stable/File.Stat.html +++ b/docs/stable/File.Stat.html @@ -73,79 +73,79 @@

      Fields (and defaults)

    2393. - size: nil + size: :undefined
    2394. - type: nil + type: :undefined
    2395. - access: nil + access: :undefined
    2396. - atime: nil + atime: :undefined
    2397. - mtime: nil + mtime: :undefined
    2398. - ctime: nil + ctime: :undefined
    2399. - mode: nil + mode: :undefined
    2400. - links: nil + links: :undefined
    2401. - major_device: nil + major_device: :undefined
    2402. - minor_device: nil + minor_device: :undefined
    2403. - inode: nil + inode: :undefined
    2404. - uid: nil + uid: :undefined
    2405. - gid: nil + gid: :undefined
    2406. diff --git a/docs/stable/File.html b/docs/stable/File.html index eb35d1aa8..6d223ea38 100644 --- a/docs/stable/File.html +++ b/docs/stable/File.html @@ -32,8 +32,16 @@

      that interact with the filesystem have their naming based on its UNIX variants. For example, deleting a file is done with File.rm. Getting its stats with -File.stat. If you want to read or write to a file -in chunks, check the IO module.

      +File.stat.

      + +

      In order to write and read files, one must use the +functions in the IO module. By default, a file is +opened on binary mode which requires the functions +IO.binread, IO.binwrite and IO.binreadline to +interact with the file. A developer may pass :utf8 +as an option when opening the file and then all other +functions from IO are available, since they work directly +with Unicode data.

      Most of the functions in this module return :ok or { :ok, result } in case of success, { :error, reason } @@ -382,7 +390,7 @@

      Examples

      #=> "" - Source + Source

      basename(path, extension) @@ -404,7 +412,7 @@

      Examples

      #=> "bar.old"
      - Source + Source

      cd(path) @@ -412,14 +420,14 @@

      Examples

      Sets the current working directory. Returns :ok if successful, { :error, reason } otherwise.

      - Source + Source

      cd!(path)

      The same as cd/0, but raises an exception if it fails.

      - Source + Source

      cd!(path, function) @@ -431,7 +439,7 @@

      Examples

      Raises an error if retrieving or changing the current directory fails.

      - Source + Source

      close(io_device) @@ -443,7 +451,7 @@

      Examples

      close/1 might return an old write error and not even try to close the file. See open/2.

      - Source + Source

      copy(source, destination, bytes_count // :infinity) @@ -462,7 +470,7 @@

      Examples

      Typical error reasons are the same as in open/2, read/1 and write/2.

      - Source + Source

      copy!(source, destination, bytes_count // :infinity) @@ -470,7 +478,7 @@

      Examples

      The same as copy/3 but raises an File.CopyError if it fails. Returns the bytes_copied otherwise.

      - Source + Source

      cp(source, destination, callback // fn _, _ -> @@ -495,7 +503,7 @@

      Examples

      It returns :ok in case of success, returns { :error, reason } otherwise.

      - Source + Source

      cp!(source, destination, callback // fn _, _ -> @@ -505,7 +513,7 @@

      Examples

      The same as cp/3, but raises File.CopyError if it fails. Returns the list of copied files otherwise.

      - Source + Source

      cp_r(source, destination, callback // fn _, _ -> @@ -557,7 +565,7 @@

      Examples

      end
      - Source + Source

      cp_r!(source, destination, callback // fn _, _ -> @@ -567,7 +575,7 @@

      Examples

      The same as cp_r/3, but raises File.CopyError if it fails. Returns the list of copied files otherwise.

      - Source + Source

      cwd() @@ -577,21 +585,21 @@

      Examples

      directories of the current directory. For this reason, returns { :ok, cwd } in case of success, { :error, reason } otherwise.

      - Source + Source

      cwd!()

      The same as cwd/0, but raises an exception if it fails.

      - Source + Source

      dir?(path)

      Returns true if the path is a directory.

      - Source + Source

      dirname(path) @@ -607,7 +615,7 @@

      Examples

      #=> "foo"
      - Source + Source

      exists?(path) @@ -628,7 +636,7 @@

      Examples

      #=> true
      - Source + Source

      expand_path(path) @@ -644,7 +652,7 @@

      Examples

      File.expand_path("/foo/bar/../bar") == "/foo/bar"
       
      - Source + Source

      expand_path(path, relative_to) @@ -662,7 +670,7 @@

      Examples

      File.expand_path("/foo/bar/../bar", "/baz") == "/foo/bar"
      - Source + Source

      extname(path) @@ -680,7 +688,7 @@

      Examples

      #=> ""
      - Source + Source

      iterator(device) @@ -704,7 +712,7 @@

      Examples

      end
      - Source + Source

      iterator(file, mode) @@ -713,7 +721,7 @@

      Examples

      returns its iterator. Fails for the same reasons as File.open.

      - Source + Source

      iterator!(file, mode // []) @@ -721,7 +729,7 @@

      Examples

      Same as iterator/2 but raises if the file cannot be opened.

      - Source + Source

      join(paths) @@ -742,7 +750,7 @@

      Examples

      #=> "/foo/bar"
      - Source + Source

      join(left, right) @@ -758,7 +766,7 @@

      Examples

      #=> "foo/bar"
      - Source + Source

      mkdir(path) @@ -777,14 +785,14 @@

      Examples

      On some platforms, :enoent is returned instead.

    2407. - Source + Source

      mkdir!(path)

      Same as mkdir, but raises an exception in case of failure. Otherwise :ok.

      - Source + Source

      mkdir_p(path) @@ -800,14 +808,14 @@

      Examples

    2408. :enotdir - A component of path is not a directory.
    2409. - Source + Source

      mkdir_p!(path)

      Same as mkdir_p, but raises an exception in case of failure. Otherwise :ok.

      - Source + Source

      open(path, modes // []) @@ -831,6 +839,11 @@

      Examples

      The compressed option must be combined with either read or write, but not both. Note that the file size obtained with stat/1 will most probably not match the number of bytes that can be read from a compressed file.

      +
    2410. :utf8 - This option denotes how data is actually stored in the disk file and + makes the file perform automatic translation of characters to and from utf-8. + If data is sent to a file in a format that cannot be converted to the utf-8 + or if data is read by a function that returns data in a format that cannot cope + with the character range of the data, an error occurs and the file will be closed.

    2411. If a function is given to modes (instead of a list), it dispatches to open/3.

      @@ -857,7 +870,7 @@

      Examples

      File.close(file)
      - Source + Source

      open(path, modes, function) @@ -882,7 +895,7 @@

      Examples

      end)
      - Source + Source

      open!(path, modes // []) @@ -890,7 +903,7 @@

      Examples

      Same as open/2 but raises an error if file could not be opened. Returns the io_device otherwise.

      - Source + Source

      open!(path, modes, function) @@ -898,7 +911,7 @@

      Examples

      Same as open/3 but raises an error if file could not be opened. Returns the function result otherwise.

      - Source + Source

      read(path) @@ -920,7 +933,7 @@

      Examples

      You can use :file.format_error(reason) to get a descriptive string of the error.

      - Source + Source

      read!(path) @@ -928,7 +941,7 @@

      Examples

      Returns binary with the contents of the given filename or raises File.Error if an error occurs.

      - Source + Source

      regular?(path) @@ -940,7 +953,7 @@

      Examples

      File.regular? __FILE__ #=> true
       
      - Source + Source

      rm(path) @@ -968,14 +981,14 @@

      Examples

      #=> {:error, :eperm}
      - Source + Source

      rm!(path)

      Same as rm, but raises an exception in case of failure. Otherwise :ok.

      - Source + Source

      rm_rf(path) @@ -997,7 +1010,7 @@

      Examples

      #=> { :ok, [] }
      - Source + Source

      rm_rf!(path) @@ -1005,7 +1018,7 @@

      Examples

      Same as rm_rf/1 but raises File.Error in case of failures, otherwise the list of files or directories removed.

      - Source + Source

      rmdir(path) @@ -1022,14 +1035,14 @@

      Examples

      #=> {:error, :enotdir}
      - Source + Source

      rmdir!(path)

      Same as rmdir/1, but raises an exception in case of failure. Otherwise :ok.

      - Source + Source

      rootname(path) @@ -1047,7 +1060,7 @@

      Examples

      #=> "/foo/bar"
      - Source + Source

      rootname(path, extension) @@ -1066,7 +1079,7 @@

      Examples

      #=> "/foo/bar.erl"
      - Source + Source

      split(path) @@ -1084,7 +1097,7 @@

      Examples

      #=> ["/", "foo", "bar"]
      - Source + Source

      stat(path, opts // []) @@ -1103,7 +1116,7 @@

      Options

      Default is local.
      - Source + Source

      stat!(path, opts // []) @@ -1111,23 +1124,23 @@

      Options

      Same as stat but returns the File.Stat directly and throws File.Error if an error is returned.

      - Source + Source

      - touch(path, time // calendar.local_time()) + touch(path, time // :calendar.local_time())

      Updates modification time (mtime) and access time (atime) of the given file. File is created if it doesn’t exist.

      - Source + Source

      - touch!(path, time // calendar.local_time()) + touch!(path, time // :calendar.local_time())

      Same as touch/1 but raises an exception if it fails. Returns :ok otherwise.

      - Source + Source

      wildcard(glob) @@ -1167,7 +1180,7 @@

      Examples

      File.wildcard("projects/*/ebin/**/*.{beam,app}")
       
      - Source + Source

      write(path, content, modes // []) @@ -1187,14 +1200,14 @@

      Examples

    2412. :eisdir - The named file is a directory.
    2413. - Source + Source

      write!(path, content, modes // [])

      Same as write/3 but raises an exception if it fails, returns :ok otherwise.

      - Source + Source

      write_stat(path, stat, opts // []) @@ -1202,7 +1215,7 @@

      Examples

      Writes the given File.Stat back to the filesystem at the given path. Returns :ok or { :error, reason }.

      - Source + Source

      write_stat!(path, stat, opts // []) @@ -1210,7 +1223,7 @@

      Examples

      Same as write_stat/3 but raises an exception if it fails. Returns :ok otherwise.

      - Source + Source
      diff --git a/docs/stable/GenServer.Behaviour.html b/docs/stable/GenServer.Behaviour.html index aae5e9e2b..156591578 100644 --- a/docs/stable/GenServer.Behaviour.html +++ b/docs/stable/GenServer.Behaviour.html @@ -70,7 +70,7 @@

      Example

      - Source + Source diff --git a/docs/stable/IEx.Autocomplete.html b/docs/stable/IEx.Autocomplete.html index 52a8465c6..1adbb5e45 100644 --- a/docs/stable/IEx.Autocomplete.html +++ b/docs/stable/IEx.Autocomplete.html @@ -62,7 +62,7 @@

      Functions

      expand(expr)

      - Source + Source diff --git a/docs/stable/IEx.Helpers.html b/docs/stable/IEx.Helpers.html index a93df9bef..16e20fb2d 100644 --- a/docs/stable/IEx.Helpers.html +++ b/docs/stable/IEx.Helpers.html @@ -27,11 +27,22 @@

      -

      A bunch of helpers available in IEx.

      +

      Welcome to Interactive Elixir. You are currently +seeing the documentation for the module IEx.Helpers +which provides many helpers to make Elixir's shell +more joyful to work with.

      + +

      This message was triggered by invoking the helper +h(), usually referred as h/0 (since it expects 0 +arguments).

      + +

      There are many other helpers available:

      • c/2 - compiles a file in the given path
      • h/0,h/1, h/2 - prints help/documentation
      • +
      • t/1, t/3 — prints type information
      • +
      • s/1, s/3 — prints spec information
      • m/0 - prints loaded modules
      • r/0 - recompiles and reloads the given module's source file
      • v/0 - prints all commands and values
      • @@ -98,6 +109,11 @@

        Functions summary

        r/1 +
      • + + s/3 + +
      • v/0 @@ -120,6 +136,16 @@

        Macros summary

        h/1
      • +
      • + + s/1 + +
      • +
      • + + t/1 + +
      @@ -143,14 +169,14 @@

      Examples

      #=> Foo
      - Source + Source

      h()

      Shows the documentation for IEx.Helpers.

      - Source + Source

      h(function, arity) @@ -167,21 +193,21 @@

      Examples

      #=> Prints documentation for this function
      - Source + Source

      h(module, function, arity)

      Shows the documentation for the function/arity in module.

      - Source + Source

      m()

      Returns the name and module of all modules loaded.

      - Source + Source

      r() @@ -189,7 +215,7 @@

      Examples

      Reloads all modules that were already reloaded at some point with r/1.

      - Source + Source

      r(module) @@ -199,14 +225,27 @@

      Examples

      Please note that all the modules defined in the specified files are recompiled and reloaded.

      - Source + Source +
      +

      + s(module, function, arity) +

      +

      Prints the specs for a given function.

      + +

      Examples

      + +
      s(Enum.all?/2)
      +s(Enum.t/0)
      +
      +
      + Source

      v()

      Prints commands history and their result.

      - Source + Source

      v(n) @@ -215,7 +254,7 @@

      Examples

      values to lookup query's value from latest to earliest. For instance, v(-1) returns the latest result.

      - Source + Source @@ -243,7 +282,33 @@

      Examples

      h Enum.all?/2 - Source + Source +
      +

      + s(module) +

      +

      Prints all specs from a given module.

      + +

      Examples

      + +
      s(Enum)
      +
      +
      + Source +
      +

      + t(module) +

      +

      Prints all types for the given module or prints out a specified type's +specification

      + +

      Examples

      + +
      t(Enum)
      +t(Enum.t/0)
      +
      +
      + Source
      diff --git a/docs/stable/IO.html b/docs/stable/IO.html index 1e0f6873b..794b3fb4c 100644 --- a/docs/stable/IO.html +++ b/docs/stable/IO.html @@ -30,7 +30,7 @@

      Module responsible for doing IO. Many functions in this module expects an IO device and an io data encoded in UTF-8.

      -

      An IO device must be a pid is an atom representing a process. +

      An IO device must be a pid or an atom representing a process. For convenience, Elixir provides :stdio and :stderr as shortcut to Erlang's :standard_io and :standard_error.

      @@ -60,6 +60,21 @@

      Functions summary

      • + + binread/2 + +
      • +
      • + + binreadline/1 + +
      • +
      • + + binwrite/2 + +
      • +
      • getb/3 @@ -106,6 +121,36 @@

        Functions summary

        Functions

        +

        + binread(device // :stdio, count) +

        +

        Reads count bytes from the IO device as binary, +no unicode conversion happens.

        + +

        Check read/2 for more information.

        +
        + Source +
        +

        + binreadline(device // :stdio) +

        +

        Reads a line from the IO device as binary, +no unicode conversion happens.

        + +

        Check readline/1 for more information.

        +
        + Source +
        +

        + binwrite(device // :stdio, item) +

        +

        Writes the given argument to the given device +as a binary, no unicode conversion happens.

        + +

        Check write/2 for more information.

        +
        + Source +

        getb(device // :stdio, prompt, count // 1)

        @@ -119,7 +164,7 @@

        Functions

        NFS file system.

      - Source + Source

      gets(device // :stdio, prompt) @@ -135,7 +180,7 @@

      Functions

      NFS file system.

      - Source + Source

      inspect(device // :stdio, item, opts // []) @@ -143,7 +188,7 @@

      Functions

      Inspects and writes the given argument to the device followed by a new line. Returns the item given.

      - Source + Source

      puts(device // :stdio, item) @@ -152,7 +197,7 @@

      Functions

      but adds a new line at the end. The argument is expected to be a chardata.

      - Source + Source

      read(device // :stdio, count) @@ -172,7 +217,7 @@

      Functions

      readline(device // :stdio)

      -

      Read a line from the IO device. It returns:

      +

      Reads a line from the IO device. It returns:

      • data - The input characters.

      • @@ -185,7 +230,7 @@

        Functions

        This function does the same as gets/2, except the prompt is not required as argument.

      - Source + Source

      write(device // :stdio, item) @@ -206,7 +251,7 @@

      Examples

      #=> "error"
      - Source + Source
      diff --git a/docs/stable/Kernel.SpecialForms.html b/docs/stable/Kernel.SpecialForms.html index 46855ca5e..eb539af75 100644 --- a/docs/stable/Kernel.SpecialForms.html +++ b/docs/stable/Kernel.SpecialForms.html @@ -209,13 +209,44 @@

      Examples

      __aliases__(args)

      This is the special form used to hold aliases information. -At compilation time, it is usually compiled to an atom:

      +It is usually compiled to an atom:

      quote do: Foo.Bar
       { :__aliases__, 0, [:Foo,:Bar] }
       
      + +

      Elixir represents Foo.Bar as __aliases__ so calls can be +unambiguously identified by the operator :.. For example:

      + +
      quote do: Foo.bar
      +{{:.,0,[{:__aliases__,0,[:Foo]},:bar]},0,[]}
      +
      + +

      Whenever an expression iterator sees a :. as the tuple key, +it can be sure that it represents a call and the second element +of the arguments list is an atom.

      + +

      On the other hand, aliases holds some properties:

      + +

      1) The head element of aliases can be any term;

      + +

      2) The tail elements of aliases are guaranteed to always be atoms;

      + +

      3) When the head element of aliases is the atom :Elixir, no expansion happen;

      + +

      4) When the head element of aliases is not an atom, it is expanded at runtime:

      + +
        quote do: some_var.Foo
      +  {:__aliases__,0,[{:some_var,0,:quoted},:Bar]}
      +
      + +

      Since some_var is not available at compilation time, the compiler + expands such expression to:

      + +
        Module.concat [some_var, Foo]
      +
      - Source + Source

      __block__(args) @@ -239,7 +270,7 @@

      Examples

      it belonged to another file.

      quote location: :keep, do: 1
      -#=> { :__scope__, 1,[[file: "iex"], 1] }
      +#=> { :__scope__, 1,[[file: "iex"],[do: 1]] }
       

      Check quote/1 for more information.

      @@ -336,8 +367,8 @@

      Selector

      import :all, List
       
      -

      It can also be customized to import only functions or only -macros:

      +

      It can also be customized to import only all functions or +all macros:

      import :functions, List
       import :macros, List
      diff --git a/docs/stable/Kernel.Typespec.html b/docs/stable/Kernel.Typespec.html
      index 218e10160..8c1e96032 100644
      --- a/docs/stable/Kernel.Typespec.html
      +++ b/docs/stable/Kernel.Typespec.html
      @@ -27,10 +27,14 @@ 

      -

      This is the module that converts Elixir typespecs -to Erlang typespecs syntax. Everytime @spec, @type -and @typep are used they proxy to the functions -in this module.

      +

      Holds macros and functions for working with typespecs.

      + +

      The attributes @type, @opaque, @typep, @spec and +@callback available in modules are handled by the equivalent +macros defined by this module.

      + +

      See http://www.erlang.org/doc/reference_manual/typespec.html +for more information.

      @@ -46,12 +50,57 @@

      Functions summary

      • - get_specs/1 + beam_callbacks/1 + +
      • +
      • + + beam_specs/1 + +
      • +
      • + + beam_types/1 + +
      • +
      • + + define_callback/3 + +
      • +
      • + + define_spec/3 + +
      • +
      • + + define_type/3 + +
      • +
      • + + defines_callback?/3 + +
      • +
      • + + defines_spec?/3 + +
      • +
      • + + defines_type?/3
      • - get_types/1 + spec_to_ast/1 + +
      • +
      • + + type_to_ast/1
      • @@ -66,6 +115,11 @@

        Macros summary

        defcallback/2 +
      • + + defopaque/1 + +
      • defspec/2 @@ -73,7 +127,7 @@

        Macros summary

      • - deftype/2 + deftype/1
      • @@ -91,25 +145,105 @@

        Macros summary

        Functions

        -

        - get_specs(module) +

        + beam_callbacks(module) +

        +

        Returns all callbacks available from the beam.

        + +

        It is returned as a list of tuples where the first +element is spec name and arity and the second is the spec.

        + +

        The module has to have a corresponding beam file +on the file system.

        +
        + Source +
        +

        + beam_specs(module) +

        +

        Returns all specs available from the beam.

        + +

        It is returned as a list of tuples where the first +element is spec name and arity and the second is the spec.

        + +

        The module has to have a corresponding beam file +on the file system.

        +
        + Source +
        +

        + beam_types(module) +

        +

        Returns all types available from the beam.

        + +

        It is returned as a list of tuples where the first +element is the type (:typep, :type and :opaque).

        + +

        The module has to have a corresponding beam file +on the file system.

        +
        + Source +
        +

        + define_callback(module, tuple, definition) +

        +

        Defines a callback by receiving Erlang's typespec.

        +
        + Source +
        +

        + define_spec(module, tuple, definition) +

        +

        Defines a spec by receiving Erlang's typespec.

        +
        + Source +
        +

        + define_type(module, kind, type) +

        +

        Defines a type, typep or opaque by receiving Erlang's typespec.

        +
        + Source +
        +

        + defines_callback?(module, name, arity) +

        +

        Returns true if the current module defines a callback. +This function is only available for modules being compiled.

        +
        + Source +
        +

        + defines_spec?(module, name, arity)

        -

        Get the specs defined for the given module. This function -is only available for modules being compiled. If the module -was already compiled, you need to loop its attributes -to get such information.

        +

        Returns true if the current module defines a given spec. +This function is only available for modules being compiled.

        - Source + Source
        -

        - get_types(module) +

        + defines_type?(module, name, arity)

        -

        Get the types defined for the given module. This function -is only available for modules being compiled. If the module -was already compiled, you need to loop its attributes -to get such information.

        +

        Returns true if the current module defines a given type +(private, opaque or not). This function is only available +for modules being compiled.

        - Source + Source +
        +

        + spec_to_ast(arg1) +

        +

        Converts a spec clause back to Elixir AST. +Returns a 2-items tuple with the spec arguments and return result.

        +
        + Source +
        +

        + type_to_ast(arg1) +

        +

        Converts a type clause back to Elixir AST.

        +
        + Source
        @@ -121,26 +255,67 @@

        Macros

        defcallback(spec, block)

        -
        - Source +

        Defines a callback. +This macro is the one responsible to handle the attribute @callback.

        + +

        Examples

        + +
        @callback add(number, number), do: number
        +
        +
        + Source +
        +

        + defopaque(type) +

        +

        Defines an opaque type. +This macro is the one responsible to handle the attribute @opaque.

        + +

        Examples

        + +
        @opaque my_type :: atom
        +
        +
        + Source

        defspec(spec, block)

        -
        - Source +

        Defines a spec. +This macro is the one responsible to handle the attribute @spec.

        + +

        Examples

        + +
        @spec add(number, number), do: number
        +
        +
        + Source
        -

        - deftype(name, options // []) +

        + deftype(type)

        -
        - Source +

        Defines a type. +This macro is the one responsible to handle the attribute @type.

        + +

        Examples

        + +
        @type my_type :: atom
        +
        +
        + Source

        - deftypep(name) + deftypep(type)

        -
        - Source +

        Defines a private type. +This macro is the one responsible to handle the attribute @typep.

        + +

        Examples

        + +
        @typep my_type :: atom
        +
        +
        + Source
        diff --git a/docs/stable/Kernel.html b/docs/stable/Kernel.html index 1e6010df6..fdd6d4f40 100644 --- a/docs/stable/Kernel.html +++ b/docs/stable/Kernel.html @@ -151,21 +151,6 @@

        Functions summary

        function_exported?/3
      • -
      • - - halt/0 - -
      • -
      • - - halt/1 - -
      • -
      • - - halt/2 - -
      • hd/1 @@ -678,6 +663,11 @@

        Macros summary

        defrecord/4
      • +
      • + + defrecordp/2 + +
      • destructure/2 @@ -1089,59 +1079,14 @@

        Examples

        it is not loaded. Check Code.ensure_loaded/1 for more information.

      - Source -
      -

      - halt() -

      -

      The same as halt(0, []).

      -
      - Source -
      -

      - halt(status) -

      -

      The same as halt(status, []).

      -
      - Source -
      -

      - halt(status, options) -

      -

      Halts the Erlang runtime system where the first argument status must be a -non-negative integer, a char list, or the atom :abort.

      - -
        -
      • If an integer, the runtime system exits with the integer value which -is returned to the Operating System;

      • -
      • If a char list, an erlang crash dump is produced with status as slogan, -and then the runtime system exits with status code 1;

      • -
      • If :abort, the runtime system aborts producing a core dump, if that is -enabled in the operating system.

      • -
      - -

      Note that on many platforms, only the status codes 0-255 are supported -by the operating system.

      - -

      For integer status, Erlang runtime system closes all ports and allows async -threads to finish their operations before exiting. To exit without such -flushing, pass options [flush: false] instead.

      - -

      Examples

      - -
      halt(0)
      -halt(1, flush: false)
      -halt(:abort)
      -
      -
      - Source + Source

      hd(list)

      Returns the head of a list, raises badarg if the list is empty.

      - Source + Source

      integer_to_list(number) @@ -1154,7 +1099,7 @@

      Examples

      #=> '7'
      - Source + Source

      integer_to_list(number, base) @@ -1168,7 +1113,7 @@

      Examples

      #=> "3FF"
      - Source + Source

      iolist_size(item) @@ -1181,7 +1126,7 @@

      Examples

      #=> 4
      - Source + Source

      iolist_to_binary(item) @@ -1198,7 +1143,7 @@

      Examples

      #=> <<1,2,3,1,2,3,4,5,4,6>>
      - Source + Source

      is_alive() @@ -1206,7 +1151,7 @@

      Examples

      Returns true if the local node is alive; that is, if the node can be part of a distributed system.

      - Source + Source

      is_atom(term) @@ -1215,7 +1160,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      is_binary(term) @@ -1226,7 +1171,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      is_bitstring(term) @@ -1235,7 +1180,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      is_boolean(term) @@ -1245,7 +1190,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      is_float(term) @@ -1254,7 +1199,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      is_function(term) @@ -1263,7 +1208,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      is_function(term, arity) @@ -1273,7 +1218,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      is_integer(term) @@ -1282,7 +1227,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      is_list(term) @@ -1291,7 +1236,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      is_number(term) @@ -1301,7 +1246,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      is_pid(term) @@ -1310,7 +1255,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      is_port(term) @@ -1319,7 +1264,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      is_reference(term) @@ -1328,7 +1273,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      is_tuple(term) @@ -1337,7 +1282,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      length(list) @@ -1351,7 +1296,7 @@

      Examples

      length([1,2,3,4,5,6,7,8,9]) #=> 9
       
      - Source + Source

      list_to_atom(char_list) @@ -1363,7 +1308,7 @@

      Examples

      list_to_atom('elixir') #=> :elixir
       
      - Source + Source

      list_to_binary(char_list) @@ -1375,7 +1320,7 @@

      Examples

      list_to_binary('Elixir') #=> "Elixir"
       
      - Source + Source

      list_to_bitstring(bitstring_list) @@ -1393,7 +1338,7 @@

      Examples

      #=> <<1,2,3,1,2,3,4,5,4,6,7|4>>
      - Source + Source

      list_to_existing_atom(char_list) @@ -1401,7 +1346,7 @@

      Examples

      Returns the atom whose text representation is char_list, but only if there already exists such atom.

      - Source + Source

      list_to_float(char_list) @@ -1413,7 +1358,7 @@

      Examples

      list_to_float('2.2017764e+0') #=> 2.2017764
       
      - Source + Source

      list_to_integer(char_list) @@ -1425,7 +1370,7 @@

      Examples

      list_to_integer('123') #=> 123
       
      - Source + Source

      list_to_integer(char_list, base) @@ -1437,7 +1382,7 @@

      Examples

      list_to_integer('3FF', 16) #=> 1023
       
      - Source + Source

      list_to_pid(char_list) @@ -1456,7 +1401,7 @@

      Examples

      list_to_pid('<0.41>') #=> <0.4.1>
       
      - Source + Source

      list_to_tuple(list) @@ -1468,7 +1413,7 @@

      Examples

      list_to_tuple([:share, [:elixir, 163]]). #=> {:share, [:elixir, 163]}
       
      - Source + Source

      make_ref() @@ -1484,7 +1429,7 @@

      Examples

      #=> #Ref<0.0.0.135>
      - Source + Source

      max(first, second) @@ -1498,7 +1443,7 @@

      Examples

      max(1, 2) #=> 2
       
      - Source + Source

      min(first, second) @@ -1512,7 +1457,7 @@

      Examples

      min(1, 2) #=> 1
       
      - Source + Source

      node() @@ -1522,7 +1467,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      node(arg) @@ -1533,7 +1478,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      pid_to_list(pid) @@ -1549,7 +1494,7 @@

      Warning:

      It should not be used in application programs.

      - Source + Source

      raise(msg) @@ -1572,7 +1517,7 @@

      Examples

      end
      - Source + Source

      raise(exception, args) @@ -1593,7 +1538,7 @@

      Examples

      raise ArgumentError, message: "Sample"
       
      - Source + Source

      round(number) @@ -1606,7 +1551,7 @@

      Examples

      round(5.5) #=> 6
       
      - Source + Source

      self() @@ -1614,7 +1559,7 @@

      Examples

      Returns the pid (process identifier) of the calling process. Allowed in guard clauses.

      - Source + Source

      size(arg) @@ -1622,7 +1567,7 @@

      Examples

      Returns the size of the given argument, which must be a tuple or a binary. If possible, please use tuplesize or binarysize.

      - Source + Source

      spawn(fun) @@ -1642,7 +1587,7 @@

      Examples

      end
      - Source + Source

      spawn(module, fun, args) @@ -1658,7 +1603,7 @@

      Examples

      spawn(SomeModule, :function, [1,2,3])
       
      - Source + Source

      spawn_link(fun) @@ -1679,7 +1624,7 @@

      Examples

      end
      - Source + Source

      spawn_link(module, fun, args) @@ -1695,7 +1640,7 @@

      Examples

      spawn_link(SomeModule, :function, [1,2,3])
       
      - Source + Source

      term_to_binary(term) @@ -1707,7 +1652,7 @@

      Examples

      to a file in an efficient way, or sending an Erlang term to some type of communications channel not supported by distributed :

      - Source + Source

      term_to_binary(term, opts) @@ -1721,21 +1666,21 @@

      Examples

      for more details
      - Source + Source

      throw(term)

      A non-local return from a function. Check try/2 for more information.

      - Source + Source

      tl(list)

      Returns the tail of a list. Raises ArgumentError if the list is empty.

      - Source + Source

      trunc(number) @@ -1748,21 +1693,21 @@

      Examples

      trunc(5.5) #=> 5
       
      - Source + Source

      tuple_size(tuple)

      Returns the size of a tuple.

      - Source + Source

      tuple_to_list(tuple)

      Converts a tuple to a list.

      - Source + Source
      @@ -1844,7 +1789,7 @@

      Examples

      this operator accepts any expression as arguments, not only booleans, however it is not allowed in guards.

      - Source + Source

      *(left, right) @@ -1929,7 +1874,7 @@

      Examples

      3 in 1..3 #=> true
      - Source + Source

      /(left, right) @@ -1965,7 +1910,7 @@

      Examples

      Enum.map(List.flatten([1,[2],3]), &1 * 2)
       
      - Source + Source

      <(left, right) @@ -2027,7 +1972,7 @@

      Examples

      x #=> "bar"
      - Source + Source

      ==(left, right) @@ -2080,7 +2025,7 @@

      Examples

      "abcd" =~ %r/e/ #=> nil
      - Source + Source

      >(left, right) @@ -2156,7 +2101,7 @@

      Examples

      time and not at runtime. Check the module Module for other functions to manipulate module attributes.

      - Source + Source

      __B__(string, list2) @@ -2170,7 +2115,7 @@

      Examples

      %B(f#{o}o) #=> "f\#{o}o"
      - Source + Source

      __C__(arg1, list2) @@ -2184,7 +2129,7 @@

      Examples

      %C(f#{o}o) #=> 'f\#{o}o'
      - Source + Source

      __R__(arg1, options) @@ -2197,7 +2142,7 @@

      Examples

      Regex.match? %R(f#{1,3}o), "f#o"  #=> true
       
      - Source + Source

      __b__(arg1, list2) @@ -2211,7 +2156,7 @@

      Examples

      %b(f#{:o}o) #=> "foo"
      - Source + Source

      __c__(arg1, list2) @@ -2225,7 +2170,7 @@

      Examples

      %c(f#{:o}o) #=> 'foo'
      - Source + Source

      __r__(arg1, options) @@ -2237,7 +2182,7 @@

      Examples

      Regex.match? %r(foo), "foo"  #=> true
       
      - Source + Source

      access(element, args) @@ -2311,7 +2256,7 @@

      Examples

      access a, 1 #=> :a
      - Source + Source

      and(left, right) @@ -2338,7 +2283,7 @@

      Examples

      atom_to_binary :my_atom #=> "my_atom"
       
      - Source + Source

      binary_to_atom(some_binary) @@ -2351,7 +2296,7 @@

      Examples

      binary_to_atom "my_atom" #=> :my_atom
       
      - Source + Source

      binary_to_existing_atom(some_binary) @@ -2364,7 +2309,7 @@

      Examples

      binary_to_existing_atom "my_atom" #=> :my_atom
      - Source + Source

      binary_to_float(some_binary) @@ -2376,7 +2321,7 @@

      Examples

      binary_to_float "2.2017764e+0" #=> 2.2017764
       
      - Source + Source

      binary_to_integer(some_binary) @@ -2388,7 +2333,7 @@

      Examples

      binary_to_integer "123" #=> 123
       
      - Source + Source

      binary_to_integer(some_binary, base) @@ -2401,7 +2346,7 @@

      Examples

      binary_to_integer("3FF", 16) #=> 1023
       
      - Source + Source

      case(condition, blocks) @@ -2454,7 +2399,7 @@

      Examples

      end
      - Source + Source

      cond(list1) @@ -2474,7 +2419,7 @@

      Examples

      end
      - Source + Source

      def(name, list2) @@ -2551,7 +2496,7 @@

      Dynamic generation with atoms

      because each entry k is a an atom and invoking def unquote(k)() would be invalid Elixir syntax.

      - Source + Source

      def(name, args, guards, list4) @@ -2588,7 +2533,7 @@

      Examples

      def name, args, guards, do: exprs
      - Source + Source

      defdelegate(funs, opts) @@ -2627,17 +2572,17 @@

      Examples

      defdelegate other_reverse(list), to: :lists, as: :reverse end -My:lists.reverse([1,2,3]) +MyList.reverse([1,2,3]) #=> [3,2,1] MyList.other_reverse([1,2,3]) #=> [3,2,1]
      - Source + Source

      - defexception(name, values, opts // [], do_block // []) + defexception(name, fields, opts // [], do_block // [])

      Defines an exception.

      @@ -2646,10 +2591,10 @@

      Examples

      differences:

      1) Differently from records, exceptions are documented by default; -2) Exceptions must implement message/1 as API and return a +2) Exceptions must implement message/1 as API that return a binary as result;

      - Source + Source

      defimpl(name, opts, do_block // []) @@ -2657,7 +2602,7 @@

      Examples

      Defines an implementation for the given protocol. See defprotocol/2 for examples.

      - Source + Source

      defmodule(name, list2) @@ -2705,7 +2650,7 @@

      Dynamic names

      Elixir will accept any module name as long as the expression returns an atom.

      - Source + Source

      defoverridable(tuples) @@ -2714,7 +2659,7 @@

      Dynamic names

      An overridable function is lazily defined, allowing a developer to customize it.

      - Source + Source

      defp(name, list2) @@ -2738,14 +2683,14 @@

      Examples

      In the example above, sum is private and accessing it through Foo.sum will raise an error.

      - Source + Source

      defp(name, args, guards, list4)

      The same as def/4 but generates a private function.

      - Source + Source

      defprotocol(name, list2) @@ -2816,7 +2761,7 @@

      Selecting implementations

      Reference are never going to be blank, it would be easier if we could simply provide a default implementation.

      -

      This can be achieved with Elixir as follows:

      +

      This can be achieved in Elixir as follows:

      defprotocol Blank do
         @only [Atom, Tuple, List, BitString, Any]
      @@ -2857,13 +2802,32 @@ 

      Protocols + Records

      Finally, since records are simply tuples, one can add a default protocol implementation to any record by defining a default implementation for tuples.

      + +

      Types

      + +

      As in records, defining a protocol automatically defines a type named t, +which can be used as:

      + +
      @spec present?(Blank.t), do: boolean
      +def present?(blank) do
      +  not Blank.blank?(blank)
      +end
      +
      + +

      The @spec above expresses that all types allowed to implement the +given protocol are valid argument types for the given function.

      - Source + Source

      - defrecord(name, values, opts // [], do_block // []) + defrecord(name, fields, opts // [], do_block // [])

      -

      Define a record given by name and values.

      +

      Defines a record.

      + +

      A record is a tagged tuple which contains one or more elements +and the first element is a module. This macro defines a module +that generates accessors to manipulate the record at both +compilation and runtime.

      Examples

      @@ -2873,18 +2837,18 @@

      Examples

      The line above will define a module named FileInfo which contains a function named new that returns a new record and other functions to read and set the values in the -record. Therefore, we can do:

      +record:

      file_info = FileInfo.new(atime: now())
       file_info.atime         #=> Returns the value of atime
       file_info.atime(now())  #=> Updates the value of atime
       
      -

      Internally, a record is simply a tuple where the first element is -the record module name. This can be noticed if we print the record:

      +

      A record is simply a tuple where the first element is the record +module name. We can get the record raw representation as follow:

      -
      IO.inspect FileInfo.new
      -{ FileInfo, nil, nil }
      +
      inspect FileInfo.new, raw: true
      +#=> { FileInfo, nil, nil }
       

      Extensions

      @@ -2892,8 +2856,8 @@

      Extensions

      Besides defining readers and writers for each attribute. Elixir will define extensions functions for each attribute. By default, it will define an update_#{attribute} function to update the value. Such -functions expect a function as argument that receives the current value -and must return the new one:

      +functions expect a function as argument that receives the current +value and must return the new one:

      file_info.update_atime(fn(_old) -> now() end) #=> Updates the value of atime
       
      @@ -2921,20 +2885,82 @@

      Extensions

      • merge_field - Receives keywords and merge it into the current value;
      • -
      • prepend_field - Receives another list and prepend its values
      • +
      • prepend_field - Receives another list and prepend its values;
      -

      You can define your own extensions or disable them using the except -option:

      +

      Documentation

      + +

      By default records are not documented and have @moduledoc set to false.

      -
      defrecord Config, [counter: 0, failures: []], except: [:extensions]
      +

      Types

      + +

      Every record defines a type named t that can be accessed in typespecs. +For example, assuming the Config record defined above, it could be used +in typespecs as follow:

      + +
      @spec handle_config(Config.t), do: boolean()
       
      -

      Documentation

      +

      Inside the record definition, a developer can define his own types too:

      -

      By default records are not documented and have @moduledoc set to false.

      +
      defrecord Config, counter: 0, failures: [] do
      +  @type kind :: term
      +  record_type counter: integer, failures: [kind]
      +end
      +
      + +

      When defining a type, all the fields not mentioned in the type are +assumed to have type term.

      - Source + Source +
      +

      + defrecordp(name, fields) +

      +

      Defines a record with a set of private macros to manipulate it.

      + +

      A record is a tagged tuple which contains one or more elements +and the first element is a module. This macro defines a set of +macros private to the current module to manipulate the record +exclusively at compilation time.

      + +

      defrecordp must be used instead of defrecord when there is +no interest in exposing the record as a whole. In many ways, +it is similar to Erlang records, since it is only available at +compilation time.

      + +

      Examples

      + +
      defmodule User do
      +  defrecordp :user, [name: "José", age: "25"]
      +end
      +
      + +

      In the example above, a set of macros named user but with different +arities will be defined to manipulate the underlying record:

      + +
      # To create records
      +user()        #=> { User, "José", 25 }
      +user(age: 26) #=> { User, "José", 26 }
      +
      +# To get a field from the record
      +user(record, :name) #=> "José"
      +
      +# To get many fields from the record
      +user(record, [:name, :age]) #=> ["José", 25]
      +
      +# To update the record
      +user(record, age: 26) #=> { User, "José", 26 }
      +
      +# To convert the record to keywords
      +user(record) #=> [name: "José", age: 25]
      +
      +# To match against the record
      +user(name: name) = record
      +name #=> "José"
      +
      +
      + Source

      destructure(left, right) @@ -2975,7 +3001,7 @@

      Examples

      the first value from the right side. Otherwise, it will raise a CaseClauseError.

      - Source + Source

      div(left, right) @@ -2989,7 +3015,7 @@

      Examples

      div 5, 2 #=> 2
       
      - Source + Source

      elem(tuple, index) @@ -3005,7 +3031,7 @@

      Example

      elem(tuple, 1) #=> :bar
      - Source + Source

      float_to_binary(some_float) @@ -3018,7 +3044,7 @@

      Examples

      float_to_binary 7.0 #=> "7.00000000000000000000e+00"
       
      - Source + Source

      function(args) @@ -3100,7 +3126,7 @@

      Function retrieval

      f.([1,[2],3]) #=> [1,2,3]
      - Source + Source

      if(condition, clauses) @@ -3144,7 +3170,7 @@

      Blocks examples

      If you want to compare more than two clauses, you can use the cond/1 macro.

      - Source + Source

      in(left, right) @@ -3186,7 +3212,7 @@

      Clauses

      In this case, Elixir will automatically expand it and define the variable for us.

      - Source + Source

      inspect(arg, opts // []) @@ -3210,7 +3236,7 @@

      Examples

      #=> ":foo"
      - Source + Source

      integer_to_binary(some_integer) @@ -3223,7 +3249,7 @@

      Examples

      integer_to_binary 123 #=> "123"
       
      - Source + Source

      integer_to_binary(some_integer, base) @@ -3236,7 +3262,7 @@

      Examples

      integer_to_binary 77 #=> "77"
       
      - Source + Source

      is_exception(thing) @@ -3249,14 +3275,14 @@

      Examples

      is_exception(1) #=> false
      - Source + Source

      is_range(thing)

      Check if the given argument is a range.

      - Source + Source

      is_record(thing, kind) @@ -3273,14 +3299,14 @@

      Examples

      is_record(Config.new, List) #=> false
      - Source + Source

      is_regex(thing)

      Check if the given argument is a regex.

      - Source + Source

      match?(left, right) @@ -3307,7 +3333,7 @@

      Examples

      Enum.filter list, match?({:a, x } when x < 2, &1)
      - Source + Source

      nil?(x) @@ -3321,7 +3347,7 @@

      Examples

      nil? nil #=> true
      - Source + Source

      not(arg) @@ -3397,7 +3423,7 @@

      Examples

      will occur immediately.

      - Source + Source

      rem(left, right) @@ -3411,7 +3437,7 @@

      Examples

      rem 5, 2 #=> 1
       
      - Source + Source

      setelem(tuple, index, value) @@ -3427,7 +3453,7 @@

      Example

      setelem(tuple, 0, :baz) #=> { :baz, :bar, 3 }
      - Source + Source

      to_binary(arg) @@ -3441,7 +3467,7 @@

      Examples

      #=> "foo"
      - Source + Source

      to_char_list(arg) @@ -3454,7 +3480,7 @@

      Examples

      #=> 'foo'
      - Source + Source

      try(args) @@ -3562,7 +3588,7 @@

      Catching exits and Erlang errors

      Although the second form should be avoided in favor of raise/rescue control mechanisms.

      - Source + Source

      unless(clause, options) @@ -3571,7 +3597,7 @@

      Catching exits and Erlang errors

      unless a value evalutes to true. Check if for examples and documentation.

      - Source + Source

      use(module, args // []) @@ -3608,7 +3634,7 @@

      Examples

      end
      - Source + Source

      var!(var) @@ -3652,7 +3678,7 @@

      Examples

      this operator accepts any expression as arguments, not only booleans, however it is not allowed in guards.

      - Source + Source diff --git a/docs/stable/Keyword.KeyError.html b/docs/stable/KeyError.html similarity index 98% rename from docs/stable/Keyword.KeyError.html rename to docs/stable/KeyError.html index 1168bcd2e..0d290fde0 100644 --- a/docs/stable/Keyword.KeyError.html +++ b/docs/stable/KeyError.html @@ -1,7 +1,7 @@ - Keyword.KeyError + KeyError @@ -21,7 +21,7 @@

      - Keyword.KeyError + KeyError exception diff --git a/docs/stable/Keyword.html b/docs/stable/Keyword.html index a151742da..9ba61189e 100644 --- a/docs/stable/Keyword.html +++ b/docs/stable/Keyword.html @@ -91,6 +91,11 @@

      Functions summary

      keys/1 +
    2414. + + keyword?/1 + +
    2415. merge/2 @@ -162,7 +167,7 @@

      Examples

      Keyword.delete [b: 2], :a #=> [b: 2]
    2416. - Source + Source

      equal?(left, right) @@ -176,7 +181,7 @@

      Examples

      #=> true
      - Source + Source

      from_enum(enum) @@ -185,7 +190,7 @@

      Examples

      which behaves as a dict, Keyword.from_enum do not remove duplicated entries.

      - Source + Source

      get(keywords, key, default // nil) @@ -205,7 +210,7 @@

      Examples

      Keyword.get [a: 1], :b, 3 #=> 3
      - Source + Source

      get!(keywords, key) @@ -219,7 +224,7 @@

      Examples

      Keyword.get! [a: 1], :b #=> raises KeyError[key: :b]
      - Source + Source

      get_values(keywords, key) @@ -232,7 +237,7 @@

      Examples

      #=> [1,2]
      - Source + Source

      has_key?(keywords, key) @@ -247,7 +252,7 @@

      Examples

      #=> false
      - Source + Source

      keys(keywords) @@ -260,7 +265,14 @@

      Examples

      Keyword.keys [a: 1, b: 2] #=> [:a,:b]
       
      - Source + Source +
      +

      + keyword?(arg1) +

      +

      Checks if the given argument is a keywords list or not

      +
      + Source

      merge(d1, d2) @@ -274,7 +286,7 @@

      Examples

      #=> [a:3, b:2, d: 4]
      - Source + Source

      merge(d1, d2, fun) @@ -290,14 +302,14 @@

      Examples

      #=> [a:4, b:2, d: 4]
      - Source + Source

      new()

      Returns an empty keyword list, i.e. an empty list.

      - Source + Source

      new(pairs) @@ -311,7 +323,7 @@

      Examples

      #=> [a: 2, b: 1]
      - Source + Source

      new(pairs, transform) @@ -326,10 +338,10 @@

      Examples

      #=> [a: :a, b: :b]
      - Source + Source

      - put(list, key, value) + put(keywords, key, value)

      Sets the given value under key.

      @@ -342,23 +354,23 @@

      Examples

      #=> [a: 3, b: 2]
      - Source + Source

      update(list1, key, fun)

      Updates the key with the given function. If the key does -not exist, raises Keyword.KeyError.

      +not exist, raises KeyError.

      Examples

      Keyword.update([a: 1], :a, &1 * 2)
       #=> [a: 2]
       Keyword.update([a: 1], :b, &1 * 2)
      -#=> Keyword.KeyError
      +#=> KeyError
       
      - Source + Source

      update(list1, key, initial, fun) @@ -374,7 +386,7 @@

      Examples

      #=> [a: 1, b: 11]
      - Source + Source

      values(keywords) @@ -386,7 +398,7 @@

      Examples

      Keyword.values [a: 1, b: 2] #=> [1,2]
       
      - Source + Source diff --git a/docs/stable/List.html b/docs/stable/List.html index 90855ded3..520c0f061 100644 --- a/docs/stable/List.html +++ b/docs/stable/List.html @@ -305,7 +305,7 @@

      Examples

      #=> [{ :a, 1 }, { :b, 2 }]
      - Source + Source

      keyfind(list, key, position, default // nil) @@ -326,7 +326,7 @@

      Examples

      #=> nil
      - Source + Source

      keymember?(list, key, position) @@ -347,7 +347,7 @@

      Examples

      #=> false
      - Source + Source

      keyreplace(list, key, position, new_tuple) @@ -361,7 +361,7 @@

      Examples

      #=> [a: 3, b: 2]
      - Source + Source

      keystore(list, key, position, new_tuple) @@ -376,7 +376,7 @@

      Examples

      #=> [a: 3, b: 2]
      - Source + Source

      last(list) @@ -393,7 +393,7 @@

      Examples

      #=> 3
      - Source + Source

      member?(list, term) @@ -411,7 +411,7 @@

      Examples

      #=> false
      - Source + Source

      range(first, last, step // nil) @@ -431,7 +431,7 @@

      Examples

      List.range 5, 1, -2 #=> [5, 3, 1]
      - Source + Source

      sort(list) @@ -445,7 +445,7 @@

      Examples

      #=> [1, 2, 3, 4, 7]
      - Source + Source

      sort(list, fun) @@ -459,7 +459,7 @@

      Examples

      #=> [7, 4, 3, 2, 1]
      - Source + Source

      uniq(list) @@ -472,7 +472,7 @@

      Examples

      #=> [1,2,3]
      - Source + Source

      unzip(list) @@ -489,7 +489,7 @@

      Examples

      #=> [[1, 2, 3], [:a, :b, :c]]
      - Source + Source

      wrap(list) @@ -503,7 +503,7 @@

      Examples

      List.wrap [1,2,3] #=> [1,2,3]
       
      - Source + Source

      zip(list_of_lists) @@ -519,7 +519,7 @@

      Examples

      #=> [{1, 3, 5}]
      - Source + Source diff --git a/docs/stable/Macro.Env.html b/docs/stable/Macro.Env.html index 2bd367c00..5ddaf60db 100644 --- a/docs/stable/Macro.Env.html +++ b/docs/stable/Macro.Env.html @@ -85,6 +85,12 @@

      Fields (and defaults)

      +
    2417. + + functions: nil + +
    2418. +
    2419. macros: nil @@ -137,6 +143,16 @@

      Functions summary

      function/2
    2420. +
    2421. + + functions/1 + +
    2422. +
    2423. + + functions/2 + +
    2424. in_guard?/1 @@ -232,6 +248,11 @@

      Functions summary

      update_function/2
    2425. +
    2426. + + update_functions/2 + +
    2427. update_line/2 @@ -319,6 +340,19 @@

      Functions

      Source +
      +

      + functions(record) +

      +

      Returns a list of functions imported from each module.

      +
      + Source +
      +

      + functions(value, record) +

      +
      + Source

      in_guard?(record) @@ -326,7 +360,7 @@

      Functions

      Returns wether the compilation environment is currently inside a guard.

      - Source + Source

      in_match?(record) @@ -334,7 +368,7 @@

      Functions

      Returns wether the compilation environment is currently inside a match clause.

      - Source + Source

      line(record) @@ -355,7 +389,7 @@

      Functions

      Returns a keyword list containing the file and line information as keys.

      - Source + Source

      macros(record) @@ -443,6 +477,12 @@

      Functions

      Source +
      +

      + update_functions(function, record) +

      +
      + Source

      update_line(function, record) diff --git a/docs/stable/Macro.html b/docs/stable/Macro.html index d2b594e3f..6a2fb12ab 100644 --- a/docs/stable/Macro.html +++ b/docs/stable/Macro.html @@ -117,7 +117,7 @@

      Functions

      do_safe_term(terms)

      - Source + Source

      escape(tuple) @@ -231,7 +231,7 @@

      Examples

      end
      - Source + Source

      safe_term(terms) @@ -241,7 +241,7 @@

      Examples

      evaluate code) and returns :ok unless a given term is unsafe, which is returned as { :unsafe, term }.

      - Source + Source

      to_binary(tree) diff --git a/docs/stable/Mix.Deps.html b/docs/stable/Mix.Deps.html index 06675fa1e..018965bc1 100644 --- a/docs/stable/Mix.Deps.html +++ b/docs/stable/Mix.Deps.html @@ -66,11 +66,6 @@

      Functions summary

      check_lock/2
    2428. -
    2429. - - deps_path/1 - -
    2430. format_dep/1 @@ -149,13 +144,6 @@

      Exceptions

      Checks the lock for the given dependency and update its status accordingly.

      Source -
      -

      - deps_path(arg1) -

      -

      Returns the path for the given dependency.

      -
      - Source

      format_dep(arg1) diff --git a/docs/stable/Mix.Project.html b/docs/stable/Mix.Project.html index 396d92802..b6549ba48 100644 --- a/docs/stable/Mix.Project.html +++ b/docs/stable/Mix.Project.html @@ -23,8 +23,6 @@

      Mix.Project - behaviour -

      @@ -110,7 +108,7 @@

      Functions

      Returns the project configuration already considering the current environment.

      - Source + Source

      get() @@ -125,14 +123,14 @@

      Functions

      Returns nil if no project./

      - Source + Source

      get!()

      Same as get/0 but raises an exception if no project.

      - Source + Source

      refresh() @@ -140,7 +138,7 @@

      Functions

      Refresh the project configuration. Usually required when the environment changes during a task.

      - Source + Source
      diff --git a/docs/stable/Mix.SCM.html b/docs/stable/Mix.SCM.html index 1f0ba27bc..29c52be27 100644 --- a/docs/stable/Mix.SCM.html +++ b/docs/stable/Mix.SCM.html @@ -66,51 +66,6 @@

      Functions summary

      -

      Callbacks summary

      - -
      @@ -121,21 +76,21 @@

      Functions

      Returns all available SCM.

      - Source + Source

      register(mod)

      Register the scm repository with the given key and mod.

      - Source + Source

      register_builtin()

      Register builtin SCMs.

      - Source + Source
      @@ -143,98 +98,6 @@

      Functions

      -
      -

      Callbacks

      -
      -

      - available?(path, opts) -

      -

      This behavior function receives a path, opts and returns -a boolean if the dependency is available.

      -
      - Source -
      -

      - check?(path, opts) -

      -

      This behavior function checks if the dependency is locked and -the current repository version matches the lock. Note that some -SCMs do not require a lock, for such, this function can simply -return true.

      -
      - Source -
      -

      - checkout(path, opts) -

      -

      This behavior function checks out dependencies.

      - -

      If the dependency is locked, a lock is received in opts -and the repository must be check out at the lock. Otherwise, -no lock is given and the repository can be checked out -to the latest version.

      -
      - Source -
      -

      - clean(path, opts) -

      -

      This behavior function should clean the given dependency.

      -
      - Source -
      -

      - consumes?(opts) -

      -

      This behavior function receives a keyword list of opts -and should return an updated list in case the SCM consumes -the available options. For example, when a developer specifies -a dependency:

      - -
      { "foo", "0.1.0", github: "foo/bar" }
      -
      - -

      Each registered SCM will be asked if they consume this dependency, -receiving [github: "foo/bar"] as argument. Since this option makes -sense for the Git SCM, it will return an update list of options -while other SCMs would simply return nil.

      -
      - Source -
      -

      - key() -

      -

      This behavior function should retrieve an atom representing -the SCM key. In the dependency opts, a value for the given -must be found since it is used to print information about -the requested dependency.

      -
      - Source -
      -

      - match?(opts1, opts2) -

      -

      Receives two options and must return true if the refer to the -same repository.

      -
      - Source -
      -

      - update(path, opts) -

      -

      This behavior function updates dependencies. It may be -called by deps.get or deps.update.

      - -

      In the first scenario, a lock is received in opts and -the repository must be updated to the lock. In the second, -no lock is given and the repository can be updated freely.

      - -

      It must return the current lock.

      -
      - Source -
      -
      - diff --git a/docs/stable/Mix.Shell.IO.html b/docs/stable/Mix.Shell.IO.html new file mode 100644 index 000000000..2a5bf04ac --- /dev/null +++ b/docs/stable/Mix.Shell.IO.html @@ -0,0 +1,103 @@ + + + + Mix.Shell.IO + + + + + + + + + + + + +
      +

      + Mix.Shell.IO + +

      + + +
      +

      This is Mix's default shell. +It simply prints messages to stdio and stderr.

      + +
      + + + Source + + + + + + +

      Functions summary

      + + + + + + + + +
      +

      Functions

      +
      +

      + error(message) +

      +

      Writes an error message to the shell followed by new line.

      +
      + Source +
      +

      + info(message) +

      +

      Writes a message to the shell followed by new line.

      +
      + Source +
      +

      + yes?(message) +

      +

      Receives a message and asks the user if he wants to proceed. +He must press enter or type anything that matches the a "yes" +regex %r/^Y(es)?$/i.

      +
      + Source +
      +
      + + + + + +
      + + diff --git a/docs/stable/Mix.Shell.html b/docs/stable/Mix.Shell.html index 1d9d87cf1..859c46af2 100644 --- a/docs/stable/Mix.Shell.html +++ b/docs/stable/Mix.Shell.html @@ -29,8 +29,7 @@

      -

      This is Mix's default shell. -It simply prints messages to stdio and stderr.

      +

      Defines Mix.Shell contract.

      @@ -42,30 +41,7 @@

      -

      Functions summary

      - @@ -73,43 +49,6 @@

      Functions summary

      -
      -

      Functions

      -
      -

      - behaviour_info(atom1) -

      -

      Define Mix.Shell callbacks.

      -
      - Source -
      -

      - error(message) -

      -

      Writes an error message to the shell followed by new line.

      -
      - Source -
      -

      - info(message) -

      -

      Writes a message to the shell followed by new line.

      -
      - Source -
      -

      - yes?(message) -

      -

      Receives a message and asks the user if he wants to proceed. -He must press enter or type anything that matches the a "yes" -regex %r/^Y(es)?$/i.

      -
      - Source -
      -
      - - - diff --git a/docs/stable/Mix.Task.html b/docs/stable/Mix.Task.html index 95590f114..028a6b6c7 100644 --- a/docs/stable/Mix.Task.html +++ b/docs/stable/Mix.Task.html @@ -111,7 +111,7 @@

      Functions

      Returns all loaded modules. Modules that were not yet loaded won't show up. Check load_all/0 if you want to preload all tasks.

      - Source + Source

      clear() @@ -119,7 +119,7 @@

      Functions

      Clears all invoked tasks, allowing them to be reinvoked. Returns an ordset with all the tasks invoked thus far.

      - Source + Source

      get(task) @@ -133,21 +133,21 @@

      Exceptions

    2431. Mix.InvalidTaskError - raised if the task is not a valid Mix.Task
    2432. - Source + Source

      hidden?(module)

      Checks if the task is hidden or not. Returns a boolean.

      - Source + Source

      load_all()

      Loads all tasks in all code paths.

      - Source + Source

      moduledoc(module) @@ -155,14 +155,14 @@

      Exceptions

      Gets the moduledoc for the given module. Returns the moduledoc or nil.

      - Source + Source

      reenable(task)

      Reenables a given task so it can be executed again down the stack.

      - Source + Source

      run(task, args // []) @@ -177,7 +177,7 @@

      Exceptions

      It may raise an exception if the task was not found or it is invalid. Check get/2 for more information.

      - Source + Source

      shortdoc(module) @@ -185,14 +185,14 @@

      Exceptions

      Gets the shortdoc for the given module. Returns the shortdoc or nil.

      - Source + Source

      task_name(module)

      Returns the task name for the given module.

      - Source + Source
      diff --git a/docs/stable/Mix.Tasks.Compile.Elixir.html b/docs/stable/Mix.Tasks.Compile.Elixir.html index 01606d896..0e8732754 100644 --- a/docs/stable/Mix.Tasks.Compile.Elixir.html +++ b/docs/stable/Mix.Tasks.Compile.Elixir.html @@ -41,8 +41,12 @@

      force compilation regardless of mod times by passing the --force option.

      -

      A list of files can be given after the task -name in order to select the files to compile.

      +

      Note it is important to recompile all files because +often there are compilation time dependencies between +the files (macros and etc). However, in some cases it +is useful to compile just the changed files for quick +development cycles, for such, a developer can pass +the --quick otion.

      Configuration

      @@ -56,7 +60,8 @@

      Configuration

      Command line options

        -
      • --force - forces compilation regardless of mod times;
      • +
      • --force - forces compilation regardless of module times;
      • +
      • --quick, -q - only compile files that changed;
      @@ -92,7 +97,7 @@

      Functions

      run(args)

      - Source + Source diff --git a/docs/stable/Mix.Tasks.Compile.html b/docs/stable/Mix.Tasks.Compile.html index a92b08255..29f4467a9 100644 --- a/docs/stable/Mix.Tasks.Compile.html +++ b/docs/stable/Mix.Tasks.Compile.html @@ -57,10 +57,6 @@

      Common configuration

      Defaults to "ebin", can be configured as:

      [compile_path: "ebin"]

      -
    2433. :compile_first - which files need to be compiled first. -They need to be a subset of the files found in source_paths.

      - -

      [compile_first: ["lib/foo.ex", "lib/bar.ex"]]

    2434. :watch_exts - extensions to watch in order to trigger a compilation:

      @@ -110,7 +106,7 @@

      Functions

      run(args)

      - Source + Source diff --git a/docs/stable/Mix.Tasks.Deps.Get.html b/docs/stable/Mix.Tasks.Deps.Get.html index d1e7797ea..477547303 100644 --- a/docs/stable/Mix.Tasks.Deps.Get.html +++ b/docs/stable/Mix.Tasks.Deps.Get.html @@ -63,7 +63,7 @@

      Functions

      run(args)

      - Source + Source diff --git a/docs/stable/Mix.Tasks.Test.html b/docs/stable/Mix.Tasks.Test.html index 257556357..c5a2433c6 100644 --- a/docs/stable/Mix.Tasks.Test.html +++ b/docs/stable/Mix.Tasks.Test.html @@ -42,8 +42,10 @@

      Configuration

        +
      • :test_paths - path containing tests. +Defaults to ["test"].

      • :test_pattern - a pattern to load test files. -Defaults to test/**/*_test.exs.

      • +Defaults to *_test.exs.

      • :test_helper - a file that sets up whatever is necessary for testing. Defaults to test/test_helper.exs.

      @@ -81,7 +83,7 @@

      Functions

      run(args)

      - Source + Source diff --git a/docs/stable/Mix.Utils.html b/docs/stable/Mix.Utils.html index ecc4fbfb6..861071dde 100644 --- a/docs/stable/Mix.Utils.html +++ b/docs/stable/Mix.Utils.html @@ -74,22 +74,27 @@

      Functions summary

    2435. - exclude_files/1 + extract_files/2
    2436. - extract_files/2 + extract_stale/2
    2437. - extract_files/3 + module_name_to_command/2
    2438. - module_name_to_command/2 + preserving_mtime/2 + +
    2439. +
    2440. + + relative_to_cwd/1
    2441. @@ -134,7 +139,7 @@

      Examples

      Mix.Utils.camelize "foo_bar" #=> "FooBar"
       
      - Source + Source

      command_to_module(command, at // Elixir) @@ -152,7 +157,7 @@

      Examples

      #=> { :module, Mix.Tasks.Compile }
      - Source + Source

      command_to_module_name(s) @@ -165,7 +170,7 @@

      Examples

      #=> "Compile.Elixir"
      - Source + Source

      config_merge(old, new) @@ -173,34 +178,26 @@

      Examples

      Merges two configs recursively, merging keyword lists and concatenating normal lists.

      - Source -
      -

      - exclude_files(files) -

      -

      Filtering out files which start with "."

      -
      - Source + Source

      extract_files(paths, exts)

      -

      Extract the files from the given paths with -the given extension. -It ignores files which start with "."

      +

      Extract files from a list of paths or from a wildcard.

      + +

      If the list of paths contains a directory, the directory +is expanded according to the given pattern.

      + +

      It ignores files which start with "."

      - Source + Source
      -

      - extract_files(paths, files, exts) +

      + extract_stale(sources, targets)

      -

      Extract the files from the given paths with -the given extension in case files is an empty -array. If not, get the common subset between -files and the extracted files. -It ignores files which start with "."

      +

      Extract all stale sources compared to the given targets.

      - Source + Source

      module_name_to_command(module, nesting // 0) @@ -218,7 +215,23 @@

      Examples

      #=> "compile.elixir"
      - Source + Source +
      +

      + preserving_mtime(path, fun) +

      +

      Executes a function but preserves the given path +mtime properties.

      +
      + Source +
      +

      + relative_to_cwd(path) +

      +

      Returns the given path string relative to the current +working directory.

      +
      + Source

      source(module) @@ -228,12 +241,11 @@

      Examples

      Source

      - stale?(source, target) + stale?(sources, targets)

      -

      Returns true if any of target is stale compared to source. -If target or source is a binary, it is expanded using File.wildcard.

      +

      Returns true if any of the sources are stale compared to the given target.

      - Source + Source

      underscore(atom) @@ -257,7 +269,7 @@

      Examples

      Mix.Utils.camelize "sap_example" #=> "SapExample"
      - Source + Source

      user_home() diff --git a/docs/stable/Module.html b/docs/stable/Module.html index 519f6ba73..1305c5b87 100644 --- a/docs/stable/Module.html +++ b/docs/stable/Module.html @@ -143,6 +143,11 @@

      Functions summary

      split/1
    2442. +
    2443. + + to_binary/1 + +
    2444. @@ -172,7 +177,7 @@

      Examples

      end - Source + Source

      concat(list) @@ -187,7 +192,7 @@

      Examples

      Module.concat [Foo, 'Bar'] #=> Foo.Bar
      - Source + Source

      concat(left, right) @@ -202,7 +207,7 @@

      Examples

      Module.concat Foo, 'Bar' #=> Foo.Bar
      - Source + Source

      create(module, quoted, opts // []) @@ -218,7 +223,7 @@

      Examples

      def world, do: true end -Module.create(Hello, contents, __ENV__) +Module.create(Hello, contents, __ENV__.location) Hello.world #=> true @@ -231,13 +236,12 @@

      Differences with defmodule

      function is preferred when the module body is given by a quoted expression.

      -

      Another important distinction is that defmodule -blends into the scope it is invoked, allowing you -to access all variables, imports and requires from -the module. Module.create, on the other hand, creates -a new scope so imports, requires, etc are not inherited.

      +

      Another important distinction is that Module.create +allows you to control the environment variables used +when defining the module, while defmodule automatically +shares the same environment.

      - Source + Source

      defines?(module, tuple) @@ -254,7 +258,7 @@

      Examples

      end
      - Source + Source

      defines?(module, tuple, kind) @@ -272,7 +276,7 @@

      Examples

      end
      - Source + Source

      definitions_in(module) @@ -287,7 +291,7 @@

      Examples

      end
      - Source + Source

      definitions_in(module, kind) @@ -304,7 +308,7 @@

      Examples

      end
      - Source + Source

      delete_attribute(module, key) @@ -319,48 +323,40 @@

      Examples

      end
      - Source + Source

      - eval_quoted(env, quoted, binding // [], opts // []) + eval_quoted(module, quoted, binding // [], opts // [])

      -

      Evalutes the quotes contents in the given module context. -Raises an error if the module was already compiled.

      +

      Evalutes the quotes contents in the given module context.

      -

      Options

      +

      A list of environment options can also be given as argument. +Check Code.eval for more information.

      -

      This function accepts a list of options. The supported -options are:

      - -
        -
      • :file - The filename to be used in stacktraces -and the file reported in the ENV variable.

      • -
      • :line - The line reported in the ENV variable.

      • -
      +

      Raises an error if the module was already compiled.

      Examples

      defmodule Foo do
         contents = quote do: (def sum(a, b), do: a + b)
      -  Module.eval_quoted __MODULE__, contents, []
      +  Module.eval_quoted __MODULE__, contents
       end
       
       Foo.sum(1, 2) #=> 3
       
      -

      This function also accepts a Macro.Env as first argument. This -is useful to evalute the quoted contents inside an existing -environment (considering the environemnt module, line and file):

      +

      For convenience, you can my pass __ENV__ as argument and +all options will be automatically extracted from the environment:

      defmodule Foo do
         contents = quote do: (def sum(a, b), do: a + b)
      -  Module.eval_quoted __ENV__, contents, []
      +  Module.eval_quoted __MODULE__, contents, [], __ENV__
       end
       
       Foo.sum(1, 2) #=> 3
       
      - Source + Source

      get_attribute(module, key) @@ -381,7 +377,7 @@

      Examples

      end
      - Source + Source

      make_overridable(module, tuples) @@ -390,7 +386,7 @@

      Examples

      An overridable function is lazily defined, allowing a developer to customize it.

      - Source + Source

      open?(module) @@ -405,7 +401,7 @@

      Examples

      Returns true if the given tuple in module is marked as overridable.

      - Source + Source

      put_attribute(module, key, value) @@ -421,7 +417,7 @@

      Examples

      end
      - Source + Source

      register_attribute(module, new, opts // []) @@ -458,7 +454,7 @@

      Examples

      end
      - Source + Source

      safe_concat(list) @@ -477,7 +473,7 @@

      Examples

      #=> List.Chars
      - Source + Source

      safe_concat(left, right) @@ -496,7 +492,7 @@

      Examples

      #=> List.Chars
      - Source + Source

      split(module) @@ -509,7 +505,14 @@

      Examples

      #=> ["Very", "Long", "Module", "Name", "And", "Even", "Longer"]
      - Source + Source +
      +

      + to_binary(module) +

      +

      Convert a module name to binary without the Elixir prefix.

      +
      + Source
      diff --git a/docs/stable/Node.html b/docs/stable/Node.html index 1c967e210..987b310f8 100644 --- a/docs/stable/Node.html +++ b/docs/stable/Node.html @@ -76,11 +76,21 @@

      Functions summary

      self/0 +
    2445. + + spawn/2 + +
    2446. spawn/3
    2447. +
    2448. + + spawn/4 + +
    2449. spawn/5 @@ -174,28 +184,51 @@

      Functions

      Source
      -

      - spawn(node, fun, opts // []) +

      + spawn(node, fun)

      Returns the pid of a new process started by the application of fun on node. If node does not exist, a useless pid is returned.

      -

      Check http://www.erlang.org/doc/man/erlang.html#spawn_opt-4 for +

      Check http://www.erlang.org/doc/man/erlang.html#spawn-2 for the list of available options.

      Source +
      +

      + spawn(node, fun, opts) +

      +

      Returns the pid of a new process started by the application of fun +on node. If node does not exist, a useless pid is returned.

      + +

      Check http://www.erlang.org/doc/man/erlang.html#spawn_opt-3 for +the list of available options.

      +
      + Source +
      +

      + spawn(node, module, fun, args) +

      +

      Returns the pid of a new process started by the application of +module.function(args) on node. If node does not exists, +a useless pid is returned.

      + +

      Check http://www.erlang.org/doc/man/erlang.html#spawn-4 for +the list of available options.

      +
      + Source

      - spawn(node, module, fun, args, opts // []) + spawn(node, module, fun, args, opts)

      Returns the pid of a new process started by the application of -module.function(args) on node. If node does not exists, a useless -pid is returned.

      +module.function(args) on node. If node does not exists, +a useless pid is returned.

      -

      Check http://www.erlang.org/doc/man/erlang.html#spawn_opt-4 for +

      Check http://www.erlang.org/doc/man/erlang.html#spawn_opt-5 for the list of available options.

      - Source + Source

      spawn_link(node, fun) @@ -206,7 +239,7 @@

      Functions

      (and due to the link, an exit signal with exit reason :noconnection will be received).

      - Source + Source

      spawn_link(node, module, fun, args) @@ -217,7 +250,7 @@

      Functions

      pid is returned (and due to the link, an exit signal with exit reason :noconnection will be received).

      - Source + Source diff --git a/docs/stable/OptionParser.html b/docs/stable/OptionParser.html index cbf2ff5ef..de952d0fd 100644 --- a/docs/stable/OptionParser.html +++ b/docs/stable/OptionParser.html @@ -121,7 +121,7 @@

      Example

      #=> { [source: "lib"], ["test/enum_test.exs", "--verbose"] } - Source + Source diff --git a/docs/stable/Process.html b/docs/stable/Process.html index c9d620e54..2550ec82b 100644 --- a/docs/stable/Process.html +++ b/docs/stable/Process.html @@ -151,11 +151,21 @@

      Functions summary

      self/0
    2450. +
    2451. + + spawn/1 + +
    2452. spawn/2
    2453. +
    2454. + + spawn/3 + +
    2455. spawn/4 @@ -241,7 +251,7 @@

      Functions

      See http://www.erlang.org/doc/man/erlang.html#demonitor-2 for more info.

      - Source + Source

      exit(pid, status) @@ -278,7 +288,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#process_flag-2 for more info.

      - Source + Source

      flag(pid, flag, value) @@ -289,7 +299,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#process_flag-3 for more info.

      - Source + Source

      get() @@ -319,7 +329,7 @@

      Examples

      Returns the pid of the group leader for the process which evaluates the function.

      - Source + Source

      group_leader(leader, pid) @@ -327,7 +337,7 @@

      Examples

      Sets the group leader of Pid to GroupLeader. Typically, this is used when a processes started from a certain shell should have another group leader than :init.

      - Source + Source

      info(pid) @@ -337,7 +347,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#process_info-1 for more info.

      - Source + Source

      info(pid, spec) @@ -347,7 +357,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#process_info-2 for more info.

      - Source + Source

      link(pid) @@ -357,7 +367,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#link-1 for more info.

      - Source + Source

      list() @@ -371,7 +381,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#processes-0 for more info.

      - Source + Source

      monitor(item) @@ -381,7 +391,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#monitor-2 for more info.

      - Source + Source

      put(key, value) @@ -399,14 +409,14 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#register-2 for more info.

      - Source + Source

      registered()

      Returns a list of names which have been registered using register/2.

      - Source + Source

      self() @@ -414,30 +424,47 @@

      Examples

      Returns the current process.

      Source +
      +

      + spawn(fun) +

      +

      Returns the pid of a new process started by the application of fun. +It behaves exactly the same as Kernel.spawn/1.

      +
      + Source

      - spawn(fun, opts // []) + spawn(fun, opts)

      Returns the pid of a new process started by the application of fun.

      -

      It behaves exactly the same as the Kernel.spawn/1 function except -it also accepts extra options, for the list of available options -check http://www.erlang.org/doc/man/erlang.html#spawn_opt-4

      +

      It also accepts extra options, for the list of available options +check http://www.erlang.org/doc/man/erlang.html#spawn_opt-2

      +
      + Source +
      +

      + spawn(mod, fun, args) +

      +

      Returns the pid of a new process started by the application of +module.function(args). The new process created will be placed in the system +scheduler queue and be run some time later.

      + +

      It behaves exactly the same as the Kernel.spawn/3 function.

      - Source + Source

      - spawn(mod, fun, args, opts // []) + spawn(mod, fun, args, opts)

      Returns the pid of a new process started by the application of module.function(args). The new process created will be placed in the system scheduler queue and be run some time later.

      -

      It behaves exactly the same as the Kernel.spawn/3 function except -it also accepts extra options, for the list of available options +

      It also accepts extra options, for the list of available options check http://www.erlang.org/doc/man/erlang.html#spawn_opt-4

      - Source + Source

      spawn_link(fun) @@ -446,7 +473,7 @@

      Examples

      A link is created between the calling process and the new process, atomically.

      - Source + Source

      spawn_link(mod, fun, args) @@ -455,7 +482,7 @@

      Examples

      module.function(args). A link is created between the calling process and the new process, atomically. Otherwise works like spawn/3.

      - Source + Source

      spawn_monitor(fun) @@ -463,7 +490,7 @@

      Examples

      Returns the pid of a new process started by the application of fun and reference for a monitor created to the new process.

      - Source + Source

      spawn_monitor(mod, fun, args) @@ -472,7 +499,7 @@

      Examples

      and the process is monitored at the same time. Returns the pid and a reference for the monitor. Otherwise works like spawn/3.

      - Source + Source

      unlink(pid) @@ -483,7 +510,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#unlink-1 for more info.

      - Source + Source

      unregister(name) @@ -492,7 +519,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#unregister-1 for more info.

      - Source + Source

      whereis(name) @@ -502,7 +529,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#whereis-1 for more info.

      - Source + Source diff --git a/docs/stable/Record.html b/docs/stable/Record.html index ad46fb822..3dc1395e7 100644 --- a/docs/stable/Record.html +++ b/docs/stable/Record.html @@ -56,6 +56,16 @@

      Functions summary

      defrecord/3
    2456. +
    2457. + + defrecordp/2 + +
    2458. +
    2459. + + deftypes/4 + +
    2460. extract/2 @@ -77,71 +87,61 @@

      Functions

      deffunctions(values, opts // [], env)

      Defines record functions skipping the module definition. -This is called directly by defrecord. It expects the -module environment, the module values and a keyword list -of options.

      +This is called directly by defrecord. It expects the record +values, a set of options and the module environment.

      Examples

      defmodule CustomRecord do
         Record.deffunctions [:name, :age], __ENV__
      +  Record.deftypes [:name, :age], __ENV__
       end
       
      - Source + Source

      defmacros(name, values, env)

      -

      Defines three macros for reading and writing records values. -These macros are private to the current module and are -basically a simple mechanism for manipulating tuples when -there isn't an interest in exposing the record as a whole. -In some ways, it is similar to Erlang records, since it is -only available at compilation time.

      +

      Defines macros for manipulating records. This is called +directly by defrecordp. It expects the macro name, the +record values and the environment.

      Examples

      -
      defmodule CustomModule do
      -  Record.defmacros :_user, [:name, :age], __ENV__
      -
      -  def new(name, age) do
      -    _user(name: name, age: age)
      -  end
      -
      -  def name(user, name) do
      -    _user(user, name: name)
      -  end
      -
      -  def age(user) do
      -    _user(user, :age)
      -  end
      -
      -  def to_keywords(user) do
      -    _user(user)
      -  end
      -
      -  def name_and_age(user) do
      -   _user(user, [:name, :age])
      -  end
      -
      -  def age_and_name(user) do
      -   _user(user, [:age, :name])
      -  end
      +
      defmodule CustomRecord do
      +  Record.defmacros :user, [:name, :age], __ENV__
       end
       
      - Source + Source

      defrecord(name, values, opts)

      Main entry point for records definition. It defines a module -with the given name and the fields specified in modules. +with the given name and the fields specified in values. This is invoked directly by Kernel.defrecord, so check it for more information and documentation.

      Source +
      +

      + defrecordp(name, fields) +

      +

      Main entry point for private records definition. It defines +a set of macros with the given name and the fields specified +in values. This is invoked directly by Kernel.defrecordp, +so check it for more information and documentation.

      +
      + Source +
      +

      + deftypes(values, types, opts // [], env) +

      +

      Defines types and specs for the record.

      +
      + Source

      extract(name, opts) diff --git a/docs/stable/Regex.CompileError.html b/docs/stable/Regex.CompileError.html index 04db72f15..4b8e3454a 100644 --- a/docs/stable/Regex.CompileError.html +++ b/docs/stable/Regex.CompileError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -110,55 +110,55 @@

      Functions

      exception(args)

      - Source + Source

      exception(args, self)

      - Source + Source

      message(record)

      - Source + Source

      message(value, record)

      - Source + Source

      new()

      - Source + Source

      new(opts)

      - Source + Source

      to_keywords(record)

      - Source + Source

      update(keywords, record)

      - Source + Source

      update_message(function, record)

      - Source + Source
      diff --git a/docs/stable/Regex.html b/docs/stable/Regex.html index 0d76f3a26..d1484e700 100644 --- a/docs/stable/Regex.html +++ b/docs/stable/Regex.html @@ -111,11 +111,6 @@

      Functions summary

      index/2
    2461. -
    2462. - - indexes/2 - -
    2463. match?/2 @@ -178,7 +173,7 @@

      Examples

      Regex.captures %r/c(?<foo>d)/g, "abcd"  #=> [{:foo, ["d"]}]
       
      - Source + Source

      compile(source, options // "") @@ -188,7 +183,7 @@

      Examples

      It returns { :ok, regex } in case of success, { :error, reason } otherwise.

      - Source + Source

      compile!(source, options // "") @@ -196,7 +191,7 @@

      Examples

      Compiles the regular expression according to the given options. Fails with Regex.CompileError if the regex cannot be compiled.

      - Source + Source

      groups(arg1) @@ -208,7 +203,7 @@

      Examples

      Regex.groups %r/(?<foo>foo)/g #=> ["foo"]
       
      - Source + Source

      index(arg1, string) @@ -223,23 +218,7 @@

      Examples

      Regex.index %r/e/, "abcd" #=> nil
      - Source -
      -

      - indexes(arg1, string) -

      -

      Returns a list with the match indexes in the given string. -The matches are tuples where the first element is the index -(zero indexed) the match happened and the second is the length -of the match.

      - -

      Examples

      - -
      Regex.indexes %r/c(d)/, "abcd"  #=> [{2,2},{3,1}]
      -Regex.indexes %r/e/, "abcd"     #=> nil
      -
      -
      - Source + Source

      match?(arg1, string) @@ -252,7 +231,7 @@

      Examples

      Regex.match? %r/foo/, "bar" #=> false
      - Source + Source

      opts(arg1) @@ -264,14 +243,14 @@

      Examples

      Regex.opts %r(foo)m #=> 'm'
       
      - Source + Source

      re_pattern(arg1)

      Returns the underlying re_pattern in the regular expression.

      - Source + Source

      replace(arg1, string, replacement, options // []) @@ -293,7 +272,7 @@

      Examples

      Regex.replace(%r/(b)/, "abc", "[\\1]") #=> "a[b]c"
      - Source + Source

      run(regex, string, options // []) @@ -307,7 +286,7 @@

      Examples

      Regex.run %r/e/, "abcd" #=> nil
      - Source + Source

      scan(regex, string, options // []) @@ -324,7 +303,7 @@

      Examples

      Regex.scan %r/e/, "abcd" #=> []
      - Source + Source

      source(arg1) @@ -336,7 +315,7 @@

      Examples

      Regex.source %r(foo) #=> "foo"
       
      - Source + Source

      split(regex, string, options // []) @@ -344,7 +323,7 @@

      Examples

      Split the given target in the number of parts specified. If no ammount of parts is given, it defaults to :infinity.

      - Source + Source
      diff --git a/docs/stable/String.html b/docs/stable/String.html index 665f5d55b..9a91d2bdd 100644 --- a/docs/stable/String.html +++ b/docs/stable/String.html @@ -28,8 +28,14 @@

      A string in Elixir is a utf-8 binary. This module -contains function to work with utf-8 data and its -codepoints.

      +contains function to work with utf-8 data, its +codepoints and graphemes.

      + +

      Notice that graphemes is a superset of UTF-8 codepoints +which also contains named sequences as defined per +http://www.unicode.org/reports/tr34/. In short, graphemes +also contain multiple characters that are "perceived as +a single character" by readers.

      For working with raw binaries, use Erlang's :binary module.

      @@ -71,6 +77,11 @@

      Functions summary

      first/1

    2464. +
    2465. + + graphemes/1 + +
    2466. last/1 @@ -86,6 +97,16 @@

      Functions summary

      lstrip/2
    2467. +
    2468. + + next_codepoint/1 + +
    2469. +
    2470. + + next_grapheme/1 + +
    2471. printable?/1 @@ -131,7 +152,7 @@

      Functions

      at(string, position)

      -

      Returns the codepoint in the position of the given utf8 string. +

      Returns the grapheme in the position of the given utf8 string. If position is greater than string length, than it returns nil.

      Examples

      @@ -140,10 +161,10 @@

      Examples

      String.at("elixir", 1) #=> "l" String.at("elixir", 10) #=> nil String.at("elixir", -1) #=> "r" -String.at("elixir", -10) #=> "nil" +String.at("elixir", -10) #=> nil
      - Source + Source

      codepoints(string) @@ -157,12 +178,16 @@

      Examples

      String.codepoints("ἅἪῼ") #=> ["ἅ","Ἢ","ῼ"]
      - Source + Source

      - downcase(arg1) + downcase(binary)

      -

      Convert all characters on the given string to down case.

      +

      Convert all characters on the given string to downcase.

      + +

      This function relies on the simple lowercase mapping +available in Unicode 6.2.0, check http://unicode.org/reports/tr44/ +for more information.

      Examples

      @@ -171,7 +196,7 @@

      Examples

      String.downcase("JOSÉ") #=> "josé"
      - Source + Source

      duplicate(subject, n) @@ -184,12 +209,12 @@

      Examples

      String.duplicate("abc", 2) #=> "abcabc"
      - Source + Source

      first(string)

      -

      Returns the first codepoint from an utf8 string.

      +

      Returns the first grapheme from an utf8 string.

      Examples

      @@ -197,12 +222,23 @@

      Examples

      String.first("եոգլի") #=> "ե"
      - Source + Source +
      +

      + graphemes(string) +

      +

      Returns unicode graphemes in the string

      + +

      Examples

      + +

      String.graphemes("Ā̀stute") # => ["Ā̀","s","t","u","t","e"]

      +
      + Source

      last(string)

      -

      Returns the last codepoint from an utf8 string.

      +

      Returns the last grapheme from an utf8 string.

      Examples

      @@ -210,12 +246,12 @@

      Examples

      String.last("եոգլի") #=> "ի"
      - Source + Source

      length(string)

      -

      Returns the number of codepoint in an utf8 string.

      +

      Returns the number of unicode graphemes in an utf8 string.

      Examples

      @@ -223,7 +259,7 @@

      Examples

      String.length("եոգլի") #=> 5
      - Source + Source

      lstrip(string, char // 32) @@ -237,7 +273,39 @@

      Examples

      String.lstrip("_ abc _", ?_) #=> " abc _"
      - Source + Source +
      +

      + next_codepoint(string) +

      +

      Returns the next codepoint in a String.

      + +

      The result is a tuple with the codepoint and the +remaining of the string or :no_codepoint in case +the String reached its end.

      + +

      Examples

      + +
      String.next_codepoint("josé") #=> { "j", "osé" }
      +
      +
      + Source +
      +

      + next_grapheme(string) +

      +

      Returns the next grapheme in a String.

      + +

      The result is a tuple with the grapheme and the +remaining of the string or :no_grapheme in case +the String reached its end.

      + +

      Examples

      + +
      String.next_grapheme("josé") #=> { "j", "osé" }
      +
      +
      + Source

      printable?(arg1) @@ -250,7 +318,7 @@

      Examples

      String.printable?("abc") #=> true
       
      - Source + Source

      replace(subject, pattern, replacement, options // []) @@ -273,7 +341,7 @@

      Examples

      String.replace("a,b,c", ",", "[]", insert_replaced: [1,1]) #=> "a[,,]b[,,]c"
      - Source + Source

      rstrip(string, char // 32) @@ -316,7 +384,7 @@

      Examples

      String.split("a,b", %r{.}) #=> ["a,b"]
      - Source + Source

      strip(string, char // 32) @@ -330,12 +398,16 @@

      Examples

      String.strip("a abc a", ?a) #=> " abc "
      - Source + Source

      - upcase(arg1) + upcase(binary)

      -

      Convert all characters on the given string to upper case.

      +

      Convert all characters on the given string to upcase.

      + +

      This function relies on the simple uppercase mapping +available in Unicode 6.2.0, check http://unicode.org/reports/tr44/ +for more information.

      Examples

      @@ -344,7 +416,7 @@

      Examples

      String.upcase("josé") #=> "JOSÉ"
      - Source + Source
      diff --git a/docs/stable/System.html b/docs/stable/System.html index b8e219696..d35f14197 100644 --- a/docs/stable/System.html +++ b/docs/stable/System.html @@ -83,6 +83,11 @@

      Functions summary

      get_pid/0
    2472. +
    2473. + + halt/2 + +
    2474. put_env/1 @@ -192,6 +197,40 @@

      Functions

      See http://www.erlang.org/doc/man/os.html#getpid-0 for more info.

      Source +
      +

      + halt(status // 0, options // []) +

      +

      Halts the Erlang runtime system where the first argument status must be a +non-negative integer, the atom :abort or any type that can be converted +to a char list.

      + +
        +
      • If an integer, the runtime system exits with the integer value which +is returned to the Operating System;

      • +
      • If :abort, the runtime system aborts producing a core dump, if that is +enabled in the operating system;

      • +
      • If a char list, an erlang crash dump is produced with status as slogan, +and then the runtime system exits with status code 1;

      • +
      + +

      Note that on many platforms, only the status codes 0-255 are supported +by the operating system.

      + +

      For integer status, Erlang runtime system closes all ports and allows async +threads to finish their operations before exiting. To exit without such +flushing, pass options [flush: false] instead.

      + +

      For more information, check: http://www.erlang.org/doc/man/erlang.html#halt-2

      + +

      Examples

      + +
      System.halt(0)
      +System.halt(1, flush: false)
      +System.halt(:abort)
      +
      +
      + Source

      put_env(dict) diff --git a/docs/stable/URI.Parser.html b/docs/stable/URI.Parser.html index 2a02c4f7f..d1bca10fe 100644 --- a/docs/stable/URI.Parser.html +++ b/docs/stable/URI.Parser.html @@ -46,46 +46,12 @@

      -

      Callbacks summary

      - - - -
      -

      Callbacks

      -
      -

      - default_port() -

      -

      Responsible for returning the default port.

      -
      - Source -
      -

      - parse(uri_info) -

      -

      Responsible for parsing extra URL information.

      -
      - Source -
      -
      -
      diff --git a/docs/stable/modules_list.html b/docs/stable/modules_list.html index 528290c64..ed4264833 100644 --- a/docs/stable/modules_list.html +++ b/docs/stable/modules_list.html @@ -16,7 +16,7 @@
    2475. +
    2476. + + get!/2 + + Binary.Dict +
    2477. +
    2478. has_key?/2 @@ -437,6 +444,13 @@

      Dict

    2479. +
    2480. + + get!/2 + + Dict +
    2481. +
    2482. has_key?/2 @@ -839,20 +853,6 @@

      Enum

    2483. -
    2484. - - times/2 - - Enum -
    2485. - -
    2486. - - times/3 - - Enum -
    2487. -
    2488. zip/2 @@ -977,6 +977,101 @@

      ExUnit.Assertions

    2489. + +
    2490. + + + CLIFormatter + + ExUnit.CLIFormatter +
    2491. +
    2492. @@ -995,6 +1090,17 @@

      ExUnit.Case

    2493. + +
    2494. + + + Formatter + + ExUnit.Formatter +
    2495. +
        + +
      @@ -1597,6 +1703,27 @@

      IEx.Helpers +
    2496. + + s/1 + + IEx.Helpers +
    2497. + +
    2498. + + s/3 + + IEx.Helpers +
    2499. + +
    2500. + + t/1 + + IEx.Helpers +
    2501. +
    2502. v/0 @@ -1706,6 +1833,27 @@

    2503. @@ -4696,6 +4862,13 @@

      Node

    2504. +
    2505. + + spawn/2 + + Node +
    2506. +
    2507. spawn/3 @@ -4703,6 +4876,13 @@

      Node

    2508. +
    2509. + + spawn/4 + + Node +
    2510. +
    2511. spawn/5 @@ -5013,6 +5193,13 @@

      Process

    2512. +
    2513. + + spawn/1 + + Process +
    2514. +
    2515. spawn/2 @@ -5020,6 +5207,13 @@

      Process

    2516. +
    2517. + + spawn/3 + + Process +
    2518. +
    2519. spawn/4 @@ -5108,6 +5302,20 @@

      Record

    2520. +
    2521. + + defrecordp/2 + + Record +
    2522. + +
    2523. + + deftypes/4 + + Record +
    2524. +
    2525. extract/2 @@ -5161,13 +5369,6 @@

      Regex

    2526. -
    2527. - - indexes/2 - - Regex -
    2528. -
    2529. match?/2 @@ -5270,6 +5471,13 @@

      String

    2530. +
    2531. + + graphemes/1 + + String +
    2532. +
    2533. last/1 @@ -5291,6 +5499,20 @@

      String

    2534. +
    2535. + + next_codepoint/1 + + String +
    2536. + +
    2537. + + next_grapheme/1 + + String +
    2538. +
    2539. printable?/1 @@ -5400,6 +5622,13 @@

      System

    2540. +
    2541. + + halt/2 + + System +
    2542. +
    2543. put_env/1 @@ -5558,20 +5787,6 @@

    2544. diff --git a/docs/stable/protocols_list.html b/docs/stable/protocols_list.html index b442a119e..7767530d3 100644 --- a/docs/stable/protocols_list.html +++ b/docs/stable/protocols_list.html @@ -16,7 +16,7 @@

      - Elixir v0.7.0 + Elixir v0.7.1

    2545. +
    2546. + + functions/1 + + Macro.Env +
    2547. + +
    2548. + + functions/2 + + Macro.Env +
    2549. +
    2550. in_guard?/1 @@ -1934,6 +1948,13 @@

      Macro.Env

    2551. +
    2552. + + update_functions/2 + + Macro.Env +
    2553. +
    2554. update_line/2 From 30c72efbfeb27e069cd3daf0eeaf185d1bfcde78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Mon, 19 Nov 2012 09:08:09 +0100 Subject: [PATCH 261/437] v0.7.1 released --- _includes/search.html | 2 +- ...released-and-the-end-of-a-journey.markdown | 21 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 _posts/2012-11-18-elixir-v0-7-1-released-and-the-end-of-a-journey.markdown diff --git a/_includes/search.html b/_includes/search.html index c9597a6e4..11fbffd11 100644 --- a/_includes/search.html +++ b/_includes/search.html @@ -1,6 +1,6 @@ diff --git a/_posts/2012-11-18-elixir-v0-7-1-released-and-the-end-of-a-journey.markdown b/_posts/2012-11-18-elixir-v0-7-1-released-and-the-end-of-a-journey.markdown new file mode 100644 index 000000000..fc2744f84 --- /dev/null +++ b/_posts/2012-11-18-elixir-v0-7-1-released-and-the-end-of-a-journey.markdown @@ -0,0 +1,21 @@ +--- +layout: post +title: Elixir v0.7.1 released and the end of a journey +author: José Valim +category: Releases +excerpt: Elixir v0.7.1 was released to celebrate the end of a two months journey traveling around Europe and United States talking about Elixir. + +--- + +Elixir v0.7.1 was released this weekend to celebrate the end of a two months journey traveling around Europe and United States talking about and exposing Elixir to new developers. + +This is a minor release that contains a couple enhancements regarding UTF-8, [dialyzer](http://www.erlang.org/doc/man/dialyzer.html) support and bug fixes. + +During this time traveling around, we have spoken at many conferences, as [Strange Loop](http://thestrangeloop.com/), [Øredev](http://oredev.org/) and [Rupy](http://rupy.eu/) as well as different companies. Developers from different backgrounds have shown interest in Elixir, [written about it](http://spin.atomicobject.com/2012/10/31/elixir-erlang-and-the-dining-philosophers/), joined us at #elixir-lang on freenode and contributed to the language. As of today, Elixir is powered by 51 different contributors! + +In case you missed any of those conferences, [the talk I presented at Øredev is available and you can watch it now](http://vimeo.com/53221562). The slides are also available below. + +If you want to hear more about Elixir at a conference or an event, please let us know. Thank you and don't forget to [give Elixir a try](/getting_started/1.html)! + + + From 0fb253b3e9050e6c123d57a2614df87cbba1f56d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Mon, 19 Nov 2012 09:10:52 +0100 Subject: [PATCH 262/437] Remove share buttons from blog --- _layouts/post.html | 38 ++++---------------------------------- css/style.css | 13 ------------- 2 files changed, 4 insertions(+), 47 deletions(-) diff --git a/_layouts/post.html b/_layouts/post.html index 673145eae..f94e000bf 100644 --- a/_layouts/post.html +++ b/_layouts/post.html @@ -12,44 +12,14 @@

      {{ page.title }}

      {{ page.subtitle }}

      {% endif %} - +
      {{ content }}
      - + - + diff --git a/css/style.css b/css/style.css index bae3ae913..f8358e6d6 100644 --- a/css/style.css +++ b/css/style.css @@ -573,19 +573,6 @@ body.source div.menu li.source a { margin: 3px 25px 20px 0; } -div.share-buttons { - width: auto; - padding: 13px 0px 5px 5px; - text-align: right; - background-color: #F5f5f5; - border: 1px solid #EFEFEF; - border-left: 0px; - border-right: 0px; - min-height: 30px; -} - -div.share-buttons span { float: left; display: block; } - /* Post titles -------------------------------------------------------------- */ .hentry .entry-title { From e5122d143fa231b2a3e1a2ad97e6e8a7aba635c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Mon, 19 Nov 2012 17:58:45 +0100 Subject: [PATCH 263/437] Fix typo --- ...-18-elixir-v0-7-1-released-and-the-end-of-a-journey.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_posts/2012-11-18-elixir-v0-7-1-released-and-the-end-of-a-journey.markdown b/_posts/2012-11-18-elixir-v0-7-1-released-and-the-end-of-a-journey.markdown index fc2744f84..18cfca9e6 100644 --- a/_posts/2012-11-18-elixir-v0-7-1-released-and-the-end-of-a-journey.markdown +++ b/_posts/2012-11-18-elixir-v0-7-1-released-and-the-end-of-a-journey.markdown @@ -11,7 +11,7 @@ Elixir v0.7.1 was released this weekend to celebrate the end of a two months jou This is a minor release that contains a couple enhancements regarding UTF-8, [dialyzer](http://www.erlang.org/doc/man/dialyzer.html) support and bug fixes. -During this time traveling around, we have spoken at many conferences, as [Strange Loop](http://thestrangeloop.com/), [Øredev](http://oredev.org/) and [Rupy](http://rupy.eu/) as well as different companies. Developers from different backgrounds have shown interest in Elixir, [written about it](http://spin.atomicobject.com/2012/10/31/elixir-erlang-and-the-dining-philosophers/), joined us at #elixir-lang on freenode and contributed to the language. As of today, Elixir is powered by 51 different contributors! +During this time traveling around, we have spoken at many conferences, as [Strange Loop](http://thestrangeloop.com/), [Øredev](http://oredev.org/) and [Rupy](http://rupy.eu/) as well as at different companies. Developers from different backgrounds have shown interest in Elixir, [written about it](http://spin.atomicobject.com/2012/10/31/elixir-erlang-and-the-dining-philosophers/), joined us at #elixir-lang on freenode and contributed to the language. As of today, Elixir is powered by 51 different contributors! In case you missed any of those conferences, [the talk I presented at Øredev is available and you can watch it now](http://vimeo.com/53221562). The slides are also available below. From 243984ea582be4f0d4ec0aa28d5ddd25350cdb11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Tue, 20 Nov 2012 00:08:37 +0100 Subject: [PATCH 264/437] Update v0.7.1 announcement --- ...elixir-v0-7-1-released-and-the-end-of-a-journey.markdown | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/_posts/2012-11-18-elixir-v0-7-1-released-and-the-end-of-a-journey.markdown b/_posts/2012-11-18-elixir-v0-7-1-released-and-the-end-of-a-journey.markdown index 18cfca9e6..6a5b60ce7 100644 --- a/_posts/2012-11-18-elixir-v0-7-1-released-and-the-end-of-a-journey.markdown +++ b/_posts/2012-11-18-elixir-v0-7-1-released-and-the-end-of-a-journey.markdown @@ -3,15 +3,15 @@ layout: post title: Elixir v0.7.1 released and the end of a journey author: José Valim category: Releases -excerpt: Elixir v0.7.1 was released to celebrate the end of a two months journey traveling around Europe and United States talking about Elixir. +excerpt: Elixir v0.7.1 was released to celebrate the end of a two months journey traveling around Europe, United States and Brazil talking about Elixir. --- -Elixir v0.7.1 was released this weekend to celebrate the end of a two months journey traveling around Europe and United States talking about and exposing Elixir to new developers. +Elixir v0.7.1 was released this weekend to celebrate the end of a two months journey traveling around Europe, United States and Brazil talking about and exposing Elixir to new developers. This is a minor release that contains a couple enhancements regarding UTF-8, [dialyzer](http://www.erlang.org/doc/man/dialyzer.html) support and bug fixes. -During this time traveling around, we have spoken at many conferences, as [Strange Loop](http://thestrangeloop.com/), [Øredev](http://oredev.org/) and [Rupy](http://rupy.eu/) as well as at different companies. Developers from different backgrounds have shown interest in Elixir, [written about it](http://spin.atomicobject.com/2012/10/31/elixir-erlang-and-the-dining-philosophers/), joined us at #elixir-lang on freenode and contributed to the language. As of today, Elixir is powered by 51 different contributors! +During this time traveling around, we have spoken at many conferences, as [Strange Loop](http://thestrangeloop.com/), [Øredev](http://oredev.org/), [QCon SP](http://qconsp.com/) and [Rupy](http://rupy.eu/) as well as at different companies. Developers from different backgrounds have shown interest in Elixir, [written about it](http://spin.atomicobject.com/2012/10/31/elixir-erlang-and-the-dining-philosophers/), joined us at #elixir-lang on freenode and contributed to the language. As of today, Elixir is powered by 51 different contributors! In case you missed any of those conferences, [the talk I presented at Øredev is available and you can watch it now](http://vimeo.com/53221562). The slides are also available below. From 6081b34bf405bf700349adee17d5afc62711a7bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sat, 24 Nov 2012 21:01:50 +0100 Subject: [PATCH 265/437] Improvements to the getting started guide --- getting_started/2.markdown | 36 +++++++++++++----------------------- getting_started/5.markdown | 2 +- 2 files changed, 14 insertions(+), 24 deletions(-) diff --git a/getting_started/2.markdown b/getting_started/2.markdown index ee61b1475..ab6673a8a 100644 --- a/getting_started/2.markdown +++ b/getting_started/2.markdown @@ -172,7 +172,7 @@ When discussing lists earlier we saw the following example: iex> t [2, 3] -In Elixir, `=` does not mean assignment as in programming languages like Java and Ruby. `=` is actually a match operator which will check if the expressions on both left and right side match. Consider this example: +In Elixir, `=` is not an assignment as in programming languages like Java, Ruby, Python, etc. `=` is actually a match operator which will check if the expressions on both left and right side match. Consider this example: iex> { 1, 2, 3 } = { 1, 2, 3 } { 1, 2, 3 } @@ -249,36 +249,22 @@ The second example uses the block syntax. We can also use `else` in the block sy 10 + 3 end -Elixir blocks work similarly to Ruby blocks. For example, a developer could add parentheses as follow: +It is important to notice that `do`/`end` always binds to the farthest function call. For example, the following expression: - if(false) do + is_number if true do 1 + 2 - else - 10 + 3 - end - -It is also important to notice that `do`/`end` always binds to the farthest function call. For example, the following expression: - - Enum.map [1,2,3], fn(x) do - x * 2 end Would be parsed as: - Enum.map([1,2,3], fn(x)) do - x * 2 - end - -Which is not what we want since `do` is binding to the farthest function call; in this case `Enum.map`. For this reason, we always use the `->` syntax for functions and reserve `do/end` for the remaining control structures: - - Enum.map [1,2,3], fn(x) -> - x * 2 + is_number(if true) do + 1 + 2 end -Which is then parsed as: +Which is not what we want since `do` is binding to the farthest function call, in this case `is_number`. Adding explicit parenthesis is enough to resolve the ambiguity: - Enum.map([1,2,3], fn(x) -> - x * 2 + is_number(if true do + 1 + 2 end) ## 2.7 Control flow structures @@ -451,7 +437,11 @@ In Elixir, creating a function is similar to the `case` mechanism we have just s A function with one clause can be defined with a (preferred) shortcut syntax as follows: - function = fn x, y -> x + y end + f = fn x, y -> x + y end + + f = fn x, y -> + x + y + end This is the syntax that's going to be used throughout this guide. diff --git a/getting_started/5.markdown b/getting_started/5.markdown index cdbf05052..56ec02702 100644 --- a/getting_started/5.markdown +++ b/getting_started/5.markdown @@ -55,7 +55,7 @@ With those basic structures in mind, we are ready to define our own macro. ## 5.2 Defining our own macro -A macro can be defined using `defmacro`. For instance, in just a few lines of code we can define a macro called `unless` which works the same way Ruby's `unless` does: +A macro can be defined using `defmacro`. For instance, in just a few lines of code we can define a macro called `unless` which does the opposite of `if`: {% highlight ruby %} defmodule MyMacro do From a4380e70cde5ee1952cbd92302a41fb4818c0191 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sat, 24 Nov 2012 23:36:01 +0100 Subject: [PATCH 266/437] Improving diving in --- getting_started/2.markdown | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/getting_started/2.markdown b/getting_started/2.markdown index ab6673a8a..ee7bba519 100644 --- a/getting_started/2.markdown +++ b/getting_started/2.markdown @@ -232,21 +232,33 @@ Although pattern matching allows us to build powerful constructs, its usage is l ## 2.6 Blocks -One of the first control flow constructs we usually learn is the conditional `if`. In Elixir, we can write `if` in these two ways: +One of the first control flow constructs we usually learn is the conditional `if`. In Elixir, we could write `if` as follow: iex> if true, do: 1 + 2 3 + +The `if` expression can also be written using the block syntax: + iex> if true do - ...> 1 + 2 + ...> a = 1 + 2 + ...> a + 10 ...> end - 3 + 13 -The second example uses the block syntax. We can also use `else` in the block syntax: +You can think of `do`/`end` blocks as a convenience for passing a group of expressions to `do:`. It is exactly the same as: + + iex> if true, do: ( + ...> a = 1 + 2 + ...> a + 10 + ...> ) + 13 + +We can pass an `else` clause in the block syntax: if false do - 1 + 2 + :this else - 10 + 3 + :that end It is important to notice that `do`/`end` always binds to the farthest function call. For example, the following expression: From b6d4eecbef2c4077d81faccc237c0ca43dcb4fe8 Mon Sep 17 00:00:00 2001 From: Mike Pack Date: Sun, 25 Nov 2012 17:45:30 -0700 Subject: [PATCH 267/437] Fix typo --- getting_started/2.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/getting_started/2.markdown b/getting_started/2.markdown index ee7bba519..4413db62a 100644 --- a/getting_started/2.markdown +++ b/getting_started/2.markdown @@ -585,7 +585,7 @@ For example, if you write a software that does log partitioning and log rotation # We need to handle the error accordingly end -Notice `File.read` does not raise an exception in case something goes wrong, it returns a tuple containing `:ok` in case of success and `{ :error, reason }` in case of failures. This is approach is commonly called **sideband data** as we annotate the result. +Notice `File.read` does not raise an exception in case something goes wrong, it returns a tuple containing `:ok` in case of success and `{ :error, reason }` in case of failures. This approach is commonly called **sideband data** as we annotate the result. On the other hand, a CLI interface that needs to access or manipulate a file given by the user, you may necessarily expect a file to be there, if it isn't there is nothing you can do then fail. Then you may use `File.read!` which raises an exception: From 5639aa5cb92daf39f9f8cbf77bbe9e78f300cb7a Mon Sep 17 00:00:00 2001 From: Brad Chase Date: Mon, 26 Nov 2012 06:12:17 -0500 Subject: [PATCH 268/437] added missing word --- getting_started/2.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/getting_started/2.markdown b/getting_started/2.markdown index 4413db62a..48e2ac7e6 100644 --- a/getting_started/2.markdown +++ b/getting_started/2.markdown @@ -172,7 +172,7 @@ When discussing lists earlier we saw the following example: iex> t [2, 3] -In Elixir, `=` is not an assignment as in programming languages like Java, Ruby, Python, etc. `=` is actually a match operator which will check if the expressions on both left and right side match. Consider this example: +In Elixir, `=` is not an assignment operator as in programming languages like Java, Ruby, Python, etc. `=` is actually a match operator which will check if the expressions on both left and right side match. Consider this example: iex> { 1, 2, 3 } = { 1, 2, 3 } { 1, 2, 3 } From 30b12502263505fbbf05a8e158b0e3cf47c36274 Mon Sep 17 00:00:00 2001 From: Brad Chase Date: Mon, 26 Nov 2012 06:12:40 -0500 Subject: [PATCH 269/437] fixed operator --- getting_started/2.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/getting_started/2.markdown b/getting_started/2.markdown index 48e2ac7e6..c62f8fc30 100644 --- a/getting_started/2.markdown +++ b/getting_started/2.markdown @@ -374,7 +374,7 @@ Each match clause also supports special conditions specified via guards: In the example above, the second clause will only match when x is positive. The Erlang VM only allows the following expressions as guards: -* comparison operators (`==`, `!=`, `===`, `!===`, `>`, `<`, `<=`, `>=`); +* comparison operators (`==`, `!=`, `===`, `!==`, `>`, `<`, `<=`, `>=`); * strict boolean operators (`and`, `or`, `not`). Note that `||` and `&&` are not allowed; * arithmetic operators (`+`, `-`, `*`, `/`); * `<>` and `++` as long as the left side is a literal; From 9fb1e0184854895b6297230fc3ab58e40265702a Mon Sep 17 00:00:00 2001 From: Brad Chase Date: Mon, 26 Nov 2012 06:26:24 -0500 Subject: [PATCH 270/437] pretty sure the first use of "function" in this sentence should be "process" instead --- getting_started/2.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/getting_started/2.markdown b/getting_started/2.markdown index c62f8fc30..651cfe97a 100644 --- a/getting_started/2.markdown +++ b/getting_started/2.markdown @@ -543,7 +543,7 @@ You may not see exactly `<0.36.0>` back, but something similar. If there are no ...> end Too late -Notice we spawned a new function using the `spawn` function passing another function as argument. Elixir also supports `spawn_link`, which spawns a child process but keeps the parent and child connected. This way, if the child dies unexpectedly, the parent receives a notification. [`Process`](/docs/stable/Process.html) and [`Node`](/docs/stable/Node.html) modules contains many functions to manage processes, including spawning and get information about processes running in other nodes in the network. +Notice we spawned a new process using the `spawn` function passing another function as argument. Elixir also supports `spawn_link`, which spawns a child process but keeps the parent and child connected. This way, if the child dies unexpectedly, the parent receives a notification. [`Process`](/docs/stable/Process.html) and [`Node`](/docs/stable/Node.html) modules contains many functions to manage processes, including spawning and get information about processes running in other nodes in the network. ## 2.8 Exceptions From 03882487590972ad1f36f3f086a2dceca2c9c50a Mon Sep 17 00:00:00 2001 From: Brad Chase Date: Mon, 26 Nov 2012 06:31:24 -0500 Subject: [PATCH 271/437] "oops" :smiley: --- getting_started/2.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/getting_started/2.markdown b/getting_started/2.markdown index 651cfe97a..b769971b3 100644 --- a/getting_started/2.markdown +++ b/getting_started/2.markdown @@ -581,7 +581,7 @@ For example, if you write a software that does log partitioning and log rotation # we could access the file # proceed as expected { :error, reason } -> - # Ops, something went wrong + # Oops, something went wrong # We need to handle the error accordingly end From f0676ef2a26eca745663bc4cb4dabb58c11f53f7 Mon Sep 17 00:00:00 2001 From: Brad Chase Date: Mon, 26 Nov 2012 06:45:33 -0500 Subject: [PATCH 272/437] fixed typo --- getting_started/3.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/getting_started/3.markdown b/getting_started/3.markdown index e1f275df1..c15c3d554 100644 --- a/getting_started/3.markdown +++ b/getting_started/3.markdown @@ -237,7 +237,7 @@ In general, a module does not need to be required before usage, except if we wan MyMacros.my_if do_something, it_works end -An attempt to call a macro that was not loaded will raise an error. Note that likes the `alias` directive, `require` is also lexically scoped. +An attempt to call a macro that was not loaded will raise an error. Note that like the `alias` directive, `require` is also lexically scoped. ### 3.5.3 import From bafa7056dbceb99c1a9a58374dfd6349f5e67441 Mon Sep 17 00:00:00 2001 From: Brad Chase Date: Mon, 26 Nov 2012 06:46:13 -0500 Subject: [PATCH 273/437] fixed typo --- getting_started/3.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/getting_started/3.markdown b/getting_started/3.markdown index c15c3d554..a20ff8b23 100644 --- a/getting_started/3.markdown +++ b/getting_started/3.markdown @@ -241,7 +241,7 @@ An attempt to call a macro that was not loaded will raise an error. Note that li ### 3.5.3 import -We use `import` whenever we want to easily access functions or macros from others modules without using the qualified name. For instance, if we want to use the `duplicate` function from `List` several times in a module and we don't want to always type `List.duplicate`, we can simply import it: +We use `import` whenever we want to easily access functions or macros from other modules without using the qualified name. For instance, if we want to use the `duplicate` function from `List` several times in a module and we don't want to always type `List.duplicate`, we can simply import it: defmodule Math do import List, only: [duplicate: 2] From 0e2cbc70ae399c6a18db67585857aeb7fd299cf2 Mon Sep 17 00:00:00 2001 From: Brad Chase Date: Mon, 26 Nov 2012 06:57:09 -0500 Subject: [PATCH 274/437] fixed typo --- getting_started/4.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/getting_started/4.markdown b/getting_started/4.markdown index a73def112..c46655676 100644 --- a/getting_started/4.markdown +++ b/getting_started/4.markdown @@ -34,7 +34,7 @@ Internally, a record is simply a tuple where the first element is always the rec ### 4.1.1 Pattern matching -Elixir also allows one to pattern match against records. For example, imagine we want to check if a file was accessed or not based on the `FileInfo` record above, we could implement is as follow: +Elixir also allows one to pattern match against records. For example, imagine we want to check if a file was accessed or not based on the `FileInfo` record above, we could implement it as follow: def was_accessed?(FileInfo[accesses: 0]), do: true def was_accessed?(FileInfo[]), do: false From 7fa7f18951b8a1bc55133acdc4606b3b08a22ca9 Mon Sep 17 00:00:00 2001 From: Brad Chase Date: Mon, 26 Nov 2012 07:07:55 -0500 Subject: [PATCH 275/437] changed number in copy to reflect number of items in the list --- getting_started/4.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/getting_started/4.markdown b/getting_started/4.markdown index c46655676..6fc8306db 100644 --- a/getting_started/4.markdown +++ b/getting_started/4.markdown @@ -175,7 +175,7 @@ Finally, since records are simply tuples, one can add a default protocol impleme ### 4.2.3 Built-in protocols -Elixir ships with three built-in protocols, they are: +Elixir ships with five built-in protocols, they are: * Access - specifies how to access an element. This is the protocol that empowers bracket access in Elixir, for example: From b2ce5ef4c87763e3960e69a62f6dfa28c4d683d1 Mon Sep 17 00:00:00 2001 From: Brad Chase Date: Mon, 26 Nov 2012 07:19:35 -0500 Subject: [PATCH 276/437] fixed wording --- getting_started/5.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/getting_started/5.markdown b/getting_started/5.markdown index 56ec02702..615b4bd08 100644 --- a/getting_started/5.markdown +++ b/getting_started/5.markdown @@ -120,7 +120,7 @@ We can define any macro we want, including ones that override the built-in macro ## 5.3 Macros hygiene -Elixir macros follow Scheme conventions and are hygienic. This means a variable defined inside a macro won't conflict with a variable defined in the context the macro is inserted. For example: +Elixir macros follow Scheme conventions and are hygienic. This means a variable defined inside a macro won't conflict with a variable defined in the context where that macro is inserted. For example: {% highlight ruby %} defmodule Hygiene do From c93ddeb8e28201211df8f3015dbe467c2be3c8cf Mon Sep 17 00:00:00 2001 From: Brad Chase Date: Mon, 26 Nov 2012 07:26:16 -0500 Subject: [PATCH 277/437] added #'s for consistent syntax highlighting --- getting_started/5.markdown | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/getting_started/5.markdown b/getting_started/5.markdown index 615b4bd08..f14cda57c 100644 --- a/getting_started/5.markdown +++ b/getting_started/5.markdown @@ -190,10 +190,10 @@ require Hygiene Hygiene.quoted(x) #=> { - { :x, 1, nil }, - { :x, 1, :quoted }, - { :x, 1, [] } -} +# { :x, 1, nil }, +# { :x, 1, :quoted }, +# { :x, 1, [] } +# } {% endhighlight %} Summing up: if the third element is a list, it is certainly a function call. If not, it may be a variable (coming from a quote or not) or a function call. From fb8c57932477a49db924600746dc3ed45c4cddde Mon Sep 17 00:00:00 2001 From: Brad Chase Date: Mon, 26 Nov 2012 07:34:16 -0500 Subject: [PATCH 278/437] fixed typo, wording --- getting_started/6.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/getting_started/6.markdown b/getting_started/6.markdown index 8c6d05d42..aedbbbc2e 100644 --- a/getting_started/6.markdown +++ b/getting_started/6.markdown @@ -113,7 +113,7 @@ This functionality can also be used to print the documentation for any Elixir mo iex> h(Enum.each/2) ... -The documentation for built-in functions can also be accessed directly or directly in the `Kernel` module: +The documentation for built-in functions can also be accessed directly or indirectly from the `Kernel` module: iex> h(is_atom/1) ... From bfa56924b9b84910c8692ee36869255ddecc8ad2 Mon Sep 17 00:00:00 2001 From: Brad Chase Date: Mon, 26 Nov 2012 07:41:39 -0500 Subject: [PATCH 279/437] fixed typo --- getting_started/7.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/getting_started/7.markdown b/getting_started/7.markdown index 4f6650f31..5218d7543 100644 --- a/getting_started/7.markdown +++ b/getting_started/7.markdown @@ -8,7 +8,7 @@ guide: 7 ## 7.1 Applications -In order to get your first project started, Elixir ships with a build tool called [`Mix`](/getting_started/mix.html). You can get your new project start by simply running: +In order to get your first project started, Elixir ships with a build tool called [`Mix`](/getting_started/mix.html). You can get your new project started by simply running: mix new path/to/new/project From 7bab7df9ed42855d569c4a1783c5c93aba1cfcd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Mon, 26 Nov 2012 14:23:58 +0100 Subject: [PATCH 280/437] Ammend guide since we have a String module --- getting_started/2.markdown | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/getting_started/2.markdown b/getting_started/2.markdown index b769971b3..edca61208 100644 --- a/getting_started/2.markdown +++ b/getting_started/2.markdown @@ -82,7 +82,7 @@ Since keyword lists are very frequently passed as arguments, they do not require ## 2.3 Char lists and binaries -In the previous chapter we have discussed double- and single- representations. Double-quoted are binary strings while single-quoted are char lists: +In the previous chapter we have discussed double- and single- representations: iex> "sample" == 'sample' false @@ -91,7 +91,7 @@ In the previous chapter we have discussed double- and single- representations. D iex> is_list 'char list' true -In fact, both double-quoted and single-quoted representations are just a shorter representation of binaries and lists. Given that `?a` in Elixir returns the ASCII integer for the letter `a`, we could also write: +In fact, both double-quoted and single-quoted representations are just a shorter representation of binaries and lists respectively. Given that `?a` in Elixir returns the ASCII integer for the letter `a`, we could also write: iex> <> "abc" @@ -145,7 +145,7 @@ If at any moment, you would like to match the top of a binary against any other This is equivalent to the head and tail pattern matching we saw in lists. There is much more to binaries and pattern matching in Elixir that allows great flexibility when working with such structures, but they are beyond the scope of a getting started guide. -Currently, Elixir does not ship with any library for doing string manipulation, but this will be amended soon. +In order to work with binaries, one can use [Erlang's binary module](http://www.erlang.org/doc/man/binary.html) or [Elixir's String module](http://elixir-lang.org/docs/stable/String.html) which is meant to work on UTF-8 data. ## 2.4 Calling Erlang functions From 8daaa3e734c678ca25051161ca53ef6c1d53df36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Mon, 26 Nov 2012 14:29:13 +0100 Subject: [PATCH 281/437] Link to defrecord docs --- getting_started/4.markdown | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/getting_started/4.markdown b/getting_started/4.markdown index 6fc8306db..59c24fab7 100644 --- a/getting_started/4.markdown +++ b/getting_started/4.markdown @@ -69,7 +69,7 @@ Since `counter` is an integer, Elixir automatically defines a helper named `incr iex> new_config.counter 10 -On the other hand, if the default value is a list Elixir will define the two following helpers: +On the other hand if the default value is a list Elixir will define the two following helpers: * `prepend_field` - Receives another list and prepends its values * `merge_field` - Receives a keywords list and merges it into the current value; @@ -97,6 +97,8 @@ Since `new_config` remains unchanged, we get a new record with the `counter` fie iex> new_config.increment_counter Config[counter: 2, failures: []] +For more information on records, [check out the documentation for the `defrecord` macro](http://elixir-lang.org/docs/master/Kernel.html#defrecord/4) + ## 4.2 Protocols Protocols allow us to define contracts. Dispatching a protocol is available to any data type as long as it implements the prototype. Let's consider a practical example. From 46fbb7db97037a4f6b86fb10040c3c4fb276c67e Mon Sep 17 00:00:00 2001 From: Brad Chase Date: Tue, 27 Nov 2012 01:19:40 -0500 Subject: [PATCH 282/437] fixed typo --- crash-course.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crash-course.markdown b/crash-course.markdown index 6d7894f93..3b04e9584 100644 --- a/crash-course.markdown +++ b/crash-course.markdown @@ -182,7 +182,7 @@ to invoke the `new` function from the `orddict` module. In Elixir, use the dot ` Process.self {% endhighlight %} -**Note**. Since Erlang modules are represented by atoms, you may invoke Erlang functions in Elixir as follow: +**Note**. Since Erlang modules are represented by atoms, you may invoke Erlang functions in Elixir as follows: {% highlight ruby %} :lists.sort [3, 2,1] From f7871a297949307978b1ea79b45dae21660e8d54 Mon Sep 17 00:00:00 2001 From: Brad Chase Date: Tue, 27 Nov 2012 01:23:35 -0500 Subject: [PATCH 283/437] fixed typo --- crash-course.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crash-course.markdown b/crash-course.markdown index 3b04e9584..c2cb4f09f 100644 --- a/crash-course.markdown +++ b/crash-course.markdown @@ -194,7 +194,7 @@ All of the Erlang built-ins reside in the `:erlang` module. ## 3 Data Types -Erlang and Elixir have the same data types for the most part, but there is a number of differences. +Erlang and Elixir have the same data types for the most part, but there are a number of differences. ### Atoms From 1544c083f3d7166b5829cd32454155224a40a5ea Mon Sep 17 00:00:00 2001 From: Brad Chase Date: Tue, 27 Nov 2012 16:12:32 -0500 Subject: [PATCH 284/437] fixed typo --- crash-course.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crash-course.markdown b/crash-course.markdown index c2cb4f09f..9eefbb8f2 100644 --- a/crash-course.markdown +++ b/crash-course.markdown @@ -328,7 +328,7 @@ lines. ### Keyword list (Orddict) -Orddicts in Erlang are created using either `orddict:new/0` or `orddict:from_list/1` while Elixir offers a literal syntax and call them keyword list: +Orddicts in Erlang are created using either `orddict:new/0` or `orddict:from_list/1` while Elixir offers a literal syntax and calls them keyword lists: **Erlang** From 45fa6b1b48f93078d0f1de01eb4410a7c73994dc Mon Sep 17 00:00:00 2001 From: Brad Chase Date: Tue, 27 Nov 2012 16:21:25 -0500 Subject: [PATCH 285/437] fixed URL index to avoid collision with [1] above --- crash-course.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crash-course.markdown b/crash-course.markdown index 9eefbb8f2..6cf9c6b6e 100644 --- a/crash-course.markdown +++ b/crash-course.markdown @@ -358,7 +358,7 @@ The syntax for records differs significantly between Erlang and Elixir. Please r [1]: http://learnyousomeerlang.com/a-short-visit-to-common-data-structures#records [2]: http://elixir-lang.org/getting_started/4.html -In order to translate Erlang records into Elixir records, use Record.extract(). For example, to use the `ec2_instance_spec` record from [erlcloud][1]: +In order to translate Erlang records into Elixir records, use Record.extract(). For example, to use the `ec2_instance_spec` record from [erlcloud][3]: {% highlight ruby %} defrecord :ec2_instance_spec, Record.extract(:ec2_instance_spec, @@ -373,7 +373,7 @@ new_host = :ec2_instance_spec.new( IO.puts inspect(new_host) {% endhighlight %} -[1]: https://github.com/gleber/erlcloud/blob/master/include/erlcloud_ec2.hrl#L11 +[3]: https://github.com/gleber/erlcloud/blob/master/include/erlcloud_ec2.hrl#L11
      From b39e2ca08425441d4fd225440b0f833104735169 Mon Sep 17 00:00:00 2001 From: Brad Chase Date: Tue, 27 Nov 2012 16:32:14 -0500 Subject: [PATCH 286/437] clarified wording --- crash-course.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crash-course.markdown b/crash-course.markdown index 6cf9c6b6e..833f0ecd0 100644 --- a/crash-course.markdown +++ b/crash-course.markdown @@ -400,7 +400,7 @@ priv() -> Here we create a module named ``hello_module``. In it we define three functions, the first two of which are made available for other modules to call via the ``export`` directive at the top. It contains a list of functions, each of which is written in the format ``/``. Arity stands for the number of arguments. -An equivalent code in Elixir: +An Elixir equivalent to the Erlang above: {% highlight ruby %} defmodule HelloModule do From 75e9e05bd69cec04a5fdc4c08f69cf3d81204a94 Mon Sep 17 00:00:00 2001 From: Brad Chase Date: Tue, 27 Nov 2012 16:39:51 -0500 Subject: [PATCH 287/437] changed ouput to match behavior seen in iex --- crash-course.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crash-course.markdown b/crash-course.markdown index 833f0ecd0..898d45966 100644 --- a/crash-course.markdown +++ b/crash-course.markdown @@ -456,7 +456,7 @@ HelloModule.Utils.priv #=> ** (UndefinedFunctionError) undefined function: HelloModule.Utils.priv/0 HelloModule.State.new -#=> { HelloModule.State, [:sally] } +#=> HelloModule.State[ponies: [:sally]] {% endhighlight %}
      From afa8d70d69e7b6a3a80bbe499d6d959c97fd9cde Mon Sep 17 00:00:00 2001 From: Brad Chase Date: Tue, 27 Nov 2012 16:45:37 -0500 Subject: [PATCH 288/437] changed URL index to avoid collisions below now :grin: --- crash-course.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crash-course.markdown b/crash-course.markdown index 898d45966..cce53c857 100644 --- a/crash-course.markdown +++ b/crash-course.markdown @@ -358,7 +358,7 @@ The syntax for records differs significantly between Erlang and Elixir. Please r [1]: http://learnyousomeerlang.com/a-short-visit-to-common-data-structures#records [2]: http://elixir-lang.org/getting_started/4.html -In order to translate Erlang records into Elixir records, use Record.extract(). For example, to use the `ec2_instance_spec` record from [erlcloud][3]: +In order to translate Erlang records into Elixir records, use Record.extract(). For example, to use the `ec2_instance_spec` record from [erlcloud][8]: {% highlight ruby %} defrecord :ec2_instance_spec, Record.extract(:ec2_instance_spec, @@ -373,7 +373,7 @@ new_host = :ec2_instance_spec.new( IO.puts inspect(new_host) {% endhighlight %} -[3]: https://github.com/gleber/erlcloud/blob/master/include/erlcloud_ec2.hrl#L11 +[8]: https://github.com/gleber/erlcloud/blob/master/include/erlcloud_ec2.hrl#L11
      From f1d95e1c7e4284f773844f4fcd4c855798dbd469 Mon Sep 17 00:00:00 2001 From: Brad Chase Date: Tue, 27 Nov 2012 16:47:39 -0500 Subject: [PATCH 289/437] fixed wording --- crash-course.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crash-course.markdown b/crash-course.markdown index cce53c857..f64cfbd2e 100644 --- a/crash-course.markdown +++ b/crash-course.markdown @@ -469,7 +469,7 @@ HelloModule.State.new ### Pattern Matching -Pattern matching in Elixir is based on Erlang implementation and in general very similar: +Pattern matching in Elixir is based on Erlang's implementation and in general very similar: **Erlang** From 83266eecf5b2e992205eb83707b13ae1b32f74b0 Mon Sep 17 00:00:00 2001 From: Brad Chase Date: Tue, 27 Nov 2012 16:50:49 -0500 Subject: [PATCH 290/437] clarified wording --- crash-course.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crash-course.markdown b/crash-course.markdown index f64cfbd2e..2e3a156d3 100644 --- a/crash-course.markdown +++ b/crash-course.markdown @@ -495,7 +495,7 @@ def loop_through([]) do end {% endhighlight %} -When defining a function with the same name multiple times, each such definition is called a **clause**. In Erlang, clauses always go side by side, separated by a semi-colon ``;``, the last clause is terminated by a dot ``.``. +When defining a function with the same name multiple times, each such definition is called a **clause**. In Erlang, clauses always go side by side and are separated by a semi-colon ``;``. The last clause is terminated by a dot ``.``. Elixir doesn't require punctuation to separate clause, although the must be grouped together. From aa0a385e14e3ccdd377dd9e6d663999a50f3c8cc Mon Sep 17 00:00:00 2001 From: Brad Chase Date: Tue, 27 Nov 2012 16:51:40 -0500 Subject: [PATCH 291/437] fixed typo, wording --- crash-course.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crash-course.markdown b/crash-course.markdown index 2e3a156d3..dc7c75ee4 100644 --- a/crash-course.markdown +++ b/crash-course.markdown @@ -497,7 +497,7 @@ end When defining a function with the same name multiple times, each such definition is called a **clause**. In Erlang, clauses always go side by side and are separated by a semi-colon ``;``. The last clause is terminated by a dot ``.``. -Elixir doesn't require punctuation to separate clause, although the must be grouped together. +Elixir doesn't require punctuation to separate clauses, but they must be grouped together. ### Function Overloading From 7d22178cbddbe928dc0e929efcd35fd798ff7d0c Mon Sep 17 00:00:00 2001 From: Brad Chase Date: Tue, 27 Nov 2012 16:58:19 -0500 Subject: [PATCH 292/437] changed # to % for erlang comment --- crash-course.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crash-course.markdown b/crash-course.markdown index dc7c75ee4..d8326022e 100644 --- a/crash-course.markdown +++ b/crash-course.markdown @@ -306,7 +306,7 @@ Elixir supports a literal syntax for regular expressions. Such syntax allows reg {% highlight erlang %} { ok, Pattern } = re:compile("abc\\s"). re:run("abc ", Pattern). -#=> { match, ["abc "] } +%=> { match, ["abc "] } {% endhighlight %} **Elixir** From 7cdcce7e95638211e3c52780e4b7e611d1036be7 Mon Sep 17 00:00:00 2001 From: Brad Chase Date: Tue, 27 Nov 2012 17:36:37 -0500 Subject: [PATCH 293/437] fixed typo --- crash-course.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crash-course.markdown b/crash-course.markdown index d8326022e..d38f8192c 100644 --- a/crash-course.markdown +++ b/crash-course.markdown @@ -609,7 +609,7 @@ Enum.map [1, 2, 3, 4], square #=> [1, 4, 9, 16] {% endhighlight %} -Is is possible to use pattern matching when defining anonymous functions too. In Elixir, `fn` is a shortcut, so we need to use `function` when we want many clauses: +It is possible to use pattern matching when defining anonymous functions too. In Elixir, `fn` is a shortcut, so we need to use `function` when we want many clauses: **Erlang** From 4a16d907accb47ee6c54057040894ef229b4a105 Mon Sep 17 00:00:00 2001 From: Brad Chase Date: Tue, 27 Nov 2012 17:39:23 -0500 Subject: [PATCH 294/437] added output comment --- crash-course.markdown | 1 + 1 file changed, 1 insertion(+) diff --git a/crash-course.markdown b/crash-course.markdown index d38f8192c..925d7f3fc 100644 --- a/crash-course.markdown +++ b/crash-course.markdown @@ -665,6 +665,7 @@ def square(x) do end Enum.map [1,2,3], function(:square, 1) +#=> [1, 4, 9] {% endhighlight %} ### Partials in Elixir From 01df9e97a2e3787e4ac80902c2bcd8cfd3b61e03 Mon Sep 17 00:00:00 2001 From: Mike Pack Date: Tue, 27 Nov 2012 23:16:00 -0700 Subject: [PATCH 295/437] Fix typo --- getting_started/3.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/getting_started/3.markdown b/getting_started/3.markdown index a20ff8b23..524ce3b69 100644 --- a/getting_started/3.markdown +++ b/getting_started/3.markdown @@ -182,7 +182,7 @@ Then, we add the head of the list to the accumulator `h + acc` and call `sum_lis sum_list [3], 3 sum_list [], 6 -When the list is empty, it will match the final clause which returns the final result of `6`. In imperative languages, such implementation would usually fail for large lists because the stack (in which our execution path is kept) would grown until it reaches a limit. Erlang, however, does last call optimization in which the stack does not grow when a function exits by calling another function. +When the list is empty, it will match the final clause which returns the final result of `6`. In imperative languages, such implementation would usually fail for large lists because the stack (in which our execution path is kept) would grow until it reaches a limit. Erlang, however, does last call optimization in which the stack does not grow when a function exits by calling another function. Recursion and last call optimization are an important part of Erlang and are commonly used to create loops, especially in cases where a process needs to wait and respond to messages (using the `receive` macro we saw in the previous chapter). However, recursion as above is rarely used to manipulate lists, since [the `Enum` module](/docs/stable/Enum.html) already abstracts such use cases. For instance, the example above could be simply written as: From 5c4ab0234616095f42ce3034839b9091ce1501d7 Mon Sep 17 00:00:00 2001 From: Mike Pack Date: Tue, 27 Nov 2012 23:37:11 -0700 Subject: [PATCH 296/437] Fix link --- getting_started/3.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/getting_started/3.markdown b/getting_started/3.markdown index a20ff8b23..24534e846 100644 --- a/getting_started/3.markdown +++ b/getting_started/3.markdown @@ -314,7 +314,7 @@ In addition to the built-in attributes outlined above, customer attributes may a IO.inspect @my_data #=> 13 end -Unlike Erlang, user defined attributes are not stored in the module by default since it is common in Elixir to use such attributes to store temporary data. A developer can configure an attribute to behave closer to Erlang by calling [`Module.register_attribute/2`](/docs/stable/Module.html#register_attribute/2). +Unlike Erlang, user defined attributes are not stored in the module by default since it is common in Elixir to use such attributes to store temporary data. A developer can configure an attribute to behave closer to Erlang by calling [`Module.register_attribute/3`](/docs/stable/Module.html#register_attribute/3). Finally, notice that attributes can also be read inside functions: From 19295b18728eff3c71214f5cb15dac45bb6505e1 Mon Sep 17 00:00:00 2001 From: Mike Pack Date: Tue, 27 Nov 2012 23:45:10 -0700 Subject: [PATCH 297/437] Fix index nav --- getting_started/4.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/getting_started/4.markdown b/getting_started/4.markdown index 59c24fab7..01084ec0c 100644 --- a/getting_started/4.markdown +++ b/getting_started/4.markdown @@ -1,6 +1,6 @@ --- layout: getting_started -title: 4. Protocols & Records +title: 4. Records & Protocols guide: 4 --- From e26ecdcd6850036af911d3122af8a7e0f641fb33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sat, 1 Dec 2012 10:55:08 +0100 Subject: [PATCH 298/437] Update records chapter --- getting_started/4.markdown | 65 +++++--------------------------------- 1 file changed, 8 insertions(+), 57 deletions(-) diff --git a/getting_started/4.markdown b/getting_started/4.markdown index 01084ec0c..18428be68 100644 --- a/getting_started/4.markdown +++ b/getting_started/4.markdown @@ -12,26 +12,25 @@ Elixir provides both records and protocols. This chapter will outline the main f Records are simple structures that hold values. For example, we can define a `FileInfo` record that is supposed to store information about files as follows: - defrecord FileInfo, atime: nil, mtime: nil, accesses: 0 + defrecord FileInfo, atime: nil, accesses: 0 -The line above defines a module named `FileInfo` which contains a function named `new` (that returns a new record) and other functions to read and set the values in the record. Therefore, we can do: +The line above will define a module named `FileInfo` which contains a function named `new` that returns a new record and other functions to read and set the values in the record: file_info = FileInfo.new(atime: { 2010, 4, 17 }) file_info.atime #=> Returns the value of atime file_info.atime({ 2012, 10, 13 }) #=> Updates the value of atime -Elixir will also define an `update_#{field}` function that accepts a function of one argument. When we invoke the update function, it calls the function we have provided, passing it the current value of the field and updating the field with the value returned from our function: +A record is simply a tuple where the first element is the record module name. We can get the record raw representation as follow: + + inspect FileInfo.new, raw: true + #=> "{ FileInfo, nil, nil }" + +Besides defining readers and writers for each attribute, Elixir also defines an `update_#{attribute}` function to update the value. Such functions expect a function as argument that receives the current value and must return the new one. For example, every time the file is accessed, the accesses counter can be incremented with: file_info = FileInfo.new(accesses: 10) file_info = file_info.update_accesses(fn(x) -> x + 1 end) file_info.accesses #=> 11 -Internally, a record is simply a tuple where the first element is always the record module name. In Interactive Elixir (`iex`) (or using IO.inspect), we can get all of the fields of a record: - - iex> defrecord FileInfo, atime: nil, mtime: nil - iex> FileInfo.new - FileInfo[atime: nil, mtime: nil] - ### 4.1.1 Pattern matching Elixir also allows one to pattern match against records. For example, imagine we want to check if a file was accessed or not based on the `FileInfo` record above, we could implement it as follow: @@ -49,54 +48,6 @@ This syntax can also be used to create new records: As we are going to see in the next section (4.2), this "brackets syntax" is powered by the access protocol and, in the records case, it is handled at compilation time which provides faster access and creation times compared to `file_info.accesses` and `FileInfo.new`. -### 4.1.2 Default based functions - -Depending on the default value, Elixir will define helpers to interact with the record. For example, the test framework that ships with Elixir, called ExUnit, defines a record which keeps track of how many tests were executed and the failures that happened. The record definition is similar to: - - iex> defrecord Config, counter: 0, failures: [] - -Since `counter` is an integer, Elixir automatically defines a helper named `increment_counter` that will increase the counter value: - - iex> new_config = Config.new.increment_counter - Config[counter: 1, failures: []] - iex> new_config.counter - 1 - -`increment_counter` also accepts a number to increment as argument: - - iex> new_config = Config.new.increment_counter 10 - Config[counter: 10, failures: []] - iex> new_config.counter - 10 - -On the other hand if the default value is a list Elixir will define the two following helpers: - -* `prepend_field` - Receives another list and prepends its values -* `merge_field` - Receives a keywords list and merges it into the current value; - -Keep in mind that records (as any other data structure) in Elixir are immutable. Every time you update a record's field, a new record is returned with the corresponding field updated. For example: - - iex> new_config = Config.new - Config[counter: 0, failures: []] - iex> new_config.counter - 0 - iex> new_config.increment_counter - Config[counter: 1, []] - -Notice how `increment_counter` returned not simply an updated value of the `counter` field, but a whole new record which has its `counter` field set to the old value plus one. What will happen if we call `increment_counter` multiple times? - - iex> new_config.increment_counter - Config[counter: 1, failures: []] - iex> new_config.increment_counter - Config[counter: 1, failures: []] - -Since `new_config` remains unchanged, we get a new record with the `counter` field's value set to `1` every time we call `increment_counter`. In order to keep the new record, we need to assign it to a variable: - - iex> new_config = new_config.increment_counter - Config[counter: 1, failures: []] - iex> new_config.increment_counter - Config[counter: 2, failures: []] - For more information on records, [check out the documentation for the `defrecord` macro](http://elixir-lang.org/docs/master/Kernel.html#defrecord/4) ## 4.2 Protocols From a965b8026ae2db19e0644f1cdeb8763d71dbe4cf Mon Sep 17 00:00:00 2001 From: Yurii Rashkovskii Date: Sat, 1 Dec 2012 14:38:13 -0800 Subject: [PATCH 299/437] Update _includes/important-links.html --- _includes/important-links.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_includes/important-links.html b/_includes/important-links.html index 177d0beff..dd20a8a4e 100644 --- a/_includes/important-links.html +++ b/_includes/important-links.html @@ -7,6 +7,6 @@

      Important Links

    2555. Issues Tracker
    2556. Textmate Bundle
    2557. Vim Elixir
    2558. -
    2559. Crash Course for Erlang developers
    2560. +
    2561. Crash Course for Erlang developers
    2562. From a1ff76adad5b34e2ce1d86497a99a4bd2a72fa95 Mon Sep 17 00:00:00 2001 From: Robert Malko Date: Sun, 2 Dec 2012 07:06:04 -0500 Subject: [PATCH 300/437] Crash-course Anonymous Functions fixes --- crash-course.markdown | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crash-course.markdown b/crash-course.markdown index 925d7f3fc..65ee8e305 100644 --- a/crash-course.markdown +++ b/crash-course.markdown @@ -588,11 +588,11 @@ Anonymous functions are defined in the following way: **Erlang** {% highlight erlang %} -Sum = fun(a, b) -> a + b end. +Sum = fun(A, B) -> A + B end. Sum(4, 3). %=> 7 -Square = fun(x) -> x * x end. +Square = fun(X) -> X * X end. lists:map(Square, [1, 2, 3, 4]). %=> [1, 4, 9, 16] {% endhighlight %} @@ -601,7 +601,7 @@ lists:map(Square, [1, 2, 3, 4]). {% highlight ruby %} sum = fn(a, b) -> a + b end -sum 4, 3 +sum.(4, 3) #=> 7 square = fn(x) -> x * x end From 4d695cadd49beec65475a824649861ce11031955 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Mon, 3 Dec 2012 18:20:59 +0100 Subject: [PATCH 301/437] Remove OrdDict files to force git to pick up new name --- docs/master/Orddict.html | 118 --------------------------------------- docs/stable/Orddict.html | 118 --------------------------------------- 2 files changed, 236 deletions(-) delete mode 100644 docs/master/Orddict.html delete mode 100644 docs/stable/Orddict.html diff --git a/docs/master/Orddict.html b/docs/master/Orddict.html deleted file mode 100644 index e0f10ee22..000000000 --- a/docs/master/Orddict.html +++ /dev/null @@ -1,118 +0,0 @@ - - - - OrdDict - - - - - - - - - - - - -
      -

      - OrdDict - -

      - - -
      -

      This module implements a dictionary type that stores items -as a list of tuples. It is a simple wrapper around -Erlang's orddict module -and exposed via the Dict module.

      - -

      Check the Dict module for examples and documentation.

      - -
      - - - Source - - - - - - -

      Functions summary

      - - - - - - - - -
      -

      Functions

      -
      -

      - new() -

      -

      Creates a new empty dict.

      -
      - Source -
      -

      - new(pairs) -

      -

      Creates a new dict from a list of pairs.

      - -

      Examples

      - -
      OrdDict.new [{:b,1},{:a,2}]
      -#=> [a: 1, b: 2]
      -
      -
      - Source -
      -

      - new(list, transform) -

      -

      Creates a new dict from a list of elements with the -help of the transformation function.

      - -

      Examples

      - -
      OrdDict.new ["a", "b"], fn x -> {x, x} end
      -#=> ["a": "a", "b": "b"]
      -
      -
      - Source -
      -
      - - - - - -
      - - diff --git a/docs/stable/Orddict.html b/docs/stable/Orddict.html deleted file mode 100644 index e0f10ee22..000000000 --- a/docs/stable/Orddict.html +++ /dev/null @@ -1,118 +0,0 @@ - - - - OrdDict - - - - - - - - - - - - -
      -

      - OrdDict - -

      - - -
      -

      This module implements a dictionary type that stores items -as a list of tuples. It is a simple wrapper around -Erlang's orddict module -and exposed via the Dict module.

      - -

      Check the Dict module for examples and documentation.

      - -
      - - - Source - - - - - - -

      Functions summary

      - - - - - - - - -
      -

      Functions

      -
      -

      - new() -

      -

      Creates a new empty dict.

      -
      - Source -
      -

      - new(pairs) -

      -

      Creates a new dict from a list of pairs.

      - -

      Examples

      - -
      OrdDict.new [{:b,1},{:a,2}]
      -#=> [a: 1, b: 2]
      -
      -
      - Source -
      -

      - new(list, transform) -

      -

      Creates a new dict from a list of elements with the -help of the transformation function.

      - -

      Examples

      - -
      OrdDict.new ["a", "b"], fn x -> {x, x} end
      -#=> ["a": "a", "b": "b"]
      -
      -
      - Source -
      -
      - - - - - -
      - - From 7daae2d6b437bbadb1aead3eb0768f5f5d1cf6ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Mon, 3 Dec 2012 18:23:58 +0100 Subject: [PATCH 302/437] Add OrdDict files with proper casing --- docs/master/OrdDict.html | 118 +++++++++++++++++++++++++++++++++++++++ docs/stable/OrdDict.html | 118 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 236 insertions(+) create mode 100644 docs/master/OrdDict.html create mode 100644 docs/stable/OrdDict.html diff --git a/docs/master/OrdDict.html b/docs/master/OrdDict.html new file mode 100644 index 000000000..e0f10ee22 --- /dev/null +++ b/docs/master/OrdDict.html @@ -0,0 +1,118 @@ + + + + OrdDict + + + + + + + + + + + + +
      +

      + OrdDict + +

      + + +
      +

      This module implements a dictionary type that stores items +as a list of tuples. It is a simple wrapper around +Erlang's orddict module +and exposed via the Dict module.

      + +

      Check the Dict module for examples and documentation.

      + +
      + + + Source + + + + + + +

      Functions summary

      + + + + + + + + +
      +

      Functions

      +
      +

      + new() +

      +

      Creates a new empty dict.

      +
      + Source +
      +

      + new(pairs) +

      +

      Creates a new dict from a list of pairs.

      + +

      Examples

      + +
      OrdDict.new [{:b,1},{:a,2}]
      +#=> [a: 1, b: 2]
      +
      +
      + Source +
      +

      + new(list, transform) +

      +

      Creates a new dict from a list of elements with the +help of the transformation function.

      + +

      Examples

      + +
      OrdDict.new ["a", "b"], fn x -> {x, x} end
      +#=> ["a": "a", "b": "b"]
      +
      +
      + Source +
      +
      + + + + + +
      + + diff --git a/docs/stable/OrdDict.html b/docs/stable/OrdDict.html new file mode 100644 index 000000000..e0f10ee22 --- /dev/null +++ b/docs/stable/OrdDict.html @@ -0,0 +1,118 @@ + + + + OrdDict + + + + + + + + + + + + +
      +

      + OrdDict + +

      + + +
      +

      This module implements a dictionary type that stores items +as a list of tuples. It is a simple wrapper around +Erlang's orddict module +and exposed via the Dict module.

      + +

      Check the Dict module for examples and documentation.

      + +
      + + + Source + + + + + + +

      Functions summary

      + + + + + + + + +
      +

      Functions

      +
      +

      + new() +

      +

      Creates a new empty dict.

      +
      + Source +
      +

      + new(pairs) +

      +

      Creates a new dict from a list of pairs.

      + +

      Examples

      + +
      OrdDict.new [{:b,1},{:a,2}]
      +#=> [a: 1, b: 2]
      +
      +
      + Source +
      +

      + new(list, transform) +

      +

      Creates a new dict from a list of elements with the +help of the transformation function.

      + +

      Examples

      + +
      OrdDict.new ["a", "b"], fn x -> {x, x} end
      +#=> ["a": "a", "b": "b"]
      +
      +
      + Source +
      +
      + + + + + +
      + + From fd0e12260df5de659062e4b27c10dd3b4c0a967a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Tue, 4 Dec 2012 13:50:46 +0100 Subject: [PATCH 303/437] Have a better Erlang sample --- index.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index fe9ef380f..bd0ad7bd1 100644 --- a/index.html +++ b/index.html @@ -153,7 +153,9 @@

      Erlang all the way down

      After all, Elixir is still Erlang. An Elixir programmer can invoke any Erlang function with no runtime cost:

      {% highlight ruby %} -:lists.flatten([1,[2],3]) #=> [1,2,3] +:application.start(:crypto) +:crypto.md5("Using crypto from Erlang OTP") +#=> <<192,223,75,115,...>> {% endhighlight %}

      Since Elixir generates the same bytecode, Elixir is fully OTP compliant and doesn't try to break any of those battle-field tested techniques Erlang is familiar for. Erlang type specifications, behaviors and module attributes are all supported. It is easy to add Elixir to your existing Erlang programs too (including rebar support)! From c3d5da5c646490ac87dd1c3f6f0a3717b1dab58c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Tue, 4 Dec 2012 13:52:42 +0100 Subject: [PATCH 304/437] Do not escape < and > on highlight --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index bd0ad7bd1..a10a4d03a 100644 --- a/index.html +++ b/index.html @@ -155,7 +155,7 @@

      Erlang all the way down

      {% highlight ruby %} :application.start(:crypto) :crypto.md5("Using crypto from Erlang OTP") -#=> <<192,223,75,115,...>> +#=> <<192,223,75,115,...>> {% endhighlight %}

      Since Elixir generates the same bytecode, Elixir is fully OTP compliant and doesn't try to break any of those battle-field tested techniques Erlang is familiar for. Erlang type specifications, behaviors and module attributes are all supported. It is easy to add Elixir to your existing Erlang programs too (including rebar support)! From fc7f55cde7a97a3f48ceb3b9978a7bdb149d4333 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Tue, 4 Dec 2012 20:04:28 +0100 Subject: [PATCH 305/437] Update to v0.7.2 --- docs/master/ArgumentError.html | 20 +- docs/master/ArithmeticError.html | 20 +- docs/master/BadArityError.html | 28 +-- docs/master/BadFunctionError.html | 22 +- docs/master/Behaviour.html | 15 +- docs/master/CaseClauseError.html | 22 +- docs/master/CompileError.html | 34 +-- docs/master/Enum.Iterator.Function.html | 2 +- docs/master/Enum.Iterator.List.html | 2 +- docs/master/Enum.OutOfBoundsError.html | 20 +- docs/master/Enum.html | 132 ++++++---- docs/master/ErlangError.html | 22 +- docs/master/ExUnit.Assertions.html | 24 +- docs/master/ExUnit.html | 18 +- docs/master/Exception.html | 20 +- docs/master/File.html | 71 ++++-- docs/master/FunctionClauseError.html | 34 +-- docs/master/IEx.Helpers.html | 92 +++---- docs/master/IEx.html | 92 ++----- docs/master/Kernel.CLI.html | 93 +++++++ docs/master/Kernel.SpecialForms.html | 4 +- docs/master/Kernel.Typespec.html | 137 +++++++--- docs/master/Kernel.html | 307 ++++++++++++++--------- docs/master/KeyError.html | 22 +- docs/master/List.html | 87 +------ docs/master/Macro.html | 53 +++- docs/master/MatchError.html | 22 +- docs/master/Mix.Error.html | 50 ++++ docs/master/Mix.InvalidTaskError.html | 50 ++++ docs/master/Mix.NoProjectError.html | 50 ++++ docs/master/Mix.NoTaskError.html | 50 ++++ docs/master/Mix.OutOfDateDepsError.html | 72 +++++- docs/master/Mix.Shell.IO.html | 19 +- docs/master/Mix.Shell.Process.html | 23 +- docs/master/Mix.Shell.html | 23 ++ docs/master/Mix.Tasks.Run.html | 10 +- docs/master/Module.html | 40 +-- docs/master/Protocol.UndefinedError.html | 28 +-- docs/master/Record.html | 8 +- docs/master/Regex.html | 2 +- docs/master/RuntimeError.html | 20 +- docs/master/String.html | 107 +++++--- docs/master/SyntaxError.html | 34 +-- docs/master/System.html | 26 +- docs/master/SystemLimitError.html | 20 +- docs/master/TokenMissingError.html | 34 +-- docs/master/URI.html | 4 +- docs/master/UndefinedFunctionError.html | 34 +-- docs/master/modules_list.html | 224 +++++++++++------ docs/master/protocols_list.html | 2 +- docs/master/records_list.html | 142 ++++++++++- docs/stable/ArgumentError.html | 20 +- docs/stable/ArithmeticError.html | 20 +- docs/stable/BadArityError.html | 28 +-- docs/stable/BadFunctionError.html | 22 +- docs/stable/Behaviour.html | 15 +- docs/stable/CaseClauseError.html | 22 +- docs/stable/CompileError.html | 34 +-- docs/stable/Enum.Iterator.Function.html | 2 +- docs/stable/Enum.Iterator.List.html | 2 +- docs/stable/Enum.OutOfBoundsError.html | 20 +- docs/stable/Enum.html | 132 ++++++---- docs/stable/ErlangError.html | 22 +- docs/stable/ExUnit.Assertions.html | 24 +- docs/stable/ExUnit.html | 18 +- docs/stable/Exception.html | 20 +- docs/stable/File.html | 71 ++++-- docs/stable/FunctionClauseError.html | 34 +-- docs/stable/IEx.Helpers.html | 92 +++---- docs/stable/IEx.html | 92 ++----- docs/stable/Kernel.CLI.html | 93 +++++++ docs/stable/Kernel.SpecialForms.html | 4 +- docs/stable/Kernel.Typespec.html | 137 +++++++--- docs/stable/Kernel.html | 307 ++++++++++++++--------- docs/stable/KeyError.html | 22 +- docs/stable/List.html | 87 +------ docs/stable/Macro.html | 53 +++- docs/stable/MatchError.html | 22 +- docs/stable/Mix.Error.html | 50 ++++ docs/stable/Mix.InvalidTaskError.html | 50 ++++ docs/stable/Mix.NoProjectError.html | 50 ++++ docs/stable/Mix.NoTaskError.html | 50 ++++ docs/stable/Mix.OutOfDateDepsError.html | 72 +++++- docs/stable/Mix.Shell.IO.html | 19 +- docs/stable/Mix.Shell.Process.html | 23 +- docs/stable/Mix.Shell.html | 23 ++ docs/stable/Mix.Tasks.Run.html | 10 +- docs/stable/Module.html | 40 +-- docs/stable/Protocol.UndefinedError.html | 28 +-- docs/stable/Record.html | 8 +- docs/stable/Regex.html | 2 +- docs/stable/RuntimeError.html | 20 +- docs/stable/String.html | 107 +++++--- docs/stable/SyntaxError.html | 34 +-- docs/stable/System.html | 26 +- docs/stable/SystemLimitError.html | 20 +- docs/stable/TokenMissingError.html | 34 +-- docs/stable/URI.html | 4 +- docs/stable/UndefinedFunctionError.html | 34 +-- docs/stable/modules_list.html | 224 +++++++++++------ docs/stable/protocols_list.html | 2 +- docs/stable/records_list.html | 142 ++++++++++- 102 files changed, 3276 insertions(+), 1698 deletions(-) create mode 100644 docs/master/Kernel.CLI.html create mode 100644 docs/stable/Kernel.CLI.html diff --git a/docs/master/ArgumentError.html b/docs/master/ArgumentError.html index 99da265b4..ff6dd3be4 100644 --- a/docs/master/ArgumentError.html +++ b/docs/master/ArgumentError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -110,55 +110,55 @@

      Functions

      exception(args)

      - Source + Source

      exception(args, self)

      - Source + Source

      message(record)

      - Source + Source

      message(value, record)

      - Source + Source

      new()

      - Source + Source

      new(opts)

      - Source + Source

      to_keywords(record)

      - Source + Source

      update(keywords, record)

      - Source + Source

      update_message(function, record)

      - Source + Source
      diff --git a/docs/master/ArithmeticError.html b/docs/master/ArithmeticError.html index 8be9f9383..1da22ab13 100644 --- a/docs/master/ArithmeticError.html +++ b/docs/master/ArithmeticError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -110,55 +110,55 @@

      Functions

      exception(args)

      - Source + Source

      exception(args, self)

      - Source + Source

      message(record)

      - Source + Source

      message(value, record)

      - Source + Source

      new()

      - Source + Source

      new(opts)

      - Source + Source

      to_keywords(record)

      - Source + Source

      update(keywords, record)

      - Source + Source

      update_message(function, record)

      - Source + Source
      diff --git a/docs/master/BadArityError.html b/docs/master/BadArityError.html index 768e24227..4d4bdacd8 100644 --- a/docs/master/BadArityError.html +++ b/docs/master/BadArityError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -136,79 +136,79 @@

      Functions

      args(record)

      - Source + Source

      args(value, record)

      - Source + Source

      exception(args)

      - Source + Source

      exception(args, self)

      - Source + Source

      function(record)

      - Source + Source

      function(value, record)

      - Source + Source

      message(exception)

      - Source + Source

      new()

      - Source + Source

      new(opts)

      - Source + Source

      to_keywords(record)

      - Source + Source

      update(keywords, record)

      - Source + Source

      update_args(function, record)

      - Source + Source

      update_function(function, record)

      - Source + Source
      diff --git a/docs/master/BadFunctionError.html b/docs/master/BadFunctionError.html index 5c40a2c5d..24ffc5af2 100644 --- a/docs/master/BadFunctionError.html +++ b/docs/master/BadFunctionError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -115,61 +115,61 @@

      Functions

      actual(record)

      - Source + Source

      actual(value, record)

      - Source + Source

      exception(args)

      - Source + Source

      exception(args, self)

      - Source + Source

      message(exception)

      - Source + Source

      new()

      - Source + Source

      new(opts)

      - Source + Source

      to_keywords(record)

      - Source + Source

      update(keywords, record)

      - Source + Source

      update_actual(function, record)

      - Source + Source
      diff --git a/docs/master/Behaviour.html b/docs/master/Behaviour.html index c20e5907e..a42786017 100644 --- a/docs/master/Behaviour.html +++ b/docs/master/Behaviour.html @@ -39,10 +39,10 @@

      use Behaviour @doc "Parses the given URL" - defcallback parse(uri_info :: URI.Info.t), do: URI.Info.t + defcallback parse(uri_info :: URI.Info.t) :: URI.Info.t @doc "Defines a default port" - defcallback default_port(), do: integer + defcallback default_port() :: integer end @@ -85,6 +85,11 @@

      Implementation

      Macros summary

      • + + defcallback/1 + +
      • +
      • defcallback/2 @@ -101,6 +106,12 @@

        Macros summary

        Macros

        +

        + defcallback(fun) +

        +
        + Source +

        defcallback(fun, list2)

        diff --git a/docs/master/CaseClauseError.html b/docs/master/CaseClauseError.html index 127001e4e..d45ae69ac 100644 --- a/docs/master/CaseClauseError.html +++ b/docs/master/CaseClauseError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -115,61 +115,61 @@

        Functions

        actual(record)

        - Source + Source

        actual(value, record)

        - Source + Source

        exception(args)

        - Source + Source

        exception(args, self)

        - Source + Source

        message(exception)

        - Source + Source

        new()

        - Source + Source

        new(opts)

        - Source + Source

        to_keywords(record)

        - Source + Source

        update(keywords, record)

        - Source + Source

        update_actual(function, record)

        - Source + Source
        diff --git a/docs/master/CompileError.html b/docs/master/CompileError.html index f0d7b502c..64bbb0eab 100644 --- a/docs/master/CompileError.html +++ b/docs/master/CompileError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -157,97 +157,97 @@

        Functions

        description(record)

        - Source + Source

        description(value, record)

        - Source + Source

        exception(args)

        - Source + Source

        exception(args, self)

        - Source + Source

        file(record)

        - Source + Source

        file(value, record)

        - Source + Source

        line(record)

        - Source + Source

        line(value, record)

        - Source + Source

        message(exception)

        - Source + Source

        new()

        - Source + Source

        new(opts)

        - Source + Source

        to_keywords(record)

        - Source + Source

        update(keywords, record)

        - Source + Source

        update_description(function, record)

        - Source + Source

        update_file(function, record)

        - Source + Source

        update_line(function, record)

        - Source + Source
        diff --git a/docs/master/Enum.Iterator.Function.html b/docs/master/Enum.Iterator.Function.html index 29c254865..60fee1252 100644 --- a/docs/master/Enum.Iterator.Function.html +++ b/docs/master/Enum.Iterator.Function.html @@ -29,7 +29,7 @@

        - Source + Source diff --git a/docs/master/Enum.Iterator.List.html b/docs/master/Enum.Iterator.List.html index 2c3a4cd46..2512817e3 100644 --- a/docs/master/Enum.Iterator.List.html +++ b/docs/master/Enum.Iterator.List.html @@ -29,7 +29,7 @@

        - Source + Source diff --git a/docs/master/Enum.OutOfBoundsError.html b/docs/master/Enum.OutOfBoundsError.html index b0d788706..449c27827 100644 --- a/docs/master/Enum.OutOfBoundsError.html +++ b/docs/master/Enum.OutOfBoundsError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -110,55 +110,55 @@

        Functions

        exception(args)

        - Source + Source

        exception(args, self)

        - Source + Source

        message(record)

        - Source + Source

        message(value, record)

        - Source + Source

        new()

        - Source + Source

        new(opts)

        - Source + Source

        to_keywords(record)

        - Source + Source

        update(keywords, record)

        - Source + Source

        update_message(function, record)

        - Source + Source
        diff --git a/docs/master/Enum.html b/docs/master/Enum.html index 2e3b6006b..53044e9ad 100644 --- a/docs/master/Enum.html +++ b/docs/master/Enum.html @@ -153,17 +153,22 @@

        Functions summary

      • - qsort/1 + reduce/3
      • - reduce/3 + reverse/1
      • - reverse/1 + sort/1 + +
      • +
      • + + sort/2
      • @@ -186,6 +191,11 @@

        Functions summary

        take_while/2
      • +
      • + + uniq/1 + +
      • zip/2 @@ -204,9 +214,7 @@

        Functions summary

        Functions

        - all?(collection, fun // fn x -> - x -end) + all?(collection, fun // fn x -> x end)

        Invokes the given fun for each item in the collection and returns true if each invocation returns true as well, otherwise it short-circuits and returns @@ -231,9 +239,7 @@

        Examples

        Source

        - any?(collection, fun // fn x -> - x -end) + any?(collection, fun // fn x -> x end)

        Invokes the given fun for each item in the collection and returns true if at least one invocation returns true. Returns false otherwise.

        @@ -296,8 +302,8 @@

        Examples

        drop(collection, count)

        -

        Drops the first count items from the collection. Expects an ordered -collection.

        +

        Drops the first count items from the collection. +Expects an ordered collection.

        Examples

        @@ -320,7 +326,7 @@

        Examples

        #=> [3,4,5]
        - Source + Source

        each(collection, fun) @@ -333,7 +339,7 @@

        Examples

        Enum.each ['some', 'example'], fn(x) -> IO.puts x end
         
        - Source + Source

        empty?(collection) @@ -346,7 +352,7 @@

        Examples

        Enum.empty? [1,2,3] #=> false
        - Source + Source

        filter(collection, fun) @@ -360,7 +366,7 @@

        Examples

        #=> [2]
        - Source + Source

        filter_map(collection, filter, mapper) @@ -373,7 +379,7 @@

        Examples

        #=> [4]
        - Source + Source

        find(collection, ifnone // nil, fun) @@ -393,7 +399,7 @@

        Examples

        #=> 3
        - Source + Source

        find_index(collection, fun) @@ -412,7 +418,7 @@

        Examples

        #=> 2
        - Source + Source

        find_value(collection, ifnone // nil, fun) @@ -429,7 +435,7 @@

        Examples

        #=> true
        - Source + Source

        first(collection) @@ -442,7 +448,7 @@

        Examples

        Enum.first [1,2,3] #=> 1
        - Source + Source

        join(collection, joiner // "") @@ -463,7 +469,7 @@

        Examples

        Enum.join([1,2,3], ' = ') #=> '1 = 2 = 3'
        - Source + Source

        map(collection, fun) @@ -481,7 +487,7 @@

        Examples

        #=> [a: -1, b: -2]
        - Source + Source

        map_join(collection, joiner // "", mapper) @@ -502,7 +508,7 @@

        Examples

        Enum.map_join([1,2,3], ' = ', &1 * 2) #=> '2 = 4 = 6'
        - Source + Source

        map_reduce(collection, acc, f) @@ -521,7 +527,7 @@

        Examples

        #=> { [2, 4, 6], 6 }
        - Source + Source

        partition(collection, fun) @@ -536,19 +542,7 @@

        Examples

        #=> { [2], [1,3] }
        - Source -
        -

        - qsort(collection) -

        -

        Sorts the collection according to the quick sort algorithm.

        - -

        Examples

        - -
        Enum.qsort [3,2,1] #=> [1,2,3]
        -
        -
        - Source + Source

        reduce(collection, acc, fun) @@ -563,7 +557,7 @@

        Examples

        #=> 6
        - Source + Source

        reverse(collection) @@ -576,16 +570,43 @@

        Examples

        #=> [3, 2, 1]
        - Source + Source +
        +

        + sort(collection) +

        +

        Sorts the collection using the merge sort algorithm.

        + +

        Examples

        + +
        Enum.sort [3,2,1] #=> [1,2,3]
        +
        +
        + Source +
        +

        + sort(collection, fun) +

        +

        Sorts the collection using the merge sort algorithm.

        + +

        Examples

        + +
        Enum.sort [3,2,1], &1 > &2 #=> [1,2,3]
        +
        +
        + Source

        split(collection, count)

        -

        Splits the enumerable into two collections, leaving count elements in the -first one. If count is a negative number, it starts couting from the back -to the beginning of the collection. Be aware that a negative count -implies in an iteration through the whole collection. -Expects an ordered collection.

        +

        Splits the enumerable into two collections, leaving count +elements in the first one. If count is a negative number, +it starts couting from the back to the beginning of the +collection.

        + +

        Be aware that a negative count implies the collection +will be iterate twice. One to calculate the position and +another one to do the actual splitting.

        Examples

        @@ -596,7 +617,7 @@

        Examples

        Enum.split [1,2,3], -5 #=> { [], [1,2,3] }
        - Source + Source

        split_while(collection, fun) @@ -610,7 +631,7 @@

        Examples

        #=> { [1], [2, 3, 4] }
        - Source + Source

        take(collection, count) @@ -625,7 +646,7 @@

        Examples

        Enum.take [1,2,3], 0 #=> []
        - Source + Source

        take_while(collection, fun) @@ -639,7 +660,20 @@

        Examples

        #=> [1, 2]
        - Source + Source +
        +

        + uniq(collection) +

        +

        Iterates the enumerable removing all duplicated items.

        + +

        Examples

        + +
        Enum.uniq [1,2,3,2,1]
        +#=> [1, 2, 3]
        +
        +
        + Source

        zip(coll1, coll2) @@ -649,7 +683,7 @@

        Examples

        dictated by the first enum. In case the second list is shorter, values are filled with nil.

        - Source + Source diff --git a/docs/master/ErlangError.html b/docs/master/ErlangError.html index 19e722328..9e35e5f11 100644 --- a/docs/master/ErlangError.html +++ b/docs/master/ErlangError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -115,61 +115,61 @@

        Functions

        exception(args)

        - Source + Source

        exception(args, self)

        - Source + Source

        message(exception)

        - Source + Source

        new()

        - Source + Source

        new(opts)

        - Source + Source

        original(record)

        - Source + Source

        original(value, record)

        - Source + Source

        to_keywords(record)

        - Source + Source

        update(keywords, record)

        - Source + Source

        update_original(function, record)

        - Source + Source
        diff --git a/docs/master/ExUnit.Assertions.html b/docs/master/ExUnit.Assertions.html index 344ccbefa..f78aff867 100644 --- a/docs/master/ExUnit.Assertions.html +++ b/docs/master/ExUnit.Assertions.html @@ -153,7 +153,7 @@

        Examples

        assert false, "it will never be true"
         
        - Source + Source

        assert_in_delta(expected, received, delta, message // nil) @@ -166,7 +166,7 @@

        Examples

        assert_in_delta 10, 15, 4
        - Source + Source

        assert_raise(exception, function) @@ -181,7 +181,7 @@

        Examples

        end
        - Source + Source

        assert_raise(exception, message, function) @@ -196,7 +196,7 @@

        Examples

        end
        - Source + Source

        flunk(message // "Epic Fail!") @@ -208,7 +208,7 @@

        Examples

        flunk "This should raise an error"
         
        - Source + Source

        refute(not_expected, message) @@ -221,7 +221,7 @@

        Examples

        refute true, "This will obviously fail"
         
        - Source + Source

        refute_in_delta(expected, received, delta, message // nil) @@ -234,7 +234,7 @@

        Examples

        refute_in_delta 10, 11, 2
        - Source + Source @@ -282,7 +282,7 @@

        Examples

        assert_received { :hello, _ } - Source + Source

        catch_error(expression) @@ -295,7 +295,7 @@

        Examples

        assert catch_error(error 1) == 1
         
        - Source + Source

        catch_exit(expression) @@ -308,7 +308,7 @@

        Examples

        assert catch_exit(exit 1) == 1
         
        - Source + Source

        catch_throw(expression) @@ -321,7 +321,7 @@

        Examples

        assert catch_throw(throw 1) == 1
         
        - Source + Source

        refute(expected) @@ -352,7 +352,7 @@

        Examples

        refute_received :bye
        - Source + Source diff --git a/docs/master/ExUnit.html b/docs/master/ExUnit.html index a351ff27d..24d2d817b 100644 --- a/docs/master/ExUnit.html +++ b/docs/master/ExUnit.html @@ -98,6 +98,11 @@

        Functions summary

        start/1
      • +
      • + + user_options/1 + +
      @@ -116,7 +121,7 @@

      Functions

      Register a callback to be invoked every time a new ExUnit process is spawned.

      - Source + Source

      configure(options) @@ -132,7 +137,7 @@

      Options

    2563. :max_cases - Maximum number of cases to run in parallel
    2564. - Source + Source

      run() @@ -140,7 +145,7 @@

      Options

      API used to run the tests. A developer does not need to call it directly.

      - Source + Source

      start(options // []) @@ -168,6 +173,13 @@

      User config example (~/.ex_unit.exs)

      [formatter: ExUnit.Formatter.ANSI]

      Source +
      +

      + user_options(user_config // nil) +

      +

      Returns the configured user options.

      +
      + Source
      diff --git a/docs/master/Exception.html b/docs/master/Exception.html index 98fc0b6a8..5bcbc93ab 100644 --- a/docs/master/Exception.html +++ b/docs/master/Exception.html @@ -43,6 +43,11 @@

      Functions summary

      • + + env_stacktrace/1 + +
      • +
      • format_file_line/1 @@ -79,20 +84,27 @@

        Functions summary

        Functions

        +

        + env_stacktrace(env) +

        +

        Returns a formatted stacktrace from the environment.

        +
        + Source +

        format_file_line(file_line)

        Formats file and line information present in stacktraces. Expect them to be given in a keyword list.

        - Source + Source

        format_file_line(file, line)

        Formats the given file and line.

        - Source + Source

        format_module_fun_arity(module, fun, arity) @@ -108,10 +120,10 @@

        Functions

        Formats each line in the stacktrace.

        - Source + Source

        - formatted_stacktrace(trace // System.stacktrace()) + formatted_stacktrace(trace // nil)

        Returns the stacktrace as a binary formatted as per format_stacktrace/1.

        diff --git a/docs/master/File.html b/docs/master/File.html index 6d223ea38..0b0d4f556 100644 --- a/docs/master/File.html +++ b/docs/master/File.html @@ -97,6 +97,21 @@

        Functions summary

        basename/2
      • +
      • + + biniterator/1 + +
      • +
      • + + biniterator/2 + +
      • +
      • + + biniterator!/2 + +
      • cd/1 @@ -413,6 +428,32 @@

        Examples

        Source +
        +

        + biniterator(device) +

        +

        Converts the file device into an iterator that can +be passed into Enum to iterate line by line as a +binary. Check iterator/1 for more information.

        +
        + Source +
        +

        + biniterator(file, mode) +

        +

        Opens the given file with the given mode and +returns its biniterator. Fails for the same reasons +as File.open.

        +
        + Source +
        +

        + biniterator!(file, mode // []) +

        +

        Same as biniterator/2 but raises if the file +cannot be opened.

        +
        + Source

        cd(path) @@ -481,9 +522,7 @@

        Examples

        Source

        - cp(source, destination, callback // fn _, _ -> - true -end) + cp(source, destination, callback // fn _, _ -> true end)

        Copies the contents in source to destination. Similar to the command cp -r in Unix systems, @@ -506,9 +545,7 @@

        Examples

        Source

        - cp!(source, destination, callback // fn _, _ -> - true -end) + cp!(source, destination, callback // fn _, _ -> true end)

        The same as cp/3, but raises File.CopyError if it fails. Returns the list of copied files otherwise.

        @@ -516,9 +553,7 @@

        Examples

        Source

        - cp_r(source, destination, callback // fn _, _ -> - true -end) + cp_r(source, destination, callback // fn _, _ -> true end)

        Copies the contents in source to destination. Similar to the command cp -r in Unix systems, @@ -568,9 +603,7 @@

        Examples

        Source

        - cp_r!(source, destination, callback // fn _, _ -> - true -end) + cp_r!(source, destination, callback // fn _, _ -> true end)

        The same as cp_r/3, but raises File.CopyError if it fails. Returns the list of copied files otherwise.

        @@ -693,10 +726,12 @@

        Examples

        iterator(device)

        -

        Convert the file device into an iterator that can be +

        Converts the file device into an iterator that can be passed into Enum. The device is iterated line -by line lazily, at the end of iteration the file is -closed.

        +by line, at the end of iteration the file is closed.

        + +

        This reads the file as utf-8. CHeck out File.biniterator +to handle the file as a raw binary.

        Examples

        @@ -712,7 +747,7 @@

        Examples

        end
        - Source + Source

        iterator(file, mode) @@ -721,7 +756,7 @@

        Examples

        returns its iterator. Fails for the same reasons as File.open.

        - Source + Source

        iterator!(file, mode // []) @@ -729,7 +764,7 @@

        Examples

        Same as iterator/2 but raises if the file cannot be opened.

        - Source + Source

        join(paths) diff --git a/docs/master/FunctionClauseError.html b/docs/master/FunctionClauseError.html index 558807f47..a8169c45e 100644 --- a/docs/master/FunctionClauseError.html +++ b/docs/master/FunctionClauseError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -157,97 +157,97 @@

        Functions

        arity(record)

        - Source + Source

        arity(value, record)

        - Source + Source

        exception(args)

        - Source + Source

        exception(args, self)

        - Source + Source

        function(record)

        - Source + Source

        function(value, record)

        - Source + Source

        message(exception)

        - Source + Source

        module(record)

        - Source + Source

        module(value, record)

        - Source + Source

        new()

        - Source + Source

        new(opts)

        - Source + Source

        to_keywords(record)

        - Source + Source

        update(keywords, record)

        - Source + Source

        update_arity(function, record)

        - Source + Source

        update_function(function, record)

        - Source + Source

        update_module(function, record)

        - Source + Source
        diff --git a/docs/master/IEx.Helpers.html b/docs/master/IEx.Helpers.html index 16e20fb2d..6826188c8 100644 --- a/docs/master/IEx.Helpers.html +++ b/docs/master/IEx.Helpers.html @@ -40,13 +40,15 @@

        • c/2 - compiles a file in the given path
        • -
        • h/0,h/1, h/2 - prints help/documentation
        • -
        • t/1, t/3 — prints type information
        • -
        • s/1, s/3 — prints spec information
        • +
        • h/0, h/1 - prints help/documentation
        • +
        • t/1 — prints type information
        • +
        • s/1 — prints spec information
        • m/0 - prints loaded modules
        • -
        • r/0 - recompiles and reloads the given module's source file
        • +
        • r/0, r/1 - recompiles and reloads the given module's source file
        • +
        • l/1 - loads given module beam code by purging the current version
        • v/0 - prints all commands and values
        • v/1 - retrieves nth value from console
        • +
        • flush/0 — flush all messages sent to the shell

        Help for functions in this module can be consulted @@ -81,17 +83,17 @@

        Functions summary

      • - h/0 + flush/0
      • - h/2 + h/0
      • - h/3 + l/1
      • @@ -109,11 +111,6 @@

        Functions summary

        r/1
      • -
      • - - s/3 - -
      • v/0 @@ -169,45 +166,35 @@

        Examples

        #=> Foo - Source + Source
        -

        - h() +

        + flush()

        -

        Shows the documentation for IEx.Helpers.

        +

        Flushes all messages sent to the shell and prints them out

        - Source + Source
        -

        - h(function, arity) +

        + h()

        -

        Prints the documentation for the given function and arity.

        - -

        The function may either be a function defined inside IEx.Helpers -or in Kernel. To see functions from other module, use -h/3 instead.

        - -

        Examples

        - -
        h(:h, 2)
        -#=> Prints documentation for this function
        -
        +

        Shows the documentation for IEx.Helpers.

        - Source + Source
        -

        - h(module, function, arity) +

        + l(module)

        -

        Shows the documentation for the function/arity in module.

        +

        Purges and reloads specified module

        - Source + Source

        m()

        Returns the name and module of all modules loaded.

        - Source + Source

        r() @@ -215,7 +202,7 @@

        Examples

        Reloads all modules that were already reloaded at some point with r/1.

        - Source + Source

        r(module) @@ -225,27 +212,14 @@

        Examples

        Please note that all the modules defined in the specified files are recompiled and reloaded.

        - Source -
        -

        - s(module, function, arity) -

        -

        Prints the specs for a given function.

        - -

        Examples

        - -
        s(Enum.all?/2)
        -s(Enum.t/0)
        -
        -
        - Source + Source

        v()

        Prints commands history and their result.

        - Source + Source

        v(n) @@ -254,7 +228,7 @@

        Examples

        values to lookup query's value from latest to earliest. For instance, v(-1) returns the latest result.

        - Source + Source
        @@ -280,9 +254,10 @@

        Examples

        h receive/1
         h Enum.all?/2
        +h Enum.all?
         
        - Source + Source

        s(module) @@ -292,9 +267,13 @@

        Examples

        Examples

        s(Enum)
        +s(Enum.all?)
        +s(Enum.all?/2)
        +s(list_to_atom)
        +s(list_to_atom/1)
         
        - Source + Source

        t(module) @@ -306,9 +285,10 @@

        Examples

        t(Enum)
         t(Enum.t/0)
        +t(Enum.t)
         
        - Source + Source diff --git a/docs/master/IEx.html b/docs/master/IEx.html index 1144a089b..e59273ac1 100644 --- a/docs/master/IEx.html +++ b/docs/master/IEx.html @@ -27,15 +27,18 @@

        -

        This module implements interactive Elixir. It provides a main -function, start which will either delegate to tty or simple. -The former is meant for systems where tty is available and relies -on it in order to work properly. This makes all control commands -available in tty available to the developer.

        +

        This module implements Interactive Elixir.

        -

        In case tty is not available (for example, Windows), a -developer may invoke simple which starts a stripped -down version.

        +

        The interactive elixir needs to be set as the +proper -user when starting the Erlang VM and +so can be done with the help of IEx.CLI.

        + +

        If possible, Elixir will start a tty (smart terminal) +which makes all control commands available in tty +available to the developer.

        + +

        In case tty is not available (for example, Windows), +a dumb terminal version is started instead.

        @@ -59,11 +62,6 @@

        Functions summary

        after_spawn/1
      • -
      • - - cli/0 - -
      • inspect_opts/0 @@ -76,22 +74,7 @@

        Functions summary

      • - preload/0 - -
      • -
      • - - run/1 - -
      • -
      • - - simple/1 - -
      • -
      • - - tty/1 + started?/0
      • @@ -111,68 +94,35 @@

        Functions

        Returns registered after spawn callbacks.

        - Source + Source

        after_spawn(fun)

        -

        Registers a function to be invoked after IEx -process is spawned. Requires IEx.preload to -be invoked.

        -
        - Source -
        -

        - cli() -

        -

        Interface to start IEx from CLI.

        +

        Registers a function to be invoked after IEx process is spawned.

        - Source + Source

        inspect_opts()

        Returns currently registered inspect options.

        - Source + Source

        inspect_opts(opts)

        Registers options used on inspect.

        - Source -
        -

        - preload() -

        -

        Simply loads IEx application. Most of the times it is -preloaded on demand, but if you want to pre-configure -IEx, you need to preload it.

        -
        - Source -
        -

        - run(opts // []) -

        -

        Runs IEx checking if tty is available or not. -If so, invoke tty, otherwise go with the simple iex.

        -
        - Source -
        -

        - simple(opts // []) -

        -

        Starts IEx simply using the current stdio.

        -
        - Source + Source
        -

        - tty(opts // []) +

        + started?()

        -

        Starts IEx using a tty server.

        +

        Returns true if IEx was properly started.

        - Source + Source
        diff --git a/docs/master/Kernel.CLI.html b/docs/master/Kernel.CLI.html new file mode 100644 index 000000000..aa4b3f9b3 --- /dev/null +++ b/docs/master/Kernel.CLI.html @@ -0,0 +1,93 @@ + + + + Kernel.CLI + + + + + + + + + + + + +
        +

        + Kernel.CLI + +

        + + +
        +

        Module responsible for controlling Elixir's CLI

        + +
        + + + Source + + + + + + +

        Functions summary

        + + + + + + + + +
        +

        Functions

        +
        +

        + run(fun, halt // true) +

        +

        Runs the given function by catching any failure +and printing them to stdout. at_exit hooks are +also invoked before exiting.

        + +

        This function is used by Elixir's CLI and also +by escripts generated by Elixir.

        +
        + Source +
        +

        + wait_until_finished() +

        +

        Wait until the CLI finishes procesing options.

        +
        + Source +
        +
        + + + + + +
        + + diff --git a/docs/master/Kernel.SpecialForms.html b/docs/master/Kernel.SpecialForms.html index eb539af75..76031fe6e 100644 --- a/docs/master/Kernel.SpecialForms.html +++ b/docs/master/Kernel.SpecialForms.html @@ -291,7 +291,7 @@

        Examples

        end -

        In the example above, we have set up MyOrdict to be alias +

        In the example above, we have set up MyKeyword to be alias as Keyword. So now, any reference to Keyword will be automatically replaced by MyKeyword.

        @@ -542,7 +542,7 @@

        Hygiene

        a = 10 NoHygiene.interference -a #=> 11 +a #=> 1

        Notice that aliases are not hygienic in Elixir, ambiguity diff --git a/docs/master/Kernel.Typespec.html b/docs/master/Kernel.Typespec.html index 8c1e96032..111ff35ad 100644 --- a/docs/master/Kernel.Typespec.html +++ b/docs/master/Kernel.Typespec.html @@ -33,6 +33,86 @@

        @callback available in modules are handled by the equivalent macros defined by this module.

        +

        Defining a type

        + +

        @type typename :: type +@typep typename :: type +@opaque type_name :: type

        + +

        For more details, see documentation for deftype, deftypep and defopaque in +Kernel.Typespec

        + +

        Defining a specification

        + +

        @spec functionname(type, type) :: type +@callback functionname(type, type) :: type

        + +

        For more details, see documentation for defspec and defcallback in +Kernel.Typespec

        + +

        Types

        + +

        The type syntax provided by Elixir is fairly similar to the one +in Erlang.

        + +

        Most of the built-in types provided in Erlang (for example, pid()) +are expressed the same way: pid() or simply pid. Parametrized types +are also supported: list(integer()) and so are remote types: Enum.t.

        + +

        Certain data type shortcuts ([...], <<>> and {...}) are supported as well.

        + +

        Main differences lie in how bit strings and functions are defined:

        + +

        Bit Strings

        + +

        Bit string with a base size of 3:

        + +
        <<_ :: 3>>
        +
        + +

        Bit string with a unit size of 8:

        + +
        <<_ :: _ * 8>>
        +
        + +

        Functions

        + +

        Any function:

        + +
        (fun(...) -> any)
        +or
        +((...) -> any)
        +or
        +(... -> any)
        +
        + +

        Function with arity of zero:

        + +
        (fun() -> type)
        +or
        +(() -> type)
        +
        + +

        Function with some arity:

        + +
        (fun(type, type) -> type)
        +or
        +((type, type) -> type)
        +or
        +(type, type -> type)
        +
        + +

        Notes

        + +

        Elixir discourages the use of type string() as it might be confused +with binaries which are referred to as "strings" in Elixir (as opposed to +character lists). In order to use the type that is called string() in Erlang, +one has to use the char_list() type which is a synonym to string(). If yu +use string(), you'll get a warning from the compiler.

        + +

        If you want to refer to the "string" type (the one operated by functions in the +String module), use String.t() type instead.

        +

        See http://www.erlang.org/doc/reference_manual/typespec.html for more information.

        @@ -95,7 +175,7 @@

        Functions summary

      • - spec_to_ast/1 + spec_to_ast/2
      • @@ -112,7 +192,7 @@

        Macros summary

      • - Source + Source

        beam_specs(module) @@ -169,7 +249,7 @@

        Functions

        The module has to have a corresponding beam file on the file system.

        - Source + Source

        beam_types(module) @@ -182,28 +262,28 @@

        Functions

        The module has to have a corresponding beam file on the file system.

        - Source + Source

        define_callback(module, tuple, definition)

        Defines a callback by receiving Erlang's typespec.

        - Source + Source

        define_spec(module, tuple, definition)

        Defines a spec by receiving Erlang's typespec.

        - Source + Source

        define_type(module, kind, type)

        Defines a type, typep or opaque by receiving Erlang's typespec.

        - Source + Source

        defines_callback?(module, name, arity) @@ -211,7 +291,7 @@

        Functions

        Returns true if the current module defines a callback. This function is only available for modules being compiled.

        - Source + Source

        defines_spec?(module, name, arity) @@ -219,7 +299,7 @@

        Functions

        Returns true if the current module defines a given spec. This function is only available for modules being compiled.

        - Source + Source

        defines_type?(module, name, arity) @@ -228,22 +308,21 @@

        Functions

        (private, opaque or not). This function is only available for modules being compiled.

        - Source + Source
        -

        - spec_to_ast(arg1) +

        + spec_to_ast(name, arg2)

        -

        Converts a spec clause back to Elixir AST. -Returns a 2-items tuple with the spec arguments and return result.

        +

        Converts a spec clause back to Elixir AST.

        - Source + Source

        type_to_ast(arg1)

        Converts a type clause back to Elixir AST.

        - Source + Source
        @@ -252,18 +331,18 @@

        Functions

        Macros

        -

        - defcallback(spec, block) +

        + defcallback(spec)

        Defines a callback. This macro is the one responsible to handle the attribute @callback.

        Examples

        -
        @callback add(number, number), do: number
        +
        @callback add(number, number) :: number
         
        - Source + Source

        defopaque(type) @@ -276,20 +355,20 @@

        Examples

        @opaque my_type :: atom
         
        - Source + Source
        -

        - defspec(spec, block) +

        + defspec(spec)

        Defines a spec. This macro is the one responsible to handle the attribute @spec.

        Examples

        -
        @spec add(number, number), do: number
        +
        @spec add(number, number) :: number
         
        - Source + Source

        deftype(type) @@ -302,7 +381,7 @@

        Examples

        @type my_type :: atom
         
        - Source + Source

        deftypep(type) @@ -315,7 +394,7 @@

        Examples

        @typep my_type :: atom
         
        - Source + Source diff --git a/docs/master/Kernel.html b/docs/master/Kernel.html index fdd6d4f40..66ef54248 100644 --- a/docs/master/Kernel.html +++ b/docs/master/Kernel.html @@ -301,6 +301,11 @@

        Functions summary

        list_to_tuple/1 +
      • + + macro_exported?/3 + +
      • make_ref/0 @@ -1079,7 +1084,7 @@

        Examples

        it is not loaded. Check Code.ensure_loaded/1 for more information.

        - Source + Source

        hd(list) @@ -1414,6 +1419,18 @@

        Examples

        Source +
        +

        + macro_exported?(module, macro, arity) +

        +

        Returns true if the module is loaded and contains a +public macro with the given arity, otherwise false.

        + +

        Notice that this function does not load the module in case +it is not loaded. Check Code.ensure_loaded/1 for more +information.

        +
        + Source

        make_ref() @@ -1517,7 +1534,7 @@

        Examples

        end
        - Source + Source

        raise(exception, args) @@ -1531,14 +1548,18 @@

        Examples

        Any module defined via defexception automatically defines exception(args) that returns a new instance of the record and a exception(args, current) that -works as no-op.

        +updates the current exception.

        + +

        Re-raising an exception will retrieve the previous +stacktrace so it keps the properties of the original +exception.

        Examples

        raise ArgumentError, message: "Sample"
         
        - Source + Source

        round(number) @@ -1789,7 +1810,7 @@

        Examples

        this operator accepts any expression as arguments, not only booleans, however it is not allowed in guards.

        - Source + Source

        *(left, right) @@ -1874,7 +1895,7 @@

        Examples

        3 in 1..3 #=> true
        - Source + Source

        /(left, right) @@ -1909,8 +1930,26 @@

        Examples

        Enum.map(List.flatten([1,[2],3]), &1 * 2)
         
        + +

        Please be aware of operator precendence, when using +this operator. For example, the following expression:

        + +
        String.graphemes "Hello" /> Enum.reverse
        +
        + +

        Is translated to:

        + +
        String.graphemes("Hello" /> Enum.reverse)
        +
        + +

        Which will result in an error as Enum.Iterator protocol +is not defined for binaries. Adding explicit parenthesis +is recommended:

        + +
        String.graphemes("Hello") /> Enum.reverse
        +
        - Source + Source

        <(left, right) @@ -1972,7 +2011,7 @@

        Examples

        x #=> "bar"
        - Source + Source

        ==(left, right) @@ -2025,7 +2064,7 @@

        Examples

        "abcd" =~ %r/e/ #=> nil
        - Source + Source

        >(left, right) @@ -2101,7 +2140,7 @@

        Examples

        time and not at runtime. Check the module Module for other functions to manipulate module attributes.

        - Source + Source

        __B__(string, list2) @@ -2115,7 +2154,7 @@

        Examples

        %B(f#{o}o) #=> "f\#{o}o"
        - Source + Source

        __C__(arg1, list2) @@ -2129,7 +2168,7 @@

        Examples

        %C(f#{o}o) #=> 'f\#{o}o'
        - Source + Source

        __R__(arg1, options) @@ -2142,7 +2181,7 @@

        Examples

        Regex.match? %R(f#{1,3}o), "f#o"  #=> true
         
        - Source + Source

        __b__(arg1, list2) @@ -2156,7 +2195,7 @@

        Examples

        %b(f#{:o}o) #=> "foo"
        - Source + Source

        __c__(arg1, list2) @@ -2170,7 +2209,7 @@

        Examples

        %c(f#{:o}o) #=> 'foo'
        - Source + Source

        __r__(arg1, options) @@ -2182,7 +2221,7 @@

        Examples

        Regex.match? %r(foo), "foo"  #=> true
         
        - Source + Source

        access(element, args) @@ -2256,7 +2295,7 @@

        Examples

        access a, 1 #=> :a
        - Source + Source

        and(left, right) @@ -2283,7 +2322,7 @@

        Examples

        atom_to_binary :my_atom #=> "my_atom"
         
        - Source + Source

        binary_to_atom(some_binary) @@ -2296,7 +2335,7 @@

        Examples

        binary_to_atom "my_atom" #=> :my_atom
         
        - Source + Source

        binary_to_existing_atom(some_binary) @@ -2309,7 +2348,7 @@

        Examples

        binary_to_existing_atom "my_atom" #=> :my_atom
        - Source + Source

        binary_to_float(some_binary) @@ -2321,7 +2360,7 @@

        Examples

        binary_to_float "2.2017764e+0" #=> 2.2017764
         
        - Source + Source

        binary_to_integer(some_binary) @@ -2333,7 +2372,7 @@

        Examples

        binary_to_integer "123" #=> 123
         
        - Source + Source

        binary_to_integer(some_binary, base) @@ -2346,7 +2385,7 @@

        Examples

        binary_to_integer("3FF", 16) #=> 1023
         
        - Source + Source

        case(condition, blocks) @@ -2399,7 +2438,7 @@

        Examples

        end
        - Source + Source

        cond(list1) @@ -2419,7 +2458,7 @@

        Examples

        end
        - Source + Source

        def(name, list2) @@ -2579,7 +2618,7 @@

        Examples

        #=> [3,2,1]
        - Source + Source

        defexception(name, fields, opts // [], do_block // []) @@ -2590,11 +2629,12 @@

        Examples

        the same API and similar behavior to defrecord/4 with two notable differences:

        -

        1) Differently from records, exceptions are documented by default; -2) Exceptions must implement message/1 as API that return a +

        1) Differently from records, exceptions are documented by default;

        + +

        2) Exceptions must implement message/1 as API that return a binary as result;

        - Source + Source

        defimpl(name, opts, do_block // []) @@ -2602,7 +2642,7 @@

        Examples

        Defines an implementation for the given protocol. See defprotocol/2 for examples.

        - Source + Source

        defmodule(name, list2) @@ -2659,7 +2699,7 @@

        Dynamic names

        An overridable function is lazily defined, allowing a developer to customize it.

        - Source + Source

        defp(name, list2) @@ -2808,7 +2848,7 @@

        Types

        As in records, defining a protocol automatically defines a type named t, which can be used as:

        -
        @spec present?(Blank.t), do: boolean
        +
        @spec present?(Blank.t) :: boolean
         def present?(blank) do
           not Blank.blank?(blank)
         end
        @@ -2817,7 +2857,7 @@ 

        Types

        The @spec above expresses that all types allowed to implement the given protocol are valid argument types for the given function.

        - Source + Source

        defrecord(name, fields, opts // [], do_block // []) @@ -2831,7 +2871,7 @@

        Types

        Examples

        -
        defrecord FileInfo, atime: nil, mtime: nil
        +
        defrecord FileInfo, atime: nil, accesses: 0
         

        The line above will define a module named FileInfo which @@ -2851,42 +2891,56 @@

        Examples

        #=> { FileInfo, nil, nil }
        -

        Extensions

        - -

        Besides defining readers and writers for each attribute. Elixir will -define extensions functions for each attribute. By default, it will -define an update_#{attribute} function to update the value. Such +

        Besides defining readers and writers for each attribute, Elixir also +defines an update_#{attribute} function to update the value. Such functions expect a function as argument that receives the current -value and must return the new one:

        +value and must return the new one. For example, every time the file +is accessed, the accesses counter can be incremented with:

        -
        file_info.update_atime(fn(_old) -> now() end) #=> Updates the value of atime
        +
        file_info.update_accesses(fn(old) -> old + 1 end)
         
        -

        Besides, Elixir may define new functions depending on the default value. -For example, ExUnit defines a record which keeps track of how many tests -were executed and the failures that happened. The record definition is -similar to:

        +

        Which can be also written as:

        -
        defrecord Config, counter: 0, failures: []
        +
        file_info.update_accesses(&1 + 1)
         
        -

        Since counter is an integer, Elixir automatically defines a helper -named increment_counter that will increase the counter value:

        +

        Access syntax

        + +

        Records in Elixir can be expanded at compilation time to provide +pattern matching and faster operations. For example, the clause +below will only match if a FileInfo is given and the number of +accesses is zero:

        -
        Config.new.increment_counter.counter #=> 1
        +
        def enforce_no_access(FileInfo[accesses: 0]), do: :ok
         
        -

        increment_counter also accepts a number of increment as argument:

        +

        The clause above will expand to:

        -
        Config.new.increment_counter(10).counter #=> 10
        +
        def enforce_no_access({ FileInfo, _, 0 }), do: :ok
         
        -

        Besides, if the default is a list, Elixir will define two helpers:

        +

        The downside of using such syntax is that, every time the record +changes, your code now needs to be recompiled (which is usually +not a concern since Elixir build tools by default recompiles the +whole project whenever there is a change).

        -
          -
        • merge_field - Receives keywords and merge it into the current value;
        • -
        • prepend_field - Receives another list and prepend its values;
        • -
        +

        Finally, keep in mind that Elixir triggers some optimizations whenever +the access syntax is used. For example:

        + +
        def no_access?(FileInfo[] = file_info) do
        +  file_info.accesses == 0
        +end
        +
        + +

        Is translated to:

        + +
        def no_access?({ FileInfo, _, _ } = file_info) do
        +  elem(file_info, 1) == 0
        +end
        +
        + +

        Which provides faster get and set times for record operations.

        Documentation

        @@ -2898,7 +2952,7 @@

        Types

        For example, assuming the Config record defined above, it could be used in typespecs as follow:

        -
        @spec handle_config(Config.t), do: boolean()
        +
        @spec handle_config(Config.t) :: boolean()
         

        Inside the record definition, a developer can define his own types too:

        @@ -2912,7 +2966,7 @@

        Types

        When defining a type, all the fields not mentioned in the type are assumed to have type term.

        - Source + Source

        defrecordp(name, fields) @@ -2960,7 +3014,7 @@

        Examples

        name #=> "José"
        - Source + Source

        destructure(left, right) @@ -3001,7 +3055,7 @@

        Examples

        the first value from the right side. Otherwise, it will raise a CaseClauseError.

        - Source + Source

        div(left, right) @@ -3015,7 +3069,7 @@

        Examples

        div 5, 2 #=> 2
         
        - Source + Source

        elem(tuple, index) @@ -3031,7 +3085,7 @@

        Example

        elem(tuple, 1) #=> :bar
        - Source + Source

        float_to_binary(some_float) @@ -3044,7 +3098,7 @@

        Examples

        float_to_binary 7.0 #=> "7.00000000000000000000e+00"
         
        - Source + Source

        function(args) @@ -3088,29 +3142,29 @@

        Shortcut syntax

        do/end always matches the furthest call, if we used the function macro as below:

        -
        Enum.map [1,2,3], function(x) do
        -  x * 2
        +
        Enum.map [1,2,3], function do
        +  x -> x * 2
         end
         

        It would be parsed as:

        -
        Enum.map([1,2,3], function(x)) do
        -  x * 2
        +
        Enum.map([1,2,3], function) do
        +  x -> x * 2
         end
         

        The stab shortcut syntax has the proper precedence:

        -
        Enum.map [1,2,3], fn x ->
        -  x * 2
        +
        Enum.map [1,2,3], fn
        +  x -> x * 2
         end
         

        Which is handled as:

        -
        Enum.map([1,2,3], fn x ->
        -  x * 2
        +
        Enum.map([1,2,3], fn
        +  x -> x * 2
         end)
         
        @@ -3126,7 +3180,7 @@

        Function retrieval

        f.([1,[2],3]) #=> [1,2,3]
        - Source + Source

        if(condition, clauses) @@ -3170,7 +3224,7 @@

        Blocks examples

        If you want to compare more than two clauses, you can use the cond/1 macro.

        - Source + Source

        in(left, right) @@ -3212,7 +3266,7 @@

        Clauses

        In this case, Elixir will automatically expand it and define the variable for us.

        - Source + Source

        inspect(arg, opts // []) @@ -3236,7 +3290,7 @@

        Examples

        #=> ":foo"
        - Source + Source

        integer_to_binary(some_integer) @@ -3249,7 +3303,7 @@

        Examples

        integer_to_binary 123 #=> "123"
         
        - Source + Source

        integer_to_binary(some_integer, base) @@ -3262,7 +3316,7 @@

        Examples

        integer_to_binary 77 #=> "77"
         
        - Source + Source

        is_exception(thing) @@ -3275,14 +3329,14 @@

        Examples

        is_exception(1) #=> false
        - Source + Source

        is_range(thing)

        Check if the given argument is a range.

        - Source + Source

        is_record(thing, kind) @@ -3299,14 +3353,14 @@

        Examples

        is_record(Config.new, List) #=> false
        - Source + Source

        is_regex(thing)

        Check if the given argument is a regex.

        - Source + Source

        match?(left, right) @@ -3333,7 +3387,7 @@

        Examples

        Enum.filter list, match?({:a, x } when x < 2, &1)
        - Source + Source

        nil?(x) @@ -3347,7 +3401,7 @@

        Examples

        nil? nil #=> true
        - Source + Source

        not(arg) @@ -3423,7 +3477,7 @@

        Examples

        will occur immediately.

      - Source + Source

      rem(left, right) @@ -3437,7 +3491,7 @@

      Examples

      rem 5, 2 #=> 1
       
      - Source + Source

      setelem(tuple, index, value) @@ -3453,7 +3507,7 @@

      Example

      setelem(tuple, 0, :baz) #=> { :baz, :bar, 3 }
      - Source + Source

      to_binary(arg) @@ -3467,7 +3521,7 @@

      Examples

      #=> "foo"
      - Source + Source

      to_char_list(arg) @@ -3480,7 +3534,7 @@

      Examples

      #=> 'foo'
      - Source + Source

      try(args) @@ -3503,20 +3557,19 @@

      Examples

      end -

      The rescue clause is used to handle errors, while the catch clause -can be used to catch throw values. Both catch and rescue clauses -accepts the same pattern matching rules as match.

      +

      The rescue clause is used to handle exceptions, while the catch +clause can be used to catch thrown values. Both catch and rescue +clauses work based on pattern matching.

      Note that calls inside try are not tail recursive since the VM needs to keep the stacktrace in case an exception happens.

      Rescue clauses

      -

      Besides accepting the same pattern matching rules as match -clauses, rescue provides some conveniences around exceptions -that allows one to rescue an exception by its name and not by -its internal contents. All the following formats are valid -rescue expressions:

      +

      Besides relying on pattern matching, rescue clauses provides some +conveniences around exceptions that allows one to rescue an +exception by its name. All the following formats are valid rescue +expressions:

      try do
         UndefinedModule.undefined_function
      @@ -3545,30 +3598,9 @@ 

      Rescue clauses

      end
      -

      Variable visibility

      - -

      Since an expression inside try may not have been evaluted -due to an exception, any variable created inside try cannot -be accessed externaly. -For instance:

      - -
      try do
      -  x = 1
      -  do_something_that_may_fail(same_arg)
      -  :ok
      -catch
      -  _ | _ -> :failed
      -end
      -
      -x #=> Cannot access `x`
      -
      - -

      In the example above, x cannot be accessed since it was defined -inside the try clause.

      -

      Catching exits and Erlang errors

      -

      The catch clause works exactly the same as in : Therefore, +

      The catch clause works exactly the same as in erlang. Therefore, one can also handle exits/errors coming from Erlang as below:

      try do
      @@ -3587,8 +3619,39 @@ 

      Catching exits and Erlang errors

      Although the second form should be avoided in favor of raise/rescue control mechanisms.

      + +

      Variable visibility

      + +

      Since an expression inside try may not have been evaluted +due to an exception, any variable created inside try cannot +be accessed externaly. For instance:

      + +
      try do
      +  x = 1
      +  do_something_that_may_fail(same_arg)
      +  :ok
      +catch
      +  _, _ -> :failed
      +end
      +
      +x #=> Cannot access `x`
      +
      + +

      In the example above, x cannot be accessed since it was defined +inside the try clause. A common practice to address this issue +is to return the variables defined inside try:

      + +
      x =
      +  try do
      +    x = 1
      +    do_something_that_may_fail(same_arg)
      +    x
      +  catch
      +    _, _ -> :failed
      +  end
      +
      - Source + Source

      unless(clause, options) @@ -3597,7 +3660,7 @@

      Catching exits and Erlang errors

      unless a value evalutes to true. Check if for examples and documentation.

      - Source + Source

      use(module, args // []) @@ -3634,7 +3697,7 @@

      Examples

      end
      - Source + Source

      var!(var) @@ -3678,7 +3741,7 @@

      Examples

      this operator accepts any expression as arguments, not only booleans, however it is not allowed in guards.

      - Source + Source diff --git a/docs/master/KeyError.html b/docs/master/KeyError.html index 0d290fde0..db307b332 100644 --- a/docs/master/KeyError.html +++ b/docs/master/KeyError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -115,61 +115,61 @@

      Functions

      exception(args)

      - Source + Source

      exception(args, self)

      - Source + Source

      key(record)

      - Source + Source

      key(value, record)

      - Source + Source

      message(exception)

      - Source + Source

      new()

      - Source + Source

      new(opts)

      - Source + Source

      to_keywords(record)

      - Source + Source

      update(keywords, record)

      - Source + Source

      update_key(function, record)

      - Source + Source
      diff --git a/docs/master/List.html b/docs/master/List.html index 520c0f061..83bdad2fc 100644 --- a/docs/master/List.html +++ b/docs/master/List.html @@ -123,26 +123,6 @@

      Functions summary

      member?/2

    2565. -
    2566. - - range/3 - -
    2567. -
    2568. - - sort/1 - -
    2569. -
    2570. - - sort/2 - -
    2571. -
    2572. - - uniq/1 - -
    2573. unzip/1 @@ -412,67 +392,6 @@

      Examples

      Source -
      -

      - range(first, last, step // nil) -

      -

      Returns a list of integers in the given range (both ends included when -possible). An optional step can be provided as well (defaults to 1).

      - -

      If first > last and no step is provided, the numbers will be in descending -order.

      - -

      Examples

      - -
      List.range 1, 3     #=> [1,2,3]
      -List.range 1, 8, 2  #=> [1,3,5,7]
      -List.range 1, 0     #=> []
      -List.range 3, 1     #=> [3,2,1]
      -List.range 5, 1, -2 #=> [5, 3, 1]
      -
      -
      - Source -
      -

      - sort(list) -

      -

      Sorts the list by comparing each term. For an alternative -sorting algorithm, check Enum.qsort.

      - -

      Examples

      - -
      List.sort [3, 4, 2, 1, 7]
      -#=> [1, 2, 3, 4, 7]
      -
      -
      - Source -
      -

      - sort(list, fun) -

      -

      Sorts the list according to an ordering function. fun(a, b) should -return true if a compares less than or equal to b, false otherwise.

      - -

      Examples

      - -
      List.sort [3, 4, 2, 1, 7], fn a, b -> b <= a end
      -#=> [7, 4, 3, 2, 1]
      -
      -
      - Source -
      -

      - uniq(list) -

      -

      Returns a list without duplicated items.

      - -

      Examples

      - -
      List.uniq [1,2,3,2,1]
      -#=> [1,2,3]
      -
      -
      - Source

      unzip(list) @@ -489,7 +408,7 @@

      Examples

      #=> [[1, 2, 3], [:a, :b, :c]]
      - Source + Source

      wrap(list) @@ -503,7 +422,7 @@

      Examples

      List.wrap [1,2,3] #=> [1,2,3]
       
      - Source + Source

      zip(list_of_lists) @@ -519,7 +438,7 @@

      Examples

      #=> [{1, 3, 5}]
      - Source + Source diff --git a/docs/master/Macro.html b/docs/master/Macro.html index 6a2fb12ab..0ab1ed027 100644 --- a/docs/master/Macro.html +++ b/docs/master/Macro.html @@ -56,6 +56,11 @@

      Functions summary

      expand/2
    2574. +
    2575. + + extract_args/1 + +
    2576. safe_term/1 @@ -117,7 +122,7 @@

      Functions

      do_safe_term(terms)

      - Source + Source

      escape(tuple) @@ -135,7 +140,7 @@

      Examples

      #=> { :{}, 0, [:a, :b, :c] }
      - Source + Source

      expand(aliases, env) @@ -147,6 +152,7 @@

      Examples

    2577. Macros (local or remote);
    2578. Aliases are expanded (if possible) and return atoms;
    2579. All pseudo-variables (FILE, MODULE, etc);
    2580. +
    2581. Module attributes reader (@foo);
    2582. In case the expression cannot be expanded, it returns the expression itself.

      @@ -231,7 +237,29 @@

      Examples

      end - Source + Source +
      +

      + extract_args(expr) +

      +

      Receives an expresion representing a possible definition +and extracts its arguments. It returns a tuple with the +function name and the arguments list or :error if not +a valid call syntax.

      + +

      This is useful for macros that want to provide the same +arguments syntax available in def/defp/defmacro and friends.

      + +

      Examples

      + +
      extract_args(quote do: foo)        == { :foo, [] }
      +extract_args(quote do: foo())      == { :foo, [] }
      +extract_args(quote do: :foo.())    == { :foo, [] }
      +extract_args(quote do: foo(1,2,3)) == { :foo, [1,2,3] }
      +extract_args(quote do: 1.(1,2,3))  == :error
      +
      +
      + Source

      safe_term(terms) @@ -241,7 +269,7 @@

      Examples

      evaluate code) and returns :ok unless a given term is unsafe, which is returned as { :unsafe, term }.

      - Source + Source

      to_binary(tree) @@ -254,7 +282,7 @@

      Examples

      #=> "foo.bar(1, 2, 3)"
      - Source + Source

      unescape_binary(chars) @@ -280,7 +308,7 @@

      Examples

      In the example above, we pass a string with \n escaped and we return a version with it unescaped.

      - Source + Source

      unescape_binary(chars, map) @@ -315,6 +343,11 @@

      Octals

      Octals will by default be escaped unless the map function returns false for ?0.

      +

      Hex

      + +

      Octals will by default be escaped unless the map function +returns false for ?x.

      +

      Examples

      Using the unescape_map defined above is easy:

      @@ -322,7 +355,7 @@

      Examples

      Macro.unescape_binary "example\\n", unescape_map(&1)
       
      - Source + Source

      unescape_tokens(tokens) @@ -330,11 +363,11 @@

      Examples

      Unescape the given tokens according to the default map. Check unescape/1 and unescape/2 for more information about unescaping. Only tokens that are binaries are -unescaped, all others are ignored. This method is useful +unescaped, all others are ignored. This function is useful when implementing your own sigils. Check the implementation of Kernel.__b__ for examples.

      - Source + Source

      unescape_tokens(tokens, map) @@ -342,7 +375,7 @@

      Examples

      Unescape the given tokens according to the given map. Check unescape_tokens/1 and unescaped/2 for more information.

      - Source + Source
      diff --git a/docs/master/MatchError.html b/docs/master/MatchError.html index b85947f52..72f662c02 100644 --- a/docs/master/MatchError.html +++ b/docs/master/MatchError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -115,61 +115,61 @@

      Functions

      actual(record)

      - Source + Source

      actual(value, record)

      - Source + Source

      exception(args)

      - Source + Source

      exception(args, self)

      - Source + Source

      message(exception)

      - Source + Source

      new()

      - Source + Source

      new(opts)

      - Source + Source

      to_keywords(record)

      - Source + Source

      update(keywords, record)

      - Source + Source

      update_actual(function, record)

      - Source + Source
      diff --git a/docs/master/Mix.Error.html b/docs/master/Mix.Error.html index cc8400d65..e617924c7 100644 --- a/docs/master/Mix.Error.html +++ b/docs/master/Mix.Error.html @@ -37,6 +37,12 @@

      Fields (and defaults)

      @@ -129,6 +155,18 @@

      Functions

      Source +
      +

      + mix_error(record) +

      +
      + Source +
      +

      + mix_error(value, record) +

      +
      + Source

      new() @@ -147,6 +185,12 @@

      Functions

      Source +
      +

      + toggle_mix_error(record) +

      +
      + Source

      update(keywords, record) @@ -159,6 +203,12 @@

      Functions

      Source +
      +

      + update_mix_error(function, record) +

      +
      + Source
      diff --git a/docs/master/Mix.InvalidTaskError.html b/docs/master/Mix.InvalidTaskError.html index dd83e7d79..044b89a62 100644 --- a/docs/master/Mix.InvalidTaskError.html +++ b/docs/master/Mix.InvalidTaskError.html @@ -43,6 +43,12 @@

      Fields (and defaults)

    2583. +
    2584. + + mix_error: true + +
    2585. + @@ -64,6 +70,16 @@

      Functions summary

      message/1 +
    2586. + + mix_error/1 + +
    2587. +
    2588. + + mix_error/2 + +
    2589. new/0 @@ -89,11 +105,21 @@

      Functions summary

      to_keywords/1
    2590. +
    2591. + + toggle_mix_error/1 + +
    2592. update/2
    2593. +
    2594. + + update_mix_error/2 + +
    2595. update_task/2 @@ -128,6 +154,18 @@

      Functions

      Source +
      +

      + mix_error(record) +

      +
      + Source +
      +

      + mix_error(value, record) +

      +
      + Source

      new() @@ -158,12 +196,24 @@

      Functions

      Source +
      +

      + toggle_mix_error(record) +

      +
      + Source

      update(keywords, record)

      Source +
      +

      + update_mix_error(function, record) +

      +
      + Source

      update_task(function, record) diff --git a/docs/master/Mix.NoProjectError.html b/docs/master/Mix.NoProjectError.html index fb0721644..82f5178b3 100644 --- a/docs/master/Mix.NoProjectError.html +++ b/docs/master/Mix.NoProjectError.html @@ -37,6 +37,12 @@

      Fields (and defaults)

      @@ -129,6 +155,18 @@

      Functions

      Source +
      +

      + mix_error(record) +

      +
      + Source +
      +

      + mix_error(value, record) +

      +
      + Source

      new() @@ -147,6 +185,12 @@

      Functions

      Source +
      +

      + toggle_mix_error(record) +

      +
      + Source

      update(keywords, record) @@ -159,6 +203,12 @@

      Functions

      Source +
      +

      + update_mix_error(function, record) +

      +
      + Source
      diff --git a/docs/master/Mix.NoTaskError.html b/docs/master/Mix.NoTaskError.html index 41b7814f1..213d40a2d 100644 --- a/docs/master/Mix.NoTaskError.html +++ b/docs/master/Mix.NoTaskError.html @@ -43,6 +43,12 @@

      Fields (and defaults)

    2596. +
    2597. + + mix_error: true + +
    2598. + @@ -64,6 +70,16 @@

      Functions summary

      message/1 +
    2599. + + mix_error/1 + +
    2600. +
    2601. + + mix_error/2 + +
    2602. new/0 @@ -89,11 +105,21 @@

      Functions summary

      to_keywords/1
    2603. +
    2604. + + toggle_mix_error/1 + +
    2605. update/2
    2606. +
    2607. + + update_mix_error/2 + +
    2608. update_task/2 @@ -128,6 +154,18 @@

      Functions

      Source +
      +

      + mix_error(record) +

      +
      + Source +
      +

      + mix_error(value, record) +

      +
      + Source

      new() @@ -158,12 +196,24 @@

      Functions

      Source +
      +

      + toggle_mix_error(record) +

      +
      + Source

      update(keywords, record)

      Source +
      +

      + update_mix_error(function, record) +

      +
      + Source

      update_task(function, record) diff --git a/docs/master/Mix.OutOfDateDepsError.html b/docs/master/Mix.OutOfDateDepsError.html index df647aec7..52d41cafd 100644 --- a/docs/master/Mix.OutOfDateDepsError.html +++ b/docs/master/Mix.OutOfDateDepsError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -37,6 +37,12 @@

      Fields (and defaults)

      @@ -115,61 +141,85 @@

      Functions

      env(record)

      - Source + Source

      env(value, record)

      - Source + Source

      exception(args)

      - Source + Source

      exception(args, self)

      - Source + Source

      message(exception)

      - Source + Source +
      +

      + mix_error(record) +

      +
      + Source +
      +

      + mix_error(value, record) +

      +
      + Source

      new()

      - Source + Source

      new(opts)

      - Source + Source

      to_keywords(record)

      - Source + Source +
      +

      + toggle_mix_error(record) +

      +
      + Source

      update(keywords, record)

      - Source + Source

      update_env(function, record)

      - Source + Source +
      +

      + update_mix_error(function, record) +

      +
      + Source
      diff --git a/docs/master/Mix.Shell.IO.html b/docs/master/Mix.Shell.IO.html index 2a5bf04ac..f74380962 100644 --- a/docs/master/Mix.Shell.IO.html +++ b/docs/master/Mix.Shell.IO.html @@ -43,6 +43,11 @@

      Functions summary

      • + + cmd/1 + +
      • +
      • error/1 @@ -69,19 +74,27 @@

        Functions summary

        Functions

        +

        + cmd(command) +

        +

        Executes the given command and prints its output +to stdout as it comes.

        +
        + Source +

        error(message)

        Writes an error message to the shell followed by new line.

        - Source + Source

        info(message)

        Writes a message to the shell followed by new line.

        - Source + Source

        yes?(message) @@ -90,7 +103,7 @@

        Functions

        He must press enter or type anything that matches the a "yes" regex %r/^Y(es)?$/i.

        - Source + Source
        diff --git a/docs/master/Mix.Shell.Process.html b/docs/master/Mix.Shell.Process.html index f369ad1e5..51be639b1 100644 --- a/docs/master/Mix.Shell.Process.html +++ b/docs/master/Mix.Shell.Process.html @@ -55,6 +55,11 @@

        Functions summary

        • + + cmd/1 + +
        • +
        • error/1 @@ -86,17 +91,23 @@

          Functions summary

          Functions

          +

          + cmd(command) +

          +

          Executes the given command and fowards its messages to +the current process.

          +
          + Source +

          error(message)

          Simply forwards the message to the current process.

          - Source + Source

          - flush(callback // fn x -> - x -end) + flush(callback // fn x -> x end)

          Flush all :mix_shell messages from the current process. If a callback is given, it is invoked for each received message.

          @@ -113,7 +124,7 @@

          Examples

          Simply forwards the message to the current process.

          - Source + Source

          yes?(message) @@ -127,7 +138,7 @@

          Examples

          If one does not exist, it will abort since there no shell process input given. Value must be true or false.

          - Source + Source
          diff --git a/docs/master/Mix.Shell.html b/docs/master/Mix.Shell.html index 859c46af2..21fb84ff8 100644 --- a/docs/master/Mix.Shell.html +++ b/docs/master/Mix.Shell.html @@ -41,7 +41,15 @@

          +

          Functions summary

          + @@ -49,6 +57,21 @@

          +
          +

          Functions

          +
          +

          + cmd(command, callback) +

          +

          An implementation of the command callback that +is shared accross different shells.

          +
          + Source +
          +
          + + + diff --git a/docs/master/Mix.Tasks.Run.html b/docs/master/Mix.Tasks.Run.html index b5e151e46..5eac9c9fd 100644 --- a/docs/master/Mix.Tasks.Run.html +++ b/docs/master/Mix.Tasks.Run.html @@ -32,6 +32,14 @@

          Before running the code, it invokes the prepare task which defaults to compile and load your project.

          +

          Command line options

          + +
            +
          • --require, -r - Requires a file before running the command
          • +
          • --parallel-require, -pr - Requires a file in parallel
          • +
          • --no-halt - Does not halt the system after running the command
          • +
          +

          Examples

          mix run Hello.world
          @@ -71,7 +79,7 @@ 

          Functions

          run(args)

          - Source + Source diff --git a/docs/master/Module.html b/docs/master/Module.html index 1305c5b87..b845183c1 100644 --- a/docs/master/Module.html +++ b/docs/master/Module.html @@ -177,7 +177,7 @@

          Examples

          end
          - Source + Source

          concat(list) @@ -192,7 +192,7 @@

          Examples

          Module.concat [Foo, 'Bar'] #=> Foo.Bar
          - Source + Source

          concat(left, right) @@ -207,7 +207,7 @@

          Examples

          Module.concat Foo, 'Bar' #=> Foo.Bar
          - Source + Source

          create(module, quoted, opts // []) @@ -241,7 +241,7 @@

          Differences with defmodule

          when defining the module, while defmodule automatically shares the same environment.

          - Source + Source

          defines?(module, tuple) @@ -258,7 +258,7 @@

          Examples

          end
          - Source + Source

          defines?(module, tuple, kind) @@ -276,7 +276,7 @@

          Examples

          end
          - Source + Source

          definitions_in(module) @@ -291,7 +291,7 @@

          Examples

          end
          - Source + Source

          definitions_in(module, kind) @@ -308,7 +308,7 @@

          Examples

          end
          - Source + Source

          delete_attribute(module, key) @@ -323,7 +323,7 @@

          Examples

          end
          - Source + Source

          eval_quoted(module, quoted, binding // [], opts // []) @@ -356,7 +356,7 @@

          Examples

          Foo.sum(1, 2) #=> 3
          - Source + Source

          get_attribute(module, key) @@ -377,7 +377,7 @@

          Examples

          end
          - Source + Source

          make_overridable(module, tuples) @@ -386,7 +386,7 @@

          Examples

          An overridable function is lazily defined, allowing a developer to customize it.

          - Source + Source

          open?(module) @@ -394,14 +394,14 @@

          Examples

          Check if a module is open, i.e. it is currently being defined and its attributes and functions can be modified.

          - Source + Source

          overridable?(module, tuple)

          Returns true if the given tuple in module is marked as overridable.

          - Source + Source

          put_attribute(module, key, value) @@ -417,7 +417,7 @@

          Examples

          end
          - Source + Source

          register_attribute(module, new, opts // []) @@ -454,7 +454,7 @@

          Examples

          end
          - Source + Source

          safe_concat(list) @@ -473,7 +473,7 @@

          Examples

          #=> List.Chars
          - Source + Source

          safe_concat(left, right) @@ -492,7 +492,7 @@

          Examples

          #=> List.Chars
          - Source + Source

          split(module) @@ -505,14 +505,14 @@

          Examples

          #=> ["Very", "Long", "Module", "Name", "And", "Even", "Longer"]
          - Source + Source

          to_binary(module)

          Convert a module name to binary without the Elixir prefix.

          - Source + Source
          diff --git a/docs/master/Protocol.UndefinedError.html b/docs/master/Protocol.UndefinedError.html index 3f5cd15dd..bf575437f 100644 --- a/docs/master/Protocol.UndefinedError.html +++ b/docs/master/Protocol.UndefinedError.html @@ -29,7 +29,7 @@

          - Source + Source @@ -136,79 +136,79 @@

          Functions

          exception(args)

          - Source + Source

          exception(args, self)

          - Source + Source

          message(exception)

          - Source + Source

          new()

          - Source + Source

          new(opts)

          - Source + Source

          protocol(record)

          - Source + Source

          protocol(value, record)

          - Source + Source

          structure(record)

          - Source + Source

          structure(value, record)

          - Source + Source

          to_keywords(record)

          - Source + Source

          update(keywords, record)

          - Source + Source

          update_protocol(function, record)

          - Source + Source

          update_structure(function, record)

          - Source + Source
          diff --git a/docs/master/Record.html b/docs/master/Record.html index 3dc1395e7..d346d1816 100644 --- a/docs/master/Record.html +++ b/docs/master/Record.html @@ -84,7 +84,7 @@

          Functions summary

          Functions

          - deffunctions(values, opts // [], env) + deffunctions(values, _opts // [], env)

          Defines record functions skipping the module definition. This is called directly by defrecord. It expects the record @@ -114,7 +114,7 @@

          Examples

          end
          - Source + Source

          defrecord(name, values, opts) @@ -137,11 +137,11 @@

          Examples

          Source

          - deftypes(values, types, opts // [], env) + deftypes(values, types, _opts // [], env)

          Defines types and specs for the record.

          - Source + Source

          extract(name, opts) diff --git a/docs/master/Regex.html b/docs/master/Regex.html index d1484e700..760503fd0 100644 --- a/docs/master/Regex.html +++ b/docs/master/Regex.html @@ -45,7 +45,7 @@

          their shortcut in parenthesis, are:

            -
          • unicode (u) - used when you want to match against specific unicode characters
          • +
          • unicode (u) - enable unicode specific patterns like \p
          • caseless (i) - add case insensitivity
          • dotall (s) - causes dot to match newlines and also set newline to anycrlf. The new line setting can be overwritten by setting (*CR) or (*LF) or diff --git a/docs/master/RuntimeError.html b/docs/master/RuntimeError.html index 2ccdfdec5..110d1e912 100644 --- a/docs/master/RuntimeError.html +++ b/docs/master/RuntimeError.html @@ -29,7 +29,7 @@

            - Source + Source @@ -110,55 +110,55 @@

            Functions

            exception(args)

            - Source + Source

          exception(args, self)

          - Source + Source

          message(record)

          - Source + Source

          message(value, record)

          - Source + Source

          new()

          - Source + Source

          new(opts)

          - Source + Source

          to_keywords(record)

          - Source + Source

          update(keywords, record)

          - Source + Source

          update_message(function, record)

          - Source + Source
          diff --git a/docs/master/String.html b/docs/master/String.html index 9a91d2bdd..0381769b1 100644 --- a/docs/master/String.html +++ b/docs/master/String.html @@ -92,6 +92,11 @@

          Functions summary

          length/1
        • +
        • + + lstrip/1 + +
        • lstrip/2 @@ -117,6 +122,11 @@

          Functions summary

          replace/4
        • +
        • + + rstrip/1 + +
        • rstrip/2 @@ -127,6 +137,11 @@

          Functions summary

          split/3
        • +
        • + + strip/1 + +
        • strip/2 @@ -157,14 +172,14 @@

          Functions

          Examples

          -
          String.at("elixir", 0) #=> "1"
          +
          String.at("elixir", 0) #=> "e"
           String.at("elixir", 1) #=> "l"
           String.at("elixir", 10) #=> nil
           String.at("elixir", -1) #=> "r"
           String.at("elixir", -10) #=> nil
           
          - Source + Source

          codepoints(string) @@ -178,7 +193,7 @@

          Examples

          String.codepoints("ἅἪῼ") #=> ["ἅ","Ἢ","ῼ"]
          - Source + Source

          downcase(binary) @@ -209,7 +224,7 @@

          Examples

          String.duplicate("abc", 2) #=> "abcabc"
          - Source + Source

          first(string) @@ -222,7 +237,7 @@

          Examples

          String.first("եոգլի") #=> "ե"
          - Source + Source

          graphemes(string) @@ -233,7 +248,7 @@

          Examples

          String.graphemes("Ā̀stute") # => ["Ā̀","s","t","u","t","e"]

          - Source + Source

          last(string) @@ -246,7 +261,7 @@

          Examples

          String.last("եոգլի") #=> "ի"
          - Source + Source

          length(string) @@ -259,21 +274,32 @@

          Examples

          String.length("եոգլի") #=> 5
          - Source + Source
          -

          - lstrip(string, char // 32) +

          + lstrip(binary)

          -

          Returns a string where leading char have been -removed. If no char is passed spaceis used.

          +

          Returns a string where leading whitespace characters +have been removed.

          Examples

          String.lstrip("   abc  ")       #=> "abc  "
          -String.lstrip("_  abc  _", ?_)  #=> "  abc  _"
           
          - Source + Source +
          +

          + lstrip(other, char) +

          +

          Returns a string where leading char have been removed.

          + +

          Examples

          + +
          String.lstrip("_  abc  _", ?_)  #=> "  abc  _"
          +
          +
          + Source

          next_codepoint(string) @@ -289,7 +315,7 @@

          Examples

          String.next_codepoint("josé") #=> { "j", "osé" }
           
          - Source + Source

          next_grapheme(string) @@ -305,7 +331,7 @@

          Examples

          String.next_grapheme("josé") #=> { "j", "osé" }
           
          - Source + Source

          printable?(arg1) @@ -341,21 +367,32 @@

          Examples

          String.replace("a,b,c", ",", "[]", insert_replaced: [1,1]) #=> "a[,,]b[,,]c"
          - Source + Source
          -

          - rstrip(string, char // 32) +

          + rstrip(binary)

          -

          Returns a string where trailing char have been -removed. If no char is passed spaceis used.

          +

          Returns a string where trailing whitespace characters +and new line have been removed.

          Examples

          String.rstrip("   abc  ")      #=> "   abc"
          -String.rstrip("   abc _", ?_)  #=> "   abc "
           
          - Source + Source +
          +

          + rstrip(string, char) +

          +

          Returns a string where trailing char have been removed.

          + +

          Examples

          + +
          String.rstrip("   abc _", ?_)  #=> "   abc "
          +
          +
          + Source

          split(binary, pattern // " ", options // []) @@ -386,19 +423,31 @@

          Examples

          Source
          -

          - strip(string, char // 32) +

          + strip(string)

          -

          Returns a string where leading/trailing char have been -removed. If no char is passed spaceis used.

          +

          Returns a string where leading/trailing whitespace +and new line characters have been removed.

          Examples

          String.strip("   abc  ")       #=> "abc"
          -String.strip("a  abc  a", ?a)  #=> "  abc  "
           
          - Source + Source +
          +

          + strip(string, char) +

          +

          Returns a string where leading/trailing char have been +removed.

          + +

          Examples

          + +
          String.strip("a  abc  a", ?a)  #=> "  abc  "
          +
          +
          + Source

          upcase(binary) diff --git a/docs/master/SyntaxError.html b/docs/master/SyntaxError.html index 742e6a727..8a9744be0 100644 --- a/docs/master/SyntaxError.html +++ b/docs/master/SyntaxError.html @@ -29,7 +29,7 @@

          - Source + Source @@ -157,97 +157,97 @@

          Functions

          description(record)

          - Source + Source

          description(value, record)

          - Source + Source

          exception(args)

          - Source + Source

          exception(args, self)

          - Source + Source

          file(record)

          - Source + Source

          file(value, record)

          - Source + Source

          line(record)

          - Source + Source

          line(value, record)

          - Source + Source

          message(exception)

          - Source + Source

          new()

          - Source + Source

          new(opts)

          - Source + Source

          to_keywords(record)

          - Source + Source

          update(keywords, record)

          - Source + Source

          update_description(function, record)

          - Source + Source

          update_file(function, record)

          - Source + Source

          update_line(function, record)

          - Source + Source
          diff --git a/docs/master/System.html b/docs/master/System.html index d35f14197..f49f4b6b3 100644 --- a/docs/master/System.html +++ b/docs/master/System.html @@ -125,7 +125,7 @@

          Functions

          Returns the list of command-line arguments passed to the program.

          - Source + Source

          at_exit(fun) @@ -137,14 +137,14 @@

          Functions

          The function must expect the exit status code as argument.

          - Source + Source

          build_info()

          Returns a keywords list with version, git tag info and date.

          - Source + Source

          cmd(command) @@ -156,7 +156,7 @@

          Functions

          If command is a char list, a char list is returned. Returns a binary otherwise.

          - Source + Source

          find_executable(command) @@ -168,7 +168,7 @@

          Functions

          If command is a char list, a char list is returned. Returns a binary otherwise.

          - Source + Source

          get_env() @@ -177,7 +177,7 @@

          Functions

          given as a single string of the format "VarName=Value", where VarName is the name of the variable and Value its value.

          - Source + Source

          get_env(varname) @@ -186,7 +186,7 @@

          Functions

          varname as a binary, or nil if the environment variable is undefined.

          - Source + Source

          get_pid() @@ -196,7 +196,7 @@

          Functions

          See http://www.erlang.org/doc/man/os.html#getpid-0 for more info.

          - Source + Source

          halt(status // 0, options // []) @@ -230,7 +230,7 @@

          Examples

          System.halt(:abort)
          - Source + Source

          put_env(dict) @@ -238,28 +238,28 @@

          Examples

          Sets a new value for each environment variable corresponding to each key in dict.

          - Source + Source

          put_env(varname, value)

          Sets a new value for the environment variable varname.

          - Source + Source

          stacktrace()

          Get the stacktrace.

          - Source + Source

          version()

          Returns Elixir's version as binary.

          - Source + Source
          diff --git a/docs/master/SystemLimitError.html b/docs/master/SystemLimitError.html index c601d7de2..6f73b2fee 100644 --- a/docs/master/SystemLimitError.html +++ b/docs/master/SystemLimitError.html @@ -29,7 +29,7 @@

          - Source + Source @@ -110,55 +110,55 @@

          Functions

          exception(args)

          - Source + Source

          exception(args, self)

          - Source + Source

          message(record)

          - Source + Source

          message(value, record)

          - Source + Source

          new()

          - Source + Source

          new(opts)

          - Source + Source

          to_keywords(record)

          - Source + Source

          update(keywords, record)

          - Source + Source

          update_message(function, record)

          - Source + Source
          diff --git a/docs/master/TokenMissingError.html b/docs/master/TokenMissingError.html index 518048f14..1e1b88e74 100644 --- a/docs/master/TokenMissingError.html +++ b/docs/master/TokenMissingError.html @@ -29,7 +29,7 @@

          - Source + Source @@ -157,97 +157,97 @@

          Functions

          description(record)

          - Source + Source

          description(value, record)

          - Source + Source

          exception(args)

          - Source + Source

          exception(args, self)

          - Source + Source

          file(record)

          - Source + Source

          file(value, record)

          - Source + Source

          line(record)

          - Source + Source

          line(value, record)

          - Source + Source

          message(exception)

          - Source + Source

          new()

          - Source + Source

          new(opts)

          - Source + Source

          to_keywords(record)

          - Source + Source

          update(keywords, record)

          - Source + Source

          update_description(function, record)

          - Source + Source

          update_file(function, record)

          - Source + Source

          update_line(function, record)

          - Source + Source
          diff --git a/docs/master/URI.html b/docs/master/URI.html index ececf5633..e985b8fd2 100644 --- a/docs/master/URI.html +++ b/docs/master/URI.html @@ -88,7 +88,7 @@

          Functions

          Unpercent (URL) decodes a URI.

          - Source + Source

          decode_query(q, dict // OrdDict.new()) @@ -139,7 +139,7 @@

          Functions

          for that particular scheme. Take a look at URI.HTTPS for an example of one of these extension modules.

          - Source + Source

          query_decoder(q) diff --git a/docs/master/UndefinedFunctionError.html b/docs/master/UndefinedFunctionError.html index da4dad5c5..27b0d3a09 100644 --- a/docs/master/UndefinedFunctionError.html +++ b/docs/master/UndefinedFunctionError.html @@ -29,7 +29,7 @@

          - Source + Source @@ -157,97 +157,97 @@

          Functions

          arity(record)

          - Source + Source

          arity(value, record)

          - Source + Source

          exception(args)

          - Source + Source

          exception(args, self)

          - Source + Source

          function(record)

          - Source + Source

          function(value, record)

          - Source + Source

          message(exception)

          - Source + Source

          module(record)

          - Source + Source

          module(value, record)

          - Source + Source

          new()

          - Source + Source

          new(opts)

          - Source + Source

          to_keywords(record)

          - Source + Source

          update(keywords, record)

          - Source + Source

          update_arity(function, record)

          - Source + Source

          update_function(function, record)

          - Source + Source

          update_module(function, record)

          - Source + Source
          diff --git a/docs/master/modules_list.html b/docs/master/modules_list.html index ed4264833..4f7ad5898 100644 --- a/docs/master/modules_list.html +++ b/docs/master/modules_list.html @@ -16,7 +16,7 @@

          - Elixir v0.7.1 + Elixir v0.7.2

          exception(args, self)

          - Source + Source

          message(record)

          - Source + Source

          message(value, record)

          - Source + Source

          new()

          - Source + Source

          new(opts)

          - Source + Source

          to_keywords(record)

          - Source + Source

          update(keywords, record)

          - Source + Source

          update_message(function, record)

          - Source + Source
          diff --git a/docs/stable/ArithmeticError.html b/docs/stable/ArithmeticError.html index 8be9f9383..1da22ab13 100644 --- a/docs/stable/ArithmeticError.html +++ b/docs/stable/ArithmeticError.html @@ -29,7 +29,7 @@

          - Source + Source @@ -110,55 +110,55 @@

          Functions

          exception(args)

          - Source + Source

          exception(args, self)

          - Source + Source

          message(record)

          - Source + Source

          message(value, record)

          - Source + Source

          new()

          - Source + Source

          new(opts)

          - Source + Source

          to_keywords(record)

          - Source + Source

          update(keywords, record)

          - Source + Source

          update_message(function, record)

          - Source + Source
          diff --git a/docs/stable/BadArityError.html b/docs/stable/BadArityError.html index 768e24227..4d4bdacd8 100644 --- a/docs/stable/BadArityError.html +++ b/docs/stable/BadArityError.html @@ -29,7 +29,7 @@

          - Source + Source @@ -136,79 +136,79 @@

          Functions

          args(record)

          - Source + Source

          args(value, record)

          - Source + Source

          exception(args)

          - Source + Source

          exception(args, self)

          - Source + Source

          function(record)

          - Source + Source

          function(value, record)

          - Source + Source

          message(exception)

          - Source + Source

          new()

          - Source + Source

          new(opts)

          - Source + Source

          to_keywords(record)

          - Source + Source

          update(keywords, record)

          - Source + Source

          update_args(function, record)

          - Source + Source

          update_function(function, record)

          - Source + Source
          diff --git a/docs/stable/BadFunctionError.html b/docs/stable/BadFunctionError.html index 5c40a2c5d..24ffc5af2 100644 --- a/docs/stable/BadFunctionError.html +++ b/docs/stable/BadFunctionError.html @@ -29,7 +29,7 @@

          - Source + Source @@ -115,61 +115,61 @@

          Functions

          actual(record)

          - Source + Source

          actual(value, record)

          - Source + Source

          exception(args)

          - Source + Source

          exception(args, self)

          - Source + Source

          message(exception)

          - Source + Source

          new()

          - Source + Source

          new(opts)

          - Source + Source

          to_keywords(record)

          - Source + Source

          update(keywords, record)

          - Source + Source

          update_actual(function, record)

          - Source + Source
          diff --git a/docs/stable/Behaviour.html b/docs/stable/Behaviour.html index c20e5907e..a42786017 100644 --- a/docs/stable/Behaviour.html +++ b/docs/stable/Behaviour.html @@ -39,10 +39,10 @@

          use Behaviour @doc "Parses the given URL" - defcallback parse(uri_info :: URI.Info.t), do: URI.Info.t + defcallback parse(uri_info :: URI.Info.t) :: URI.Info.t @doc "Defines a default port" - defcallback default_port(), do: integer + defcallback default_port() :: integer end @@ -85,6 +85,11 @@

          Implementation

          Macros summary

          • + + defcallback/1 + +
          • +
          • defcallback/2 @@ -101,6 +106,12 @@

            Macros summary

            Macros

            +

            + defcallback(fun) +

            +
            + Source +

            defcallback(fun, list2)

            diff --git a/docs/stable/CaseClauseError.html b/docs/stable/CaseClauseError.html index 127001e4e..d45ae69ac 100644 --- a/docs/stable/CaseClauseError.html +++ b/docs/stable/CaseClauseError.html @@ -29,7 +29,7 @@

            - Source + Source @@ -115,61 +115,61 @@

            Functions

            actual(record)

            - Source + Source

            actual(value, record)

            - Source + Source

            exception(args)

            - Source + Source

            exception(args, self)

            - Source + Source

            message(exception)

            - Source + Source

            new()

            - Source + Source

            new(opts)

            - Source + Source

            to_keywords(record)

            - Source + Source

            update(keywords, record)

            - Source + Source

            update_actual(function, record)

            - Source + Source
            diff --git a/docs/stable/CompileError.html b/docs/stable/CompileError.html index f0d7b502c..64bbb0eab 100644 --- a/docs/stable/CompileError.html +++ b/docs/stable/CompileError.html @@ -29,7 +29,7 @@

            - Source + Source @@ -157,97 +157,97 @@

            Functions

            description(record)

            - Source + Source

            description(value, record)

            - Source + Source

            exception(args)

            - Source + Source

            exception(args, self)

            - Source + Source

            file(record)

            - Source + Source

            file(value, record)

            - Source + Source

            line(record)

            - Source + Source

            line(value, record)

            - Source + Source

            message(exception)

            - Source + Source

            new()

            - Source + Source

            new(opts)

            - Source + Source

            to_keywords(record)

            - Source + Source

            update(keywords, record)

            - Source + Source

            update_description(function, record)

            - Source + Source

            update_file(function, record)

            - Source + Source

            update_line(function, record)

            - Source + Source
            diff --git a/docs/stable/Enum.Iterator.Function.html b/docs/stable/Enum.Iterator.Function.html index 29c254865..60fee1252 100644 --- a/docs/stable/Enum.Iterator.Function.html +++ b/docs/stable/Enum.Iterator.Function.html @@ -29,7 +29,7 @@

            - Source + Source diff --git a/docs/stable/Enum.Iterator.List.html b/docs/stable/Enum.Iterator.List.html index 2c3a4cd46..2512817e3 100644 --- a/docs/stable/Enum.Iterator.List.html +++ b/docs/stable/Enum.Iterator.List.html @@ -29,7 +29,7 @@

            - Source + Source diff --git a/docs/stable/Enum.OutOfBoundsError.html b/docs/stable/Enum.OutOfBoundsError.html index b0d788706..449c27827 100644 --- a/docs/stable/Enum.OutOfBoundsError.html +++ b/docs/stable/Enum.OutOfBoundsError.html @@ -29,7 +29,7 @@

            - Source + Source @@ -110,55 +110,55 @@

            Functions

            exception(args)

            - Source + Source

            exception(args, self)

            - Source + Source

            message(record)

            - Source + Source

            message(value, record)

            - Source + Source

            new()

            - Source + Source

            new(opts)

            - Source + Source

            to_keywords(record)

            - Source + Source

            update(keywords, record)

            - Source + Source

            update_message(function, record)

            - Source + Source
            diff --git a/docs/stable/Enum.html b/docs/stable/Enum.html index 2e3b6006b..53044e9ad 100644 --- a/docs/stable/Enum.html +++ b/docs/stable/Enum.html @@ -153,17 +153,22 @@

            Functions summary

          • - qsort/1 + reduce/3
          • - reduce/3 + reverse/1
          • - reverse/1 + sort/1 + +
          • +
          • + + sort/2
          • @@ -186,6 +191,11 @@

            Functions summary

            take_while/2
          • +
          • + + uniq/1 + +
          • zip/2 @@ -204,9 +214,7 @@

            Functions summary

            Functions

            - all?(collection, fun // fn x -> - x -end) + all?(collection, fun // fn x -> x end)

            Invokes the given fun for each item in the collection and returns true if each invocation returns true as well, otherwise it short-circuits and returns @@ -231,9 +239,7 @@

            Examples

            Source

            - any?(collection, fun // fn x -> - x -end) + any?(collection, fun // fn x -> x end)

            Invokes the given fun for each item in the collection and returns true if at least one invocation returns true. Returns false otherwise.

            @@ -296,8 +302,8 @@

            Examples

            drop(collection, count)

            -

            Drops the first count items from the collection. Expects an ordered -collection.

            +

            Drops the first count items from the collection. +Expects an ordered collection.

            Examples

            @@ -320,7 +326,7 @@

            Examples

            #=> [3,4,5]
            - Source + Source

            each(collection, fun) @@ -333,7 +339,7 @@

            Examples

            Enum.each ['some', 'example'], fn(x) -> IO.puts x end
             
            - Source + Source

            empty?(collection) @@ -346,7 +352,7 @@

            Examples

            Enum.empty? [1,2,3] #=> false
            - Source + Source

            filter(collection, fun) @@ -360,7 +366,7 @@

            Examples

            #=> [2]
            - Source + Source

            filter_map(collection, filter, mapper) @@ -373,7 +379,7 @@

            Examples

            #=> [4]
            - Source + Source

            find(collection, ifnone // nil, fun) @@ -393,7 +399,7 @@

            Examples

            #=> 3
            - Source + Source

            find_index(collection, fun) @@ -412,7 +418,7 @@

            Examples

            #=> 2
            - Source + Source

            find_value(collection, ifnone // nil, fun) @@ -429,7 +435,7 @@

            Examples

            #=> true
            - Source + Source

            first(collection) @@ -442,7 +448,7 @@

            Examples

            Enum.first [1,2,3] #=> 1
            - Source + Source

            join(collection, joiner // "") @@ -463,7 +469,7 @@

            Examples

            Enum.join([1,2,3], ' = ') #=> '1 = 2 = 3'
            - Source + Source

            map(collection, fun) @@ -481,7 +487,7 @@

            Examples

            #=> [a: -1, b: -2]
            - Source + Source

            map_join(collection, joiner // "", mapper) @@ -502,7 +508,7 @@

            Examples

            Enum.map_join([1,2,3], ' = ', &1 * 2) #=> '2 = 4 = 6'
            - Source + Source

            map_reduce(collection, acc, f) @@ -521,7 +527,7 @@

            Examples

            #=> { [2, 4, 6], 6 }
            - Source + Source

            partition(collection, fun) @@ -536,19 +542,7 @@

            Examples

            #=> { [2], [1,3] }
            - Source -
            -

            - qsort(collection) -

            -

            Sorts the collection according to the quick sort algorithm.

            - -

            Examples

            - -
            Enum.qsort [3,2,1] #=> [1,2,3]
            -
            -
            - Source + Source

            reduce(collection, acc, fun) @@ -563,7 +557,7 @@

            Examples

            #=> 6
            - Source + Source

            reverse(collection) @@ -576,16 +570,43 @@

            Examples

            #=> [3, 2, 1]
            - Source + Source +
            +

            + sort(collection) +

            +

            Sorts the collection using the merge sort algorithm.

            + +

            Examples

            + +
            Enum.sort [3,2,1] #=> [1,2,3]
            +
            +
            + Source +
            +

            + sort(collection, fun) +

            +

            Sorts the collection using the merge sort algorithm.

            + +

            Examples

            + +
            Enum.sort [3,2,1], &1 > &2 #=> [1,2,3]
            +
            +
            + Source

            split(collection, count)

            -

            Splits the enumerable into two collections, leaving count elements in the -first one. If count is a negative number, it starts couting from the back -to the beginning of the collection. Be aware that a negative count -implies in an iteration through the whole collection. -Expects an ordered collection.

            +

            Splits the enumerable into two collections, leaving count +elements in the first one. If count is a negative number, +it starts couting from the back to the beginning of the +collection.

            + +

            Be aware that a negative count implies the collection +will be iterate twice. One to calculate the position and +another one to do the actual splitting.

            Examples

            @@ -596,7 +617,7 @@

            Examples

            Enum.split [1,2,3], -5 #=> { [], [1,2,3] }
            - Source + Source

            split_while(collection, fun) @@ -610,7 +631,7 @@

            Examples

            #=> { [1], [2, 3, 4] }
            - Source + Source

            take(collection, count) @@ -625,7 +646,7 @@

            Examples

            Enum.take [1,2,3], 0 #=> []
            - Source + Source

            take_while(collection, fun) @@ -639,7 +660,20 @@

            Examples

            #=> [1, 2]
            - Source + Source +
            +

            + uniq(collection) +

            +

            Iterates the enumerable removing all duplicated items.

            + +

            Examples

            + +
            Enum.uniq [1,2,3,2,1]
            +#=> [1, 2, 3]
            +
            +
            + Source

            zip(coll1, coll2) @@ -649,7 +683,7 @@

            Examples

            dictated by the first enum. In case the second list is shorter, values are filled with nil.

            - Source + Source diff --git a/docs/stable/ErlangError.html b/docs/stable/ErlangError.html index 19e722328..9e35e5f11 100644 --- a/docs/stable/ErlangError.html +++ b/docs/stable/ErlangError.html @@ -29,7 +29,7 @@

            - Source + Source @@ -115,61 +115,61 @@

            Functions

            exception(args)

            - Source + Source

            exception(args, self)

            - Source + Source

            message(exception)

            - Source + Source

            new()

            - Source + Source

            new(opts)

            - Source + Source

            original(record)

            - Source + Source

            original(value, record)

            - Source + Source

            to_keywords(record)

            - Source + Source

            update(keywords, record)

            - Source + Source

            update_original(function, record)

            - Source + Source
            diff --git a/docs/stable/ExUnit.Assertions.html b/docs/stable/ExUnit.Assertions.html index 344ccbefa..f78aff867 100644 --- a/docs/stable/ExUnit.Assertions.html +++ b/docs/stable/ExUnit.Assertions.html @@ -153,7 +153,7 @@

            Examples

            assert false, "it will never be true"
             
            - Source + Source

            assert_in_delta(expected, received, delta, message // nil) @@ -166,7 +166,7 @@

            Examples

            assert_in_delta 10, 15, 4
            - Source + Source

            assert_raise(exception, function) @@ -181,7 +181,7 @@

            Examples

            end
            - Source + Source

            assert_raise(exception, message, function) @@ -196,7 +196,7 @@

            Examples

            end
            - Source + Source

            flunk(message // "Epic Fail!") @@ -208,7 +208,7 @@

            Examples

            flunk "This should raise an error"
             
            - Source + Source

            refute(not_expected, message) @@ -221,7 +221,7 @@

            Examples

            refute true, "This will obviously fail"
             
            - Source + Source

            refute_in_delta(expected, received, delta, message // nil) @@ -234,7 +234,7 @@

            Examples

            refute_in_delta 10, 11, 2
            - Source + Source @@ -282,7 +282,7 @@

            Examples

            assert_received { :hello, _ } - Source + Source

            catch_error(expression) @@ -295,7 +295,7 @@

            Examples

            assert catch_error(error 1) == 1
             
            - Source + Source

            catch_exit(expression) @@ -308,7 +308,7 @@

            Examples

            assert catch_exit(exit 1) == 1
             
            - Source + Source

            catch_throw(expression) @@ -321,7 +321,7 @@

            Examples

            assert catch_throw(throw 1) == 1
             
            - Source + Source

            refute(expected) @@ -352,7 +352,7 @@

            Examples

            refute_received :bye
            - Source + Source diff --git a/docs/stable/ExUnit.html b/docs/stable/ExUnit.html index a351ff27d..24d2d817b 100644 --- a/docs/stable/ExUnit.html +++ b/docs/stable/ExUnit.html @@ -98,6 +98,11 @@

            Functions summary

            start/1
          • +
          • + + user_options/1 + +
          @@ -116,7 +121,7 @@

          Functions

          Register a callback to be invoked every time a new ExUnit process is spawned.

          - Source + Source

          configure(options) @@ -132,7 +137,7 @@

          Options

        • :max_cases - Maximum number of cases to run in parallel
        - Source + Source

        run() @@ -140,7 +145,7 @@

        Options

        API used to run the tests. A developer does not need to call it directly.

        - Source + Source

        start(options // []) @@ -168,6 +173,13 @@

        User config example (~/.ex_unit.exs)

        [formatter: ExUnit.Formatter.ANSI]

        Source +
        +

        + user_options(user_config // nil) +

        +

        Returns the configured user options.

        +
        + Source
        diff --git a/docs/stable/Exception.html b/docs/stable/Exception.html index 98fc0b6a8..5bcbc93ab 100644 --- a/docs/stable/Exception.html +++ b/docs/stable/Exception.html @@ -43,6 +43,11 @@

        Functions summary

        • + + env_stacktrace/1 + +
        • +
        • format_file_line/1 @@ -79,20 +84,27 @@

          Functions summary

          Functions

          +

          + env_stacktrace(env) +

          +

          Returns a formatted stacktrace from the environment.

          +
          + Source +

          format_file_line(file_line)

          Formats file and line information present in stacktraces. Expect them to be given in a keyword list.

          - Source + Source

          format_file_line(file, line)

          Formats the given file and line.

          - Source + Source

          format_module_fun_arity(module, fun, arity) @@ -108,10 +120,10 @@

          Functions

          Formats each line in the stacktrace.

          - Source + Source

          - formatted_stacktrace(trace // System.stacktrace()) + formatted_stacktrace(trace // nil)

          Returns the stacktrace as a binary formatted as per format_stacktrace/1.

          diff --git a/docs/stable/File.html b/docs/stable/File.html index 6d223ea38..0b0d4f556 100644 --- a/docs/stable/File.html +++ b/docs/stable/File.html @@ -97,6 +97,21 @@

          Functions summary

          basename/2
        • +
        • + + biniterator/1 + +
        • +
        • + + biniterator/2 + +
        • +
        • + + biniterator!/2 + +
        • cd/1 @@ -413,6 +428,32 @@

          Examples

          Source +
          +

          + biniterator(device) +

          +

          Converts the file device into an iterator that can +be passed into Enum to iterate line by line as a +binary. Check iterator/1 for more information.

          +
          + Source +
          +

          + biniterator(file, mode) +

          +

          Opens the given file with the given mode and +returns its biniterator. Fails for the same reasons +as File.open.

          +
          + Source +
          +

          + biniterator!(file, mode // []) +

          +

          Same as biniterator/2 but raises if the file +cannot be opened.

          +
          + Source

          cd(path) @@ -481,9 +522,7 @@

          Examples

          Source

          - cp(source, destination, callback // fn _, _ -> - true -end) + cp(source, destination, callback // fn _, _ -> true end)

          Copies the contents in source to destination. Similar to the command cp -r in Unix systems, @@ -506,9 +545,7 @@

          Examples

          Source

          - cp!(source, destination, callback // fn _, _ -> - true -end) + cp!(source, destination, callback // fn _, _ -> true end)

          The same as cp/3, but raises File.CopyError if it fails. Returns the list of copied files otherwise.

          @@ -516,9 +553,7 @@

          Examples

          Source

          - cp_r(source, destination, callback // fn _, _ -> - true -end) + cp_r(source, destination, callback // fn _, _ -> true end)

          Copies the contents in source to destination. Similar to the command cp -r in Unix systems, @@ -568,9 +603,7 @@

          Examples

          Source

          - cp_r!(source, destination, callback // fn _, _ -> - true -end) + cp_r!(source, destination, callback // fn _, _ -> true end)

          The same as cp_r/3, but raises File.CopyError if it fails. Returns the list of copied files otherwise.

          @@ -693,10 +726,12 @@

          Examples

          iterator(device)

          -

          Convert the file device into an iterator that can be +

          Converts the file device into an iterator that can be passed into Enum. The device is iterated line -by line lazily, at the end of iteration the file is -closed.

          +by line, at the end of iteration the file is closed.

          + +

          This reads the file as utf-8. CHeck out File.biniterator +to handle the file as a raw binary.

          Examples

          @@ -712,7 +747,7 @@

          Examples

          end
          - Source + Source

          iterator(file, mode) @@ -721,7 +756,7 @@

          Examples

          returns its iterator. Fails for the same reasons as File.open.

          - Source + Source

          iterator!(file, mode // []) @@ -729,7 +764,7 @@

          Examples

          Same as iterator/2 but raises if the file cannot be opened.

          - Source + Source

          join(paths) diff --git a/docs/stable/FunctionClauseError.html b/docs/stable/FunctionClauseError.html index 558807f47..a8169c45e 100644 --- a/docs/stable/FunctionClauseError.html +++ b/docs/stable/FunctionClauseError.html @@ -29,7 +29,7 @@

          - Source + Source @@ -157,97 +157,97 @@

          Functions

          arity(record)

          - Source + Source

          arity(value, record)

          - Source + Source

          exception(args)

          - Source + Source

          exception(args, self)

          - Source + Source

          function(record)

          - Source + Source

          function(value, record)

          - Source + Source

          message(exception)

          - Source + Source

          module(record)

          - Source + Source

          module(value, record)

          - Source + Source

          new()

          - Source + Source

          new(opts)

          - Source + Source

          to_keywords(record)

          - Source + Source

          update(keywords, record)

          - Source + Source

          update_arity(function, record)

          - Source + Source

          update_function(function, record)

          - Source + Source

          update_module(function, record)

          - Source + Source
          diff --git a/docs/stable/IEx.Helpers.html b/docs/stable/IEx.Helpers.html index 16e20fb2d..6826188c8 100644 --- a/docs/stable/IEx.Helpers.html +++ b/docs/stable/IEx.Helpers.html @@ -40,13 +40,15 @@

          • c/2 - compiles a file in the given path
          • -
          • h/0,h/1, h/2 - prints help/documentation
          • -
          • t/1, t/3 — prints type information
          • -
          • s/1, s/3 — prints spec information
          • +
          • h/0, h/1 - prints help/documentation
          • +
          • t/1 — prints type information
          • +
          • s/1 — prints spec information
          • m/0 - prints loaded modules
          • -
          • r/0 - recompiles and reloads the given module's source file
          • +
          • r/0, r/1 - recompiles and reloads the given module's source file
          • +
          • l/1 - loads given module beam code by purging the current version
          • v/0 - prints all commands and values
          • v/1 - retrieves nth value from console
          • +
          • flush/0 — flush all messages sent to the shell

          Help for functions in this module can be consulted @@ -81,17 +83,17 @@

          Functions summary

        • - h/0 + flush/0
        • - h/2 + h/0
        • - h/3 + l/1
        • @@ -109,11 +111,6 @@

          Functions summary

          r/1
        • -
        • - - s/3 - -
        • v/0 @@ -169,45 +166,35 @@

          Examples

          #=> Foo - Source + Source
          -

          - h() +

          + flush()

          -

          Shows the documentation for IEx.Helpers.

          +

          Flushes all messages sent to the shell and prints them out

          - Source + Source
          -

          - h(function, arity) +

          + h()

          -

          Prints the documentation for the given function and arity.

          - -

          The function may either be a function defined inside IEx.Helpers -or in Kernel. To see functions from other module, use -h/3 instead.

          - -

          Examples

          - -
          h(:h, 2)
          -#=> Prints documentation for this function
          -
          +

          Shows the documentation for IEx.Helpers.

          - Source + Source
          -

          - h(module, function, arity) +

          + l(module)

          -

          Shows the documentation for the function/arity in module.

          +

          Purges and reloads specified module

          - Source + Source

          m()

          Returns the name and module of all modules loaded.

          - Source + Source

          r() @@ -215,7 +202,7 @@

          Examples

          Reloads all modules that were already reloaded at some point with r/1.

          - Source + Source

          r(module) @@ -225,27 +212,14 @@

          Examples

          Please note that all the modules defined in the specified files are recompiled and reloaded.

          - Source -
          -

          - s(module, function, arity) -

          -

          Prints the specs for a given function.

          - -

          Examples

          - -
          s(Enum.all?/2)
          -s(Enum.t/0)
          -
          -
          - Source + Source

          v()

          Prints commands history and their result.

          - Source + Source

          v(n) @@ -254,7 +228,7 @@

          Examples

          values to lookup query's value from latest to earliest. For instance, v(-1) returns the latest result.

          - Source + Source
          @@ -280,9 +254,10 @@

          Examples

          h receive/1
           h Enum.all?/2
          +h Enum.all?
           
          - Source + Source

          s(module) @@ -292,9 +267,13 @@

          Examples

          Examples

          s(Enum)
          +s(Enum.all?)
          +s(Enum.all?/2)
          +s(list_to_atom)
          +s(list_to_atom/1)
           
          - Source + Source

          t(module) @@ -306,9 +285,10 @@

          Examples

          t(Enum)
           t(Enum.t/0)
          +t(Enum.t)
           
          - Source + Source diff --git a/docs/stable/IEx.html b/docs/stable/IEx.html index 1144a089b..e59273ac1 100644 --- a/docs/stable/IEx.html +++ b/docs/stable/IEx.html @@ -27,15 +27,18 @@

          -

          This module implements interactive Elixir. It provides a main -function, start which will either delegate to tty or simple. -The former is meant for systems where tty is available and relies -on it in order to work properly. This makes all control commands -available in tty available to the developer.

          +

          This module implements Interactive Elixir.

          -

          In case tty is not available (for example, Windows), a -developer may invoke simple which starts a stripped -down version.

          +

          The interactive elixir needs to be set as the +proper -user when starting the Erlang VM and +so can be done with the help of IEx.CLI.

          + +

          If possible, Elixir will start a tty (smart terminal) +which makes all control commands available in tty +available to the developer.

          + +

          In case tty is not available (for example, Windows), +a dumb terminal version is started instead.

          @@ -59,11 +62,6 @@

          Functions summary

          after_spawn/1
        • -
        • - - cli/0 - -
        • inspect_opts/0 @@ -76,22 +74,7 @@

          Functions summary

        • - preload/0 - -
        • -
        • - - run/1 - -
        • -
        • - - simple/1 - -
        • -
        • - - tty/1 + started?/0
        • @@ -111,68 +94,35 @@

          Functions

          Returns registered after spawn callbacks.

          - Source + Source

          after_spawn(fun)

          -

          Registers a function to be invoked after IEx -process is spawned. Requires IEx.preload to -be invoked.

          -
          - Source -
          -

          - cli() -

          -

          Interface to start IEx from CLI.

          +

          Registers a function to be invoked after IEx process is spawned.

          - Source + Source

          inspect_opts()

          Returns currently registered inspect options.

          - Source + Source

          inspect_opts(opts)

          Registers options used on inspect.

          - Source -
          -

          - preload() -

          -

          Simply loads IEx application. Most of the times it is -preloaded on demand, but if you want to pre-configure -IEx, you need to preload it.

          -
          - Source -
          -

          - run(opts // []) -

          -

          Runs IEx checking if tty is available or not. -If so, invoke tty, otherwise go with the simple iex.

          -
          - Source -
          -

          - simple(opts // []) -

          -

          Starts IEx simply using the current stdio.

          -
          - Source + Source
          -

          - tty(opts // []) +

          + started?()

          -

          Starts IEx using a tty server.

          +

          Returns true if IEx was properly started.

          - Source + Source
          diff --git a/docs/stable/Kernel.CLI.html b/docs/stable/Kernel.CLI.html new file mode 100644 index 000000000..aa4b3f9b3 --- /dev/null +++ b/docs/stable/Kernel.CLI.html @@ -0,0 +1,93 @@ + + + + Kernel.CLI + + + + + + + + + + + + +
          +

          + Kernel.CLI + +

          + + +
          +

          Module responsible for controlling Elixir's CLI

          + +
          + + + Source + + + + + + +

          Functions summary

          + + + + + + + + +
          +

          Functions

          +
          +

          + run(fun, halt // true) +

          +

          Runs the given function by catching any failure +and printing them to stdout. at_exit hooks are +also invoked before exiting.

          + +

          This function is used by Elixir's CLI and also +by escripts generated by Elixir.

          +
          + Source +
          +

          + wait_until_finished() +

          +

          Wait until the CLI finishes procesing options.

          +
          + Source +
          +
          + + + + + +
          + + diff --git a/docs/stable/Kernel.SpecialForms.html b/docs/stable/Kernel.SpecialForms.html index eb539af75..76031fe6e 100644 --- a/docs/stable/Kernel.SpecialForms.html +++ b/docs/stable/Kernel.SpecialForms.html @@ -291,7 +291,7 @@

          Examples

          end -

          In the example above, we have set up MyOrdict to be alias +

          In the example above, we have set up MyKeyword to be alias as Keyword. So now, any reference to Keyword will be automatically replaced by MyKeyword.

          @@ -542,7 +542,7 @@

          Hygiene

          a = 10 NoHygiene.interference -a #=> 11 +a #=> 1

          Notice that aliases are not hygienic in Elixir, ambiguity diff --git a/docs/stable/Kernel.Typespec.html b/docs/stable/Kernel.Typespec.html index 8c1e96032..111ff35ad 100644 --- a/docs/stable/Kernel.Typespec.html +++ b/docs/stable/Kernel.Typespec.html @@ -33,6 +33,86 @@

          @callback available in modules are handled by the equivalent macros defined by this module.

          +

          Defining a type

          + +

          @type typename :: type +@typep typename :: type +@opaque type_name :: type

          + +

          For more details, see documentation for deftype, deftypep and defopaque in +Kernel.Typespec

          + +

          Defining a specification

          + +

          @spec functionname(type, type) :: type +@callback functionname(type, type) :: type

          + +

          For more details, see documentation for defspec and defcallback in +Kernel.Typespec

          + +

          Types

          + +

          The type syntax provided by Elixir is fairly similar to the one +in Erlang.

          + +

          Most of the built-in types provided in Erlang (for example, pid()) +are expressed the same way: pid() or simply pid. Parametrized types +are also supported: list(integer()) and so are remote types: Enum.t.

          + +

          Certain data type shortcuts ([...], <<>> and {...}) are supported as well.

          + +

          Main differences lie in how bit strings and functions are defined:

          + +

          Bit Strings

          + +

          Bit string with a base size of 3:

          + +
          <<_ :: 3>>
          +
          + +

          Bit string with a unit size of 8:

          + +
          <<_ :: _ * 8>>
          +
          + +

          Functions

          + +

          Any function:

          + +
          (fun(...) -> any)
          +or
          +((...) -> any)
          +or
          +(... -> any)
          +
          + +

          Function with arity of zero:

          + +
          (fun() -> type)
          +or
          +(() -> type)
          +
          + +

          Function with some arity:

          + +
          (fun(type, type) -> type)
          +or
          +((type, type) -> type)
          +or
          +(type, type -> type)
          +
          + +

          Notes

          + +

          Elixir discourages the use of type string() as it might be confused +with binaries which are referred to as "strings" in Elixir (as opposed to +character lists). In order to use the type that is called string() in Erlang, +one has to use the char_list() type which is a synonym to string(). If yu +use string(), you'll get a warning from the compiler.

          + +

          If you want to refer to the "string" type (the one operated by functions in the +String module), use String.t() type instead.

          +

          See http://www.erlang.org/doc/reference_manual/typespec.html for more information.

          @@ -95,7 +175,7 @@

          Functions summary

        • - spec_to_ast/1 + spec_to_ast/2
        • @@ -112,7 +192,7 @@

          Macros summary

        • - Source + Source

          beam_specs(module) @@ -169,7 +249,7 @@

          Functions

          The module has to have a corresponding beam file on the file system.

          - Source + Source

          beam_types(module) @@ -182,28 +262,28 @@

          Functions

          The module has to have a corresponding beam file on the file system.

          - Source + Source

          define_callback(module, tuple, definition)

          Defines a callback by receiving Erlang's typespec.

          - Source + Source

          define_spec(module, tuple, definition)

          Defines a spec by receiving Erlang's typespec.

          - Source + Source

          define_type(module, kind, type)

          Defines a type, typep or opaque by receiving Erlang's typespec.

          - Source + Source

          defines_callback?(module, name, arity) @@ -211,7 +291,7 @@

          Functions

          Returns true if the current module defines a callback. This function is only available for modules being compiled.

          - Source + Source

          defines_spec?(module, name, arity) @@ -219,7 +299,7 @@

          Functions

          Returns true if the current module defines a given spec. This function is only available for modules being compiled.

          - Source + Source

          defines_type?(module, name, arity) @@ -228,22 +308,21 @@

          Functions

          (private, opaque or not). This function is only available for modules being compiled.

          - Source + Source
          -

          - spec_to_ast(arg1) +

          + spec_to_ast(name, arg2)

          -

          Converts a spec clause back to Elixir AST. -Returns a 2-items tuple with the spec arguments and return result.

          +

          Converts a spec clause back to Elixir AST.

          - Source + Source

          type_to_ast(arg1)

          Converts a type clause back to Elixir AST.

          - Source + Source
          @@ -252,18 +331,18 @@

          Functions

          Macros

          -

          - defcallback(spec, block) +

          + defcallback(spec)

          Defines a callback. This macro is the one responsible to handle the attribute @callback.

          Examples

          -
          @callback add(number, number), do: number
          +
          @callback add(number, number) :: number
           
          - Source + Source

          defopaque(type) @@ -276,20 +355,20 @@

          Examples

          @opaque my_type :: atom
           
          - Source + Source
          -

          - defspec(spec, block) +

          + defspec(spec)

          Defines a spec. This macro is the one responsible to handle the attribute @spec.

          Examples

          -
          @spec add(number, number), do: number
          +
          @spec add(number, number) :: number
           
          - Source + Source

          deftype(type) @@ -302,7 +381,7 @@

          Examples

          @type my_type :: atom
           
          - Source + Source

          deftypep(type) @@ -315,7 +394,7 @@

          Examples

          @typep my_type :: atom
           
          - Source + Source diff --git a/docs/stable/Kernel.html b/docs/stable/Kernel.html index fdd6d4f40..66ef54248 100644 --- a/docs/stable/Kernel.html +++ b/docs/stable/Kernel.html @@ -301,6 +301,11 @@

          Functions summary

          list_to_tuple/1 +
        • + + macro_exported?/3 + +
        • make_ref/0 @@ -1079,7 +1084,7 @@

          Examples

          it is not loaded. Check Code.ensure_loaded/1 for more information.

          - Source + Source

          hd(list) @@ -1414,6 +1419,18 @@

          Examples

          Source +
          +

          + macro_exported?(module, macro, arity) +

          +

          Returns true if the module is loaded and contains a +public macro with the given arity, otherwise false.

          + +

          Notice that this function does not load the module in case +it is not loaded. Check Code.ensure_loaded/1 for more +information.

          +
          + Source

          make_ref() @@ -1517,7 +1534,7 @@

          Examples

          end
          - Source + Source

          raise(exception, args) @@ -1531,14 +1548,18 @@

          Examples

          Any module defined via defexception automatically defines exception(args) that returns a new instance of the record and a exception(args, current) that -works as no-op.

          +updates the current exception.

          + +

          Re-raising an exception will retrieve the previous +stacktrace so it keps the properties of the original +exception.

          Examples

          raise ArgumentError, message: "Sample"
           
          - Source + Source

          round(number) @@ -1789,7 +1810,7 @@

          Examples

          this operator accepts any expression as arguments, not only booleans, however it is not allowed in guards.

          - Source + Source

          *(left, right) @@ -1874,7 +1895,7 @@

          Examples

          3 in 1..3 #=> true
          - Source + Source

          /(left, right) @@ -1909,8 +1930,26 @@

          Examples

          Enum.map(List.flatten([1,[2],3]), &1 * 2)
           
          + +

          Please be aware of operator precendence, when using +this operator. For example, the following expression:

          + +
          String.graphemes "Hello" /> Enum.reverse
          +
          + +

          Is translated to:

          + +
          String.graphemes("Hello" /> Enum.reverse)
          +
          + +

          Which will result in an error as Enum.Iterator protocol +is not defined for binaries. Adding explicit parenthesis +is recommended:

          + +
          String.graphemes("Hello") /> Enum.reverse
          +
          - Source + Source

          <(left, right) @@ -1972,7 +2011,7 @@

          Examples

          x #=> "bar"
          - Source + Source

          ==(left, right) @@ -2025,7 +2064,7 @@

          Examples

          "abcd" =~ %r/e/ #=> nil
          - Source + Source

          >(left, right) @@ -2101,7 +2140,7 @@

          Examples

          time and not at runtime. Check the module Module for other functions to manipulate module attributes.

          - Source + Source

          __B__(string, list2) @@ -2115,7 +2154,7 @@

          Examples

          %B(f#{o}o) #=> "f\#{o}o"
          - Source + Source

          __C__(arg1, list2) @@ -2129,7 +2168,7 @@

          Examples

          %C(f#{o}o) #=> 'f\#{o}o'
          - Source + Source

          __R__(arg1, options) @@ -2142,7 +2181,7 @@

          Examples

          Regex.match? %R(f#{1,3}o), "f#o"  #=> true
           
          - Source + Source

          __b__(arg1, list2) @@ -2156,7 +2195,7 @@

          Examples

          %b(f#{:o}o) #=> "foo"
          - Source + Source

          __c__(arg1, list2) @@ -2170,7 +2209,7 @@

          Examples

          %c(f#{:o}o) #=> 'foo'
          - Source + Source

          __r__(arg1, options) @@ -2182,7 +2221,7 @@

          Examples

          Regex.match? %r(foo), "foo"  #=> true
           
          - Source + Source

          access(element, args) @@ -2256,7 +2295,7 @@

          Examples

          access a, 1 #=> :a
          - Source + Source

          and(left, right) @@ -2283,7 +2322,7 @@

          Examples

          atom_to_binary :my_atom #=> "my_atom"
           
          - Source + Source

          binary_to_atom(some_binary) @@ -2296,7 +2335,7 @@

          Examples

          binary_to_atom "my_atom" #=> :my_atom
           
          - Source + Source

          binary_to_existing_atom(some_binary) @@ -2309,7 +2348,7 @@

          Examples

          binary_to_existing_atom "my_atom" #=> :my_atom
          - Source + Source

          binary_to_float(some_binary) @@ -2321,7 +2360,7 @@

          Examples

          binary_to_float "2.2017764e+0" #=> 2.2017764
           
          - Source + Source

          binary_to_integer(some_binary) @@ -2333,7 +2372,7 @@

          Examples

          binary_to_integer "123" #=> 123
           
          - Source + Source

          binary_to_integer(some_binary, base) @@ -2346,7 +2385,7 @@

          Examples

          binary_to_integer("3FF", 16) #=> 1023
           
          - Source + Source

          case(condition, blocks) @@ -2399,7 +2438,7 @@

          Examples

          end
          - Source + Source

          cond(list1) @@ -2419,7 +2458,7 @@

          Examples

          end
          - Source + Source

          def(name, list2) @@ -2579,7 +2618,7 @@

          Examples

          #=> [3,2,1]
          - Source + Source

          defexception(name, fields, opts // [], do_block // []) @@ -2590,11 +2629,12 @@

          Examples

          the same API and similar behavior to defrecord/4 with two notable differences:

          -

          1) Differently from records, exceptions are documented by default; -2) Exceptions must implement message/1 as API that return a +

          1) Differently from records, exceptions are documented by default;

          + +

          2) Exceptions must implement message/1 as API that return a binary as result;

          - Source + Source

          defimpl(name, opts, do_block // []) @@ -2602,7 +2642,7 @@

          Examples

          Defines an implementation for the given protocol. See defprotocol/2 for examples.

          - Source + Source

          defmodule(name, list2) @@ -2659,7 +2699,7 @@

          Dynamic names

          An overridable function is lazily defined, allowing a developer to customize it.

          - Source + Source

          defp(name, list2) @@ -2808,7 +2848,7 @@

          Types

          As in records, defining a protocol automatically defines a type named t, which can be used as:

          -
          @spec present?(Blank.t), do: boolean
          +
          @spec present?(Blank.t) :: boolean
           def present?(blank) do
             not Blank.blank?(blank)
           end
          @@ -2817,7 +2857,7 @@ 

          Types

          The @spec above expresses that all types allowed to implement the given protocol are valid argument types for the given function.

          - Source + Source

          defrecord(name, fields, opts // [], do_block // []) @@ -2831,7 +2871,7 @@

          Types

          Examples

          -
          defrecord FileInfo, atime: nil, mtime: nil
          +
          defrecord FileInfo, atime: nil, accesses: 0
           

          The line above will define a module named FileInfo which @@ -2851,42 +2891,56 @@

          Examples

          #=> { FileInfo, nil, nil }
          -

          Extensions

          - -

          Besides defining readers and writers for each attribute. Elixir will -define extensions functions for each attribute. By default, it will -define an update_#{attribute} function to update the value. Such +

          Besides defining readers and writers for each attribute, Elixir also +defines an update_#{attribute} function to update the value. Such functions expect a function as argument that receives the current -value and must return the new one:

          +value and must return the new one. For example, every time the file +is accessed, the accesses counter can be incremented with:

          -
          file_info.update_atime(fn(_old) -> now() end) #=> Updates the value of atime
          +
          file_info.update_accesses(fn(old) -> old + 1 end)
           
          -

          Besides, Elixir may define new functions depending on the default value. -For example, ExUnit defines a record which keeps track of how many tests -were executed and the failures that happened. The record definition is -similar to:

          +

          Which can be also written as:

          -
          defrecord Config, counter: 0, failures: []
          +
          file_info.update_accesses(&1 + 1)
           
          -

          Since counter is an integer, Elixir automatically defines a helper -named increment_counter that will increase the counter value:

          +

          Access syntax

          + +

          Records in Elixir can be expanded at compilation time to provide +pattern matching and faster operations. For example, the clause +below will only match if a FileInfo is given and the number of +accesses is zero:

          -
          Config.new.increment_counter.counter #=> 1
          +
          def enforce_no_access(FileInfo[accesses: 0]), do: :ok
           
          -

          increment_counter also accepts a number of increment as argument:

          +

          The clause above will expand to:

          -
          Config.new.increment_counter(10).counter #=> 10
          +
          def enforce_no_access({ FileInfo, _, 0 }), do: :ok
           
          -

          Besides, if the default is a list, Elixir will define two helpers:

          +

          The downside of using such syntax is that, every time the record +changes, your code now needs to be recompiled (which is usually +not a concern since Elixir build tools by default recompiles the +whole project whenever there is a change).

          -
            -
          • merge_field - Receives keywords and merge it into the current value;
          • -
          • prepend_field - Receives another list and prepend its values;
          • -
          +

          Finally, keep in mind that Elixir triggers some optimizations whenever +the access syntax is used. For example:

          + +
          def no_access?(FileInfo[] = file_info) do
          +  file_info.accesses == 0
          +end
          +
          + +

          Is translated to:

          + +
          def no_access?({ FileInfo, _, _ } = file_info) do
          +  elem(file_info, 1) == 0
          +end
          +
          + +

          Which provides faster get and set times for record operations.

          Documentation

          @@ -2898,7 +2952,7 @@

          Types

          For example, assuming the Config record defined above, it could be used in typespecs as follow:

          -
          @spec handle_config(Config.t), do: boolean()
          +
          @spec handle_config(Config.t) :: boolean()
           

          Inside the record definition, a developer can define his own types too:

          @@ -2912,7 +2966,7 @@

          Types

          When defining a type, all the fields not mentioned in the type are assumed to have type term.

          - Source + Source

          defrecordp(name, fields) @@ -2960,7 +3014,7 @@

          Examples

          name #=> "José"
          - Source + Source

          destructure(left, right) @@ -3001,7 +3055,7 @@

          Examples

          the first value from the right side. Otherwise, it will raise a CaseClauseError.

          - Source + Source

          div(left, right) @@ -3015,7 +3069,7 @@

          Examples

          div 5, 2 #=> 2
           
          - Source + Source

          elem(tuple, index) @@ -3031,7 +3085,7 @@

          Example

          elem(tuple, 1) #=> :bar
          - Source + Source

          float_to_binary(some_float) @@ -3044,7 +3098,7 @@

          Examples

          float_to_binary 7.0 #=> "7.00000000000000000000e+00"
           
          - Source + Source

          function(args) @@ -3088,29 +3142,29 @@

          Shortcut syntax

          do/end always matches the furthest call, if we used the function macro as below:

          -
          Enum.map [1,2,3], function(x) do
          -  x * 2
          +
          Enum.map [1,2,3], function do
          +  x -> x * 2
           end
           

          It would be parsed as:

          -
          Enum.map([1,2,3], function(x)) do
          -  x * 2
          +
          Enum.map([1,2,3], function) do
          +  x -> x * 2
           end
           

          The stab shortcut syntax has the proper precedence:

          -
          Enum.map [1,2,3], fn x ->
          -  x * 2
          +
          Enum.map [1,2,3], fn
          +  x -> x * 2
           end
           

          Which is handled as:

          -
          Enum.map([1,2,3], fn x ->
          -  x * 2
          +
          Enum.map([1,2,3], fn
          +  x -> x * 2
           end)
           
          @@ -3126,7 +3180,7 @@

          Function retrieval

          f.([1,[2],3]) #=> [1,2,3]
          - Source + Source

          if(condition, clauses) @@ -3170,7 +3224,7 @@

          Blocks examples

          If you want to compare more than two clauses, you can use the cond/1 macro.

          - Source + Source

          in(left, right) @@ -3212,7 +3266,7 @@

          Clauses

          In this case, Elixir will automatically expand it and define the variable for us.

          - Source + Source

          inspect(arg, opts // []) @@ -3236,7 +3290,7 @@

          Examples

          #=> ":foo"
          - Source + Source

          integer_to_binary(some_integer) @@ -3249,7 +3303,7 @@

          Examples

          integer_to_binary 123 #=> "123"
           
          - Source + Source

          integer_to_binary(some_integer, base) @@ -3262,7 +3316,7 @@

          Examples

          integer_to_binary 77 #=> "77"
           
          - Source + Source

          is_exception(thing) @@ -3275,14 +3329,14 @@

          Examples

          is_exception(1) #=> false
          - Source + Source

          is_range(thing)

          Check if the given argument is a range.

          - Source + Source

          is_record(thing, kind) @@ -3299,14 +3353,14 @@

          Examples

          is_record(Config.new, List) #=> false
          - Source + Source

          is_regex(thing)

          Check if the given argument is a regex.

          - Source + Source

          match?(left, right) @@ -3333,7 +3387,7 @@

          Examples

          Enum.filter list, match?({:a, x } when x < 2, &1)
          - Source + Source

          nil?(x) @@ -3347,7 +3401,7 @@

          Examples

          nil? nil #=> true
          - Source + Source

          not(arg) @@ -3423,7 +3477,7 @@

          Examples

          will occur immediately.

        - Source + Source

        rem(left, right) @@ -3437,7 +3491,7 @@

        Examples

        rem 5, 2 #=> 1
         
        - Source + Source

        setelem(tuple, index, value) @@ -3453,7 +3507,7 @@

        Example

        setelem(tuple, 0, :baz) #=> { :baz, :bar, 3 }
        - Source + Source

        to_binary(arg) @@ -3467,7 +3521,7 @@

        Examples

        #=> "foo"
        - Source + Source

        to_char_list(arg) @@ -3480,7 +3534,7 @@

        Examples

        #=> 'foo'
        - Source + Source

        try(args) @@ -3503,20 +3557,19 @@

        Examples

        end -

        The rescue clause is used to handle errors, while the catch clause -can be used to catch throw values. Both catch and rescue clauses -accepts the same pattern matching rules as match.

        +

        The rescue clause is used to handle exceptions, while the catch +clause can be used to catch thrown values. Both catch and rescue +clauses work based on pattern matching.

        Note that calls inside try are not tail recursive since the VM needs to keep the stacktrace in case an exception happens.

        Rescue clauses

        -

        Besides accepting the same pattern matching rules as match -clauses, rescue provides some conveniences around exceptions -that allows one to rescue an exception by its name and not by -its internal contents. All the following formats are valid -rescue expressions:

        +

        Besides relying on pattern matching, rescue clauses provides some +conveniences around exceptions that allows one to rescue an +exception by its name. All the following formats are valid rescue +expressions:

        try do
           UndefinedModule.undefined_function
        @@ -3545,30 +3598,9 @@ 

        Rescue clauses

        end
        -

        Variable visibility

        - -

        Since an expression inside try may not have been evaluted -due to an exception, any variable created inside try cannot -be accessed externaly. -For instance:

        - -
        try do
        -  x = 1
        -  do_something_that_may_fail(same_arg)
        -  :ok
        -catch
        -  _ | _ -> :failed
        -end
        -
        -x #=> Cannot access `x`
        -
        - -

        In the example above, x cannot be accessed since it was defined -inside the try clause.

        -

        Catching exits and Erlang errors

        -

        The catch clause works exactly the same as in : Therefore, +

        The catch clause works exactly the same as in erlang. Therefore, one can also handle exits/errors coming from Erlang as below:

        try do
        @@ -3587,8 +3619,39 @@ 

        Catching exits and Erlang errors

        Although the second form should be avoided in favor of raise/rescue control mechanisms.

        + +

        Variable visibility

        + +

        Since an expression inside try may not have been evaluted +due to an exception, any variable created inside try cannot +be accessed externaly. For instance:

        + +
        try do
        +  x = 1
        +  do_something_that_may_fail(same_arg)
        +  :ok
        +catch
        +  _, _ -> :failed
        +end
        +
        +x #=> Cannot access `x`
        +
        + +

        In the example above, x cannot be accessed since it was defined +inside the try clause. A common practice to address this issue +is to return the variables defined inside try:

        + +
        x =
        +  try do
        +    x = 1
        +    do_something_that_may_fail(same_arg)
        +    x
        +  catch
        +    _, _ -> :failed
        +  end
        +
        - Source + Source

        unless(clause, options) @@ -3597,7 +3660,7 @@

        Catching exits and Erlang errors

        unless a value evalutes to true. Check if for examples and documentation.

        - Source + Source

        use(module, args // []) @@ -3634,7 +3697,7 @@

        Examples

        end
        - Source + Source

        var!(var) @@ -3678,7 +3741,7 @@

        Examples

        this operator accepts any expression as arguments, not only booleans, however it is not allowed in guards.

        - Source + Source diff --git a/docs/stable/KeyError.html b/docs/stable/KeyError.html index 0d290fde0..db307b332 100644 --- a/docs/stable/KeyError.html +++ b/docs/stable/KeyError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -115,61 +115,61 @@

        Functions

        exception(args)

        - Source + Source

        exception(args, self)

        - Source + Source

        key(record)

        - Source + Source

        key(value, record)

        - Source + Source

        message(exception)

        - Source + Source

        new()

        - Source + Source

        new(opts)

        - Source + Source

        to_keywords(record)

        - Source + Source

        update(keywords, record)

        - Source + Source

        update_key(function, record)

        - Source + Source
        diff --git a/docs/stable/List.html b/docs/stable/List.html index 520c0f061..83bdad2fc 100644 --- a/docs/stable/List.html +++ b/docs/stable/List.html @@ -123,26 +123,6 @@

        Functions summary

        member?/2
      • -
      • - - range/3 - -
      • -
      • - - sort/1 - -
      • -
      • - - sort/2 - -
      • -
      • - - uniq/1 - -
      • unzip/1 @@ -412,67 +392,6 @@

        Examples

        Source -
        -

        - range(first, last, step // nil) -

        -

        Returns a list of integers in the given range (both ends included when -possible). An optional step can be provided as well (defaults to 1).

        - -

        If first > last and no step is provided, the numbers will be in descending -order.

        - -

        Examples

        - -
        List.range 1, 3     #=> [1,2,3]
        -List.range 1, 8, 2  #=> [1,3,5,7]
        -List.range 1, 0     #=> []
        -List.range 3, 1     #=> [3,2,1]
        -List.range 5, 1, -2 #=> [5, 3, 1]
        -
        -
        - Source -
        -

        - sort(list) -

        -

        Sorts the list by comparing each term. For an alternative -sorting algorithm, check Enum.qsort.

        - -

        Examples

        - -
        List.sort [3, 4, 2, 1, 7]
        -#=> [1, 2, 3, 4, 7]
        -
        -
        - Source -
        -

        - sort(list, fun) -

        -

        Sorts the list according to an ordering function. fun(a, b) should -return true if a compares less than or equal to b, false otherwise.

        - -

        Examples

        - -
        List.sort [3, 4, 2, 1, 7], fn a, b -> b <= a end
        -#=> [7, 4, 3, 2, 1]
        -
        -
        - Source -
        -

        - uniq(list) -

        -

        Returns a list without duplicated items.

        - -

        Examples

        - -
        List.uniq [1,2,3,2,1]
        -#=> [1,2,3]
        -
        -
        - Source

        unzip(list) @@ -489,7 +408,7 @@

        Examples

        #=> [[1, 2, 3], [:a, :b, :c]]
        - Source + Source

        wrap(list) @@ -503,7 +422,7 @@

        Examples

        List.wrap [1,2,3] #=> [1,2,3]
         
        - Source + Source

        zip(list_of_lists) @@ -519,7 +438,7 @@

        Examples

        #=> [{1, 3, 5}]
        - Source + Source diff --git a/docs/stable/Macro.html b/docs/stable/Macro.html index 6a2fb12ab..0ab1ed027 100644 --- a/docs/stable/Macro.html +++ b/docs/stable/Macro.html @@ -56,6 +56,11 @@

        Functions summary

        expand/2
      • +
      • + + extract_args/1 + +
      • safe_term/1 @@ -117,7 +122,7 @@

        Functions

        do_safe_term(terms)

        - Source + Source

        escape(tuple) @@ -135,7 +140,7 @@

        Examples

        #=> { :{}, 0, [:a, :b, :c] }
        - Source + Source

        expand(aliases, env) @@ -147,6 +152,7 @@

        Examples

      • Macros (local or remote);
      • Aliases are expanded (if possible) and return atoms;
      • All pseudo-variables (FILE, MODULE, etc);
      • +
      • Module attributes reader (@foo);

      In case the expression cannot be expanded, it returns the expression itself.

      @@ -231,7 +237,29 @@

      Examples

      end - Source + Source +
      +

      + extract_args(expr) +

      +

      Receives an expresion representing a possible definition +and extracts its arguments. It returns a tuple with the +function name and the arguments list or :error if not +a valid call syntax.

      + +

      This is useful for macros that want to provide the same +arguments syntax available in def/defp/defmacro and friends.

      + +

      Examples

      + +
      extract_args(quote do: foo)        == { :foo, [] }
      +extract_args(quote do: foo())      == { :foo, [] }
      +extract_args(quote do: :foo.())    == { :foo, [] }
      +extract_args(quote do: foo(1,2,3)) == { :foo, [1,2,3] }
      +extract_args(quote do: 1.(1,2,3))  == :error
      +
      +
      + Source

      safe_term(terms) @@ -241,7 +269,7 @@

      Examples

      evaluate code) and returns :ok unless a given term is unsafe, which is returned as { :unsafe, term }.

      - Source + Source

      to_binary(tree) @@ -254,7 +282,7 @@

      Examples

      #=> "foo.bar(1, 2, 3)"
      - Source + Source

      unescape_binary(chars) @@ -280,7 +308,7 @@

      Examples

      In the example above, we pass a string with \n escaped and we return a version with it unescaped.

      - Source + Source

      unescape_binary(chars, map) @@ -315,6 +343,11 @@

      Octals

      Octals will by default be escaped unless the map function returns false for ?0.

      +

      Hex

      + +

      Octals will by default be escaped unless the map function +returns false for ?x.

      +

      Examples

      Using the unescape_map defined above is easy:

      @@ -322,7 +355,7 @@

      Examples

      Macro.unescape_binary "example\\n", unescape_map(&1)
       
      - Source + Source

      unescape_tokens(tokens) @@ -330,11 +363,11 @@

      Examples

      Unescape the given tokens according to the default map. Check unescape/1 and unescape/2 for more information about unescaping. Only tokens that are binaries are -unescaped, all others are ignored. This method is useful +unescaped, all others are ignored. This function is useful when implementing your own sigils. Check the implementation of Kernel.__b__ for examples.

      - Source + Source

      unescape_tokens(tokens, map) @@ -342,7 +375,7 @@

      Examples

      Unescape the given tokens according to the given map. Check unescape_tokens/1 and unescaped/2 for more information.

      - Source + Source
      diff --git a/docs/stable/MatchError.html b/docs/stable/MatchError.html index b85947f52..72f662c02 100644 --- a/docs/stable/MatchError.html +++ b/docs/stable/MatchError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -115,61 +115,61 @@

      Functions

      actual(record)

      - Source + Source

      actual(value, record)

      - Source + Source

      exception(args)

      - Source + Source

      exception(args, self)

      - Source + Source

      message(exception)

      - Source + Source

      new()

      - Source + Source

      new(opts)

      - Source + Source

      to_keywords(record)

      - Source + Source

      update(keywords, record)

      - Source + Source

      update_actual(function, record)

      - Source + Source
      diff --git a/docs/stable/Mix.Error.html b/docs/stable/Mix.Error.html index cc8400d65..e617924c7 100644 --- a/docs/stable/Mix.Error.html +++ b/docs/stable/Mix.Error.html @@ -37,6 +37,12 @@

      Fields (and defaults)

      @@ -129,6 +155,18 @@

      Functions

      Source +
      +

      + mix_error(record) +

      +
      + Source +
      +

      + mix_error(value, record) +

      +
      + Source

      new() @@ -147,6 +185,12 @@

      Functions

      Source +
      +

      + toggle_mix_error(record) +

      +
      + Source

      update(keywords, record) @@ -159,6 +203,12 @@

      Functions

      Source +
      +

      + update_mix_error(function, record) +

      +
      + Source
      diff --git a/docs/stable/Mix.InvalidTaskError.html b/docs/stable/Mix.InvalidTaskError.html index dd83e7d79..044b89a62 100644 --- a/docs/stable/Mix.InvalidTaskError.html +++ b/docs/stable/Mix.InvalidTaskError.html @@ -43,6 +43,12 @@

      Fields (and defaults)

    2609. +
    2610. + + mix_error: true + +
    2611. + @@ -64,6 +70,16 @@

      Functions summary

      message/1 +
    2612. + + mix_error/1 + +
    2613. +
    2614. + + mix_error/2 + +
    2615. new/0 @@ -89,11 +105,21 @@

      Functions summary

      to_keywords/1
    2616. +
    2617. + + toggle_mix_error/1 + +
    2618. update/2
    2619. +
    2620. + + update_mix_error/2 + +
    2621. update_task/2 @@ -128,6 +154,18 @@

      Functions

      Source +
      +

      + mix_error(record) +

      +
      + Source +
      +

      + mix_error(value, record) +

      +
      + Source

      new() @@ -158,12 +196,24 @@

      Functions

      Source +
      +

      + toggle_mix_error(record) +

      +
      + Source

      update(keywords, record)

      Source +
      +

      + update_mix_error(function, record) +

      +
      + Source

      update_task(function, record) diff --git a/docs/stable/Mix.NoProjectError.html b/docs/stable/Mix.NoProjectError.html index fb0721644..82f5178b3 100644 --- a/docs/stable/Mix.NoProjectError.html +++ b/docs/stable/Mix.NoProjectError.html @@ -37,6 +37,12 @@

      Fields (and defaults)

      @@ -129,6 +155,18 @@

      Functions

      Source +
      +

      + mix_error(record) +

      +
      + Source +
      +

      + mix_error(value, record) +

      +
      + Source

      new() @@ -147,6 +185,12 @@

      Functions

      Source +
      +

      + toggle_mix_error(record) +

      +
      + Source

      update(keywords, record) @@ -159,6 +203,12 @@

      Functions

      Source +
      +

      + update_mix_error(function, record) +

      +
      + Source
      diff --git a/docs/stable/Mix.NoTaskError.html b/docs/stable/Mix.NoTaskError.html index 41b7814f1..213d40a2d 100644 --- a/docs/stable/Mix.NoTaskError.html +++ b/docs/stable/Mix.NoTaskError.html @@ -43,6 +43,12 @@

      Fields (and defaults)

    2622. +
    2623. + + mix_error: true + +
    2624. + @@ -64,6 +70,16 @@

      Functions summary

      message/1 +
    2625. + + mix_error/1 + +
    2626. +
    2627. + + mix_error/2 + +
    2628. new/0 @@ -89,11 +105,21 @@

      Functions summary

      to_keywords/1
    2629. +
    2630. + + toggle_mix_error/1 + +
    2631. update/2
    2632. +
    2633. + + update_mix_error/2 + +
    2634. update_task/2 @@ -128,6 +154,18 @@

      Functions

      Source +
      +

      + mix_error(record) +

      +
      + Source +
      +

      + mix_error(value, record) +

      +
      + Source

      new() @@ -158,12 +196,24 @@

      Functions

      Source +
      +

      + toggle_mix_error(record) +

      +
      + Source

      update(keywords, record)

      Source +
      +

      + update_mix_error(function, record) +

      +
      + Source

      update_task(function, record) diff --git a/docs/stable/Mix.OutOfDateDepsError.html b/docs/stable/Mix.OutOfDateDepsError.html index df647aec7..52d41cafd 100644 --- a/docs/stable/Mix.OutOfDateDepsError.html +++ b/docs/stable/Mix.OutOfDateDepsError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -37,6 +37,12 @@

      Fields (and defaults)

      @@ -115,61 +141,85 @@

      Functions

      env(record)

      - Source + Source

      env(value, record)

      - Source + Source

      exception(args)

      - Source + Source

      exception(args, self)

      - Source + Source

      message(exception)

      - Source + Source +
      +

      + mix_error(record) +

      +
      + Source +
      +

      + mix_error(value, record) +

      +
      + Source

      new()

      - Source + Source

      new(opts)

      - Source + Source

      to_keywords(record)

      - Source + Source +
      +

      + toggle_mix_error(record) +

      +
      + Source

      update(keywords, record)

      - Source + Source

      update_env(function, record)

      - Source + Source +
      +

      + update_mix_error(function, record) +

      +
      + Source
      diff --git a/docs/stable/Mix.Shell.IO.html b/docs/stable/Mix.Shell.IO.html index 2a5bf04ac..f74380962 100644 --- a/docs/stable/Mix.Shell.IO.html +++ b/docs/stable/Mix.Shell.IO.html @@ -43,6 +43,11 @@

      Functions summary

      • + + cmd/1 + +
      • +
      • error/1 @@ -69,19 +74,27 @@

        Functions summary

        Functions

        +

        + cmd(command) +

        +

        Executes the given command and prints its output +to stdout as it comes.

        +
        + Source +

        error(message)

        Writes an error message to the shell followed by new line.

        - Source + Source

        info(message)

        Writes a message to the shell followed by new line.

        - Source + Source

        yes?(message) @@ -90,7 +103,7 @@

        Functions

        He must press enter or type anything that matches the a "yes" regex %r/^Y(es)?$/i.

        - Source + Source
        diff --git a/docs/stable/Mix.Shell.Process.html b/docs/stable/Mix.Shell.Process.html index f369ad1e5..51be639b1 100644 --- a/docs/stable/Mix.Shell.Process.html +++ b/docs/stable/Mix.Shell.Process.html @@ -55,6 +55,11 @@

        Functions summary

        • + + cmd/1 + +
        • +
        • error/1 @@ -86,17 +91,23 @@

          Functions summary

          Functions

          +

          + cmd(command) +

          +

          Executes the given command and fowards its messages to +the current process.

          +
          + Source +

          error(message)

          Simply forwards the message to the current process.

          - Source + Source

          - flush(callback // fn x -> - x -end) + flush(callback // fn x -> x end)

          Flush all :mix_shell messages from the current process. If a callback is given, it is invoked for each received message.

          @@ -113,7 +124,7 @@

          Examples

          Simply forwards the message to the current process.

          - Source + Source

          yes?(message) @@ -127,7 +138,7 @@

          Examples

          If one does not exist, it will abort since there no shell process input given. Value must be true or false.

          - Source + Source
          diff --git a/docs/stable/Mix.Shell.html b/docs/stable/Mix.Shell.html index 859c46af2..21fb84ff8 100644 --- a/docs/stable/Mix.Shell.html +++ b/docs/stable/Mix.Shell.html @@ -41,7 +41,15 @@

          +

          Functions summary

          + @@ -49,6 +57,21 @@

          +
          +

          Functions

          +
          +

          + cmd(command, callback) +

          +

          An implementation of the command callback that +is shared accross different shells.

          +
          + Source +
          +
          + + + diff --git a/docs/stable/Mix.Tasks.Run.html b/docs/stable/Mix.Tasks.Run.html index b5e151e46..5eac9c9fd 100644 --- a/docs/stable/Mix.Tasks.Run.html +++ b/docs/stable/Mix.Tasks.Run.html @@ -32,6 +32,14 @@

          Before running the code, it invokes the prepare task which defaults to compile and load your project.

          +

          Command line options

          + +
            +
          • --require, -r - Requires a file before running the command
          • +
          • --parallel-require, -pr - Requires a file in parallel
          • +
          • --no-halt - Does not halt the system after running the command
          • +
          +

          Examples

          mix run Hello.world
          @@ -71,7 +79,7 @@ 

          Functions

          run(args)

          - Source + Source diff --git a/docs/stable/Module.html b/docs/stable/Module.html index 1305c5b87..b845183c1 100644 --- a/docs/stable/Module.html +++ b/docs/stable/Module.html @@ -177,7 +177,7 @@

          Examples

          end
          - Source + Source

          concat(list) @@ -192,7 +192,7 @@

          Examples

          Module.concat [Foo, 'Bar'] #=> Foo.Bar
          - Source + Source

          concat(left, right) @@ -207,7 +207,7 @@

          Examples

          Module.concat Foo, 'Bar' #=> Foo.Bar
          - Source + Source

          create(module, quoted, opts // []) @@ -241,7 +241,7 @@

          Differences with defmodule

          when defining the module, while defmodule automatically shares the same environment.

          - Source + Source

          defines?(module, tuple) @@ -258,7 +258,7 @@

          Examples

          end
          - Source + Source

          defines?(module, tuple, kind) @@ -276,7 +276,7 @@

          Examples

          end
          - Source + Source

          definitions_in(module) @@ -291,7 +291,7 @@

          Examples

          end
          - Source + Source

          definitions_in(module, kind) @@ -308,7 +308,7 @@

          Examples

          end
          - Source + Source

          delete_attribute(module, key) @@ -323,7 +323,7 @@

          Examples

          end
          - Source + Source

          eval_quoted(module, quoted, binding // [], opts // []) @@ -356,7 +356,7 @@

          Examples

          Foo.sum(1, 2) #=> 3
          - Source + Source

          get_attribute(module, key) @@ -377,7 +377,7 @@

          Examples

          end
          - Source + Source

          make_overridable(module, tuples) @@ -386,7 +386,7 @@

          Examples

          An overridable function is lazily defined, allowing a developer to customize it.

          - Source + Source

          open?(module) @@ -394,14 +394,14 @@

          Examples

          Check if a module is open, i.e. it is currently being defined and its attributes and functions can be modified.

          - Source + Source

          overridable?(module, tuple)

          Returns true if the given tuple in module is marked as overridable.

          - Source + Source

          put_attribute(module, key, value) @@ -417,7 +417,7 @@

          Examples

          end
          - Source + Source

          register_attribute(module, new, opts // []) @@ -454,7 +454,7 @@

          Examples

          end
          - Source + Source

          safe_concat(list) @@ -473,7 +473,7 @@

          Examples

          #=> List.Chars
          - Source + Source

          safe_concat(left, right) @@ -492,7 +492,7 @@

          Examples

          #=> List.Chars
          - Source + Source

          split(module) @@ -505,14 +505,14 @@

          Examples

          #=> ["Very", "Long", "Module", "Name", "And", "Even", "Longer"]
          - Source + Source

          to_binary(module)

          Convert a module name to binary without the Elixir prefix.

          - Source + Source
          diff --git a/docs/stable/Protocol.UndefinedError.html b/docs/stable/Protocol.UndefinedError.html index 3f5cd15dd..bf575437f 100644 --- a/docs/stable/Protocol.UndefinedError.html +++ b/docs/stable/Protocol.UndefinedError.html @@ -29,7 +29,7 @@

          - Source + Source @@ -136,79 +136,79 @@

          Functions

          exception(args)

          - Source + Source

          exception(args, self)

          - Source + Source

          message(exception)

          - Source + Source

          new()

          - Source + Source

          new(opts)

          - Source + Source

          protocol(record)

          - Source + Source

          protocol(value, record)

          - Source + Source

          structure(record)

          - Source + Source

          structure(value, record)

          - Source + Source

          to_keywords(record)

          - Source + Source

          update(keywords, record)

          - Source + Source

          update_protocol(function, record)

          - Source + Source

          update_structure(function, record)

          - Source + Source
          diff --git a/docs/stable/Record.html b/docs/stable/Record.html index 3dc1395e7..d346d1816 100644 --- a/docs/stable/Record.html +++ b/docs/stable/Record.html @@ -84,7 +84,7 @@

          Functions summary

          Functions

          - deffunctions(values, opts // [], env) + deffunctions(values, _opts // [], env)

          Defines record functions skipping the module definition. This is called directly by defrecord. It expects the record @@ -114,7 +114,7 @@

          Examples

          end
          - Source + Source

          defrecord(name, values, opts) @@ -137,11 +137,11 @@

          Examples

          Source

          - deftypes(values, types, opts // [], env) + deftypes(values, types, _opts // [], env)

          Defines types and specs for the record.

          - Source + Source

          extract(name, opts) diff --git a/docs/stable/Regex.html b/docs/stable/Regex.html index d1484e700..760503fd0 100644 --- a/docs/stable/Regex.html +++ b/docs/stable/Regex.html @@ -45,7 +45,7 @@

          their shortcut in parenthesis, are:

            -
          • unicode (u) - used when you want to match against specific unicode characters
          • +
          • unicode (u) - enable unicode specific patterns like \p
          • caseless (i) - add case insensitivity
          • dotall (s) - causes dot to match newlines and also set newline to anycrlf. The new line setting can be overwritten by setting (*CR) or (*LF) or diff --git a/docs/stable/RuntimeError.html b/docs/stable/RuntimeError.html index 2ccdfdec5..110d1e912 100644 --- a/docs/stable/RuntimeError.html +++ b/docs/stable/RuntimeError.html @@ -29,7 +29,7 @@

            - Source + Source @@ -110,55 +110,55 @@

            Functions

            exception(args)

            - Source + Source

          exception(args, self)

          - Source + Source

          message(record)

          - Source + Source

          message(value, record)

          - Source + Source

          new()

          - Source + Source

          new(opts)

          - Source + Source

          to_keywords(record)

          - Source + Source

          update(keywords, record)

          - Source + Source

          update_message(function, record)

          - Source + Source
          diff --git a/docs/stable/String.html b/docs/stable/String.html index 9a91d2bdd..0381769b1 100644 --- a/docs/stable/String.html +++ b/docs/stable/String.html @@ -92,6 +92,11 @@

          Functions summary

          length/1
        • +
        • + + lstrip/1 + +
        • lstrip/2 @@ -117,6 +122,11 @@

          Functions summary

          replace/4
        • +
        • + + rstrip/1 + +
        • rstrip/2 @@ -127,6 +137,11 @@

          Functions summary

          split/3
        • +
        • + + strip/1 + +
        • strip/2 @@ -157,14 +172,14 @@

          Functions

          Examples

          -
          String.at("elixir", 0) #=> "1"
          +
          String.at("elixir", 0) #=> "e"
           String.at("elixir", 1) #=> "l"
           String.at("elixir", 10) #=> nil
           String.at("elixir", -1) #=> "r"
           String.at("elixir", -10) #=> nil
           
          - Source + Source

          codepoints(string) @@ -178,7 +193,7 @@

          Examples

          String.codepoints("ἅἪῼ") #=> ["ἅ","Ἢ","ῼ"]
          - Source + Source

          downcase(binary) @@ -209,7 +224,7 @@

          Examples

          String.duplicate("abc", 2) #=> "abcabc"
          - Source + Source

          first(string) @@ -222,7 +237,7 @@

          Examples

          String.first("եոգլի") #=> "ե"
          - Source + Source

          graphemes(string) @@ -233,7 +248,7 @@

          Examples

          String.graphemes("Ā̀stute") # => ["Ā̀","s","t","u","t","e"]

          - Source + Source

          last(string) @@ -246,7 +261,7 @@

          Examples

          String.last("եոգլի") #=> "ի"
          - Source + Source

          length(string) @@ -259,21 +274,32 @@

          Examples

          String.length("եոգլի") #=> 5
          - Source + Source
          -

          - lstrip(string, char // 32) +

          + lstrip(binary)

          -

          Returns a string where leading char have been -removed. If no char is passed spaceis used.

          +

          Returns a string where leading whitespace characters +have been removed.

          Examples

          String.lstrip("   abc  ")       #=> "abc  "
          -String.lstrip("_  abc  _", ?_)  #=> "  abc  _"
           
          - Source + Source +
          +

          + lstrip(other, char) +

          +

          Returns a string where leading char have been removed.

          + +

          Examples

          + +
          String.lstrip("_  abc  _", ?_)  #=> "  abc  _"
          +
          +
          + Source

          next_codepoint(string) @@ -289,7 +315,7 @@

          Examples

          String.next_codepoint("josé") #=> { "j", "osé" }
           
          - Source + Source

          next_grapheme(string) @@ -305,7 +331,7 @@

          Examples

          String.next_grapheme("josé") #=> { "j", "osé" }
           
          - Source + Source

          printable?(arg1) @@ -341,21 +367,32 @@

          Examples

          String.replace("a,b,c", ",", "[]", insert_replaced: [1,1]) #=> "a[,,]b[,,]c"
          - Source + Source
          -

          - rstrip(string, char // 32) +

          + rstrip(binary)

          -

          Returns a string where trailing char have been -removed. If no char is passed spaceis used.

          +

          Returns a string where trailing whitespace characters +and new line have been removed.

          Examples

          String.rstrip("   abc  ")      #=> "   abc"
          -String.rstrip("   abc _", ?_)  #=> "   abc "
           
          - Source + Source +
          +

          + rstrip(string, char) +

          +

          Returns a string where trailing char have been removed.

          + +

          Examples

          + +
          String.rstrip("   abc _", ?_)  #=> "   abc "
          +
          +
          + Source

          split(binary, pattern // " ", options // []) @@ -386,19 +423,31 @@

          Examples

          Source
          -

          - strip(string, char // 32) +

          + strip(string)

          -

          Returns a string where leading/trailing char have been -removed. If no char is passed spaceis used.

          +

          Returns a string where leading/trailing whitespace +and new line characters have been removed.

          Examples

          String.strip("   abc  ")       #=> "abc"
          -String.strip("a  abc  a", ?a)  #=> "  abc  "
           
          - Source + Source +
          +

          + strip(string, char) +

          +

          Returns a string where leading/trailing char have been +removed.

          + +

          Examples

          + +
          String.strip("a  abc  a", ?a)  #=> "  abc  "
          +
          +
          + Source

          upcase(binary) diff --git a/docs/stable/SyntaxError.html b/docs/stable/SyntaxError.html index 742e6a727..8a9744be0 100644 --- a/docs/stable/SyntaxError.html +++ b/docs/stable/SyntaxError.html @@ -29,7 +29,7 @@

          - Source + Source @@ -157,97 +157,97 @@

          Functions

          description(record)

          - Source + Source

          description(value, record)

          - Source + Source

          exception(args)

          - Source + Source

          exception(args, self)

          - Source + Source

          file(record)

          - Source + Source

          file(value, record)

          - Source + Source

          line(record)

          - Source + Source

          line(value, record)

          - Source + Source

          message(exception)

          - Source + Source

          new()

          - Source + Source

          new(opts)

          - Source + Source

          to_keywords(record)

          - Source + Source

          update(keywords, record)

          - Source + Source

          update_description(function, record)

          - Source + Source

          update_file(function, record)

          - Source + Source

          update_line(function, record)

          - Source + Source
          diff --git a/docs/stable/System.html b/docs/stable/System.html index d35f14197..f49f4b6b3 100644 --- a/docs/stable/System.html +++ b/docs/stable/System.html @@ -125,7 +125,7 @@

          Functions

          Returns the list of command-line arguments passed to the program.

          - Source + Source

          at_exit(fun) @@ -137,14 +137,14 @@

          Functions

          The function must expect the exit status code as argument.

          - Source + Source

          build_info()

          Returns a keywords list with version, git tag info and date.

          - Source + Source

          cmd(command) @@ -156,7 +156,7 @@

          Functions

          If command is a char list, a char list is returned. Returns a binary otherwise.

          - Source + Source

          find_executable(command) @@ -168,7 +168,7 @@

          Functions

          If command is a char list, a char list is returned. Returns a binary otherwise.

          - Source + Source

          get_env() @@ -177,7 +177,7 @@

          Functions

          given as a single string of the format "VarName=Value", where VarName is the name of the variable and Value its value.

          - Source + Source

          get_env(varname) @@ -186,7 +186,7 @@

          Functions

          varname as a binary, or nil if the environment variable is undefined.

          - Source + Source

          get_pid() @@ -196,7 +196,7 @@

          Functions

          See http://www.erlang.org/doc/man/os.html#getpid-0 for more info.

          - Source + Source

          halt(status // 0, options // []) @@ -230,7 +230,7 @@

          Examples

          System.halt(:abort)
          - Source + Source

          put_env(dict) @@ -238,28 +238,28 @@

          Examples

          Sets a new value for each environment variable corresponding to each key in dict.

          - Source + Source

          put_env(varname, value)

          Sets a new value for the environment variable varname.

          - Source + Source

          stacktrace()

          Get the stacktrace.

          - Source + Source

          version()

          Returns Elixir's version as binary.

          - Source + Source
          diff --git a/docs/stable/SystemLimitError.html b/docs/stable/SystemLimitError.html index c601d7de2..6f73b2fee 100644 --- a/docs/stable/SystemLimitError.html +++ b/docs/stable/SystemLimitError.html @@ -29,7 +29,7 @@

          - Source + Source @@ -110,55 +110,55 @@

          Functions

          exception(args)

          - Source + Source

          exception(args, self)

          - Source + Source

          message(record)

          - Source + Source

          message(value, record)

          - Source + Source

          new()

          - Source + Source

          new(opts)

          - Source + Source

          to_keywords(record)

          - Source + Source

          update(keywords, record)

          - Source + Source

          update_message(function, record)

          - Source + Source
          diff --git a/docs/stable/TokenMissingError.html b/docs/stable/TokenMissingError.html index 518048f14..1e1b88e74 100644 --- a/docs/stable/TokenMissingError.html +++ b/docs/stable/TokenMissingError.html @@ -29,7 +29,7 @@

          - Source + Source @@ -157,97 +157,97 @@

          Functions

          description(record)

          - Source + Source

          description(value, record)

          - Source + Source

          exception(args)

          - Source + Source

          exception(args, self)

          - Source + Source

          file(record)

          - Source + Source

          file(value, record)

          - Source + Source

          line(record)

          - Source + Source

          line(value, record)

          - Source + Source

          message(exception)

          - Source + Source

          new()

          - Source + Source

          new(opts)

          - Source + Source

          to_keywords(record)

          - Source + Source

          update(keywords, record)

          - Source + Source

          update_description(function, record)

          - Source + Source

          update_file(function, record)

          - Source + Source

          update_line(function, record)

          - Source + Source
          diff --git a/docs/stable/URI.html b/docs/stable/URI.html index ececf5633..e985b8fd2 100644 --- a/docs/stable/URI.html +++ b/docs/stable/URI.html @@ -88,7 +88,7 @@

          Functions

          Unpercent (URL) decodes a URI.

          - Source + Source

          decode_query(q, dict // OrdDict.new()) @@ -139,7 +139,7 @@

          Functions

          for that particular scheme. Take a look at URI.HTTPS for an example of one of these extension modules.

          - Source + Source

          query_decoder(q) diff --git a/docs/stable/UndefinedFunctionError.html b/docs/stable/UndefinedFunctionError.html index da4dad5c5..27b0d3a09 100644 --- a/docs/stable/UndefinedFunctionError.html +++ b/docs/stable/UndefinedFunctionError.html @@ -29,7 +29,7 @@

          - Source + Source @@ -157,97 +157,97 @@

          Functions

          arity(record)

          - Source + Source

          arity(value, record)

          - Source + Source

          exception(args)

          - Source + Source

          exception(args, self)

          - Source + Source

          function(record)

          - Source + Source

          function(value, record)

          - Source + Source

          message(exception)

          - Source + Source

          module(record)

          - Source + Source

          module(value, record)

          - Source + Source

          new()

          - Source + Source

          new(opts)

          - Source + Source

          to_keywords(record)

          - Source + Source

          update(keywords, record)

          - Source + Source

          update_arity(function, record)

          - Source + Source

          update_function(function, record)

          - Source + Source

          update_module(function, record)

          - Source + Source
          diff --git a/docs/stable/modules_list.html b/docs/stable/modules_list.html index ed4264833..4f7ad5898 100644 --- a/docs/stable/modules_list.html +++ b/docs/stable/modules_list.html @@ -16,7 +16,7 @@

          - Elixir v0.7.1 + Elixir v0.7.2

          - Source + Source

          delete_path(path) @@ -200,7 +200,7 @@

          Functions

          Deletes a path from Erlang VM code path. The path is expanded with File.expand_path before deleted.

          - Source + Source

          ensure_compiled(module) @@ -217,7 +217,7 @@

          Functions

          Check ensure_loaded/1 for more information on module loading and when to use ensure_loaded/1 or ensure_compiled/1.

          - Source + Source

          ensure_compiled?(module) @@ -225,7 +225,7 @@

          Functions

          Similar to ensure_compiled/1, but returns a boolean in case it could be ensured or not.

          - Source + Source

          ensure_loaded(module) @@ -267,7 +267,7 @@

          Code.ensure_compiled

          must be used just in same rare conditions, usually involving macros that needs to invoke a module for callback information.

          - Source + Source

          ensure_loaded?(module) @@ -275,7 +275,7 @@

          Code.ensure_compiled

          Similar to ensure_loaded/1, but returns a boolean in case it could be ensured or not.

          - Source + Source

          eval(string, binding // [], opts // []) @@ -311,7 +311,7 @@

          Examples

          #=> { 3, [ {:a, 1}, {:b, 2} ] }
          - Source + Source

          eval_quoted(quoted, binding // [], opts // []) @@ -336,7 +336,7 @@

          Examples

          #=> { 3, [ {:a, 1}, {:b, 2} ] }
          - Source + Source

          load_file(file, relative_to // nil) @@ -352,14 +352,14 @@

          Examples

          a given file, the given file will be loaded N times. Check require_file if you don't want a file to be loaded concurrently.

          - Source + Source

          loaded_files()

          Returns all the loaded files.

          - Source + Source

          prepend_path(path) @@ -367,7 +367,7 @@

          Examples

          Prepends a path to Erlang VM code path. The path is expanded with File.expand_path before added.

          - Source + Source

          require_file(file, relative_to // nil) @@ -384,7 +384,7 @@

          Examples

          file, the given file will be loaded only once. Check load_file if you want a file to be loaded concurrently.

          - Source + Source

          string_to_ast(string, opts // []) @@ -402,7 +402,7 @@

          Options

          when non-existing atoms are found by the tokenizer.

        - Source + Source

        string_to_ast!(string, opts // []) @@ -414,7 +414,7 @@

        Options

        Check Code.string_to_ast/2 for options information.

        - Source + Source

        unload_files(files) @@ -424,7 +424,7 @@

        Options

        calling this function only removes it from the list, allowing it to be required again.

        - Source + Source diff --git a/docs/master/CompileError.html b/docs/master/CompileError.html index 64bbb0eab..2db4ccc37 100644 --- a/docs/master/CompileError.html +++ b/docs/master/CompileError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -62,85 +62,10 @@

        Fields (and defaults)

        Functions summary

        @@ -153,101 +78,11 @@

        Functions summary

        Functions

        -

        - description(record) -

        -
        - Source -
        -

        - description(value, record) -

        -
        - Source -
        -

        - exception(args) -

        -
        - Source -
        -

        - exception(args, self) -

        -
        - Source -
        -

        - file(record) -

        -
        - Source -
        -

        - file(value, record) -

        -
        - Source -
        -

        - line(record) -

        -
        - Source -
        -

        - line(value, record) -

        -
        - Source -

        message(exception)

        - Source -
        -

        - new() -

        -
        - Source -
        -

        - new(opts) -

        -
        - Source -
        -

        - to_keywords(record) -

        -
        - Source -
        -

        - update(keywords, record) -

        -
        - Source -
        -

        - update_description(function, record) -

        -
        - Source -
        -

        - update_file(function, record) -

        -
        - Source -
        -

        - update_line(function, record) -

        -
        - Source + Source
        diff --git a/docs/master/Dict.html b/docs/master/Dict.html index 76235be02..4d3fee023 100644 --- a/docs/master/Dict.html +++ b/docs/master/Dict.html @@ -111,6 +111,11 @@

        Functions summary

        put/3
      • +
      • + + put_new/3 + +
      • size/1 @@ -165,6 +170,11 @@

        Callbacks summary

        size/1
      • +
      • + + put_new/3 + +
      • put/3 @@ -223,14 +233,14 @@

        Examples

        Dict.delete d, :a #=> [b: 2] - Source + Source

        empty(dict)

        Returns an empty dict of the same type as dict.

        - Source + Source

        get(dict, key, default // nil) @@ -246,7 +256,7 @@

        Examples

        Dict.get d, :b, 3 #=> 3
        - Source + Source

        get!(dict, key) @@ -261,7 +271,7 @@

        Examples

        Dict.get d, :b #=> raises KeyError[key: :b]
        - Source + Source

        has_key?(dict, key) @@ -275,7 +285,7 @@

        Examples

        Dict.has_key?(d, :b) #=> false
        - Source + Source

        keys(dict) @@ -290,7 +300,7 @@

        Examples

        Dict.keys d #=> [:a,:b]
        - Source + Source

        merge(dict1, dict2) @@ -308,7 +318,7 @@

        Examples

        #=> [a: 3, b: 2, d: 4]
        - Source + Source

        merge(dict1, dict2, fun) @@ -326,7 +336,7 @@

        Examples

        #=> [a: 4, b: 2, d: 4]
        - Source + Source

        put(dict, key, val) @@ -341,7 +351,21 @@

        Examples

        #=> [a: 3, b: 2]
        - Source + Source +
        +

        + put_new(dict, key, val) +

        +

        Puts the given value under key in dict unless key already exists.

        + +

        Examples

        + +
        d = new [a: 1, b: 2]
        +Dict.put_new d, :a, 3
        +#=> [a: 1, b: 2]
        +
        +
        + Source

        size(dict) @@ -354,7 +378,7 @@

        Examples

        Dict.size d #=> 2
        - Source + Source

        to_list(dict) @@ -362,7 +386,7 @@

        Examples

        Returns a list of key-value pairs stored in dict. No particular order is enforced.

        - Source + Source

        update(dict, key, fun) @@ -377,7 +401,7 @@

        Examples

        #=> [a: -1, b: 2]
        - Source + Source

        update(dict, key, initial, fun) @@ -393,7 +417,7 @@

        Examples

        #=> [a: 1, b: 2, c: 3]
        - Source + Source

        values(dict) @@ -406,7 +430,7 @@

        Examples

        Dict.values d #=> [1,2]
        - Source + Source @@ -421,24 +445,30 @@

        Callbacks

        values(t())

        - Source + Source

        update(t(), key(), (value() -> value()))

        - Source + Source

        to_list(t())

        - Source + Source

        size(t())

        + Source +
        +

        + put_new(t(), key(), value()) +

        +
        Source

        diff --git a/docs/master/Enum.Iterator.Binary.Dict.html b/docs/master/Enum.Iterator.Binary.Dict.html index 7d805ed84..8434e454e 100644 --- a/docs/master/Enum.Iterator.Binary.Dict.html +++ b/docs/master/Enum.Iterator.Binary.Dict.html @@ -29,14 +29,27 @@

        - Source + Source +

        Functions summary

        + @@ -44,6 +57,25 @@

        +
        +

        Functions

        +
        +

        + count(arg1) +

        +
        + Source +
        +

        + iterator(arg1) +

        +
        + Source +
        +
        + + +

        diff --git a/docs/master/Enum.Iterator.Function.html b/docs/master/Enum.Iterator.Function.html index 60fee1252..13f3ea715 100644 --- a/docs/master/Enum.Iterator.Function.html +++ b/docs/master/Enum.Iterator.Function.html @@ -29,14 +29,27 @@

        - Source + Source +

        Functions summary

        + @@ -44,6 +57,25 @@

        +
        +

        Functions

        +
        +

        + count(function) +

        +
        + Source +
        +

        + iterator(function) +

        +
        + Source +
        +
        + + + diff --git a/docs/master/Enum.Iterator.HashDict.html b/docs/master/Enum.Iterator.HashDict.html index 356652169..9d6d45596 100644 --- a/docs/master/Enum.Iterator.HashDict.html +++ b/docs/master/Enum.Iterator.HashDict.html @@ -29,14 +29,27 @@

        - Source + Source +

        Functions summary

        + @@ -44,6 +57,25 @@

        +
        +

        Functions

        +
        +

        + count(dict) +

        +
        + Source +
        +

        + iterator(dict) +

        +
        + Source +
        +
        + + + diff --git a/docs/master/Enum.Iterator.List.html b/docs/master/Enum.Iterator.List.html index 2512817e3..d9e7f0cdf 100644 --- a/docs/master/Enum.Iterator.List.html +++ b/docs/master/Enum.Iterator.List.html @@ -29,14 +29,27 @@

        - Source + Source +

        Functions summary

        + @@ -44,6 +57,25 @@

        +
        +

        Functions

        +
        +

        + count(list) +

        +
        + Source +
        +

        + iterator(list) +

        +
        + Source +
        +
        + + + diff --git a/docs/master/Enum.Iterator.Orddict.html b/docs/master/Enum.Iterator.Orddict.html index eff971109..a2fc093e3 100644 --- a/docs/master/Enum.Iterator.Orddict.html +++ b/docs/master/Enum.Iterator.Orddict.html @@ -29,14 +29,27 @@

        - Source + Source +

        Functions summary

        + @@ -44,6 +57,25 @@

        +
        +

        Functions

        +
        +

        + count(arg1) +

        +
        + Source +
        +

        + iterator(arg1) +

        +
        + Source +
        +
        + + + diff --git a/docs/master/Enum.Iterator.Range.html b/docs/master/Enum.Iterator.Range.html index 6284c9fd7..3be0a165c 100644 --- a/docs/master/Enum.Iterator.Range.html +++ b/docs/master/Enum.Iterator.Range.html @@ -36,7 +36,20 @@

        +

        Functions summary

        + @@ -44,6 +57,25 @@

        +
        +

        Functions

        +
        +

        + count(range) +

        +
        + Source +
        +

        + iterator(range) +

        +
        + Source +
        +
        + + + diff --git a/docs/master/Enum.OutOfBoundsError.html b/docs/master/Enum.OutOfBoundsError.html index 449c27827..6ce6d6ebd 100644 --- a/docs/master/Enum.OutOfBoundsError.html +++ b/docs/master/Enum.OutOfBoundsError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -47,55 +47,7 @@

        Fields (and defaults)

        -

        Functions summary

        - @@ -103,67 +55,6 @@

        Functions summary

        -
        -

        Functions

        -
        -

        - exception(args) -

        -
        - Source -
        -

        - exception(args, self) -

        -
        - Source -
        -

        - message(record) -

        -
        - Source -
        -

        - message(value, record) -

        -
        - Source -
        -

        - new() -

        -
        - Source -
        -

        - new(opts) -

        -
        - Source -
        -

        - to_keywords(record) -

        -
        - Source -
        -

        - update(keywords, record) -

        -
        - Source -
        -

        - update_message(function, record) -

        -
        - Source -
        -
        - - - diff --git a/docs/master/Enum.html b/docs/master/Enum.html index 53044e9ad..880243d08 100644 --- a/docs/master/Enum.html +++ b/docs/master/Enum.html @@ -582,7 +582,7 @@

        Examples

        Enum.sort [3,2,1] #=> [1,2,3]
         
        - Source + Source

        sort(collection, fun) @@ -594,7 +594,7 @@

        Examples

        Enum.sort [3,2,1], &1 > &2 #=> [1,2,3]
         
        - Source + Source

        split(collection, count) @@ -617,7 +617,7 @@

        Examples

        Enum.split [1,2,3], -5 #=> { [], [1,2,3] }
        - Source + Source

        split_while(collection, fun) @@ -631,7 +631,7 @@

        Examples

        #=> { [1], [2, 3, 4] }
        - Source + Source

        take(collection, count) @@ -646,7 +646,7 @@

        Examples

        Enum.take [1,2,3], 0 #=> []
        - Source + Source

        take_while(collection, fun) @@ -660,7 +660,7 @@

        Examples

        #=> [1, 2]
        - Source + Source

        uniq(collection) @@ -673,7 +673,7 @@

        Examples

        #=> [1, 2, 3]
        - Source + Source

        zip(coll1, coll2) @@ -683,7 +683,7 @@

        Examples

        dictated by the first enum. In case the second list is shorter, values are filled with nil.

        - Source + Source diff --git a/docs/master/ErlangError.html b/docs/master/ErlangError.html index 9e35e5f11..2ca0c2a0b 100644 --- a/docs/master/ErlangError.html +++ b/docs/master/ErlangError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -50,55 +50,10 @@

        Fields (and defaults)

        Functions summary

        @@ -111,65 +66,11 @@

        Functions summary

        Functions

        -

        - exception(args) -

        -
        - Source -
        -

        - exception(args, self) -

        -
        - Source -

        message(exception)

        - Source -
        -

        - new() -

        -
        - Source -
        -

        - new(opts) -

        -
        - Source -
        -

        - original(record) -

        -
        - Source -
        -

        - original(value, record) -

        -
        - Source -
        -

        - to_keywords(record) -

        -
        - Source -
        -

        - update(keywords, record) -

        -
        - Source -
        -

        - update_original(function, record) -

        -
        - Source + Source
        diff --git a/docs/master/ExUnit.Assertions.html b/docs/master/ExUnit.Assertions.html index f78aff867..4ea3951b1 100644 --- a/docs/master/ExUnit.Assertions.html +++ b/docs/master/ExUnit.Assertions.html @@ -46,7 +46,7 @@

        - Source + Source @@ -60,6 +60,11 @@

        Functions summary

        assert/2
      • +
      • + + assert/4 + +
      • assert_in_delta/4 @@ -102,6 +107,11 @@

        Macros summary

        assert/1
      • +
      • + + assert_receive/3 + +
      • assert_received/2 @@ -127,6 +137,11 @@

        Macros summary

        refute/1
      • +
      • + + refute_receive/3 + +
      • refute_received/2 @@ -153,7 +168,21 @@

        Examples

        assert false, "it will never be true"
         
        - Source + Source +
        +

        + assert(value, expected, actual, opts) +

        +

        Asserts the expected value is true. +If it fails, it raises an expectation error +using the given expected and actual values.

        + +

        Examples

        + +
        assert this > that, this, that, reason: "more than"
        +
        +
        + Source

        assert_in_delta(expected, received, delta, message // nil) @@ -166,7 +195,7 @@

        Examples

        assert_in_delta 10, 15, 4
        - Source + Source

        assert_raise(exception, function) @@ -181,7 +210,7 @@

        Examples

        end
        - Source + Source

        assert_raise(exception, message, function) @@ -196,7 +225,7 @@

        Examples

        end
        - Source + Source

        flunk(message // "Epic Fail!") @@ -208,7 +237,7 @@

        Examples

        flunk "This should raise an error"
         
        - Source + Source

        refute(not_expected, message) @@ -221,7 +250,7 @@

        Examples

        refute true, "This will obviously fail"
         
        - Source + Source

        refute_in_delta(expected, received, delta, message // nil) @@ -234,7 +263,7 @@

        Examples

        refute_in_delta 10, 11, 2
        - Source + Source @@ -260,7 +289,32 @@

        Examples

        assert true
         
        - Source + Source +
        +

        + assert_receive(expected, timeout // 100, message // nil) +

        +

        Assets a message was or is going to be received. Differently from +assert_received, it has a default timeout time of 100 miliseconds.

        + +

        The given expected content must be a pattern.

        + +

        Examples

        + +
        assert_receive :hello
        +
        + +

        Asserts against a larger timeout:

        + +
        assert_receive :hello, 20_000
        +
        + +

        You can also match against specific patterns:

        + +
        assert_received { :hello, _ }
        +
        +
        + Source

        assert_received(expected, message // nil) @@ -282,7 +336,7 @@

        Examples

        assert_received { :hello, _ }
        - Source + Source

        catch_error(expression) @@ -295,7 +349,7 @@

        Examples

        assert catch_error(error 1) == 1
         
        - Source + Source

        catch_exit(expression) @@ -308,7 +362,7 @@

        Examples

        assert catch_exit(exit 1) == 1
         
        - Source + Source

        catch_throw(expression) @@ -321,7 +375,7 @@

        Examples

        assert catch_throw(throw 1) == 1
         
        - Source + Source

        refute(expected) @@ -336,7 +390,27 @@

        Examples

        refute false
         
        - Source + Source +
        +

        + refute_receive(not_expected, timeout // 100, message // nil) +

        +

        Asserts a message was not received and won't be during +a timeout value.

        + +

        The not_expected contents must be a match pattern.

        + +

        Examples

        + +
        refute_receive :bye
        +
        + +

        Refute received with a explicit timeout:

        + +
        refute_receive :bye, 1000
        +
        +
        + Source

        refute_received(not_expected, message // nil) @@ -352,7 +426,7 @@

        Examples

        refute_received :bye
        - Source + Source diff --git a/docs/master/ExUnit.CLIFormatter.html b/docs/master/ExUnit.CLIFormatter.html index 8a2b18544..861ffece9 100644 --- a/docs/master/ExUnit.CLIFormatter.html +++ b/docs/master/ExUnit.CLIFormatter.html @@ -44,12 +44,12 @@

        Functions summary

        • - case_finished/1 + case_finished/2
        • - case_started/1 + case_started/2
        • @@ -79,12 +79,12 @@

          Functions summary

        • - suite_finished/0 + suite_finished/1
        • - suite_started/0 + suite_started/1
        • @@ -94,12 +94,12 @@

          Functions summary

        • - test_finished/3 + test_finished/4
        • - test_started/2 + test_started/3
        • @@ -114,56 +114,56 @@

          Functions summary

          Functions

          -

          - case_finished(_) +

          + case_finished(_id, _test_case)

          - Source + Source
          -

          - case_started(_) +

          + case_started(_id, _test_case)

          - Source + Source

          code_change(_old, state, _extra)

          - Source + Source

          handle_call(arg1, arg2, state)

          - Source + Source

          handle_cast(arg1, state)

          - Source + Source

          handle_info(_msg, state)

          - Source + Source

          init(args)

          - Source + Source
          -

          - suite_finished() +

          + suite_finished(id)

          - Source + Source
          -

          - suite_started() +

          + suite_started(_opts)

          Source @@ -172,19 +172,19 @@

          Functions

          terminate(reason, state)

          - Source + Source
          -

          - test_finished(test_case, test, result) +

          + test_finished(id, test_case, test, result)

          - Source + Source
          -

          - test_started(_test_case, _test) +

          + test_started(_id, _test_case, _test)

          - Source + Source
          diff --git a/docs/master/ExUnit.ExpectationError.html b/docs/master/ExUnit.ExpectationError.html new file mode 100644 index 000000000..53b4db699 --- /dev/null +++ b/docs/master/ExUnit.ExpectationError.html @@ -0,0 +1,338 @@ + + + + ExUnit.ExpectationError + + + + + + + + + + + + +
          +

          + ExUnit.ExpectationError + + exception + +

          + + + + Source + + + + +

          Fields (and defaults)

          +
            + +
          • + + expected: nil + +
          • + +
          • + + actual: nil + +
          • + +
          • + + reason: "" + +
          • + +
          • + + negation: false + +
          • + +
          • + + prelude: "Expected" + +
          • + +
          + + + +

          Functions summary

          + + + + + + + + +
          +

          Functions

          +
          +

          + actual(record) +

          +
          + Source +
          +

          + actual(value, record) +

          +
          + Source +
          +

          + exception(args) +

          +
          + Source +
          +

          + exception(args, self) +

          +
          + Source +
          +

          + expected(record) +

          +
          + Source +
          +

          + expected(value, record) +

          +
          + Source +
          +

          + message(exception) +

          +
          + Source +
          +

          + negation(record) +

          +
          + Source +
          +

          + negation(value, record) +

          +
          + Source +
          +

          + new() +

          +
          + Source +
          +

          + new(opts) +

          +
          + Source +
          +

          + prelude(record) +

          +
          + Source +
          +

          + prelude(value, record) +

          +
          + Source +
          +

          + reason(record) +

          +
          + Source +
          +

          + reason(value, record) +

          +
          + Source +
          +

          + to_keywords(record) +

          +
          + Source +
          +

          + update(keywords, record) +

          +
          + Source +
          +

          + update_actual(function, record) +

          +
          + Source +
          +

          + update_expected(function, record) +

          +
          + Source +
          +

          + update_negation(function, record) +

          +
          + Source +
          +

          + update_prelude(function, record) +

          +
          + Source +
          +

          + update_reason(function, record) +

          +
          + Source +
          +
          + + + + + +
          + + diff --git a/docs/master/ExUnit.Formatter.html b/docs/master/ExUnit.Formatter.html index 4cf10cf06..5ea9e8b14 100644 --- a/docs/master/ExUnit.Formatter.html +++ b/docs/master/ExUnit.Formatter.html @@ -50,32 +50,32 @@

          Callbacks summary

          • - test_finished/3 + test_finished/4
          • - test_started/2 + test_started/3
          • - case_finished/1 + case_finished/2
          • - case_started/1 + case_started/2
          • - suite_finished/0 + suite_finished/1
          • - suite_started/0 + suite_started/1
          • @@ -90,41 +90,41 @@

            Callbacks summary

            Callbacks

            -

            - test_finished(test_case(), test(), result()) +

            + test_finished(id(), test_case(), test(), result())

            - Source + Source
            -

            - test_started(test_case(), test()) +

            + test_started(id(), test_case(), test())

            - Source + Source
            -

            - case_finished(test_case()) +

            + case_finished(id(), test_case())

            - Source + Source
            -

            - case_started(test_case()) +

            + case_started(id(), test_case())

            - Source + Source
            -

            - suite_finished() +

            + suite_finished(id())

            - Source + Source
            -

            - suite_started() +

            + suite_started(opts :: list())

            - Source + Source
            diff --git a/docs/master/ExUnit.html b/docs/master/ExUnit.html index 24d2d817b..662c10e92 100644 --- a/docs/master/ExUnit.html +++ b/docs/master/ExUnit.html @@ -66,6 +66,26 @@

            Assertions

            Check ExUnit.Assertions for assertions documentation.

            +

            User config

            + +

            When started, ExUnit automatically reads a user configuration +from the following locations, in this order:

            + +
              +
            • $EXUNIT_CONFIG environment variable
            • +
            • $HOME/.ex_unit.exs
            • +
            + +

            If none found, no user config will be read.

            + +

            User config is an elixir file which should return a keyword list +with ex_unit options. Please note that explicit options passed +to start/1 or configure/1 will take precedence over user options.

            + +
            # User config example (~/.ex_unit.exs)
            +[formatter: ExUnit.Formatter.ANSI]
            +
            + @@ -98,6 +118,11 @@

            Functions summary

            start/1 +
          • + + stop/1 + +
          • user_options/1 @@ -118,68 +143,63 @@

            Functions

            after_spawn(callback)

            -

            Register a callback to be invoked every time a +

            Registers a callback to be invoked every time a new ExUnit process is spawned.

            - Source + Source

            configure(options)

            -

            Configure ExUnit.

            +

            Configures ExUnit.

            Options

            ExUnit supports the following options given to start:

              -
            • :formatter - The formatter that will print results
            • -
            • :max_cases - Maximum number of cases to run in parallel
            • +
            • :formatter - The formatter that will print results. + Defaults to ExUnit.CLIFormatter;

            • +
            • :max_cases - Maximum number of cases to run in parallel. + Defaults to :erlang.system_info(:schedulers_online);

            - Source + Source

            run()

            -

            API used to run the tests. A developer does not -need to call it directly.

            +

            API used to run the tests. It is invoked automatically +if ExUnit is started via ExUnit.start.

            + +

            Returns the number of failures.

            - Source + Source

            start(options // [])

            -

            Start ExUnit. Required to be invoked before loading -any file that uses ExUnit.Case. Check configure/1 -to see the supported options.

            - -

            This function will also try to read a user config from the following -locations, in this order:

            - -
              -
            • $EXUNIT_CONFIG environment variable
            • -
            • $HOME/.ex_unit.exs
            • -
            - -

            If none found, no user config will be read.

            - -

            User config is an elixir file which should return a keyword list -with ex_unit options. Please note that explicit options passed to start/1 -will take precedence over user options.

            +

            Starts up ExUnit and automatically set it up to run +tests at the VM exit. It accepts a set of options to +configure ExUnit (the same ones accepted by configure/1).

            -

            User config example (~/.ex_unit.exs)

            - -

            [formatter: ExUnit.Formatter.ANSI]

            +

            In case you want to run tests manually, skip calling this +function and rely on configure/1 and run/0 instead.

            - Source + Source +
            +

            + stop(_state) +

            +
            + Source

            user_options(user_config // nil)

            Returns the configured user options.

            - Source + Source
            diff --git a/docs/master/Exception.html b/docs/master/Exception.html index 5bcbc93ab..d82b02785 100644 --- a/docs/master/Exception.html +++ b/docs/master/Exception.html @@ -28,7 +28,7 @@

            Several convenience functions to work and pretty print -exceptions and backtraces.

            +exceptions and stacktraces.

            @@ -44,7 +44,12 @@

            Functions summary

            • - env_stacktrace/1 + filter_stacktrace/1 + +
            • +
            • + + format_entry/1
            • @@ -59,17 +64,17 @@

              Functions summary

            • - format_module_fun_arity/3 + format_stacktrace/1
            • - format_stacktrace/1 + normalize/1
            • - formatted_stacktrace/1 + print_stacktrace/1
            • @@ -84,50 +89,61 @@

              Functions summary

              Functions

              -

              - env_stacktrace(env) +

              + filter_stacktrace(list1)

              -

              Returns a formatted stacktrace from the environment.

              +

              Filters the stacktrace removing internal Elixir entries.

              + +

              This is useful when a stacktrace is received from Erlang code +and it needs to be formatted by an Elixir application.

              - Source + Source +
              +

              + format_entry(arg1) +

              +

              Receives a tuple representing a stacktrace entry and formats it.

              +
              + Source

              format_file_line(file_line)

              -

              Formats file and line information present in stacktraces. -Expect them to be given in a keyword list.

              -
              - Source +
              + Source

              format_file_line(file, line)

              -

              Formats the given file and line.

              -
              - Source +
              + Source
              -

              - format_module_fun_arity(module, fun, arity) +

              + format_stacktrace(trace // nil)

              -

              Receives a module, fun and arity and returns a string -representing such invocation. Arity may also be a list -of arguments. It follows the same syntax as in stacktraces.

              +

              Formats the stacktrace.

              + +

              A stacktrace must be given as argument. If not, this function +calculates the current stacktrace and formats it. As consequence, +the value of System.stacktrace is changed.

              - Source + Source
              -

              - format_stacktrace(arg1) +

              + normalize(exception)

              -

              Formats each line in the stacktrace.

              +

              Normalizes an exception converting Erlang exceptions +to Elixir exceptions. Useful when interfacing Erlang +code with Elixir code.

              - Source + Source
              -

              - formatted_stacktrace(trace // nil) +

              -

              Returns the stacktrace as a binary formatted as per format_stacktrace/1.

              +

              Prints the current stacktrace to standard output.

              - Source + Source
              diff --git a/docs/master/File.CopyError.html b/docs/master/File.CopyError.html index 81eda9de4..0c050f7e0 100644 --- a/docs/master/File.CopyError.html +++ b/docs/master/File.CopyError.html @@ -68,100 +68,10 @@

              Fields (and defaults)

              Functions summary

              @@ -174,119 +84,11 @@

              Functions summary

              Functions

              -

              - action(record) -

              -
              - Source -
              -

              - action(value, record) -

              -
              - Source -
              -

              - destination(record) -

              -
              - Source -
              -

              - destination(value, record) -

              -
              - Source -
              -

              - exception(args) -

              -
              - Source -
              -

              - exception(args, self) -

              -
              - Source -

              message(exception)

              Source -
              -

              - new() -

              -
              - Source -
              -

              - new(opts) -

              -
              - Source -
              -

              - reason(record) -

              -
              - Source -
              -

              - reason(value, record) -

              -
              - Source -
              -

              - source(record) -

              -
              - Source -
              -

              - source(value, record) -

              -
              - Source -
              -

              - to_keywords(record) -

              -
              - Source -
              -

              - update(keywords, record) -

              -
              - Source -
              -

              - update_action(function, record) -

              -
              - Source -
              -

              - update_destination(function, record) -

              -
              - Source -
              -

              - update_reason(function, record) -

              -
              - Source -
              -

              - update_source(function, record) -

              -
              - Source
              diff --git a/docs/master/File.Error.html b/docs/master/File.Error.html index 785ade120..24ec1fad1 100644 --- a/docs/master/File.Error.html +++ b/docs/master/File.Error.html @@ -62,85 +62,10 @@

              Fields (and defaults)

              Functions summary

              @@ -153,101 +78,11 @@

              Functions summary

              Functions

              -

              - action(record) -

              -
              - Source -
              -

              - action(value, record) -

              -
              - Source -
              -

              - exception(args) -

              -
              - Source -
              -

              - exception(args, self) -

              -
              - Source -

              message(exception)

              Source -
              -

              - new() -

              -
              - Source -
              -

              - new(opts) -

              -
              - Source -
              -

              - path(record) -

              -
              - Source -
              -

              - path(value, record) -

              -
              - Source -
              -

              - reason(record) -

              -
              - Source -
              -

              - reason(value, record) -

              -
              - Source -
              -

              - to_keywords(record) -

              -
              - Source -
              -

              - update(keywords, record) -

              -
              - Source -
              -

              - update_action(function, record) -

              -
              - Source -
              -

              - update_path(function, record) -

              -
              - Source -
              -

              - update_reason(function, record) -

              -
              - Source
              diff --git a/docs/master/File.IteratorError.html b/docs/master/File.IteratorError.html index 9d97e9e25..4aff72bd1 100644 --- a/docs/master/File.IteratorError.html +++ b/docs/master/File.IteratorError.html @@ -50,55 +50,10 @@

              Fields (and defaults)

              Functions summary

              @@ -111,65 +66,11 @@

              Functions summary

              Functions

              -

              - exception(args) -

              -
              - Source -
              -

              - exception(args, self) -

              -
              - Source -

              message(exception)

              Source -
              -

              - new() -

              -
              - Source -
              -

              - new(opts) -

              -
              - Source -
              -

              - reason(record) -

              -
              - Source -
              -

              - reason(value, record) -

              -
              - Source -
              -

              - to_keywords(record) -

              -
              - Source -
              -

              - update(keywords, record) -

              -
              - Source -
              -

              - update_reason(function, record) -

              -
              - Source
              diff --git a/docs/master/File.Stat.html b/docs/master/File.Stat.html index fd721bf67..e231e5de2 100644 --- a/docs/master/File.Stat.html +++ b/docs/master/File.Stat.html @@ -153,495 +153,12 @@

              Fields (and defaults)

              -

              Functions summary

              - - -
              -

              Functions

              -
              -

              - access(record) -

              -
              - Source -
              -

              - access(value, record) -

              -
              - Source -
              -

              - atime(record) -

              -
              - Source -
              -

              - atime(value, record) -

              -
              - Source -
              -

              - ctime(record) -

              -
              - Source -
              -

              - ctime(value, record) -

              -
              - Source -
              -

              - gid(record) -

              -
              - Source -
              -

              - gid(value, record) -

              -
              - Source -
              -

              - inode(record) -

              -
              - Source -
              -

              - inode(value, record) -

              -
              - Source -
              -

              - links(record) -

              -
              - Source -
              -

              - links(value, record) -

              -
              - Source -
              -

              - major_device(record) -

              -
              - Source -
              -

              - major_device(value, record) -

              -
              - Source -
              -

              - minor_device(record) -

              -
              - Source -
              -

              - minor_device(value, record) -

              -
              - Source -
              -

              - mode(record) -

              -
              - Source -
              -

              - mode(value, record) -

              -
              - Source -
              -

              - mtime(record) -

              -
              - Source -
              -

              - mtime(value, record) -

              -
              - Source -
              -

              - new() -

              -
              - Source -
              -

              - new(opts) -

              -
              - Source -
              -

              - size(record) -

              -
              - Source -
              -

              - size(value, record) -

              -
              - Source -
              -

              - to_keywords(record) -

              -
              - Source -
              -

              - type(record) -

              -
              - Source -
              -

              - type(value, record) -

              -
              - Source -
              -

              - uid(record) -

              -
              - Source -
              -

              - uid(value, record) -

              -
              - Source -
              -

              - update(keywords, record) -

              -
              - Source -
              -

              - update_access(function, record) -

              -
              - Source -
              -

              - update_atime(function, record) -

              -
              - Source -
              -

              - update_ctime(function, record) -

              -
              - Source -
              -

              - update_gid(function, record) -

              -
              - Source -
              -

              - update_inode(function, record) -

              -
              - Source -
              -

              - update_links(function, record) -

              -
              - Source -
              -

              - update_major_device(function, record) -

              -
              - Source -
              -

              - update_minor_device(function, record) -

              -
              - Source -
              -

              - update_mode(function, record) -

              -
              - Source -
              -

              - update_mtime(function, record) -

              -
              - Source -
              -

              - update_size(function, record) -

              -
              - Source -
              -

              - update_type(function, record) -

              -
              - Source -
              -

              - update_uid(function, record) -

              -
              - Source -
              -
              - diff --git a/docs/master/FunctionClauseError.html b/docs/master/FunctionClauseError.html index a8169c45e..926a4478a 100644 --- a/docs/master/FunctionClauseError.html +++ b/docs/master/FunctionClauseError.html @@ -29,7 +29,7 @@

              - Source + Source @@ -62,85 +62,10 @@

              Fields (and defaults)

              Functions summary

              @@ -153,101 +78,11 @@

              Functions summary

              Functions

              -

              - arity(record) -

              -
              - Source -
              -

              - arity(value, record) -

              -
              - Source -
              -

              - exception(args) -

              -
              - Source -
              -

              - exception(args, self) -

              -
              - Source -
              -

              - function(record) -

              -
              - Source -
              -

              - function(value, record) -

              -
              - Source -

              message(exception)

              - Source -
              -

              - module(record) -

              -
              - Source -
              -

              - module(value, record) -

              -
              - Source -
              -

              - new() -

              -
              - Source -
              -

              - new(opts) -

              -
              - Source -
              -

              - to_keywords(record) -

              -
              - Source -
              -

              - update(keywords, record) -

              -
              - Source -
              -

              - update_arity(function, record) -

              -
              - Source -
              -

              - update_function(function, record) -

              -
              - Source -
              -

              - update_module(function, record) -

              -
              - Source + Source
              diff --git a/docs/master/GenServer.Behaviour.html b/docs/master/GenServer.Behaviour.html index 156591578..155cdf677 100644 --- a/docs/master/GenServer.Behaviour.html +++ b/docs/master/GenServer.Behaviour.html @@ -27,46 +27,92 @@

              -

              By using this module, you get default GenServer callbacks -for init, handle_call, handle_info, handle_cast, -terminate and code_change. Since these functions are -defined as overridable, they can be customized and fallback -to the default behaviour by calling super.

              +

              This module is a convenience to define GenServer callbacks in Elixir.

              -

              This module also tags the behavior as :genserver. For more -information on genserver, please refer to the Erlang -documentation:

              - -

              http://www.erlang.org/doc/man/gen_server.html -http://www.erlang.org/doc/design_principles/gen_server_concepts.html

              +

              A server is responsible to react to messages received from client +and a GenServer is an OTP behaviour that encapsulates common server +functionalities.

              Example

              +

              Bellow follows an example of a GenServer that push and pop items +into a stack:

              +
              defmodule MyServer do
                 use GenServer.Behaviour
               
                 # Callbacks
               
              -  def handle_call(:peek, _from, [h|_] = state) do
              -    { :reply, h, state }
              +  def handle_call(:pop, _from, [h|t]) do
              +    { :reply, h, t }
                 end
               
              -  # Default behaviour
              -  def handle_call(request, from, config) do
              -    super(request, from, config)
              +  def handle_call(_request, _from, _config) do
              +    # Call the default implementation from GenServer.Behaviour
              +    super
                 end
               
              -  def handle_cast({ :push, item }, state) do
              -    { :noreply, [item|state] }
              +  def handle_cast({ :push, item }, config) do
              +    { :noreply, [item|config] }
                 end
               
              -  # Default cast behaviour
              -  def handle_cast(request, config) do
              -    super(request, config)
              +  def handle_cast(_request, _config) do
              +    super
                 end
               end
              +
              +{ :ok, pid } = :gen_server.start_link(MyServer, [:hello], [])
              +
              +:gen_server.call(pid, :pop)
              +#=> :hello
              +
              +:gen_server.cast(pid, { :push, :world })
              +#=> :ok
              +
              +:gen_server.call(pid, :pop)
              +#=> :world
              +
              + +

              Notice we never call the server callbacks directly, they are called +by OTP whenever we interact with the server. cast messages are +asynchronous while call ones are synchronous. In the case of +GenServer's, there are 8 different values a callback such as +handle_call or handle_cast can return:

              + +
              { :reply, reply, new_state }
              +{ :reply, reply, new_state, timeout }
              +{ :reply, reply, new_state, :hibernate }
              +{ :noreply, new_state }
              +{ :noreply, new_state, timeout }
              +{ :noreply, new_state, :hibernate }
              +{ :stop, reason, new_state }
              +{ :stop, reason, reply, new_state }
               
              +

              There are 6 callbacks required to be implemented in a GenServer. The +GenServer.Behaviour module defines all of them automatically, but +allows us to customize the ones we need. The list of callbacks are:

              + +
                +
              • init(args) - invoked when the server is started;
              • +
              • handle_call(msg, from, state) - invoked to handle call messages;
              • +
              • handle_cast(msg, state) - invoked to handle cast messages;
              • +
              • handle_info(msg, state) - handle all other messages which are +normally received by processes;
              • +
              • terminate(reason, state) - called when the server is about to +terminate, useful for cleaning up;
              • +
              • code_change(old_vsn, state, extra) - called when the application +code is being upgraded live (hot code swap);
              • +
              + +

              Starting and sending messages to the gen_server is done +via Erlang's :gen_server module. For more information, +please refer to the following:

              + +

              http://www.erlang.org/doc/man/gen_server.html +http://www.erlang.org/doc/design_principles/gen_server_concepts.html +http://learnyousomeerlang.com/clients-and-servers

              +
              diff --git a/docs/master/IEx.Helpers.html b/docs/master/IEx.Helpers.html index 6826188c8..9168bad82 100644 --- a/docs/master/IEx.Helpers.html +++ b/docs/master/IEx.Helpers.html @@ -173,7 +173,7 @@

              Examples

              Flushes all messages sent to the shell and prints them out

              - Source + Source

              h() @@ -187,7 +187,7 @@

              Examples

              Purges and reloads specified module

              - Source + Source

              m() @@ -202,7 +202,7 @@

              Examples

              Reloads all modules that were already reloaded at some point with r/1.

              - Source + Source

              r(module) @@ -212,7 +212,7 @@

              Examples

              Please note that all the modules defined in the specified files are recompiled and reloaded.

              - Source + Source

              v() @@ -228,7 +228,7 @@

              Examples

              values to lookup query's value from latest to earliest. For instance, v(-1) returns the latest result.

              - Source + Source
              @@ -273,7 +273,7 @@

              Examples

              s(list_to_atom/1)
            - Source + Source

            t(module) @@ -288,7 +288,7 @@

            Examples

            t(Enum.t)
            - Source + Source diff --git a/docs/master/IO.html b/docs/master/IO.html index 794b3fb4c..369c6a166 100644 --- a/docs/master/IO.html +++ b/docs/master/IO.html @@ -164,7 +164,7 @@

            Functions

            NFS file system.

          - Source + Source

          gets(device // :stdio, prompt) @@ -180,7 +180,7 @@

          Functions

          NFS file system.

        - Source + Source

        inspect(device // :stdio, item, opts // []) @@ -188,7 +188,7 @@

        Functions

        Inspects and writes the given argument to the device followed by a new line. Returns the item given.

        - Source + Source

        puts(device // :stdio, item) diff --git a/docs/master/Kernel.SpecialForms.html b/docs/master/Kernel.SpecialForms.html index ed0c9bb43..39bf8a6ff 100644 --- a/docs/master/Kernel.SpecialForms.html +++ b/docs/master/Kernel.SpecialForms.html @@ -27,9 +27,13 @@

        -

        In this module we define Elixir special forms. Those are called -special forms because they cannot be overridden by the developer -and sometimes have lexical scope (like alias, import, etc).

        +

        In this module we define Elixir special forms. Special forms +cannot be overriden by the developer and are the basic +building blocks of Elixir code.

        + +

        Some of those forms are lexical (like alias, import, etc). +The macros {}, [] and <<>> are also special forms used +to define data structures, respectively tuples, lists and binaries.

        This module also documents Elixir's pseudo variables (__MODULE__, __FILE__, __ENV__ and __CALLER__). Pseudo variables return @@ -162,8 +166,128 @@

        Examples

        :<<>>.(1,2,3)
         << 1, 2, 3 >>
         
        + +

        Bitstring types

        + +

        A bitstring may contain many parts and those may have +specific types. Most of the time, Elixir will figure out +the part's type and won't require any work from you:

        + +
        <<102, "oo">>
        +#=> "foo"
        +
        + +

        Above we have two parts: the first is an integer and the +second is a binary. If we use any other Elixir expression, +Elixir can no longer guess the type:

        + +
        rest = "oo"
        +<<102, rest>>
        +#=> ** (ArgumentError) argument error
        +
        + +

        When a variable or expression is given as a binary part, +Elixir defaults the type of that part to an unsigned +little-endian integer. In the example above, since we haven't +specified a type, Elixir expected an integer but we passed a +binary, resulting in ArgumentError. We can solve this by +explicitly tagging it as a binary:

        + +
        <<102, rest :: binary>>
        +
        + +

        The type can be integer, float, binary, bytes, bitstring, +bits, utf8, utf16 or utf32, e.g.:

        + +
        <<102 :: float, rest :: binary>>
        +
        + +

        Integer can be any arbitrary precision integer. A float is an +IEEE 754 binary32 or binary64 floating point number. A bitstring +is an arbitrary series of bits. A binary is a special case of +bitstring that has a total size divisible by 8.

        + +

        The utf8, utf16, and utf32 types are for UTF code points.

        + +

        The bits type is an alias for bitstring. The bytes type is an +alias for binary.

        + +

        The signedness can also be given as signed or unsigned. The +signedness only matters for matching. If unspecified, it +defaults to unsigned. Example:

        + +
        <<-100 :: signed, rest :: binary>> = <<-100, "foo">>
        +#=> <<156,102,111,111>>
        +
        + +

        This match would have failed if we did not specify that the +value -100 is signed. If we're matching into a variable instead +of a value, the signedness won't be checked; rather, the number +will simply be interpreted as having the given (or implied) +signedness, e.g.:

        + +
        <<val, rest :: binary>> = <<-100, "foo">>
        +val
        +#=> 156
        +
        + +

        Here, val is interpreted as unsigned.

        + +

        Signedness is only relevant on integers.

        + +

        The endianness of a part can be big, little or native (the +latter meaning it will be resolved at VM load time). Passing +many options can be done by giving a list:

        + +
        <<102 :: [integer, native], rest :: binary>>
        +
        + +

        Or:

        + +
        <<102 :: [unsigned, big, integer], rest :: binary>>
        +
        + +

        And so on.

        + +

        Endianness only makes sense for integers and some UTF code +point types (utf16 and utf32).

        + +

        Finally, we can also specify size and unit for each part. The +unit is multiplied by the size to give the effective size of +the part:

        + +
        <<102, rest :: [size(2), unit(8)]>> = "foo"
        +"foo"
        +
        +<<102, rest :: size(16)>> = "foo"
        +"foo"
        +
        +<<102, rest :: size(32)>> = "foo"
        +** (MatchError) no match of right hand side value: "foo"
        +
        + +

        In the example above, the first two expressions matches +because the string "foo" takes 24 bits and we are matching +against a part of 24 bits as well, 8 of which are taken by +the integer 102 and the remaining 16 bits are specified on +the rest. On the last example, we expect a rest with size 32, +which won't match.

        + +

        Size and unit are not applicable to utf8, utf16, and utf32.

        + +

        The default size for integers is 8. For floats, it is 64. For +binaries, it is the size of the binary. Only the last binary +in a binary match can use the default size (all others must +have their size specified explicitly). Bitstrings do not have +a default size.

        + +

        The default unit for integers, floats, and bitstrings is 1. For +binaries, it is 8.

        + +

        For floats, unit * size must result in 32 or 64, corresponding +to binary32 and binary64, respectively.

        - Source + Source

        [args] @@ -176,7 +300,7 @@

        Examples

        [ 1, 2, 3 ]
        - Source + Source

        __ENV__() @@ -185,7 +309,7 @@

        Examples

        record. In the environment you can access the current filename, line numbers, set up aliases, the current function and others.

        - Source + Source

        __FILE__() @@ -194,7 +318,7 @@

        Examples

        Although the file can be accessed in the ENV, this macro is a convenient shortcut.

        - Source + Source

        __MODULE__() @@ -203,7 +327,7 @@

        Examples

        Although the module can be accessed in the ENV, this macro is a convenient shortcut.

        - Source + Source

        args @@ -223,8 +347,8 @@

        Examples

        Whenever an expression iterator sees a :. as the tuple key, -it can be sure that it represents a call and the second element -of the arguments list is an atom.

        +it can be sure that it represents a call and the second argument +is the list is an atom.

        On the other hand, aliases holds some properties:

        @@ -246,7 +370,7 @@

        Examples

          Module.concat [some_var, Foo]
         
        - Source + Source

        args @@ -259,7 +383,7 @@

        Examples

        #=> { :__block__, 0, [1,2,3] }
        - Source + Source

        __scope__(opts, args) @@ -275,7 +399,7 @@

        Examples

        Check quote/1 for more information.

        - Source + Source

        alias(module, opts) @@ -319,7 +443,7 @@

        Lexical scope

        have lexical scope. This means you can set up aliases inside specific functions and it won't affect the overall scope.

        - Source + Source

        bc(args) @@ -333,7 +457,7 @@

        Lexical scope

        "helloworld"
        - Source + Source

        import(module, opts) @@ -411,7 +535,7 @@

        Alias/Require shortcut

        also accepts as: as an option so it automatically sets up an alias. Please check alias for more information.

        - Source + Source

        lc(args) @@ -459,7 +583,7 @@

        Alias/Require shortcut

        [{213,45,132},{64,76,32},{76,0,0},{234,32,15}]
        - Source + Source

        quote(opts, list2) @@ -599,7 +723,7 @@

        Stacktrace information

        particular, the macro __FILE__ will always point to GenServer.Behaviour file.

        - Source + Source

        require(module, opts) @@ -630,7 +754,7 @@

        Alias shortcut

        require also accepts as: as an option so it automatically sets up an alias. Please check alias for more information.

        - Source + Source

        unquote(expr) @@ -659,7 +783,7 @@

        Examples

        #=> { :sum, 0, [1, 13, 3] }
        - Source + Source

        unquote_splicing(expr) @@ -674,7 +798,7 @@

        Examples

        #=> { :sum, 0, [1, 2, 3, 4, 5] }
        - Source + Source

        {args} @@ -687,7 +811,7 @@

        Examples

        { 1, 2, 3 }
        - Source + Source diff --git a/docs/master/Kernel.Typespec.html b/docs/master/Kernel.Typespec.html index 111ff35ad..b0ee9c9c9 100644 --- a/docs/master/Kernel.Typespec.html +++ b/docs/master/Kernel.Typespec.html @@ -236,7 +236,7 @@

        Functions

        The module has to have a corresponding beam file on the file system.

        - Source + Source

        beam_specs(module) @@ -249,7 +249,7 @@

        Functions

        The module has to have a corresponding beam file on the file system.

        - Source + Source

        beam_types(module) @@ -262,28 +262,28 @@

        Functions

        The module has to have a corresponding beam file on the file system.

        - Source + Source

        define_callback(module, tuple, definition)

        Defines a callback by receiving Erlang's typespec.

        - Source + Source

        define_spec(module, tuple, definition)

        Defines a spec by receiving Erlang's typespec.

        - Source + Source

        define_type(module, kind, type)

        Defines a type, typep or opaque by receiving Erlang's typespec.

        - Source + Source

        defines_callback?(module, name, arity) @@ -291,7 +291,7 @@

        Functions

        Returns true if the current module defines a callback. This function is only available for modules being compiled.

        - Source + Source

        defines_spec?(module, name, arity) @@ -299,7 +299,7 @@

        Functions

        Returns true if the current module defines a given spec. This function is only available for modules being compiled.

        - Source + Source

        defines_type?(module, name, arity) @@ -308,21 +308,21 @@

        Functions

        (private, opaque or not). This function is only available for modules being compiled.

        - Source + Source

        spec_to_ast(name, arg2)

        Converts a spec clause back to Elixir AST.

        - Source + Source

        type_to_ast(arg1)

        Converts a type clause back to Elixir AST.

        - Source + Source
        @@ -342,7 +342,7 @@

        Examples

        @callback add(number, number) :: number
         
        - Source + Source

        defopaque(type) @@ -368,7 +368,7 @@

        Examples

        @spec add(number, number) :: number
         
        - Source + Source

        deftype(type) diff --git a/docs/master/Kernel.html b/docs/master/Kernel.html index 271af6f2d..cb1276ba4 100644 --- a/docs/master/Kernel.html +++ b/docs/master/Kernel.html @@ -346,6 +346,11 @@

        Functions summary

        raise/2
      • +
      • + + raise/3 + +
      • round/1 @@ -1084,7 +1089,7 @@

        Examples

        it is not loaded. Check Code.ensure_loaded/1 for more information.

        - Source + Source

        hd(list) @@ -1430,7 +1435,7 @@

        Examples

        it is not loaded. Check Code.ensure_loaded/1 for more information.

        - Source + Source

        make_ref() @@ -1518,8 +1523,10 @@

        Warning:

        Raises an error.

        -

        If the argument is a binary, it raises RuntimeError with the message. -If anything else, becomes a call to raise(argument, []).

        +

        If the argument is a binary, it raises RuntimeError +using the given argument as message.

        + +

        If anything else, becomes a call to raise(argument, []).

        Examples

        @@ -1534,7 +1541,7 @@

        Examples

        end
        - Source + Source

        raise(exception, args) @@ -1546,20 +1553,38 @@

        Examples

        structure.

        Any module defined via defexception automatically -defines exception(args) that returns a new instance -of the record and a exception(args, current) that -updates the current exception.

        - -

        Re-raising an exception will retrieve the previous -stacktrace so it keps the properties of the original -exception.

        +defines both exception(args) and exception(args, current) +that creates a new and updates the given exception.

        Examples

        raise ArgumentError, message: "Sample"
         
        - Source + Source +
        +

        + raise(exception, args, stacktrace) +

        +

        Re-raises an exception with the given stacktrace.

        + +

        Examples

        + +
        try do
        +  raise "Oops"
        +rescue
        +  exception, stacktrace ->
        +    if exception.message == "Oops" do
        +      raise exception, [], stacktrace
        +    end
        +end
        +
        + +

        Notice that Elixir does not associate stacktraces +with exceptions by default. They need to be explicitly +captured and added to the exception.

        +
        + Source

        round(number) @@ -1810,7 +1835,7 @@

        Examples

        this operator accepts any expression as arguments, not only booleans, however it is not allowed in guards.

        - Source + Source

        left * right @@ -1895,7 +1920,7 @@

        Examples

        3 in 1..3 #=> true
        - Source + Source

        left / right @@ -1949,7 +1974,7 @@

        Examples

        String.graphemes("Hello") /> Enum.reverse
         
        - Source + Source

        left < right @@ -2011,7 +2036,7 @@

        Examples

        x #=> "bar"
        - Source + Source

        left == right @@ -2064,7 +2089,7 @@

        Examples

        "abcd" =~ %r/e/ #=> nil
        - Source + Source

        left > right @@ -2140,7 +2165,7 @@

        Examples

        time and not at runtime. Check the module Module for other functions to manipulate module attributes.

        - Source + Source

        __B__(string, list2) @@ -2154,7 +2179,7 @@

        Examples

        %B(f#{o}o) #=> "f\#{o}o"
        - Source + Source

        __C__(arg1, list2) @@ -2168,7 +2193,7 @@

        Examples

        %C(f#{o}o) #=> 'f\#{o}o'
        - Source + Source

        __R__(arg1, options) @@ -2181,7 +2206,7 @@

        Examples

        Regex.match? %R(f#{1,3}o), "f#o"  #=> true
         
        - Source + Source

        __b__(arg1, list2) @@ -2195,7 +2220,7 @@

        Examples

        %b(f#{:o}o) #=> "foo"
        - Source + Source

        __c__(arg1, list2) @@ -2209,7 +2234,7 @@

        Examples

        %c(f#{:o}o) #=> 'foo'
        - Source + Source

        __r__(arg1, options) @@ -2221,7 +2246,7 @@

        Examples

        Regex.match? %r(foo), "foo"  #=> true
         
        - Source + Source

        access(element, args) @@ -2295,7 +2320,7 @@

        Examples

        access a, 1 #=> :a
        - Source + Source

        left and right @@ -2322,7 +2347,7 @@

        Examples

        atom_to_binary :my_atom #=> "my_atom"
         
        - Source + Source

        binary_to_atom(some_binary) @@ -2335,7 +2360,7 @@

        Examples

        binary_to_atom "my_atom" #=> :my_atom
         
        - Source + Source

        binary_to_existing_atom(some_binary) @@ -2348,7 +2373,7 @@

        Examples

        binary_to_existing_atom "my_atom" #=> :my_atom
        - Source + Source

        binary_to_float(some_binary) @@ -2360,7 +2385,7 @@

        Examples

        binary_to_float "2.2017764e+0" #=> 2.2017764
         
        - Source + Source

        binary_to_integer(some_binary) @@ -2372,7 +2397,7 @@

        Examples

        binary_to_integer "123" #=> 123
         
        - Source + Source

        binary_to_integer(some_binary, base) @@ -2385,7 +2410,7 @@

        Examples

        binary_to_integer("3FF", 16) #=> 1023
         
        - Source + Source

        case(condition, blocks) @@ -2438,7 +2463,7 @@

        Examples

        end
        - Source + Source

        cond(list1) @@ -2458,7 +2483,7 @@

        Examples

        end
        - Source + Source

        def(name, list2) @@ -2618,7 +2643,7 @@

        Examples

        #=> [3,2,1]
        - Source + Source

        defexception(name, fields, opts // [], do_block // []) @@ -2642,7 +2667,7 @@

        Examples

        Defines an implementation for the given protocol. See defprotocol/2 for examples.

        - Source + Source

        defmodule(name, list2) @@ -2699,7 +2724,7 @@

        Dynamic names

        An overridable function is lazily defined, allowing a developer to customize it.

        - Source + Source

        defp(name, list2) @@ -2857,7 +2882,7 @@

        Types

        The @spec above expresses that all types allowed to implement the given protocol are valid argument types for the given function.

        - Source + Source

        defrecord(name, fields, opts // [], do_block // []) @@ -3055,7 +3080,7 @@

        Examples

        the first value from the right side. Otherwise, it will raise a CaseClauseError.

        - Source + Source

        div(left, right) @@ -3069,7 +3094,7 @@

        Examples

        div 5, 2 #=> 2
         
        - Source + Source

        elem(tuple, index) @@ -3085,7 +3110,7 @@

        Example

        elem(tuple, 1) #=> :bar
        - Source + Source

        float_to_binary(some_float) @@ -3098,7 +3123,7 @@

        Examples

        float_to_binary 7.0 #=> "7.00000000000000000000e+00"
         
        - Source + Source

        function(args) @@ -3180,7 +3205,7 @@

        Function retrieval

        f.([1,[2],3]) #=> [1,2,3]
        - Source + Source

        if(condition, clauses) @@ -3224,7 +3249,7 @@

        Blocks examples

        If you want to compare more than two clauses, you can use the cond/1 macro.

        - Source + Source

        left in right @@ -3266,7 +3291,7 @@

        Clauses

        In this case, Elixir will automatically expand it and define the variable for us.

        - Source + Source

        inspect(arg, opts // []) @@ -3281,7 +3306,7 @@

        Options

      • :raw - tuples are not formatted as the inspect protocol, they are always shown as tuples, defaults to false;

      • :limit - the limit of items that are shown in tuples, bitstrings and -lists. Do not apply to strings;

      • +lists. Does not apply to strings;

      Examples

      @@ -3290,7 +3315,7 @@

      Examples

      #=> ":foo" - Source + Source

      integer_to_binary(some_integer) @@ -3303,7 +3328,7 @@

      Examples

      integer_to_binary 123 #=> "123"
       
      - Source + Source

      integer_to_binary(some_integer, base) @@ -3316,7 +3341,7 @@

      Examples

      integer_to_binary 77 #=> "77"
       
      - Source + Source

      is_exception(thing) @@ -3329,14 +3354,14 @@

      Examples

      is_exception(1) #=> false
      - Source + Source

      is_range(thing)

      Check if the given argument is a range.

      - Source + Source

      is_record(thing, kind) @@ -3353,14 +3378,14 @@

      Examples

      is_record(Config.new, List) #=> false
      - Source + Source

      is_regex(thing)

      Check if the given argument is a regex.

      - Source + Source

      match?(left, right) @@ -3387,7 +3412,7 @@

      Examples

      Enum.filter list, match?({:a, x } when x < 2, &1)
      - Source + Source

      nil?(x) @@ -3401,7 +3426,7 @@

      Examples

      nil? nil #=> true
      - Source + Source

      not arg @@ -3477,7 +3502,7 @@

      Examples

      will occur immediately.

    2635. - Source + Source

      rem(left, right) @@ -3491,7 +3516,7 @@

      Examples

      rem 5, 2 #=> 1
       
      - Source + Source

      setelem(tuple, index, value) @@ -3507,7 +3532,7 @@

      Example

      setelem(tuple, 0, :baz) #=> { :baz, :bar, 3 }
      - Source + Source

      to_binary(arg) @@ -3521,7 +3546,7 @@

      Examples

      #=> "foo"
      - Source + Source

      to_char_list(arg) @@ -3534,7 +3559,7 @@

      Examples

      #=> 'foo'
      - Source + Source

      try(args) @@ -3651,7 +3676,7 @@

      Variable visibility

      end
      - Source + Source

      unless(clause, options) @@ -3660,7 +3685,7 @@

      Variable visibility

      unless a value evalutes to true. Check if for examples and documentation.

      - Source + Source

      use(module, args // []) @@ -3697,7 +3722,7 @@

      Examples

      end
      - Source + Source

      var!(var) @@ -3741,7 +3766,7 @@

      Examples

      this operator accepts any expression as arguments, not only booleans, however it is not allowed in guards.

      - Source + Source diff --git a/docs/master/KeyError.html b/docs/master/KeyError.html index db307b332..b0a2a2e64 100644 --- a/docs/master/KeyError.html +++ b/docs/master/KeyError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -50,55 +50,10 @@

      Fields (and defaults)

      Functions summary

      @@ -111,65 +66,11 @@

      Functions summary

      Functions

      -

      - exception(args) -

      -
      - Source -
      -

      - exception(args, self) -

      -
      - Source -
      -

      - key(record) -

      -
      - Source -
      -

      - key(value, record) -

      -
      - Source -

      message(exception)

      - Source -
      -

      - new() -

      -
      - Source -
      -

      - new(opts) -

      -
      - Source -
      -

      - to_keywords(record) -

      -
      - Source -
      -

      - update(keywords, record) -

      -
      - Source -
      -

      - update_key(function, record) -

      -
      - Source + Source
      diff --git a/docs/master/Keyword.html b/docs/master/Keyword.html index 9ba61189e..11a174d02 100644 --- a/docs/master/Keyword.html +++ b/docs/master/Keyword.html @@ -126,6 +126,11 @@

      Functions summary

      put/3 +
    2636. + + put_new/3 + +
    2637. update/3 @@ -181,7 +186,7 @@

      Examples

      #=> true - Source + Source

      from_enum(enum) @@ -252,7 +257,7 @@

      Examples

      #=> false
      - Source + Source

      keys(keywords) @@ -286,7 +291,7 @@

      Examples

      #=> [a:3, b:2, d: 4]
      - Source + Source

      merge(d1, d2, fun) @@ -302,7 +307,7 @@

      Examples

      #=> [a:4, b:2, d: 4]
      - Source + Source

      new() @@ -343,7 +348,7 @@

      Examples

      put(keywords, key, value)

      -

      Sets the given value under key.

      +

      Puts the given value under key.

      If a previous value is already stored, all entries are removed and the value is overriden.

      @@ -355,6 +360,20 @@

      Examples

      Source +
      +

      + put_new(keywords, key, value) +

      +

      Puts the given value under key unless the entry key +already exists.

      + +

      Examples

      + +
      Keyword.put_new [a: 1, b: 2], :a, 3
      +#=> [a: 1, b: 2]
      +
      +
      + Source

      update(list1, key, fun) @@ -370,7 +389,7 @@

      Examples

      #=> KeyError
      - Source + Source

      update(list1, key, initial, fun) @@ -386,7 +405,7 @@

      Examples

      #=> [a: 1, b: 11]
      - Source + Source

      values(keywords) diff --git a/docs/master/List.Chars.Atom.html b/docs/master/List.Chars.Atom.html index 5939205b2..b672659fb 100644 --- a/docs/master/List.Chars.Atom.html +++ b/docs/master/List.Chars.Atom.html @@ -36,7 +36,15 @@

      +

      Functions summary

      + @@ -44,6 +52,19 @@

      +
      +

      Functions

      +
      +

      + to_char_list(atom) +

      +
      + Source +
      +
      + + +

      diff --git a/docs/master/List.Chars.BitString.html b/docs/master/List.Chars.BitString.html index 7230cf1c2..0e87f7dd2 100644 --- a/docs/master/List.Chars.BitString.html +++ b/docs/master/List.Chars.BitString.html @@ -36,7 +36,15 @@

      +

      Functions summary

      + @@ -44,6 +52,19 @@

      +
      +

      Functions

      +
      +

      + to_char_list(bitstring) +

      +
      + Source +
      +
      + + + diff --git a/docs/master/List.Chars.List.html b/docs/master/List.Chars.List.html index 918a04826..5abba51c1 100644 --- a/docs/master/List.Chars.List.html +++ b/docs/master/List.Chars.List.html @@ -36,7 +36,15 @@

      +

      Functions summary

      + @@ -44,6 +52,19 @@

      +
      +

      Functions

      +
      +

      + to_char_list(list) +

      +
      + Source +
      +
      + + + diff --git a/docs/master/List.Chars.Number.html b/docs/master/List.Chars.Number.html index 234e6a32d..477665e1d 100644 --- a/docs/master/List.Chars.Number.html +++ b/docs/master/List.Chars.Number.html @@ -36,7 +36,15 @@

      +

      Functions summary

      + @@ -44,6 +52,19 @@

      +
      +

      Functions

      +
      +

      + to_char_list(integer) +

      +
      + Source +
      +
      + + + diff --git a/docs/master/List.html b/docs/master/List.html index 83bdad2fc..75aca8a52 100644 --- a/docs/master/List.html +++ b/docs/master/List.html @@ -408,7 +408,7 @@

      Examples

      #=> [[1, 2, 3], [:a, :b, :c]] - Source + Source

      wrap(list) @@ -422,7 +422,7 @@

      Examples

      List.wrap [1,2,3] #=> [1,2,3]
       
      - Source + Source

      zip(list_of_lists) @@ -438,7 +438,7 @@

      Examples

      #=> [{1, 3, 5}]
      - Source + Source diff --git a/docs/master/Macro.Env.html b/docs/master/Macro.Env.html index 5ddaf60db..c44f3587f 100644 --- a/docs/master/Macro.Env.html +++ b/docs/master/Macro.Env.html @@ -29,8 +29,27 @@

      -

      A record that contains compile time environment information, -It can be accessed at any time by calling ENV.

      +

      A record that holds compile time environment information.

      + +

      The current environment can be accessed at any time as +__ENV__. Inside macros, the caller environment can be +accessed as __CALLER__. It contains the following fields:

      + +
        +
      • module - the current module name.
      • +
      • file - the current file name as a binary
      • +
      • line - the current line as an integer
      • +
      • function - a tuple as { atom, integer }, where the first +element is the function name and the seconds its arity. Returns +nil if not inside a function
      • +
      • aliases - a list of two item tuples, where the first +item is the aliased name and the second the actual name
      • +
      • context - the context of the environment. It can be nil +(default context), inside a guard or inside an assign
      • +
      • requires - the list of required modules
      • +
      • functions - a list of functions imported from each module
      • +
      • macros - a list of macros imported from each module
      • +
      @@ -104,56 +123,6 @@

      Fields (and defaults)

      Functions summary

      • - - aliases/1 - -
      • -
      • - - aliases/2 - -
      • -
      • - - context/1 - -
      • -
      • - - context/2 - -
      • -
      • - - file/1 - -
      • -
      • - - file/2 - -
      • -
      • - - function/1 - -
      • -
      • - - function/2 - -
      • -
      • - - functions/1 - -
      • -
      • - - functions/2 - -
      • -
      • in_guard?/1 @@ -163,16 +132,6 @@

        Functions summary

        in_match?/1
      • -
      • - - line/1 - -
      • -
      • - - line/2 - -
      • location/1 @@ -180,97 +139,7 @@

        Functions summary

      • - macros/1 - -
      • -
      • - - macros/2 - -
      • -
      • - - module/1 - -
      • -
      • - - module/2 - -
      • -
      • - - new/0 - -
      • -
      • - - new/1 - -
      • -
      • - - requires/1 - -
      • -
      • - - requires/2 - -
      • -
      • - - to_keywords/1 - -
      • -
      • - - update/2 - -
      • -
      • - - update_aliases/2 - -
      • -
      • - - update_context/2 - -
      • -
      • - - update_file/2 - -
      • -
      • - - update_function/2 - -
      • -
      • - - update_functions/2 - -
      • -
      • - - update_line/2 - -
      • -
      • - - update_macros/2 - -
      • -
      • - - update_module/2 - -
      • -
      • - - update_requires/2 + stacktrace/1
      • @@ -285,82 +154,13 @@

        Functions summary

        Functions

        -

        - aliases(record) -

        -

        Returns a list of two item tuples, where the first -item is the aliased name and the second the actual name.

        -
        - Source -
        -

        - aliases(value, record) -

        -
        - Source -
        -

        - context(record) -

        -

        Returns the context of the environment. It can be nil -(default context), inside a guard or inside an assign.

        -
        - Source -
        -

        - context(value, record) -

        -
        - Source -
        -

        - file(record) -

        -

        Returns the current file name as a binary.

        -
        - Source -
        -

        - file(value, record) -

        -
        - Source -
        -

        - function(record) -

        -

        Returns a tuple as { Atom, Integer }, where the first element -is the function name and the seconds its arity. Returns nil -if not inside a function.

        -
        - Source -
        -

        - function(value, record) -

        -
        - Source -
        -

        - functions(record) -

        -

        Returns a list of functions imported from each module.

        -
        - Source -
        -

        - functions(value, record) -

        -
        - Source -

        in_guard?(record)

        Returns wether the compilation environment is currently inside a guard.

        - Source + Source

        in_match?(record) @@ -368,20 +168,7 @@

        Functions

        Returns wether the compilation environment is currently inside a match clause.

        - Source -
        -

        - line(record) -

        -

        Returns the current line as an integer.

        -
        - Source -
        -

        - line(value, record) -

        -
        - Source + Source

        location(record) @@ -389,124 +176,14 @@

        Functions

        Returns a keyword list containing the file and line information as keys.

        - Source -
        -

        - macros(record) -

        -

        Returns a list of macros imported from each module.

        -
        - Source + Source
        -

        - macros(value, record) +

        + stacktrace(record)

        -
        - Source -
        -

        - module(record) -

        -

        Returns the current module name.

        -
        - Source -
        -

        - module(value, record) -

        -
        - Source -
        -

        - new() -

        -
        - Source -
        -

        - new(opts) -

        -
        - Source -
        -

        - requires(record) -

        -

        Returns the list of required modules.

        +

        Returns the environment stacktrace.

        - Source -
        -

        - requires(value, record) -

        -
        - Source -
        -

        - to_keywords(record) -

        -
        - Source -
        -

        - update(keywords, record) -

        -
        - Source -
        -

        - update_aliases(function, record) -

        -
        - Source -
        -

        - update_context(function, record) -

        -
        - Source -
        -

        - update_file(function, record) -

        -
        - Source -
        -

        - update_function(function, record) -

        -
        - Source -
        -

        - update_functions(function, record) -

        -
        - Source -
        -

        - update_line(function, record) -

        -
        - Source -
        -

        - update_macros(function, record) -

        -
        - Source -
        -

        - update_module(function, record) -

        -
        - Source -
        -

        - update_requires(function, record) -

        -
        - Source + Source
        diff --git a/docs/master/Macro.html b/docs/master/Macro.html index 0ab1ed027..a76e326f9 100644 --- a/docs/master/Macro.html +++ b/docs/master/Macro.html @@ -122,7 +122,7 @@

        Functions

        do_safe_term(terms)

        - Source + Source

        escape(tuple) @@ -237,7 +237,7 @@

        Examples

        end
        - Source + Source

        extract_args(expr) @@ -269,7 +269,7 @@

        Examples

        evaluate code) and returns :ok unless a given term is unsafe, which is returned as { :unsafe, term }.

        - Source + Source

        to_binary(tree) @@ -282,7 +282,7 @@

        Examples

        #=> "foo.bar(1, 2, 3)"
        - Source + Source

        unescape_binary(chars) @@ -292,9 +292,9 @@

        Examples

        Check unescape_binary/2 for information on how to customize the escaping map.

        -

        In this setup, Elixir will escape the following: \b, \d, -\e, \f, \n, \r, \s, \t and \v. Octals are also -escaped according to the latin1 set they represent.

        +

        In this setup, Elixir will escape the following: \a, \b, +\d, \e, \f, \n, \r, \s, \t and \v. Octals are +also escaped according to the latin1 set they represent.

        This function is commonly used on sigil implementations (like %r, %b and others).

        @@ -323,7 +323,8 @@

        Map

        representing the number of the characters it wants to unescape. Here is the default mapping function implemented by Elixir:

        -
        def unescape_map(?b), do: ?\b
        +
        def unescape_map(?a), do: ?\a
        +def unescape_map(?b), do: ?\b
         def unescape_map(?d), do: ?\d
         def unescape_map(?e), do: ?\e
         def unescape_map(?f), do: ?\f
        @@ -355,7 +356,7 @@ 

        Examples

        Macro.unescape_binary "example\\n", unescape_map(&1)
         
        - Source + Source

        unescape_tokens(tokens) @@ -367,7 +368,7 @@

        Examples

        when implementing your own sigils. Check the implementation of Kernel.__b__ for examples.

        - Source + Source

        unescape_tokens(tokens, map) @@ -375,7 +376,7 @@

        Examples

        Unescape the given tokens according to the given map. Check unescape_tokens/1 and unescaped/2 for more information.

        - Source + Source
        diff --git a/docs/master/MatchError.html b/docs/master/MatchError.html index 72f662c02..265d2fb13 100644 --- a/docs/master/MatchError.html +++ b/docs/master/MatchError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -50,55 +50,10 @@

        Fields (and defaults)

        Functions summary

        @@ -111,65 +66,11 @@

        Functions summary

        Functions

        -

        - actual(record) -

        -
        - Source -
        -

        - actual(value, record) -

        -
        - Source -
        -

        - exception(args) -

        -
        - Source -
        -

        - exception(args, self) -

        -
        - Source -

        message(exception)

        - Source -
        -

        - new() -

        -
        - Source -
        -

        - new(opts) -

        -
        - Source -
        -

        - to_keywords(record) -

        -
        - Source -
        -

        - update(keywords, record) -

        -
        - Source -
        -

        - update_actual(function, record) -

        -
        - Source + Source
        diff --git a/docs/master/Mix.Deps.Lock.html b/docs/master/Mix.Deps.Lock.html deleted file mode 100644 index c7b0b2874..000000000 --- a/docs/master/Mix.Deps.Lock.html +++ /dev/null @@ -1,101 +0,0 @@ - - - - Mix.Deps.Lock - - - - - - - - - - - - -
        -

        - Mix.Deps.Lock - -

        - - -
        -

        This is the module responsible to manage mix.lock file.

        - -
        - - - Source - - - - - - -

        Functions summary

        - - - - - - - - -
        -

        Functions

        -
        -

        - lockfile() -

        -

        Returns the lockfile path.

        -
        - Source -
        -

        - read(file // lockfile) -

        -

        Read the file, returns a keyword list containing -the app name and its current lock information.

        -
        - Source -
        -

        - write(file // lockfile, dict) -

        -

        Receives a keyword list and writes it to the disk.

        -
        - Source -
        -
        - - - - - -
        - - diff --git a/docs/master/Mix.Error.html b/docs/master/Mix.Error.html index e617924c7..1617d4c20 100644 --- a/docs/master/Mix.Error.html +++ b/docs/master/Mix.Error.html @@ -100,11 +100,6 @@

        Functions summary

        to_keywords/1 -
      • - - toggle_mix_error/1 - -
      • update/2 @@ -185,12 +180,6 @@

        Functions

        Source -
        -

        - toggle_mix_error(record) -

        -
        - Source

        update(keywords, record) diff --git a/docs/master/Mix.InvalidTaskError.html b/docs/master/Mix.InvalidTaskError.html index 044b89a62..7609a4984 100644 --- a/docs/master/Mix.InvalidTaskError.html +++ b/docs/master/Mix.InvalidTaskError.html @@ -105,11 +105,6 @@

        Functions summary

        to_keywords/1
      • -
      • - - toggle_mix_error/1 - -
      • update/2 @@ -196,12 +191,6 @@

        Functions

        Source -
        -

        - toggle_mix_error(record) -

        -
        - Source

        update(keywords, record) diff --git a/docs/master/Mix.NoProjectError.html b/docs/master/Mix.NoProjectError.html index 82f5178b3..18dce114e 100644 --- a/docs/master/Mix.NoProjectError.html +++ b/docs/master/Mix.NoProjectError.html @@ -100,11 +100,6 @@

        Functions summary

        to_keywords/1
      • -
      • - - toggle_mix_error/1 - -
      • update/2 @@ -185,12 +180,6 @@

        Functions

        Source -
        -

        - toggle_mix_error(record) -

        -
        - Source

        update(keywords, record) diff --git a/docs/master/Mix.NoTaskError.html b/docs/master/Mix.NoTaskError.html index 213d40a2d..5e559456b 100644 --- a/docs/master/Mix.NoTaskError.html +++ b/docs/master/Mix.NoTaskError.html @@ -105,11 +105,6 @@

        Functions summary

        to_keywords/1
      • -
      • - - toggle_mix_error/1 - -
      • update/2 @@ -196,12 +191,6 @@

        Functions

        Source -
        -

        - toggle_mix_error(record) -

        -
        - Source

        update(keywords, record) diff --git a/docs/master/Mix.OutOfDateDepsError.html b/docs/master/Mix.OutOfDateDepsError.html index 52d41cafd..f1120f0ab 100644 --- a/docs/master/Mix.OutOfDateDepsError.html +++ b/docs/master/Mix.OutOfDateDepsError.html @@ -105,11 +105,6 @@

        Functions summary

        to_keywords/1
      • -
      • - - toggle_mix_error/1 - -
      • update/2 @@ -196,12 +191,6 @@

        Functions

        Source -
        -

        - toggle_mix_error(record) -

        -
        - Source

        update(keywords, record) diff --git a/docs/master/Mix.Project.html b/docs/master/Mix.Project.html index b6549ba48..cef543bbd 100644 --- a/docs/master/Mix.Project.html +++ b/docs/master/Mix.Project.html @@ -90,6 +90,11 @@

        Functions summary

        refresh/0
      • +
      • + + sources/0 + +
      @@ -108,7 +113,7 @@

      Functions

      Returns the project configuration already considering the current environment.

      - Source + Source

      get() @@ -121,16 +126,16 @@

      Functions

      function raises Mix.NoProjectError in case no project is available.

      -

      Returns nil if no project./

      +

      Returns nil if no project.

      - Source + Source

      get!()

      Same as get/0 but raises an exception if no project.

      - Source + Source

      refresh() @@ -138,7 +143,14 @@

      Functions

      Refresh the project configuration. Usually required when the environment changes during a task.

      - Source + Source +
      +

      + sources() +

      +

      Returns a list of project source files (mix.exs and mix.lock)

      +
      + Source
      diff --git a/docs/master/Mix.Tasks.App.Start.html b/docs/master/Mix.Tasks.App.Start.html new file mode 100644 index 000000000..f3ade2d1b --- /dev/null +++ b/docs/master/Mix.Tasks.App.Start.html @@ -0,0 +1,83 @@ + + + + Mix.Tasks.App.Start + + + + + + + + + + + + +
      +

      + Mix.Tasks.App.Start + +

      + + +
      +

      Starts all registered apps. If no apps key exists, +it starts the current application.

      + +

      Command line options

      + +
        +
      • --no-compile - do not compile even if files require compilation;
      • +
      • --no-start - do not start applications after compilation;
      • +
      + +
      + + + Source + + + + + + +

      Functions summary

      + + + + + + + + +
      +

      Functions

      +
      +

      + run(args) +

      +
      + Source +
      +
      + + + + + +
      + + diff --git a/docs/master/Mix.Tasks.Compile.App.html b/docs/master/Mix.Tasks.Compile.App.html index 32132466a..ed6f67653 100644 --- a/docs/master/Mix.Tasks.Compile.App.html +++ b/docs/master/Mix.Tasks.Compile.App.html @@ -40,17 +40,17 @@

      http://www.erlang.org/doc/design_principles/applications.html

      -

      Configuration

      +

      Command line options

        -
      • :app - The application name as a binary (required)
      • -
      • :version - The application version as a binary (required)
      • +
      • --force forces compilation regardless of mod times
      -

      Command line options

      +

      Configuration

        -
      • --force forces compilation regardless of mod times
      • +
      • :app - The application name as a binary (required)
      • +
      • :version - The application version as a binary (required)
      diff --git a/docs/master/Mix.Tasks.Compile.Elixir.html b/docs/master/Mix.Tasks.Compile.Elixir.html index 0e8732754..523200517 100644 --- a/docs/master/Mix.Tasks.Compile.Elixir.html +++ b/docs/master/Mix.Tasks.Compile.Elixir.html @@ -48,6 +48,13 @@

      development cycles, for such, a developer can pass the --quick otion.

      +

      Command line options

      + +
        +
      • --force - forces compilation regardless of module times;
      • +
      • --quick, -q - only compile files that changed;
      • +
      +

      Configuration

        @@ -55,13 +62,6 @@

        Configuration

        to Elixir's compiler, they are: :ignore_module_conflict, :docs and :debug_info. By default, uses the same behaviour as Elixir -
      - -

      Command line options

      - -
        -
      • --force - forces compilation regardless of module times;
      • -
      • --quick, -q - only compile files that changed;
      diff --git a/docs/master/Mix.Tasks.Compile.html b/docs/master/Mix.Tasks.Compile.html index 29f4467a9..03526f9d9 100644 --- a/docs/master/Mix.Tasks.Compile.html +++ b/docs/master/Mix.Tasks.Compile.html @@ -44,6 +44,14 @@

      Configuration

      [compilers: [:elixir, :mycompiler, :app]]
       
      +

      Command line options

      + +
        +
      • --list - List all enabled compilers.
      • +
      + +

      Remaining options are forwarded to underlying compilers.

      +

      Common configuration

      The following options are usually shared by different compilers:

      @@ -65,12 +73,6 @@

      Common configuration

      is a change:

      [compile_exts: [:ex]]

    2638. - - -

      Command line options

      - -
        -
      • --list - List all enabled compilers.
      @@ -106,7 +108,7 @@

      Functions

      run(args)

      - Source + Source diff --git a/docs/master/Mix.Tasks.Deps.Compile.html b/docs/master/Mix.Tasks.Deps.Compile.html index fcc3e500c..820af8949 100644 --- a/docs/master/Mix.Tasks.Deps.Compile.html +++ b/docs/master/Mix.Tasks.Deps.Compile.html @@ -44,16 +44,9 @@

      The compilation can be customized by passing a compile option in the dependency:

      -
      { :some_dependency, "0.1.0", git: "...", compile: :compile_some_dependency }
      +
      { :some_dependency, "0.1.0", git: "...", compile: "command to compile" }
       
      -

      If the compile option is an atom, it will invoke the given atom -in the current project passing the app name as argument. Except -if the atom is :noop, where nothing is done.

      - -

      If a binary, it is considered to be command line instructions -which mix will use to shell out.

      - @@ -87,7 +80,7 @@

      Functions

      run(args)

      - Source + Source diff --git a/docs/master/Mix.Tasks.Iex.html b/docs/master/Mix.Tasks.Iex.html index bde71a0b6..80c6f6303 100644 --- a/docs/master/Mix.Tasks.Iex.html +++ b/docs/master/Mix.Tasks.Iex.html @@ -32,6 +32,13 @@

      Before starting IEx, it invokes the prepare task which defaults to compile and load your project.

      +

      Command line options

      + +
        +
      • --no-compile - do not compile even if files require compilation;
      • +
      • --no-start - do not start applications after compilation;
      • +
      + @@ -62,10 +69,10 @@

      Functions summary

      Functions

      - run(_) + run(args)

      - Source + Source
      diff --git a/docs/master/Mix.Tasks.New.html b/docs/master/Mix.Tasks.New.html index 18b56df2d..82532352c 100644 --- a/docs/master/Mix.Tasks.New.html +++ b/docs/master/Mix.Tasks.New.html @@ -30,12 +30,17 @@

      Creates a new Elixir project. It expects the path of the project as argument.

      -
      mix new PATH [--app APP] [--module MODULE]
      +
      mix new PATH [--sup] [--app APP] [--module MODULE]
       

      A project at the given PATH will be created. The application name and module name will be retrieved -from the path, unless -app or --module is given.

      +from the path, unless one of -app or --module +is given.

      + +

      An --sup option can be given to generate an +app with a supervisor and an application module +that starts the supervisor.

      Examples

      @@ -45,6 +50,11 @@

      Examples

      Is equivalent to:

      mix new hello_world --app hello_world --module HelloWorld
      +
      + +

      To generate an app with supervisor and application behaviours:

      + +
      mix new hello_world --sup
       
      @@ -80,7 +90,7 @@

      Functions

      run(argv)

      - Source + Source diff --git a/docs/master/Mix.Tasks.Run.html b/docs/master/Mix.Tasks.Run.html index 5eac9c9fd..99dd19d48 100644 --- a/docs/master/Mix.Tasks.Run.html +++ b/docs/master/Mix.Tasks.Run.html @@ -38,6 +38,8 @@

      Command line options

    2639. --require, -r - Requires a file before running the command
    2640. --parallel-require, -pr - Requires a file in parallel
    2641. --no-halt - Does not halt the system after running the command
    2642. +
    2643. --no-compile - do not compile even if files require compilation;
    2644. +
    2645. --no-start - do not start applications after compilation;
    2646. Examples

      @@ -79,7 +81,7 @@

      Functions

      run(args)

      - Source + Source diff --git a/docs/master/Mix.Tasks.Test.html b/docs/master/Mix.Tasks.Test.html index c5a2433c6..16f8a4341 100644 --- a/docs/master/Mix.Tasks.Test.html +++ b/docs/master/Mix.Tasks.Test.html @@ -39,6 +39,15 @@

      A list of files can be given after the task name in order to select the files to compile.

      +

      Command line options

      + +
        +
      • --force - forces compilation regardless of module times;
      • +
      • --quick, -q - only compile files that changed;
      • +
      • --no-compile - do not compile even if files require compilation;
      • +
      • --no-start - do not start applications after compilation;
      • +
      +

      Configuration

        @@ -83,7 +92,7 @@

        Functions

        run(args)

        - Source + Source diff --git a/docs/master/Mix.Utils.html b/docs/master/Mix.Utils.html index 861071dde..46674d198 100644 --- a/docs/master/Mix.Utils.html +++ b/docs/master/Mix.Utils.html @@ -139,7 +139,7 @@

        Examples

        Mix.Utils.camelize "foo_bar" #=> "FooBar"
         
        - Source + Source

        command_to_module(command, at // Elixir) @@ -170,7 +170,7 @@

        Examples

        #=> "Compile.Elixir"
      - Source + Source

      config_merge(old, new) @@ -178,7 +178,7 @@

      Examples

      Merges two configs recursively, merging keyword lists and concatenating normal lists.

      - Source + Source

      extract_files(paths, exts) @@ -190,7 +190,7 @@

      Examples

      It ignores files which start with "."

      - Source + Source

      extract_stale(sources, targets) @@ -215,7 +215,7 @@

      Examples

      #=> "compile.elixir"

      - Source + Source

      preserving_mtime(path, fun) @@ -223,7 +223,7 @@

      Examples

      Executes a function but preserves the given path mtime properties.

      - Source + Source

      relative_to_cwd(path) @@ -231,7 +231,7 @@

      Examples

      Returns the given path string relative to the current working directory.

      - Source + Source

      source(module) @@ -269,7 +269,7 @@

      Examples

      Mix.Utils.camelize "sap_example" #=> "SapExample"
      - Source + Source

      user_home() diff --git a/docs/master/Mix.html b/docs/master/Mix.html index 53c298baf..bc1a279b6 100644 --- a/docs/master/Mix.html +++ b/docs/master/Mix.html @@ -81,7 +81,7 @@

      Functions summary

    2647. - start/0 + stop/1
    2648. @@ -101,7 +101,7 @@

      Functions

      Returns the mix environment.

      - Source + Source

      env(env) @@ -109,7 +109,7 @@

      Functions

      Changes the current mix env. Project configuration loaded per environment is not going to be reloaded.

      - Source + Source

      loadpaths() @@ -117,7 +117,7 @@

      Functions

      Starts mix and loads the project and dependencies into one step. Useful when invoking mix from an external tool.

      - Source + Source

      project() @@ -127,7 +127,7 @@

      Functions

      return an empty keyword list. This allows many mix tasks to work without a need for an underlying project.

      - Source + Source

      shell() @@ -139,21 +139,20 @@

      Functions

      allow developers to use a test shell, that simply sends the messages to the current process.

      - Source + Source

      shell(shell)

      Sets the current shell.

      - Source + Source
      -

      - start() +

      + stop(_state)

      -

      Starts the mix application and its dependencies.

      -
      - Source +
      + Source
      diff --git a/docs/master/Node.html b/docs/master/Node.html index 987b310f8..a427c34f1 100644 --- a/docs/master/Node.html +++ b/docs/master/Node.html @@ -124,7 +124,7 @@

      Functions

      Returns true if the local node is alive; that is, if the node can be part of a distributed system. Otherwise, it returns false.

      - Source + Source

      disconnect(node) @@ -136,7 +136,7 @@

      Functions

      See http://www.erlang.org/doc/man/erlang.html#disconnect_node-1 for more info.

      - Source + Source

      list() @@ -144,7 +144,7 @@

      Functions

      Returns a list of all visible nodes in the system, excluding the local node. Same as list(visible).

      - Source + Source

      list(args) @@ -155,7 +155,7 @@

      Functions

      See http://www.erlang.org/doc/man/erlang.html#nodes-1 for more info.

      - Source + Source

      monitor(node, flag) @@ -165,7 +165,7 @@

      Functions

      See http://www.erlang.org/doc/man/erlang.html#monitor_node-2 for more info.

      - Source + Source

      monitor(node, flag, options) @@ -175,14 +175,14 @@

      Functions

      See http://www.erlang.org/doc/man/erlang.html#monitor_node-3 for more info.

      - Source + Source

      self()

      Returns the current node. It returns the same as the built-in node().

      - Source + Source

      spawn(node, fun) @@ -193,7 +193,7 @@

      Functions

      Check http://www.erlang.org/doc/man/erlang.html#spawn-2 for the list of available options.

      - Source + Source

      spawn(node, fun, opts) @@ -204,7 +204,7 @@

      Functions

      Check http://www.erlang.org/doc/man/erlang.html#spawn_opt-3 for the list of available options.

      - Source + Source

      spawn(node, module, fun, args) @@ -216,7 +216,7 @@

      Functions

      Check http://www.erlang.org/doc/man/erlang.html#spawn-4 for the list of available options.

      - Source + Source

      spawn(node, module, fun, args, opts) @@ -228,7 +228,7 @@

      Functions

      Check http://www.erlang.org/doc/man/erlang.html#spawn_opt-5 for the list of available options.

      - Source + Source

      spawn_link(node, fun) @@ -239,7 +239,7 @@

      Functions

      (and due to the link, an exit signal with exit reason :noconnection will be received).

      - Source + Source

      spawn_link(node, module, fun, args) @@ -250,7 +250,7 @@

      Functions

      pid is returned (and due to the link, an exit signal with exit reason :noconnection will be received).

      - Source + Source diff --git a/docs/master/OptionParser.html b/docs/master/OptionParser.html index de952d0fd..1d57f362f 100644 --- a/docs/master/OptionParser.html +++ b/docs/master/OptionParser.html @@ -84,28 +84,35 @@

      Aliases

      #=> { [debug: true], [] }
      -

      Flags

      +

      Switches

      -

      A set of flags can be given as argument too. Those are considered -boolean and never consume the next value unless it is a boolean:

      +

      Extra information about switches can be given as argument too. This is useful +in order to say a switch must behave as a boolean, list, etc. The following +types are supported:

      -
      OptionParser.parse(["--unlock path/to/file"], flags: [:unlock])
      +
        +
      • :boolean - They never consume the next value unless it is true/false;
      • +
      + +

      Examples:

      + +
      OptionParser.parse(["--unlock path/to/file"], switches: [unlock: :boolean])
       #=> { [unlock: true], ["path/to/file"] }
       
      -OptionParser.parse(["--unlock false path/to/file"], flags: [:unlock])
      +OptionParser.parse(["--unlock false path/to/file"], switches: [unlock: :boolean])
       #=> { [unlock: false], ["path/to/file"] }
       

      Negation switches

      Any switches starting with --no- are always considered to be -booleans and never parse the next value.

      +booleans and never parse the next value:

      OptionParser.parse(["--no-op path/to/file"])
       #=> { [no_op: true], ["path/to/file"] }
       
      - Source + Source

      parse_head(argv, opts // []) @@ -121,7 +128,7 @@

      Example

      #=> { [source: "lib"], ["test/enum_test.exs", "--verbose"] }
      - Source + Source diff --git a/docs/master/Process.html b/docs/master/Process.html index 2550ec82b..e06b10b17 100644 --- a/docs/master/Process.html +++ b/docs/master/Process.html @@ -226,21 +226,21 @@

      Functions

      pid must refer to a process at the local node.

      - Source + Source

      delete()

      Deletes all items in the dictionary.

      - Source + Source

      delete(key)

      Deletes the given key from the dictionary.

      - Source + Source

      demonitor(monitor_ref, options // []) @@ -251,10 +251,10 @@

      Functions

      See http://www.erlang.org/doc/man/erlang.html#demonitor-2 for more info.

      - Source + Source

      - exit(pid, status) + exit(pid, reason)

      Sends an exit signal with the given reason to the pid.

      @@ -278,7 +278,7 @@

      Examples

      Process.exit(pid, :kill)
       
      - Source + Source

      flag(flag, value) @@ -288,7 +288,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#process_flag-2 for more info.

      - Source + Source

      flag(pid, flag, value) @@ -299,37 +299,35 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#process_flag-3 for more info.

      - Source + Source

      get()

      -

      Returns all key-values in the dictionary -with no specific ordering (i.e. they are -not a keyword list).

      +

      Returns all key-values in the dictionary.

      - Source + Source

      get(key, default // nil)

      Returns the value for the given key.

      - Source + Source

      get_keys(value)

      Returns all keys that have the given value.

      - Source + Source

      group_leader()

      Returns the pid of the group leader for the process which evaluates the function.

      - Source + Source

      group_leader(leader, pid) @@ -337,7 +335,7 @@

      Examples

      Sets the group leader of Pid to GroupLeader. Typically, this is used when a processes started from a certain shell should have another group leader than :init.

      - Source + Source

      info(pid) @@ -347,7 +345,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#process_info-1 for more info.

      - Source + Source

      info(pid, spec) @@ -357,7 +355,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#process_info-2 for more info.

      - Source + Source

      link(pid) @@ -367,7 +365,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#link-1 for more info.

      - Source + Source

      list() @@ -381,7 +379,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#processes-0 for more info.

      - Source + Source

      monitor(item) @@ -391,14 +389,14 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#monitor-2 for more info.

      - Source + Source

      put(key, value)

      Stores the given key-value in the process dictionary.

      - Source + Source

      register(pid, name) @@ -409,21 +407,21 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#register-2 for more info.

      - Source + Source

      registered()

      Returns a list of names which have been registered using register/2.

      - Source + Source

      self()

      Returns the current process.

      - Source + Source

      spawn(fun) @@ -431,7 +429,7 @@

      Examples

      Returns the pid of a new process started by the application of fun. It behaves exactly the same as Kernel.spawn/1.

      - Source + Source

      spawn(fun, opts) @@ -441,7 +439,7 @@

      Examples

      It also accepts extra options, for the list of available options check http://www.erlang.org/doc/man/erlang.html#spawn_opt-2

      - Source + Source

      spawn(mod, fun, args) @@ -452,7 +450,7 @@

      Examples

      It behaves exactly the same as the Kernel.spawn/3 function.

      - Source + Source

      spawn(mod, fun, args, opts) @@ -464,7 +462,7 @@

      Examples

      It also accepts extra options, for the list of available options check http://www.erlang.org/doc/man/erlang.html#spawn_opt-4

      - Source + Source

      spawn_link(fun) @@ -473,7 +471,7 @@

      Examples

      A link is created between the calling process and the new process, atomically.

      - Source + Source

      spawn_link(mod, fun, args) @@ -482,7 +480,7 @@

      Examples

      module.function(args). A link is created between the calling process and the new process, atomically. Otherwise works like spawn/3.

      - Source + Source

      spawn_monitor(fun) @@ -490,7 +488,7 @@

      Examples

      Returns the pid of a new process started by the application of fun and reference for a monitor created to the new process.

      - Source + Source

      spawn_monitor(mod, fun, args) @@ -499,7 +497,7 @@

      Examples

      and the process is monitored at the same time. Returns the pid and a reference for the monitor. Otherwise works like spawn/3.

      - Source + Source

      unlink(pid) @@ -510,7 +508,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#unlink-1 for more info.

      - Source + Source

      unregister(name) @@ -519,7 +517,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#unregister-1 for more info.

      - Source + Source

      whereis(name) @@ -529,7 +527,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#whereis-1 for more info.

      - Source + Source diff --git a/docs/master/Protocol.UndefinedError.html b/docs/master/Protocol.UndefinedError.html index bf575437f..99441b413 100644 --- a/docs/master/Protocol.UndefinedError.html +++ b/docs/master/Protocol.UndefinedError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -56,70 +56,10 @@

      Fields (and defaults)

      Functions summary

      @@ -132,83 +72,11 @@

      Functions summary

      Functions

      -

      - exception(args) -

      -
      - Source -
      -

      - exception(args, self) -

      -
      - Source -

      message(exception)

      - Source -
      -

      - new() -

      -
      - Source -
      -

      - new(opts) -

      -
      - Source -
      -

      - protocol(record) -

      -
      - Source -
      -

      - protocol(value, record) -

      -
      - Source -
      -

      - structure(record) -

      -
      - Source -
      -

      - structure(value, record) -

      -
      - Source -
      -

      - to_keywords(record) -

      -
      - Source -
      -

      - update(keywords, record) -

      -
      - Source -
      -

      - update_protocol(function, record) -

      -
      - Source -
      -

      - update_structure(function, record) -

      -
      - Source + Source
      diff --git a/docs/master/Range.Iterator.Number.html b/docs/master/Range.Iterator.Number.html index 0c1fe9718..8e7d0385e 100644 --- a/docs/master/Range.Iterator.Number.html +++ b/docs/master/Range.Iterator.Number.html @@ -36,7 +36,20 @@

      +

      Functions summary

      + @@ -44,6 +57,25 @@

      +
      +

      Functions

      +
      +

      + count(first, arg2) +

      +
      + Source +
      +

      + iterator(first, arg2) +

      +
      + Source +
      +
      + + + diff --git a/docs/master/Range.html b/docs/master/Range.html index 24fa0c8d9..28c55082a 100644 --- a/docs/master/Range.html +++ b/docs/master/Range.html @@ -58,132 +58,12 @@

      Fields (and defaults)

      -

      Functions summary

      - - -
      -

      Functions

      -
      -

      - first(record) -

      -
      - Source -
      -

      - first(value, record) -

      -
      - Source -
      -

      - last(record) -

      -
      - Source -
      -

      - last(value, record) -

      -
      - Source -
      -

      - new() -

      -
      - Source -
      -

      - new(opts) -

      -
      - Source -
      -

      - to_keywords(record) -

      -
      - Source -
      -

      - update(keywords, record) -

      -
      - Source -
      -

      - update_first(function, record) -

      -
      - Source -
      -

      - update_last(function, record) -

      -
      - Source -
      -
      - diff --git a/docs/master/Record.html b/docs/master/Record.html index d346d1816..6180ef4e7 100644 --- a/docs/master/Record.html +++ b/docs/master/Record.html @@ -94,7 +94,7 @@

      Examples

      defmodule CustomRecord do
         Record.deffunctions [:name, :age], __ENV__
      -  Record.deftypes [:name, :age], __ENV__
      +  Record.deftypes [:name, :age], [name: :binary, age: :integer], __ENV__
       end
       
      @@ -114,7 +114,7 @@

      Examples

      end
      - Source + Source

      defrecord(name, values, opts) @@ -141,7 +141,7 @@

      Examples

      Defines types and specs for the record.

      - Source + Source

      extract(name, opts) diff --git a/docs/master/Regex.CompileError.html b/docs/master/Regex.CompileError.html index 4b8e3454a..f4a673958 100644 --- a/docs/master/Regex.CompileError.html +++ b/docs/master/Regex.CompileError.html @@ -47,55 +47,7 @@

      Fields (and defaults)

      -

      Functions summary

      - @@ -103,67 +55,6 @@

      Functions summary

      -
      -

      Functions

      -
      -

      - exception(args) -

      -
      - Source -
      -

      - exception(args, self) -

      -
      - Source -
      -

      - message(record) -

      -
      - Source -
      -

      - message(value, record) -

      -
      - Source -
      -

      - new() -

      -
      - Source -
      -

      - new(opts) -

      -
      - Source -
      -

      - to_keywords(record) -

      -
      - Source -
      -

      - update(keywords, record) -

      -
      - Source -
      -

      - update_message(function, record) -

      -
      - Source -
      -
      - - -
      diff --git a/docs/master/RuntimeError.html b/docs/master/RuntimeError.html index 110d1e912..3b3ade316 100644 --- a/docs/master/RuntimeError.html +++ b/docs/master/RuntimeError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -47,55 +47,7 @@

      Fields (and defaults)

      -

      Functions summary

      - @@ -103,67 +55,6 @@

      Functions summary

      -
      -

      Functions

      -
      -

      - exception(args) -

      -
      - Source -
      -

      - exception(args, self) -

      -
      - Source -
      -

      - message(record) -

      -
      - Source -
      -

      - message(value, record) -

      -
      - Source -
      -

      - new() -

      -
      - Source -
      -

      - new(opts) -

      -
      - Source -
      -

      - to_keywords(record) -

      -
      - Source -
      -

      - update(keywords, record) -

      -
      - Source -
      -

      - update_message(function, record) -

      -
      - Source -
      -
      - - - diff --git a/docs/master/String.html b/docs/master/String.html index 0381769b1..c0d3a119b 100644 --- a/docs/master/String.html +++ b/docs/master/String.html @@ -57,6 +57,11 @@

      Functions summary

      at/2 +
    2649. + + capitalize/1 + +
    2650. codepoints/1 @@ -132,6 +137,11 @@

      Functions summary

      rstrip/2
    2651. +
    2652. + + slice/3 + +
    2653. split/3 @@ -179,7 +189,22 @@

      Examples

      String.at("elixir", -10) #=> nil - Source + Source +
      +

      + capitalize(string) +

      +

      Convert the first character on the given string to uppercase +and the remaining to downcase.

      + +

      Examples

      + +
      String.capitalize("abcd") #=> "Abcd"
      +String.capitalize("ab 123 xpto") #=> "Ab 123 xpto"
      +String.capitalize("josé") #=> "José"
      +
      +
      + Source

      codepoints(string) @@ -193,7 +218,7 @@

      Examples

      String.codepoints("ἅἪῼ") #=> ["ἅ","Ἢ","ῼ"]
      - Source + Source

      downcase(binary) @@ -211,7 +236,7 @@

      Examples

      String.downcase("JOSÉ") #=> "josé"
      - Source + Source

      duplicate(subject, n) @@ -224,7 +249,7 @@

      Examples

      String.duplicate("abc", 2) #=> "abcabc"
      - Source + Source

      first(string) @@ -237,7 +262,7 @@

      Examples

      String.first("եոգլի") #=> "ե"
      - Source + Source

      graphemes(string) @@ -248,7 +273,7 @@

      Examples

      String.graphemes("Ā̀stute") # => ["Ā̀","s","t","u","t","e"]

      - Source + Source

      last(string) @@ -261,7 +286,7 @@

      Examples

      String.last("եոգլի") #=> "ի"
      - Source + Source

      length(string) @@ -274,7 +299,7 @@

      Examples

      String.length("եոգլի") #=> 5
      - Source + Source

      lstrip(binary) @@ -287,7 +312,7 @@

      Examples

      String.lstrip("   abc  ")       #=> "abc  "
       
      - Source + Source

      lstrip(other, char) @@ -299,7 +324,7 @@

      Examples

      String.lstrip("_  abc  _", ?_)  #=> "  abc  _"
       
      - Source + Source

      next_codepoint(string) @@ -315,7 +340,7 @@

      Examples

      String.next_codepoint("josé") #=> { "j", "osé" }
       
      - Source + Source

      next_grapheme(string) @@ -331,7 +356,7 @@

      Examples

      String.next_grapheme("josé") #=> { "j", "osé" }
       
      - Source + Source

      printable?(arg1) @@ -344,7 +369,7 @@

      Examples

      String.printable?("abc") #=> true
       
      - Source + Source

      replace(subject, pattern, replacement, options // []) @@ -367,7 +392,7 @@

      Examples

      String.replace("a,b,c", ",", "[]", insert_replaced: [1,1]) #=> "a[,,]b[,,]c"
      - Source + Source

      rstrip(binary) @@ -380,7 +405,7 @@

      Examples

      String.rstrip("   abc  ")      #=> "   abc"
       
      - Source + Source

      rstrip(string, char) @@ -392,7 +417,25 @@

      Examples

      String.rstrip("   abc _", ?_)  #=> "   abc "
       
      - Source + Source +
      +

      + slice(string, start, len) +

      +

      Returns a substring starting at the offset given by the first, and +a length given by the second. +If the offset is greater than string length, than it returns nil.

      + +

      Examples

      + +
      String.slice("elixir", 1, 3) #=> "lix"
      +String.slice("elixir", 1, 10) #=> "lixir"
      +String.slice("elixir", 10, 3) #=> nil
      +String.slice("elixir", -4, 4) #=> "ixi"
      +String.slice("elixir", -10, 3) #=> nil
      +
      +
      + Source

      split(binary, pattern // " ", options // []) @@ -421,7 +464,7 @@

      Examples

      String.split("a,b", %r{.}) #=> ["a,b"]
      - Source + Source

      strip(string) @@ -434,7 +477,7 @@

      Examples

      String.strip("   abc  ")       #=> "abc"
       
      - Source + Source

      strip(string, char) @@ -447,7 +490,7 @@

      Examples

      String.strip("a  abc  a", ?a)  #=> "  abc  "
       
      - Source + Source

      upcase(binary) @@ -465,7 +508,7 @@

      Examples

      String.upcase("josé") #=> "JOSÉ"
      - Source + Source diff --git a/docs/master/Supervisor.Behaviour.html b/docs/master/Supervisor.Behaviour.html new file mode 100644 index 000000000..9505007a9 --- /dev/null +++ b/docs/master/Supervisor.Behaviour.html @@ -0,0 +1,272 @@ + + + + Supervisor.Behaviour + + + + + + + + + + + + +
      +

      + Supervisor.Behaviour + +

      + + +
      +

      This module is a convenience to define Supervisor +callbacks in Elixir. By using this module, you get +the module behaviour automatically tagged as +:supervisor and some helper functions are imported +to make defining supervisors easier.

      + +

      For more information on supervisors, please check the +remaining functions defined in this module or refer to +the following:

      + +

      http://www.erlang.org/doc/man/supervisor.html +http://www.erlang.org/doc/design_principles/sup_princ.html +http://learnyousomeerlang.com/supervisors

      + +

      Example

      + +
      defmodule ExUnit.Sup do
      +  use Supervisor.Behaviour
      +
      +  def init(user_options) do
      +    tree = [ worker(ExUnit.Runner, [user_options]) ]
      +    supervise(tree, strategy: :one_for_one)
      +  end
      +end
      +
      +{ :ok, pid } = :supervisor.start_link(MyServer, [])
      +
      + +
      + + + Source + + + + + + +

      Functions summary

      + + + + + + + + +
      +

      Functions

      +
      +

      + supervise(children, options) +

      +

      Receives a list of children (worker or supervisors) to +supervise and a set of options. Returns a tuple containing +the supervisor specification.

      + +

      Examples

      + +
      supervise children, strategy: :one_for_one
      +
      + +

      Options

      + +
        +
      • :strategy - the restart strategy option It can be either +:one_for_one, :rest_for_one, :one_for_all and +:simple_one_for_one;

      • +
      • :max_restarts - the maximum amount of restarts allowed in +a time frame. Defaults to 5;

      • +
      • :max_seconds - the time frame in which max_restarts applies. +Defaults to 5;

      • +
      + +

      The :strategy option is required and by default maximum 5 restarts +are allowed in 5 seconds.

      + +

      Strategies

      + +
        +
      • :one_for_one - If a child process terminates, only that +process is restarted;

      • +
      • :one_for_all - If a child process terminates, all other child +processes are terminated and then all child processes, including +the terminated one, are restarted;

      • +
      • :rest_for_one - If a child process terminates, the "rest" of +the child processes, i.e. the child processes after the terminated +process in start order, are terminated. Then the terminated child +process and the rest of the child processes are restarted;

      • +
      • :simple_one_for_one - Similar to :one_for_one but suits better +when dynamically attaching children;

      • +
      +
      + Source +
      +

      + supervisor(module, args, options // []) +

      +

      Defines the given module as a supervisor which will be started +with the given arguments.

      + +
      supervisor ExUnit.Runner, [], restart: :permanent
      +
      + +

      By default, the function :start_link is invoked on the given module.

      + +

      Options

      + +
        +
      • :id - a name used to identify the child specification +internally by the supervisor. Defaults to the module name;

      • +
      • :function - the function to invoke on the child to start it. +Defaults to :start_link;

      • +
      • :restart - defines when the child process should restart. +Defaults to :permanent;

      • +
      • :shutdown - defines how a child process should be terminated. +Defaults to 5000;

      • +
      • :modules - it should be a list with one element [module], +where module is the name of the callback module only if the +child process is a supervisor, genserver or genfsm. If the +child process is a gen_event, modules should be :dynamic. +Defaults to a list with the given module;

      • +
      + +

      Restart values

      + +

      The following restart values are supported:

      + +
        +
      • :permanent - the child process is always restarted;

      • +
      • :temporary - the child process is never restarted (not even +when the supervisor's strategy is :rest_for_one or :one_for_all);

      • +
      • :transient - the child process is restarted only if it +terminates abnormally, i.e. with another exit reason than +:normal, :shutdown or { :shutdown, term };

      • +
      + +

      Shutdown values

      + +

      The following shutdown values are supported:

      + +
        +
      • :brutal_kill - the child process is unconditionally terminated +using exit(child, :kill);

      • +
      • :infinity - if the child process is a supervisor, it is a mechanism +to give the subtree enough time to shutdown. It can also be used with +workers with care;

      • +
      • Finally, it can also be any integer meaning that the supervisor tells +the child process to terminate by calling exit(child, :shutdown) and +then waits for an exit signal back. If no exit signal is received within +the specified time (in miliseconds), the child process is unconditionally +terminated using exit(child, :kill);

      • +
      +
      + Source +
      +

      + worker(module, args, options // []) +

      +

      Defines the given module as a worker which will be started +with the given arguments.

      + +
      worker ExUnit.Runner, [], restart: :permanent
      +
      + +

      By default, the function :start_link is invoked on the given module.

      + +

      Options

      + +
        +
      • :id - a name used to identify the child specification +internally by the supervisor. Defaults to the module name;

      • +
      • :function - the function to invoke on the child to start it. +Defaults to :start_link;

      • +
      • :restart - defines when the child process should restart. +Defaults to :permanent;

      • +
      • :shutdown - defines how a child process should be terminated. +Defaults to 5000;

      • +
      • :modules - it should be a list with one element [module], +where module is the name of the callback module only if the +child process is a supervisor, genserver or genfsm. If the +child process is a gen_event, modules should be :dynamic. +Defaults to a list with the given module;

      • +
      + +

      Restart values

      + +

      The following restart values are supported:

      + +
        +
      • :permanent - the child process is always restarted;

      • +
      • :temporary - the child process is never restarted (not even +when the supervisor's strategy is :rest_for_one or :one_for_all);

      • +
      • :transient - the child process is restarted only if it +terminates abnormally, i.e. with another exit reason than +:normal, :shutdown or { :shutdown, term };

      • +
      + +

      Shutdown values

      + +

      The following shutdown values are supported:

      + +
        +
      • :brutal_kill - the child process is unconditionally terminated +using exit(child, :kill);

      • +
      • :infinity - if the child process is a supervisor, it is a mechanism +to give the subtree enough time to shutdown. It can also be used with +workers with care;

      • +
      • Finally, it can also be any integer meaning that the supervisor tells +the child process to terminate by calling exit(child, :shutdown) and +then waits for an exit signal back. If no exit signal is received within +the specified time (in miliseconds), the child process is unconditionally +terminated using exit(child, :kill);

      • +
      +
      + Source +
      +
      + + + + + +
      + + diff --git a/docs/master/SyntaxError.html b/docs/master/SyntaxError.html index 8a9744be0..dfa1c708f 100644 --- a/docs/master/SyntaxError.html +++ b/docs/master/SyntaxError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -62,85 +62,10 @@

      Fields (and defaults)

      Functions summary

      @@ -153,101 +78,11 @@

      Functions summary

      Functions

      -

      - description(record) -

      -
      - Source -
      -

      - description(value, record) -

      -
      - Source -
      -

      - exception(args) -

      -
      - Source -
      -

      - exception(args, self) -

      -
      - Source -
      -

      - file(record) -

      -
      - Source -
      -

      - file(value, record) -

      -
      - Source -
      -

      - line(record) -

      -
      - Source -
      -

      - line(value, record) -

      -
      - Source -

      message(exception)

      - Source -
      -

      - new() -

      -
      - Source -
      -

      - new(opts) -

      -
      - Source -
      -

      - to_keywords(record) -

      -
      - Source -
      -

      - update(keywords, record) -

      -
      - Source -
      -

      - update_description(function, record) -

      -
      - Source -
      -

      - update_file(function, record) -

      -
      - Source -
      -

      - update_line(function, record) -

      -
      - Source + Source
      diff --git a/docs/master/System.html b/docs/master/System.html index f49f4b6b3..4e6440b57 100644 --- a/docs/master/System.html +++ b/docs/master/System.html @@ -132,7 +132,7 @@

      Functions

      Registers a function that will be invoked at the end of program execution. Useful for -invoking a hook on scripted mode.

      +invoking a hook in a "script" mode.

      The function must expect the exit status code as argument.

      @@ -230,7 +230,7 @@

      Examples

      System.halt(:abort)
      - Source + Source

      put_env(dict) @@ -250,9 +250,13 @@

      Examples

      stacktrace()

      -

      Get the stacktrace.

      +

      Gets Elixir's stacktrace.

      + +

      Notice the Erlang VM (and therefore this function) does not +return the current stacktrace but rather the stacktrace of the +latest exception.

      - Source + Source

      version() diff --git a/docs/master/SystemLimitError.html b/docs/master/SystemLimitError.html index 6f73b2fee..6b0d65fd1 100644 --- a/docs/master/SystemLimitError.html +++ b/docs/master/SystemLimitError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -47,55 +47,7 @@

      Fields (and defaults)

      -

      Functions summary

      - @@ -103,67 +55,6 @@

      Functions summary

      -
      -

      Functions

      -
      -

      - exception(args) -

      -
      - Source -
      -

      - exception(args, self) -

      -
      - Source -
      -

      - message(record) -

      -
      - Source -
      -

      - message(value, record) -

      -
      - Source -
      -

      - new() -

      -
      - Source -
      -

      - new(opts) -

      -
      - Source -
      -

      - to_keywords(record) -

      -
      - Source -
      -

      - update(keywords, record) -

      -
      - Source -
      -

      - update_message(function, record) -

      -
      - Source -
      -
      - - -
      diff --git a/docs/master/TokenMissingError.html b/docs/master/TokenMissingError.html index 1e1b88e74..9a445ae52 100644 --- a/docs/master/TokenMissingError.html +++ b/docs/master/TokenMissingError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -62,85 +62,10 @@

      Fields (and defaults)

      Functions summary

      @@ -153,101 +78,11 @@

      Functions summary

      Functions

      -

      - description(record) -

      -
      - Source -
      -

      - description(value, record) -

      -
      - Source -
      -

      - exception(args) -

      -
      - Source -
      -

      - exception(args, self) -

      -
      - Source -
      -

      - file(record) -

      -
      - Source -
      -

      - file(value, record) -

      -
      - Source -
      -

      - line(record) -

      -
      - Source -
      -

      - line(value, record) -

      -
      - Source -

      message(exception)

      - Source -
      -

      - new() -

      -
      - Source -
      -

      - new(opts) -

      -
      - Source -
      -

      - to_keywords(record) -

      -
      - Source -
      -

      - update(keywords, record) -

      -
      - Source -
      -

      - update_description(function, record) -

      -
      - Source -
      -

      - update_file(function, record) -

      -
      - Source -
      -

      - update_line(function, record) -

      -
      - Source + Source
      diff --git a/docs/master/UndefinedFunctionError.html b/docs/master/UndefinedFunctionError.html index 27b0d3a09..1a7dfdbef 100644 --- a/docs/master/UndefinedFunctionError.html +++ b/docs/master/UndefinedFunctionError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -62,85 +62,10 @@

      Fields (and defaults)

      Functions summary

      @@ -153,101 +78,11 @@

      Functions summary

      Functions

      -

      - arity(record) -

      -
      - Source -
      -

      - arity(value, record) -

      -
      - Source -
      -

      - exception(args) -

      -
      - Source -
      -

      - exception(args, self) -

      -
      - Source -
      -

      - function(record) -

      -
      - Source -
      -

      - function(value, record) -

      -
      - Source -

      message(exception)

      - Source -
      -

      - module(record) -

      -
      - Source -
      -

      - module(value, record) -

      -
      - Source -
      -

      - new() -

      -
      - Source -
      -

      - new(opts) -

      -
      - Source -
      -

      - to_keywords(record) -

      -
      - Source -
      -

      - update(keywords, record) -

      -
      - Source -
      -

      - update_arity(function, record) -

      -
      - Source -
      -

      - update_function(function, record) -

      -
      - Source -
      -

      - update_module(function, record) -

      -
      - Source + Source
      diff --git a/docs/master/modules_list.html b/docs/master/modules_list.html index d901501c6..9d8b61443 100644 --- a/docs/master/modules_list.html +++ b/docs/master/modules_list.html @@ -16,7 +16,7 @@

      - Elixir v0.7.2 + Elixir v0.7.3.dev

      diff --git a/docs/master/Access.List.html b/docs/master/Access.List.html index f538c7d31..4392d3825 100644 --- a/docs/master/Access.List.html +++ b/docs/master/Access.List.html @@ -56,17 +56,20 @@

      Functions summary

      Functions

      - access(list, atom) + access(list, key)

      -

      Access the given key in a keyword list.

      +

      Access the given key in a tuple list.

      Examples

      keywords = [a: 1, b: 2]
       keywords[:a] #=> 1
      +
      +star_ratings = [{1.0, "★"}, {1.5, "★☆"}, {2.0, "★★"}]
      +star_ratings[1.5] #=> "★☆"
       
      - Source + Source
      diff --git a/docs/master/ArgumentError.html b/docs/master/ArgumentError.html index 798528cf5..1aa2defdf 100644 --- a/docs/master/ArgumentError.html +++ b/docs/master/ArgumentError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/master/ArithmeticError.html b/docs/master/ArithmeticError.html index 3d1eb6f10..bf124aba5 100644 --- a/docs/master/ArithmeticError.html +++ b/docs/master/ArithmeticError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/master/BadArityError.html b/docs/master/BadArityError.html index 8a69f0ce0..7b90146d7 100644 --- a/docs/master/BadArityError.html +++ b/docs/master/BadArityError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -76,7 +76,7 @@

      Functions

      message(exception)

      - Source + Source
      diff --git a/docs/master/BadFunctionError.html b/docs/master/BadFunctionError.html index 7a0332551..5a292c0c8 100644 --- a/docs/master/BadFunctionError.html +++ b/docs/master/BadFunctionError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -70,7 +70,7 @@

      Functions

      message(exception)

      - Source + Source diff --git a/docs/master/CaseClauseError.html b/docs/master/CaseClauseError.html index 24c2b5b4f..d2d239407 100644 --- a/docs/master/CaseClauseError.html +++ b/docs/master/CaseClauseError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -70,7 +70,7 @@

      Functions

      message(exception)

      - Source + Source diff --git a/docs/master/CompileError.html b/docs/master/CompileError.html index 2db4ccc37..c03ead4ec 100644 --- a/docs/master/CompileError.html +++ b/docs/master/CompileError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -82,7 +82,7 @@

      Functions

      message(exception)

      - Source + Source diff --git a/docs/master/Dict.html b/docs/master/Dict.html index 4d3fee023..5bb107c54 100644 --- a/docs/master/Dict.html +++ b/docs/master/Dict.html @@ -233,14 +233,14 @@

      Examples

      Dict.delete d, :a #=> [b: 2] - Source + Source

      empty(dict)

      Returns an empty dict of the same type as dict.

      - Source + Source

      get(dict, key, default // nil) @@ -256,7 +256,7 @@

      Examples

      Dict.get d, :b, 3 #=> 3
      - Source + Source

      get!(dict, key) @@ -271,7 +271,7 @@

      Examples

      Dict.get d, :b #=> raises KeyError[key: :b]
      - Source + Source

      has_key?(dict, key) @@ -285,7 +285,7 @@

      Examples

      Dict.has_key?(d, :b) #=> false
      - Source + Source

      keys(dict) @@ -318,7 +318,7 @@

      Examples

      #=> [a: 3, b: 2, d: 4]
      - Source + Source

      merge(dict1, dict2, fun) @@ -336,7 +336,7 @@

      Examples

      #=> [a: 4, b: 2, d: 4]
      - Source + Source

      put(dict, key, val) @@ -351,7 +351,7 @@

      Examples

      #=> [a: 3, b: 2]
      - Source + Source

      put_new(dict, key, val) @@ -365,7 +365,7 @@

      Examples

      #=> [a: 1, b: 2]
      - Source + Source

      size(dict) @@ -378,7 +378,7 @@

      Examples

      Dict.size d #=> 2
      - Source + Source

      to_list(dict) @@ -386,7 +386,7 @@

      Examples

      Returns a list of key-value pairs stored in dict. No particular order is enforced.

      - Source + Source

      update(dict, key, fun) @@ -401,7 +401,7 @@

      Examples

      #=> [a: -1, b: 2]
      - Source + Source

      update(dict, key, initial, fun) @@ -417,7 +417,7 @@

      Examples

      #=> [a: 1, b: 2, c: 3]
      - Source + Source

      values(dict) @@ -430,7 +430,7 @@

      Examples

      Dict.values d #=> [1,2]
      - Source + Source diff --git a/docs/master/EEx.SyntaxError.html b/docs/master/EEx.SyntaxError.html index 88579ae62..b51329ebb 100644 --- a/docs/master/EEx.SyntaxError.html +++ b/docs/master/EEx.SyntaxError.html @@ -47,55 +47,7 @@

      Fields (and defaults)

      -

      Functions summary

      - @@ -103,67 +55,6 @@

      Functions summary

      -
      -

      Functions

      -
      -

      - exception(args) -

      -
      - Source -
      -

      - exception(args, self) -

      -
      - Source -
      -

      - message(record) -

      -
      - Source -
      -

      - message(value, record) -

      -
      - Source -
      -

      - new() -

      -
      - Source -
      -

      - new(opts) -

      -
      - Source -
      -

      - to_keywords(record) -

      -
      - Source -
      -

      - update(keywords, record) -

      -
      - Source -
      -

      - update_message(function, record) -

      -
      - Source -
      -
      - - - diff --git a/docs/master/Enum.Iterator.Function.html b/docs/master/Enum.Iterator.Function.html index 13f3ea715..b100394e3 100644 --- a/docs/master/Enum.Iterator.Function.html +++ b/docs/master/Enum.Iterator.Function.html @@ -29,7 +29,7 @@

      - Source + Source @@ -64,13 +64,13 @@

      Functions

      count(function)

      - Source + Source

      iterator(function)

      - Source + Source
      diff --git a/docs/master/Enum.Iterator.List.html b/docs/master/Enum.Iterator.List.html index d9e7f0cdf..ec6727148 100644 --- a/docs/master/Enum.Iterator.List.html +++ b/docs/master/Enum.Iterator.List.html @@ -29,7 +29,7 @@

      - Source + Source @@ -64,13 +64,13 @@

      Functions

      count(list)

      - Source + Source

      iterator(list)

      - Source + Source
      diff --git a/docs/master/Enum.OutOfBoundsError.html b/docs/master/Enum.OutOfBoundsError.html index 6ce6d6ebd..0bc46edd5 100644 --- a/docs/master/Enum.OutOfBoundsError.html +++ b/docs/master/Enum.OutOfBoundsError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/master/Enum.html b/docs/master/Enum.html index 880243d08..102194a5d 100644 --- a/docs/master/Enum.html +++ b/docs/master/Enum.html @@ -236,7 +236,7 @@

      Examples

      Enum.all? [1,nil,3] #=> false - Source + Source

      any?(collection, fun // fn x -> x end) @@ -260,7 +260,7 @@

      Examples

      Enum.any? [false,true,false] #=> true
      - Source + Source

      at!(collection, n) @@ -278,7 +278,7 @@

      Examples

      Enum.at! [2,4,6], 4 #=> raises Enum.OutOfBoundsError
      - Source + Source

      count(collection) @@ -290,14 +290,14 @@

      Examples

      Enum.count [1,2,3] #=> 3
       
      - Source + Source

      count(collection, fun)

      Counts for how many items the function returns true.

      - Source + Source

      drop(collection, count) @@ -312,7 +312,7 @@

      Examples

      Enum.drop [1,2,3], 0 #=> [1,2,3]
      - Source + Source

      drop_while(collection, fun) @@ -326,20 +326,21 @@

      Examples

      #=> [3,4,5]
      - Source + Source

      each(collection, fun)

      Invokes the given fun for each item in the collection. -Returns the collection itself.

      +Returns the collection itself. fun can take two parameters, +in which case the second parameter will be the iteration index.

      Examples

      Enum.each ['some', 'example'], fn(x) -> IO.puts x end
       
      - Source + Source

      empty?(collection) @@ -352,7 +353,7 @@

      Examples

      Enum.empty? [1,2,3] #=> false
      - Source + Source

      filter(collection, fun) @@ -366,7 +367,7 @@

      Examples

      #=> [2]
      - Source + Source

      filter_map(collection, filter, mapper) @@ -379,7 +380,7 @@

      Examples

      #=> [4]
      - Source + Source

      find(collection, ifnone // nil, fun) @@ -399,7 +400,7 @@

      Examples

      #=> 3
      - Source + Source

      find_index(collection, fun) @@ -418,7 +419,7 @@

      Examples

      #=> 2
      - Source + Source

      find_value(collection, ifnone // nil, fun) @@ -435,7 +436,7 @@

      Examples

      #=> true
      - Source + Source

      first(collection) @@ -448,7 +449,7 @@

      Examples

      Enum.first [1,2,3] #=> 1
      - Source + Source

      join(collection, joiner // "") @@ -469,14 +470,17 @@

      Examples

      Enum.join([1,2,3], ' = ') #=> '1 = 2 = 3'
      - Source + Source

      map(collection, fun)

      Returns a new collection, where each item is the result of invoking fun on each corresponding item of collection. -For dicts, the function accepts a key-value tuple.

      +fun can take two parameters, in which case the second parameter +will be the iteration index.

      + +

      For dicts, the function accepts a key-value tuple.

      Examples

      @@ -487,7 +491,7 @@

      Examples

      #=> [a: -1, b: -2]
      - Source + Source

      map_join(collection, joiner // "", mapper) @@ -508,7 +512,7 @@

      Examples

      Enum.map_join([1,2,3], ' = ', &1 * 2) #=> '2 = 4 = 6'
      - Source + Source

      map_reduce(collection, acc, f) @@ -527,7 +531,7 @@

      Examples

      #=> { [2, 4, 6], 6 }
      - Source + Source

      partition(collection, fun) @@ -542,7 +546,7 @@

      Examples

      #=> { [2], [1,3] }
      - Source + Source

      reduce(collection, acc, fun) @@ -557,7 +561,7 @@

      Examples

      #=> 6
      - Source + Source

      reverse(collection) @@ -570,7 +574,7 @@

      Examples

      #=> [3, 2, 1]
      - Source + Source

      sort(collection) @@ -582,7 +586,7 @@

      Examples

      Enum.sort [3,2,1] #=> [1,2,3]
       
      - Source + Source

      sort(collection, fun) @@ -594,7 +598,7 @@

      Examples

      Enum.sort [3,2,1], &1 > &2 #=> [1,2,3]
       
      - Source + Source

      split(collection, count) @@ -617,7 +621,7 @@

      Examples

      Enum.split [1,2,3], -5 #=> { [], [1,2,3] }
      - Source + Source

      split_while(collection, fun) @@ -631,7 +635,7 @@

      Examples

      #=> { [1], [2, 3, 4] }
      - Source + Source

      take(collection, count) @@ -646,7 +650,7 @@

      Examples

      Enum.take [1,2,3], 0 #=> []
      - Source + Source

      take_while(collection, fun) @@ -660,7 +664,7 @@

      Examples

      #=> [1, 2]
      - Source + Source

      uniq(collection) @@ -673,7 +677,7 @@

      Examples

      #=> [1, 2, 3]
      - Source + Source

      zip(coll1, coll2) @@ -683,7 +687,7 @@

      Examples

      dictated by the first enum. In case the second list is shorter, values are filled with nil.

      - Source + Source diff --git a/docs/master/ErlangError.html b/docs/master/ErlangError.html index 2ca0c2a0b..c608912da 100644 --- a/docs/master/ErlangError.html +++ b/docs/master/ErlangError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -70,7 +70,7 @@

      Functions

      message(exception)

      - Source + Source diff --git a/docs/master/ExUnit.AssertionError.html b/docs/master/ExUnit.AssertionError.html index deffaeb0b..4a496fbf6 100644 --- a/docs/master/ExUnit.AssertionError.html +++ b/docs/master/ExUnit.AssertionError.html @@ -47,55 +47,7 @@

      Fields (and defaults)

      -

      Functions summary

      - @@ -103,67 +55,6 @@

      Functions summary

      -
      -

      Functions

      -
      -

      - exception(args) -

      -
      - Source -
      -

      - exception(args, self) -

      -
      - Source -
      -

      - message(record) -

      -
      - Source -
      -

      - message(value, record) -

      -
      - Source -
      -

      - new() -

      -
      - Source -
      -

      - new(opts) -

      -
      - Source -
      -

      - to_keywords(record) -

      -
      - Source -
      -

      - update(keywords, record) -

      -
      - Source -
      -

      - update_message(function, record) -

      -
      - Source -
      -
      - - - diff --git a/docs/master/ExUnit.ExpectationError.html b/docs/master/ExUnit.ExpectationError.html index 53b4db699..441757e55 100644 --- a/docs/master/ExUnit.ExpectationError.html +++ b/docs/master/ExUnit.ExpectationError.html @@ -74,115 +74,10 @@

      Fields (and defaults)

      Functions summary

      @@ -195,137 +90,11 @@

      Functions summary

      Functions

      -

      - actual(record) -

      -
      - Source -
      -

      - actual(value, record) -

      -
      - Source -
      -

      - exception(args) -

      -
      - Source -
      -

      - exception(args, self) -

      -
      - Source -
      -

      - expected(record) -

      -
      - Source -
      -

      - expected(value, record) -

      -
      - Source -

      message(exception)

      Source -
      -

      - negation(record) -

      -
      - Source -
      -

      - negation(value, record) -

      -
      - Source -
      -

      - new() -

      -
      - Source -
      -

      - new(opts) -

      -
      - Source -
      -

      - prelude(record) -

      -
      - Source -
      -

      - prelude(value, record) -

      -
      - Source -
      -

      - reason(record) -

      -
      - Source -
      -

      - reason(value, record) -

      -
      - Source -
      -

      - to_keywords(record) -

      -
      - Source -
      -

      - update(keywords, record) -

      -
      - Source -
      -

      - update_actual(function, record) -

      -
      - Source -
      -

      - update_expected(function, record) -

      -
      - Source -
      -

      - update_negation(function, record) -

      -
      - Source -
      -

      - update_prelude(function, record) -

      -
      - Source -
      -

      - update_reason(function, record) -

      -
      - Source
      diff --git a/docs/master/Exception.html b/docs/master/Exception.html index d82b02785..9a73af98f 100644 --- a/docs/master/Exception.html +++ b/docs/master/Exception.html @@ -44,22 +44,12 @@

      Functions summary

      • - filter_stacktrace/1 + format_entry/2
      • - format_entry/1 - -
      • -
      • - - format_file_line/1 - -
      • -
      • - - format_file_line/2 + format_file_line/3
      • @@ -89,34 +79,20 @@

        Functions summary

        Functions

        -

        - filter_stacktrace(list1) +

        + format_entry(entry, cwd // nil)

        -

        Filters the stacktrace removing internal Elixir entries.

        - -

        This is useful when a stacktrace is received from Erlang code -and it needs to be formatted by an Elixir application.

        -
        - Source -
        -

        - format_entry(arg1) -

        -

        Receives a tuple representing a stacktrace entry and formats it.

        +

        Receives a tuple representing a stacktrace entry and formats it. +The current working directory may be given as argument, which +is used to prettify the stacktrace.

        - Source -
        -

        - format_file_line(file_line) -

        -
        - Source + Source
        -

        - format_file_line(file, line) +

        + format_file_line(file, line, cwd)

        - Source + Source

        format_stacktrace(trace // nil) @@ -127,7 +103,7 @@

        Functions

        calculates the current stacktrace and formats it. As consequence, the value of System.stacktrace is changed.

        - Source + Source

        normalize(exception) @@ -143,7 +119,7 @@

        Functions

        Prints the current stacktrace to standard output.

        - Source + Source
        diff --git a/docs/master/File.html b/docs/master/File.html index 0b0d4f556..e303cb6fd 100644 --- a/docs/master/File.html +++ b/docs/master/File.html @@ -436,7 +436,7 @@

        Examples

        be passed into Enum to iterate line by line as a binary. Check iterator/1 for more information.

        - Source + Source

        biniterator(file, mode) @@ -445,7 +445,7 @@

        Examples

        returns its biniterator. Fails for the same reasons as File.open.

        - Source + Source

        biniterator!(file, mode // []) @@ -453,7 +453,7 @@

        Examples

        Same as biniterator/2 but raises if the file cannot be opened.

        - Source + Source

        cd(path) @@ -747,7 +747,7 @@

        Examples

        end
        - Source + Source

        iterator(file, mode) @@ -756,7 +756,7 @@

        Examples

        returns its iterator. Fails for the same reasons as File.open.

        - Source + Source

        iterator!(file, mode // []) @@ -764,7 +764,7 @@

        Examples

        Same as iterator/2 but raises if the file cannot be opened.

        - Source + Source

        join(paths) @@ -925,7 +925,7 @@

        Examples

        Examples

        -
        File.open!("foo.txt", [:read, :write], fn(file) ->
        +
        File.open!("file.txt", [:read, :write], fn(file) ->
           IO.readline(file)
         end)
         
        @@ -1009,7 +1009,7 @@

        Examples

        Examples

        -
        File.rm('foo.txt')
        +
        File.rm('file.txt')
         #=> :ok
         
         File.rm('tmp_dir/')
        @@ -1066,7 +1066,7 @@ 

        Examples

        File.rddir('tmp_dir')
         #=> :ok
         
        -File.rmdir('foo.txt')
        +File.rmdir('file.txt')
         #=> {:error, :enotdir}
         
        diff --git a/docs/master/FunctionClauseError.html b/docs/master/FunctionClauseError.html index 926a4478a..459784770 100644 --- a/docs/master/FunctionClauseError.html +++ b/docs/master/FunctionClauseError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -82,7 +82,7 @@

        Functions

        message(exception)

        - Source + Source diff --git a/docs/master/Kernel.SpecialForms.html b/docs/master/Kernel.SpecialForms.html index 39bf8a6ff..1563319b3 100644 --- a/docs/master/Kernel.SpecialForms.html +++ b/docs/master/Kernel.SpecialForms.html @@ -104,6 +104,11 @@

        Macros summary

        alias/2
      • +
      • + + alias!/1 + +
      • bc/1 @@ -139,6 +144,16 @@

        Macros summary

        unquote_splicing/1
      • +
      • + + var!/1 + +
      • +
      • + + var!/2 + +
      • {}/1 @@ -370,7 +385,7 @@

        Examples

          Module.concat [some_var, Foo]
         
        - Source + Source

        args @@ -383,7 +398,7 @@

        Examples

        #=> { :__block__, 0, [1,2,3] }
        - Source + Source

        __scope__(opts, args) @@ -399,7 +414,7 @@

        Examples

        Check quote/1 for more information.

        - Source + Source

        alias(module, opts) @@ -444,6 +459,15 @@

        Lexical scope

        specific functions and it won't affect the overall scope.

        Source +
        +

        + alias!(alias) +

        +

        When used inside quoting, marks that the alias should not +be hygienezed. This means the alias will be expanded when +the macro is expanded.

        +
        + Source

        bc(args) @@ -457,7 +481,7 @@

        Lexical scope

        "helloworld"
        - Source + Source

        import(module, opts) @@ -583,7 +607,7 @@

        Alias/Require shortcut

        [{213,45,132},{64,76,32},{76,0,0},{234,32,15}]
        - Source + Source

        quote(opts, list2) @@ -596,11 +620,11 @@

        Examples

        #=> { :sum, 0, [1, 2, 3] } -

        Homoiconicity

        +

        Explanation

        -

        Elixir is an homoiconic language. Any Elixir program can be -represented using its own data structures. The building block -of Elixir homoiconicity is a tuple with three elements, for example:

        +

        Any Elixir code can be represented using Elixir data structures. +The building block of Elixir homoiconicity is a tuple with three +elements, for example:

        { :sum, 1, [1, 2, 3] }
         
        @@ -614,8 +638,21 @@

        Homoiconicity

      • The second element of the tuple is always an integer representing the line number;
      • The third element of the tuple are the arguments for the -function call. The third argument may be an atom, meaning -that it may be a variable.
      • +function call. The third argument may be an atom, which is +usually a variable (or a local call); +
      + +

      Options

      + +
        +
      • :hygiene - When false, disables hygiene for variables, aliases and imports;
      • +
      • :unquote - When false, disables unquoting. Useful when you have a quote + inside another quote and want to control which quote is + able to unquote;
      • +
      • :location - When set to :keep, keeps the current line and file on quotes. + Read the Stacktrace information section below for more information;
      • +
      • :expand_aliases - When false, do not expand aliases;
      • +
      • :var_context - The context for quoted variables. Defaults to the current module;

      Macro literals

      @@ -633,9 +670,21 @@

      Macro literals

      Hygiene

      -

      Elixir macros are hygienic regarding to variables. This means -a variable defined in a macro cannot affect the scope where -the macro is included. Consider the following example:

      +

      Elixir macros are hygienic. This means aliases and imports +defined inside the quoted often refer to the context that +defined the macro.

      + +

      Furthermore, variables inside quote are also hygienic. That +said, a variable defined in a macro cannot affect the scope +where the macro is included.

      + +

      The option hygiene can turn off all the hygiene mechanisms +defined below. However, they can also be changed in a one by +one basis.

      + +

      Hygiene in variables

      + +

      Consider the following example:

      defmodule Hygiene do
         defmacro no_interference do
      @@ -651,10 +700,10 @@ 

      Hygiene

      In the example above, a returns 10 even if the macro -is apparently setting it to 1 because the variables defined -in the macro does not affect the context the macro is -executed. If you want to set or get a variable, you can do -it with the help of the var! macro:

      +is apparently setting it to 1 because variables defined +in the macro does not affect the context the macro is executed. +If you want to set or get a variable in the user context, you +can do it with the help of the var! macro:

      defmodule NoHygiene do
         defmacro interference do
      @@ -669,25 +718,74 @@ 

      Hygiene

      a #=> 1
      -

      Notice that aliases are not hygienic in Elixir, ambiguity -must be solved by prepending Elixir:

      +

      It is important to understand that quoted variables are scoped +to the module they are defined. That said, even if two modules +define the same quoted variable a, their values are going +to be independent:

      -
      quote do
      -  Elixir.Foo #=> Access the root Foo
      -  Foo        #=> Access the Foo alias in the current module
      -                 (if any is set), then fallback to Elixir.Foo
      +
      defmodule Hygiene1 do
      +  defmacro var1 do
      +    quote do: a = 1
      +  end
      +end
      +
      +defmodule Hygiene2 do
      +  defmacro var2 do
      +    quote do: a = 2
      +  end
       end
       
      -

      Options

      +

      Calling macros var1 and var2 are not going to change their +each other values for a. This is useful because quoted +variables from different modules cannot conflict. If you desire +to explicitly access a variable from another module, we can once +again use var! macro, but explicitly passing a second argument:

      -
        -
      • :hygiene - When false, disables hygiene;
      • -
      • :unquote - When false, disables unquoting. Useful when you have a quote -inside another quote and want to control which quote is able to unquote;
      • -
      • :location - When set to :keep, keeps the current line and file on quotes. - Read the Stacktrace information section below for more information;
      • -
      +
      # Access the variable a from Hygiene1
      +quote do: var!(a, Hygiene1) = 2
      +
      + +

      Another option is to set the var_context option, affecting +all variables in the block:

      + +
      quote var_context: Hygiene1, do: a = 2
      +
      + +

      Hygiene in aliases

      + +

      Aliases inside quote are expanded by default. +Consider the following example:

      + +
      defmodule Hygiene do
      +  alias OrdDict, as: D
      +
      +  defmacro no_interference do
      +    quote do: D.new
      +  end
      +end
      +
      +require Hygiene
      +Hygiene.no_interference #=> { OrdDict, [] }
      +
      + +

      Notice that, even though the alias D is not available +in the context the macro is expanded, the code above works +because D was expanded when the quote was generated.

      + +

      There are two ways to disable this behaviour. By giving +the expand_aliases equals to false to quote or by using +the alias! macro inside the quote:

      + +
      defmodule NoHygiene do
      +  defmacro interference do
      +    quote do: alias!(D).new
      +  end
      +end
      +
      +require NoHygiene
      +NoHygiene.interference #=> UndefinedFunctionError
      +

      Stacktrace information

      @@ -708,8 +806,8 @@

      Stacktrace information

      However, if there is an exception in any of these functions, we want the stacktrace to point to the GenServer.Behaviour and not the line that calls use GenServer.Behaviour. For this reason, there is an -option called :location that when set to :keep keeps these proper -semantics:

      +option called :location that when set to :keep keeps the original +line and file lines instead of setting them to 0:

      quote location: :keep do
         def handle_call(request, _from, state) do
      @@ -720,10 +818,10 @@ 

      Stacktrace information

      It is important to warn though that location: :keep evaluates the code as if it was defined inside GenServer.Behaviour file, in -particular, the macro __FILE__ will always point to -GenServer.Behaviour file.

      +particular, the macro __FILE__ and exceptions happening inside +the quote will always point to GenServer.Behaviour file.

      - Source + Source

      require(module, opts) @@ -783,7 +881,7 @@

      Examples

      #=> { :sum, 0, [1, 13, 3] }
      - Source + Source

      unquote_splicing(expr) @@ -798,7 +896,23 @@

      Examples

      #=> { :sum, 0, [1, 2, 3, 4, 5] }
      - Source + Source +
      +

      + var!(var) +

      +

      When used inside quoting, marks that the variable should not +be hygienezed. Check quote/2 for more information.

      +
      + Source +
      +

      + var!(var, context) +

      +

      Defines a variable in the given context. +Check quote/2 for more information.

      +
      + Source

      {args} diff --git a/docs/master/Kernel.html b/docs/master/Kernel.html index cb1276ba4..5be538c2f 100644 --- a/docs/master/Kernel.html +++ b/docs/master/Kernel.html @@ -738,6 +738,11 @@

      Macros summary

      is_range/1
    2654. +
    2655. + + is_record/1 + +
    2656. is_record/2 @@ -810,12 +815,12 @@

      Macros summary

    2657. - var!/1 + xor/2
    2658. - xor/2 + |>/2
    2659. @@ -846,7 +851,7 @@

      Examples

      abs(-3) #=> 3 - Source + Source

      apply(fun, args) @@ -859,7 +864,7 @@

      Examples

      #=> 4
      - Source + Source

      apply(module, fun, args) @@ -872,7 +877,7 @@

      Examples

      #=> [3,2,1]
      - Source + Source

      atom_to_binary(atom, encoding) @@ -888,7 +893,7 @@

      Examples

      atom_to_binary(:elixir, :utf8) #=> "elixir"
       
      - Source + Source

      atom_to_list(atom) @@ -900,7 +905,7 @@

      Examples

      atom_to_list(:elixir) #=> 'elixir'
       
      - Source + Source

      binary_part(binary, start, length) @@ -923,7 +928,7 @@

      Examples

      binary_part "foo", 3, -1 #=> 1
       
      - Source + Source

      binary_to_atom(binary, encoding) @@ -938,21 +943,21 @@

      Examples

      binary_to_atom("elixir", :utf8) #=> :elixir
       
      - Source + Source

      binary_to_existing_atom(binary, encoding)

      Works like binary_to_atom/2, but the atom must already exist.

      - Source + Source

      binary_to_list(binary)

      Returns a list of integers which correspond to the bytes of binary.

      - Source + Source

      binary_to_list(binary, start, stop) @@ -961,7 +966,7 @@

      Examples

      from position start to position stop in binary. Positions in the binary are numbered starting from 1.

      - Source + Source

      binary_to_term(binary) @@ -975,7 +980,7 @@

      Examples

      binary_to_term(term_to_binary("foo")) #=> "foo"
       
      - Source + Source

      binary_to_term(binary, options) @@ -998,7 +1003,7 @@

      Examples

      binary_to_term(term_to_binary("foo"), [:safe])
       
      - Source + Source

      bit_size(bitstring) @@ -1013,7 +1018,7 @@

      Examples

      bit_size(<<1,2,3>>) #=> 24
      - Source + Source

      bitstring_to_list(bitstring) @@ -1022,7 +1027,7 @@

      Examples

      number of bits in the binary is not divisible by 8, the last element of the list will be a bitstring containing the remaining bits (1 up to 7 bits).

      - Source + Source

      byte_size(bitstring) @@ -1039,7 +1044,7 @@

      Examples

      byte_size(<<1,2,3>>) #=> 3
      - Source + Source

      exit(reason) @@ -1054,14 +1059,14 @@

      Examples

      exit(:seems_bad)
      - Source + Source

      float(number)

      Converts the given number to a float. Allowed in guard clauses.

      - Source + Source

      float_to_list(number) @@ -1074,7 +1079,7 @@

      Examples

      #=> '7.00000000000000000000e+00'
      - Source + Source

      function_exported?(module, function, arity) @@ -1089,14 +1094,14 @@

      Examples

      it is not loaded. Check Code.ensure_loaded/1 for more information.

      - Source + Source

      hd(list)

      Returns the head of a list, raises badarg if the list is empty.

      - Source + Source

      integer_to_list(number) @@ -1109,7 +1114,7 @@

      Examples

      #=> '7'
      - Source + Source

      integer_to_list(number, base) @@ -1123,7 +1128,7 @@

      Examples

      #=> "3FF"
      - Source + Source

      iolist_size(item) @@ -1136,7 +1141,7 @@

      Examples

      #=> 4
      - Source + Source

      iolist_to_binary(item) @@ -1153,7 +1158,7 @@

      Examples

      #=> <<1,2,3,1,2,3,4,5,4,6>>
      - Source + Source

      is_alive() @@ -1161,7 +1166,7 @@

      Examples

      Returns true if the local node is alive; that is, if the node can be part of a distributed system.

      - Source + Source

      is_atom(term) @@ -1170,7 +1175,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      is_binary(term) @@ -1181,7 +1186,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      is_bitstring(term) @@ -1190,7 +1195,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      is_boolean(term) @@ -1200,7 +1205,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      is_float(term) @@ -1209,7 +1214,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      is_function(term) @@ -1218,7 +1223,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      is_function(term, arity) @@ -1228,7 +1233,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      is_integer(term) @@ -1237,7 +1242,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      is_list(term) @@ -1246,7 +1251,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      is_number(term) @@ -1256,7 +1261,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      is_pid(term) @@ -1265,7 +1270,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      is_port(term) @@ -1274,7 +1279,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      is_reference(term) @@ -1283,7 +1288,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      is_tuple(term) @@ -1292,7 +1297,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      length(list) @@ -1306,7 +1311,7 @@

      Examples

      length([1,2,3,4,5,6,7,8,9]) #=> 9
       
      - Source + Source

      list_to_atom(char_list) @@ -1318,7 +1323,7 @@

      Examples

      list_to_atom('elixir') #=> :elixir
       
      - Source + Source

      list_to_binary(char_list) @@ -1330,7 +1335,7 @@

      Examples

      list_to_binary('Elixir') #=> "Elixir"
       
      - Source + Source

      list_to_bitstring(bitstring_list) @@ -1348,7 +1353,7 @@

      Examples

      #=> <<1,2,3,1,2,3,4,5,4,6,7|4>>
      - Source + Source

      list_to_existing_atom(char_list) @@ -1356,7 +1361,7 @@

      Examples

      Returns the atom whose text representation is char_list, but only if there already exists such atom.

      - Source + Source

      list_to_float(char_list) @@ -1368,7 +1373,7 @@

      Examples

      list_to_float('2.2017764e+0') #=> 2.2017764
       
      - Source + Source

      list_to_integer(char_list) @@ -1380,7 +1385,7 @@

      Examples

      list_to_integer('123') #=> 123
       
      - Source + Source

      list_to_integer(char_list, base) @@ -1392,7 +1397,7 @@

      Examples

      list_to_integer('3FF', 16) #=> 1023
       
      - Source + Source

      list_to_pid(char_list) @@ -1411,7 +1416,7 @@

      Examples

      list_to_pid('<0.41>') #=> <0.4.1>
       
      - Source + Source

      list_to_tuple(list) @@ -1423,7 +1428,7 @@

      Examples

      list_to_tuple([:share, [:elixir, 163]]). #=> {:share, [:elixir, 163]}
       
      - Source + Source

      macro_exported?(module, macro, arity) @@ -1435,7 +1440,7 @@

      Examples

      it is not loaded. Check Code.ensure_loaded/1 for more information.

      - Source + Source

      make_ref() @@ -1451,7 +1456,7 @@

      Examples

      #=> #Ref<0.0.0.135>
      - Source + Source

      max(first, second) @@ -1465,7 +1470,7 @@

      Examples

      max(1, 2) #=> 2
       
      - Source + Source

      min(first, second) @@ -1479,7 +1484,7 @@

      Examples

      min(1, 2) #=> 1
       
      - Source + Source

      node() @@ -1489,7 +1494,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      node(arg) @@ -1500,7 +1505,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      pid_to_list(pid) @@ -1516,7 +1521,7 @@

      Warning:

      It should not be used in application programs.

      - Source + Source

      raise(msg) @@ -1541,7 +1546,7 @@

      Examples

      end
      - Source + Source

      raise(exception, args) @@ -1561,7 +1566,7 @@

      Examples

      raise ArgumentError, message: "Sample"
       
      - Source + Source

      raise(exception, args, stacktrace) @@ -1573,18 +1578,22 @@

      Examples

      try do
         raise "Oops"
       rescue
      -  exception, stacktrace ->
      +  exception ->
      +    stacktrace = System.stacktrace
           if exception.message == "Oops" do
             raise exception, [], stacktrace
           end
       end
       
      -

      Notice that Elixir does not associate stacktraces -with exceptions by default. They need to be explicitly -captured and added to the exception.

      +

      Notice that System.stacktrace returns the stacktrace +of the last exception. That said, it is common to assign +the stacktrace as the first expression inside a rescue +clause as any other exception potentially raised (and +rescued) in between the rescue clause and the raise call +may change the System.stacktrace value.

      - Source + Source

      round(number) @@ -1597,7 +1606,7 @@

      Examples

      round(5.5) #=> 6
       
      - Source + Source

      self() @@ -1605,7 +1614,7 @@

      Examples

      Returns the pid (process identifier) of the calling process. Allowed in guard clauses.

      - Source + Source

      size(arg) @@ -1613,7 +1622,7 @@

      Examples

      Returns the size of the given argument, which must be a tuple or a binary. If possible, please use tuplesize or binarysize.

      - Source + Source

      spawn(fun) @@ -1633,7 +1642,7 @@

      Examples

      end
      - Source + Source

      spawn(module, fun, args) @@ -1649,7 +1658,7 @@

      Examples

      spawn(SomeModule, :function, [1,2,3])
       
      - Source + Source

      spawn_link(fun) @@ -1670,7 +1679,7 @@

      Examples

      end
      - Source + Source

      spawn_link(module, fun, args) @@ -1686,7 +1695,7 @@

      Examples

      spawn_link(SomeModule, :function, [1,2,3])
       
      - Source + Source

      term_to_binary(term) @@ -1698,7 +1707,7 @@

      Examples

      to a file in an efficient way, or sending an Erlang term to some type of communications channel not supported by distributed :

      - Source + Source

      term_to_binary(term, opts) @@ -1712,21 +1721,21 @@

      Examples

      for more details
    2660. - Source + Source

      throw(term)

      A non-local return from a function. Check try/2 for more information.

      - Source + Source

      tl(list)

      Returns the tail of a list. Raises ArgumentError if the list is empty.

      - Source + Source

      trunc(number) @@ -1739,21 +1748,21 @@

      Examples

      trunc(5.5) #=> 5
       
      - Source + Source

      tuple_size(tuple)

      Returns the size of a tuple.

      - Source + Source

      tuple_to_list(tuple)

      Converts a tuple to a list.

      - Source + Source
      @@ -1835,7 +1844,7 @@

      Examples

      this operator accepts any expression as arguments, not only booleans, however it is not allowed in guards.

      - Source + Source

      left * right @@ -1920,7 +1929,7 @@

      Examples

      3 in 1..3 #=> true
      - Source + Source

      left / right @@ -1938,43 +1947,10 @@

      Examples

      Source

      - left /> right + />(left, right)

      -

      /> is called the pipeline operator as it is useful -to write pipeline style expressions. This operator -tntroduces the expression on the left as the first -argument to the expression on the right.

      - -

      Examples

      - -
      [1,[2],3] /> List.flatten /> Enum.map(&1 * 2)
      -#=> [2,4,6]
      -
      - -

      The expression above is simply translated to:

      - -
      Enum.map(List.flatten([1,[2],3]), &1 * 2)
      -
      - -

      Please be aware of operator precendence, when using -this operator. For example, the following expression:

      - -
      String.graphemes "Hello" /> Enum.reverse
      -
      - -

      Is translated to:

      - -
      String.graphemes("Hello" /> Enum.reverse)
      -
      - -

      Which will result in an error as Enum.Iterator protocol -is not defined for binaries. Adding explicit parenthesis -is recommended:

      - -
      String.graphemes("Hello") /> Enum.reverse
      -
      -
      - Source +
      + Source

      left < right @@ -2036,7 +2012,7 @@

      Examples

      x #=> "bar"
      - Source + Source

      left == right @@ -2089,7 +2065,7 @@

      Examples

      "abcd" =~ %r/e/ #=> nil
      - Source + Source

      left > right @@ -2165,7 +2141,7 @@

      Examples

      time and not at runtime. Check the module Module for other functions to manipulate module attributes.

      - Source + Source

      __B__(string, list2) @@ -2179,7 +2155,7 @@

      Examples

      %B(f#{o}o) #=> "f\#{o}o"
      - Source + Source

      __C__(arg1, list2) @@ -2193,7 +2169,7 @@

      Examples

      %C(f#{o}o) #=> 'f\#{o}o'
      - Source + Source

      __R__(arg1, options) @@ -2206,7 +2182,7 @@

      Examples

      Regex.match? %R(f#{1,3}o), "f#o"  #=> true
       
      - Source + Source

      __b__(arg1, list2) @@ -2220,7 +2196,7 @@

      Examples

      %b(f#{:o}o) #=> "foo"
      - Source + Source

      __c__(arg1, list2) @@ -2234,7 +2210,7 @@

      Examples

      %c(f#{:o}o) #=> 'foo'
      - Source + Source

      __r__(arg1, options) @@ -2246,7 +2222,7 @@

      Examples

      Regex.match? %r(foo), "foo"  #=> true
       
      - Source + Source

      access(element, args) @@ -2320,7 +2296,7 @@

      Examples

      access a, 1 #=> :a
      - Source + Source

      left and right @@ -2347,7 +2323,7 @@

      Examples

      atom_to_binary :my_atom #=> "my_atom"
       
      - Source + Source

      binary_to_atom(some_binary) @@ -2360,7 +2336,7 @@

      Examples

      binary_to_atom "my_atom" #=> :my_atom
       
      - Source + Source

      binary_to_existing_atom(some_binary) @@ -2373,7 +2349,7 @@

      Examples

      binary_to_existing_atom "my_atom" #=> :my_atom
      - Source + Source

      binary_to_float(some_binary) @@ -2385,7 +2361,7 @@

      Examples

      binary_to_float "2.2017764e+0" #=> 2.2017764
       
      - Source + Source

      binary_to_integer(some_binary) @@ -2397,7 +2373,7 @@

      Examples

      binary_to_integer "123" #=> 123
       
      - Source + Source

      binary_to_integer(some_binary, base) @@ -2410,7 +2386,7 @@

      Examples

      binary_to_integer("3FF", 16) #=> 1023
       
      - Source + Source

      case(condition, blocks) @@ -2463,7 +2439,7 @@

      Examples

      end
      - Source + Source

      cond(list1) @@ -2483,7 +2459,7 @@

      Examples

      end
      - Source + Source

      def(name, list2) @@ -2560,7 +2536,7 @@

      Dynamic generation with atoms

      because each entry k is a an atom and invoking def unquote(k)() would be invalid Elixir syntax.

      - Source + Source

      def(name, args, guards, list4) @@ -2597,7 +2573,7 @@

      Examples

      def name, args, guards, do: exprs
      - Source + Source

      defdelegate(funs, opts) @@ -2643,7 +2619,7 @@

      Examples

      #=> [3,2,1]
      - Source + Source

      defexception(name, fields, opts // [], do_block // []) @@ -2659,7 +2635,7 @@

      Examples

      2) Exceptions must implement message/1 as API that return a binary as result;

      - Source + Source

      defimpl(name, opts, do_block // []) @@ -2667,7 +2643,7 @@

      Examples

      Defines an implementation for the given protocol. See defprotocol/2 for examples.

      - Source + Source

      defmodule(name, list2) @@ -2715,7 +2691,7 @@

      Dynamic names

      Elixir will accept any module name as long as the expression returns an atom.

      - Source + Source

      defoverridable(tuples) @@ -2724,7 +2700,7 @@

      Dynamic names

      An overridable function is lazily defined, allowing a developer to customize it.

      - Source + Source

      defp(name, list2) @@ -2748,14 +2724,14 @@

      Examples

      In the example above, sum is private and accessing it through Foo.sum will raise an error.

      - Source + Source

      defp(name, args, guards, list4)

      The same as def/4 but generates a private function.

      - Source + Source

      defprotocol(name, list2) @@ -2848,30 +2824,33 @@

      Selecting implementations

      Protocols + Records

      -

      The real benefit of protocols comes when mixed with records. For instance, -imagine we have a module called RedBlack that provides an API to create -and manipulate Red-Black trees. This module represents such trees via a -record named RedBlack.Tree and we want this tree to be considered blank -in case it has no items. To achieve this, the developer just needs to -implement the protocol for RedBlack.Tree:

      +

      The real benefit of protocols comes when mixed with records. +For instance, imagine we have a module called RedBlack that +provides an API to create and manipulate Red-Black trees. This +module represents such trees via a record named RedBlack.Tree +and we want this tree to be considered blank in case it has no +items. To achieve this, the developer just needs to implement +the protocol for RedBlack.Tree:

      defimpl Blank, for: RedBlack.Tree do
         def blank?(tree), do: RedBlack.empty?(tree)
       end
       
      -

      In the example above, we have implemented blank? for RedBlack.Tree -that simply delegates to RedBlack.empty? passing the tree as argument. -This implementation doesn't need to be defined inside the RedBlack -tree or inside the record, but anywhere in the code.

      +

      In the example above, we have implemented blank? for +RedBlack.Tree that simply delegates to RedBlack.empty? passing +the tree as argument. This implementation doesn't need to be defined +inside the RedBlack tree or inside the record, but anywhere in +the code.

      -

      Finally, since records are simply tuples, one can add a default protocol -implementation to any record by defining a default implementation for tuples.

      +

      Finally, since records are simply tuples, one can add a default +protocol implementation to any record by defining a default +implementation for tuples.

      Types

      -

      As in records, defining a protocol automatically defines a type named t, -which can be used as:

      +

      As in records, defining a protocol automatically defines a type +named t, which can be used as:

      @spec present?(Blank.t) :: boolean
       def present?(blank) do
      @@ -2882,7 +2861,7 @@ 

      Types

      The @spec above expresses that all types allowed to implement the given protocol are valid argument types for the given function.

      - Source + Source

      defrecord(name, fields, opts // [], do_block // []) @@ -2991,7 +2970,7 @@

      Types

      When defining a type, all the fields not mentioned in the type are assumed to have type term.

      - Source + Source

      defrecordp(name, fields) @@ -3039,7 +3018,7 @@

      Examples

      name #=> "José"
      - Source + Source

      destructure(left, right) @@ -3080,7 +3059,7 @@

      Examples

      the first value from the right side. Otherwise, it will raise a CaseClauseError.

      - Source + Source

      div(left, right) @@ -3094,7 +3073,7 @@

      Examples

      div 5, 2 #=> 2
       
      - Source + Source

      elem(tuple, index) @@ -3110,7 +3089,7 @@

      Example

      elem(tuple, 1) #=> :bar
      - Source + Source

      float_to_binary(some_float) @@ -3123,7 +3102,7 @@

      Examples

      float_to_binary 7.0 #=> "7.00000000000000000000e+00"
       
      - Source + Source

      function(args) @@ -3205,7 +3184,7 @@

      Function retrieval

      f.([1,[2],3]) #=> [1,2,3]
      - Source + Source

      if(condition, clauses) @@ -3249,7 +3228,7 @@

      Blocks examples

      If you want to compare more than two clauses, you can use the cond/1 macro.

      - Source + Source

      left in right @@ -3291,7 +3270,7 @@

      Clauses

      In this case, Elixir will automatically expand it and define the variable for us.

      - Source + Source

      inspect(arg, opts // []) @@ -3315,7 +3294,7 @@

      Examples

      #=> ":foo"
      - Source + Source

      integer_to_binary(some_integer) @@ -3328,7 +3307,7 @@

      Examples

      integer_to_binary 123 #=> "123"
       
      - Source + Source

      integer_to_binary(some_integer, base) @@ -3341,7 +3320,7 @@

      Examples

      integer_to_binary 77 #=> "77"
       
      - Source + Source

      is_exception(thing) @@ -3354,14 +3333,21 @@

      Examples

      is_exception(1) #=> false
      - Source + Source

      is_range(thing)

      Check if the given argument is a range.

      - Source + Source +
      +

      + is_record(thing) +

      +

      Check if the given argument is a record.

      +
      + Source

      is_record(thing, kind) @@ -3378,14 +3364,14 @@

      Examples

      is_record(Config.new, List) #=> false
      - Source + Source

      is_regex(thing)

      Check if the given argument is a regex.

      - Source + Source

      match?(left, right) @@ -3412,7 +3398,7 @@

      Examples

      Enum.filter list, match?({:a, x } when x < 2, &1)
      - Source + Source

      nil?(x) @@ -3426,7 +3412,7 @@

      Examples

      nil? nil #=> true
      - Source + Source

      not arg @@ -3502,7 +3488,7 @@

      Examples

      will occur immediately.

      - Source + Source

      rem(left, right) @@ -3516,7 +3502,7 @@

      Examples

      rem 5, 2 #=> 1
       
      - Source + Source

      setelem(tuple, index, value) @@ -3532,7 +3518,7 @@

      Example

      setelem(tuple, 0, :baz) #=> { :baz, :bar, 3 }
      - Source + Source

      to_binary(arg) @@ -3546,7 +3532,7 @@

      Examples

      #=> "foo"
      - Source + Source

      to_char_list(arg) @@ -3559,7 +3545,7 @@

      Examples

      #=> 'foo'
      - Source + Source

      try(args) @@ -3676,7 +3662,7 @@

      Variable visibility

      end
      - Source + Source

      unless(clause, options) @@ -3685,7 +3671,7 @@

      Variable visibility

      unless a value evalutes to true. Check if for examples and documentation.

      - Source + Source

      use(module, args // []) @@ -3722,16 +3708,7 @@

      Examples

      end
      - Source -
      -

      - var!(var) -

      -

      When used inside quoting, marks that the variable should not -be hygienezed. Check Kernel.SpecialForms.quote/1 for more -information.

      -
      - Source + Source

      left xor right @@ -3746,6 +3723,45 @@

      Examples

      Source +
      +

      + left |> right +

      +

      |> is called the pipeline operator as it is useful +to write pipeline style expressions. This operator +tntroduces the expression on the left as the first +argument to the expression on the right.

      + +

      Examples

      + +
      [1,[2],3] |> List.flatten |> Enum.map(&1 * 2)
      +#=> [2,4,6]
      +
      + +

      The expression above is simply translated to:

      + +
      Enum.map(List.flatten([1,[2],3]), &1 * 2)
      +
      + +

      Please be aware of operator precendence, when using +this operator. For example, the following expression:

      + +
      String.graphemes "Hello" |> Enum.reverse
      +
      + +

      Is translated to:

      + +
      String.graphemes("Hello" |> Enum.reverse)
      +
      + +

      Which will result in an error as Enum.Iterator protocol +is not defined for binaries. Adding explicit parenthesis +is recommended:

      + +
      String.graphemes("Hello") |> Enum.reverse
      +
      +
      + Source

      left || right @@ -3766,7 +3782,7 @@

      Examples

      this operator accepts any expression as arguments, not only booleans, however it is not allowed in guards.

      - Source + Source diff --git a/docs/master/KeyError.html b/docs/master/KeyError.html index b0a2a2e64..d22ae086d 100644 --- a/docs/master/KeyError.html +++ b/docs/master/KeyError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -70,7 +70,7 @@

      Functions

      message(exception)

      - Source + Source diff --git a/docs/master/Macro.html b/docs/master/Macro.html index a76e326f9..ea75ad58d 100644 --- a/docs/master/Macro.html +++ b/docs/master/Macro.html @@ -122,7 +122,7 @@

      Functions

      do_safe_term(terms)

      - Source + Source

      escape(tuple) @@ -269,7 +269,7 @@

      Examples

      evaluate code) and returns :ok unless a given term is unsafe, which is returned as { :unsafe, term }.

      - Source + Source

      to_binary(tree) diff --git a/docs/master/MatchError.html b/docs/master/MatchError.html index 265d2fb13..b99bdddde 100644 --- a/docs/master/MatchError.html +++ b/docs/master/MatchError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -70,7 +70,7 @@

      Functions

      message(exception)

      - Source + Source
      diff --git a/docs/master/Mix.Dep.html b/docs/master/Mix.Dep.html index dc90515ee..7560e4255 100644 --- a/docs/master/Mix.Dep.html +++ b/docs/master/Mix.Dep.html @@ -92,264 +92,12 @@

      Fields (and defaults)

      -

      Functions summary

      - - -
      -

      Functions

      -
      -

      - app(record) -

      -
      - Source -
      -

      - app(value, record) -

      -
      - Source -
      -

      - new() -

      -
      - Source -
      -

      - new(opts) -

      -
      - Source -
      -

      - opts(record) -

      -
      - Source -
      -

      - opts(value, record) -

      -
      - Source -
      -

      - project(record) -

      -
      - Source -
      -

      - project(value, record) -

      -
      - Source -
      -

      - requirement(record) -

      -
      - Source -
      -

      - requirement(value, record) -

      -
      - Source -
      -

      - scm(record) -

      -
      - Source -
      -

      - scm(value, record) -

      -
      - Source -
      -

      - status(record) -

      -
      - Source -
      -

      - status(value, record) -

      -
      - Source -
      -

      - to_keywords(record) -

      -
      - Source -
      -

      - update(keywords, record) -

      -
      - Source -
      -

      - update_app(function, record) -

      -
      - Source -
      -

      - update_opts(function, record) -

      -
      - Source -
      -

      - update_project(function, record) -

      -
      - Source -
      -

      - update_requirement(function, record) -

      -
      - Source -
      -

      - update_scm(function, record) -

      -
      - Source -
      -

      - update_status(function, record) -

      -
      - Source -
      -
      - diff --git a/docs/master/Mix.Error.html b/docs/master/Mix.Error.html index 1617d4c20..91cbab0f5 100644 --- a/docs/master/Mix.Error.html +++ b/docs/master/Mix.Error.html @@ -53,70 +53,7 @@

      Fields (and defaults)

      -

      Functions summary

      - @@ -124,85 +61,6 @@

      Functions summary

      -
      -

      Functions

      -
      -

      - exception(args) -

      -
      - Source -
      -

      - exception(args, self) -

      -
      - Source -
      -

      - message(record) -

      -
      - Source -
      -

      - message(value, record) -

      -
      - Source -
      -

      - mix_error(record) -

      -
      - Source -
      -

      - mix_error(value, record) -

      -
      - Source -
      -

      - new() -

      -
      - Source -
      -

      - new(opts) -

      -
      - Source -
      -

      - to_keywords(record) -

      -
      - Source -
      -

      - update(keywords, record) -

      -
      - Source -
      -

      - update_message(function, record) -

      -
      - Source -
      -

      - update_mix_error(function, record) -

      -
      - Source -
      -
      - - - diff --git a/docs/master/Mix.InvalidTaskError.html b/docs/master/Mix.InvalidTaskError.html index 7609a4984..7adf4d5ab 100644 --- a/docs/master/Mix.InvalidTaskError.html +++ b/docs/master/Mix.InvalidTaskError.html @@ -56,70 +56,10 @@

      Fields (and defaults)

      Functions summary

      @@ -132,83 +72,11 @@

      Functions summary

      Functions

      -

      - exception(args) -

      -
      - Source -
      -

      - exception(args, self) -

      -
      - Source -

      message(exception)

      Source -
      -

      - mix_error(record) -

      -
      - Source -
      -

      - mix_error(value, record) -

      -
      - Source -
      -

      - new() -

      -
      - Source -
      -

      - new(opts) -

      -
      - Source -
      -

      - task(record) -

      -
      - Source -
      -

      - task(value, record) -

      -
      - Source -
      -

      - to_keywords(record) -

      -
      - Source -
      -

      - update(keywords, record) -

      -
      - Source -
      -

      - update_mix_error(function, record) -

      -
      - Source -
      -

      - update_task(function, record) -

      -
      - Source
      diff --git a/docs/master/Mix.NoProjectError.html b/docs/master/Mix.NoProjectError.html index 18dce114e..90b783d18 100644 --- a/docs/master/Mix.NoProjectError.html +++ b/docs/master/Mix.NoProjectError.html @@ -53,70 +53,7 @@

      Fields (and defaults)

      -

      Functions summary

      - @@ -124,85 +61,6 @@

      Functions summary

      -
      -

      Functions

      -
      -

      - exception(args) -

      -
      - Source -
      -

      - exception(args, self) -

      -
      - Source -
      -

      - message(record) -

      -
      - Source -
      -

      - message(value, record) -

      -
      - Source -
      -

      - mix_error(record) -

      -
      - Source -
      -

      - mix_error(value, record) -

      -
      - Source -
      -

      - new() -

      -
      - Source -
      -

      - new(opts) -

      -
      - Source -
      -

      - to_keywords(record) -

      -
      - Source -
      -

      - update(keywords, record) -

      -
      - Source -
      -

      - update_message(function, record) -

      -
      - Source -
      -

      - update_mix_error(function, record) -

      -
      - Source -
      -
      - - - diff --git a/docs/master/Mix.NoTaskError.html b/docs/master/Mix.NoTaskError.html index 5e559456b..87c96a1e2 100644 --- a/docs/master/Mix.NoTaskError.html +++ b/docs/master/Mix.NoTaskError.html @@ -56,70 +56,10 @@

      Fields (and defaults)

      Functions summary

      @@ -132,83 +72,11 @@

      Functions summary

      Functions

      -

      - exception(args) -

      -
      - Source -
      -

      - exception(args, self) -

      -
      - Source -

      message(exception)

      Source -
      -

      - mix_error(record) -

      -
      - Source -
      -

      - mix_error(value, record) -

      -
      - Source -
      -

      - new() -

      -
      - Source -
      -

      - new(opts) -

      -
      - Source -
      -

      - task(record) -

      -
      - Source -
      -

      - task(value, record) -

      -
      - Source -
      -

      - to_keywords(record) -

      -
      - Source -
      -

      - update(keywords, record) -

      -
      - Source -
      -

      - update_mix_error(function, record) -

      -
      - Source -
      -

      - update_task(function, record) -

      -
      - Source
      diff --git a/docs/master/Mix.OutOfDateDepsError.html b/docs/master/Mix.OutOfDateDepsError.html index f1120f0ab..a4afa25c4 100644 --- a/docs/master/Mix.OutOfDateDepsError.html +++ b/docs/master/Mix.OutOfDateDepsError.html @@ -56,70 +56,10 @@

      Fields (and defaults)

      Functions summary

      @@ -132,83 +72,11 @@

      Functions summary

      Functions

      -

      - env(record) -

      -
      - Source -
      -

      - env(value, record) -

      -
      - Source -
      -

      - exception(args) -

      -
      - Source -
      -

      - exception(args, self) -

      -
      - Source -

      message(exception)

      Source -
      -

      - mix_error(record) -

      -
      - Source -
      -

      - mix_error(value, record) -

      -
      - Source -
      -

      - new() -

      -
      - Source -
      -

      - new(opts) -

      -
      - Source -
      -

      - to_keywords(record) -

      -
      - Source -
      -

      - update(keywords, record) -

      -
      - Source -
      -

      - update_env(function, record) -

      -
      - Source -
      -

      - update_mix_error(function, record) -

      -
      - Source
      diff --git a/docs/master/Mix.Tasks.Compile.Elixir.html b/docs/master/Mix.Tasks.Compile.Elixir.html index 523200517..d9616bb4a 100644 --- a/docs/master/Mix.Tasks.Compile.Elixir.html +++ b/docs/master/Mix.Tasks.Compile.Elixir.html @@ -58,10 +58,25 @@

      Command line options

      Configuration

        -
      • :elixirc_options - compilation options that applies +
      • :elixirc_paths - directories to find source files. +Defaults to ["lib"], can be configured as:

        + +

        [elixirc_paths: ["lib", "other"]]

      • +
      • :elixirc_options - compilation options that applies to Elixir's compiler, they are: :ignore_module_conflict, :docs and :debug_info. By default, uses the same -behaviour as Elixir

      • +behaviour as Elixir

        + +
          +
        • :compile_exts - extensions to compile whenever there +is a change:
        • +
        + +

        [compile_exts: [:ex]] +* :watch_exts - extensions to watch in order to trigger +a compilation:

        + +

        [watch_exts: [:ex, :eex]]

      @@ -97,7 +112,7 @@

      Functions

      run(args)

      - Source + Source diff --git a/docs/master/Mix.Tasks.Compile.Erlang.html b/docs/master/Mix.Tasks.Compile.Erlang.html new file mode 100644 index 000000000..e4afe82fd --- /dev/null +++ b/docs/master/Mix.Tasks.Compile.Erlang.html @@ -0,0 +1,90 @@ + + + + Mix.Tasks.Compile.Erlang + + + + + + + + + + + + +
      +

      + Mix.Tasks.Compile.Erlang + +

      + + +
      +

      A task to compile Erlang source files.

      + +

      Command line options

      + +
        +
      • ERL_COMPILER_OPTIONS - can be used to give default compile options. +It's value must be a valid Erlang term. If the value is a list, it will +be used as is. If it is not a list, it will be put into a list.
      • +
      + +

      Configuration

      + +
        +
      • :erlc_options - compilation options that applies to Erlang compiler +By default, the following options are on: [:verbose, :report_errors, :report_warnings]
      • +
      + +
      + + + Source + + + + + + +

      Functions summary

      + + + + + + + + +
      +

      Functions

      +
      +

      + run(_) +

      +
      + Source +
      +
      + + + + + +
      + + diff --git a/docs/master/Mix.Tasks.Compile.html b/docs/master/Mix.Tasks.Compile.html index 03526f9d9..536d16f41 100644 --- a/docs/master/Mix.Tasks.Compile.html +++ b/docs/master/Mix.Tasks.Compile.html @@ -57,22 +57,10 @@

      Common configuration

      The following options are usually shared by different compilers:

        -
      • :source_paths - directories to find source files. -Defaults to ["lib"], can be configured as:

        - -

        [source_paths: ["lib", "other"]]

      • :compile_path - directory to output compiled files. Defaults to "ebin", can be configured as:

        [compile_path: "ebin"]

      • -
      • :watch_exts - extensions to watch in order to trigger -a compilation:

        - -

        [watch_exts: [:ex, :eex]]

      • -
      • :compile_exts - extensions to compile whenever there -is a change:

        - -

        [compile_exts: [:ex]]

      @@ -108,7 +96,7 @@

      Functions

      run(args)

      - Source + Source diff --git a/docs/master/Mix.Tasks.Escriptize.html b/docs/master/Mix.Tasks.Escriptize.html index b30333f2b..99cd9a52c 100644 --- a/docs/master/Mix.Tasks.Escriptize.html +++ b/docs/master/Mix.Tasks.Escriptize.html @@ -34,6 +34,8 @@

      • escript_name - the name of the generated escript Defaults to project name

      • +
      • escript_path - the path to write the escript to +Defaults to project name

      • escript_main_module - the module containing the main/1 function. Defaults to Project

      • escript_embed_elixir - if true embed elixir in the escript file. @@ -82,7 +84,7 @@

        Functions

        run(args)

        - Source + Source diff --git a/docs/master/Protocol.UndefinedError.html b/docs/master/Protocol.UndefinedError.html index 99441b413..8f1ba8c25 100644 --- a/docs/master/Protocol.UndefinedError.html +++ b/docs/master/Protocol.UndefinedError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -76,7 +76,7 @@

        Functions

        message(exception)

        - Source + Source diff --git a/docs/master/Record.html b/docs/master/Record.html index 6180ef4e7..b40504198 100644 --- a/docs/master/Record.html +++ b/docs/master/Record.html @@ -43,7 +43,7 @@

        Functions summary

        • - deffunctions/3 + deffunctions/2
        • @@ -63,7 +63,7 @@

          Functions summary

        • - deftypes/4 + deftypes/3
        • @@ -83,8 +83,8 @@

          Functions summary

          Functions

          -

          - deffunctions(values, _opts // [], env) +

          + deffunctions(values, env)

          Defines record functions skipping the module definition. This is called directly by defrecord. It expects the record @@ -136,8 +136,8 @@

          Examples

          Source
          -

          - deftypes(values, types, _opts // [], env) +

          + deftypes(values, types, env)

          Defines types and specs for the record.

          diff --git a/docs/master/RuntimeError.html b/docs/master/RuntimeError.html index 3b3ade316..2c1b5ce09 100644 --- a/docs/master/RuntimeError.html +++ b/docs/master/RuntimeError.html @@ -29,7 +29,7 @@

          - Source + Source diff --git a/docs/master/String.html b/docs/master/String.html index c0d3a119b..8e6995da1 100644 --- a/docs/master/String.html +++ b/docs/master/String.html @@ -162,6 +162,11 @@

          Functions summary

          upcase/1
        • +
        • + + valid_codepoint?/1 + +
        @@ -189,7 +194,7 @@

        Examples

        String.at("elixir", -10) #=> nil - Source + Source

        capitalize(string) @@ -209,7 +214,7 @@

        Examples

        codepoints(string)

        -

        Returns a list with codepoints from an utf8 string.

        +

        Returns all codepoints in the string.

        Examples

        @@ -218,7 +223,7 @@

        Examples

        String.codepoints("ἅἪῼ") #=> ["ἅ","Ἢ","ῼ"]
        - Source + Source

        downcase(binary) @@ -249,7 +254,7 @@

        Examples

        String.duplicate("abc", 2) #=> "abcabc"
        - Source + Source

        first(string) @@ -262,7 +267,7 @@

        Examples

        String.first("եոգլի") #=> "ե"
        - Source + Source

        graphemes(string) @@ -271,9 +276,10 @@

        Examples

        Examples

        -

        String.graphemes("Ā̀stute") # => ["Ā̀","s","t","u","t","e"]

        +
        String.graphemes("Ā̀stute") # => ["Ā̀","s","t","u","t","e"]
        +
        - Source + Source

        last(string) @@ -286,7 +292,7 @@

        Examples

        String.last("եոգլի") #=> "ի"
        - Source + Source

        length(string) @@ -299,7 +305,7 @@

        Examples

        String.length("եոգլի") #=> 5
        - Source + Source

        lstrip(binary) @@ -340,7 +346,7 @@

        Examples

        String.next_codepoint("josé") #=> { "j", "osé" }
         
        - Source + Source

        next_grapheme(string) @@ -356,7 +362,7 @@

        Examples

        String.next_grapheme("josé") #=> { "j", "osé" }
         
        - Source + Source

        printable?(arg1) @@ -375,13 +381,12 @@

        Examples

        replace(subject, pattern, replacement, options // [])

        Returns a new binary based on subject by replacing the parts -matching pattern for replacement. If options is specified -with [global: true], then it will replace all matches, otherwise -it will replace just the first one.

        +matching pattern for replacement. By default, it replaces +all entries, except if global: false is given as option.

        -

        For the replaced part must be used in replacement, then the -position or the positions where it is to be inserted must be specified by using -the option insert_replaced.

        +

        If the replaced part must be used in replacement, then the +position or the positions where it is to be inserted must be +specified by using the option insert_replaced.

        Examples

        @@ -392,7 +397,7 @@

        Examples

        String.replace("a,b,c", ",", "[]", insert_replaced: [1,1]) #=> "a[,,]b[,,]c"
        - Source + Source

        rstrip(binary) @@ -435,7 +440,7 @@

        Examples

        String.slice("elixir", -10, 3) #=> nil
        - Source + Source

        split(binary, pattern // " ", options // []) @@ -509,6 +514,24 @@

        Examples

        Source +
        +

        + valid_codepoint?(arg1) +

        +

        Checks whether str is a valid codepoint.

        + +

        Note that the empty string is considered invalid, as are +strings containing multiple codepoints.

        + +

        Examples

        + +
        String.valid_codepoint?("a") #=> true
        +String.valid_codepoint?("ø") #=> true
        +String.valid_codepoint?("ÿff") #=> false
        +String.valid_codepoint?("asdf") #=> false
        +
        +
        + Source
        diff --git a/docs/master/SyntaxError.html b/docs/master/SyntaxError.html index dfa1c708f..27ca38388 100644 --- a/docs/master/SyntaxError.html +++ b/docs/master/SyntaxError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -82,7 +82,7 @@

        Functions

        message(exception)

        - Source + Source diff --git a/docs/master/SystemLimitError.html b/docs/master/SystemLimitError.html index 6b0d65fd1..1f760d026 100644 --- a/docs/master/SystemLimitError.html +++ b/docs/master/SystemLimitError.html @@ -29,7 +29,7 @@

        - Source + Source diff --git a/docs/master/TokenMissingError.html b/docs/master/TokenMissingError.html index 9a445ae52..cb4d48285 100644 --- a/docs/master/TokenMissingError.html +++ b/docs/master/TokenMissingError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -82,7 +82,7 @@

        Functions

        message(exception)

        - Source + Source diff --git a/docs/master/UndefinedFunctionError.html b/docs/master/UndefinedFunctionError.html index 1a7dfdbef..6c1254a66 100644 --- a/docs/master/UndefinedFunctionError.html +++ b/docs/master/UndefinedFunctionError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -82,7 +82,7 @@

        Functions

        message(exception)

        - Source + Source diff --git a/docs/master/modules_list.html b/docs/master/modules_list.html index 9d8b61443..829f46ac6 100644 --- a/docs/master/modules_list.html +++ b/docs/master/modules_list.html @@ -1247,28 +1247,14 @@

      • - filter_stacktrace/1 + format_entry/2 Exception
      • - format_entry/1 - - Exception -
      • - -
      • - - format_file_line/1 - - Exception -
      • - -
      • - - format_file_line/2 + format_file_line/3 Exception
      • @@ -2155,6 +2141,13 @@

        Kernel.SpecialForms

      • +
      • + + alias!/1 + + Kernel.SpecialForms +
      • +
      • bc/1 @@ -2204,6 +2197,20 @@

        Kernel.SpecialForms

      • +
      • + + var!/1 + + Kernel.SpecialForms +
      • + +
      • + + var!/2 + + Kernel.SpecialForms +
      • +
      • {}/1 @@ -3030,6 +3037,13 @@

        Kernel

      • +
      • + + is_record/1 + + Kernel +
      • +
      • is_record/2 @@ -3382,14 +3396,14 @@

      • - var!/1 + xor/2 Kernel
      • - xor/2 + |>/2 Kernel
      • @@ -4394,6 +4408,24 @@

        Mix.Tasks.Compile.Elixir

      • +
      +
    2661. + + + Tasks.Compile.Erlang + + Mix.Tasks.Compile.Erlang +
    2662. +
        + + +
      • + + run/1 + + Mix.Tasks.Compile.Erlang +
      • +
    2663. @@ -5522,7 +5554,7 @@

    2664. - deffunctions/3 + deffunctions/2 Record
    2665. @@ -5550,7 +5582,7 @@

    2666. - deftypes/4 + deftypes/3 Record
    2667. @@ -5829,6 +5861,13 @@

      String

    2668. +
    2669. + + valid_codepoint?/1 + + String +
    2670. +
    2671. diff --git a/docs/master/records_list.html b/docs/master/records_list.html index ede0f3e73..662c6e49f 100644 --- a/docs/master/records_list.html +++ b/docs/master/records_list.html @@ -155,69 +155,6 @@

    2672. @@ -258,69 +195,6 @@

    2673. @@ -332,48 +206,6 @@

    2674. @@ -655,355 +382,33 @@

        -
      • - - app/1 - - Mix.Dep -
      • +
      +
    2675. + + + Mix.Error + + Mix.Error +
    2676. +
        -
      • - - app/2 - - Mix.Dep -
      • -
      • - - new/0 - - Mix.Dep -
      • +
      +
    2677. + + + Mix.InvalidTaskError + + Mix.InvalidTaskError +
    2678. + -
    2679. - - - Mix.Error - - Mix.Error -
    2680. - -
    2681. - - - Mix.InvalidTaskError - - Mix.InvalidTaskError -
    2682. - @@ -1017,90 +422,6 @@

    2683. @@ -1112,20 +433,6 @@

    2684. @@ -1214,34 +451,6 @@

        -
      • - - env/1 - - Mix.OutOfDateDepsError -
      • - -
      • - - env/2 - - Mix.OutOfDateDepsError -
      • - -
      • - - exception/1 - - Mix.OutOfDateDepsError -
      • - -
      • - - exception/2 - - Mix.OutOfDateDepsError -
      • -
      • message/1 @@ -1249,62 +458,6 @@

        Mix.OutOfDateDepsError

      • -
      • - - mix_error/1 - - Mix.OutOfDateDepsError -
      • - -
      • - - mix_error/2 - - Mix.OutOfDateDepsError -
      • - -
      • - - new/0 - - Mix.OutOfDateDepsError -
      • - -
      • - - new/1 - - Mix.OutOfDateDepsError -
      • - -
      • - - to_keywords/1 - - Mix.OutOfDateDepsError -
      • - -
      • - - update/2 - - Mix.OutOfDateDepsError -
      • - -
      • - - update_env/2 - - Mix.OutOfDateDepsError -
      • - -
      • - - update_mix_error/2 - - Mix.OutOfDateDepsError -
      • -
    2685. From 35ff80c791f6b767d52a99fe3a85a5a3b64c5deb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sat, 12 Jan 2013 23:52:44 +0100 Subject: [PATCH 317/437] Fix JS bug --- docs/master/js/full_list.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/master/js/full_list.js b/docs/master/js/full_list.js index e1418474d..2e4016283 100644 --- a/docs/master/js/full_list.js +++ b/docs/master/js/full_list.js @@ -21,9 +21,9 @@ function fullListSearch() { searchCache.push({name:link.text(), fullName:fullName, node:$(this), link:link}); }); - $('#search input').keyup(function() { - if ((event.keyCode > ignoreKeyCodeMin && event.keyCode < ignoreKeyCodeMax) - || event.keyCode == commandKey) + $('#search input').keyup(function(evnt) { + if ((evnt.keyCode > ignoreKeyCodeMin && evnt.keyCode < ignoreKeyCodeMax) + || evnt.keyCode == commandKey) return; searchString = this.value; caseSensitiveMatch = searchString.match(/[A-Z]/) != null; From 825add5c189a1bf7737634652f954cad4f6dd097 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sat, 19 Jan 2013 17:45:58 -0700 Subject: [PATCH 318/437] Update master docs --- docs/master/Access.Binary.Dict.html | 4 +- docs/master/Access.HashDict.html | 4 +- docs/master/Access.Orddict.html | 4 +- docs/master/ArgumentError.html | 2 +- docs/master/ArithmeticError.html | 2 +- docs/master/BadArityError.html | 4 +- docs/master/BadFunctionError.html | 4 +- docs/master/Binary.Dict.html | 8 +- docs/master/Binary.Inspect.Function.html | 77 +++ docs/master/Binary.Inspect.HashDict.html | 72 +++ docs/master/Binary.Inspect.PID.html | 77 +++ docs/master/Binary.Inspect.Port.html | 77 +++ docs/master/Binary.Inspect.Range.html | 72 +++ docs/master/Binary.Inspect.Reference.html | 77 +++ docs/master/Binary.Inspect.html | 36 ++ docs/master/CaseClauseError.html | 4 +- docs/master/Code.html | 47 +- docs/master/CompileError.html | 4 +- docs/master/Dict.html | 128 +++-- docs/master/Enum.Iterator.Binary.Dict.html | 6 +- docs/master/Enum.Iterator.HashDict.html | 6 +- docs/master/Enum.Iterator.Orddict.html | 6 +- docs/master/Enum.OutOfBoundsError.html | 2 +- docs/master/ErlangError.html | 4 +- docs/master/Exception.html | 10 +- docs/master/File.html | 406 ++------------- docs/master/FunctionClauseError.html | 4 +- docs/master/HashDict.html | 198 ++++++- docs/master/Kernel.SpecialForms.html | 4 +- docs/master/Kernel.html | 106 ++-- docs/master/KeyError.html | 4 +- docs/master/List.Dict.html | 276 ++++++++++ docs/master/MatchError.html | 4 +- docs/master/Mix.Project.html | 22 +- docs/master/Mix.Task.html | 4 +- docs/master/Mix.Tasks.Deps.Get.html | 8 +- docs/master/Mix.Tasks.Deps.Update.html | 8 +- docs/master/Mix.Tasks.Escriptize.html | 11 +- docs/master/Mix.Utils.html | 25 +- docs/master/OrdDict.html | 8 +- .../{Tuple.html => Path.NoHomeError.html} | 19 +- docs/master/Path.html | 430 +++++++++++++++ docs/master/Protocol.UndefinedError.html | 4 +- docs/master/RuntimeError.html | 2 +- docs/master/String.html | 160 ++++-- docs/master/SyntaxError.html | 4 +- docs/master/SystemLimitError.html | 2 +- docs/master/TokenMissingError.html | 4 +- docs/master/URI.html | 2 +- docs/master/UndefinedFunctionError.html | 4 +- docs/master/modules_list.html | 489 ++++++++++++++---- docs/master/protocols_list.html | 108 ++++ docs/master/records_list.html | 11 + docs/stable/js/full_list.js | 16 +- 54 files changed, 2351 insertions(+), 729 deletions(-) create mode 100644 docs/master/Binary.Inspect.Function.html create mode 100644 docs/master/Binary.Inspect.HashDict.html create mode 100644 docs/master/Binary.Inspect.PID.html create mode 100644 docs/master/Binary.Inspect.Port.html create mode 100644 docs/master/Binary.Inspect.Range.html create mode 100644 docs/master/Binary.Inspect.Reference.html create mode 100644 docs/master/List.Dict.html rename docs/master/{Tuple.html => Path.NoHomeError.html} (60%) create mode 100644 docs/master/Path.html diff --git a/docs/master/Access.Binary.Dict.html b/docs/master/Access.Binary.Dict.html index 4ee1a6170..483b82ccb 100644 --- a/docs/master/Access.Binary.Dict.html +++ b/docs/master/Access.Binary.Dict.html @@ -29,7 +29,7 @@

      - Source + Source @@ -59,7 +59,7 @@

      Functions

      access(dict, key)

      - Source + Source diff --git a/docs/master/Access.HashDict.html b/docs/master/Access.HashDict.html index 813d2659f..180a77fa2 100644 --- a/docs/master/Access.HashDict.html +++ b/docs/master/Access.HashDict.html @@ -29,7 +29,7 @@

      - Source + Source @@ -59,7 +59,7 @@

      Functions

      access(dict, key)

      - Source + Source diff --git a/docs/master/Access.Orddict.html b/docs/master/Access.Orddict.html index 5172f2ae7..4d64bd824 100644 --- a/docs/master/Access.Orddict.html +++ b/docs/master/Access.Orddict.html @@ -29,7 +29,7 @@

      - Source + Source @@ -59,7 +59,7 @@

      Functions

      access(dict, key)

      - Source + Source diff --git a/docs/master/ArgumentError.html b/docs/master/ArgumentError.html index 1aa2defdf..55e962cf7 100644 --- a/docs/master/ArgumentError.html +++ b/docs/master/ArgumentError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/master/ArithmeticError.html b/docs/master/ArithmeticError.html index bf124aba5..803ab5bc5 100644 --- a/docs/master/ArithmeticError.html +++ b/docs/master/ArithmeticError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/master/BadArityError.html b/docs/master/BadArityError.html index 7b90146d7..490017446 100644 --- a/docs/master/BadArityError.html +++ b/docs/master/BadArityError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -76,7 +76,7 @@

      Functions

      message(exception)

      - Source + Source diff --git a/docs/master/BadFunctionError.html b/docs/master/BadFunctionError.html index 5a292c0c8..d52162522 100644 --- a/docs/master/BadFunctionError.html +++ b/docs/master/BadFunctionError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -70,7 +70,7 @@

      Functions

      message(exception)

      - Source + Source diff --git a/docs/master/Binary.Dict.html b/docs/master/Binary.Dict.html index 1e3c4c38c..2a71f9abf 100644 --- a/docs/master/Binary.Dict.html +++ b/docs/master/Binary.Dict.html @@ -36,7 +36,7 @@

      - Source + Source @@ -77,7 +77,7 @@

      Functions

      Creates a new empty dict.

      - Source + Source

      new(pairs) @@ -90,7 +90,7 @@

      Examples

      #=> [a: 1, b: 2]
      - Source + Source

      new(list, transform) @@ -104,7 +104,7 @@

      Examples

      #=> ["a": "a", "b": "b"]
      - Source + Source diff --git a/docs/master/Binary.Inspect.Function.html b/docs/master/Binary.Inspect.Function.html new file mode 100644 index 000000000..7abed6af3 --- /dev/null +++ b/docs/master/Binary.Inspect.Function.html @@ -0,0 +1,77 @@ + + + + Binary.Inspect.Function + + + + + + + + + + + + +
      +

      + Binary.Inspect.Function + + impl + +

      + + +
      +

      Inspect functions, when possible, in a literal form.

      + +
      + + + Source + + + + + + +

      Functions summary

      + + + + + + + + +
      +

      Functions

      +
      +

      + inspect(function, _opts) +

      +
      + Source +
      +
      + + + + + +
      + + diff --git a/docs/master/Binary.Inspect.HashDict.html b/docs/master/Binary.Inspect.HashDict.html new file mode 100644 index 000000000..05a0523ec --- /dev/null +++ b/docs/master/Binary.Inspect.HashDict.html @@ -0,0 +1,72 @@ + + + + Binary.Inspect.HashDict + + + + + + + + + + + + +
      +

      + Binary.Inspect.HashDict + + impl + +

      + + + + Source + + + + + + +

      Functions summary

      + + + + + + + + +
      +

      Functions

      +
      +

      + inspect(dict, opts) +

      +
      + Source +
      +
      + + + + + +
      + + diff --git a/docs/master/Binary.Inspect.PID.html b/docs/master/Binary.Inspect.PID.html new file mode 100644 index 000000000..014f2b907 --- /dev/null +++ b/docs/master/Binary.Inspect.PID.html @@ -0,0 +1,77 @@ + + + + Binary.Inspect.PID + + + + + + + + + + + + +
      +

      + Binary.Inspect.PID + + impl + +

      + + +
      +

      Inspect PIDs

      + +
      + + + Source + + + + + + +

      Functions summary

      + + + + + + + + +
      +

      Functions

      +
      +

      + inspect(pid, _) +

      +
      + Source +
      +
      + + + + + +
      + + diff --git a/docs/master/Binary.Inspect.Port.html b/docs/master/Binary.Inspect.Port.html new file mode 100644 index 000000000..704f6c138 --- /dev/null +++ b/docs/master/Binary.Inspect.Port.html @@ -0,0 +1,77 @@ + + + + Binary.Inspect.Port + + + + + + + + + + + + +
      +

      + Binary.Inspect.Port + + impl + +

      + + +
      +

      Inspect ports

      + +
      + + + Source + + + + + + +

      Functions summary

      + + + + + + + + +
      +

      Functions

      +
      +

      + inspect(port, _) +

      +
      + Source +
      +
      + + + + + +
      + + diff --git a/docs/master/Binary.Inspect.Range.html b/docs/master/Binary.Inspect.Range.html new file mode 100644 index 000000000..af92c4386 --- /dev/null +++ b/docs/master/Binary.Inspect.Range.html @@ -0,0 +1,72 @@ + + + + Binary.Inspect.Range + + + + + + + + + + + + +
      +

      + Binary.Inspect.Range + + impl + +

      + + + + Source + + + + + + +

      Functions summary

      + + + + + + + + +
      +

      Functions

      +
      +

      + inspect(arg1, opts) +

      +
      + Source +
      +
      + + + + + +
      + + diff --git a/docs/master/Binary.Inspect.Reference.html b/docs/master/Binary.Inspect.Reference.html new file mode 100644 index 000000000..75e428bc4 --- /dev/null +++ b/docs/master/Binary.Inspect.Reference.html @@ -0,0 +1,77 @@ + + + + Binary.Inspect.Reference + + + + + + + + + + + + +
      +

      + Binary.Inspect.Reference + + impl + +

      + + +
      +

      Inspect references

      + +
      + + + Source + + + + + + +

      Functions summary

      + + + + + + + + +
      +

      Functions

      +
      +

      + inspect(ref, _) +

      +
      + Source +
      +
      + + + + + +
      + + diff --git a/docs/master/Binary.Inspect.html b/docs/master/Binary.Inspect.html index 96a6e7e57..e9c1f94d4 100644 --- a/docs/master/Binary.Inspect.html +++ b/docs/master/Binary.Inspect.html @@ -64,6 +64,18 @@

      Implementations

    2686. +
    2687. + + Function + +
    2688. + +
    2689. + + HashDict + +
    2690. +
    2691. List @@ -76,6 +88,30 @@

      Implementations

    2692. +
    2693. + + PID + +
    2694. + +
    2695. + + Port + +
    2696. + +
    2697. + + Range + +
    2698. + +
    2699. + + Reference + +
    2700. +
    2701. Regex diff --git a/docs/master/CaseClauseError.html b/docs/master/CaseClauseError.html index d2d239407..5e01b7caf 100644 --- a/docs/master/CaseClauseError.html +++ b/docs/master/CaseClauseError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -70,7 +70,7 @@

      Functions

      message(exception)

      - Source + Source diff --git a/docs/master/Code.html b/docs/master/Code.html index c40495847..d8ddfbd97 100644 --- a/docs/master/Code.html +++ b/docs/master/Code.html @@ -151,7 +151,7 @@

      Functions

      append_path(path)

      Appends a path to Erlang VM code path. -The path is expanded with File.expand_path before added.

      +The path is expanded with Path.expand before added.

      Source
      @@ -164,7 +164,7 @@

      Functions

      For compiling many files at once, check Kernel.ParallelCompiler.

      - Source + Source

      compiler_options() @@ -172,7 +172,7 @@

      Functions

      Loads the compilation options from the code server. Check compiler_options/1 for more information.

      - Source + Source

      compiler_options(opts) @@ -192,13 +192,13 @@

      Functions

      without raising errors, false by default;
    2702. - Source + Source

      delete_path(path)

      Deletes a path from Erlang VM code path. -The path is expanded with File.expand_path before deleted.

      +The path is expanded with Path.expand before deleted.

      Source
      @@ -217,7 +217,7 @@

      Functions

      Check ensure_loaded/1 for more information on module loading and when to use ensure_loaded/1 or ensure_compiled/1.

      - Source + Source

      ensure_compiled?(module) @@ -225,7 +225,7 @@

      Functions

      Similar to ensure_compiled/1, but returns a boolean in case it could be ensured or not.

      - Source + Source

      ensure_loaded(module) @@ -267,7 +267,7 @@

      Code.ensure_compiled

      must be used just in same rare conditions, usually involving macros that needs to invoke a module for callback information.

      - Source + Source

      ensure_loaded?(module) @@ -275,7 +275,7 @@

      Code.ensure_compiled

      Similar to ensure_loaded/1, but returns a boolean in case it could be ensured or not.

      - Source + Source

      eval(string, binding // [], opts // []) @@ -287,16 +287,27 @@

      Code.ensure_compiled

      • :file - the file to be considered in the evaluation
      • :line - the line the script starts
      • +
      • :delegate_locals_to - delegate local calls to the given module, +the default is to not delegate
      • +
      + +

      Besides, the following scope values can be configured:

      + +
      • :aliases - a list of tuples with the alias and its target
      • :requires - a list of modules required
      • :functions - a list of tuples where the first element is a module and the second a list of imported function names and arity
      • :macros - a list of tuples where the first element is a module and the second a list of imported macro names and arity
      • -
      • :delegate_locals_to - delegate local calls to the given module, -the default is to not delegate
      +

      Notice that setting any ov the values above overrides Elixir default +values. For example, setting :requires to [], will no longer +automatically required the Kernel module, in the same way setting +:macros will no longer auto-import Kernel macros as if, case, +etc.

      +

      Examples

      Code.eval "a + b", [a: 1, b: 2], file: __ENV__.file, line: __ENV__.line
      @@ -311,7 +322,7 @@ 

      Examples

      #=> { 3, [ {:a, 1}, {:b, 2} ] }
      - Source + Source

      eval_quoted(quoted, binding // [], opts // []) @@ -336,7 +347,7 @@

      Examples

      #=> { 3, [ {:a, 1}, {:b, 2} ] }
      - Source + Source

      load_file(file, relative_to // nil) @@ -352,7 +363,7 @@

      Examples

      a given file, the given file will be loaded N times. Check require_file if you don't want a file to be loaded concurrently.

      - Source + Source

      loaded_files() @@ -365,7 +376,7 @@

      Examples

      prepend_path(path)

      Prepends a path to Erlang VM code path. -The path is expanded with File.expand_path before added.

      +The path is expanded with Path.expand before added.

      Source
      @@ -384,7 +395,7 @@

      Examples

      file, the given file will be loaded only once. Check load_file if you want a file to be loaded concurrently.

      - Source + Source

      string_to_ast(string, opts // []) @@ -402,7 +413,7 @@

      Options

      when non-existing atoms are found by the tokenizer.

    2703. - Source + Source

      string_to_ast!(string, opts // []) @@ -414,7 +425,7 @@

      Options

      Check Code.string_to_ast/2 for options information.

      - Source + Source

      unload_files(files) diff --git a/docs/master/CompileError.html b/docs/master/CompileError.html index c03ead4ec..d8af90bc2 100644 --- a/docs/master/CompileError.html +++ b/docs/master/CompileError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -82,7 +82,7 @@

      Functions

      message(exception)

      - Source + Source
      diff --git a/docs/master/Dict.html b/docs/master/Dict.html index 5bb107c54..c9c8c0318 100644 --- a/docs/master/Dict.html +++ b/docs/master/Dict.html @@ -31,20 +31,14 @@

      This module specifies the Dict API expected to be implemented by different dictionaries. It also provides -functions that redirect to the underlying Dict based on -the tuple signature.

      - -

      The keyword list used throughout Elixir cannot be -manipulated via the Dict module, you must use the -Keyword module instead. This distinction is intentional: -the Dict module is meant to work on structures that work -as storage.

      +functions that redirect to the underlying Dict, allowing +a developer to work with different Dict implementations +using one API.

      To create a new dict, use the new functions defined by each dict type:

      -
      OrdDict.new [{:a, 1}, {:b, 2}]
      -HashDict.new  #=> creates an empty HashDict
      +
      HashDict.new  #=> creates an empty HashDict
       

      For simplicity's sake, in the examples below everytime @@ -54,6 +48,9 @@

      it implies that the returned value is actually of the same dict type as the input one.

      +

      Keep in mind that all dicts are also required to +implement both Access and Enum.Iterator protocols.

      +

      @@ -155,6 +152,11 @@

      Callbacks summary

      values/1

    2704. +
    2705. + + update/4 + +
    2706. update/3 @@ -185,6 +187,11 @@

      Callbacks summary

      merge/3
    2707. +
    2708. + + merge/2 + +
    2709. keys/1 @@ -195,11 +202,21 @@

      Callbacks summary

      has_key?/2
    2710. +
    2711. + + get!/2 + +
    2712. get/3
    2713. +
    2714. + + get/2 + +
    2715. empty/1 @@ -233,14 +250,14 @@

      Examples

      Dict.delete d, :a #=> [b: 2]
      - Source + Source

      empty(dict)

      Returns an empty dict of the same type as dict.

      - Source + Source

      get(dict, key, default // nil) @@ -256,7 +273,7 @@

      Examples

      Dict.get d, :b, 3 #=> 3
      - Source + Source

      get!(dict, key) @@ -271,7 +288,7 @@

      Examples

      Dict.get d, :b #=> raises KeyError[key: :b]
      - Source + Source

      has_key?(dict, key) @@ -285,7 +302,7 @@

      Examples

      Dict.has_key?(d, :b) #=> false
      - Source + Source

      keys(dict) @@ -300,15 +317,13 @@

      Examples

      Dict.keys d #=> [:a,:b]
      - Source + Source

      - merge(dict1, dict2) + merge(dict, enum)

      -

      Merges two dicts into one. If the dicts have duplicated entries, -the one given as second argument wins. In case the second argument -is not of the same kind as the first one, it is converted to the -same kind before merging as long as it implements the Enum protocol.

      +

      Merges the given enum into the dict. In case one of the enum entries +alread exist in the dict, it is given higher preference.

      Examples

      @@ -318,13 +333,14 @@

      Examples

      #=> [a: 3, b: 2, d: 4]
      - Source + Source

      - merge(dict1, dict2, fun) + merge(dict, enum, fun)

      -

      Merges two dicts into one. If the dicts have duplicated entries, the given -function is invoked to solve conflicts.

      +

      Merges the given enum into the dict. In case one of the enum entries +alread exist in the dict, the given function is invoked to solve +conflicts.

      Examples

      @@ -336,7 +352,7 @@

      Examples

      #=> [a: 4, b: 2, d: 4]
      - Source + Source

      put(dict, key, val) @@ -351,7 +367,7 @@

      Examples

      #=> [a: 3, b: 2]
      - Source + Source

      put_new(dict, key, val) @@ -365,7 +381,7 @@

      Examples

      #=> [a: 1, b: 2]
      - Source + Source

      size(dict) @@ -378,7 +394,7 @@

      Examples

      Dict.size d #=> 2
      - Source + Source

      to_list(dict) @@ -386,7 +402,7 @@

      Examples

      Returns a list of key-value pairs stored in dict. No particular order is enforced.

      - Source + Source

      update(dict, key, fun) @@ -401,7 +417,7 @@

      Examples

      #=> [a: -1, b: 2]
      - Source + Source

      update(dict, key, initial, fun) @@ -417,7 +433,7 @@

      Examples

      #=> [a: 1, b: 2, c: 3]
      - Source + Source

      values(dict) @@ -430,7 +446,7 @@

      Examples

      Dict.values d #=> [1,2]
      - Source + Source @@ -446,72 +462,96 @@

      Callbacks

      Source +
      +

      + update(t(), key(), value(), (value() -> value())) +

      +
      + Source

      update(t(), key(), (value() -> value()))

      - Source + Source

      to_list(t())

      - Source + Source

      size(t())

      - Source + Source

      put_new(t(), key(), value())

      - Source + Source

      put(t(), key(), value())

      - Source + Source

      merge(t(), t(), (key(), value(), value() -> value()))

      - Source + Source +
      +

      + merge(t(), t()) +

      +
      + Source

      keys(t())

      - Source + Source

      has_key?(t(), key())

      - Source + Source +
      +

      + get!(t(), key()) +

      +
      + Source

      get(t(), key(), value())

      - Source + Source +
      +

      + get(t(), key()) +

      +
      + Source

      empty(t())

      - Source + Source

      delete(t(), key())

      - Source + Source
      diff --git a/docs/master/Enum.Iterator.Binary.Dict.html b/docs/master/Enum.Iterator.Binary.Dict.html index 8434e454e..3aac32d21 100644 --- a/docs/master/Enum.Iterator.Binary.Dict.html +++ b/docs/master/Enum.Iterator.Binary.Dict.html @@ -29,7 +29,7 @@

      - Source + Source @@ -64,13 +64,13 @@

      Functions

      count(arg1)

      - Source + Source

      iterator(arg1)

      - Source + Source
      diff --git a/docs/master/Enum.Iterator.HashDict.html b/docs/master/Enum.Iterator.HashDict.html index 9d6d45596..8b507ebd6 100644 --- a/docs/master/Enum.Iterator.HashDict.html +++ b/docs/master/Enum.Iterator.HashDict.html @@ -29,7 +29,7 @@

      - Source + Source @@ -64,13 +64,13 @@

      Functions

      count(dict)

      - Source + Source

      iterator(dict)

      - Source + Source
      diff --git a/docs/master/Enum.Iterator.Orddict.html b/docs/master/Enum.Iterator.Orddict.html index a2fc093e3..59ee6956c 100644 --- a/docs/master/Enum.Iterator.Orddict.html +++ b/docs/master/Enum.Iterator.Orddict.html @@ -29,7 +29,7 @@

      - Source + Source @@ -64,13 +64,13 @@

      Functions

      count(arg1)

      - Source + Source

      iterator(arg1)

      - Source + Source
      diff --git a/docs/master/Enum.OutOfBoundsError.html b/docs/master/Enum.OutOfBoundsError.html index 0bc46edd5..c5e344942 100644 --- a/docs/master/Enum.OutOfBoundsError.html +++ b/docs/master/Enum.OutOfBoundsError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/master/ErlangError.html b/docs/master/ErlangError.html index c608912da..c68f65886 100644 --- a/docs/master/ErlangError.html +++ b/docs/master/ErlangError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -70,7 +70,7 @@

      Functions

      message(exception)

      - Source + Source diff --git a/docs/master/Exception.html b/docs/master/Exception.html index 9a73af98f..2d3e5066e 100644 --- a/docs/master/Exception.html +++ b/docs/master/Exception.html @@ -92,7 +92,7 @@

      Functions

      format_file_line(file, line, cwd)

      - Source + Source

      format_stacktrace(trace // nil) @@ -103,7 +103,7 @@

      Functions

      calculates the current stacktrace and formats it. As consequence, the value of System.stacktrace is changed.

      - Source + Source

      normalize(exception) @@ -118,8 +118,12 @@

      Functions

      print_stacktrace(trace // nil)

      Prints the current stacktrace to standard output.

      + +

      A stacktrace must be given as argument. If not, this function +calculates the current stacktrace and formats it. As consequence, +the value of System.stacktrace is changed.

      - Source + Source
      diff --git a/docs/master/File.html b/docs/master/File.html index e303cb6fd..9840a74ec 100644 --- a/docs/master/File.html +++ b/docs/master/File.html @@ -27,12 +27,11 @@

      -

      This module contains function to manipulate files, -filenames and the filesystem. Many of the functions -that interact with the filesystem have their naming -based on its UNIX variants. For example, deleting a -file is done with File.rm. Getting its stats with -File.stat.

      +

      This module contains function to manipulate files. +Many of the functions that interact with the filesystem +have their naming based on its UNIX variants. For +example, deleting a file is done with File.rm. +Getting its stats with File.stat.

      In order to write and read files, one must use the functions in the IO module. By default, a file is @@ -88,16 +87,6 @@

      Functions summary

      • - - basename/1 - -
      • -
      • - - basename/2 - -
      • -
      • biniterator/1 @@ -177,31 +166,11 @@

        Functions summary

        dir?/1
      • -
      • - - dirname/1 - -
      • exists?/1
      • -
      • - - expand_path/1 - -
      • -
      • - - expand_path/2 - -
      • -
      • - - extname/1 - -
      • iterator/1 @@ -217,16 +186,6 @@

        Functions summary

        iterator!/2
      • -
      • - - join/1 - -
      • -
      • - - join/2 - -
      • mkdir/1 @@ -312,21 +271,6 @@

        Functions summary

        rmdir!/1
      • -
      • - - rootname/1 - -
      • -
      • - - rootname/2 - -
      • -
      • - - split/1 - -
      • stat/2 @@ -347,11 +291,6 @@

        Functions summary

        touch!/2
      • -
      • - - wildcard/1 - -
      • write/3 @@ -384,51 +323,6 @@

        Functions summary

        Functions

        -

        - basename(path) -

        -

        Returns the last component of the path or the path -itself if it does not contain any directory separators.

        - -

        If the given path is a char list, returns a char list. -Otherwise returns a binary.

        - -

        Examples

        - -
        File.basename("foo")
        -#=> "foo"
        -
        -File.basename("foo/bar")
        -#=> "bar"
        -
        -File.basename("/")
        -#=> ""
        -
        -
        - Source -
        -

        - basename(path, extension) -

        -

        Returns the last component of path with the extension -stripped. This function should be used to remove a specific -extension which might, or might not, be there.

        - -

        If the given path is a char list, returns a char list. -Otherwise returns a binary.

        - -

        Examples

        - -
        File.basename("~/foo/bar.ex", ".ex")
        -#=> "bar"
        -File.basename("~/foo/bar.exs", ".ex")
        -#=> "bar.exs"
        -File.basename("~/foo/bar.old.ex", ".ex")
        -#=> "bar.old"
        -
        -
        - Source -

        biniterator(device)

        @@ -436,7 +330,7 @@

        Examples

        be passed into Enum to iterate line by line as a binary. Check iterator/1 for more information.

        - Source + Source

        biniterator(file, mode) @@ -445,7 +339,7 @@

        Examples

        returns its biniterator. Fails for the same reasons as File.open.

        - Source + Source

      biniterator!(file, mode // []) @@ -453,7 +347,7 @@

      Examples

      Same as biniterator/2 but raises if the file cannot be opened.

      - Source + Source

      cd(path) @@ -461,14 +355,14 @@

      Examples

      Sets the current working directory. Returns :ok if successful, { :error, reason } otherwise.

      - Source + Source

      cd!(path)

      The same as cd/0, but raises an exception if it fails.

      - Source + Source

      cd!(path, function) @@ -480,7 +374,7 @@

      Examples

      Raises an error if retrieving or changing the current directory fails.

      - Source + Source

      close(io_device) @@ -492,7 +386,7 @@

      Examples

      close/1 might return an old write error and not even try to close the file. See open/2.

      - Source + Source

      copy(source, destination, bytes_count // :infinity) @@ -511,7 +405,7 @@

      Examples

      Typical error reasons are the same as in open/2, read/1 and write/2.

      - Source + Source

      copy!(source, destination, bytes_count // :infinity) @@ -519,7 +413,7 @@

      Examples

      The same as copy/3 but raises an File.CopyError if it fails. Returns the bytes_copied otherwise.

      - Source + Source

      cp(source, destination, callback // fn _, _ -> true end) @@ -542,7 +436,7 @@

      Examples

      It returns :ok in case of success, returns { :error, reason } otherwise.

      - Source + Source

      cp!(source, destination, callback // fn _, _ -> true end) @@ -550,7 +444,7 @@

      Examples

      The same as cp/3, but raises File.CopyError if it fails. Returns the list of copied files otherwise.

      - Source + Source

      cp_r(source, destination, callback // fn _, _ -> true end) @@ -600,7 +494,7 @@

      Examples

      end
      - Source + Source

      cp_r!(source, destination, callback // fn _, _ -> true end) @@ -608,7 +502,7 @@

      Examples

      The same as cp_r/3, but raises File.CopyError if it fails. Returns the list of copied files otherwise.

      - Source + Source

      cwd() @@ -618,37 +512,21 @@

      Examples

      directories of the current directory. For this reason, returns { :ok, cwd } in case of success, { :error, reason } otherwise.

      - Source + Source

      cwd!()

      The same as cwd/0, but raises an exception if it fails.

      - Source + Source

      dir?(path)

      Returns true if the path is a directory.

      - Source -
      -

      - dirname(path) -

      -

      Return the directory component of path.

      - -

      If the given path is a char list, returns a char list. -Otherwise returns a binary.

      - -

      Examples

      - -
      File.dirname("/foo/bar.ex")
      -#=> "foo"
      -
      -
      - Source + Source

      exists?(path) @@ -669,59 +547,7 @@

      Examples

      #=> true
      - Source -
      -

      - expand_path(path) -

      -

      Expands the path by returning its absolute name and expanding -any . and .. characters.

      - -

      If the given path is a char list, returns a char list. -Otherwise returns a binary.

      - -

      Examples

      - -
      File.expand_path("/foo/bar/../bar") == "/foo/bar"
      -
      -
      - Source -
      -

      - expand_path(path, relative_to) -

      -

      Expands the path to the relative location and expanding -any . and .. characters. If the path is already an -absolute path, the relative location is ignored.

      - -

      If the given path is a char list, returns a char list. -Otherwise returns a binary.

      - -

      Examples

      - -
      File.expand_path("foo/bar/../bar", "/baz") == "/baz/foo/bar"
      -File.expand_path("/foo/bar/../bar", "/baz") == "/foo/bar"
      -
      -
      - Source -
      -

      - extname(path) -

      -

      Return the extension of the last component of path.

      - -

      If the given path is a char list, returns a char list. -Otherwise returns a binary.

      - -

      Examples

      - -
      File.extname("foo.erl")
      -#=> ".erl"
      -File.extname("~/foo/bar")
      -#=> ""
      -
      -
      - Source + Source

      iterator(device) @@ -747,7 +573,7 @@

      Examples

      end
      - Source + Source

      iterator(file, mode) @@ -756,7 +582,7 @@

      Examples

      returns its iterator. Fails for the same reasons as File.open.

      - Source + Source

      iterator!(file, mode // []) @@ -764,44 +590,7 @@

      Examples

      Same as iterator/2 but raises if the file cannot be opened.

      - Source -
      -

      - join(paths) -

      -

      Returns a string with one or more paths components joint by the path separator. -This function should be used to convert a list of strings in a path.

      - -

      If the given paths are a char list, returns a char list. -Otherwise returns a binary.

      - -

      Examples

      - -
      File.join(["~", "foo"])
      -#=> "~/foo"
      -File.join(["foo"])
      -#=> "foo"
      -File.join(["/", "foo", "bar"])
      -#=> "/foo/bar"
      -
      -
      - Source -
      -

      - join(left, right) -

      -

      Join two paths.

      - -

      If the given paths are a char list, returns a char list. -Otherwise returns a binary.

      - -

      Examples

      - -
      File.join("foo", "bar")
      -#=> "foo/bar"
      -
      -
      - Source + Source

      mkdir(path) @@ -820,14 +609,14 @@

      Examples

      On some platforms, :enoent is returned instead.

    2716. - Source + Source

      mkdir!(path)

      Same as mkdir, but raises an exception in case of failure. Otherwise :ok.

      - Source + Source

      mkdir_p(path) @@ -843,14 +632,14 @@

      Examples

    2717. :enotdir - A component of path is not a directory.
    2718. - Source + Source

      mkdir_p!(path)

      Same as mkdir_p, but raises an exception in case of failure. Otherwise :ok.

      - Source + Source

      open(path, modes // []) @@ -905,7 +694,7 @@

      Examples

      File.close(file)
      - Source + Source

      open(path, modes, function) @@ -930,7 +719,7 @@

      Examples

      end)
      - Source + Source

      open!(path, modes // []) @@ -938,7 +727,7 @@

      Examples

      Same as open/2 but raises an error if file could not be opened. Returns the io_device otherwise.

      - Source + Source

      open!(path, modes, function) @@ -946,7 +735,7 @@

      Examples

      Same as open/3 but raises an error if file could not be opened. Returns the function result otherwise.

      - Source + Source

      read(path) @@ -968,7 +757,7 @@

      Examples

      You can use :file.format_error(reason) to get a descriptive string of the error.

      - Source + Source

      read!(path) @@ -976,7 +765,7 @@

      Examples

      Returns binary with the contents of the given filename or raises File.Error if an error occurs.

      - Source + Source

      regular?(path) @@ -988,7 +777,7 @@

      Examples

      File.regular? __FILE__ #=> true
       
      - Source + Source

      rm(path) @@ -1016,14 +805,14 @@

      Examples

      #=> {:error, :eperm}
      - Source + Source

      rm!(path)

      Same as rm, but raises an exception in case of failure. Otherwise :ok.

      - Source + Source

      rm_rf(path) @@ -1045,7 +834,7 @@

      Examples

      #=> { :ok, [] }
      - Source + Source

      rm_rf!(path) @@ -1053,7 +842,7 @@

      Examples

      Same as rm_rf/1 but raises File.Error in case of failures, otherwise the list of files or directories removed.

      - Source + Source

      rmdir(path) @@ -1070,69 +859,14 @@

      Examples

      #=> {:error, :enotdir}
      - Source + Source

      rmdir!(path)

      Same as rmdir/1, but raises an exception in case of failure. Otherwise :ok.

      - Source -
      -

      - rootname(path) -

      -

      Returns the path with the extension stripped.

      - -

      If the given path is a char list, returns a char list. -Otherwise returns a binary.

      - -

      Examples

      - -
      File.rootname("/foo/bar")
      -#=> "/foo/bar"
      -File.rootname("/foo/bar.ex")
      -#=> "/foo/bar"
      -
      -
      - Source -
      -

      - rootname(path, extension) -

      -

      Returns the path with the extension stripped. This function should be used to -remove a specific extension which might, or might not, be there.

      - -

      If the given path is a char list, returns a char list. -Otherwise returns a binary.

      - -

      Examples

      - -
      File.rootname("/foo/bar.erl", ".erl")
      -#=> "/foo/bar"
      -File.rootname("/foo/bar.erl", ".ex")
      -#=> "/foo/bar.erl"
      -
      -
      - Source -
      -

      - split(path) -

      -

      Returns a list with the path splitted by the path separator. -If an empty string is given, then it returns the root path.

      - -

      Examples

      - -
       File.split("")
      - #=> ["/"]
      - File.split("foo")
      - #=> ["foo"]
      - File.split("/foo/bar")
      - #=> ["/", "foo", "bar"]
      -
      -
      - Source + Source

      stat(path, opts // []) @@ -1151,7 +885,7 @@

      Options

      Default is local.

    2719. - Source + Source

      stat!(path, opts // []) @@ -1159,7 +893,7 @@

      Options

      Same as stat but returns the File.Stat directly and throws File.Error if an error is returned.

      - Source + Source

      touch(path, time // :calendar.local_time()) @@ -1167,7 +901,7 @@

      Options

      Updates modification time (mtime) and access time (atime) of the given file. File is created if it doesn’t exist.

      - Source + Source

      touch!(path, time // :calendar.local_time()) @@ -1175,47 +909,7 @@

      Options

      Same as touch/1 but raises an exception if it fails. Returns :ok otherwise.

      - Source -
      -

      - wildcard(glob) -

      -

      Traverses files and directories according to the given glob expression.

      - -

      The wildcard string looks like an ordinary filename, except that certain -"wildcard characters" are interpreted in a special way. The following -characters are special:

      - -
        -
      • ? - Matches one character.
      • -
      • * - Matches any number of characters up to the end of - the filename, the next dot, or the next slash.
      • -
      • ** - Two adjacent *'s used as a single pattern will - match all files and zero or more directories and subdirectories.
      • -
      • [char1,char2,...] - Matches any of the characters listed. Two characters - separated by a hyphen will match a range of characters.
      • -
      • {item1,item2,...} - Matches one of the alternatives.
      • -
      - -

      Other characters represent themselves. Only filenames that have exactly -the same character in the same position will match. Note that matching -is case-sensitive; i.e. "a" will not match "A".

      - -

      Examples

      - -

      Imagine you have a directory called projects with three Elixir projects -inside of it: elixir, exdoc and dynamo. You can find all .beam files -inside their ebin directories all projects as follows:

      - -
      File.wildcard("projects/*/ebin/**/*.beam")
      -
      - -

      If you want to search for both .beam and .app files, you could do:

      - -
      File.wildcard("projects/*/ebin/**/*.{beam,app}")
      -
      -
      - Source + Source

      write(path, content, modes // []) @@ -1235,14 +929,14 @@

      Examples

    2720. :eisdir - The named file is a directory.
    2721. - Source + Source

      write!(path, content, modes // [])

      Same as write/3 but raises an exception if it fails, returns :ok otherwise.

      - Source + Source

      write_stat(path, stat, opts // []) @@ -1250,7 +944,7 @@

      Examples

      Writes the given File.Stat back to the filesystem at the given path. Returns :ok or { :error, reason }.

      - Source + Source

      write_stat!(path, stat, opts // []) @@ -1258,7 +952,7 @@

      Examples

      Same as write_stat/3 but raises an exception if it fails. Returns :ok otherwise.

      - Source + Source
      diff --git a/docs/master/FunctionClauseError.html b/docs/master/FunctionClauseError.html index 459784770..7125199dd 100644 --- a/docs/master/FunctionClauseError.html +++ b/docs/master/FunctionClauseError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -82,7 +82,7 @@

      Functions

      message(exception)

      - Source + Source diff --git a/docs/master/HashDict.html b/docs/master/HashDict.html index 9a4ba49da..d3adf03d4 100644 --- a/docs/master/HashDict.html +++ b/docs/master/HashDict.html @@ -27,12 +27,12 @@

      -

      This module implements a dictionary type based on -hashing of the keys. It is a simple wrapper around -Erlang's dict module -and exposed via the Dict module.

      +

      A key-value store.

      -

      Check the Dict module for examples and documentation.

      +

      The HashDict is meant to work well with both small and +large set of keys and it is an implementation of the Dict +behaviour. For more information about the functions and +their APIs, please consult the Dict module.

      @@ -47,6 +47,41 @@

      Functions summary

      @@ -73,39 +143,143 @@

      Functions summary

      Functions

      +

      + delete(dict, key) +

      +

      Deletes a value from the dict.

      +
      + Source +
      +

      + empty(_) +

      +

      Returns an empty dict.

      +
      + Source +
      +

      + get(dict, key, default // nil) +

      +

      Gets the value under key from the dict.

      +
      + Source +
      +

      + get!(dict, key) +

      +

      Gets the value under key from the dict, +raises KeyError if such key does not exist.

      +
      + Source +
      +

      + has_key?(dict, key) +

      +

      Checks if the dict has the given key.

      +
      + Source +
      +

      + keys(dict) +

      +

      Get all keys in the dict.

      +
      + Source +
      +

      + merge(dict, enum, callback // fn _k, _v1, v2 -> v2 end) +

      +

      Merges two dictionaries.

      +
      + Source +

      new()

      Creates a new empty dict.

      - Source + Source

      new(pairs)

      -

      Creates a new dict from a list of pairs.

      +

      Creates a new dict from the given enumerable.

      Examples

      HashDict.new [{:b,1},{:a,2}]
      -#=> [a: 1, b: 2]
      +#=> HashDict[a: 1, b: 2]
       
      - Source + Source

      new(list, transform)

      -

      Creates a new dict from a list of elements with the +

      Creates a new dict from the enumerable with the help of the transformation function.

      Examples

      HashDict.new ["a", "b"], fn x -> {x, x} end
      -#=> ["a": "a", "b": "b"]
      +#=> HashDict[{ "a", "a" }, { "b", "b" }]
       
      - Source + Source +
      +

      + put(dict, key, value) +

      +

      Puts the given key and value in the dict.

      +
      + Source +
      +

      + put_new(dict, key, value) +

      +

      Puts the given value under key in the dictionary +only if one does not exist yet.

      +
      + Source +
      +

      + size(dict) +

      +

      Returns the dict size.

      +
      + Source +
      +

      + to_list(dict) +

      +

      Converts the dict to a list.

      +
      + Source +
      +

      + update(dict, key, fun) +

      +

      Updates the key in the dictionary according +to the given function. Raises if the key does +not exist in the dictionary.

      +
      + Source +
      +

      + update(dict, key, initial, fun) +

      +

      Updates the key in the dictionary according +to the given function. Adds initial value if +the key does not exist in the dicionary.

      +
      + Source +
      +

      + values(dict) +

      +

      Get all values in the dict.

      +
      + Source
      diff --git a/docs/master/Kernel.SpecialForms.html b/docs/master/Kernel.SpecialForms.html index 1563319b3..d244c3c6c 100644 --- a/docs/master/Kernel.SpecialForms.html +++ b/docs/master/Kernel.SpecialForms.html @@ -758,7 +758,7 @@

      Hygiene in aliases

      Consider the following example:

      defmodule Hygiene do
      -  alias OrdDict, as: D
      +  alias HashDict, as: D
       
         defmacro no_interference do
           quote do: D.new
      @@ -766,7 +766,7 @@ 

      Hygiene in aliases

      end require Hygiene -Hygiene.no_interference #=> { OrdDict, [] } +Hygiene.no_interference #=> HashDict[]

      Notice that, even though the alias D is not available diff --git a/docs/master/Kernel.html b/docs/master/Kernel.html index 5be538c2f..7a5419c16 100644 --- a/docs/master/Kernel.html +++ b/docs/master/Kernel.html @@ -1094,7 +1094,7 @@

      Examples

      it is not loaded. Check Code.ensure_loaded/1 for more information.

      - Source + Source

      hd(list) @@ -1440,7 +1440,7 @@

      Examples

      it is not loaded. Check Code.ensure_loaded/1 for more information.

      - Source + Source

      make_ref() @@ -1546,7 +1546,7 @@

      Examples

      end
      - Source + Source

      raise(exception, args) @@ -1566,7 +1566,7 @@

      Examples

      raise ArgumentError, message: "Sample"
       
      - Source + Source

      raise(exception, args, stacktrace) @@ -1593,7 +1593,7 @@

      Examples

      rescued) in between the rescue clause and the raise call may change the System.stacktrace value.

      - Source + Source

      round(number) @@ -1844,7 +1844,7 @@

      Examples

      this operator accepts any expression as arguments, not only booleans, however it is not allowed in guards.

      - Source + Source

      left * right @@ -1929,7 +1929,7 @@

      Examples

      3 in 1..3 #=> true
      - Source + Source

      left / right @@ -1950,7 +1950,7 @@

      Examples

      />(left, right)

      - Source + Source

      left < right @@ -2012,7 +2012,7 @@

      Examples

      x #=> "bar"
      - Source + Source

      left == right @@ -2065,7 +2065,7 @@

      Examples

      "abcd" =~ %r/e/ #=> nil
      - Source + Source

      left > right @@ -2141,7 +2141,7 @@

      Examples

      time and not at runtime. Check the module Module for other functions to manipulate module attributes.

      - Source + Source

      __B__(string, list2) @@ -2155,7 +2155,7 @@

      Examples

      %B(f#{o}o) #=> "f\#{o}o"
      - Source + Source

      __C__(arg1, list2) @@ -2169,7 +2169,7 @@

      Examples

      %C(f#{o}o) #=> 'f\#{o}o'
      - Source + Source

      __R__(arg1, options) @@ -2182,7 +2182,7 @@

      Examples

      Regex.match? %R(f#{1,3}o), "f#o"  #=> true
       
      - Source + Source

      __b__(arg1, list2) @@ -2196,7 +2196,7 @@

      Examples

      %b(f#{:o}o) #=> "foo"
      - Source + Source

      __c__(arg1, list2) @@ -2210,7 +2210,7 @@

      Examples

      %c(f#{:o}o) #=> 'foo'
      - Source + Source

      __r__(arg1, options) @@ -2222,7 +2222,7 @@

      Examples

      Regex.match? %r(foo), "foo"  #=> true
       
      - Source + Source

      access(element, args) @@ -2296,7 +2296,7 @@

      Examples

      access a, 1 #=> :a
      - Source + Source

      left and right @@ -2323,7 +2323,7 @@

      Examples

      atom_to_binary :my_atom #=> "my_atom"
       
      - Source + Source

      binary_to_atom(some_binary) @@ -2336,7 +2336,7 @@

      Examples

      binary_to_atom "my_atom" #=> :my_atom
       
      - Source + Source

      binary_to_existing_atom(some_binary) @@ -2349,7 +2349,7 @@

      Examples

      binary_to_existing_atom "my_atom" #=> :my_atom
      - Source + Source

      binary_to_float(some_binary) @@ -2361,7 +2361,7 @@

      Examples

      binary_to_float "2.2017764e+0" #=> 2.2017764
       
      - Source + Source

      binary_to_integer(some_binary) @@ -2373,7 +2373,7 @@

      Examples

      binary_to_integer "123" #=> 123
       
      - Source + Source

      binary_to_integer(some_binary, base) @@ -2386,7 +2386,7 @@

      Examples

      binary_to_integer("3FF", 16) #=> 1023
       
      - Source + Source

      case(condition, blocks) @@ -2439,7 +2439,7 @@

      Examples

      end
      - Source + Source

      cond(list1) @@ -2459,7 +2459,7 @@

      Examples

      end
      - Source + Source

      def(name, list2) @@ -2619,7 +2619,7 @@

      Examples

      #=> [3,2,1]
      - Source + Source

      defexception(name, fields, opts // [], do_block // []) @@ -3059,7 +3059,7 @@

      Examples

      the first value from the right side. Otherwise, it will raise a CaseClauseError.

      - Source + Source

      div(left, right) @@ -3073,7 +3073,7 @@

      Examples

      div 5, 2 #=> 2
       
      - Source + Source

      elem(tuple, index) @@ -3089,7 +3089,7 @@

      Example

      elem(tuple, 1) #=> :bar
      - Source + Source

      float_to_binary(some_float) @@ -3102,7 +3102,7 @@

      Examples

      float_to_binary 7.0 #=> "7.00000000000000000000e+00"
       
      - Source + Source

      function(args) @@ -3184,7 +3184,7 @@

      Function retrieval

      f.([1,[2],3]) #=> [1,2,3]
      - Source + Source

      if(condition, clauses) @@ -3228,7 +3228,7 @@

      Blocks examples

      If you want to compare more than two clauses, you can use the cond/1 macro.

      - Source + Source

      left in right @@ -3270,12 +3270,12 @@

      Clauses

      In this case, Elixir will automatically expand it and define the variable for us.

      - Source + Source

      inspect(arg, opts // [])

      -

      Inspect the given arguments according to the Binary.Inspect protocol.

      +

      Inspect the given arguments according to the Binary.Inspect protocol.

      Options

      @@ -3293,8 +3293,16 @@

      Examples

      inspect(:foo)
       #=> ":foo"
       
      + +

      Notice the inspect protocol does not necessarily return a valid Elixir +terms representation. In such cases, the inspected result must start +with #. For example, inspecting a function will return:

      + +
      inspect &1 + &2
      +#=> #Function<...>
      +
      - Source + Source

      integer_to_binary(some_integer) @@ -3307,7 +3315,7 @@

      Examples

      integer_to_binary 123 #=> "123"
       
      - Source + Source

      integer_to_binary(some_integer, base) @@ -3320,7 +3328,7 @@

      Examples

      integer_to_binary 77 #=> "77"
       
      - Source + Source

      is_exception(thing) @@ -3398,7 +3406,7 @@

      Examples

      Enum.filter list, match?({:a, x } when x < 2, &1)
      - Source + Source

      nil?(x) @@ -3412,7 +3420,7 @@

      Examples

      nil? nil #=> true
      - Source + Source

      not arg @@ -3488,7 +3496,7 @@

      Examples

      will occur immediately.

    2722. - Source + Source

      rem(left, right) @@ -3502,7 +3510,7 @@

      Examples

      rem 5, 2 #=> 1
       
      - Source + Source

      setelem(tuple, index, value) @@ -3518,7 +3526,7 @@

      Example

      setelem(tuple, 0, :baz) #=> { :baz, :bar, 3 }
      - Source + Source

      to_binary(arg) @@ -3532,7 +3540,7 @@

      Examples

      #=> "foo"
      - Source + Source

      to_char_list(arg) @@ -3545,7 +3553,7 @@

      Examples

      #=> 'foo'
      - Source + Source

      try(args) @@ -3662,7 +3670,7 @@

      Variable visibility

      end
      - Source + Source

      unless(clause, options) @@ -3671,7 +3679,7 @@

      Variable visibility

      unless a value evalutes to true. Check if for examples and documentation.

      - Source + Source

      use(module, args // []) @@ -3761,7 +3769,7 @@

      Examples

      String.graphemes("Hello") |> Enum.reverse
       
      - Source + Source

      left || right @@ -3782,7 +3790,7 @@

      Examples

      this operator accepts any expression as arguments, not only booleans, however it is not allowed in guards.

      - Source + Source diff --git a/docs/master/KeyError.html b/docs/master/KeyError.html index d22ae086d..b2b9893b3 100644 --- a/docs/master/KeyError.html +++ b/docs/master/KeyError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -70,7 +70,7 @@

      Functions

      message(exception)

      - Source + Source diff --git a/docs/master/List.Dict.html b/docs/master/List.Dict.html new file mode 100644 index 000000000..6942a809a --- /dev/null +++ b/docs/master/List.Dict.html @@ -0,0 +1,276 @@ + + + + List.Dict + + + + + + + + + + + + +
      +

      + List.Dict + +

      + + +
      +

      A Dict implementation that works on lists of two-items tuples.

      + +

      For more information about the functions and their APIs, please +consult the Dict module.

      + +
      + + + Source + + + + + + +

      Functions summary

      + + + + + + + + +
      +

      Functions

      +
      +

      + delete(dict, key) +

      +

      Deletes the entry under the given key from the dict.

      +
      + Source +
      +

      + empty(_dict) +

      +

      Returns an empty List.Dict.

      +
      + Source +
      +

      + get(dict, key, default // nil) +

      +

      Returns the value under key from the given +dict or default if no key is set.

      +
      + Source +
      +

      + get!(dict, key) +

      +

      Returns the value under the given key +raises KeyError if the key does not exist.

      +
      + Source +
      +

      + has_key?(dict, key) +

      +

      Returns true if the dict has the given key.

      +
      + Source +
      +

      + keys(dict) +

      +

      Returns all keys in the dict.

      +
      + Source +
      +

      + merge(dict, enum, callback // fn _k, _v1, v2 -> v2 end) +

      +

      Merges the given Enumerable into the dict.

      +
      + Source +
      +

      + new() +

      +

      Returns a new List.Dict, i.e. an empty list.

      +
      + Source +
      +

      + new(pairs) +

      +

      Creates a new List.Dict from the given pairs.

      +
      + Source +
      +

      + new(list, transform) +

      +

      Creates a new List.Dict from the given pairs +via the given transformation function.

      +
      + Source +
      +

      + put(dict, key, val) +

      +

      Puts the given key-value pair in the dict.

      +
      + Source +
      +

      + put_new(dict, key, val) +

      +

      Puts the given key-value pair in the dict +if no entry exists yet.

      +
      + Source +
      +

      + size(dict) +

      +

      Returns the dict size.

      +
      + Source +
      +

      + to_list(dict) +

      +

      Converts the dict to a list.

      +
      + Source +
      +

      + update(list1, key, fun) +

      +

      Updates the key in the dict according to the given function.

      +
      + Source +
      +

      + update(list1, key, initial, fun) +

      +

      Updates the key in the dict according to the given function +or uses the given initial value if no entry exists.

      +
      + Source +
      +

      + values(dict) +

      +

      Returns all values in the dict.

      +
      + Source +
      +
      + + + + + +
      + + diff --git a/docs/master/MatchError.html b/docs/master/MatchError.html index b99bdddde..4639fa521 100644 --- a/docs/master/MatchError.html +++ b/docs/master/MatchError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -70,7 +70,7 @@

      Functions

      message(exception)

      - Source + Source diff --git a/docs/master/Mix.Project.html b/docs/master/Mix.Project.html index cef543bbd..0681a64da 100644 --- a/docs/master/Mix.Project.html +++ b/docs/master/Mix.Project.html @@ -77,22 +77,22 @@

      Functions summary

    2723. - get/0 + config_files/0
    2724. - get!/0 + get/0
    2725. - refresh/0 + get!/0
    2726. - sources/0 + refresh/0
    2727. @@ -114,6 +114,13 @@

      Functions

      considering the current environment.

      Source +
      +

      + config_files() +

      +

      Returns a list of project config files (mix.exs and mix.lock).

      +
      + Source

      get() @@ -144,13 +151,6 @@

      Functions

      when the environment changes during a task.

      Source -
      -

      - sources() -

      -

      Returns a list of project source files (mix.exs and mix.lock)

      -
      - Source
      diff --git a/docs/master/Mix.Task.html b/docs/master/Mix.Task.html index ca28da80e..f26ca6d3e 100644 --- a/docs/master/Mix.Task.html +++ b/docs/master/Mix.Task.html @@ -129,7 +129,7 @@

      Functions

      Clears all invoked tasks, allowing them to be reinvoked. Returns an ordset with all the tasks invoked thus far.

      - Source + Source

      get(task) @@ -172,7 +172,7 @@

      Exceptions

      Reenables a given task so it can be executed again down the stack.

      - Source + Source

      run(task, args // []) diff --git a/docs/master/Mix.Tasks.Deps.Get.html b/docs/master/Mix.Tasks.Deps.Get.html index 477547303..917dd743b 100644 --- a/docs/master/Mix.Tasks.Deps.Get.html +++ b/docs/master/Mix.Tasks.Deps.Get.html @@ -30,6 +30,12 @@

      Get all out of date dependencies, i.e. dependencies that are not available or have an invalid lock.

      +

      Command line options

      + +
        +
      • --no-compile skip compilation of dependencies
      • +
      +
      @@ -63,7 +69,7 @@

      Functions

      run(args)

      - Source + Source diff --git a/docs/master/Mix.Tasks.Deps.Update.html b/docs/master/Mix.Tasks.Deps.Update.html index 349e3be93..ee29f6e99 100644 --- a/docs/master/Mix.Tasks.Deps.Update.html +++ b/docs/master/Mix.Tasks.Deps.Update.html @@ -33,6 +33,12 @@

      be given to update specific ones. Recompiles the given projects after updating.

      +

      Command line options

      + +
        +
      • --no-compile skip compilation of dependencies
      • +
      + @@ -66,7 +72,7 @@

      Functions

      run(args)

      - Source + Source diff --git a/docs/master/Mix.Tasks.Escriptize.html b/docs/master/Mix.Tasks.Escriptize.html index 99cd9a52c..53ba699f2 100644 --- a/docs/master/Mix.Tasks.Escriptize.html +++ b/docs/master/Mix.Tasks.Escriptize.html @@ -29,6 +29,15 @@

      Generates an escript for the project.

      +

      Command line options

      + +
        +
      • --force forces compilation regardless of mod times

      • +
      • --no-compile skips compilation to .beam

      • +
      + +

      Configuration

      +

      The following options can be specified in your mix.exs file:

      diff --git a/docs/master/Mix.Utils.html b/docs/master/Mix.Utils.html index 46674d198..73497ed0c 100644 --- a/docs/master/Mix.Utils.html +++ b/docs/master/Mix.Utils.html @@ -82,6 +82,11 @@

      Functions summary

      extract_stale/2
    2728. +
    2729. + + mix_home/0 + +
    2730. module_name_to_command/2 @@ -112,11 +117,6 @@

      Functions summary

      underscore/1
    2731. -
    2732. - - user_home/0 - -
    2733. @@ -198,6 +198,14 @@

      Examples

      Extract all stale sources compared to the given targets.

      Source +
      +

      + mix_home() +

      +

      Gets the mix home. It defaults to ~/.mix unless the +MIX_HOME environment variable is set.

      +
      + Source

      module_name_to_command(module, nesting // 0) @@ -270,13 +278,6 @@

      Examples

      Source -
      -

      - user_home() -

      -

      Gets the user home attempting to consider OS system diferences.

      -
      - Source
      diff --git a/docs/master/OrdDict.html b/docs/master/OrdDict.html index e0f10ee22..90f4daeb2 100644 --- a/docs/master/OrdDict.html +++ b/docs/master/OrdDict.html @@ -37,7 +37,7 @@

      - Source + Source @@ -78,7 +78,7 @@

      Functions

      Creates a new empty dict.

      - Source + Source

      new(pairs) @@ -91,7 +91,7 @@

      Examples

      #=> [a: 1, b: 2]
      - Source + Source

      new(list, transform) @@ -105,7 +105,7 @@

      Examples

      #=> ["a": "a", "b": "b"]
      - Source + Source diff --git a/docs/master/Tuple.html b/docs/master/Path.NoHomeError.html similarity index 60% rename from docs/master/Tuple.html rename to docs/master/Path.NoHomeError.html index 9b0c84738..225a3faff 100644 --- a/docs/master/Tuple.html +++ b/docs/master/Path.NoHomeError.html @@ -1,7 +1,7 @@ - Tuple + Path.NoHomeError @@ -21,17 +21,30 @@

      - Tuple + Path.NoHomeError + + exception

      - Source + Source +

      Fields (and defaults)

      +
        + +
      • + + message: "could not find the user home, please set the HOME environment variable" + +
      • + +
      + diff --git a/docs/master/Path.html b/docs/master/Path.html new file mode 100644 index 000000000..274b4249e --- /dev/null +++ b/docs/master/Path.html @@ -0,0 +1,430 @@ + + + + Path + + + + + + + + + + + + +
      +

      + Path + +

      + + +
      +

      This module provides conveniences for manipulating or +retrieving filesystem paths.

      + +

      The functions on this module may receive a char list or +a binary as argument and will return the given type.

      + +

      The majority of the functions in this module do not +interact with the file system, unless some few functions +that needs to query the filesystem to retrieve paths +(like Path.wildcard and Path.expand).

      + +
      + + + Source + + + + + + +

      Functions summary

      + + + + + + + + +
      +

      Functions

      +
      +

      + absname(path) +

      +

      Converts the given filename and returns an absolute name. +Differently from Path.expand/1, no attempt is made to +resolve .., . or ~.

      + +

      Unix examples

      + +
      Path.absname("foo")
      +#=> "/usr/local/foo"
      +
      +Path.absname("../x")
      +#=> "/usr/local/../x"
      +
      + +

      Windows

      + +
      Path.absname("foo").
      +"D:/usr/local/foo"
      +Path.absname("../x").
      +"D:/usr/local/../x"
      +
      +
      + Source +
      +

      + absname(path, relative_to) +

      +

      Converts the given filename and returns an absolute name +relative to the given location. If the path is already +an absolute path, the relative path is ignored.

      + +

      Differently from Path.expand/2, no attempt is made to +resolve .., . or ~.

      + +

      Examples

      + +
      Path.absname("foo", "bar")
      +#=> "bar/foo"
      +
      +Path.absname("../x", "bar")
      +#=> "bar/../x"
      +
      +
      + Source +
      +

      + basename(path) +

      +

      Returns the last component of the path or the path +itself if it does not contain any directory separators.

      + +

      Examples

      + +
      Path.basename("foo")
      +#=> "foo"
      +
      +Path.basename("foo/bar")
      +#=> "bar"
      +
      +Path.basename("/")
      +#=> ""
      +
      +
      + Source +
      +

      + basename(path, extension) +

      +

      Returns the last component of path with the extension +stripped. This function should be used to remove a specific +extension which may, or may not, be there.

      + +

      Examples

      + +
      Path.basename("~/foo/bar.ex", ".ex")
      +#=> "bar"
      +Path.basename("~/foo/bar.exs", ".ex")
      +#=> "bar.exs"
      +Path.basename("~/foo/bar.old.ex", ".ex")
      +#=> "bar.old"
      +
      +
      + Source +
      +

      + dirname(path) +

      +

      Return the directory component of path.

      + +

      Examples

      + +
      Path.dirname("/foo/bar.ex")
      +#=> "foo"
      +
      +
      + Source +
      +

      + expand(path) +

      +

      Expands the path by returning its absolute name and expanding +any . and .. characters.

      + +

      Examples

      + +
      Path.expand("/foo/bar/../bar") == "/foo/bar"
      +
      +
      + Source +
      +

      + expand(path, relative_to) +

      +

      Expands the path to the relative location and expanding +any . and .. characters. If the path is already an +absolute path, the relative location is ignored.

      + +

      Examples

      + +
      Path.expand("foo/bar/../bar", "/baz") == "/baz/foo/bar"
      +Path.expand("/foo/bar/../bar", "/baz") == "/foo/bar"
      +
      +
      + Source +
      +

      + extname(path) +

      +

      Return the extension of the last component of path.

      + +

      Examples

      + +
      Path.extname("foo.erl")
      +#=> ".erl"
      +Path.extname("~/foo/bar")
      +#=> ""
      +
      +
      + Source +
      +

      + join(paths) +

      +

      Returns a string with one or more paths components joint by the path separator. +This function should be used to convert a list of strings in a path.

      + +

      Examples

      + +
      Path.join(["~", "foo"])
      +#=> "~/foo"
      +Path.join(["foo"])
      +#=> "foo"
      +Path.join(["/", "foo", "bar"])
      +#=> "/foo/bar"
      +
      +
      + Source +
      +

      + join(left, right) +

      +

      Joins two paths.

      + +

      Examples

      + +
      Path.join("foo", "bar")
      +#=> "foo/bar"
      +
      +
      + Source +
      +

      + relative_to(path, from) +

      +

      Returns the given path relative to the given from path.

      + +

      This function does not query the filesystem, so it assumes +no symlinks in between the paths.

      + +

      In case a direct relative path cannot be found, it returns +the original path.

      + +

      Examples

      + +
      Path.relative_to("/usr/local/foo", "/usr/local") #=> "foo"
      +Path.relative_to("/usr/local/foo", "/") #=> "foo"
      +Path.relative_to("/usr/local/foo", "/etc") #=> "/usr/local/foo"
      +
      +
      + Source +
      +

      + rootname(path) +

      +

      Returns the path with the extension stripped.

      + +

      Examples

      + +
      Path.rootname("/foo/bar")
      +#=> "/foo/bar"
      +Path.rootname("/foo/bar.ex")
      +#=> "/foo/bar"
      +
      +
      + Source +
      +

      + rootname(path, extension) +

      +

      Returns the path with the extension stripped. This function should be used to +remove a specific extension which might, or might not, be there.

      + +

      Examples

      + +
      Path.rootname("/foo/bar.erl", ".erl")
      +#=> "/foo/bar"
      +Path.rootname("/foo/bar.erl", ".ex")
      +#=> "/foo/bar.erl"
      +
      +
      + Source +
      +

      + split(path) +

      +

      Returns a list with the path splitted by the path separator. +If an empty string is given, then it returns the root path.

      + +

      Examples

      + +
       Path.split("")
      + #=> ["/"]
      + Path.split("foo")
      + #=> ["foo"]
      + Path.split("/foo/bar")
      + #=> ["/", "foo", "bar"]
      +
      +
      + Source +
      +

      + wildcard(glob) +

      +

      Traverses paths according to the given glob expression.

      + +

      The wildcard looks like an ordinary path, except that certain +"wildcard characters" are interpreted in a special way. The +following characters are special:

      + +
        +
      • ? - Matches one character.
      • +
      • * - Matches any number of characters up to the end of + the filename, the next dot, or the next slash.
      • +
      • ** - Two adjacent *'s used as a single pattern will + match all files and zero or more directories and subdirectories.
      • +
      • [char1,char2,...] - Matches any of the characters listed. Two characters + separated by a hyphen will match a range of characters.
      • +
      • {item1,item2,...} - Matches one of the alternatives.
      • +
      + +

      Other characters represent themselves. Only paths that have +exactly the same character in the same position will match. Note +that matching is case-sensitive; i.e. "a" will not match "A".

      + +

      Examples

      + +

      Imagine you have a directory called projects with three Elixir projects +inside of it: elixir, exdoc and dynamo. You can find all .beam files +inside their ebin directories all projects as follows:

      + +
      Path.wildcard("projects/*/ebin/**/*.beam")
      +
      + +

      If you want to search for both .beam and .app files, you could do:

      + +
      Path.wildcard("projects/*/ebin/**/*.{beam,app}")
      +
      +
      + Source +
      +
      + + + + + +
      + + diff --git a/docs/master/Protocol.UndefinedError.html b/docs/master/Protocol.UndefinedError.html index 8f1ba8c25..a0ff398dc 100644 --- a/docs/master/Protocol.UndefinedError.html +++ b/docs/master/Protocol.UndefinedError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -76,7 +76,7 @@

      Functions

      message(exception)

      - Source + Source
      diff --git a/docs/master/RuntimeError.html b/docs/master/RuntimeError.html index 2c1b5ce09..17b6a9586 100644 --- a/docs/master/RuntimeError.html +++ b/docs/master/RuntimeError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/master/String.html b/docs/master/String.html index 8e6995da1..c3b63fb67 100644 --- a/docs/master/String.html +++ b/docs/master/String.html @@ -27,19 +27,87 @@

      -

      A string in Elixir is a utf-8 binary. This module -contains function to work with utf-8 data, its -codepoints and graphemes.

      +

      A string in Elixir is a UTF-8 encoded binary.

      + +

      The functions in this module act according to the +Unicode Standard, version 6.2.0. A codepoint is a +Unicode Character, which may be represented by one +or more bytes. For example, the character "é" is +represented with two bytes:

      + +
      string = "é"
      +#=> "é"
      +size(string)
      +#=> 2
      +
      + +

      Furthermore, this module also presents the concept of +graphemes, which are multiple characters that may be +"perceived as a single character" by readers. For example, +the same "é" character written above could be represented +by the letter "e" followed by the accent ́:

      + +
      string = "\x{0065}\x{0301}"
      +#=> "é"
      +size(string)
      +#=> 3
      +
      -

      Notice that graphemes is a superset of UTF-8 codepoints -which also contains named sequences as defined per -http://www.unicode.org/reports/tr34/. In short, graphemes -also contain multiple characters that are "perceived as -a single character" by readers.

      +

      Although the example above is made of two characters, it is +perceived by users as one.

      -

      For working with raw binaries, use Erlang's :binary +

      Graphemes can also be two characters that are interpreted +as one by some languages. For example, some languages may +consider "ch" as a grapheme. However, since this information +depends on the locale, it is not taken into account by this module.

      +

      In general, the functions in this module rely on the Unicode +Standard, but does not contain any of the locale specific +behaviour.

      + +

      Integer codepoints

      + +

      Although codepoints could be represented as integers, this +module represents all codepoints as binaries. For example:

      + +
      String.codepoints "josé" #=> ["j", "o", "s", "é"]
      +
      + +

      There are a couple of ways to retrieve a character integer +codepoint. One may use the ? special macro:

      + +
      ?j #=> 106
      +?é #=> 233
      +
      + +

      Or also via pattern matching:

      + +
      << eacute :: utf8 >> = "é"
      +eacute #=> 233
      +
      + +

      As we have seen above, codepoints can be inserted into +a string by their hexadecimal code:

      + +
      string = "jos\x{0065}\x{0301}"
      +#=> "josé"
      +
      + +

      Self-synchronization

      + +

      The UTF-8 encoding is self-synchronizing. This means that +if malformed data (i.e., data that is not possible according +to the definition of the encoding) is encountered, only one +codepoint needs to be rejected.

      + +

      This module relies on this behaviour to ignore such invalid +characters. For example, String.length is going to return +a correct result even if an invalid codepoint is fed into it.

      + +

      In the future, bang version of such functions may be +provided which will rather raise on such invalid data.

      +
      @@ -194,7 +262,7 @@

      Examples

      String.at("elixir", -10) #=> nil - Source + Source

      capitalize(string) @@ -209,7 +277,7 @@

      Examples

      String.capitalize("josé") #=> "José"
      - Source + Source

      codepoints(string) @@ -223,17 +291,13 @@

      Examples

      String.codepoints("ἅἪῼ") #=> ["ἅ","Ἢ","ῼ"]
      - Source + Source

      downcase(binary)

      Convert all characters on the given string to downcase.

      -

      This function relies on the simple lowercase mapping -available in Unicode 6.2.0, check http://unicode.org/reports/tr44/ -for more information.

      -

      Examples

      String.downcase("ABCD") #=> "abcd"
      @@ -241,7 +305,7 @@ 

      Examples

      String.downcase("JOSÉ") #=> "josé"
      - Source + Source

      duplicate(subject, n) @@ -254,7 +318,7 @@

      Examples

      String.duplicate("abc", 2) #=> "abcabc"
      - Source + Source

      first(string) @@ -267,19 +331,19 @@

      Examples

      String.first("եոգլի") #=> "ե"
      - Source + Source

      graphemes(string)

      -

      Returns unicode graphemes in the string

      +

      Returns unicode graphemes in the string.

      Examples

      String.graphemes("Ā̀stute") # => ["Ā̀","s","t","u","t","e"]
       
      - Source + Source

      last(string) @@ -292,7 +356,7 @@

      Examples

      String.last("եոգլի") #=> "ի"
      - Source + Source

      length(string) @@ -305,7 +369,7 @@

      Examples

      String.length("եոգլի") #=> 5
      - Source + Source

      lstrip(binary) @@ -318,7 +382,7 @@

      Examples

      String.lstrip("   abc  ")       #=> "abc  "
       
      - Source + Source

      lstrip(other, char) @@ -330,7 +394,7 @@

      Examples

      String.lstrip("_  abc  _", ?_)  #=> "  abc  _"
       
      - Source + Source

      next_codepoint(string) @@ -339,14 +403,19 @@

      Examples

      The result is a tuple with the codepoint and the remaining of the string or :no_codepoint in case -the String reached its end.

      +the string reached its end.

      + +

      As the other functions in the String module, this +function does not check for the validity of the codepoint. +That said, if an invalid codepoint is found, it will +be returned by this function.

      Examples

      String.next_codepoint("josé") #=> { "j", "osé" }
       
      - Source + Source

      next_grapheme(string) @@ -362,7 +431,7 @@

      Examples

      String.next_grapheme("josé") #=> { "j", "osé" }
       
      - Source + Source

      printable?(arg1) @@ -375,14 +444,14 @@

      Examples

      String.printable?("abc") #=> true
       
      - Source + Source

      replace(subject, pattern, replacement, options // [])

      Returns a new binary based on subject by replacing the parts matching pattern for replacement. By default, it replaces -all entries, except if global: false is given as option.

      +all entries, except if the global option is set to false.

      If the replaced part must be used in replacement, then the position or the positions where it is to be inserted must be @@ -397,7 +466,7 @@

      Examples

      String.replace("a,b,c", ",", "[]", insert_replaced: [1,1]) #=> "a[,,]b[,,]c"
      - Source + Source

      rstrip(binary) @@ -410,7 +479,7 @@

      Examples

      String.rstrip("   abc  ")      #=> "   abc"
       
      - Source + Source

      rstrip(string, char) @@ -422,7 +491,7 @@

      Examples

      String.rstrip("   abc _", ?_)  #=> "   abc "
       
      - Source + Source

      slice(string, start, len) @@ -440,7 +509,7 @@

      Examples

      String.slice("elixir", -10, 3) #=> nil
      - Source + Source

      split(binary, pattern // " ", options // []) @@ -449,9 +518,10 @@

      Examples

      returning a list of these sub string. The pattern can be a string, a list of strings or a regular expression.

      -

      The string is split into two parts by default, unless -global option is true. If a pattern is not specified, -the string is split on whitespace occurrences.

      +

      The string is split into as many parts as possible by +default, unless the global option is set to false. +If a pattern is not specified, the string is split on +whitespace occurrences.

      It returns a list with the original string if the pattern can't be matched.

      @@ -469,7 +539,7 @@

      Examples

      String.split("a,b", %r{.}) #=> ["a,b"]
      - Source + Source

      strip(string) @@ -482,7 +552,7 @@

      Examples

      String.strip("   abc  ")       #=> "abc"
       
      - Source + Source

      strip(string, char) @@ -495,17 +565,13 @@

      Examples

      String.strip("a  abc  a", ?a)  #=> "  abc  "
       
      - Source + Source

      upcase(binary)

      Convert all characters on the given string to upcase.

      -

      This function relies on the simple uppercase mapping -available in Unicode 6.2.0, check http://unicode.org/reports/tr44/ -for more information.

      -

      Examples

      String.upcase("abcd") #=> "ABCD"
      @@ -513,7 +579,7 @@ 

      Examples

      String.upcase("josé") #=> "JOSÉ"
      - Source + Source

      valid_codepoint?(arg1) @@ -527,11 +593,11 @@

      Examples

      String.valid_codepoint?("a") #=> true
       String.valid_codepoint?("ø") #=> true
      -String.valid_codepoint?("ÿff") #=> false
      +String.valid_codepoint?("\xffff") #=> false
       String.valid_codepoint?("asdf") #=> false
       
      - Source + Source diff --git a/docs/master/SyntaxError.html b/docs/master/SyntaxError.html index 27ca38388..1ddb24bf4 100644 --- a/docs/master/SyntaxError.html +++ b/docs/master/SyntaxError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -82,7 +82,7 @@

      Functions

      message(exception)

      - Source + Source diff --git a/docs/master/SystemLimitError.html b/docs/master/SystemLimitError.html index 1f760d026..7265a4da8 100644 --- a/docs/master/SystemLimitError.html +++ b/docs/master/SystemLimitError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/master/TokenMissingError.html b/docs/master/TokenMissingError.html index cb4d48285..3c0a39bcd 100644 --- a/docs/master/TokenMissingError.html +++ b/docs/master/TokenMissingError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -82,7 +82,7 @@

      Functions

      message(exception)

      - Source + Source diff --git a/docs/master/URI.html b/docs/master/URI.html index e985b8fd2..53d8f633b 100644 --- a/docs/master/URI.html +++ b/docs/master/URI.html @@ -91,7 +91,7 @@

      Functions

      Source

      - decode_query(q, dict // OrdDict.new()) + decode_query(q, dict // HashDict.new())

      Given a query string of the form "key1=value1&key=value2...", produces an orddict with one entry for each key-value pair. Each key and value will be a diff --git a/docs/master/UndefinedFunctionError.html b/docs/master/UndefinedFunctionError.html index 6c1254a66..04665acbc 100644 --- a/docs/master/UndefinedFunctionError.html +++ b/docs/master/UndefinedFunctionError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -82,7 +82,7 @@

      Functions

      message(exception)

      - Source + Source
      diff --git a/docs/master/modules_list.html b/docs/master/modules_list.html index 829f46ac6..73a95b97b 100644 --- a/docs/master/modules_list.html +++ b/docs/master/modules_list.html @@ -350,6 +350,13 @@

      Dict +
    2734. + + update/4 + + Dict +
    2735. +
    2736. update/3 @@ -392,6 +399,13 @@

      Dict

    2737. +
    2738. + + merge/2 + + Dict +
    2739. +
    2740. keys/1 @@ -406,6 +420,13 @@

      Dict

    2741. +
    2742. + + get!/2 + + Dict +
    2743. +
    2744. get/3 @@ -413,6 +434,13 @@

      Dict

    2745. +
    2746. + + get/2 + + Dict +
    2747. +
    2748. empty/1 @@ -1291,20 +1319,6 @@

      -
    2749. - - - Tuple - - Tuple -
    2750. -
        - -
    2751. diff --git a/docs/master/protocols_list.html b/docs/master/protocols_list.html index f50d731a2..cc5815b12 100644 --- a/docs/master/protocols_list.html +++ b/docs/master/protocols_list.html @@ -310,6 +310,42 @@

      Binary.Inspect.BitString

    2752. + +
    2753. + + + Function + + Binary.Inspect.Function +
    2754. +
        + + +
      • + + inspect/2 + + Binary.Inspect.Function +
      • + +
      +
    2755. + + + HashDict + + Binary.Inspect.HashDict +
    2756. +
        + + +
      • + + inspect/2 + + Binary.Inspect.HashDict +
      • +
    2757. @@ -346,6 +382,78 @@

      Binary.Inspect.Number

    2758. + +
    2759. + + + PID + + Binary.Inspect.PID +
    2760. +
        + + +
      • + + inspect/2 + + Binary.Inspect.PID +
      • + +
      +
    2761. + + + Port + + Binary.Inspect.Port +
    2762. +
        + + +
      • + + inspect/2 + + Binary.Inspect.Port +
      • + +
      +
    2763. + + + Range + + Binary.Inspect.Range +
    2764. +
        + + +
      • + + inspect/2 + + Binary.Inspect.Range +
      • + +
      +
    2765. + + + Reference + + Binary.Inspect.Reference +
    2766. +
        + + +
      • + + inspect/2 + + Binary.Inspect.Reference +
      • +
    2767. diff --git a/docs/master/records_list.html b/docs/master/records_list.html index 662c6e49f..4ee46e1d5 100644 --- a/docs/master/records_list.html +++ b/docs/master/records_list.html @@ -458,6 +458,17 @@

      Mix.OutOfDateDepsError

    2768. + +
    2769. + + + Path.NoHomeError + + Path.NoHomeError +
    2770. +
        + +
    2771. diff --git a/docs/stable/js/full_list.js b/docs/stable/js/full_list.js index e1418474d..8fc7e0bc7 100644 --- a/docs/stable/js/full_list.js +++ b/docs/stable/js/full_list.js @@ -20,10 +20,10 @@ function fullListSearch() { var fullName = link.attr('title').split(' ')[0]; searchCache.push({name:link.text(), fullName:fullName, node:$(this), link:link}); }); - - $('#search input').keyup(function() { - if ((event.keyCode > ignoreKeyCodeMin && event.keyCode < ignoreKeyCodeMax) - || event.keyCode == commandKey) + + $('#search input').keyup(function(evnt) { + if ((evnt.keyCode > ignoreKeyCodeMin && evnt.keyCode < ignoreKeyCodeMax) + || evnt.keyCode == commandKey) return; searchString = this.value; caseSensitiveMatch = searchString.match(/[A-Z]/) != null; @@ -35,7 +35,7 @@ function fullListSearch() { $('#full_list, #content').removeClass('insearch'); $('#full_list li').removeClass('found').each(function() { var link = $(this).find('.object_link a'); - link.text(link.text()); + link.text(link.text()); }); if (clicked) { clicked.parents('ul').each(function() { @@ -53,7 +53,7 @@ function fullListSearch() { searchItem(); } }); - + $('#search input').focus(); $('#full_list').after("
      "); } @@ -127,10 +127,10 @@ function linkList() { function collapse() { if (!$('#full_list').hasClass('class')) return; - $('#full_list.class a.toggle').click(function() { + $('#full_list.class a.toggle').click(function() { $(this).parent().toggleClass('collapsed').next().toggleClass('collapsed'); highlight(); - return false; + return false; }); $('#full_list.class ul').each(function() { $(this).addClass('collapsed').prev().addClass('collapsed'); From 12ce7c992a1c8073c78a649550dfbb946789f26f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sun, 20 Jan 2013 09:59:09 -0700 Subject: [PATCH 319/437] Updates to the getting started guide --- getting_started/1.markdown | 2 +- getting_started/2.markdown | 90 +++++++++++++++++++++++++++++--------- getting_started/3.markdown | 1 + getting_started/5.markdown | 38 +++++----------- getting_started/6.markdown | 2 +- 5 files changed, 84 insertions(+), 49 deletions(-) diff --git a/getting_started/1.markdown b/getting_started/1.markdown index 413cab332..69af696cf 100644 --- a/getting_started/1.markdown +++ b/getting_started/1.markdown @@ -142,7 +142,7 @@ Booleans are represented internally as atoms: iex> is_atom(true) true -Elixir also provides Port, References and PIDs as data types (usually used in process communication) but they are out of the scope of a getting started tutorial. For now, let's take a look at the basic operators in Elixir before we move on to the next chapter. +Elixir also provides `Port`, `Reference`s and `PID`s as data types (usually used in process communication) but they are out of the scope of a getting started tutorial. For now, let's take a look at the basic operators in Elixir before we move on to the next chapter. ## 1.4 Operators diff --git a/getting_started/2.markdown b/getting_started/2.markdown index edca61208..02e03e680 100644 --- a/getting_started/2.markdown +++ b/getting_started/2.markdown @@ -106,24 +106,24 @@ In such cases, Elixir detects that all characters in the list and in the binary iex> [?a, ?b, ?c, 1] [97,98,99,1] -Since lists are implemented as linked lists, it means a char list usually takes a lot of space in memory (in ASCII, it would be one byte for each character and another byte to point to the next character). For this reason, binary (double-quoted) strings are preferred unless you want to explicitly iterate over a char list. +Since lists are implemented as linked lists, it means a char list usually takes a lot of space in memory (in ASCII, it would be one byte for each character and another byte to point to the next character). For this reason, binaries (double-quoted) are preferred unless you want to explicitly iterate over a char list. Although a bit more verbose, it is also possible to do head/tail style pattern matching with binaries. A binary is made up of a number of parts which must be tagged with their type. Most of the time, Elixir will figure out the part's type and won't require any work from you: iex> <<102, "oo">> "foo" -In the example, we have two parts: the first is an integer and the second is a binary. If we use any other Elixir expression, Elixir can no longer guess the type: +In the example, we have two parts: the first is an integer and the second is a binary. If we use an Elixir expression, Elixir will default its type to an integer: iex> rest = "oo" iex> <<102, rest>> ** (ArgumentError) argument error -When a variable or expression is given as a binary part, Elixir defaults the type of that part to an integer. In the example above, since we haven't specified a type, Elixir expected an integer but we passed a binary, resulting in `ArgumentError`. We can solve this by explicitly tagging it as a binary: +In the example above, since we haven't specified a type for `rest`, Elixir expected an integer but we passed a binary, resulting in `ArgumentError`. We can solve this by explicitly tagging it as a binary: iex> <<102, rest :: binary>> -The type can be `integer`, `float`, `binary`, `bytes`, `bitstring`, `bits`, `utf8`, `utf16` or `utf32` (we can also pass endianness and signedness as specifiers too, but we will leave this discussion for later). When passing more than one option, we use a list: +The type can be `integer`, `float`, `binary`, `bytes`, `bitstring`, `bits`, `utf8`, `utf16` or `utf32`. We can pass endianness and signedness too, when passing more than one option, we use a list: iex> <<102, rest :: [binary, signed]>> @@ -145,9 +145,58 @@ If at any moment, you would like to match the top of a binary against any other This is equivalent to the head and tail pattern matching we saw in lists. There is much more to binaries and pattern matching in Elixir that allows great flexibility when working with such structures, but they are beyond the scope of a getting started guide. -In order to work with binaries, one can use [Erlang's binary module](http://www.erlang.org/doc/man/binary.html) or [Elixir's String module](http://elixir-lang.org/docs/stable/String.html) which is meant to work on UTF-8 data. +## 2.4 UTF-8 Strings -## 2.4 Calling Erlang functions +In the previous section we've learnt about binaries. A string in Elixir is a binary which is encoded in UTF-8. For example, the string "é" is a UTF-8 binary containing two bytes: + + iex> string = "é" + "é" + iex> size(string) + 2 + +In order to easily manipulate strings, Elixir provides a [String module](http://elixir-lang.org/docs/stable/String.html): + + # returns the number of bytes + iex> size "héllò" + 7 + + # returns the number of characters as perceived by humans + iex> String.length "héllò" + 5 + +> Note: to retrieve the number of elements in a data structure, you will use a function named `length` or `size`. Their usage is not arbitrary. The first is used when the number of elements needs to be calculated. For example, calling `length(list)` will iterate the whole list to find the number of elements in that list. `size` is the opposite, it means the value is pre-calculated and stored somewhere and therefore retrieving its value is a cheap operation. That said, we use `size` to get the size of a binary, which is cheap, but retrieving the number of unicode characters uses `String.length`, since the whole string needs to be iterated. + +Each character in the string "héllò" above is a Unicode codepoint. One may use `String.codepoints` to split a string into smaller strings representing its codepoints: + + iex> String.codepoints "héllò" + ["h", "é", "l", "l", "ó"] + +The Unicode standard assigns an integer value to each character. Elixir allows a developer to retrieve or insert a character based on its integer codepoint value as well: + + # Gettng the integer codepoint + iex> ?h + 104 + iex> ?é + 233 + + # Inserting a codepoint based on its hexadecimal value + iex> "h\xE9ll\xF2" + "héllò" + +UTF-8 also plays nicely with pattern matching. You can match against a UTF-8 codepoint, retriving its integer value as follow: + + iex> << eacute :: utf8, rest :: binary >> = "épa" + "épa" + iex> ecaute + 233 + iex> << ecaute :: utf8 >> + "é" + iex> rest + "pa" + +In general, you will find working with binaries and strings in Elixir a breeze. Whenever you want to work with raw binaries, one can use [Erlang's binary module](http://www.erlang.org/doc/man/binary.html), and use [Elixir's String module](http://elixir-lang.org/docs/stable/String.html) when you want to work on strings, which are simply UTF-8 encoded binaries. + +## 2.5 Calling Erlang functions One of Elixir assets is easy integration with the existing Erlang ecosystem. Erlang ships with a group of libraries called OTP (Open Telecom Platform). Besides being a standard library, OTP provides several facilities to build OTP applications with supervisors that are robust, distributed and fault-tolerant. @@ -161,7 +210,7 @@ Erlang's OTP is very well documented and easily navigable: * [OTP docs](http://www.erlang.org/doc/) * [Standard library docs](http://www.erlang.org/doc/man/STDLIB_app.html) -## 2.5 Pattern matching +## 2.6 Pattern matching When discussing lists earlier we saw the following example: @@ -230,7 +279,7 @@ Although pattern matching allows us to build powerful constructs, its usage is l iex> :lists.flatten([1,[2],3]) = [1,2,3] ** (ErlangError) erlang error :illegal_pattern -## 2.6 Blocks +## 2.7 Blocks One of the first control flow constructs we usually learn is the conditional `if`. In Elixir, we could write `if` as follow: @@ -279,11 +328,11 @@ Which is not what we want since `do` is binding to the farthest function call, i 1 + 2 end) -## 2.7 Control flow structures +## 2.8 Control flow structures In this section we'll describe Elixir's main control flow structures. -### 2.7.1 If +### 2.8.1 If Refreshing from the section above, all these calls behave the same: @@ -297,7 +346,7 @@ Refreshing from the section above, all these calls behave the same: In Elixir, all values except `false` and `nil` evaluate to `true`. Therefore there is no need to explicit convert the `if` argument to a boolean. If you want to check if one of many conditions are true, you can use the `cond` macro. -### 2.7.2 Cond +### 2.8.2 Cond `cond` allows you to check many expressions and executes the first one that evaluates to true: @@ -312,7 +361,7 @@ In Elixir, all values except `false` and `nil` evaluate to `true`. Therefore the If none of the expressions above return true, an error would be raised. -### 2.7.3 Other boolean operators +### 2.8.3 Other operators In the previous chapter, we discussed the boolean operators `and`, `or` and `not`. These operators are strict in that they only accept booleans as their first argument. @@ -340,7 +389,7 @@ Elixir provides three operators with similar functionality but that accept argum As a rule of thumb, use `and`, `or` and `not` when both arguments are expected to be booleans, as in guard clauses. If any of the arguments are non-booleans, use `&&`, `||` and `!`. -### 2.7.4 Case +### 2.8.4 Case In section 2.5, we introduced pattern matching via the `=` operator. Sometimes, however, it is convenient to compare an expression against several expressions until we find a matching one. In this scenario, we use `case`: @@ -372,12 +421,13 @@ Each match clause also supports special conditions specified via guards: "No match" end -In the example above, the second clause will only match when x is positive. The Erlang VM only allows the following expressions as guards: +In the example above, the second clause will only match when x is positive. The Erlang VM only allows a limitted set of expressions as guards: * comparison operators (`==`, `!=`, `===`, `!==`, `>`, `<`, `<=`, `>=`); -* strict boolean operators (`and`, `or`, `not`). Note that `||` and `&&` are not allowed; +* boolean operators (`and`, `or`, `not`). Note that `||` and `&&` are not allowed; * arithmetic operators (`+`, `-`, `*`, `/`); * `<>` and `++` as long as the left side is a literal; +* the `in` operator; * all the following type check functions: * is_atom/1 @@ -435,7 +485,7 @@ However, the example above will always fail. If the argument is a list, calling In such cases, if there is an error in one of the guards, it won't affect the next one. -### 2.7.5 Functions +### 2.8.5 Functions In Elixir, creating a function is similar to the `case` mechanism we have just seen. It allows us to define a function with many clauses: @@ -463,7 +513,7 @@ As Elixir is an immutable language, the binding of the function is also immutabl (fn -> x = 2 end).() x #=> 1 -### 2.7.6 Try +### 2.8.6 Try The next control-flow mechanism is `try/catch/after`: @@ -510,7 +560,7 @@ The common strategy is to explicitly make all arguments that are required after x #=> returns the value of x or nil for failures -### 2.7.7 Receive +### 2.8.7 Receive The last control-flow mechanism we are going to discuss is essential to Elixir's and Erlang's actor mechanism. In Elixir, the code is run in separate processes that exchange messages between them. Those processes are not Operating System processes (they are actually quite light-weight) but are called so since they do not share state with each other. @@ -545,7 +595,7 @@ You may not see exactly `<0.36.0>` back, but something similar. If there are no Notice we spawned a new process using the `spawn` function passing another function as argument. Elixir also supports `spawn_link`, which spawns a child process but keeps the parent and child connected. This way, if the child dies unexpectedly, the parent receives a notification. [`Process`](/docs/stable/Process.html) and [`Node`](/docs/stable/Node.html) modules contains many functions to manage processes, including spawning and get information about processes running in other nodes in the network. -## 2.8 Exceptions +## 2.9 Exceptions Elixir provides the concept of exceptions. An exception can be raised using the function `raise` and rescued inside a `try` block with the `rescue` keyword: @@ -595,7 +645,7 @@ We can sum this up in few words: don't use exceptions for control-flow. If you f Custom exceptions can be defined using the `defexception` macro. You can check a list of defined exceptions in [our documentations page](/docs/stable/), by clicking "Records" in the upper left corner. -## 2.8 Built-in functions +## 2.10 Built-in functions Elixir ships with many built-in functions automatically available in the current scope. In addition to the control flow expressions seen above, Elixir also adds: `elem` and `setelem` to read and set values in tuples, `inspect` that returns the representation of a given data type as a string, and many others. All of these functions imported by default are available in [`Kernel`](/docs/stable/Kernel.html) and [Elixir special forms are available in `Kernel.SpecialForms`](/docs/stable/Kernel.SpecialForms.html). diff --git a/getting_started/3.markdown b/getting_started/3.markdown index bd5e3a7be..2379c3507 100644 --- a/getting_started/3.markdown +++ b/getting_started/3.markdown @@ -298,6 +298,7 @@ Elixir has a handful of reserved attributes. The following are currently functio * `@on_load` - expects a function name that will be invoked whenever the module is loaded. The function must have arity 0 and has to return `:ok`, otherwise the loading of the module is aborted; * `@before_compile` - expects a `{ module, function }` that will be invoked with the module name before the module is compiled. The function may be a macro, allowing you to inject functions inside the module exactly before compilation; * `@after_compile` - expects a `{ module, function }` that will be invoked with the module name and its object code right after the module is compiled and loaded; +* `@on_definition` - expects a `{ module, function }` that will be invoked after each function/macro is defined. This makes it easy to annotate and customize functions; The following attributes are part of [typespecs](http://www.erlang.org/doc/reference_manual/typespec.html) and are also supported by Elixir: diff --git a/getting_started/5.markdown b/getting_started/5.markdown index 33a3647c9..432506a1f 100644 --- a/getting_started/5.markdown +++ b/getting_started/5.markdown @@ -24,7 +24,7 @@ The tuple above represents a function call to sum passing 1, 2 and 3 as argument * The first element of the tuple is always an atom or another tuple in the same representation; * The second element of the tuple is always an integer representing the line number; -* The third element of the tuple is either a list of arguments for the function call or an atom (`nil` or `:quoted`), meaning that the tuple represents a variable, not a function call. +* The third element of the tuple is either a list of arguments for the function call or an atom. When an atom, it means the tuple represents a variable, not a function call. You can get the representation of any expression by using the quote macro: @@ -120,7 +120,7 @@ We can define any macro we want, including ones that override the built-in macro ## 5.3 Macros hygiene -Elixir macros follow Scheme conventions and are hygienic. This means a variable defined inside a macro won't conflict with a variable defined in the context where that macro is inserted. For example: +Elixir macros follow Scheme conventions and are hygienic. This means that aliases and imports will be expanded in the context the quoted contents are defined. It also guarantees that a variable defined inside a quote won't conflict with a variable defined in the context where that macro is expanded. For example: {% highlight ruby %} defmodule Hygiene do @@ -164,39 +164,23 @@ HygieneTest.go # => 1 {% endhighlight %} -Macros hygiene only works because Elixir marks a variable as coming from the quote. For example, consider this: +Variables hygiene only works because Elixir annotates variables with their context. For example, a variable `x` defined at the line 3 of a module, would be represented as: -{% highlight ruby %} -iex> quote do: x -{ :x, 0, :quoted } -{% endhighlight %} + { :x, 3, nil } -Notice that the third element is `:quoted`. It means that x may be a function call with 0 arguments or a variable coming from a quote. On the other hand, an unquoted variable would have the third element equal to nil. Let's consider this final example: +However, a quoted variable is represented as: {% highlight ruby %} -defmodule Hygiene do - defmacro quoted(x) do - quote do - { unquote(x), x, x() } - end +defmodule Sample do + def quoted do + quote do: x end end -{% endhighlight %} -In the example above, we have defined a macro called `quoted` that returns an unquoted variable, a quoted variable and a function call. Calling this macro will return: - -{% highlight ruby %} -require Hygiene - -Hygiene.quoted(x) -#=> { -# { :x, 1, nil }, -# { :x, 1, :quoted }, -# { :x, 1, [] } -# } +Sample.quoted #=> { :x, 3, Sample } {% endhighlight %} -Summing up: if the third element is a list, it is certainly a function call. If not, it may be a variable (coming from a quote or not) or a function call. +Notice that the third element in the quoted variable is the atom `Sample`, instead of `nil`, which marks the variable as coming from the `Sample` module. Therefore, Elixir considers those two variables come from different contexts and handle them accordingly. ## 5.4 Private macros @@ -287,6 +271,6 @@ At the moment the module is being defined, there isn't **yet** a function named ## 5.6 Don't write macros -Although macros are a powerful construct, the first rule of the macro club is **don't write macros**. Macros are harder to write than ordinary Elixir functions, and it's considered to be bad style to use them when they're not necessary. +Although macros are a powerful construct, the first rule of the macro club is **don't write macros**. Macros are harder to write than ordinary Elixir functions, and it's considered to be bad style to use them when they're not necessary. Elixir already provides elegant mechanisms to write your every day code and macros should be saved as last resort. With those lessons, we finish our introduction to macros. Next, let's move to the next chapter which will discuss several topics such as native code compilation, partial application and others. diff --git a/getting_started/6.markdown b/getting_started/6.markdown index b42cbb62a..0115653df 100644 --- a/getting_started/6.markdown +++ b/getting_started/6.markdown @@ -136,7 +136,7 @@ We could also write this as: The example above works as if `size(&1)` translates directly to `fn(x) -> size(x) end`. Since operators are also function calls, they can also benefit of the same syntax: - iex> Enum.reduce [1,2,3], 0, &1 * &2 + iex> Enum.reduce [1,2,3], 1, &1 * &2 6 In this case, `&1 * &2` translates to `fn(x, y) -> x * y end`. The values `&1` and `&2` maps to the argument order in the generated function. From e19678104ad41278987396210657bb9d138c8435 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Tue, 22 Jan 2013 15:56:42 -0700 Subject: [PATCH 320/437] Update crash-course.markdown Fix rebar integration config (ht: @evanmiller) --- crash-course.markdown | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/crash-course.markdown b/crash-course.markdown index 65ee8e305..cab4d15d7 100644 --- a/crash-course.markdown +++ b/crash-course.markdown @@ -877,8 +877,7 @@ Elixir is structured similarly to Erlang's OTP. It is divided into applications {% highlight erlang %} {lib_dirs, [ - "deps/elixir/lib/elixir/ebin", - "deps/elixir/lib/ex_unit/ebin" + "deps/elixir/lib" ]}. {% endhighlight %} From c0003380c1613aa7fd23b20fa2a8a7f5869458a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Tue, 22 Jan 2013 20:19:31 -0700 Subject: [PATCH 321/437] Update crash-course.markdown Some fixes regarding Erlang syntax --- crash-course.markdown | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/crash-course.markdown b/crash-course.markdown index cab4d15d7..30493e0a3 100644 --- a/crash-course.markdown +++ b/crash-course.markdown @@ -185,7 +185,7 @@ Process.self **Note**. Since Erlang modules are represented by atoms, you may invoke Erlang functions in Elixir as follows: {% highlight ruby %} -:lists.sort [3, 2,1] +:lists.sort [3, 2, 1] {% endhighlight %} All of the Erlang built-ins reside in the `:erlang` module. @@ -383,15 +383,15 @@ Each Erlang module lives in its own file which has the following structure: {% highlight erlang %} -module(hello_module). --export([fun/0, fun/1]). +-export([some_fun/0, fun/1]). % A "Hello world" function -fun() -> +some_fun() -> io:format('~s~n', ['Hello world!']). % This one works only with lists -fun(list) when is_list(list) -> - io:format('~s~n', list). +some_fun(List) when is_list(List) -> + io:format('~s~n', List). % Non-exported functions are private priv() -> @@ -405,12 +405,12 @@ An Elixir equivalent to the Erlang above: {% highlight ruby %} defmodule HelloModule do # A "Hello world" function - def fun do + def some_fun do IO.puts "Hello world!" end # This one works only with lists - def fun(list) when is_list(list) do + def some_fun(list) when is_list(list) do IO.inspect list end From 8003e11bb53a1876869001a579e1ab145205abc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Wed, 23 Jan 2013 09:29:21 -0700 Subject: [PATCH 322/437] Update crash-course.markdown --- crash-course.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crash-course.markdown b/crash-course.markdown index 30493e0a3..275863c84 100644 --- a/crash-course.markdown +++ b/crash-course.markdown @@ -852,8 +852,8 @@ It can be called from Erlang as follow: -module(erlang_contrived). -compile(export_all). -uglify(bin) -> - 'Elixir-Contrived':ugly_binary(bin). +uglify(Bin) -> + 'Elixir-Contrived':ugly_binary(Bin). {% endhighlight %} However this syntax is suboptimal. For this reason, Elixir ships with a parse transform that allows you to write the module names in a more convenient way: From d6913783b4b1046aea89fb908f0974b195c1d10f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Wed, 5 Dec 2012 13:50:00 +0100 Subject: [PATCH 323/437] Break down mix chapter in two --- _config.yml | 1 - _layouts/getting_started.html | 22 +- ...2012-08-01-elixir-v0-6-0-released.markdown | 2 +- getting_started/1.markdown | 5 +- getting_started/2.markdown | 5 +- getting_started/3.markdown | 5 +- getting_started/4.markdown | 5 +- getting_started/5.markdown | 5 +- getting_started/6.markdown | 5 +- getting_started/7.markdown | 11 +- .../{ex_unit.markdown => ex_unit/1.markdown} | 53 ++- getting_started/mix.markdown | 363 ------------------ getting_started/mix/1.markdown | 240 ++++++++++++ getting_started/mix/2.markdown | 104 +++++ 14 files changed, 409 insertions(+), 417 deletions(-) rename getting_started/{ex_unit.markdown => ex_unit/1.markdown} (77%) delete mode 100644 getting_started/mix.markdown create mode 100644 getting_started/mix/1.markdown create mode 100644 getting_started/mix/2.markdown diff --git a/_config.yml b/_config.yml index 9ceb508bd..8ee0a103b 100644 --- a/_config.yml +++ b/_config.yml @@ -1,4 +1,3 @@ markdown: rdiscount pygments: true -total_guides: 7 permalink: /blog/:year/:month/:day/:title diff --git a/_layouts/getting_started.html b/_layouts/getting_started.html index fa0695e59..2887f94cc 100644 --- a/_layouts/getting_started.html +++ b/_layouts/getting_started.html @@ -20,11 +20,17 @@

      Index

      -

      Applications

      - +

      Mix - a build tool for Elixir

      +
        +
      1. Introduction to Mix
      2. +
      3. Creating custom Mix tasks
      4. +
      +
      +
      +

      ExUnit - a unit test framework

      +
        +
      1. Introduction to ExUnit
      2. +
      @@ -36,11 +42,11 @@

      Applications

      {% if page.guide %} {% endif %} diff --git a/_posts/2012-08-01-elixir-v0-6-0-released.markdown b/_posts/2012-08-01-elixir-v0-6-0-released.markdown index 13bfea2fe..3e52772bb 100644 --- a/_posts/2012-08-01-elixir-v0-6-0-released.markdown +++ b/_posts/2012-08-01-elixir-v0-6-0-released.markdown @@ -23,6 +23,6 @@ Our interactive shell (IEx) also had many improvements, thanks to the Elixir dev

      Elixir v0.6 quick tour - Mix and IEx from Plataformatec on Vimeo.

      -That's it. Of course the documentation was also improved in the process, including two brand new getting started chapters on [Mix](/getting_started/mix.html) and [ExUnit](/getting_started/ex_unit.html). For the next months, we will continue improving Elixir (you can see some ideas floating around in the [issues tracker](github.com/elixir-lang/elixir/issues)) but we will start to focus on other tools and libraries for the community. +That's it. Of course the documentation was also improved in the process, including two brand new getting started chapters on [Mix](/getting_started/mix/1.html) and [ExUnit](/getting_started/ex_unit/1.html). For the next months, we will continue improving Elixir (you can see some ideas floating around in the [issues tracker](github.com/elixir-lang/elixir/issues)) but we will start to focus on other tools and libraries for the community. Thank you and don't forget to [give Elixir a try](/getting_started/1.html)! \ No newline at end of file diff --git a/getting_started/1.markdown b/getting_started/1.markdown index 69af696cf..1059b81ed 100644 --- a/getting_started/1.markdown +++ b/getting_started/1.markdown @@ -1,10 +1,11 @@ --- layout: getting_started -title: 1. Introduction +title: 1 Introduction guide: 1 +total_guides: 7 --- -# 1 Introduction +# {{ page.title }} Welcome! In this tutorial we are going to show you how to get started with Elixir. We will start with how to install Elixir, how to use its interactive shell, and basic data types and operators. In later chapters, we are even going to discuss more advanced subjects such as macros, protocols and other features provided by Elixir. diff --git a/getting_started/2.markdown b/getting_started/2.markdown index 02e03e680..0656bccf1 100644 --- a/getting_started/2.markdown +++ b/getting_started/2.markdown @@ -1,10 +1,11 @@ --- layout: getting_started -title: 2. Diving in +title: 2 Diving in guide: 2 +total_guides: 7 --- -# 2 Diving in +# {{ page.title }} In this chapter we'll go a bit deeper into the basic data-types, learn some control flow mechanisms and how to create and invoke anonymous functions. diff --git a/getting_started/3.markdown b/getting_started/3.markdown index 2379c3507..2e17844f0 100644 --- a/getting_started/3.markdown +++ b/getting_started/3.markdown @@ -1,10 +1,11 @@ --- layout: getting_started -title: 3. Modules +title: 3 Modules guide: 3 +total_guides: 7 --- -# 3 Modules +# {{ page.title }} In Elixir, you can group several functions into a module. In the previous chapter, for example, we invoked functions from the module List: diff --git a/getting_started/4.markdown b/getting_started/4.markdown index 18428be68..26ad2ed3e 100644 --- a/getting_started/4.markdown +++ b/getting_started/4.markdown @@ -1,10 +1,11 @@ --- layout: getting_started -title: 4. Records & Protocols +title: 4 Records & Protocols guide: 4 +total_guides: 7 --- -# 4 Records & Protocols +# {{ page.title }} Elixir provides both records and protocols. This chapter will outline the main features of both and provide some examples. More specifically, we will learn how to use `defrecord`, `defprotocol` and `defimpl`. diff --git a/getting_started/5.markdown b/getting_started/5.markdown index 432506a1f..bb5be26bf 100644 --- a/getting_started/5.markdown +++ b/getting_started/5.markdown @@ -1,10 +1,11 @@ --- layout: getting_started -title: 5. Macros +title: 5 Macros guide: 5 +total_guides: 7 --- -# 5 Macros +# {{ page.title }} An Elixir program can be represented by its own data structures. This chapter will describe what those structures look like and how to manipulate them to create your own macros. diff --git a/getting_started/6.markdown b/getting_started/6.markdown index 0115653df..d823d6810 100644 --- a/getting_started/6.markdown +++ b/getting_started/6.markdown @@ -1,10 +1,11 @@ --- layout: getting_started -title: 6. Other topics +title: 6 Other topics guide: 6 +total_guides: 7 --- -# 6 Other topics +# {{ page.title }} This chapter contains different small topics that are part of Elixir's day to day work. We will learn about writing documentation, list and binary comprehensions, partial function application and more! diff --git a/getting_started/7.markdown b/getting_started/7.markdown index 5218d7543..eea89bf2b 100644 --- a/getting_started/7.markdown +++ b/getting_started/7.markdown @@ -1,21 +1,22 @@ --- layout: getting_started -title: 7. Where To Go Next +title: 7 Where To Go Next guide: 7 +total_guides: 7 --- -# 7 Where To Go Next +# {{ page.title }} ## 7.1 Applications -In order to get your first project started, Elixir ships with a build tool called [`Mix`](/getting_started/mix.html). You can get your new project started by simply running: +In order to get your first project started, Elixir ships with a build tool called [`Mix`](/getting_started/mix/1.html). You can get your new project started by simply running: mix new path/to/new/project You can learn more about Elixir and other applications in the links below: -* [Mix - a build tool for Elixir](/getting_started/mix.html) -* [ExUnit - a unit test framework](/getting_started/ex_unit.html) +* [Mix - a build tool for Elixir](/getting_started/mix/1.html) +* [ExUnit - a unit test framework](/getting_started/ex_unit/1.html) ## 7.2 Sample Code diff --git a/getting_started/ex_unit.markdown b/getting_started/ex_unit/1.markdown similarity index 77% rename from getting_started/ex_unit.markdown rename to getting_started/ex_unit/1.markdown index 41d143795..1019ef2e9 100644 --- a/getting_started/ex_unit.markdown +++ b/getting_started/ex_unit/1.markdown @@ -1,14 +1,14 @@ --- layout: getting_started -title: ExUnit +title: 1 Introduction to ExUnit +guide: 1 +total_guides: 1 --- -# ExUnit +# {{ page.title }} ExUnit is a unit test framework that ships with Elixir. -## 1 Getting started - Using ExUnit is quite easy, here is a file with the minimum required: {% highlight ruby %} @@ -29,15 +29,15 @@ In general, we just need to invoke `ExUnit.start`, define a test case using `ExU In this chapter, we will discuss the most common features available in ExUnit and how to customize it further. -## 2 ExUnit +## 1.1 Starting ExUnit ExUnit is started using `ExUnit.start`. This function accepts a couple options, so [check its documentation](/docs/stable/ExUnit.html) for more details. For now, we will just detail the most common ones: * `:formatter` - When you run tests with ExUnit, all the IO is done by [the formatter](https://github.com/elixir-lang/elixir/blob/master/lib/ex_unit/lib/ex_unit/formatter.ex). Developers can define their own formatters and this is the configuration that tells ExUnit to use a custom formatter; -* `:max_cases` - As we are going to see soon, ExUnit allows you to easily run tests in parallel. This is very useful to speed up your tests that have no side affects. This option allows us to configure the maximum number of cases ExUnit runs in parallel. +* `:max_cases` - As we are going to see soon, ExUnit allows you to easily run tests in concurrently. This is very useful to speed up your tests that have no side affects. This option allows us to configure the maximum number of cases ExUnit runs in concurrently. -## 3 ExUnit.Case +## 1.2 Defining a test case After ExUnit is started, we can define our own test cases. This is done by using `ExUnit.Case` in our module: @@ -47,19 +47,9 @@ use ExUnit.Case `ExUnit.Case` provides some features, so let's take a look at them. -### 3.1 Async - -The first feature worth commenting in ExUnit is the ability to run test cases in parallel. All you need to do is pass the `:async` option set to true: - -{% highlight ruby %} -use ExUnit.Case, async: true -{% endhighlight %} - -This will run this test case in parallel with other test cases which are async too. The tests inside a particular case is still run in parallel. - -### 3.2 The test macro +### 1.2.1 The test macro -`ExUnit.Case` runs all functions starting with `test`. As a convenience to define such functions, `ExUnit.Case` provides a test macro, so instead of writing: +`ExUnit.Case` runs all functions whose name starts with `test`: {% highlight ruby %} def test_the_truth do @@ -67,7 +57,7 @@ def test_the_truth do end {% endhighlight %} -A developer can write: +As a convenience to define such functions, `ExUnit.Case` provides a test macro, which allows one to write: {% highlight ruby %} test "the truth" do @@ -75,9 +65,9 @@ test "the truth" do end {% endhighlight %} -Which is more legible. The test macro accepts either a binary or an atom as name. +Which is more readable. The test macro accepts either a binary or an atom as name. -### 3.3 Assertions +### 1.2.2 Assertions Another convenience provided by `ExUnit.Case` is to automatically import a set of assertion macros and functions, available in [`ExUnit.Assertions`](/docs/stable/ExUnit.Assertions.html). @@ -108,16 +98,25 @@ end So don't forget to check [`ExUnit.Assertions`' documentation](/docs/stable/ExUnit.Assertions.html) for more examples. -### 3.4 Callbacks +### 1.2.3 Callbacks `ExUnit.Case` defines four callbacks: * `setup_all()` and `teardown_all(context)` which are executed before and after all tests respectively; -* `setup(context, test)` and `teardown(context, test)` which are executed before and after each test, receiving -the test name as argument; +* `setup(context, test)` and `teardown(context, test)` which are executed before and after each test, receiving the test name as argument; Such callbacks are useful to clean up any side-effect a test may cause, as for example, state in genservers, data on filesystem, or entries in a database. Data can be passed in between such callbacks as context, the context value returned by `setup_all` is passed down to all other callbacks. The value can then be updated in `setup` which is passed down to `teardown`. -## 4 Lots To Do +### 1.2.4 Async + +Finally, ExUnit also allows test cases to run concurrently. All you need to do is pass the `:async` option set to true: + +{% highlight ruby %} +use ExUnit.Case, async: true +{% endhighlight %} + +This will run this test case concurrently with other test cases which are async too. The tests inside a particular case are still run in sequentially. + +## 2 Lots To Do -ExUnit is still a work in progress. Feel free to visit [our issues tracker](https://github.com/elixir-lang/elixir/issues) to add issues for anything you'd like to see in ExUnit and feel free to contribute. \ No newline at end of file +ExUnit is still a work in progress. Feel free to visit [our issues tracker](https://github.com/elixir-lang/elixir/issues) to add issues for anything you'd like to see in ExUnit and feel free to contribute. diff --git a/getting_started/mix.markdown b/getting_started/mix.markdown deleted file mode 100644 index 7c20f759f..000000000 --- a/getting_started/mix.markdown +++ /dev/null @@ -1,363 +0,0 @@ ---- -layout: getting_started -title: Mix ---- - -# Mix - -Elixir ships with a few applications to make building and deploying projects with Elixir easier and Mix is certainly their backbone. - -Mix is a build tool that provides tasks for creating, compiling, testing (and soon deploying) Elixir projects. Mix is inspired by the [Leiningen](https://github.com/technomancy/leiningen) build tool for Clojure and was written by one of its contributors. - -In this chapter, you will learn how to create projects using `mix`, install dependencies and create your own tasks. - -## 1 Getting started - -In order to start your first project, simply use the `mix new` command passing the path to your project. For now, we will create an application called `my_project` in the current directory: - - mix new ./my_project - -Mix will create a directory named `my_project` with few files in it: - - .gitignore - README.md - mix.exs - lib/my_project.ex - test/test_helper.exs - test/my_project_test.exs - -Let's take a brief look at some of these. - -> Mix is an Elixir executable. This means that in order to run `mix`, you need to have elixir's executable in your PATH. If not, you can run it by passing the script as argument to elixir: -> -> bin/elixir bin/mix new ./my_project -> -> Note that you can also execute any script in your PATH from Elixir via the -S option: -> -> bin/elixir -S mix new ./my_project -> -> When using -S, elixir finds the script wherever it is in your PATH and executes it. - -### 1.1 mix.exs - -This is the file with your projects configuration. It looks like this: - -{% highlight ruby %} -defmodule MyProject.Mixfile do - use Mix.Project - - def project do - [ app: :my_project, - version: "0.0.1", - deps: deps ] - end - - # Configuration for the OTP application - def application do - [] - end - - # Returns the list of dependencies in the format: - # { :foobar, "0.1", git: "https://github.com/elixir-lang/foobar.git" } - defp deps do - [] - end -end -{% endhighlight %} - -Our `mix.exs` is quite straight-forward. It defines two functions, `project` which should return the project configuration, for example, where to find the source files, the application name and version. And another function named `application` which allow us to generate an application according to the Open Telecom Platform (OTP) that ships with Erlang. We will talk more about these later. - -### 1.2 lib/my_project.ex - -This file simply contains the definition of our project main module with a `start` function: - -{% highlight ruby %} -defmodule MyProject do - def start do - :ok = :application.start(:my_project) - end -end -{% endhighlight %} - - -The `start` function invokes the erlang module `application` and tells it to start our application. - -### 1.3 test/my_project_test.exs - -This file contains a stub test case for our project: - -{% highlight ruby %} -Code.require_file "../test_helper", __FILE__ - -defmodule MyProjectTest do - use ExUnit.Case - - test "the truth" do - assert true - end -end -{% endhighlight %} - -It is important to note a couple things: - -1) Notice the file is an Elixir script file (`.exs`). This is convenient because we don't need to compile test files before running them; - -2) The first line in our test is simply requiring the `test_helper` file in the same directory as the current file. As we are going to see, the `test/test_helper.exs` file is responsible for starting the test framework; - -3) Then we define a test module named `MyProjectTest`, using `ExUnit.Case` to inject default behavior and define a simple test. You can learn more about the test framework in the [ExUnit](/getting_started/ex_unit.html) chapter; - -Since this file is a script file (`.exs`) and it also requires `test_helper.exs`, responsible for setting up the test framework, we can execute this file directly from the command line, which is very useful when you want to run a specific test and not the whole test suite, try it: - - $ elixir -pa ebin test/my_project_test.exs - -### 1.4 test/test_helper.exs - -The last file we are going to check is the `test_helper.exs`, which simply loads our application and sets up the test framework: - -{% highlight ruby %} -MyProject.start -ExUnit.start -{% endhighlight %} - -And that is it, with our project created. We are ready to move on! - -## 2 Exploring - -Now that we created our new project, what can we do with it? In order to check the commands available to us, just run the task `help`: - - $ mix help - -It will print all the tasks available. You can get further information by invoking `mix help TASK`. - -Play around with the available tasks, like `mix compile` and `mix test`, and execute them in your project to check how they work. - -## 3 Compilation - -Mix can compile our project for us. The default configurations uses `lib/` for source files and `ebin/` for compiled beam files, you don't even have to provide any compilation-specific setup but if you must, some options are available. For instance, if you want to put your compiled files in another directory besides `ebin`, simply set in `:compile_path` in your `mix.exs` file: - -{% highlight ruby %} -def project do - [compile_path: "ebin"] -end -{% endhighlight %} - -In general, Mix tries to be smart and compile only when necessary. - -You can also note that, after you compile for the first time, Mix generates an `my_project.app` file inside your `ebin` directory. This file specifies an Erlang application and it holds information about your application, for example, what are its dependencies, which modules it defines and so forth. In our `MyProject.start` function, when we call `:application.start(:my_project)`, Erlang will load the `my_project.app` file and process it. For instance, if there are any dependencies missing, it will let us now. - -### 3.1 Running the application - -Generally, the application starts by calling `MyProject.start` function. -It's the entry point to your application, so besides the call to -`:application.start(:my_project)`, you might want to do actual app job -here. - -There are a few ways to start an application. You can use the `mix run` task or run `mix iex` to start an Elixir interactive shell and then type `MyProject.start` to play with exported application functions and more. - -## 4 Tasks - -In Mix, a task is simply an Elixir module inside the `Mix.Tasks` namespace and a `run/1` function. For example, the `compile` task is a module named `Mix.Tasks.Compile`. - -Here is a simple example task: - -{% highlight ruby %} -defmodule Mix.Tasks.Hello do - use Mix.Task - - @shortdoc "This is short documentation, see" - - @moduledoc """ - A test task. - """ - def run(_) do - IO.puts "Hello, World!" - end -end -{% endhighlight %} - -This defines a task called `hello`. In order to make it a task, it defines a `run` function that takes a single argument that will be a list of binary strings which are the arguments that were passed to the task on the command line or from another task calling this one. - -When you invoke `mix hello`, this task will run and print `Hello, World!`. Mix uses its first argument to lookup the task module and execute its `run` function. - -You're probably wondering why we have a `@moduledoc` and `@shortdoc`. Both are used by the `help` task for listing tasks and providing documentation of them. The former is used when `mix help TASK` is invoked, the latter in the general listing with `mix help`. - -Besides those two, there is also `@hidden` attribute that, when set to true, marks the task as hidden so it does not show up on `mix help Task`. Any task without `@shortdoc` also won't show up. - -### 4.1 Common API - -When writing tasks, there are some common mix functionality we would like to access. There is a gist: - -* `Mix.project` - Returns the project configuration under the function `project`; Notice this function returns an empty configuration if no `mix.exs` file exists in the current directory, this allows many mix functions to work even if a `mix.exs` project is not defined; - -* `Mix.Project.current` - Access the module for the current project, this is useful in case you want to access special functions in the project. It raises an exception if no project is defined; - -* `Mix.shell` - The shell is a simple abstraction for doing IO in Mix. Such abstractions make it easy to test existing mix tasks. In the future, the shell will provide conveniences for colored output and getting user input; - -* `Mix.Task.run(task, args)` - This is how you invoke a task from another task in Mix; Notice that if the task was already invoked, it works as no-op; - -There is more to the Mix API, so feel free to [check the documentation](/docs/stable/Mix.html), with special attention to [`Mix.Task`](/docs/stable/Mix.Task.html) and [`Mix.Project`](/docs/stable/Mix.Project.html). - -### 4.2 Namespaced Tasks - -While tasks are simple, they can be used to accomplish complex things. Since they are just Elixir code, anything you can do in normal Elixir you can do in Mix tasks. You can distribute tasks however you want just like normal libraries and thus they can be reused in many projects. - -So, what do you do when you have a whole bunch of related tasks? If you name them all like `foo`, `bar`, `baz`, etc, eventually you'll end up with conflicts with other people's tasks. To prevent this, Mix allows you to namespace tasks. - -Let's assume you have a bunch of tasks for working with Riak. - -{% highlight ruby %} -defmodule Mix.Tasks.Riak do - defmodule Dostuff do - ... - end - - defmodule Dootherstuff do - ... - end -end -{% endhighlight %} - -Now you'll have two different tasks under the modules `Mix.Tasks.Riak.Dostuff` and `Mix.Tasks.Riak.Dootherstuff` respectively. You can invoke these tasks like so: `mix mongodb.dostuff` and `mix mongodb.dootherstuff`. Pretty cool, huh? - -You should use this feature when you have a bunch of related tasks that would be unwieldly if named completely independently of each other. If you have a few unrelated tasks, go ahead and name them however you like. - -## 5 Dependencies - -Mix is also able to manage git (so far) dependencies. Dependencies should be listed in project settings, as follow: - -{% highlight ruby %} -def project do - [ app: :my_project, - version: "0.0.1", - deps: deps ] -end - -defp deps do - [ { :some_project, "0.3.0", github: "some_project/other" }, - { :another_project, "1.0.2", git: "https://example.com/another/main.git" } ] -end -{% endhighlight %} - -**Note:** Although not required, it is common to split dependencies into their own function; - -### 5.1 Source Code Management (SCM) - -In the example above, we have used `git` to specify our dependency. Mix was designed in a way it can support multiple SCM tools, by default it ships with `:git` and `:raw`. The most common options are: - -* `:git` - the dependency is a git repository that is retrieved and updated by Mix; -* `:raw` - the dependency is simply a raw path in the filesystem; -* `:compile` - how to compile the dependency, more information in the next section; - -Each SCM may support custom options. `:git` supports the following: - -* `:ref` - an optional reference (a commit) to checkout the git repository; -* `:tag` - an optional tag to checkout the git repository; -* `:branch` - an optional branch to checkout the git repository; -* `:submodules` - when true, initializes submodules recursively in the dependency; - -### 5.2 Compiling dependencies - -In order to compile a dependency, Mix looks into the repository for the best way to proceed. If the dependency contains one of the files below, it will proceed as follows: - -1. `mix.exs` - compiles the dependency directly with Mix; -2. `rebar.config` or `rebar.config.script` - compiles using `rebar compile deps_dir=DEPS`, where `DEPS` is the directory where Mix install by default the project dependencies; -3. `Makefile` - simply invokes `make` - -If the dependency does not contain any of the above, you can specify a command directly with the `:compile` option - - compile: "./configure && make" - -You could also pass an atom to `:compile` and, in such cases, a function with the name of the atom will be invoked in your current project with the app name as argument, allowing you to customize its compilation: - - def project do - [ deps: [ - { :some_project, "0.3.0", - git: "https://github.com/some_project/other.git", compile: :using_foo } - ] ] - end - - def using_foo(app) do - # ... - end - -Finally, if `:noop` is given to `:compile`, nothing is done. - -### 5.3 Repeatability - -An important feature in any dependency management tool is repeatability. For this reason when you first get your dependencies, Mix will create a file called `mix.lock` that contains in which reference each dependency is checked out. - -When another developer gets a copy of the same project, Mix will checkout exactly the same references, ensuring other developers can "repeat" the same setup. - -Locks are automatically updated when `deps.update` is called and can be removed with `deps.unlock`. - -### 5.4 Tasks - -Elixir has many tasks to manage such dependencies: - -* `mix deps` - List all dependencies and their status; -* `mix deps.get` - Get all unavailable dependencies; -* `mix deps.compile` - Compile dependencies; -* `mix deps.update` - Update dependencies; -* `mix deps.clean` - Remove dependencies files; -* `mix deps.unlock` - Unlock the given dependencies; - -Use `mix help` to get more information. - -## 6. Environments - -Mix has the concept of environments that allows a developer to customize compilation and other options based on an external setting. By default, Mix understands three environments: - -* `dev` - the one in which mix tasks are run by default -* `test` - the one used by `mix test` -* `prod` - used to specify dependencies that should be available to parent projects, i.e. when a project has another Mix project as a dependency, only the `prod` dependencies are imported into the parent project - -By default, those environments behave the same and all configuration we have seen so far will affect all three environments. Customization per environment can be done using the `env:` option: - -{% highlight ruby %} -def project do - [ env: [ - prod: [compile_path: "prod_ebin"] ] ] -end -{% endhighlight %} - -By default, Mix runs on `dev` environment (except for tests). The environment can be changed via the `MIX_ENV` environment option: - - MIX_ENV=prod mix compile - -## 7 Local tasks - -Elixir also ships with the ability to manage local tasks. Local tasks can be installed from any URL and are available from anywhere within Elixir: - - $ mix local.install http://elixir-lang/hello.beam - -If everything works as expected, the task will be installed on your machine and you can then successfully invoke it: - - $ mix hello - -You can use `mix local` to show all available local tasks and their path. Removing a task is as easy as: - - $ mix local.uninstall hello - -## 8 Do - -In some situations, it is desired to execute more than one task at once. For this purpose, Elixir also ships with a `do` task that simply executes all the given commands separated by comma: - - $ mix do help compile, compile --list - -For instance, the command above will show help information for the compile task and then print the list of available compilers. - -## 9 OptionParser - -Although not a Mix feature, Elixir ships with an `OptionParser` which is quite useful when creating mix tasks that accepts options. The `OptionParser` receives the argv and returns a tuple with parsed options and the remaining arguments: - - - OptionParser.parse(["--debug"]) - #=> { [debug: true], [] } - - OptionParser.parse(["--source", "lib"]) - #=> { [source: "lib"], [] } - - OptionParser.parse(["--source", "lib", "test/enum_test.exs", "--verbose"]) - #=> { [source: "lib", verbose: true], ["test/enum_test.exs"] } - -Check [`OptionParser`](/docs/stable/OptionParser.html) documentation for more information. diff --git a/getting_started/mix/1.markdown b/getting_started/mix/1.markdown new file mode 100644 index 000000000..7f91d472e --- /dev/null +++ b/getting_started/mix/1.markdown @@ -0,0 +1,240 @@ +--- +layout: getting_started +title: 1 Introduction to Mix +guide: 1 +total_guides: 2 +--- + +# {{ page.title }} + +Elixir ships with a few applications to make building and deploying projects with Elixir easier and Mix is certainly their backbone. + +Mix is a build tool that provides tasks for creating, compiling, testing (and soon deploying) Elixir projects. Mix is inspired by the [Leiningen](https://github.com/technomancy/leiningen) build tool for Clojure and was written by one of its contributors. + +In this chapter, you will learn how to create projects using `mix` and install dependencies. In the following sections, we will also learn how to create custom tasks and manage Erlang applications. + +## 1.1 Bootstrapping + +In order to start your first project, simply use the `mix new` command passing the path to your project. For now, we will create an application called `my_project` in the current directory: + + mix new ./my_project + +Mix will create a directory named `my_project` with few files in it: + + .gitignore + README.md + mix.exs + lib/my_project.ex + test/test_helper.exs + test/my_project_test.exs + +Let's take a brief look at some of these. + +> Mix is an Elixir executable. This means that in order to run `mix`, you need to have elixir's executable in your PATH. If not, you can run it by passing the script as argument to elixir: +> +> bin/elixir bin/mix new ./my_project +> +> Note that you can also execute any script in your PATH from Elixir via the -S option: +> +> bin/elixir -S mix new ./my_project +> +> When using -S, elixir finds the script wherever it is in your PATH and executes it. + +### 1.1.1 mix.exs + +This is the file with your projects configuration. It looks like this: + +{% highlight ruby %} +defmodule MyProject.Mixfile do + use Mix.Project + + def project do + [ app: :my_project, + version: "0.0.1", + deps: deps ] + end + + # Configuration for the OTP application + def application do + [] + end + + # Returns the list of dependencies in the format: + # { :foobar, "0.1", git: "https://github.com/elixir-lang/foobar.git" } + defp deps do + [] + end +end +{% endhighlight %} + +Our `mix.exs` is quite straight-forward. It defines two functions: `project`, which returns project configuration like the application name and version, and `application`, which is used to generate an Erlang application that is managed by the Erlang Runtime. We will talk more about these later. + +### 1.1.2 lib/my_project.ex + +This file simply contains a simple module definition to lay out your code: + +{% highlight ruby %} +defmodule MyProject do +end +{% endhighlight %} + + +### 1.1.3 test/my_project_test.exs + +This file contains a stub test case for our project: + +{% highlight ruby %} +Code.require_file "../test_helper", __FILE__ + +defmodule MyProjectTest do + use ExUnit.Case + + test "the truth" do + assert true + end +end +{% endhighlight %} + +It is important to note a couple things: + +1) Notice the file is an Elixir script file (`.exs`). This is convenient because we don't need to compile test files before running them; + +2) The first line in our test is simply requiring the `test_helper` file in the same directory as the current file. As we are going to see, the `test/test_helper.exs` file is responsible for starting the test framework; + +3) Then we define a test module named `MyProjectTest`, using `ExUnit.Case` to inject default behavior and define a simple test. You can learn more about the test framework in the [ExUnit](/getting_started/ex_unit/1.html) chapter + +### 1.1.4 test/test_helper.exs + +The last file we are going to check is the `test_helper.exs`, which simply loads our application and sets up the test framework: + +{% highlight ruby %} +ExUnit.start [] +{% endhighlight %} + +And that is it, with our project created. We are ready to move on! + +## 1.2 Exploring + +Now that we created our new project, what can we do with it? In order to check the commands available to us, just run the task `help`: + + $ mix help + +It will print all the tasks available. You can get further information by invoking `mix help TASK`. + +Play around with the available tasks, like `mix compile` and `mix test`, and execute them in your project to check how they work. + +## 1.3 Compilation + +Mix can compile our project for us. The default configurations uses `lib/` for source files and `ebin/` for compiled beam files, you don't even have to provide any compilation-specific setup but if you must, some options are available. For instance, if you want to put your compiled files in another directory besides `ebin`, simply set in `:compile_path` in your `mix.exs` file: + +{% highlight ruby %} +def project do + [compile_path: "ebin"] +end +{% endhighlight %} + +In general, Mix tries to be smart and compile only when necessary. + +Note that, after you compile for the first time, Mix generates a `my_project.app` file inside your `ebin` directory. This file defines an Erlang application based on the contents of the `application` function in your Mix project. + +The `.app` file holds information about your application, what are its dependencies, which modules it defines and so forth. The application is automatically started by mix every time you run some commands but it could be started manually by running: + + :application.start(:my_project) + +Or with the command line `--app` flag: + + elixir -pa ebin --app my_project + +## 1.4 Dependencies + +Mix is also able to manage dependencies. Dependencies should be listed in the project settings, as follow: + +{% highlight ruby %} +def project do + [ app: :my_project, + version: "0.0.1", + deps: deps ] +end + +defp deps do + [ { :some_project, "0.3.0", github: "some_project/other" }, + { :another_project, "1.0.2", git: "https://example.com/another/repo.git" } ] +end +{% endhighlight %} + +**Note:** Although not required, it is common to split dependencies into their own function; + +### 1.4.1 Source Code Management (SCM) + +In the example above, we have used `git` to specify our dependency. Mix was designed in a way it can support multiple SCM tools, by default it ships with `:git` and `:raw`. The most common options are: + +* `:git` - the dependency is a git repository that is retrieved and updated by Mix; +* `:raw` - the dependency is simply a raw path in the filesystem; +* `:compile` - how to compile the dependency, more information in the next section; + +Each SCM may support custom options. `:git` supports the following: + +* `:ref` - an optional reference (a commit) to checkout the git repository; +* `:tag` - an optional tag to checkout the git repository; +* `:branch` - an optional branch to checkout the git repository; +* `:submodules` - when true, initializes submodules recursively in the dependency; + +### 1.4.2 Compiling dependencies + +In order to compile a dependency, Mix looks into the repository for the best way to proceed. If the dependency contains one of the files below, it will proceed as follows: + +1. `mix.exs` - compiles the dependency directly with Mix; +2. `rebar.config` or `rebar.config.script` - compiles using `rebar compile deps_dir=DEPS`, where `DEPS` is the directory where Mix install by default the project dependencies; +3. `Makefile` - simply invokes `make`; + +If the dependency does not contain any of the above, you can specify a command directly with the `:compile` option: + +{% highlight ruby %} + compile: "./configure && make" +{% endhighlight %} + +If `:noop` is given to `:compile`, nothing is done. + +### 1.4.3 Repeatability + +An important feature in any dependency management tool is repeatability. For this reason when you first get your dependencies, Mix will create a file called `mix.lock` that contains in which reference each dependency is checked out. + +When another developer gets a copy of the same project, Mix will checkout exactly the same references, ensuring other developers can "repeat" the same setup. + +Locks are automatically updated when `deps.update` is called and can be removed with `deps.unlock`. + +### 1.4.4 Dependencies tasks + +Elixir has many tasks to manage such dependencies: + +* `mix deps` - List all dependencies and their status; +* `mix deps.get` - Get all unavailable dependencies; +* `mix deps.compile` - Compile dependencies; +* `mix deps.update` - Update dependencies; +* `mix deps.clean` - Remove dependencies files; +* `mix deps.unlock` - Unlock the given dependencies; + +Use `mix help` to get more information. + +## 1.5 Environments + +Mix has the concept of environments that allows a developer to customize compilation and other options based on an external setting. By default, Mix understands three environments: + +* `dev` - the one in which mix tasks are run by default +* `test` - the one used by `mix test` +* `prod` - used to specify dependencies that should be available to parent projects, i.e. when a project has another Mix project as a dependency, only the `prod` dependencies are imported into the parent project + +By default, those environments behave the same and all configuration we have seen so far will affect all three environments. Customization per environment can be done using the `env:` option: + +{% highlight ruby %} +def project do + [ env: [ + prod: [compile_path: "prod_ebin"] ] ] +end +{% endhighlight %} + +By default, Mix runs on `dev` environment (except for tests). The environment can be changed via the `MIX_ENV` environment option: + + MIX_ENV=prod mix compile + +In the next chapters, we will learn more about building applications and how to create your own tasks. diff --git a/getting_started/mix/2.markdown b/getting_started/mix/2.markdown new file mode 100644 index 000000000..0d149ddda --- /dev/null +++ b/getting_started/mix/2.markdown @@ -0,0 +1,104 @@ +--- +layout: getting_started +title: 2 Creating custom Mix tasks +guide: 2 +total_guides: 2 +--- + +# {{ page.title }} + +In Mix, a task is simply an Elixir module inside the `Mix.Tasks` namespace and a `run/1` function. For example, the `compile` task is a module named `Mix.Tasks.Compile`. + +Here is a simple example task: + +{% highlight ruby %} +defmodule Mix.Tasks.Hello do + use Mix.Task + + @shortdoc "This is short documentation, see" + + @moduledoc """ + A test task. + """ + def run(_) do + IO.puts "Hello, World!" + end +end +{% endhighlight %} + +This defines a task called `hello`. In order to make it a task, it defines a `run` function that takes a single argument that will be a list of binary strings which are the arguments that were passed to the task on the command line or from another task calling this one. + +When you invoke `mix hello`, this task will run and print `Hello, World!`. Mix uses its first argument to lookup the task module and execute its `run` function. + +You're probably wondering why we have a `@moduledoc` and `@shortdoc`. Both are used by the `help` task for listing tasks and providing documentation of them. The former is used when `mix help TASK` is invoked, the latter in the general listing with `mix help`. + +Besides those two, there is also `@hidden` attribute that, when set to true, marks the task as hidden so it does not show up on `mix help Task`. Any task without `@shortdoc` also won't show up. + +### 2.1 Common API + +When writing tasks, there are some common mix functionality we would like to access. There is a gist: + +* `Mix.project` - Returns the project configuration under the function `project`; Notice this function returns an empty configuration if no `mix.exs` file exists in the current directory, this allows many mix functions to work even if a `mix.exs` project is not defined; + +* `Mix.Project.current` - Access the module for the current project, this is useful in case you want to access special functions in the project. It raises an exception if no project is defined; + +* `Mix.shell` - The shell is a simple abstraction for doing IO in Mix. Such abstractions make it easy to test existing mix tasks. In the future, the shell will provide conveniences for colored output and getting user input; + +* `Mix.Task.run(task, args)` - This is how you invoke a task from another task in Mix; Notice that if the task was already invoked, it works as no-op; + +There is more to the Mix API, so feel free to [check the documentation](/docs/stable/Mix.html), with special attention to [`Mix.Task`](/docs/stable/Mix.Task.html) and [`Mix.Project`](/docs/stable/Mix.Project.html). + +### 2.2 Namespaced Tasks + +While tasks are simple, they can be used to accomplish complex things. Since they are just Elixir code, anything you can do in normal Elixir you can do in Mix tasks. You can distribute tasks however you want just like normal libraries and thus they can be reused in many projects. + +So, what do you do when you have a whole bunch of related tasks? If you name them all like `foo`, `bar`, `baz`, etc, eventually you'll end up with conflicts with other people's tasks. To prevent this, Mix allows you to namespace tasks. + +Let's assume you have a bunch of tasks for working with Riak. + +{% highlight ruby %} +defmodule Mix.Tasks.Riak do + defmodule Dostuff do + ... + end + + defmodule Dootherstuff do + ... + end +end +{% endhighlight %} + +Now you'll have two different tasks under the modules `Mix.Tasks.Riak.Dostuff` and `Mix.Tasks.Riak.Dootherstuff` respectively. You can invoke these tasks like so: `mix mongodb.dostuff` and `mix mongodb.dootherstuff`. Pretty cool, huh? + +You should use this feature when you have a bunch of related tasks that would be unwieldly if named completely independently of each other. If you have a few unrelated tasks, go ahead and name them however you like. + +## 2.3 OptionParser + +Although not a Mix feature, Elixir ships with an `OptionParser` which is quite useful when creating mix tasks that accepts options. The `OptionParser` receives a list of arguments and returns a tuple with parsed options and the remaining arguments: + + OptionParser.parse(["--debug"]) + #=> { [debug: true], [] } + + OptionParser.parse(["--source", "lib"]) + #=> { [source: "lib"], [] } + + OptionParser.parse(["--source", "lib", "test/enum_test.exs", "--verbose"]) + #=> { [source: "lib", verbose: true], ["test/enum_test.exs"] } + +Check [`OptionParser`](/docs/stable/OptionParser.html) documentation for more information. + +## 2.4 Local tasks + +Many times, you want to share a task in between projects or easily install a task that someone made available. With this requirement in mind, Mix also ships with the ability to manage local tasks. Local tasks can be installed from any URL and are available from anywhere within Elixir: + + $ mix local.install http://elixir-lang/hello.beam + +If everything works as expected, the task will be installed on your machine and you can then successfully invoke it: + + $ mix hello + +You can use `mix local` to show all available local tasks and their path. Removing a task is as easy as: + + $ mix local.uninstall hello + +With this in mind, you are ready to go out, create and install your custom tasks! Enjoy! From 010852c688388868e93a8d4c8af6fa1efb996a11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Thu, 6 Dec 2012 21:01:58 +0100 Subject: [PATCH 324/437] Add chapter about building OTP applications --- _layouts/getting_started.html | 3 +- getting_started/7.markdown | 27 +--- getting_started/mix/1.markdown | 29 ++-- getting_started/mix/2.markdown | 265 ++++++++++++++++++++++++++------- getting_started/mix/3.markdown | 104 +++++++++++++ 5 files changed, 338 insertions(+), 90 deletions(-) create mode 100644 getting_started/mix/3.markdown diff --git a/_layouts/getting_started.html b/_layouts/getting_started.html index 2887f94cc..3db942f80 100644 --- a/_layouts/getting_started.html +++ b/_layouts/getting_started.html @@ -23,7 +23,8 @@

      Index

      Mix - a build tool for Elixir

      1. Introduction to Mix
      2. -
      3. Creating custom Mix tasks
      4. +
      5. Building OTP apps with Mix
      6. +
      7. Creating custom Mix tasks
      diff --git a/getting_started/7.markdown b/getting_started/7.markdown index eea89bf2b..cfdf51269 100644 --- a/getting_started/7.markdown +++ b/getting_started/7.markdown @@ -18,45 +18,32 @@ You can learn more about Elixir and other applications in the links below: * [Mix - a build tool for Elixir](/getting_started/mix/1.html) * [ExUnit - a unit test framework](/getting_started/ex_unit/1.html) -## 7.2 Sample Code - -Elixir has more features to offer than what has been described so far, but you should already be comfortable enough to start coding. Here is a bunch of links that'll help you get started: - -* This small and simple [chat application](https://gist.github.com/2783092) shows the basics of working with processes. - -* [ExReminder](https://github.com/alco/ExReminder). This is a more sophisticated application based on a chapter from the _Learn You Some Erlang_ book. - -* [WebSocket Server](https://github.com/alco/ws-elixir) demonstrates an approach to building a web server that supports custom protocols communicating via WebSockets. - -## 7.3 A Byte of Erlang +## 7.2 A Byte of Erlang As the main page of this site puts it: > Elixir is a programming language built on top of the Erlang VM. -So, in order to write a real application with Elixir, familiarity with Erlang's concepts is required. Here's a list of online resources that cover Erlang's fundamentals and its more advanced features: +Sooner than later, an Elixir developer will want to interface with existing Erlang libraries. Here's a list of online resources that cover Erlang's fundamentals and its more advanced features: * This [Erlang Syntax: A Crash Course][1] provides a concise intro to Erlang's syntax. Each code snippet is accompanied by equivalent code in Elixir. This is an opportunity for you to not only get some exposure to the Erlang's syntax but also review some of the things you have learned in the present guide. * Erlang's official website has a short [tutorial][2] with pictures that briefly describe Erlang's primitives for concurrent programming. -* A larger and more comprehensive [guide][3] from Erlang's official documentation site. - * [Learn You Some Erlang for Great Good!][4] is an excellent introduction to Erlang, its design principles, standard library, best practices and much more. If you are serious about Elixir, you'll want to get a solid understanding of Erlang principles. Once you have read through the crash course mentioned above, you'll be able to safely skip the first couple of chapters in the book that mostly deal with the syntax. When you reach [The Hitchhiker's Guide to Concurrency][5] chapter, that's where the real fun starts. -## 7.4 Reference Manual +## 7.3 Reference Manual -[You can also check the source code of Elixir itself](https://github.com/elixir-lang/elixir/tree/master/lib), which is mainly written in Elixir, or [explore Elixir's documentation][8]. +[You can also check the source code of Elixir itself][3], which is mainly written in Elixir (mainly the `lib` directory), or [explore Elixir's documentation][8]. -## 7.5 Join The Community +## 7.4 Join The Community Remember that in case of any difficulties, you can always visit the **#elixir-lang** channel on **irc.freenode.net** or send a message to the [mailing list][6]. You can be sure that there will be someone willing to help. [1]: http://elixir-lang.org/crash-course.html [2]: http://www.erlang.org/course/concurrent_programming.html - [3]: http://www.erlang.org/doc/getting_started/users_guide.html + [3]: https://github.com/elixir-lang/elixir [4]: http://learnyousomeerlang.com/ [5]: http://learnyousomeerlang.com/the-hitchhikers-guide-to-concurrency [6]: http://groups.google.com/group/elixir-lang-core - [7]: https://github.com/elixir-lang/elixir/tree/master/lib - [8]: http://elixir-lang.org/docs/ + [7]: http://elixir-lang.org/docs/ diff --git a/getting_started/mix/1.markdown b/getting_started/mix/1.markdown index 7f91d472e..152be0012 100644 --- a/getting_started/mix/1.markdown +++ b/getting_started/mix/1.markdown @@ -2,7 +2,7 @@ layout: getting_started title: 1 Introduction to Mix guide: 1 -total_guides: 2 +total_guides: 3 --- # {{ page.title }} @@ -17,7 +17,7 @@ In this chapter, you will learn how to create projects using `mix` and install d In order to start your first project, simply use the `mix new` command passing the path to your project. For now, we will create an application called `my_project` in the current directory: - mix new ./my_project + $ mix new ./my_project Mix will create a directory named `my_project` with few files in it: @@ -32,11 +32,11 @@ Let's take a brief look at some of these. > Mix is an Elixir executable. This means that in order to run `mix`, you need to have elixir's executable in your PATH. If not, you can run it by passing the script as argument to elixir: > -> bin/elixir bin/mix new ./my_project +> $ bin/elixir bin/mix new ./my_project > > Note that you can also execute any script in your PATH from Elixir via the -S option: > -> bin/elixir -S mix new ./my_project +> $ bin/elixir -S mix new ./my_project > > When using -S, elixir finds the script wherever it is in your PATH and executes it. @@ -67,7 +67,7 @@ defmodule MyProject.Mixfile do end {% endhighlight %} -Our `mix.exs` is quite straight-forward. It defines two functions: `project`, which returns project configuration like the application name and version, and `application`, which is used to generate an Erlang application that is managed by the Erlang Runtime. We will talk more about these later. +Our `mix.exs` is quite straight-forward. It defines two functions: `project`, which returns project configuration like the application name and version, and `application`, which is used to generate an Erlang application that is managed by the Erlang Runtime. We will going into detail about these in the next chapter. ### 1.1.2 lib/my_project.ex @@ -78,7 +78,6 @@ defmodule MyProject do end {% endhighlight %} - ### 1.1.3 test/my_project_test.exs This file contains a stub test case for our project: @@ -137,13 +136,7 @@ In general, Mix tries to be smart and compile only when necessary. Note that, after you compile for the first time, Mix generates a `my_project.app` file inside your `ebin` directory. This file defines an Erlang application based on the contents of the `application` function in your Mix project. -The `.app` file holds information about your application, what are its dependencies, which modules it defines and so forth. The application is automatically started by mix every time you run some commands but it could be started manually by running: - - :application.start(:my_project) - -Or with the command line `--app` flag: - - elixir -pa ebin --app my_project +The `.app` file holds information about your application, what are its dependencies, which modules it defines and so forth. The application is automatically started by Mix every time you run some commands and we will learn how to configure it in the next chapter. ## 1.4 Dependencies @@ -183,7 +176,7 @@ Each SCM may support custom options. `:git` supports the following: In order to compile a dependency, Mix looks into the repository for the best way to proceed. If the dependency contains one of the files below, it will proceed as follows: -1. `mix.exs` - compiles the dependency directly with Mix; +1. `mix.exs` - compiles the dependency directly with Mix by invoking the compile task; 2. `rebar.config` or `rebar.config.script` - compiles using `rebar compile deps_dir=DEPS`, where `DEPS` is the directory where Mix install by default the project dependencies; 3. `Makefile` - simply invokes `make`; @@ -221,8 +214,8 @@ Use `mix help` to get more information. Mix has the concept of environments that allows a developer to customize compilation and other options based on an external setting. By default, Mix understands three environments: * `dev` - the one in which mix tasks are run by default -* `test` - the one used by `mix test` -* `prod` - used to specify dependencies that should be available to parent projects, i.e. when a project has another Mix project as a dependency, only the `prod` dependencies are imported into the parent project +* `test` - used by `mix test` +* `prod` - the environment in which dependencies are loaded and compiled By default, those environments behave the same and all configuration we have seen so far will affect all three environments. Customization per environment can be done using the `env:` option: @@ -235,6 +228,6 @@ end By default, Mix runs on `dev` environment (except for tests). The environment can be changed via the `MIX_ENV` environment option: - MIX_ENV=prod mix compile + $ MIX_ENV=prod mix compile -In the next chapters, we will learn more about building applications and how to create your own tasks. +In the next chapters, we will learn more about building OTP applications with Mix and how to create your own tasks. diff --git a/getting_started/mix/2.markdown b/getting_started/mix/2.markdown index 0d149ddda..650632e5f 100644 --- a/getting_started/mix/2.markdown +++ b/getting_started/mix/2.markdown @@ -1,104 +1,267 @@ --- layout: getting_started -title: 2 Creating custom Mix tasks +title: 2 Building OTP apps with Mix guide: 2 -total_guides: 2 +total_guides: 3 --- # {{ page.title }} -In Mix, a task is simply an Elixir module inside the `Mix.Tasks` namespace and a `run/1` function. For example, the `compile` task is a module named `Mix.Tasks.Compile`. +In the previous chapter, we have generated an application with Mix and explored a bit how Mix works. In this chapter, we will learn how to build an OTP application. In practice, we don't need Mix in order to build such applications, however, Mix provides some conveniences for us which we are going to explore throughout this chapter. -Here is a simple example task: +## 2.1 The Stacker server + +Our application is going to be a simple stack that allow us push and pop items from the stack as we wish. Let's call it stacker: + + $ mix new stacker + +Our application is going to have one stack which may be accessed by many processes at the same time. To achieve such, we will create a server that is responsible to manage such stack. The clients will send messages to the server whenever they want to push or pop something from the stack. + +Since creating such servers are a common pattern when building Erlang and Elixir applications, we have a behaviour in OTP that encapsulates common server functionalities called **GenServer**. Let's create a file named `lib/stacker/server.ex` with our first server: {% highlight ruby %} -defmodule Mix.Tasks.Hello do - use Mix.Task +defmodule Stacker.Server do + use GenServer.Behaviour - @shortdoc "This is short documentation, see" + def init(stack) do + { :ok, stack } + end - @moduledoc """ - A test task. - """ - def run(_) do - IO.puts "Hello, World!" + def handle_call(:pop, _from, [h|stack]) do + { :reply, h, stack } + end + + def handle_cast({ :push, new }, stack) do + { :noreply, [new|stack] } end end {% endhighlight %} -This defines a task called `hello`. In order to make it a task, it defines a `run` function that takes a single argument that will be a list of binary strings which are the arguments that were passed to the task on the command line or from another task calling this one. +Our server defines three callbacks: `init/1`, `handle_call/3` and `handle_cast/2`. We never call those functions directly, they are called by OTP whenever we interact with the server. We will go into details about these soon, let's just ensure it works as expected. To do so, run `mix iex` and type the following: -When you invoke `mix hello`, this task will run and print `Hello, World!`. Mix uses its first argument to lookup the task module and execute its `run` function. + # Let's start the server using Erlang's :gen_server module. + # It expects 3 arguments: the server module, the initial + # stack and some options (if desired): + iex> { :ok, pid } = :gen_server.start_link(Stacker.Server, [], []) + {:ok,<...>} -You're probably wondering why we have a `@moduledoc` and `@shortdoc`. Both are used by the `help` task for listing tasks and providing documentation of them. The former is used when `mix help TASK` is invoked, the latter in the general listing with `mix help`. + # Now let's push something onto the stack + iex> :gen_server.cast(pid, { :push, 13 }) + :ok + + # Now let's get it out from the stack + # Notice we are using *call* instead of *cast* + iex> :gen_server.call(pid, :pop) + 13 -Besides those two, there is also `@hidden` attribute that, when set to true, marks the task as hidden so it does not show up on `mix help Task`. Any task without `@shortdoc` also won't show up. +Excellent, our server works as expected! There are many things happening behind the scenes, so let's discuss them one by one. -### 2.1 Common API +First, we started the server using [the `:gen_server` module from OTP](http://www.erlang.org/doc/man/gen_server.html). Notice we have used `start_link`, which starts the server and links our current process to the server. In this scenario, if the server dies, it will send an exit message to our process, making it crash too. We will see this in action later. The `start_link` returns the process identifier (`pid`) of the newly spawned server. -When writing tasks, there are some common mix functionality we would like to access. There is a gist: +Later, we have sent a **cast** message to the `pid`. The message was `{ :push, 13 }`, written in the same format as we specified in the `handle_cast/2` callback in `Stacker.Server`. Whenever we send a `cast` message, the `handle_cast/2` callback will be invoked to handle the message. -* `Mix.project` - Returns the project configuration under the function `project`; Notice this function returns an empty configuration if no `mix.exs` file exists in the current directory, this allows many mix functions to work even if a `mix.exs` project is not defined; +Then we finally read what was on the stack by sending a **call** message, which will dispatch to the `handle_call/3` callback. So, what is the difference between **cast** and **call** after all? -* `Mix.Project.current` - Access the module for the current project, this is useful in case you want to access special functions in the project. It raises an exception if no project is defined; +`cast` messages are asynchronous: we simply send a message to the server and we don't expect a reply back. That's why our `handle_cast/2` callback returns `{ :noreply, [new|stack] }`. The first item of the tuple states nothing is should be replied and the second contains our updated stack. -* `Mix.shell` - The shell is a simple abstraction for doing IO in Mix. Such abstractions make it easy to test existing mix tasks. In the future, the shell will provide conveniences for colored output and getting user input; +On the other hand, `call` message are synchronous. When we send a `call` message, the client expects a response back. In this case, the `handle_call/3` callback returns `{ :reply, h, stack }`, Where the second item is the term to be returned and the third is our new stack without its head. Since `call`s are able to send messages back to the client, it also receives a the client information as argument (`_from`). -* `Mix.Task.run(task, args)` - This is how you invoke a task from another task in Mix; Notice that if the task was already invoked, it works as no-op; +### 2.1.1 Learning more about callbacks -There is more to the Mix API, so feel free to [check the documentation](/docs/stable/Mix.html), with special attention to [`Mix.Task`](/docs/stable/Mix.Task.html) and [`Mix.Project`](/docs/stable/Mix.Project.html). +In the case of GenServer's, there are 8 different values a callback such as `handle_call` or `handle_cast` can return: -### 2.2 Namespaced Tasks + { :reply, reply, new_state } + { :reply, reply, new_state, timeout } + { :reply, reply, new_state, :hibernate } + { :noreply, new_state } + { :noreply, new_state, timeout } + { :noreply, new_state, :hibernate } + { :stop, reason, new_state } + { :stop, reason, reply, new_state } -While tasks are simple, they can be used to accomplish complex things. Since they are just Elixir code, anything you can do in normal Elixir you can do in Mix tasks. You can distribute tasks however you want just like normal libraries and thus they can be reused in many projects. +There are 6 callbacks required to be implemented in a GenServer. The `GenServer.Behaviour` module defines all of them automatically, but allows us to customize the ones we need. The list of callbacks are: -So, what do you do when you have a whole bunch of related tasks? If you name them all like `foo`, `bar`, `baz`, etc, eventually you'll end up with conflicts with other people's tasks. To prevent this, Mix allows you to namespace tasks. +* `init(args)` - invoked when the server is started; +* `handle_call(msg, from, state)` - invoked to handle call messages; +* `handle_cast(msg, state)` - invoked to handle cast messages; +* `handle_info(msg, state)` - handle all other messages which are normally received by processes; +* `terminate(reason, state)` - called when the server is about to terminate, useful for cleaning up; +* `code_change(old_vsn, state, extra)` - called when the application code is being upgraded live (hot code swap); -Let's assume you have a bunch of tasks for working with Riak. +### 2.1.2 Crashing a server -{% highlight ruby %} -defmodule Mix.Tasks.Riak do - defmodule Dostuff do +Of what use is a server if we cannot crash it? It is actually quite easy to crash our server. Our `handle_call/3` callback only works if there is something on the stack (remember `[h|t]` won't match an empty list). So let's simply send a message when the stack is empty: + + # Start another server, but with an initial :hello item + iex> { :ok, pid } = :gen_server.start_link(Stacker.Server, [:hello], []) + {:ok,<...>} + + # Let's get our initial item: + iex> :gen_server.call(pid, :pop) + :hello + + # And now let's do an unknown call: + iex> :gen_server.call(pid, :pop) + + =ERROR REPORT==== 6-Dec-2012::19:15:33 === ... + ** (exit) {{:function_clause,...}} + ... + +You can see there are two error reports. The first one is generated by server, due to the crash. Since the server is linked to our process, it also sent an exit message, which was printed by `IEx` as `** (exit) ...`. + +There is a bit more to GenServer's than what we have seen here. For more information, check [`GenServer.Behaviour`'s documentation](http://elixir-lang.org/docs/stable/GenServer.Behaviour.html). + +## 2.2 Supervising our servers + +When building applications in Erlang/Elixir, a common philosophy is to "let it crash". Resources are going to become unavailable, timeout in between services are going to happen and other possible failures. That's why it is important to recover and react to such failures. With this in mind, we are going to write a supervisor to supervise our server. + +Create a file at `lib/stacker/supervisor.ex` with the following: + +{% highlight ruby %} +defmodule Stacker.Supervisor do + use Supervisor.Behaviour + + # A convenience to start the supervisor + def start_link(stack) do + :supervisor.start_link(__MODULE__, stack) end + + # The callback invoked when the supervisor starts + def init(stack) do + children = [ worker(Stacker.Server, [stack]) ] + supervise children, strategy: :one_for_one + end +end +{% endhighlight %} - defmodule Dootherstuff do - ... +In case of supervisors, the only callback that needs to be implemented is `init(args)`. This callback needs to return a supervisor specification, in this case returned by the helper function `supervise/2`. + +Our supervisor is in general very simple: it has to supervise one worker, in this case, `Stacker.Server` and the worker will be started by receiving one argument, which is the default stack. The defined worker is then going to be supervised using the `:one_for_one` strategy, which only restarts the worker that dies when a failure happens. + +By default, the supervisor will invoke the `Stacker.Server.start_link(stack)` function, which we have not implemented yet. So let's implement it now: + +{% highlight ruby %} +defmodule Stacker.Server do + use GenServer.Behaviour + + def start_link(stack) do + :gen_server.start_link({ :local, :stacker }, __MODULE__, stack, []) + end + + def init(stack) do + { :ok, stack } + end + + def handle_call(:pop, _from, [h|stack]) do + { :reply, h, stack } end + + def handle_cast({ :push, new }, stack) do + { :noreply, [new|stack] } + end +end +{% endhighlight %} + +The `start_link` function is quite similar to how we were starting our server with one extra argument: `{ :local, :stacker }`. This argument registers the server in our local nodes, allowing it to be invoked by the given name (in this case, `:stacker`), instead of the `pid`. + +With our supervisor in hand, let's start the console by running `$ mix iex` once again, which will recompile our files too: + + # Now we will start the supervisor with a default stack + iex> Stacker.Supervisor.start_link([:hello]) + {:ok,<...>} + + # And we will access the server by name + iex> :gen_server.call(:stacker, :pop) + :hello + +Notice the supervisor started the server for us, which we were able to send messages to with the `:server` name. What happens if we crash our server again? + + iex> :gen_server.call(:stacker, :pop) + + =ERROR REPORT==== 6-Dec-2012::19:15:33 === + ... + ** (exit) {{:function_clause,...}} + ... + + iex> :gen_server.call(:stacker, :pop) + :hello + +It crashes exactly as before but it is restarted right away with the default stack by the supervisor, allowing us to retrieve `:hello` again. Excellent! By default the supervisor allows a worker to restart maximum 5 times in a 5 seconds timespan. If the worker crashes more frequently than that, the supervisor gives up on the worker and no longer restarts it. Let's check it by sending 5 unknown messages one right after the other (be fast!): + + iex> :gen_server.call(:stacker, :unknown) + ... 5 times ... + + iex> :gen_server.call(:stacker, :unknown) + ** (exit) {:noproc,{:gen_server,:call,[:stacker,:unknown]}} + gen_server.erl:180: :gen_server.call/2 + +The sixth message no longer generates an error report, that happens because our server was no longer started automatically and Elixir returns `:noproc`, meaning there isn't a process named `:stacker`. The number of restarts allowed and its time interval can be customize by passing options to the `supervise` function. Different strategies can be chosen for both the supervisor and the worker. For more information on the supported options, [check the documentation for `Supervisor.Behaviour`](http://elixir-lang.org/docs/stable/Supervisor.Behaviour.html). + +## 2.3 Who supervisors the supervisor? + +We have built our supervisor, but a pertinent question is: who supervisors the supervisor? To answer this question, OTP contains the concept of applications. Applications can be started and stopped as an unit and, when doing so, they are often linked to a supervisor. + +In the previous chapter, we have learned how Mix automatically generates an `.app` file every time we compile our project based on the information contained on the `application` function in our `mix.exs` file. + +The `.app` file is called **application specification** and it must contain our application dependencies, the modules it defines, registered names and many others. Some of this information is filled in automatically by Mix but other information needs to be added manually. + +In our case, our application has a supervisor and, furthermore, it registers a server with name `:stacker`. If other application registers a server with the same name, it will lead to crashes, so we must add this information to the application file. When releasing our software, the release tool is going to let us know about such conflicts. So, let's open the `mix.exs` file and edit the `application` function to the following: + +{% highlight ruby %} +def application do + [ registered: [:stacker], + mod: { Stacker, [:hello] } ] end {% endhighlight %} -Now you'll have two different tasks under the modules `Mix.Tasks.Riak.Dostuff` and `Mix.Tasks.Riak.Dootherstuff` respectively. You can invoke these tasks like so: `mix mongodb.dostuff` and `mix mongodb.dootherstuff`. Pretty cool, huh? +In the `:registered` key we specify all names registered by our application. The `:mod` key specifies that, as soon as the application is started, it must invoke the **application module callback**, in this case, `Stacker`. Such callback must return the `pid` of the supervisor which is associated to this application. + +With this in mind, let's open up the `lib/stacker.ex` file and add the following: -You should use this feature when you have a bunch of related tasks that would be unwieldly if named completely independently of each other. If you have a few unrelated tasks, go ahead and name them however you like. +{% highlight ruby %} +defmodule Stacker do + use Application.Behaviour + + def start(_type, stack) do + Stacker.Supervisor.start_link(stack) + end +end +{% endhighlight %} -## 2.3 OptionParser +The `Application.Behaviour` expects two callbacks, `start(type, args)` and `stop(state)`. We are required to implement `start/2` though we have decided to not bother about `stop(state)` for now. -Although not a Mix feature, Elixir ships with an `OptionParser` which is quite useful when creating mix tasks that accepts options. The `OptionParser` receives a list of arguments and returns a tuple with parsed options and the remaining arguments: +If everything works correctly, all you need to do is to start `$ mix iex` once again. Our files are going to be recompiled and the supervisor (and consequently our server) will be automatically started: - OptionParser.parse(["--debug"]) - #=> { [debug: true], [] } + iex> :gen_server.call(:stacker, :pop) + :hello - OptionParser.parse(["--source", "lib"]) - #=> { [source: "lib"], [] } +Amazing, it works! As you may have noticed, the application `start/2` callback receives a type argument, which we have ignored. The type controls how the VM behaves when the supervisor and consequently our application crashes. You can learn more about it by [reading the documentation for `Application.Behaviour`](http://elixir-lang.org/docs/stable/Application.Behaviour.html). - OptionParser.parse(["--source", "lib", "test/enum_test.exs", "--verbose"]) - #=> { [source: "lib", verbose: true], ["test/enum_test.exs"] } +## 2.4 Starting applications -Check [`OptionParser`](/docs/stable/OptionParser.html) documentation for more information. +Mix will always start the current application and all application dependencies. Notice there is a difference between your project dependencies (the ones defined under the `deps` key we have discussed in the previous chapter) and the application dependencies. -## 2.4 Local tasks +The project dependencies may contain your test framework or a compile-time only dependency. The application dependency is everything you depend on at runtime. Any application dependency needs to be explicitly added to the `application` function too: -Many times, you want to share a task in between projects or easily install a task that someone made available. With this requirement in mind, Mix also ships with the ability to manage local tasks. Local tasks can be installed from any URL and are available from anywhere within Elixir: +{% highlight ruby %} +def application do + [ registered: [:stacker], + applications: [:some_dep_], + mod: { Stacker, [:hello] } ] +end +{% endhighlight %} - $ mix local.install http://elixir-lang/hello.beam +When running tasks on Mix, Mix will ensure the application and all application dependencies are started. This can also be done via command line with the flag `--app`: -If everything works as expected, the task will be installed on your machine and you can then successfully invoke it: + $ elixir -pa ebin --app my_project + +You may also start which application individually via the command line using [Erlang's :application module](http://www.erlang.org/doc/man/application.html): - $ mix hello + :application.start(:my_project) -You can use `mix local` to show all available local tasks and their path. Removing a task is as easy as: +You can learn more about the other keys allowed in the application specification [in the applications chapter from Learn You Some Erlang](http://learnyousomeerlang.com/building-otp-applications). - $ mix local.uninstall hello +Finally, notice that `mix new` supports a `--sup` option, which tells Mix to generate a supervisor with an application module callback, automating some of the work we have done here. -With this in mind, you are ready to go out, create and install your custom tasks! Enjoy! +With final note, we have finished this chapter. We have learned how to create servers, supervise them, and hook them into our application lifecycle. In the next chapter, we will learn how to create custom tasks in Mix. diff --git a/getting_started/mix/3.markdown b/getting_started/mix/3.markdown new file mode 100644 index 000000000..6bcc90c04 --- /dev/null +++ b/getting_started/mix/3.markdown @@ -0,0 +1,104 @@ +--- +layout: getting_started +title: 3 Creating custom Mix tasks +guide: 3 +total_guides: 3 +--- + +# {{ page.title }} + +In Mix, a task is simply an Elixir module inside the `Mix.Tasks` namespace and a `run/1` function. For example, the `compile` task is a module named `Mix.Tasks.Compile`. + +Here is a simple example task: + +{% highlight ruby %} +defmodule Mix.Tasks.Hello do + use Mix.Task + + @shortdoc "This is short documentation, see" + + @moduledoc """ + A test task. + """ + def run(_) do + IO.puts "Hello, World!" + end +end +{% endhighlight %} + +This defines a task called `hello`. In order to make it a task, it defines a `run` function that takes a single argument that will be a list of binary strings which are the arguments that were passed to the task on the command line or from another task calling this one. + +When you invoke `mix hello`, this task will run and print `Hello, World!`. Mix uses its first argument to lookup the task module and execute its `run` function. + +You're probably wondering why we have a `@moduledoc` and `@shortdoc`. Both are used by the `help` task for listing tasks and providing documentation of them. The former is used when `mix help TASK` is invoked, the latter in the general listing with `mix help`. + +Besides those two, there is also `@hidden` attribute that, when set to true, marks the task as hidden so it does not show up on `mix help Task`. Any task without `@shortdoc` also won't show up. + +### 3.1 Common API + +When writing tasks, there are some common mix functionality we would like to access. There is a gist: + +* `Mix.project` - Returns the project configuration under the function `project`; Notice this function returns an empty configuration if no `mix.exs` file exists in the current directory, this allows many mix functions to work even if a `mix.exs` project is not defined; + +* `Mix.Project.current` - Access the module for the current project, this is useful in case you want to access special functions in the project. It raises an exception if no project is defined; + +* `Mix.shell` - The shell is a simple abstraction for doing IO in Mix. Such abstractions make it easy to test existing mix tasks. In the future, the shell will provide conveniences for colored output and getting user input; + +* `Mix.Task.run(task, args)` - This is how you invoke a task from another task in Mix; Notice that if the task was already invoked, it works as no-op; + +There is more to the Mix API, so feel free to [check the documentation](/docs/stable/Mix.html), with special attention to [`Mix.Task`](/docs/stable/Mix.Task.html) and [`Mix.Project`](/docs/stable/Mix.Project.html). + +### 3.2 Namespaced Tasks + +While tasks are simple, they can be used to accomplish complex things. Since they are just Elixir code, anything you can do in normal Elixir you can do in Mix tasks. You can distribute tasks however you want just like normal libraries and thus they can be reused in many projects. + +So, what do you do when you have a whole bunch of related tasks? If you name them all like `foo`, `bar`, `baz`, etc, eventually you'll end up with conflicts with other people's tasks. To prevent this, Mix allows you to namespace tasks. + +Let's assume you have a bunch of tasks for working with Riak. + +{% highlight ruby %} +defmodule Mix.Tasks.Riak do + defmodule Dostuff do + ... + end + + defmodule Dootherstuff do + ... + end +end +{% endhighlight %} + +Now you'll have two different tasks under the modules `Mix.Tasks.Riak.Dostuff` and `Mix.Tasks.Riak.Dootherstuff` respectively. You can invoke these tasks like so: `mix mongodb.dostuff` and `mix mongodb.dootherstuff`. Pretty cool, huh? + +You should use this feature when you have a bunch of related tasks that would be unwieldly if named completely independently of each other. If you have a few unrelated tasks, go ahead and name them however you like. + +## 3.3 OptionParser + +Although not a Mix feature, Elixir ships with an `OptionParser` which is quite useful when creating mix tasks that accepts options. The `OptionParser` receives a list of arguments and returns a tuple with parsed options and the remaining arguments: + + OptionParser.parse(["--debug"]) + #=> { [debug: true], [] } + + OptionParser.parse(["--source", "lib"]) + #=> { [source: "lib"], [] } + + OptionParser.parse(["--source", "lib", "test/enum_test.exs", "--verbose"]) + #=> { [source: "lib", verbose: true], ["test/enum_test.exs"] } + +Check [`OptionParser`](/docs/stable/OptionParser.html) documentation for more information. + +## 3.4 Local tasks + +Many times, you want to share a task in between projects or easily install a task that someone made available. With this requirement in mind, Mix also ships with the ability to manage local tasks. Local tasks can be installed from any URL and are available from anywhere within Elixir: + + $ mix local.install http://elixir-lang/hello.beam + +If everything works as expected, the task will be installed on your machine and you can then successfully invoke it: + + $ mix hello + +You can use `mix local` to show all available local tasks and their path. Removing a task is as easy as: + + $ mix local.uninstall hello + +With this in mind, you are ready to go out, create and install your custom tasks! Enjoy! From 6dcc7732c7dab29e7ca77d9f131bcb817d834f86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sat, 8 Dec 2012 20:19:11 +0100 Subject: [PATCH 325/437] Update docs --- getting_started/mix/1.markdown | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/getting_started/mix/1.markdown b/getting_started/mix/1.markdown index 152be0012..93088fdce 100644 --- a/getting_started/mix/1.markdown +++ b/getting_started/mix/1.markdown @@ -159,11 +159,12 @@ end ### 1.4.1 Source Code Management (SCM) -In the example above, we have used `git` to specify our dependency. Mix was designed in a way it can support multiple SCM tools, by default it ships with `:git` and `:raw`. The most common options are: +In the example above, we have used `git` to specify our dependency. Mix was designed in a way it can support multiple SCM tools, by default it ships with `:git` and `:path`. The most common options are: * `:git` - the dependency is a git repository that is retrieved and updated by Mix; -* `:raw` - the dependency is simply a raw path in the filesystem; -* `:compile` - how to compile the dependency, more information in the next section; +* `:path` - the dependency is simply a path in the filesystem; +* `:compile` - how to compile the dependency; +* `:app` - the path of the application expected to be defined by the dependency; Each SCM may support custom options. `:git` supports the following: @@ -186,7 +187,7 @@ If the dependency does not contain any of the above, you can specify a command d compile: "./configure && make" {% endhighlight %} -If `:noop` is given to `:compile`, nothing is done. +If `:compile` is set to false, nothing is done. ### 1.4.3 Repeatability From 6aaf1fac12eaab4720e0fb9a9660f7ba3c46d8ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sun, 20 Jan 2013 12:12:28 -0700 Subject: [PATCH 326/437] mix iex -> iex -S mix --- getting_started/mix/1.markdown | 2 +- getting_started/mix/2.markdown | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/getting_started/mix/1.markdown b/getting_started/mix/1.markdown index 93088fdce..e5212f3c0 100644 --- a/getting_started/mix/1.markdown +++ b/getting_started/mix/1.markdown @@ -30,7 +30,7 @@ Mix will create a directory named `my_project` with few files in it: Let's take a brief look at some of these. -> Mix is an Elixir executable. This means that in order to run `mix`, you need to have elixir's executable in your PATH. If not, you can run it by passing the script as argument to elixir: +> Note: Mix is an Elixir executable. This means that in order to run `mix`, you need to have elixir's executable in your PATH. If not, you can run it by passing the script as argument to elixir: > > $ bin/elixir bin/mix new ./my_project > diff --git a/getting_started/mix/2.markdown b/getting_started/mix/2.markdown index 650632e5f..c372d8cbc 100644 --- a/getting_started/mix/2.markdown +++ b/getting_started/mix/2.markdown @@ -37,7 +37,7 @@ defmodule Stacker.Server do end {% endhighlight %} -Our server defines three callbacks: `init/1`, `handle_call/3` and `handle_cast/2`. We never call those functions directly, they are called by OTP whenever we interact with the server. We will go into details about these soon, let's just ensure it works as expected. To do so, run `mix iex` and type the following: +Our server defines three callbacks: `init/1`, `handle_call/3` and `handle_cast/2`. We never call those functions directly, they are called by OTP whenever we interact with the server. We will go into details about these soon, let's just ensure it works as expected. To do so, run `iex -S mix` on your command line to start iex with mix and type the following: # Let's start the server using Erlang's :gen_server module. # It expects 3 arguments: the server module, the initial @@ -48,7 +48,7 @@ Our server defines three callbacks: `init/1`, `handle_call/3` and `handle_cast/2 # Now let's push something onto the stack iex> :gen_server.cast(pid, { :push, 13 }) :ok - + # Now let's get it out from the stack # Notice we are using *call* instead of *cast* iex> :gen_server.call(pid, :pop) @@ -99,7 +99,7 @@ Of what use is a server if we cannot crash it? It is actually quite easy to cras # Let's get our initial item: iex> :gen_server.call(pid, :pop) :hello - + # And now let's do an unknown call: iex> :gen_server.call(pid, :pop) @@ -121,12 +121,12 @@ Create a file at `lib/stacker/supervisor.ex` with the following: {% highlight ruby %} defmodule Stacker.Supervisor do use Supervisor.Behaviour - + # A convenience to start the supervisor def start_link(stack) do :supervisor.start_link(__MODULE__, stack) end - + # The callback invoked when the supervisor starts def init(stack) do children = [ worker(Stacker.Server, [stack]) ] @@ -165,7 +165,7 @@ end The `start_link` function is quite similar to how we were starting our server with one extra argument: `{ :local, :stacker }`. This argument registers the server in our local nodes, allowing it to be invoked by the given name (in this case, `:stacker`), instead of the `pid`. -With our supervisor in hand, let's start the console by running `$ mix iex` once again, which will recompile our files too: +With our supervisor in hand, let's start the console by running `iex -S mix` once again, which will recompile our files too: # Now we will start the supervisor with a default stack iex> Stacker.Supervisor.start_link([:hello]) @@ -191,7 +191,7 @@ It crashes exactly as before but it is restarted right away with the default sta iex> :gen_server.call(:stacker, :unknown) ... 5 times ... - + iex> :gen_server.call(:stacker, :unknown) ** (exit) {:noproc,{:gen_server,:call,[:stacker,:unknown]}} gen_server.erl:180: :gen_server.call/2 @@ -231,7 +231,7 @@ end The `Application.Behaviour` expects two callbacks, `start(type, args)` and `stop(state)`. We are required to implement `start/2` though we have decided to not bother about `stop(state)` for now. -If everything works correctly, all you need to do is to start `$ mix iex` once again. Our files are going to be recompiled and the supervisor (and consequently our server) will be automatically started: +If everything works correctly, all you need to do is to start `iex -S mix` once again. Our files are going to be recompiled and the supervisor (and consequently our server) will be automatically started: iex> :gen_server.call(:stacker, :pop) :hello @@ -255,7 +255,7 @@ end When running tasks on Mix, Mix will ensure the application and all application dependencies are started. This can also be done via command line with the flag `--app`: $ elixir -pa ebin --app my_project - + You may also start which application individually via the command line using [Erlang's :application module](http://www.erlang.org/doc/man/application.html): :application.start(:my_project) From 79dcfaa44c35d63f28061e1b3e4738a311ca57fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Mon, 21 Jan 2013 16:07:45 -0700 Subject: [PATCH 327/437] Update quoted representation --- getting_started/5.markdown | 52 +++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 21 deletions(-) diff --git a/getting_started/5.markdown b/getting_started/5.markdown index bb5be26bf..e7efa776e 100644 --- a/getting_started/5.markdown +++ b/getting_started/5.markdown @@ -11,38 +11,48 @@ An Elixir program can be represented by its own data structures. This chapter wi ## 5.1 Building blocks of an Elixir program -The building block of Elixir is a tuple with three elements, for example: +The building block of Elixir is a tuple with three elements. The function call `sum(1,2,3)` is represented in Elixir as: {% highlight ruby %} -{ :sum, 1, [1, 2, 3] } +{ :sum, [], [1, 2, 3] } {% endhighlight %} -The tuple above represents a function call to sum passing 1, 2 and 3 as arguments. The tuple elements are: - -{% highlight ruby %} -{ tuple | atom, integer, list | atom } -{% endhighlight %} - -* The first element of the tuple is always an atom or another tuple in the same representation; -* The second element of the tuple is always an integer representing the line number; -* The third element of the tuple is either a list of arguments for the function call or an atom. When an atom, it means the tuple represents a variable, not a function call. - You can get the representation of any expression by using the quote macro: iex> quote do: sum(1, 2, 3) - { :sum, 0, [1, 2, 3] } + { :sum, [], [1, 2, 3] } -Everything in Elixir is a function call and can be represented by such tuples. For example, operators are represented as such: +Operators are also represented as such tuples: iex> quote do: 1 + 2 - { :+, 0, [1, 2] } + { :+, [], [1, 2] } Even a tuple is represented as a call to `{}`: iex> quote do: { 1, 2, 3 } - { :{}, 0, [1, 2, 3] } + { :{}, [], [1, 2, 3] } + +Variables are also represented using tuples, except the last element is an atom, instead of a list: + + iex> quote do: x + { :x, [], Elixir } + +When quoting more complex expressions, we can see the representation is composed of such tuples, which are nested on each other resembling a tree where each tuple is a node: + + iex> quote do: sum(1, 2 + 3, 4) + { :sum, [], [1, { :+, [], [2, 3] }, 4] } + +In general, each node (tuple) above follows the following format: + +{% highlight ruby %} +{ tuple | atom, integer, list | atom } +{% endhighlight %} + +* The first element of the tuple is an atom or another tuple in the same representation; +* The second element of the tuple is an list of metadata, it may hold information like the node line number; +* The third element of the tuple is either a list of arguments for the function call or an atom. When an atom, it means the tuple represents a variable. -The only exception to this rule are the five Elixir literals below. Literals are data types that when quoted return themselves. They are: +Besides the node defined above, there are also five Elixir literals that when quoted return themselves (and not a tuple). They are: {% highlight ruby %} :sum #=> Atoms @@ -82,7 +92,7 @@ unless 2 + 2 == 5, do: call_function() Our `unless` macro will receive the following: {% highlight ruby %} -unless({:==, 1, [{:+, 1, [2, 2]}, 5]}, { :call_function, 1, [] }) +unless({:==, [], [{:+, [], [2, 2]}, 5]}, { :call_function, [], [] }) {% endhighlight %} Then our `unless` macro will call `quote`, to return a tree representation of the `if` clause. This means we are transforming our `unless` into an `if`! @@ -115,7 +125,7 @@ end if(!(2 + 2 == 5), do: call_function()) {% endhighlight %} -In other words, unquote is a mechanism to inject expressions into the tree being quoted and it is an essential tool for meta-programming. Elixir also provides `unquote_splicing` allowing us to inject many expressions at once. +In other words, `unquote` is a mechanism to inject expressions into the tree being quoted and it is an essential tool for meta-programming. Elixir also provides `unquote_splicing` allowing us to inject many expressions at once. We can define any macro we want, including ones that override the built-in macros provided by Elixir. For instance, you can redefine `case`, `receive`, `+`, etc. The only exceptions are Elixir special forms that cannot be overridden, [the full list of special forms is available in `Kernel.SpecialForms`](/docs/stable/Kernel.SpecialForms.html). @@ -167,7 +177,7 @@ HygieneTest.go Variables hygiene only works because Elixir annotates variables with their context. For example, a variable `x` defined at the line 3 of a module, would be represented as: - { :x, 3, nil } + { :x, [line: 3], nil } However, a quoted variable is represented as: @@ -178,7 +188,7 @@ defmodule Sample do end end -Sample.quoted #=> { :x, 3, Sample } +Sample.quoted #=> { :x, [line: 3], Sample } {% endhighlight %} Notice that the third element in the quoted variable is the atom `Sample`, instead of `nil`, which marks the variable as coming from the `Sample` module. Therefore, Elixir considers those two variables come from different contexts and handle them accordingly. From c3f5f089428c5fee2bf6afa328811facc520aebe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Fri, 25 Jan 2013 21:46:15 -0700 Subject: [PATCH 328/437] Small adjustments to mix related goodies --- getting_started/2.markdown | 6 ++++-- getting_started/mix/2.markdown | 8 +++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/getting_started/2.markdown b/getting_started/2.markdown index 0656bccf1..28dc1260e 100644 --- a/getting_started/2.markdown +++ b/getting_started/2.markdown @@ -201,12 +201,14 @@ In general, you will find working with binaries and strings in Elixir a breeze. One of Elixir assets is easy integration with the existing Erlang ecosystem. Erlang ships with a group of libraries called OTP (Open Telecom Platform). Besides being a standard library, OTP provides several facilities to build OTP applications with supervisors that are robust, distributed and fault-tolerant. -Since an Erlang module is nothing more than an atom, invoking those libraries from Elixir is quite straight-forward. For example, we can call the [function `flatten` from the module `lists`](http://www.erlang.org/doc/man/lists.html#flatten-1) as follows: +Since an Erlang module is nothing more than an atom, invoking those libraries from Elixir is quite straight-forward. For example, we can call the [function `flatten` from the module `lists`](http://www.erlang.org/doc/man/lists.html#flatten-1) or interact with [the math module](http://www.erlang.org/doc/man/math.html) as follows: iex> :lists.flatten [1,[2],3] [1,2,3] + iex> :math.sin :math.pi + 1.2246467991473532e-16 -Erlang's OTP is very well documented and easily navigable: +Erlang's OTP is very well documented and we will learn more about building OTP applications in the Mix chapters: * [OTP docs](http://www.erlang.org/doc/) * [Standard library docs](http://www.erlang.org/doc/man/STDLIB_app.html) diff --git a/getting_started/mix/2.markdown b/getting_started/mix/2.markdown index c372d8cbc..bae52fb8e 100644 --- a/getting_started/mix/2.markdown +++ b/getting_started/mix/2.markdown @@ -198,7 +198,7 @@ It crashes exactly as before but it is restarted right away with the default sta The sixth message no longer generates an error report, that happens because our server was no longer started automatically and Elixir returns `:noproc`, meaning there isn't a process named `:stacker`. The number of restarts allowed and its time interval can be customize by passing options to the `supervise` function. Different strategies can be chosen for both the supervisor and the worker. For more information on the supported options, [check the documentation for `Supervisor.Behaviour`](http://elixir-lang.org/docs/stable/Supervisor.Behaviour.html). -## 2.3 Who supervisors the supervisor? +## 2.3 Who supervises the supervisor? We have built our supervisor, but a pertinent question is: who supervisors the supervisor? To answer this question, OTP contains the concept of applications. Applications can be started and stopped as an unit and, when doing so, they are often linked to a supervisor. @@ -247,7 +247,7 @@ The project dependencies may contain your test framework or a compile-time only {% highlight ruby %} def application do [ registered: [:stacker], - applications: [:some_dep_], + applications: [:some_dep], mod: { Stacker, [:hello] } ] end {% endhighlight %} @@ -262,6 +262,4 @@ You may also start which application individually via the command line using [Er You can learn more about the other keys allowed in the application specification [in the applications chapter from Learn You Some Erlang](http://learnyousomeerlang.com/building-otp-applications). -Finally, notice that `mix new` supports a `--sup` option, which tells Mix to generate a supervisor with an application module callback, automating some of the work we have done here. - -With final note, we have finished this chapter. We have learned how to create servers, supervise them, and hook them into our application lifecycle. In the next chapter, we will learn how to create custom tasks in Mix. +Finally, notice that `mix new` supports a `--sup` option, which tells Mix to generate a supervisor with an application module callback, automating some of the work we have done here (try it!). We have learned how to create servers, supervise them, and hook them into our application lifecycle. In the next chapter, we will learn how to create custom tasks in Mix. From 07f7ee2135aec5d36c75d1df547d2f35bc47da08 Mon Sep 17 00:00:00 2001 From: Yurii Rashkovskii Date: Sat, 26 Jan 2013 22:10:18 -0800 Subject: [PATCH 329/437] Update crash-course.markdown Fix error in the sum function example (Function Overloading) --- crash-course.markdown | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crash-course.markdown b/crash-course.markdown index 275863c84..d0951ddae 100644 --- a/crash-course.markdown +++ b/crash-course.markdown @@ -506,10 +506,10 @@ In both Erlang and Elixir, a function is not identified only by its name, but by **Erlang** {% highlight erlang %} -sum() -> 0; -sum(a) -> a; -sum(a, b) -> a + b; -sum(a, b, c) -> a + b + c. +sum() -> 0. +sum(A) -> A. +sum(A, B) -> A + B. +sum(A, B, C) -> A + B + C. {% endhighlight %} **Elixir** From 7ecd333099694060904d969730951f0f57937813 Mon Sep 17 00:00:00 2001 From: Alexei Sholik Date: Sun, 27 Jan 2013 13:36:48 +0200 Subject: [PATCH 330/437] Erlang vars must be capitalized Conflicts: crash-course.markdown --- crash-course.markdown | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/crash-course.markdown b/crash-course.markdown index d0951ddae..054f247a6 100644 --- a/crash-course.markdown +++ b/crash-course.markdown @@ -168,7 +168,7 @@ Elixir allows you to omit parentheses in function calls, Erlang does not. | Erlang | Elixir | -------------------------------------- | some_function(). | some_function | - | sum(a, b) | sum a, b | + | sum(A, B) | sum a, b | Invoking a function from a module uses different syntax. In Erlang, you would write @@ -390,7 +390,7 @@ some_fun() -> io:format('~s~n', ['Hello world!']). % This one works only with lists -some_fun(List) when is_list(List) -> +fun(List) when is_list(List) -> io:format('~s~n', List). % Non-exported functions are private @@ -474,9 +474,9 @@ Pattern matching in Elixir is based on Erlang's implementation and in general ve **Erlang** {% highlight erlang %} -loop_through([h|t]) -> - io:format '~p~n', [h], - loop_through(t); +loop_through([H|T]) -> + io:format '~p~n', [H], + loop_through(T); loop_through([]) -> ok. @@ -506,9 +506,9 @@ In both Erlang and Elixir, a function is not identified only by its name, but by **Erlang** {% highlight erlang %} -sum() -> 0. -sum(A) -> A. -sum(A, B) -> A + B. +sum() -> 0; +sum(A) -> A; +sum(A, B) -> A + B; sum(A, B, C) -> A + B + C. {% endhighlight %} @@ -651,7 +651,7 @@ Anonymous functions are first-class values, so they can be passed as arguments t **Erlang** {% highlight erlang %} -square(x) -> x * x. +square(X) -> X * X. lists:map(fun square/1, [1, 2, 3]). %=> [1, 4, 9] @@ -850,7 +850,7 @@ It can be called from Erlang as follow: {% highlight erlang %} -module(erlang_contrived). --compile(export_all). +-export([uglify/1]). uglify(Bin) -> 'Elixir-Contrived':ugly_binary(Bin). @@ -860,11 +860,11 @@ However this syntax is suboptimal. For this reason, Elixir ships with a parse tr {% highlight erlang %} -module(erlang_improved). --compile(export_all). +-export([prettify/1]). -compile({parse_transform, elixir_transform}). -pretiffy(bin) -> - 'Elixir.Contrived':pretty_binary(bin). +prettify(Bin) -> + 'Elixir.Contrived':pretty_binary(Bin). {% endhighlight %} ### Rebar integration From 62378e67a9d0dc5e9f6cceffd315cb221064be98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sun, 27 Jan 2013 09:20:45 -0700 Subject: [PATCH 331/437] Move truthy and false operators section to chapter 1 --- getting_started/1.markdown | 24 ++++++++++++++++++++++++ getting_started/2.markdown | 36 ++++-------------------------------- 2 files changed, 28 insertions(+), 32 deletions(-) diff --git a/getting_started/1.markdown b/getting_started/1.markdown index 69af696cf..9e7f30f1b 100644 --- a/getting_started/1.markdown +++ b/getting_started/1.markdown @@ -189,6 +189,30 @@ Giving a non-boolean will raise an exception: > Note: If you are an Erlang developer, `and` and `or` in Elixir actually map to the `andalso` and `orelse` operators in Erlang. +Besides those boolean operators, Elixir also provides `||`, `&&` and `!` which accept arguments of any type. For these operators, all values except `false` and `nil` will evaluate to true: + + # or + iex> 1 || true + 1 + iex> false || 11 + 11 + + # and + iex> nil && 13 + nil + iex> true && 17 + 17 + + # ! + iex> !true + false + iex> !1 + false + iex> !nil + true + +As a rule of thumb, use `and`, `or` and `not` when you are expecting a booleans. If any of the arguments are non-booleans, use `&&`, `||` and `!`. + Elixir also provides `==`, `!=`, `===`, `!==`, `<=`, `>=`, `<` and `>` as comparison operators: iex> 1 == 1 diff --git a/getting_started/2.markdown b/getting_started/2.markdown index 02e03e680..f5a28d91c 100644 --- a/getting_started/2.markdown +++ b/getting_started/2.markdown @@ -361,35 +361,7 @@ In Elixir, all values except `false` and `nil` evaluate to `true`. Therefore the If none of the expressions above return true, an error would be raised. -### 2.8.3 Other operators - -In the previous chapter, we discussed the boolean operators `and`, `or` and `not`. These operators are strict in that they only accept booleans as their first argument. - -Elixir provides three operators with similar functionality but that accept arguments of any type: `||`, `&&` and `!`. For these operators, all values except `false` and `nil` will evaluate to true. - - # or - iex> 1 || true - 1 - iex> false || 11 - 11 - - # and - iex> nil && 13 - nil - iex> true && 17 - 17 - - # ! - iex> !true - false - iex> !1 - false - iex> !nil - true - -As a rule of thumb, use `and`, `or` and `not` when both arguments are expected to be booleans, as in guard clauses. If any of the arguments are non-booleans, use `&&`, `||` and `!`. - -### 2.8.4 Case +### 2.8.3 Case In section 2.5, we introduced pattern matching via the `=` operator. Sometimes, however, it is convenient to compare an expression against several expressions until we find a matching one. In this scenario, we use `case`: @@ -485,7 +457,7 @@ However, the example above will always fail. If the argument is a list, calling In such cases, if there is an error in one of the guards, it won't affect the next one. -### 2.8.5 Functions +### 2.8.4 Functions In Elixir, creating a function is similar to the `case` mechanism we have just seen. It allows us to define a function with many clauses: @@ -513,7 +485,7 @@ As Elixir is an immutable language, the binding of the function is also immutabl (fn -> x = 2 end).() x #=> 1 -### 2.8.6 Try +### 2.8.5 Try The next control-flow mechanism is `try/catch/after`: @@ -560,7 +532,7 @@ The common strategy is to explicitly make all arguments that are required after x #=> returns the value of x or nil for failures -### 2.8.7 Receive +### 2.8.6 Receive The last control-flow mechanism we are going to discuss is essential to Elixir's and Erlang's actor mechanism. In Elixir, the code is run in separate processes that exchange messages between them. Those processes are not Operating System processes (they are actually quite light-weight) but are called so since they do not share state with each other. From ce221cca80fada11e4625243784fceb352c75b28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sun, 27 Jan 2013 22:03:41 -0700 Subject: [PATCH 332/437] Add v0.8.0 announcement blog post --- _includes/search.html | 2 +- ...2013-01-27-elixir-v0-8-0-released.markdown | 103 ++++++++++++++++++ images/contents/hash-dict-fetch.png | Bin 0 -> 8760 bytes images/contents/hash-dict-update.png | Bin 0 -> 8857 bytes 4 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 _posts/2013-01-27-elixir-v0-8-0-released.markdown create mode 100644 images/contents/hash-dict-fetch.png create mode 100644 images/contents/hash-dict-update.png diff --git a/_includes/search.html b/_includes/search.html index 5a60b8001..3410cf9cf 100644 --- a/_includes/search.html +++ b/_includes/search.html @@ -1,6 +1,6 @@ diff --git a/_posts/2013-01-27-elixir-v0-8-0-released.markdown b/_posts/2013-01-27-elixir-v0-8-0-released.markdown new file mode 100644 index 000000000..1033f99d5 --- /dev/null +++ b/_posts/2013-01-27-elixir-v0-8-0-released.markdown @@ -0,0 +1,103 @@ +--- +layout: post +title: Elixir v0.8.0 released +author: José Valim +category: Releases +excerpt: In the last 9th January, we celebrated two years since Elixir's first commit and to celebrate this occasion we have prepared a big release. Elixir v0.8 is out, with documentation, optimizations, bug fixes and shinning new features. Let's take a look at them! +--- + +In the last 9th January, we celebrated [two years since Elixir's first commit](https://github.com/elixir-lang/elixir/commit/337c3f2d569a42ebd5fcab6fef18c5e012f9be5b) and to celebrate this occasion we have prepared a big release. Elixir v0.8 is out, with documentation, optimizations, bug fixes and shinning new features. Let's take a look at them! + +## OTP applications + +One of the goals for the v0.8 release was better integration with OTP applications. By passing the `--sup` optiont to Mix, you can start a new OTP Application containing application callbacks and a supervisor: + + mix new my_app --sup + +And applications can be started directly from the command line as well: + + elixir --app my_app + +We have written a whole [guide chapter about creating OTP applications, supervisors and servers](/getting_started/mix/2.html). Give it a try! + +## Improved Unicode support + +Elixir favors the use of utf-8 binaries since its first release. In the latest releases, we took it up a notch by adding Unicode support, built upon the Unicode Standard 6.2.0. Elixir v0.8 takes this even further, adding more convenience functions and better support to named sequences: + +{% highlight elixir %} +String.capitalize("fiN") #=> "Fin" +{% endhighlight %} + +The example above contains a string with only two codepoints, [the codepoint fi](http://www.fileformat.info/info/unicode/char/FB01/index.htm) and [the codepoint n](http://www.fileformat.info/info/unicode/char/006E/index.htm). Look how Elixir properly capitalizes the string, returning a new string made of three codepoints (all ascii letters). + +Learn more about [Unicode support with the String module](http://elixir-lang.org/docs/master/String.html). + +## AST metadata + +As per this release, Elixir AST notes can contain metadata. This metadata is compilation time only but may allow macros to annotate important information in the AST nodes, like line numbers, file and other library specific information. If you quote an Elixir expression, you can see the metadata slot: + +{% highlight elixir %} +quote do: hello("world") +{ :hello, [], ["world"] } +{% endhighlight %} + +In the example above, we can see the AST representation of the expression `hello("world")`. It is made of a tuple of three elements, the first one is the function name represented by the atom `:hello`, the second one is a keyword list containing metadata (in this case, no metadata is available) and the third is a list of arguments, containing the string "world". + +By default, `quote` does not annotate line numbers, but we can pass it as an option: + +{% highlight elixir %} +quote line: __ENV__.line, do: hello("world") +{ :hello, [line: 9], ["world"] } +{% endhighlight %} + +Now, we can see the metadata spot being used to annotate the line number. This change allowed us to take our macros one step further... + +## Macros expansion + +Prior to this release, Elixir had limitted expension of imports and aliases. We decided this would be an important issue to tackle on this release, as people are building more and more projects on top of Elixir. + +Imagine you manually implemented `unless` as a macro, that does the opposite of `if`: + +{% highlight elixir %} +defmacro unless(expr, opts) do + quote do + if(!unquote(expr), unquote(opts)) + end +end +{% endhighlight %} + +When some code call the `unless` macro above, in previous Elixir versions, it would expect the `if` macro to be available at the caller. This may not be necessarily true and, even worse, another implementation of the `if` macro, not compatible to the one above, could be available. + +Elixir v0.8 ensures that the `unless` macro above will expand to the same `if` macro available when quoted, guaranteeing different libraries can integrate easily without imposing hidden requirements. + +You can read more about [macros in the getting started guide](http://elixir-lang.org/getting_started/5.html) or [go deep into the quote macro docs](http://elixir-lang.org/docs/master/Kernel.SpecialForms.html#quote/2). + +## A new way to manipulatet with paths + +Elixir v0.8 contains a bit of house cleaning too. We have created [the Path module](http://elixir-lang.org/docs/master/Path.html) to accommodate functions used to manipulate filesystem paths and have also added functions like [`System.tmp_dir` and `System.user_home`](http://elixir-lang.org/docs/master/System.html) which are meant to work accross different operating systems and are very handy when scripting. + +## The new HashDict + +For last but not least, Elixir ships with a [new HashDict implementation](https://github.com/elixir-lang/elixir/blob/master/lib/elixir/lib/hash_dict.ex). In Erlang, there are different key-value store implementations and often you need to pick which one is the best for you based on the average size of the dictionary. Generally speaking, [orddicts](http://www.erlang.org/doc/man/orddict.html) are efficient and fast when you want to hold a handful of items, otherwise you should consider [gb_trees](http://www.erlang.org/doc/man/gb_trees.html) unless you want to hold thousands of items, when then [dict](http://www.erlang.org/doc/man/dict.html) becomes your best option. The fact those implementations do not provide the same API, makes it harder to change your code when you realize another implementation would be better fit. + +For Elixir, we decided to have a single dictionary implementation that would scale as needed. It would start as a compact representation for a handful of items and expand and rehash accordingly as new items are added or removed, providing fast access and modification times on all ranges. We are glad to say our goals were reached and a new `HashDict` implementation ships with Elixir v0.8. + +Let's take a look at some benchmarks: + +![Comparison of fetch times with string keys](/images/contents/hash-dict-fetch.png) + +![Comparison of update times with string keys](/images/contents/hash-dict-update.png) + +For each number of keys, we have measured and normalized those values against `HashDict` results. This way it is easy to see which implementation takes more or less time compared to Elixir's implementation. + +`orddict` is still the faster representation for small ranges since it is a simple list. However, `HashDict` is able to be relatively fast compared to `orddict` for those small ranges and the fastest solution once you have dozens of keys. [Those results can be verified when using other types as keys as well](https://gist.github.com/436a9d2bca5051a6dfab). + +Finally, given `HashDict` starts with a compact representation, it also takes less memory. Compared to the `dict` implementation, an empty `HashDict` takes only 5 words, while `dict` takes 47. + +## Wrapping up + +We continue actively working on Elixir and this release is the result of our efforts on different areas! We have exciting plans and newer possibilities to explore, as a new release of Erlang OTP comes out in a couple weeks. + +Also, we previously announced Elixir is going to be released frequently, every 2 to 4 weeks. We have made a small detour to get v0.8.0 out of the door, but we are back to our regular schedule as of today! + +[Celebrate with us and give Elixir a try](/getting_started/1.html)! \ No newline at end of file diff --git a/images/contents/hash-dict-fetch.png b/images/contents/hash-dict-fetch.png new file mode 100644 index 0000000000000000000000000000000000000000..31abaf84d3cead77e02867675f2a2d0aec26c5f2 GIT binary patch literal 8760 zcmd5?cR1DW-&ZLq4pC$rvSnsu9OGmjk`=Pa-r31c%J>Qyk<4RnWrh<;*(-Z*;n;f~ zp8KfZe6HuWp6j`;=O3K=d_MPhkJtTvz21UVln{hhD6in);1J5oNk7EFIj@6*bMD^d z^I&8tL1qjGhwfBfT0;HV@JixU74?CGFHy|ivp=k?X`?dbspZvsCod%LzrL^05R@H+ zZ_RI=@{pD%Tb0a&_^vp8aOQK_(hb$J_v&`WMkI#m4cWJbALLNhWwQq5r?B2){dtNJ z>k)B#y2jONW8~&rYxJ&utlFZ}t;VxvB5CX*&HgzYoG&x(&u@dh+zSLh7Kp(QDA-zx z6!^pCG7ipj2zaK84t#>){*#A{piWEu1&cjdo}Qk9R^6t9AB;9OHk{J^_&jJW#EtLY zzdurLN9#Tt@#V`sMA(3hPzO=1PJQ;)RG&tm(z^X>A=;_m5~Z>FE5{+Ji`Km&oDR~E+FtIW+<B)=v4M+cI&L0>C06NyIv%ldJhqxS%QSoeL3_AvadOiJv1z{*6^Rt z6DSf?->Y$SbaXliCS}QvS?FqC94^b#TO#MuyMuDAdvUQ?3_bq&s3TE?ot=HB_4eJn zeIp}BIax_0$oCI2GZo`&*1ujI4q-zlD8>uiwIBET*%l}GWK^YbYjd+9lxiSfn{Oz5 z7u~0T4mt61A0I2RP{#bx-qx1DZ`EDWDSmXk)v25yw9)dGT?4Y*g_J7Lt%#{!9x7?9 zOQGp9(w8osF*7sUL?NXDA-tQ)aLo4VSatvWXr;3Sa0PeG{`8vf>Cs1%MuX2D8Y1)H zLv>puZn6D@c)fLotFb<6xwCxgi>+d!qz7q_0xbRWvkhbSp!9S`tNHnP`0;wZQ=ZSw zfcg^BupKF?-N%VfMC79tSlQU_7beWL#%dn0Jux;;B&-7 z& z7=H_5!xOL{M@2_p*O<(uipFI1u|LXJ`H0#Z_v|L-(@ti%aew%s;NI#OduRj$!kPtj zh|a@wcv&q8gB9C7}Q! zyD@*)sujkKF}I1gv~x}*VuQ*t4|>CWk4=6ACpNp!gbJo}n)eypiWB#)!ceGjQ?+a? zFWVxx2$sfkmnTll?7cJf@Ha=5C_jGu7-pCnX4uUpv6(J0T;{$;-G#JS4>3HJEOf2! z?ASj%%(dt`#jN?3wG?u`ZH?s)k=76q6s#yMRi}g>G%Ihs+? ziaXoK7Vx9ElVh8KLhbxPU|%+yLjCG;6lyfW@5c4(K~FO1?tZM27^;Y7dpO~H`uQ7I z=%WH1V4RxR-JueT0uf=~6V!VqPU}WjOW$%rJaZveN-HZXCz~v##3vIqm?nmBQAgS# z>ZWVLNl8ftb8nVkn(TM=i)m$zD3M?=n7PKanj`C}nrL!X0; zQqR3rPP?I-^14aML&-c6-?&+>laaxkjI{P1nVs%(doJ;r-Oec}*fmIDh|QjfExrF{ z$hLfEmZS@*izG|R$6Jc0@jZ5|l)rBvFCU!Cdzg{x8>c$apUe=WabqjC_Bg}GxxdJ; zwmy(ZH`#Z-0~&IJ-7HT&iW!Yq$>2M>ptiO(l>2UX&1T{uI>$f2#mu{-$QNVNSL@2M zi)TI|wrers@Hjv%3jt|S%+oA-G;;Nz#s}kZFkWh)9ida4}{?ZUT?{_$|RjL%;m~W6hyjOzZez zTlbNiR8otOPcY0!J`YzO)$OzW1CfJ;AXWQ7IcRB(yxsNE&|dZ;)U@2&-ioB_;#rw#s3*bC{Gw zi&;Pn3)cq_MwN?NxJkQ~!yLT=R*2d>(Ay8<1r){9BG|aYB0RG0uWv8*6wrQ+m>Tl6 z)D;uDX;SfIOnsV{mv@;(0hc=W7Tf4@iAQbxxVps1BLp1oc%^dMraet?zc7B&9G!a`y>V!0X}|2!+f%@&+;Ho zfvtwyV-M=eqJpYBCJh9xhC2;eyJ2BYC=Wuro=inF^^Q|QK}CB$t=xpXtE;8Zo%);} z=k-a6KKauVOxZwtZ{yQ^>?y5oikBA9P``HET^>T~7jDcnYQ}NgrCa;Fmz0>FQ}DqU zU`<$?*5k)1)U_^)58Hp%ww$aO?)F=>%;Z+6o4pnG2}X~UcMKp{ilcWY>-@34!&LfU zs-ER(mzWnTyjk1y(tfIhW{!xVUi^_3c=^GR*@easS7YO80R18s9n?E7bq1^5ii(QX zqLjrcu3ei7g0!2LyjFZUR%+F=zV5IhR%uPx_JVEAMj;T~1I1~P5yz`;wNzprrMvF6 zb|d9t8{bILZY6ANY~O->e0(}Zx7r3jn)C^W5j^;Pc3rhBRc-Ct%KoK9#@Wizas{RP z>4h`(J$Jm$Ts#v>B{*Btjr4Hcn+l{YkK!0w7RPM&gu_qvzlV_9nJH2diSMUWg$&bZ z2%9)D<%OerZBO!+Yg<~!r`tGn%bSE#`B$Pw!t_!P%L}%4en4R^a>L9~!4HEWNZH#~ zqqQ=4g{_GqZnNDaBYib_jWnJQsv_sPAW7WHq~BAl*%yW7P@A(-Nm>poNU3{)UF+cB z=8N4K7cX8c&KmIHOcy8$^4cA;KqLV|V$%al}kq&$gL8>|| zbRn-X$cpatswuwb$0r~tJ=sQ-Jp=jVd)Slwhp}e9mg<-hzfFHznz_Mr--+I(e^?%Y zBH(6>!JH-o_0t%`D7ISbQ`Ue}`4q~0_Y`zdRc5(Kp-7V4v*MPb07~7NI3^sIg#g(0 z=4P?wAPmW~@S)|$mEmNWCk{}UxN8}-L}9VZK_?+X8^I z2Qo1+MX@Na{zz*qw;RddBi1a`!-qgMW?%X-F@6{#cL6m#R zE}SbNv;N{$GP#`34pWlPo_%utk-%fp5Xq$QP)*JM#S2OYw@=`UsAfh!GBUDE+H}#3 zrp``fC8Z>6rXSH@7^!}?uBUubS!L25sdCLb498RIp8~*UY+?c~dt+ncM@0s9&=4b% z#KbeB-k50&A2`8#bN!YS^a>~^Xoa2959cMwSl+e&944qX$5xKXhsv&qaGEk2yS4Gp zwMVPfRbKK1vas#Fz0Qt~a++CCLiv0;4a_nlnoWU}$qTf_PSt@ir9{|WPEN($urgGs zb*9wNNiJO0V`KVzSC`6?7D3d)a@+Y7DVJ=^iJH&5f2dVIU9nwMDHrPQKj|$#!Ck2( zfT;x*=#)izhkM9$c$9+TuHS&q_8t^lG+N&z^H&%DQ?wFSB-bQgIHF0tA{*O1Ae+Yn#dI4O?%XhT|PAgL~PQW zpom=R&Is9Z74q0#c=6)ARRY}C2h>u3z1lTeTHoXSjqdL5ouz@mSFb3@rm>!<;FV5V z#KXnS);y)u3si{Va0fBOZGaMTMXN8>p|(0i*fk4}(RoDygjAVfO^`)&UmoydAgzxO zsLZaCbAc*P^z?XZ_?GAH^6h}Z&z^gRC!6FV;W>YbP*#EAVzUrx_2eAK8VD%~Nes84 z4}gYu?{2Q>KlJAKOJt6s+|_c+lanXX<)hLasL(1$ra93_d{SoqOVE}~i{Vl$@1tEs zMa43j2L=X7*Lx)VFG0mT)S(ekx)o1WOrd1too?cU%K(SX1J6yYt# zZKsrHiDl@HVE~?TB8;h8`QxikDz6v3p!fGdMY%9swiJC^tyFI3FW&hOF_}<%UrpC~ z!xNjRfKYj2b_VqKx~sXCMmz>E9)A=%)7e z(BNPS0o%cR?ULnVM{X>?TYaFe-V6AO{phEUpk(2pCp`~1pxFE40uq2?)J6FN6z@E_LU`ep2UT&~wz^ngeg69^CcSJ-) zU@(}F(6jG<+;DeyC#!hhZte@!BmI4dv8bk|CSd8*)YO+RUuG!8>Wq5quNy@$#h(9t zY-NepH?Lneb#wsL8kOLa*@wT6xp3Rm!U7>Jtwqfr_rUpQ8$KanXh;ZOeEVPKrXIRT zBkc5T`mvmxoVB&JwzjsctgNKu3xEBL3!{xn82T%cmTy>zsbKjp^7He*eUlbpQCC-Q zqKU9MKN$T%1lV$+T<^1o>%rz6y{O21bZjihbw|bD_I6R`<>O0BO>F^plYQvx*AEmF zqIBmxA3h`*z*TugWp&+#=EH#uJq{H1^&O8%zHf<&jj5Sg+=I-Nl$3Yx-gS3BEW`)U z^+x(E&j0=2tiTNbY0p9hTt;V}Um(Ut8!q-^`u5KbsG@@oYZe*0cG*{)oDfR3NG@gQ$c)1mOsVT;xC)K8GyDEiW%GEG$e; zPTpXDG&?uPL-%_XWkygYGcjdkXS34L83B}faQWAEyV9;PT)KFXhv@f%;mjaN=;>d$ z|K7F-Kk&1t)9mG~U+crR^@@v&Nk~bda5!{Q{3%*9jWR2dZJAB=lf>nY;1?cY5StDF zQ?cBJfB@8~<5WvM#U5KMx~;7(J3G6$m^Tx|EY?B`m9HuI8VvDB&;M(d0^os7(*M-Z zfA{*E+rI|>fuYYF2iC(n4&>Yal(?7qItxL69r`}_Objm;MM+nkU6ZC|nG=4PN0 zRAf{EvWGw*oNrH({ECPw;bQIwN=oG!^`LaL9sLxcaPChpwcqC8h+ZpqvE+>df(o>C#c~dLMMX|__SU8*kW`cJzcBqWE+hMuMF+&{Q-p%<=}X2^P=EJJPC=!^@T1{*P9d+aWOHE9z9~7 zh>DE-#N0)v@lKi;K;|u|HQfB~69z;b^EE8^{pm3fy6Q&Qsm>x(9v2Ig|NWtLEvWgy z-H$smH<)p;5DGT^DRQ7dDv*40Q&|8yT+@XfTGy);rJRD>Fu~%0hHaBEuo^dT-qI+{0Oog?b z(`pxBBewd3L);X+lxZvC8kesj567=9nT&!2FfMflj z>s>0AIP)3+M_?(eOV1`V-H5sjHh>)@g9ra!;s50z>3Og{EPRC|6U*TSV}VQi_?IQ> zht<^8`GM{RXc=mwf$A@p9tTzK9q<~kUloh*$yPG_a3O7UbW|pU?0ZAQ*}XTluweQ0 zmt}y(T%1j9w6wHXLxHxX{GPvgy8l!2976p z|Mo8Y>m>mrdHeQl_nS5UON7NSW`A=bdS{9RB$_dRaB#{4zbl48T)2i(0nf?3oR{_+ z>_RFU_+ng#$nVbpMH$e{V%PV}x6HzuO5_BX7+*+#5CMXAb9aV9AKrauXJ-a_dfUWD z1_m@_WDUj0E5NJ3?MTnfW|m||Mn=Fvh~UR}#Kp&_`@!vBT3QMa`XDJf`rBVU3#y_@ ztDa0k3SQIA+2(;FLruIgL!P#l7T&lA5)u+TJUr;T8Zm?bE8biN*7q}$I*TF@I**4` zew&9_O8|=vXVLf19zDa8v#HMg*}Nce|1|&q#bDg|-=Pl*U@V%P?Gy{)zfSUhGnkL@ zz`?PMR!RQxFZDl=M-fp`e4qe+GFBynKp56|4ZV`}LHFhW;m~z;RJ(y&HQV33MEK5~ zuEs_dMn-9o!OP8^ov{&1;Wxuj*8QM6 z1Zh#XRXuV_cT39!pvIcc0@at~6>PslWQ{|+c=qe7t3X*#hPhhLP#;t}&tD>Ayl8U(L^PhPz9~zt9Sg`q;HAc3b|}J z&1dhUr#s_F_EiWUA0KGNWMgg;6W{8z%TU$R8!gZkB=1H}HBngz-KBB&4^*pQa5EQD zx>R+ac#76s~)ol@%HxCw^^^OtOSJhQPDap;3a)Dd%)1c?AcsMsrm@P z4hL(|%}YdCPY|nZ4heUh$aO>(h|#Zr`Duh4CP4?M7?E(-Cgy4=V8An^%nwwOFLY~F zJkhtcU4F~1`Li>*_Ho_$f3%&iKt?n3@5@jiKj5+hzE2kSM!97B14lz3kll?9AXcHC zuDrhrM55VHz68o}R9$_}NQ4LEc?0`f3Mqk(9T&EtxPFT5PJtd+LB;q(c#@DK zJwJbG3{)wOH>0ER0JLQ?GcsJnhoAUA3be#V2I7igRA8TeG=p8DP5`D-{#>(*V77>Hr%9e0u=pzIE=xC2F{j-Y~d* zrm6ajI+Mg?;^@BuF*q1HH@P?AyEZ>x0lG1OidRhdc!Hj#lZw*%&Q9nbf3V%Y{i6X8 zJBp2k@z0(zFN-boOD!X)MI9!e-&BCx)OS(CKMoTH544{s!IHBnw&|v=;MUA217hS{8&KT9y?v^V3Gu6PU1BEONELkvV@*;^ zjSP*|YMl0N2?`1V%-_as4QSi^0(Qgv0N^lI0nnB-&_51Q>DxEUb}~KMU15%Do}K~? zqk{8-%ZPWpW-ZyOX#lUjpY0M85t?Y51+=#qr0p8O-M(61U)LT08jY_h(uRv2)#FRJ zYma%cU@NhjI$Z1-WtWOp*^SmYjf;x|j*khjY*0V|fSsE>+*#se%qlkn+Hr1TeEdj- zy`dF{0ct-jT)aEkd=P2tT-H7c#7@wf$^e2SL52mUJ|iouHDK@&T++;J4zw4zMp~dE zPaP5gOLTAsu-co&W!BkS<9!730wF7#8$UfgExtc_p^q%&TVtcb3}$aalhA0c^H(ey`pv)!P8VYFg;cJh44rl=vmU7c;6fS{QUG-uzRK6P<-;F z(E4d+-Ijx6YDYWZi{5^eqf-@O()^OG8@g6lGyJ4Rd&0wj3@}UCwm3d zLhV3CDD4dSLq|HpnE9Z__teMrgGpnU^+aY?O3Gt^#>E;?!6ylkQNz6BpB$yI+XFrt z2fYW}r VuIr#{wFmR!$jc~67fL>U@n4{Y|2qHx literal 0 HcmV?d00001 diff --git a/images/contents/hash-dict-update.png b/images/contents/hash-dict-update.png new file mode 100644 index 0000000000000000000000000000000000000000..8713606ab4920dcc65c7d75235e0b39ae8fd0a09 GIT binary patch literal 8857 zcmd5?WmuHmx<eerlw@3Bq1T8R#j2dA|W|# zNJ4VzCdFy+W+m~~1PKY}Lsdn29nVor5|xI|(7~4|9>3Wh8{6z8@u+5$ViWm|jgYQ9 z9g8=?uj5n0l&E!l{7(<2zhd zJ3fgA;kmiFP`In-EK2z_De1&z%7reiuprHKbbb*eN!SSqfgWO<0>*Bx&v~YNmr+Re zUd|1`Z>L0SyDm15S3PZMX<1-w*l!vwx1*w@{Q2|e?6KEo6XW}LkQA?ZCa;#x&d%Om zEi0ub8$Z6{aYxdV+5Q2H{bmzLt7{yNnds-FS#xo`nm zEy91lAo83gI*9t7FB_ZpB1Z!9Xm4G*%6_2iVO8*HDANN>(DEx1mP5h%!)5-ZfN$@_ z!jg-sSxvQ%uUNQ3CJ1vCHLlLm%_<_;6lt zV`Jwr7~E`>`fH7hjEwgZPLuV1J{ZT4(S?^ZH>^iW=T=8PIZf8)RxB(msK*PZ-3nzW zWy6eB7M+LS@GkNb+3M`L-1wLnF^l%->=ggQ5v!CW8LzE@e7$_=@H84ZR^h-88>#Uq zdMPiPivD`q4E6;mN$Tl*neBk>%3$Fkj+(U6dunUTrAlaNyz0~HMvpT4M2$z6v+yXs zVn#&$wb{w8r9MYpTi}bc4@U3A3B^>ZsHw%e%gcX7)5r;QEhEh&Ya32*>(|aM`JUi$ z_os*J%gtyilmk^iUZ&I3)V$WkulKQFSIALI>#gYg_ar+f7w)Q3^vEZxEWi0qCYuh1 zZKiXN%*`#-{a)LNo($}oVn)o$vsque+-x`FCC_eCVJm*whRRisWVP(|$CM9U&0Fj? zK`jfAm$0r?sJG1(%9J}#H^#?bv{@am(hh*A&}m+IMoUMBdi$1>I``h8Un3gL2zww9 zcKJ?h4kkk>%&^jNqR^=F#?k8ak+qo_bBnm~abw({a*tbSZ4%*bwq41xy%%M@UCT+0 ziXY0`+UDgMi&3|4u2}e-dTlqSJR<3~tb@bPKhNLI)6Lh>bE?C}iYnTOK_k4h&K^l5 znuQ%~FLX3lPWc;+zWjswt-G^xaoLpD0@NndGY{Gu3aj_r_#uxI7Ck#Py73OZoFm+Z zeeYDCJ8!!4Fj+exhaJCxOg|UZ<~0|imnmpDu$Ix8DAniN-0y%GNsfw|QSo>1$*&05 z{)Bc{m!j`CV`5~q^3NQ(lXZaSlXvO4gz-LJgm$NWIvDBl=OHhd_OSBx^Bc(83^+M5 zwP{uTC`bO$xQdfr7gJkXTUvU}=6F$Au6LaargNq3*(uU8NA;8&xaIt!yp^?-jtArQTa@=D0)bg$ozL&lVIHYZP!%^SX;s=Y2RVp)L+M!RMWCPt?cS(0_hF zGv$9&*jXq#T4tl&w;6w>sW<@5G^nDk9%ohKj`3djo}|p?H5;;yYI<&u!Z0y04M3I} z1F38;8n!YAIXR5I#AuqmwF?LcIM@V=p;L`t*wJe^)CF_PjHrU5whtCk?$nqz`1i&J zqRQrMn|+(f=o(fvbaZC_n{GDxd+#3!bWfrzVKMVZ`D6wH3_e4t&ma?|Zc1&>9gq5F zBIJbBRR#G41$E~T0gy$f>&s(@et(tboyQ+9$PK~1{{dn3oNc8W!>v!&*}3uEmbD!$ zNI2B2xng-k7<-UXr)7;djOyhQfzziBD->2Vu^-~Tkq()@vu@R}%R_8uUfgw(M0-EZ zkSTY^7?#&YwuG@rw3~0we}gi;RfPllqcR#ZpI*q|zGc(Po!tmRet#~`^xfTX$@y$K z+!BIDmYY#_Yk$~0qAk|e>h4FDSza8pmHAshIqrQ5w8AIWFG6(ohp1eyt@q>QbKIM^ zk3jTh<)kA#Zux!ZIP-m%xBPTBgBGlI;|158`cy2xYq{qkZatu=BGiAj<@osc=g&t` zT^Oufd%|%xmNWkH+MeeP)sL|m`x3)55LRyR$uhSjw~Nt1jyi%L;c@apU|jwDvx?2s2zC$c63`_O z?Px2XuJzjf&<|NM<ey1FjqnSOK#zYIm&tN})ED0_0yw9(kg*RK~X@N?z8Y1K7H8)%yMiy90y>atiu z==m@8UiOKCg^{!SYSbwTM&u=lNU`azT!nraU$h!j;le}8|-8cZ+hkw$s6JzS;MWs`%E zfz@Y`wwpur24=L}sNUDh%q&d+SAN2v6~}UgJ>aua_l#_cs=MGE#iE+AP1lJM+gM?*d@ChHQR2J?tm@E$PF$`S%B0FA5r# zS!-Q~ZQ3^IlK#VrY4M}$pB*{7DO3>Yu_A-=lV!Y6PylD@9|bQ!Z`yR3B-bZUmq7>b zw7K&_#UCn$r6H^=zc#roGJGNf8P5o5VPT=Fs){?>i)#UwJvx6Y?t%Bx#x%ND(sLvA z&_VYQN>5Lp?6W3yWu>^R%yqdxx6Wq|6eBel=AX+0`Cq?&eMwGpzrg^#5+G@Sw2dVF z>ospxVfMu4KXQn5e0#4dOM@b(!EEYvaXc=(X{x zbF{Rn_=;kGq@YoSb-?LH8@Ms3q@qVd8DT+4 ziHeGAAMnx7quf5btqgwt{CRwQ ze0X>mlxL&OkN!)tze3KH%dK&pY1KeBf_tjv4O0f5FLD6F5Sk@~{+I+Ihp^`0$tFt7 zTkMs`z;)?VfAHakQ|`cRBp#2Kl9H-;DdT^%qI3W{CYU=W^CgG6p-vvnEipbY$NpKsFM7aB^wK}r&FI2^@ zbTn4lI>4ek0dC*-A*{fsA1XE015R_l#%eeiZa-CD#~d_pDTZckvM&FgXF0r|XGGXE zh-J>CIUG7x?Y82M85L{)ro|LsG11iw1HY zXgG(qoFIqK-rDz}>CaDQD5u)Ydd5rdDay-xCFj1{5 zp10mFX^IR92?1qlt?z-0y?wzhZ|;r1Q-|Y3^<~|$t}dtcXkM+))NVO`pLE*0GgYIE z<&mX}2_ojrpl<5z?X@S5N=bn=xh{66wS+^pjUF!mgTM`tmoHzwX2RJ3veX`COpj$Y z4S_ty;f4wf%<;L&;+8mWmiZ3nnWesL3oLI1E#qstq$0$h0RwruvfexK;tuZ^{$84D zith)7qHbA`lXXIz0(=5%I4(V6GyHgLWCMU&Dnf5)`t=3=$2P+y=E??Hx#~S6&yX1o^-v_r?GbQTKV0eA*d&rSN}rSO5d)~g@xni{=5 zW=Wqx{iw|DCu-J6_TluqOKcmJ7i4F;5L?PZJ!yBG0Z!@3P`*y{4AR4)nTr0P^7!#A zcyZ_UZQ#Z+k&$0s5rRbVIpjU(LRU&ecsSd2%Qv5kb8>?JJmne;2_c@IIN%f^)1(6w z`)er#5N_qy@Q@{tVFAzcsz}JkSX@C2^aO)5O)&2{;*S zMZnGf)Tei`kf$y#j~+dG@$#i!pCxuUSCLb{gxk5x$;G9utsNQ~dhXmg zP((OlS5aKbim|Me&mbmsltn&Y*5q6%7K@dF>0Z8gQ6TOJ>Tyte5qAT7+;ofG=2gH_?J@kf zJb8|EbaY+?20pnLu*(%X0tf@4s#7NZwzb1I$VE9Kezg zJqMWl-Yq1XMqm#JL=sn(3re7V0H1V+9TZx3?JU>X!J&b3#erGDgbzaUNMKC`L3I}3 ziL}5uT^B`N{=3~HAg2iLgMoLWP$+P%HZ?VYbkz|DQwEFoaDWx>F^fFX(4d8rfl=Uv zeedk-tfHb~D&p6oXr6EL-`)d5zW&dpgnn5nd_6^zJw8#K=?71IKP-+pTlIo_+|}{R zWZT=Le`;!U^_XFPTaKTf-(-c4o?y_&Zmr9-P!q2&o9g z7eIL+y}YpMhk8QS!Ms7sK`lHbS@uIbFIteChsD@#ir9v-5`!CW)#{xl^Ei>v}V z=&E4G4PhyVS%auP9@4~MFV4HmaZxP>ap<;N=^M{zjX5a)3WBWUp5gh(K$1pENM`ZbU^;@=-g zuqfD23j`*XinzFrS>-^Qw4yu+QAL87>4-dGVrB-`6%B;91A)w^P6~ zDKiitp%Y}*y$H@r^pfA7-Sh=wfBbj|d?~k)U_P_H%Mub2GBV>+Q|!Ryh{#?M43$=NVUK(;`#1!0=L<5R!~sj3kNr!|xFOSK6fkFla0W7Yq#Ky>Y zMKdSN31F~Niw>a&wUSTgI{|vBnQ!e%k(09@7KXuKI3+Zy#!%9Y)r%{rkCw|rO;U}e z$|zBKk(Qa()O3o#J4eUHf}(H$ilF6kU+z~epWCVctTHpBknu&hYmOa6|KpCw>adya zkF&~aw$uGjX2UM3A>NEjO-nk=IzCxTMOfbi6h>A94&yXbWEvL}TQ(u`sxMnT;-ZK` zxzElbs3|!Ju~1Vmq1#i!=N!c4QSQ7fxutYAn?q?W(K%7vrBc!Za6*@W`W(h8Vxqo{ zjg8%t6V|Wu#)8I>j!}9}Uf$bgfM7w#0Mm}HAg=Mv*;aN-i6+}$d9BkqQP@QSPFRCt zra5e^#2k6J+6~o1f{GR(&_VyR6cmwmMmEvW(E#`Kg}GWwx(uDo9^`V`abEVA{eHIP zPcDy)r{qwDm)(GMt?^j*-@{oU>+9>+#P$I@4;Z>UX_?optt#csb)K8)?&Jf4|6mQ_ z0Q@l^X#l&YJs1pZ@+1S5BKhP|Z>H+9&rN0)ar@xV&>GNv0u%8W}NNt6HVy7X3{xY}b~D5BRr1GTq4HFXC$>N($;0PZ$+_LMJQ zzN`!t)u15M%4_eY`@Ltw*wk?0;|bG}X0wj2z&8I(WAI-cB!dL_0|qMsBvw8!r~q&F1(3Uj0k+=Q*f6Yh-~8DWG_$k4Jwt3-o^(yt`P9|bnfhSFurqB@ zR}cuq%J4ME*2{j04M!8}y?uS5uV344j($&)j-E0_+jt^m2`)T6;Z9!tFz_~Qe; zkH(r~*RNgUQA@n)#NA~mz%b%+g7+J70IQ|vgWjk$;&7`225zKDKt6#cpGl4Ty$Vkp z4X)KeT4yFYW-Y&{eiTqk2qYk8?Xd2>2LOFzuv}W~qSleGVq;^QSkL&La>uiO98B&fk56aU@#l-hjuouD}(oTr2r!Z61Y)?y%cCi0e)IV`qHJF zz8UbD|uX6($F zGf8l__6KtGjSYA#jHwwAeUd5wO?gU!{u1a1N4ALB4PHHWmg(9o;01fH^73wOZsryg z=+v|s0!H8G;NYN3X8X-mMe%lp+p)#~%^21c6x`jlpQy$H`aAECkrcZ+qRssCmKRmI zrcActWhz)n_`pIm9UUDwbI*gx8V@HM-;J;2R15;$>z2c5wKbKMl@z*Rra^p0?yJLe zP^bge9Z-;(&slc4?!FgySRF0_Np=3xDOZXg2d#~2vD#C9C#W=mb;qfCS?lgg*nW^S znj_eYMoXP_LO*rMoyc%=D~`!ONFOcrj&q0|idDtk15Zl2Tsw&zTuQ19E^N6ySK3 z8BFEWeQGo8^1!lE&Lt{=^3zd}jP&#}yaf_uoZIN3Aw5Ajwl%q;bZNLGWA{l0g?;lI zrrvna8ohn{wZ8-!B4IzA>K7u)%WDICyEhVR@#IO#z*wPa!vl=XaD?X$IFqeco?{sR z$0X`JoSX_ZCA{rSQZAY98Co(s_@i~xI&Zg;QVWOCGR+hLwPYECBilAmK<%zgBCyY`0x*03&#;j@_>p~atLk+Cl+ zEF3vQ*3Iz@$yMLh(V>k2K3N3VFJPv?*f1cyH zDwTVA20%P)4U;>_T`&g~V5n%0wqoTl=B%};Y?f6ICiHWS?=l-3) iy!ZzR_TKvw(mTN`0)?b@k3p^`QN5+6_)+2Ei~j)f@>IzH literal 0 HcmV?d00001 From 2cf78a71959db0552efbddf59249f1de6aee8322 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sun, 27 Jan 2013 22:18:45 -0700 Subject: [PATCH 333/437] No more github downloads, use dropbox links for now --- getting_started/1.markdown | 6 +++--- packages.html | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 packages.html diff --git a/getting_started/1.markdown b/getting_started/1.markdown index 1059b81ed..f51ac4eea 100644 --- a/getting_started/1.markdown +++ b/getting_started/1.markdown @@ -27,7 +27,7 @@ After Erlang is up and running, it is time to install Elixir. You can do that vi ### 1.1.1 Distributions -Elixir v0.7.0 forward is required to run this tutorial and it may be available in some distributions: +Elixir v0.8.0 forward is required to run this tutorial and it may be available in some distributions: * Homebrew for Mac OS X: `brew install elixir` (run `brew update` to ensure you have the latest formula) * Fedora 17+ and Fedora Rawhide: `sudo yum -y install elixir` @@ -36,9 +36,9 @@ If you don't use any of the distributions above, don't worry, we also provide a ### 1.1.2 Precompiled package -Elixir provides a package file with its compiled source for every release. You can grab the latest [in the downloads page](https://github.com/elixir-lang/elixir/downloads) (make sure to download one of the versioned packages under the "Download packages" section and not the "Download as zip/tar.gz" buttons which will rather download Elixir's master branch). +Elixir provides a [precompiled package for every release](/packages.html). -After unzip-ing the package, you are ready to run the `elixir` and `iex` commands from the `bin` directory. It is recommended that you also add Elixir's `bin` path to your PATH environment variable to ease development. In a Unix system, that can be achieved with: +After downloading and unzip-ing the package, you are ready to run the `elixir` and `iex` commands from the `bin` directory. It is recommended that you also add Elixir's `bin` path to your PATH environment variable to ease development. In a Unix system, that can be achieved with: export PATH="$PATH:/path/to/elixir/bin" diff --git a/packages.html b/packages.html new file mode 100644 index 000000000..8be76418c --- /dev/null +++ b/packages.html @@ -0,0 +1,18 @@ +--- +layout: default +--- + +
      +
      +

      Precompiled packages

      + + +
      +
      From 300829e37df5850db2927dd6a72994f2d21dc233 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Mon, 28 Jan 2013 08:54:34 -0700 Subject: [PATCH 334/437] Fixing typos --- _posts/2013-01-27-elixir-v0-8-0-released.markdown | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/_posts/2013-01-27-elixir-v0-8-0-released.markdown b/_posts/2013-01-27-elixir-v0-8-0-released.markdown index 1033f99d5..bc56583cc 100644 --- a/_posts/2013-01-27-elixir-v0-8-0-released.markdown +++ b/_posts/2013-01-27-elixir-v0-8-0-released.markdown @@ -3,14 +3,14 @@ layout: post title: Elixir v0.8.0 released author: José Valim category: Releases -excerpt: In the last 9th January, we celebrated two years since Elixir's first commit and to celebrate this occasion we have prepared a big release. Elixir v0.8 is out, with documentation, optimizations, bug fixes and shinning new features. Let's take a look at them! +excerpt: On the last 9th January, we celebrated two years since Elixir's first commit and to celebrate this occasion we have prepared a big release. Elixir v0.8 is out, with documentation, optimizations, bug fixes and shiny new features. Let's take a look at them! --- -In the last 9th January, we celebrated [two years since Elixir's first commit](https://github.com/elixir-lang/elixir/commit/337c3f2d569a42ebd5fcab6fef18c5e012f9be5b) and to celebrate this occasion we have prepared a big release. Elixir v0.8 is out, with documentation, optimizations, bug fixes and shinning new features. Let's take a look at them! +On the last 9th January, we celebrated [two years since Elixir's first commit](https://github.com/elixir-lang/elixir/commit/337c3f2d569a42ebd5fcab6fef18c5e012f9be5b) and to celebrate this occasion we have prepared a big release. Elixir v0.8 is out, with documentation, optimizations, bug fixes and shiny new features. Let's take a look at them! ## OTP applications -One of the goals for the v0.8 release was better integration with OTP applications. By passing the `--sup` optiont to Mix, you can start a new OTP Application containing application callbacks and a supervisor: +One of the goals for the v0.8 release was better integration with OTP applications. By passing the `--sup` option to Mix, you can start a new OTP Application containing application callbacks and a supervisor: mix new my_app --sup @@ -34,7 +34,7 @@ Learn more about [Unicode support with the String module](http://elixir-lang.org ## AST metadata -As per this release, Elixir AST notes can contain metadata. This metadata is compilation time only but may allow macros to annotate important information in the AST nodes, like line numbers, file and other library specific information. If you quote an Elixir expression, you can see the metadata slot: +As per this release, Elixir AST notes can contain metadata. This metadata is compilation time only but may allow macros to annotate important information in AST nodes, like line numbers, file and other library specific information. If you quote an Elixir expression, we can see the metadata slot: {% highlight elixir %} quote do: hello("world") @@ -54,7 +54,7 @@ Now, we can see the metadata spot being used to annotate the line number. This c ## Macros expansion -Prior to this release, Elixir had limitted expension of imports and aliases. We decided this would be an important issue to tackle on this release, as people are building more and more projects on top of Elixir. +Prior to this release, Elixir had limited expansion of imports and aliases. We decided this would be an important issue to tackle in this release, as people are building more and more projects on top of Elixir. Imagine you manually implemented `unless` as a macro, that does the opposite of `if`: @@ -72,7 +72,7 @@ Elixir v0.8 ensures that the `unless` macro above will expand to the same `if` m You can read more about [macros in the getting started guide](http://elixir-lang.org/getting_started/5.html) or [go deep into the quote macro docs](http://elixir-lang.org/docs/master/Kernel.SpecialForms.html#quote/2). -## A new way to manipulatet with paths +## A new way to manipulate pathnames Elixir v0.8 contains a bit of house cleaning too. We have created [the Path module](http://elixir-lang.org/docs/master/Path.html) to accommodate functions used to manipulate filesystem paths and have also added functions like [`System.tmp_dir` and `System.user_home`](http://elixir-lang.org/docs/master/System.html) which are meant to work accross different operating systems and are very handy when scripting. From b38aa94855d51dfd45f9b9c35cc0b62dc9648630 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Mon, 28 Jan 2013 10:01:31 -0700 Subject: [PATCH 335/437] Update master and stable docs --- docs/master/Binary.Inspect.html | 6 - docs/master/ExUnit.CLIFormatter.html | 12 +- docs/master/Kernel.CLI.html | 2 +- docs/master/Kernel.SpecialForms.html | 122 +- docs/master/Kernel.Typespec.html | 2 +- docs/master/Macro.html | 4 +- docs/master/Mix.Tasks.Compile.Elixir.html | 2 +- docs/master/Mix.Tasks.Run.html | 4 +- docs/master/Path.html | 86 +- docs/master/String.html | 49 +- .../System.NoAccessCwdError.html} | 19 +- ...HomeError.html => System.NoHomeError.html} | 6 +- docs/master/System.NoTmpDirError.html | 62 + docs/master/System.html | 113 +- docs/master/modules_list.html | 76 +- docs/master/protocols_list.html | 20 +- docs/master/records_list.html | 46 +- docs/stable/Access.Atom.html | 4 +- docs/stable/Access.Binary.Dict.html | 23 +- docs/stable/Access.Function.html | 4 +- docs/stable/Access.HashDict.html | 23 +- docs/stable/Access.List.html | 9 +- docs/stable/Access.OrdDict.html | 23 +- docs/stable/Application.Behaviour.html | 100 + docs/stable/ArgumentError.html | 111 +- docs/stable/ArithmeticError.html | 111 +- docs/stable/BadArityError.html | 136 +- docs/stable/BadFunctionError.html | 103 +- docs/stable/Behaviour.html | 11 - docs/stable/Binary.Dict.html | 151 +- docs/stable/Binary.Inspect.Atom.html | 23 +- docs/stable/Binary.Inspect.BitString.html | 23 +- .../Binary.Inspect.Function.html} | 16 +- docs/stable/Binary.Inspect.HashDict.html | 72 + docs/stable/Binary.Inspect.List.html | 23 +- docs/stable/Binary.Inspect.Number.html | 23 +- ...Tasks.Iex.html => Binary.Inspect.PID.html} | 21 +- docs/stable/Binary.Inspect.Port.html | 77 + docs/stable/Binary.Inspect.Range.html | 72 + docs/stable/Binary.Inspect.Reference.html | 77 + docs/stable/Binary.Inspect.Regex.html | 23 +- docs/stable/Binary.Inspect.Tuple.html | 23 +- docs/stable/Binary.Inspect.html | 36 +- docs/stable/CaseClauseError.html | 103 +- docs/stable/Code.LoadError.html | 83 + docs/stable/Code.html | 57 +- docs/stable/CompileError.html | 169 +- docs/stable/Dict.html | 148 +- docs/stable/EEx.SyntaxError.html | 109 - docs/stable/Enum.Iterator.Binary.Dict.html | 34 +- docs/stable/Enum.Iterator.Function.html | 34 +- docs/stable/Enum.Iterator.HashDict.html | 34 +- docs/stable/Enum.Iterator.List.html | 34 +- docs/stable/Enum.Iterator.Orddict.html | 34 +- docs/stable/Enum.Iterator.Range.html | 32 + docs/stable/Enum.OutOfBoundsError.html | 111 +- docs/stable/Enum.html | 68 +- docs/stable/ErlangError.html | 103 +- docs/stable/ExUnit.AssertionError.html | 109 - docs/stable/ExUnit.Assertions.html | 104 +- docs/stable/ExUnit.CLIFormatter.html | 60 +- docs/stable/ExUnit.ExpectationError.html | 107 + docs/stable/ExUnit.Formatter.html | 48 +- docs/stable/ExUnit.html | 82 +- docs/stable/Exception.html | 80 +- docs/stable/File.CopyError.html | 198 - docs/stable/File.Error.html | 165 - docs/stable/File.IteratorError.html | 99 - docs/stable/File.Stat.html | 483 --- docs/stable/File.html | 412 +- docs/stable/FunctionClauseError.html | 169 +- docs/stable/GenServer.Behaviour.html | 88 +- docs/stable/HashDict.html | 198 +- docs/stable/IEx.Helpers.html | 14 +- docs/stable/IO.html | 6 +- docs/stable/Kernel.CLI.html | 2 +- docs/stable/Kernel.SpecialForms.html | 426 +- docs/stable/Kernel.Typespec.html | 28 +- docs/stable/Kernel.html | 451 +- docs/stable/KeyError.html | 103 +- docs/stable/Keyword.html | 33 +- docs/stable/List.Chars.Atom.html | 21 + docs/stable/List.Chars.BitString.html | 21 + docs/stable/List.Chars.List.html | 21 + docs/stable/List.Chars.Number.html | 21 + docs/stable/List.Dict.html | 276 ++ docs/stable/List.html | 6 +- docs/stable/Macro.Env.html | 381 +- docs/stable/Macro.html | 27 +- docs/stable/MatchError.html | 103 +- docs/stable/Mix.Dep.html | 252 -- docs/stable/Mix.Deps.Lock.html | 101 - docs/stable/Mix.Error.html | 153 - docs/stable/Mix.InvalidTaskError.html | 143 - docs/stable/Mix.NoProjectError.html | 153 - docs/stable/Mix.NoTaskError.html | 143 - docs/stable/Mix.OutOfDateDepsError.html | 143 - docs/stable/Mix.Project.html | 22 +- docs/stable/Mix.Task.html | 4 +- .../Mix.Tasks.App.Start.html} | 14 +- docs/stable/Mix.Tasks.Compile.App.html | 10 +- docs/stable/Mix.Tasks.Compile.Elixir.html | 29 +- docs/stable/Mix.Tasks.Compile.Erlang.html | 90 + docs/stable/Mix.Tasks.Compile.html | 28 +- docs/stable/Mix.Tasks.Deps.Compile.html | 11 +- docs/stable/Mix.Tasks.Deps.Get.html | 8 +- docs/stable/Mix.Tasks.Deps.Update.html | 8 +- docs/stable/Mix.Tasks.Escriptize.html | 13 +- docs/stable/Mix.Tasks.New.html | 16 +- docs/stable/Mix.Tasks.Run.html | 4 +- docs/stable/Mix.Tasks.Test.html | 11 +- docs/stable/Mix.Utils.html | 41 +- docs/stable/Mix.html | 23 +- docs/stable/Node.html | 26 +- docs/stable/OptionParser.html | 23 +- docs/stable/OrdDict.html | 8 +- docs/stable/Path.html | 484 +++ docs/stable/Process.html | 70 +- docs/stable/Protocol.UndefinedError.html | 136 +- docs/stable/Range.Iterator.Number.html | 32 + docs/stable/Range.html | 120 - docs/stable/Record.html | 18 +- docs/stable/Regex.CompileError.html | 109 - docs/stable/RuntimeError.html | 111 +- docs/stable/String.html | 237 +- docs/stable/Supervisor.Behaviour.html | 272 ++ docs/stable/SyntaxError.html | 169 +- docs/stable/System.NoAccessCwdError.html | 62 + ...spect.Any.html => System.NoHomeError.html} | 28 +- docs/stable/System.NoTmpDirError.html | 62 + docs/stable/System.html | 121 +- docs/stable/SystemLimitError.html | 111 +- docs/stable/TokenMissingError.html | 169 +- docs/stable/URI.html | 2 +- docs/stable/UndefinedFunctionError.html | 169 +- docs/stable/js/full_list.js | 10 +- docs/stable/modules_list.html | 941 +++-- docs/stable/protocols_list.html | 300 +- docs/stable/records_list.html | 3641 ++--------------- 139 files changed, 6178 insertions(+), 10117 deletions(-) rename docs/{stable/Tuple.html => master/System.NoAccessCwdError.html} (59%) rename docs/master/{Path.NoHomeError.html => System.NoHomeError.html} (89%) create mode 100644 docs/master/System.NoTmpDirError.html create mode 100644 docs/stable/Application.Behaviour.html rename docs/{master/Binary.Inspect.Any.html => stable/Binary.Inspect.Function.html} (80%) create mode 100644 docs/stable/Binary.Inspect.HashDict.html rename docs/stable/{Mix.Tasks.Iex.html => Binary.Inspect.PID.html} (73%) create mode 100644 docs/stable/Binary.Inspect.Port.html create mode 100644 docs/stable/Binary.Inspect.Range.html create mode 100644 docs/stable/Binary.Inspect.Reference.html create mode 100644 docs/stable/Code.LoadError.html create mode 100644 docs/stable/ExUnit.ExpectationError.html create mode 100644 docs/stable/List.Dict.html delete mode 100644 docs/stable/Mix.Deps.Lock.html rename docs/{master/Mix.Tasks.Iex.html => stable/Mix.Tasks.App.Start.html} (80%) create mode 100644 docs/stable/Mix.Tasks.Compile.Erlang.html create mode 100644 docs/stable/Path.html create mode 100644 docs/stable/Supervisor.Behaviour.html create mode 100644 docs/stable/System.NoAccessCwdError.html rename docs/stable/{Binary.Inspect.Any.html => System.NoHomeError.html} (61%) create mode 100644 docs/stable/System.NoTmpDirError.html diff --git a/docs/master/Binary.Inspect.html b/docs/master/Binary.Inspect.html index e9c1f94d4..f24fb214b 100644 --- a/docs/master/Binary.Inspect.html +++ b/docs/master/Binary.Inspect.html @@ -46,12 +46,6 @@

      Implementations

        -
      • - - Any - -
      • -
      • Atom diff --git a/docs/master/ExUnit.CLIFormatter.html b/docs/master/ExUnit.CLIFormatter.html index 861ffece9..3f1dd41fe 100644 --- a/docs/master/ExUnit.CLIFormatter.html +++ b/docs/master/ExUnit.CLIFormatter.html @@ -118,13 +118,13 @@

        Functions

        case_finished(_id, _test_case)

        - Source + Source

      case_started(_id, _test_case)

      - Source + Source

      code_change(_old, state, _extra) @@ -160,13 +160,13 @@

      Functions

      suite_finished(id)

      - Source + Source

      suite_started(_opts)

      - Source + Source

      terminate(reason, state) @@ -178,13 +178,13 @@

      Functions

      test_finished(id, test_case, test, result)

      - Source + Source

      test_started(_id, _test_case, _test)

      - Source + Source
      diff --git a/docs/master/Kernel.CLI.html b/docs/master/Kernel.CLI.html index aa4b3f9b3..92a9a18dd 100644 --- a/docs/master/Kernel.CLI.html +++ b/docs/master/Kernel.CLI.html @@ -78,7 +78,7 @@

      Functions

      wait_until_finished()

      -

      Wait until the CLI finishes procesing options.

      +

      Wait until the CLI finishes processing options.

      Source
      diff --git a/docs/master/Kernel.SpecialForms.html b/docs/master/Kernel.SpecialForms.html index d244c3c6c..9b1c37037 100644 --- a/docs/master/Kernel.SpecialForms.html +++ b/docs/master/Kernel.SpecialForms.html @@ -296,13 +296,20 @@

      Bitstring types

      have their size specified explicitly). Bitstrings do not have a default size.

      +

      Size can also be specified using a syntax shortcut. Instead of +writing size(8), one can write just 8 and it will be interpreted +as size(8)

      + +
      << 1 :: 3 >> == << 1 :: size(3) >> #=> true
      +
      +

      The default unit for integers, floats, and bitstrings is 1. For binaries, it is 8.

      For floats, unit * size must result in 32 or 64, corresponding to binary32 and binary64, respectively.

      - Source + Source

      [args] @@ -324,7 +331,7 @@

      Examples

      record. In the environment you can access the current filename, line numbers, set up aliases, the current function and others.

      - Source + Source

      __FILE__() @@ -333,7 +340,7 @@

      Examples

      Although the file can be accessed in the ENV, this macro is a convenient shortcut.

      - Source + Source

      __MODULE__() @@ -342,7 +349,7 @@

      Examples

      Although the module can be accessed in the ENV, this macro is a convenient shortcut.

      - Source + Source

      args @@ -351,14 +358,14 @@

      Examples

      It is usually compiled to an atom:

      quote do: Foo.Bar
      -{ :__aliases__, 0, [:Foo,:Bar] }
      +{ :__aliases__, [], [:Foo,:Bar] }
       

      Elixir represents Foo.Bar as __aliases__ so calls can be unambiguously identified by the operator :.. For example:

      quote do: Foo.bar
      -{{:.,0,[{:__aliases__,0,[:Foo]},:bar]},0,[]}
      +{{:.,[],[{:__aliases__,[],[:Foo]},:bar]},[],[]}
       

      Whenever an expression iterator sees a :. as the tuple key, @@ -376,7 +383,7 @@

      Examples

      4) When the head element of aliases is not an atom, it is expanded at runtime:

        quote do: some_var.Foo
      -  {:__aliases__,0,[{:some_var,0,:quoted},:Bar]}
      +  {:__aliases__,[],[{:some_var,[],:quoted},:Bar]}
       

      Since some_var is not available at compilation time, the compiler @@ -385,7 +392,7 @@

      Examples

        Module.concat [some_var, Foo]
       
      - Source + Source

      args @@ -395,10 +402,10 @@

      Examples

      and should not be invoked directly:

      quote do: (1; 2; 3)
      -#=> { :__block__, 0, [1,2,3] }
      +#=> { :__block__, [], [1,2,3] }
       
      - Source + Source

      __scope__(opts, args) @@ -414,7 +421,7 @@

      Examples

      Check quote/1 for more information.

      - Source + Source

      alias(module, opts) @@ -458,7 +465,7 @@

      Lexical scope

      have lexical scope. This means you can set up aliases inside specific functions and it won't affect the overall scope.

      - Source + Source

      alias!(alias) @@ -467,7 +474,7 @@

      Lexical scope

      be hygienezed. This means the alias will be expanded when the macro is expanded.

      - Source + Source

      bc(args) @@ -481,7 +488,7 @@

      Lexical scope

      "helloworld"
      - Source + Source

      import(module, opts) @@ -559,7 +566,7 @@

      Alias/Require shortcut

      also accepts as: as an option so it automatically sets up an alias. Please check alias for more information.

      - Source + Source

      lc(args) @@ -607,7 +614,7 @@

      Alias/Require shortcut

      [{213,45,132},{64,76,32},{76,0,0},{234,32,15}]
      - Source + Source

      quote(opts, list2) @@ -617,7 +624,7 @@

      Alias/Require shortcut

      Examples

      quote do: sum(1, 2, 3)
      -#=> { :sum, 0, [1, 2, 3] }
      +#=> { :sum, [], [1, 2, 3] }
       

      Explanation

      @@ -652,6 +659,7 @@

      Options

    2772. :location - When set to :keep, keeps the current line and file on quotes. Read the Stacktrace information section below for more information;
    2773. :expand_aliases - When false, do not expand aliases;
    2774. +
    2775. :expand_imports - When false, do not expand imports;
    2776. :var_context - The context for quoted variables. Defaults to the current module;
    2777. @@ -787,12 +795,63 @@

      Hygiene in aliases

      NoHygiene.interference #=> UndefinedFunctionError +

      Hygiene in imports

      + +

      Similar to aliases, imports in Elixir hygienic. Consider the +following code:

      + +
      defmodule Hygiene do
      +  defmacrop get_size do
      +    quote do
      +      size("hello")
      +    end
      +  end
      +
      +  def return_size do
      +    import Kernel, except: [size: 1]
      +    get_size
      +  end
      +end
      +
      +Hygiene.return_size #=> 5
      +
      + +

      Notice how return_size returns 5 even though the size/1 +function is not imported.

      + +

      Elixir is smart enough to delay the resolution to the latest +moment possible. So, if you call size("hello") inside quote, +but no size/1 function is available, it is then expanded on +the caller:

      + +
      defmodule Lazy do
      +  defmacrop get_size do
      +    import Kernel, except: [size: 1]
      +
      +    quote do
      +      size([a: 1, b: 2])
      +    end
      +  end
      +
      +  def return_size do
      +    import Kernel, except: [size: 1]
      +    import Dict, only: [size: 1]
      +    get_size
      +  end
      +end
      +
      +Lazy.return_size #=> 2
      +
      + +

      As in aliases, imports expansion can be explicitly disabled +via the expand_imports option.

      +

      Stacktrace information

      One of Elixir goals is to provide proper stacktrace whenever there is an exception. In order to work properly with macros, the default behavior -in quote is to set the line to 0. When a macro is invoked and the quoted -expressions is expanded, 0 is replaced by the line of the call site.

      +in quote is to not set a line. When a macro is invoked and the quoted +expressions is expanded, the call site line is inserted.

      This is a good behavior for the majority of the cases, except if the macro is defining new functions. Consider this example:

      @@ -821,7 +880,7 @@

      Stacktrace information

      particular, the macro __FILE__ and exceptions happening inside the quote will always point to GenServer.Behaviour file.

      - Source + Source

      require(module, opts) @@ -852,7 +911,7 @@

      Alias shortcut

      require also accepts as: as an option so it automatically sets up an alias. Please check alias for more information.

      - Source + Source

      unquote(expr) @@ -871,17 +930,17 @@

      Examples

      Which would then return:

      -
      { :sum, 0, [1, { :value, 0, quoted }, 3] }
      +
      { :sum, [], [1, { :value, [], quoted }, 3] }
       

      Which is not the expected result. For this, we use unquote:

      value = 13
       quote do: sum(1, unquote(value), 3)
      -#=> { :sum, 0, [1, 13, 3] }
      +#=> { :sum, [], [1, 13, 3] }
       
      - Source + Source

      unquote_splicing(expr) @@ -893,18 +952,21 @@

      Examples

      values = [2,3,4]
       quote do: sum(1, unquote_splicing(values), 5)
      -#=> { :sum, 0, [1, 2, 3, 4, 5] }
      +#=> { :sum, [], [1, 2, 3, 4, 5] }
       
      - Source + Source

      var!(var)

      -

      When used inside quoting, marks that the variable should not -be hygienezed. Check quote/2 for more information.

      +

      When used inside quoting, marks that the variable should +not be hygienized. The argument can be either a variable +node (i.e. a tuple with three elements where the last +one is an atom) or an atom representing the variable name. +Check quote/2 for more information.

      - Source + Source

      var!(var, context) @@ -912,7 +974,7 @@

      Examples

      Defines a variable in the given context. Check quote/2 for more information.

      - Source + Source

      {args} diff --git a/docs/master/Kernel.Typespec.html b/docs/master/Kernel.Typespec.html index b0ee9c9c9..f9fafdf38 100644 --- a/docs/master/Kernel.Typespec.html +++ b/docs/master/Kernel.Typespec.html @@ -105,7 +105,7 @@

      Functions

      Notes

      Elixir discourages the use of type string() as it might be confused -with binaries which are referred to as "strings" in Elixir (as opposed to +with binaries which are referred to as "strings" in Elixir (as opposed to character lists). In order to use the type that is called string() in Erlang, one has to use the char_list() type which is a synonym to string(). If yu use string(), you'll get a warning from the compiler.

      diff --git a/docs/master/Macro.html b/docs/master/Macro.html index ea75ad58d..0efb339ac 100644 --- a/docs/master/Macro.html +++ b/docs/master/Macro.html @@ -137,7 +137,7 @@

      Examples

      #=> :foo Macro.escape({ :a, :b, :c }) -#=> { :{}, 0, [:a, :b, :c] } +#=> { :{}, [], [:a, :b, :c] }
      Source @@ -203,7 +203,7 @@

      Examples

      The compilation will fail because My.Module when quoted is not an atom, but a syntax tree as follow:

      -
      {:__aliases__, 0, [:My, :Module] }
      +
      {:__aliases__, [], [:My, :Module] }
       

      That said, we need to expand the aliases node above to an diff --git a/docs/master/Mix.Tasks.Compile.Elixir.html b/docs/master/Mix.Tasks.Compile.Elixir.html index d9616bb4a..2c19174c2 100644 --- a/docs/master/Mix.Tasks.Compile.Elixir.html +++ b/docs/master/Mix.Tasks.Compile.Elixir.html @@ -112,7 +112,7 @@

      Functions

      run(args)

      - Source + Source
      diff --git a/docs/master/Mix.Tasks.Run.html b/docs/master/Mix.Tasks.Run.html index 99dd19d48..b06c93466 100644 --- a/docs/master/Mix.Tasks.Run.html +++ b/docs/master/Mix.Tasks.Run.html @@ -38,8 +38,8 @@

      Command line options

    2778. --require, -r - Requires a file before running the command
    2779. --parallel-require, -pr - Requires a file in parallel
    2780. --no-halt - Does not halt the system after running the command
    2781. -
    2782. --no-compile - do not compile even if files require compilation;
    2783. -
    2784. --no-start - do not start applications after compilation;
    2785. +
    2786. --no-compile - Do not compile even if files require compilation;
    2787. +
    2788. --no-start - Do not start applications after compilation;
    2789. Examples

      diff --git a/docs/master/Path.html b/docs/master/Path.html index 274b4249e..3f279561a 100644 --- a/docs/master/Path.html +++ b/docs/master/Path.html @@ -100,6 +100,11 @@

      Functions summary

      join/2 +
    2790. + + relative/1 + +
    2791. relative_to/2 @@ -120,6 +125,11 @@

      Functions summary

      split/1
    2792. +
    2793. + + type/1 + +
    2794. wildcard/1 @@ -161,7 +171,7 @@

      Windows

      "D:/usr/local/../x"
      - Source + Source

      absname(path, relative_to) @@ -182,7 +192,7 @@

      Examples

      #=> "bar/../x"
      - Source + Source

      basename(path) @@ -202,7 +212,7 @@

      Examples

      #=> ""
      - Source + Source

      basename(path, extension) @@ -221,7 +231,7 @@

      Examples

      #=> "bar.old"
      - Source + Source

      dirname(path) @@ -234,7 +244,7 @@

      Examples

      #=> "foo"
      - Source + Source

      expand(path) @@ -247,7 +257,7 @@

      Examples

      Path.expand("/foo/bar/../bar") == "/foo/bar"
       
      - Source + Source

      expand(path, relative_to) @@ -262,7 +272,7 @@

      Examples

      Path.expand("/foo/bar/../bar", "/baz") == "/foo/bar"
      - Source + Source

      extname(path) @@ -277,10 +287,10 @@

      Examples

      #=> ""
      - Source + Source

      - join(paths) + join(list1)

      Returns a string with one or more paths components joint by the path separator. This function should be used to convert a list of strings in a path.

      @@ -295,7 +305,7 @@

      Examples

      #=> "/foo/bar"
      - Source + Source

      join(left, right) @@ -308,7 +318,29 @@

      Examples

      #=> "foo/bar"
      - Source + Source +
      +

      + relative(name) +

      +

      Forces the path to be a relative path.

      + +

      Unix examples

      + +
      Path.relative("/usr/local/bin")   #=> "usr/local/bin"
      +Path.relative("usr/local/bin")    #=> "usr/local/bin"
      +Path.relative("../usr/local/bin") #=> "../usr/local/bin"
      +
      + +

      Windows examples

      + +
      Path.relative("D:/usr/local/bin") #=> "usr/local/bin"
      +Path.relative("usr/local/bin")    #=> "usr/local/bin"
      +Path.relative("D:bar.ex")         #=> "bar.ex"
      +Path.relative("/bar/foo.ex")      #=> "bar/foo.ex"
      +
      +
      + Source

      relative_to(path, from) @@ -328,7 +360,7 @@

      Examples

      Path.relative_to("/usr/local/foo", "/etc") #=> "/usr/local/foo"
      - Source + Source

      rootname(path) @@ -343,7 +375,7 @@

      Examples

      #=> "/foo/bar"
      - Source + Source

      rootname(path, extension) @@ -359,7 +391,7 @@

      Examples

      #=> "/foo/bar.erl"
      - Source + Source

      split(path) @@ -377,7 +409,29 @@

      Examples

      #=> ["/", "foo", "bar"]
      - Source + Source +
      +

      + type(name) +

      +

      Returns the path type.

      + +

      Unix examples

      + +
      Path.type("/usr/local/bin")   #=> :absolute
      +Path.type("usr/local/bin")    #=> :relative
      +Path.type("../usr/local/bin") #=> :relative
      +
      + +

      Windows examples

      + +
      Path.type("D:/usr/local/bin") #=> :absolute
      +Path.type("usr/local/bin")    #=> :relative
      +Path.type("D:bar.ex")         #=> :volumerelative
      +Path.type("/bar/foo.ex")      #=> :volumerelative
      +
      +
      + Source

      wildcard(glob) @@ -417,7 +471,7 @@

      Examples

      Path.wildcard("projects/*/ebin/**/*.{beam,app}")
       
      - Source + Source diff --git a/docs/master/String.html b/docs/master/String.html index c3b63fb67..696c840d7 100644 --- a/docs/master/String.html +++ b/docs/master/String.html @@ -262,22 +262,27 @@

      Examples

      String.at("elixir", -10) #=> nil - Source + Source

      capitalize(string)

      -

      Convert the first character on the given string to uppercase -and the remaining to downcase.

      +

      Converts the first character in the given string to +titlecase and the remaining to downcase.

      + +

      This relies on the titlecase information provided +by the Unicode Standard. Note this function makes +no attempt in capitalizing all words in the string +(usually known as titlecase).

      Examples

      String.capitalize("abcd") #=> "Abcd"
      -String.capitalize("ab 123 xpto") #=> "Ab 123 xpto"
      +String.capitalize("fin")   #=> "Fin"
       String.capitalize("josé") #=> "José"
       
      - Source + Source

      codepoints(string) @@ -291,7 +296,7 @@

      Examples

      String.codepoints("ἅἪῼ") #=> ["ἅ","Ἢ","ῼ"]
      - Source + Source

      downcase(binary) @@ -318,7 +323,7 @@

      Examples

      String.duplicate("abc", 2) #=> "abcabc"
      - Source + Source

      first(string) @@ -331,7 +336,7 @@

      Examples

      String.first("եոգլի") #=> "ե"
      - Source + Source

      graphemes(string) @@ -343,7 +348,7 @@

      Examples

      String.graphemes("Ā̀stute") # => ["Ā̀","s","t","u","t","e"]
       
      - Source + Source

      last(string) @@ -356,7 +361,7 @@

      Examples

      String.last("եոգլի") #=> "ի"
      - Source + Source

      length(string) @@ -369,7 +374,7 @@

      Examples

      String.length("եոգլի") #=> 5
      - Source + Source

      lstrip(binary) @@ -382,7 +387,7 @@

      Examples

      String.lstrip("   abc  ")       #=> "abc  "
       
      - Source + Source

      lstrip(other, char) @@ -394,7 +399,7 @@

      Examples

      String.lstrip("_  abc  _", ?_)  #=> "  abc  _"
       
      - Source + Source

      next_codepoint(string) @@ -415,7 +420,7 @@

      Examples

      String.next_codepoint("josé") #=> { "j", "osé" }
       
      - Source + Source

      next_grapheme(string) @@ -431,7 +436,7 @@

      Examples

      String.next_grapheme("josé") #=> { "j", "osé" }
       
      - Source + Source

      printable?(arg1) @@ -466,7 +471,7 @@

      Examples

      String.replace("a,b,c", ",", "[]", insert_replaced: [1,1]) #=> "a[,,]b[,,]c"
      - Source + Source

      rstrip(binary) @@ -479,7 +484,7 @@

      Examples

      String.rstrip("   abc  ")      #=> "   abc"
       
      - Source + Source

      rstrip(string, char) @@ -491,7 +496,7 @@

      Examples

      String.rstrip("   abc _", ?_)  #=> "   abc "
       
      - Source + Source

      slice(string, start, len) @@ -509,7 +514,7 @@

      Examples

      String.slice("elixir", -10, 3) #=> nil
      - Source + Source

      split(binary, pattern // " ", options // []) @@ -552,7 +557,7 @@

      Examples

      String.strip("   abc  ")       #=> "abc"
       
      - Source + Source

      strip(string, char) @@ -565,7 +570,7 @@

      Examples

      String.strip("a  abc  a", ?a)  #=> "  abc  "
       
      - Source + Source

      upcase(binary) @@ -597,7 +602,7 @@

      Examples

      String.valid_codepoint?("asdf") #=> false
      - Source + Source diff --git a/docs/stable/Tuple.html b/docs/master/System.NoAccessCwdError.html similarity index 59% rename from docs/stable/Tuple.html rename to docs/master/System.NoAccessCwdError.html index 9b0c84738..ab34d3aeb 100644 --- a/docs/stable/Tuple.html +++ b/docs/master/System.NoAccessCwdError.html @@ -1,7 +1,7 @@ - Tuple + System.NoAccessCwdError @@ -21,17 +21,30 @@

      - Tuple + System.NoAccessCwdError + + exception

      - Source + Source +

      Fields (and defaults)

      +
        + +
      • + + message: "could not get a current working directory, the current location is not accessible" + +
      • + +
      + diff --git a/docs/master/Path.NoHomeError.html b/docs/master/System.NoHomeError.html similarity index 89% rename from docs/master/Path.NoHomeError.html rename to docs/master/System.NoHomeError.html index 225a3faff..aa0db634d 100644 --- a/docs/master/Path.NoHomeError.html +++ b/docs/master/System.NoHomeError.html @@ -1,7 +1,7 @@ - Path.NoHomeError + System.NoHomeError @@ -21,7 +21,7 @@

      - Path.NoHomeError + System.NoHomeError exception @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/master/System.NoTmpDirError.html b/docs/master/System.NoTmpDirError.html new file mode 100644 index 000000000..8acb2f144 --- /dev/null +++ b/docs/master/System.NoTmpDirError.html @@ -0,0 +1,62 @@ + + + + System.NoTmpDirError + + + + + + + + + + + + +
      +

      + System.NoTmpDirError + + exception + +

      + + + + Source + + + + +

      Fields (and defaults)

      +
        + +
      • + + message: "could not get a writable temporary directory, please set the TMPDIR environment variable" + +
      • + +
      + + + + + + + + + + + + + +
      + + diff --git a/docs/master/System.html b/docs/master/System.html index 4e6440b57..27a8cd615 100644 --- a/docs/master/System.html +++ b/docs/master/System.html @@ -63,6 +63,16 @@

      Functions summary

      cmd/1
    2795. +
    2796. + + cwd/0 + +
    2797. +
    2798. + + cwd!/0 + +
    2799. find_executable/1 @@ -103,6 +113,26 @@

      Functions summary

      stacktrace/0
    2800. +
    2801. + + tmp_dir/0 + +
    2802. +
    2803. + + tmp_dir!/0 + +
    2804. +
    2805. + + user_home/0 + +
    2806. +
    2807. + + user_home!/0 + +
    2808. version/0 @@ -125,7 +155,7 @@

      Functions

      Returns the list of command-line arguments passed to the program.

      - Source + Source

      at_exit(fun) @@ -137,14 +167,14 @@

      Functions

      The function must expect the exit status code as argument.

      - Source + Source

      build_info()

      Returns a keywords list with version, git tag info and date.

      - Source + Source

      cmd(command) @@ -156,7 +186,22 @@

      Functions

      If command is a char list, a char list is returned. Returns a binary otherwise.

      - Source + Source +
      +

      + cwd() +

      +

      Returns the current working directory or nil if one +is not available.

      +
      + Source +
      +

      + cwd!() +

      +

      Returns the current working directory or raises System.NoAccessCwdError.

      +
      + Source

      find_executable(command) @@ -168,7 +213,7 @@

      Functions

      If command is a char list, a char list is returned. Returns a binary otherwise.

      - Source + Source

      get_env() @@ -177,7 +222,7 @@

      Functions

      given as a single string of the format "VarName=Value", where VarName is the name of the variable and Value its value.

      - Source + Source

      get_env(varname) @@ -186,7 +231,7 @@

      Functions

      varname as a binary, or nil if the environment variable is undefined.

      - Source + Source

      get_pid() @@ -196,7 +241,7 @@

      Functions

      See http://www.erlang.org/doc/man/os.html#getpid-0 for more info.

      - Source + Source

      halt(status // 0, options // []) @@ -230,7 +275,7 @@

      Examples

      System.halt(:abort)
      - Source + Source

      put_env(dict) @@ -238,14 +283,14 @@

      Examples

      Sets a new value for each environment variable corresponding to each key in dict.

      - Source + Source

      put_env(varname, value)

      Sets a new value for the environment variable varname.

      - Source + Source

      stacktrace() @@ -256,14 +301,56 @@

      Examples

      return the current stacktrace but rather the stacktrace of the latest exception.

      - Source + Source +
      +

      + tmp_dir() +

      +

      Returns a writable temporary directory. +It searches for directories in the following order:

      + +
        +
      1. The directory named by the TMPDIR environment variable
      2. +
      3. The directory named by the TEMP environment variable
      4. +
      5. The directory named by the TMP environment variable
      6. +
      7. C:\TMP on Windows or /tmp on Unix
      8. +
      9. As a last resort, the current working directory
      10. +
      + +

      Returns nil if none of the above are writable.

      +
      + Source +
      +

      + tmp_dir!() +

      +

      Same as tmp_dir but raises System.NoTmpDirError +instead of returning nil if no temp dir is set.

      +
      + Source +
      +

      + user_home() +

      +

      Returns the user home (platform independent). +It returns nil if no user home is set.

      +
      + Source +
      +

      + user_home!() +

      +

      Same as user_home but raises System.NoHomeError +instead of returning nil if no user home is set.

      +
      + Source

      version()

      Returns Elixir's version as binary.

      - Source + Source
      diff --git a/docs/master/modules_list.html b/docs/master/modules_list.html index 73a95b97b..fc68c6a5f 100644 --- a/docs/master/modules_list.html +++ b/docs/master/modules_list.html @@ -16,7 +16,7 @@
    2809. - -
    2810. - - - Tasks.Iex - - Mix.Tasks.Iex -
    2811. -
        - - -
      • - - run/1 - - Mix.Tasks.Iex -
      • -
    2812. @@ -5485,6 +5467,13 @@

      Path

    2813. +
    2814. + + relative/1 + + Path +
    2815. +
    2816. relative_to/2 @@ -5513,6 +5502,13 @@

      Path

    2817. +
    2818. + + type/1 + + Path +
    2819. +
    2820. wildcard/1 @@ -6227,6 +6223,20 @@

      System

    2821. +
    2822. + + cwd/0 + + System +
    2823. + +
    2824. + + cwd!/0 + + System +
    2825. +
    2826. find_executable/1 @@ -6283,6 +6293,34 @@

      System

    2827. +
    2828. + + tmp_dir/0 + + System +
    2829. + +
    2830. + + tmp_dir!/0 + + System +
    2831. + +
    2832. + + user_home/0 + + System +
    2833. + +
    2834. + + user_home!/0 + + System +
    2835. +
    2836. version/0 diff --git a/docs/master/protocols_list.html b/docs/master/protocols_list.html index cc5815b12..6e20e63b2 100644 --- a/docs/master/protocols_list.html +++ b/docs/master/protocols_list.html @@ -16,7 +16,7 @@
    2837. -
    2838. - - - Path.NoHomeError - - Path.NoHomeError -
    2839. -
        - -
    2840. @@ -538,6 +527,39 @@

      SyntaxError

    2841. + +
    2842. + + + System.NoAccessCwdError + + System.NoAccessCwdError +
    2843. +
        + + +
      +
    2844. + + + System.NoHomeError + + System.NoHomeError +
    2845. +
        + + +
      +
    2846. + + + System.NoTmpDirError + + System.NoTmpDirError +
    2847. +
        + +
    2848. diff --git a/docs/stable/Access.Atom.html b/docs/stable/Access.Atom.html index 6c366febb..cfaef7331 100644 --- a/docs/stable/Access.Atom.html +++ b/docs/stable/Access.Atom.html @@ -29,7 +29,7 @@

      - Source + Source @@ -62,7 +62,7 @@

      Functions

      at compilation time. If we reach this, we should raise an exception.

      - Source + Source diff --git a/docs/stable/Access.Binary.Dict.html b/docs/stable/Access.Binary.Dict.html index 64bb67f7e..483b82ccb 100644 --- a/docs/stable/Access.Binary.Dict.html +++ b/docs/stable/Access.Binary.Dict.html @@ -29,14 +29,22 @@

      - Source + Source +

      Functions summary

      + @@ -44,6 +52,19 @@

      +
      +

      Functions

      +
      +

      + access(dict, key) +

      +
      + Source +
      +
      + + + diff --git a/docs/stable/Access.Function.html b/docs/stable/Access.Function.html index 7ee7625c8..3641fcbf8 100644 --- a/docs/stable/Access.Function.html +++ b/docs/stable/Access.Function.html @@ -29,7 +29,7 @@

      - Source + Source @@ -63,7 +63,7 @@

      Functions

      is useful because it allows a function to be passed as argument in places a dict would also fit.

      - Source + Source diff --git a/docs/stable/Access.HashDict.html b/docs/stable/Access.HashDict.html index 86891033e..180a77fa2 100644 --- a/docs/stable/Access.HashDict.html +++ b/docs/stable/Access.HashDict.html @@ -29,14 +29,22 @@

      - Source + Source +

      Functions summary

      + @@ -44,6 +52,19 @@

      +
      +

      Functions

      +
      +

      + access(dict, key) +

      +
      + Source +
      +
      + + + diff --git a/docs/stable/Access.List.html b/docs/stable/Access.List.html index f538c7d31..4392d3825 100644 --- a/docs/stable/Access.List.html +++ b/docs/stable/Access.List.html @@ -56,17 +56,20 @@

      Functions summary

      Functions

      - access(list, atom) + access(list, key)

      -

      Access the given key in a keyword list.

      +

      Access the given key in a tuple list.

      Examples

      keywords = [a: 1, b: 2]
       keywords[:a] #=> 1
      +
      +star_ratings = [{1.0, "★"}, {1.5, "★☆"}, {2.0, "★★"}]
      +star_ratings[1.5] #=> "★☆"
       
      - Source + Source
      diff --git a/docs/stable/Access.OrdDict.html b/docs/stable/Access.OrdDict.html index 4a1609b50..4d64bd824 100644 --- a/docs/stable/Access.OrdDict.html +++ b/docs/stable/Access.OrdDict.html @@ -29,14 +29,22 @@

      - Source + Source +

      Functions summary

      + @@ -44,6 +52,19 @@

      +
      +

      Functions

      +
      +

      + access(dict, key) +

      +
      + Source +
      +
      + + + diff --git a/docs/stable/Application.Behaviour.html b/docs/stable/Application.Behaviour.html new file mode 100644 index 000000000..da32d224d --- /dev/null +++ b/docs/stable/Application.Behaviour.html @@ -0,0 +1,100 @@ + + + + Application.Behaviour + + + + + + + + + + + + +
      +

      + Application.Behaviour + +

      + + +
      +

      This module is a convenience to define application module callbacks.

      + +

      In Erlang/OTP, an application is a component that can be started +and stopped as a unit, and which can be re-used in other systems +as well.

      + +

      The first step to achieve this is to define an application specification. +For example, if your application is named :my_app, an app specification +should exist at ebin/my_app.app. This file is usually defined by +build tools like Mix.

      + +

      Then, with the app specification in hands, we must also define an +application module callback that controls how to start and stop +such applications. This module is about defining such callbacks.

      + +

      There are two callbacks required to be implemented:

      + +
        +
      1. start(type, args) - It must return { :ok, pid } or +{ :ok, pid, state }, where pid is the process identifier +of the supervisor tree root;

      2. +
      3. stop(state) receives the state returned by start and should +do any necessary cleaning up. Notice that shutting down the supervisor +is automatically handled by the VM;

      4. +
      + +

      When using this module, it simply tags the module behaviour as +:application and defines a default stop/1 callback. The start/2 +still needs to be defined by the user.

      + +

      You can learn more about the :application module, the application +specification and the application module callbacks below:

      + +

      http://www.erlang.org/doc/man/application.html +http://www.erlang.org/doc/design_principles/applications.html +http://learnyousomeerlang.com/building-otp-applications

      + +

      Example

      + +
      defmodule MyApp do
      +  use Application.Behaviour
      +
      +  def start(_type, args) do
      +    MyApp.Sup.start_link(args)
      +  end
      +end
      +
      + +
      + + + Source + + + + + + + + + + + + + + + + +
      + + diff --git a/docs/stable/ArgumentError.html b/docs/stable/ArgumentError.html index ff6dd3be4..55e962cf7 100644 --- a/docs/stable/ArgumentError.html +++ b/docs/stable/ArgumentError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -47,55 +47,7 @@

      Fields (and defaults)

      -

      Functions summary

      - @@ -103,67 +55,6 @@

      Functions summary

      -
      -

      Functions

      -
      -

      - exception(args) -

      -
      - Source -
      -

      - exception(args, self) -

      -
      - Source -
      -

      - message(record) -

      -
      - Source -
      -

      - message(value, record) -

      -
      - Source -
      -

      - new() -

      -
      - Source -
      -

      - new(opts) -

      -
      - Source -
      -

      - to_keywords(record) -

      -
      - Source -
      -

      - update(keywords, record) -

      -
      - Source -
      -

      - update_message(function, record) -

      -
      - Source -
      -
      - - - diff --git a/docs/stable/ArithmeticError.html b/docs/stable/ArithmeticError.html index 1da22ab13..803ab5bc5 100644 --- a/docs/stable/ArithmeticError.html +++ b/docs/stable/ArithmeticError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -47,55 +47,7 @@

      Fields (and defaults)

      -

      Functions summary

      - @@ -103,67 +55,6 @@

      Functions summary

      -
      -

      Functions

      -
      -

      - exception(args) -

      -
      - Source -
      -

      - exception(args, self) -

      -
      - Source -
      -

      - message(record) -

      -
      - Source -
      -

      - message(value, record) -

      -
      - Source -
      -

      - new() -

      -
      - Source -
      -

      - new(opts) -

      -
      - Source -
      -

      - to_keywords(record) -

      -
      - Source -
      -

      - update(keywords, record) -

      -
      - Source -
      -

      - update_message(function, record) -

      -
      - Source -
      -
      - - - diff --git a/docs/stable/BadArityError.html b/docs/stable/BadArityError.html index 4d4bdacd8..490017446 100644 --- a/docs/stable/BadArityError.html +++ b/docs/stable/BadArityError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -56,70 +56,10 @@

      Fields (and defaults)

      Functions summary

      @@ -132,83 +72,11 @@

      Functions summary

      Functions

      -

      - args(record) -

      -
      - Source -
      -

      - args(value, record) -

      -
      - Source -
      -

      - exception(args) -

      -
      - Source -
      -

      - exception(args, self) -

      -
      - Source -
      -

      - function(record) -

      -
      - Source -
      -

      - function(value, record) -

      -
      - Source -

      message(exception)

      - Source -
      -

      - new() -

      -
      - Source -
      -

      - new(opts) -

      -
      - Source -
      -

      - to_keywords(record) -

      -
      - Source -
      -

      - update(keywords, record) -

      -
      - Source -
      -

      - update_args(function, record) -

      -
      - Source -
      -

      - update_function(function, record) -

      -
      - Source + Source
      diff --git a/docs/stable/BadFunctionError.html b/docs/stable/BadFunctionError.html index 24ffc5af2..d52162522 100644 --- a/docs/stable/BadFunctionError.html +++ b/docs/stable/BadFunctionError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -50,55 +50,10 @@

      Fields (and defaults)

      Functions summary

      @@ -111,65 +66,11 @@

      Functions summary

      Functions

      -

      - actual(record) -

      -
      - Source -
      -

      - actual(value, record) -

      -
      - Source -
      -

      - exception(args) -

      -
      - Source -
      -

      - exception(args, self) -

      -
      - Source -

      message(exception)

      - Source -
      -

      - new() -

      -
      - Source -
      -

      - new(opts) -

      -
      - Source -
      -

      - to_keywords(record) -

      -
      - Source -
      -

      - update(keywords, record) -

      -
      - Source -
      -

      - update_actual(function, record) -

      -
      - Source + Source
      diff --git a/docs/stable/Behaviour.html b/docs/stable/Behaviour.html index a42786017..055e314b0 100644 --- a/docs/stable/Behaviour.html +++ b/docs/stable/Behaviour.html @@ -89,11 +89,6 @@

      Macros summary

      defcallback/1
    2849. -
    2850. - - defcallback/2 - -
    2851. @@ -109,12 +104,6 @@

      Macros

      defcallback(fun)

      -
      - Source -
      -

      - defcallback(fun, list2) -

      Defines a callback according to the given type specification.

      Source diff --git a/docs/stable/Binary.Dict.html b/docs/stable/Binary.Dict.html index 4df282f5f..2a71f9abf 100644 --- a/docs/stable/Binary.Dict.html +++ b/docs/stable/Binary.Dict.html @@ -36,7 +36,7 @@

      - Source + Source @@ -46,41 +46,6 @@

      Functions summary

      @@ -137,54 +72,12 @@

      Functions summary

      Functions

      -

      - delete(arg1, key) -

      -
      - Source -
      -

      - empty(_) -

      -
      - Source -
      -

      - get(arg1, key, default) -

      -
      - Source -
      -

      - get!(arg1, key) -

      -
      - Source -
      -

      - has_key?(arg1, key) -

      -
      - Source -
      -

      - keys(arg1) -

      -
      - Source -
      -

      - merge(d1, d2, fun) -

      -
      - Source -

      new()

      Creates a new empty dict.

      - Source + Source

      new(pairs) @@ -197,7 +90,7 @@

      Examples

      #=> [a: 1, b: 2]
      - Source + Source

      new(list, transform) @@ -211,43 +104,7 @@

      Examples

      #=> ["a": "a", "b": "b"]
      - Source -
      -

      - put(arg1, key, value) -

      -
      - Source -
      -

      - size(arg1) -

      -
      - Source -
      -

      - to_list(arg1) -

      -
      - Source -
      -

      - update(arg1, key, fun) -

      -
      - Source -
      -

      - update(arg1, key, initial, fun) -

      -
      - Source -
      -

      - values(arg1) -

      -
      - Source + Source
      diff --git a/docs/stable/Binary.Inspect.Atom.html b/docs/stable/Binary.Inspect.Atom.html index 1afa443d7..a8e5c73e8 100644 --- a/docs/stable/Binary.Inspect.Atom.html +++ b/docs/stable/Binary.Inspect.Atom.html @@ -46,19 +46,40 @@

      Examples

      - Source + Source +

      Functions summary

      + + +
      +

      Functions

      +
      +

      + inspect(atom, _) +

      +
      + Source +
      +
      + diff --git a/docs/stable/Binary.Inspect.BitString.html b/docs/stable/Binary.Inspect.BitString.html index 2ace9f3d4..29b836854 100644 --- a/docs/stable/Binary.Inspect.BitString.html +++ b/docs/stable/Binary.Inspect.BitString.html @@ -41,19 +41,40 @@

      Examples

      - Source + Source +

      Functions summary

      + + +
      +

      Functions

      +
      +

      + inspect(thing, opts) +

      +
      + Source +
      +
      + diff --git a/docs/master/Binary.Inspect.Any.html b/docs/stable/Binary.Inspect.Function.html similarity index 80% rename from docs/master/Binary.Inspect.Any.html rename to docs/stable/Binary.Inspect.Function.html index f86a782fe..7abed6af3 100644 --- a/docs/master/Binary.Inspect.Any.html +++ b/docs/stable/Binary.Inspect.Function.html @@ -1,7 +1,7 @@ - Binary.Inspect.Any + Binary.Inspect.Function @@ -21,7 +21,7 @@

      - Binary.Inspect.Any + Binary.Inspect.Function impl @@ -29,13 +29,7 @@

      -

      For all other terms not implemented, we use the default -Erlang representation.

      - -

      Examples

      - -
      inspect Process.self #=> "<0.35.0>"
      -
      +

      Inspect functions, when possible, in a literal form.

      @@ -67,10 +61,10 @@

      Functions summary

      Functions

      - inspect(thing, _) + inspect(function, _opts)

      - Source + Source
      diff --git a/docs/stable/Binary.Inspect.HashDict.html b/docs/stable/Binary.Inspect.HashDict.html new file mode 100644 index 000000000..05a0523ec --- /dev/null +++ b/docs/stable/Binary.Inspect.HashDict.html @@ -0,0 +1,72 @@ + + + + Binary.Inspect.HashDict + + + + + + + + + + + + +
      +

      + Binary.Inspect.HashDict + + impl + +

      + + + + Source + + + + + + +

      Functions summary

      + + + + + + + + +
      +

      Functions

      +
      +

      + inspect(dict, opts) +

      +
      + Source +
      +
      + + + + + +
      + + diff --git a/docs/stable/Binary.Inspect.List.html b/docs/stable/Binary.Inspect.List.html index dcb0e4509..f6bb1fe73 100644 --- a/docs/stable/Binary.Inspect.List.html +++ b/docs/stable/Binary.Inspect.List.html @@ -49,19 +49,40 @@

      Examples

      - Source + Source +

      Functions summary

      + + +
      +

      Functions

      +
      +

      + inspect(thing, opts) +

      +
      + Source +
      +
      + diff --git a/docs/stable/Binary.Inspect.Number.html b/docs/stable/Binary.Inspect.Number.html index c25f348bc..19ba12507 100644 --- a/docs/stable/Binary.Inspect.Number.html +++ b/docs/stable/Binary.Inspect.Number.html @@ -39,19 +39,40 @@

      Examples

      - Source + Source +

      Functions summary

      + + +
      +

      Functions

      +
      +

      + inspect(thing, _) +

      +
      + Source +
      +
      + diff --git a/docs/stable/Mix.Tasks.Iex.html b/docs/stable/Binary.Inspect.PID.html similarity index 73% rename from docs/stable/Mix.Tasks.Iex.html rename to docs/stable/Binary.Inspect.PID.html index bde71a0b6..014f2b907 100644 --- a/docs/stable/Mix.Tasks.Iex.html +++ b/docs/stable/Binary.Inspect.PID.html @@ -1,7 +1,7 @@ - Mix.Tasks.Iex + Binary.Inspect.PID @@ -21,21 +21,20 @@

      - Mix.Tasks.Iex + Binary.Inspect.PID + + impl

      -

      Starts an iex repl with your project settings.

      - -

      Before starting IEx, it invokes the prepare task -which defaults to compile and load your project.

      +

      Inspect PIDs

      - Source + Source @@ -46,7 +45,7 @@

      Functions summary

      • - run/1 + inspect/2
      • @@ -61,11 +60,11 @@

        Functions summary

        Functions

        -

        - run(_) +

        + inspect(pid, _)

        - Source + Source
        diff --git a/docs/stable/Binary.Inspect.Port.html b/docs/stable/Binary.Inspect.Port.html new file mode 100644 index 000000000..704f6c138 --- /dev/null +++ b/docs/stable/Binary.Inspect.Port.html @@ -0,0 +1,77 @@ + + + + Binary.Inspect.Port + + + + + + + + + + + + +
        +

        + Binary.Inspect.Port + + impl + +

        + + +
        +

        Inspect ports

        + +
        + + + Source + + + + + + +

        Functions summary

        + + + + + + + + +
        +

        Functions

        +
        +

        + inspect(port, _) +

        +
        + Source +
        +
        + + + + + +
        + + diff --git a/docs/stable/Binary.Inspect.Range.html b/docs/stable/Binary.Inspect.Range.html new file mode 100644 index 000000000..af92c4386 --- /dev/null +++ b/docs/stable/Binary.Inspect.Range.html @@ -0,0 +1,72 @@ + + + + Binary.Inspect.Range + + + + + + + + + + + + +
        +

        + Binary.Inspect.Range + + impl + +

        + + + + Source + + + + + + +

        Functions summary

        + + + + + + + + +
        +

        Functions

        +
        +

        + inspect(arg1, opts) +

        +
        + Source +
        +
        + + + + + +
        + + diff --git a/docs/stable/Binary.Inspect.Reference.html b/docs/stable/Binary.Inspect.Reference.html new file mode 100644 index 000000000..75e428bc4 --- /dev/null +++ b/docs/stable/Binary.Inspect.Reference.html @@ -0,0 +1,77 @@ + + + + Binary.Inspect.Reference + + + + + + + + + + + + +
        +

        + Binary.Inspect.Reference + + impl + +

        + + +
        +

        Inspect references

        + +
        + + + Source + + + + + + +

        Functions summary

        + + + + + + + + +
        +

        Functions

        +
        +

        + inspect(ref, _) +

        +
        + Source +
        +
        + + + + + +
        + + diff --git a/docs/stable/Binary.Inspect.Regex.html b/docs/stable/Binary.Inspect.Regex.html index d838cb495..f25b1e48d 100644 --- a/docs/stable/Binary.Inspect.Regex.html +++ b/docs/stable/Binary.Inspect.Regex.html @@ -39,19 +39,40 @@

        Examples

      - Source + Source +

      Functions summary

      + + +
      +

      Functions

      +
      +

      + inspect(regex, opts) +

      +
      + Source +
      +
      + diff --git a/docs/stable/Binary.Inspect.Tuple.html b/docs/stable/Binary.Inspect.Tuple.html index 112c245c1..5d007c6e8 100644 --- a/docs/stable/Binary.Inspect.Tuple.html +++ b/docs/stable/Binary.Inspect.Tuple.html @@ -41,19 +41,40 @@

      Examples

      - Source + Source +

      Functions summary

      + + +
      +

      Functions

      +
      +

      + inspect(tuple, opts) +

      +
      + Source +
      +
      + diff --git a/docs/stable/Binary.Inspect.html b/docs/stable/Binary.Inspect.html index 96a6e7e57..f24fb214b 100644 --- a/docs/stable/Binary.Inspect.html +++ b/docs/stable/Binary.Inspect.html @@ -48,19 +48,25 @@

      Implementations

    2852. - Any + Atom
    2853. - Atom + BitString
    2854. - BitString + Function + +
    2855. + +
    2856. + + HashDict
    2857. @@ -76,6 +82,30 @@

      Implementations

      +
    2858. + + PID + +
    2859. + +
    2860. + + Port + +
    2861. + +
    2862. + + Range + +
    2863. + +
    2864. + + Reference + +
    2865. +
    2866. Regex diff --git a/docs/stable/CaseClauseError.html b/docs/stable/CaseClauseError.html index d45ae69ac..5e01b7caf 100644 --- a/docs/stable/CaseClauseError.html +++ b/docs/stable/CaseClauseError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -50,55 +50,10 @@

      Fields (and defaults)

      Functions summary

      @@ -111,65 +66,11 @@

      Functions summary

      Functions

      -

      - actual(record) -

      -
      - Source -
      -

      - actual(value, record) -

      -
      - Source -
      -

      - exception(args) -

      -
      - Source -
      -

      - exception(args, self) -

      -
      - Source -

      message(exception)

      - Source -
      -

      - new() -

      -
      - Source -
      -

      - new(opts) -

      -
      - Source -
      -

      - to_keywords(record) -

      -
      - Source -
      -

      - update(keywords, record) -

      -
      - Source -
      -

      - update_actual(function, record) -

      -
      - Source + Source
      diff --git a/docs/stable/Code.LoadError.html b/docs/stable/Code.LoadError.html new file mode 100644 index 000000000..d4388adca --- /dev/null +++ b/docs/stable/Code.LoadError.html @@ -0,0 +1,83 @@ + + + + Code.LoadError + + + + + + + + + + + + +
      +

      + Code.LoadError + + exception + +

      + + + + Source + + + + +

      Fields (and defaults)

      +
        + +
      • + + file: nil + +
      • + +
      + + + +

      Functions summary

      + + + + + + + + +
      +

      Functions

      +
      +

      + message(exception) +

      +
      + Source +
      +
      + + + + + +
      + + diff --git a/docs/stable/Code.html b/docs/stable/Code.html index 9a6c47eef..d8ddfbd97 100644 --- a/docs/stable/Code.html +++ b/docs/stable/Code.html @@ -151,9 +151,9 @@

      Functions

      append_path(path)

      Appends a path to Erlang VM code path. -The path is expanded with File.expand_path before added.

      +The path is expanded with Path.expand before added.

      - Source + Source

      compile_string(string, file // "nofile") @@ -164,7 +164,7 @@

      Functions

      For compiling many files at once, check Kernel.ParallelCompiler.

      - Source + Source

      compiler_options() @@ -172,7 +172,7 @@

      Functions

      Loads the compilation options from the code server. Check compiler_options/1 for more information.

      - Source + Source

      compiler_options(opts) @@ -192,15 +192,15 @@

      Functions

      without raising errors, false by default;
    2867. - Source + Source

      delete_path(path)

      Deletes a path from Erlang VM code path. -The path is expanded with File.expand_path before deleted.

      +The path is expanded with Path.expand before deleted.

      - Source + Source

      ensure_compiled(module) @@ -217,7 +217,7 @@

      Functions

      Check ensure_loaded/1 for more information on module loading and when to use ensure_loaded/1 or ensure_compiled/1.

      - Source + Source

      ensure_compiled?(module) @@ -225,7 +225,7 @@

      Functions

      Similar to ensure_compiled/1, but returns a boolean in case it could be ensured or not.

      - Source + Source

      ensure_loaded(module) @@ -267,7 +267,7 @@

      Code.ensure_compiled

      must be used just in same rare conditions, usually involving macros that needs to invoke a module for callback information.

      - Source + Source

      ensure_loaded?(module) @@ -275,7 +275,7 @@

      Code.ensure_compiled

      Similar to ensure_loaded/1, but returns a boolean in case it could be ensured or not.

      - Source + Source

      eval(string, binding // [], opts // []) @@ -287,16 +287,27 @@

      Code.ensure_compiled

      • :file - the file to be considered in the evaluation
      • :line - the line the script starts
      • +
      • :delegate_locals_to - delegate local calls to the given module, +the default is to not delegate
      • +
      + +

      Besides, the following scope values can be configured:

      + +
      • :aliases - a list of tuples with the alias and its target
      • :requires - a list of modules required
      • :functions - a list of tuples where the first element is a module and the second a list of imported function names and arity
      • :macros - a list of tuples where the first element is a module and the second a list of imported macro names and arity
      • -
      • :delegate_locals_to - delegate local calls to the given module, -the default is to not delegate
      +

      Notice that setting any ov the values above overrides Elixir default +values. For example, setting :requires to [], will no longer +automatically required the Kernel module, in the same way setting +:macros will no longer auto-import Kernel macros as if, case, +etc.

      +

      Examples

      Code.eval "a + b", [a: 1, b: 2], file: __ENV__.file, line: __ENV__.line
      @@ -311,7 +322,7 @@ 

      Examples

      #=> { 3, [ {:a, 1}, {:b, 2} ] }
      - Source + Source

      eval_quoted(quoted, binding // [], opts // []) @@ -336,7 +347,7 @@

      Examples

      #=> { 3, [ {:a, 1}, {:b, 2} ] }
      - Source + Source

      load_file(file, relative_to // nil) @@ -352,22 +363,22 @@

      Examples

      a given file, the given file will be loaded N times. Check require_file if you don't want a file to be loaded concurrently.

      - Source + Source

      loaded_files()

      Returns all the loaded files.

      - Source + Source

      prepend_path(path)

      Prepends a path to Erlang VM code path. -The path is expanded with File.expand_path before added.

      +The path is expanded with Path.expand before added.

      - Source + Source

      require_file(file, relative_to // nil) @@ -384,7 +395,7 @@

      Examples

      file, the given file will be loaded only once. Check load_file if you want a file to be loaded concurrently.

      - Source + Source

      string_to_ast(string, opts // []) @@ -402,7 +413,7 @@

      Options

      when non-existing atoms are found by the tokenizer.

      - Source + Source

      string_to_ast!(string, opts // []) @@ -414,7 +425,7 @@

      Options

      Check Code.string_to_ast/2 for options information.

      - Source + Source

      unload_files(files) @@ -424,7 +435,7 @@

      Options

      calling this function only removes it from the list, allowing it to be required again.

      - Source + Source diff --git a/docs/stable/CompileError.html b/docs/stable/CompileError.html index 64bbb0eab..d8af90bc2 100644 --- a/docs/stable/CompileError.html +++ b/docs/stable/CompileError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -62,85 +62,10 @@

      Fields (and defaults)

      Functions summary

      @@ -153,101 +78,11 @@

      Functions summary

      Functions

      -

      - description(record) -

      -
      - Source -
      -

      - description(value, record) -

      -
      - Source -
      -

      - exception(args) -

      -
      - Source -
      -

      - exception(args, self) -

      -
      - Source -
      -

      - file(record) -

      -
      - Source -
      -

      - file(value, record) -

      -
      - Source -
      -

      - line(record) -

      -
      - Source -
      -

      - line(value, record) -

      -
      - Source -

      message(exception)

      - Source -
      -

      - new() -

      -
      - Source -
      -

      - new(opts) -

      -
      - Source -
      -

      - to_keywords(record) -

      -
      - Source -
      -

      - update(keywords, record) -

      -
      - Source -
      -

      - update_description(function, record) -

      -
      - Source -
      -

      - update_file(function, record) -

      -
      - Source -
      -

      - update_line(function, record) -

      -
      - Source + Source
      diff --git a/docs/stable/Dict.html b/docs/stable/Dict.html index 76235be02..c9c8c0318 100644 --- a/docs/stable/Dict.html +++ b/docs/stable/Dict.html @@ -31,20 +31,14 @@

      This module specifies the Dict API expected to be implemented by different dictionaries. It also provides -functions that redirect to the underlying Dict based on -the tuple signature.

      - -

      The keyword list used throughout Elixir cannot be -manipulated via the Dict module, you must use the -Keyword module instead. This distinction is intentional: -the Dict module is meant to work on structures that work -as storage.

      +functions that redirect to the underlying Dict, allowing +a developer to work with different Dict implementations +using one API.

      To create a new dict, use the new functions defined by each dict type:

      -
      OrdDict.new [{:a, 1}, {:b, 2}]
      -HashDict.new  #=> creates an empty HashDict
      +
      HashDict.new  #=> creates an empty HashDict
       

      For simplicity's sake, in the examples below everytime @@ -54,6 +48,9 @@

      it implies that the returned value is actually of the same dict type as the input one.

      +

      Keep in mind that all dicts are also required to +implement both Access and Enum.Iterator protocols.

      +

      @@ -111,6 +108,11 @@

      Functions summary

      put/3 +
    2868. + + put_new/3 + +
    2869. size/1 @@ -150,6 +152,11 @@

      Callbacks summary

      values/1
    2870. +
    2871. + + update/4 + +
    2872. update/3 @@ -165,6 +172,11 @@

      Callbacks summary

      size/1
    2873. +
    2874. + + put_new/3 + +
    2875. put/3 @@ -175,6 +187,11 @@

      Callbacks summary

      merge/3
    2876. +
    2877. + + merge/2 + +
    2878. keys/1 @@ -185,11 +202,21 @@

      Callbacks summary

      has_key?/2
    2879. +
    2880. + + get!/2 + +
    2881. get/3
    2882. +
    2883. + + get/2 + +
    2884. empty/1 @@ -223,14 +250,14 @@

      Examples

      Dict.delete d, :a #=> [b: 2]
      - Source + Source

      empty(dict)

      Returns an empty dict of the same type as dict.

      - Source + Source

      get(dict, key, default // nil) @@ -246,7 +273,7 @@

      Examples

      Dict.get d, :b, 3 #=> 3
      - Source + Source

      get!(dict, key) @@ -261,7 +288,7 @@

      Examples

      Dict.get d, :b #=> raises KeyError[key: :b]
      - Source + Source

      has_key?(dict, key) @@ -275,7 +302,7 @@

      Examples

      Dict.has_key?(d, :b) #=> false
      - Source + Source

      keys(dict) @@ -290,15 +317,13 @@

      Examples

      Dict.keys d #=> [:a,:b]
      - Source + Source

      - merge(dict1, dict2) + merge(dict, enum)

      -

      Merges two dicts into one. If the dicts have duplicated entries, -the one given as second argument wins. In case the second argument -is not of the same kind as the first one, it is converted to the -same kind before merging as long as it implements the Enum protocol.

      +

      Merges the given enum into the dict. In case one of the enum entries +alread exist in the dict, it is given higher preference.

      Examples

      @@ -308,13 +333,14 @@

      Examples

      #=> [a: 3, b: 2, d: 4]
      - Source + Source

      - merge(dict1, dict2, fun) + merge(dict, enum, fun)

      -

      Merges two dicts into one. If the dicts have duplicated entries, the given -function is invoked to solve conflicts.

      +

      Merges the given enum into the dict. In case one of the enum entries +alread exist in the dict, the given function is invoked to solve +conflicts.

      Examples

      @@ -326,7 +352,7 @@

      Examples

      #=> [a: 4, b: 2, d: 4]
      - Source + Source

      put(dict, key, val) @@ -341,7 +367,21 @@

      Examples

      #=> [a: 3, b: 2]
      - Source + Source +
      +

      + put_new(dict, key, val) +

      +

      Puts the given value under key in dict unless key already exists.

      + +

      Examples

      + +
      d = new [a: 1, b: 2]
      +Dict.put_new d, :a, 3
      +#=> [a: 1, b: 2]
      +
      +
      + Source

      size(dict) @@ -354,7 +394,7 @@

      Examples

      Dict.size d #=> 2
      - Source + Source

      to_list(dict) @@ -362,7 +402,7 @@

      Examples

      Returns a list of key-value pairs stored in dict. No particular order is enforced.

      - Source + Source

      update(dict, key, fun) @@ -377,7 +417,7 @@

      Examples

      #=> [a: -1, b: 2]
      - Source + Source

      update(dict, key, initial, fun) @@ -393,7 +433,7 @@

      Examples

      #=> [a: 1, b: 2, c: 3]
      - Source + Source

      values(dict) @@ -406,7 +446,7 @@

      Examples

      Dict.values d #=> [1,2]
      - Source + Source @@ -421,6 +461,12 @@

      Callbacks

      values(t())

      + Source +
      +

      + update(t(), key(), value(), (value() -> value())) +

      +
      Source

      @@ -440,48 +486,72 @@

      Callbacks

      Source +
      +

      + put_new(t(), key(), value()) +

      +
      + Source

      put(t(), key(), value())

      - Source + Source

      merge(t(), t(), (key(), value(), value() -> value()))

      - Source + Source +
      +

      + merge(t(), t()) +

      +
      + Source

      keys(t())

      - Source + Source

      has_key?(t(), key())

      - Source + Source +
      +

      + get!(t(), key()) +

      +
      + Source

      get(t(), key(), value())

      - Source + Source +
      +

      + get(t(), key()) +

      +
      + Source

      empty(t())

      - Source + Source

      delete(t(), key())

      - Source + Source
      diff --git a/docs/stable/EEx.SyntaxError.html b/docs/stable/EEx.SyntaxError.html index 88579ae62..b51329ebb 100644 --- a/docs/stable/EEx.SyntaxError.html +++ b/docs/stable/EEx.SyntaxError.html @@ -47,55 +47,7 @@

      Fields (and defaults)

      -

      Functions summary

      - @@ -103,67 +55,6 @@

      Functions summary

      -
      -

      Functions

      -
      -

      - exception(args) -

      -
      - Source -
      -

      - exception(args, self) -

      -
      - Source -
      -

      - message(record) -

      -
      - Source -
      -

      - message(value, record) -

      -
      - Source -
      -

      - new() -

      -
      - Source -
      -

      - new(opts) -

      -
      - Source -
      -

      - to_keywords(record) -

      -
      - Source -
      -

      - update(keywords, record) -

      -
      - Source -
      -

      - update_message(function, record) -

      -
      - Source -
      -
      - - - diff --git a/docs/stable/Enum.Iterator.Binary.Dict.html b/docs/stable/Enum.Iterator.Binary.Dict.html index 7d805ed84..3aac32d21 100644 --- a/docs/stable/Enum.Iterator.Binary.Dict.html +++ b/docs/stable/Enum.Iterator.Binary.Dict.html @@ -29,14 +29,27 @@

      - Source + Source +

      Functions summary

      + @@ -44,6 +57,25 @@

      +
      +

      Functions

      +
      +

      + count(arg1) +

      +
      + Source +
      +

      + iterator(arg1) +

      +
      + Source +
      +
      + + + diff --git a/docs/stable/Enum.Iterator.Function.html b/docs/stable/Enum.Iterator.Function.html index 60fee1252..b100394e3 100644 --- a/docs/stable/Enum.Iterator.Function.html +++ b/docs/stable/Enum.Iterator.Function.html @@ -29,14 +29,27 @@

      - Source + Source +

      Functions summary

      + @@ -44,6 +57,25 @@

      +
      +

      Functions

      +
      +

      + count(function) +

      +
      + Source +
      +

      + iterator(function) +

      +
      + Source +
      +
      + + + diff --git a/docs/stable/Enum.Iterator.HashDict.html b/docs/stable/Enum.Iterator.HashDict.html index 356652169..8b507ebd6 100644 --- a/docs/stable/Enum.Iterator.HashDict.html +++ b/docs/stable/Enum.Iterator.HashDict.html @@ -29,14 +29,27 @@

      - Source + Source +

      Functions summary

      + @@ -44,6 +57,25 @@

      +
      +

      Functions

      +
      +

      + count(dict) +

      +
      + Source +
      +

      + iterator(dict) +

      +
      + Source +
      +
      + + + diff --git a/docs/stable/Enum.Iterator.List.html b/docs/stable/Enum.Iterator.List.html index 2512817e3..ec6727148 100644 --- a/docs/stable/Enum.Iterator.List.html +++ b/docs/stable/Enum.Iterator.List.html @@ -29,14 +29,27 @@

      - Source + Source +

      Functions summary

      + @@ -44,6 +57,25 @@

      +
      +

      Functions

      +
      +

      + count(list) +

      +
      + Source +
      +

      + iterator(list) +

      +
      + Source +
      +
      + + + diff --git a/docs/stable/Enum.Iterator.Orddict.html b/docs/stable/Enum.Iterator.Orddict.html index eff971109..59ee6956c 100644 --- a/docs/stable/Enum.Iterator.Orddict.html +++ b/docs/stable/Enum.Iterator.Orddict.html @@ -29,14 +29,27 @@

      - Source + Source +

      Functions summary

      + @@ -44,6 +57,25 @@

      +
      +

      Functions

      +
      +

      + count(arg1) +

      +
      + Source +
      +

      + iterator(arg1) +

      +
      + Source +
      +
      + + + diff --git a/docs/stable/Enum.Iterator.Range.html b/docs/stable/Enum.Iterator.Range.html index 6284c9fd7..3be0a165c 100644 --- a/docs/stable/Enum.Iterator.Range.html +++ b/docs/stable/Enum.Iterator.Range.html @@ -36,7 +36,20 @@

      +

      Functions summary

      + @@ -44,6 +57,25 @@

      +
      +

      Functions

      +
      +

      + count(range) +

      +
      + Source +
      +

      + iterator(range) +

      +
      + Source +
      +
      + + + diff --git a/docs/stable/Enum.OutOfBoundsError.html b/docs/stable/Enum.OutOfBoundsError.html index 449c27827..c5e344942 100644 --- a/docs/stable/Enum.OutOfBoundsError.html +++ b/docs/stable/Enum.OutOfBoundsError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -47,55 +47,7 @@

      Fields (and defaults)

      -

      Functions summary

      - @@ -103,67 +55,6 @@

      Functions summary

      -
      -

      Functions

      -
      -

      - exception(args) -

      -
      - Source -
      -

      - exception(args, self) -

      -
      - Source -
      -

      - message(record) -

      -
      - Source -
      -

      - message(value, record) -

      -
      - Source -
      -

      - new() -

      -
      - Source -
      -

      - new(opts) -

      -
      - Source -
      -

      - to_keywords(record) -

      -
      - Source -
      -

      - update(keywords, record) -

      -
      - Source -
      -

      - update_message(function, record) -

      -
      - Source -
      -
      - - - diff --git a/docs/stable/Enum.html b/docs/stable/Enum.html index 53044e9ad..102194a5d 100644 --- a/docs/stable/Enum.html +++ b/docs/stable/Enum.html @@ -236,7 +236,7 @@

      Examples

      Enum.all? [1,nil,3] #=> false - Source + Source

      any?(collection, fun // fn x -> x end) @@ -260,7 +260,7 @@

      Examples

      Enum.any? [false,true,false] #=> true
      - Source + Source

      at!(collection, n) @@ -278,7 +278,7 @@

      Examples

      Enum.at! [2,4,6], 4 #=> raises Enum.OutOfBoundsError
      - Source + Source

      count(collection) @@ -290,14 +290,14 @@

      Examples

      Enum.count [1,2,3] #=> 3
       
      - Source + Source

      count(collection, fun)

      Counts for how many items the function returns true.

      - Source + Source

      drop(collection, count) @@ -312,7 +312,7 @@

      Examples

      Enum.drop [1,2,3], 0 #=> [1,2,3]
      - Source + Source

      drop_while(collection, fun) @@ -326,20 +326,21 @@

      Examples

      #=> [3,4,5]
      - Source + Source

      each(collection, fun)

      Invokes the given fun for each item in the collection. -Returns the collection itself.

      +Returns the collection itself. fun can take two parameters, +in which case the second parameter will be the iteration index.

      Examples

      Enum.each ['some', 'example'], fn(x) -> IO.puts x end
       
      - Source + Source

      empty?(collection) @@ -352,7 +353,7 @@

      Examples

      Enum.empty? [1,2,3] #=> false
      - Source + Source

      filter(collection, fun) @@ -366,7 +367,7 @@

      Examples

      #=> [2]
      - Source + Source

      filter_map(collection, filter, mapper) @@ -379,7 +380,7 @@

      Examples

      #=> [4]
      - Source + Source

      find(collection, ifnone // nil, fun) @@ -399,7 +400,7 @@

      Examples

      #=> 3
      - Source + Source

      find_index(collection, fun) @@ -418,7 +419,7 @@

      Examples

      #=> 2
      - Source + Source

      find_value(collection, ifnone // nil, fun) @@ -435,7 +436,7 @@

      Examples

      #=> true
      - Source + Source

      first(collection) @@ -448,7 +449,7 @@

      Examples

      Enum.first [1,2,3] #=> 1
      - Source + Source

      join(collection, joiner // "") @@ -469,14 +470,17 @@

      Examples

      Enum.join([1,2,3], ' = ') #=> '1 = 2 = 3'
      - Source + Source

      map(collection, fun)

      Returns a new collection, where each item is the result of invoking fun on each corresponding item of collection. -For dicts, the function accepts a key-value tuple.

      +fun can take two parameters, in which case the second parameter +will be the iteration index.

      + +

      For dicts, the function accepts a key-value tuple.

      Examples

      @@ -487,7 +491,7 @@

      Examples

      #=> [a: -1, b: -2]
      - Source + Source

      map_join(collection, joiner // "", mapper) @@ -508,7 +512,7 @@

      Examples

      Enum.map_join([1,2,3], ' = ', &1 * 2) #=> '2 = 4 = 6'
      - Source + Source

      map_reduce(collection, acc, f) @@ -527,7 +531,7 @@

      Examples

      #=> { [2, 4, 6], 6 }
      - Source + Source

      partition(collection, fun) @@ -542,7 +546,7 @@

      Examples

      #=> { [2], [1,3] }
      - Source + Source

      reduce(collection, acc, fun) @@ -557,7 +561,7 @@

      Examples

      #=> 6
      - Source + Source

      reverse(collection) @@ -570,7 +574,7 @@

      Examples

      #=> [3, 2, 1]
      - Source + Source

      sort(collection) @@ -582,7 +586,7 @@

      Examples

      Enum.sort [3,2,1] #=> [1,2,3]
       
      - Source + Source

      sort(collection, fun) @@ -594,7 +598,7 @@

      Examples

      Enum.sort [3,2,1], &1 > &2 #=> [1,2,3]
       
      - Source + Source

      split(collection, count) @@ -617,7 +621,7 @@

      Examples

      Enum.split [1,2,3], -5 #=> { [], [1,2,3] }
      - Source + Source

      split_while(collection, fun) @@ -631,7 +635,7 @@

      Examples

      #=> { [1], [2, 3, 4] }
      - Source + Source

      take(collection, count) @@ -646,7 +650,7 @@

      Examples

      Enum.take [1,2,3], 0 #=> []
      - Source + Source

      take_while(collection, fun) @@ -660,7 +664,7 @@

      Examples

      #=> [1, 2]
      - Source + Source

      uniq(collection) @@ -673,7 +677,7 @@

      Examples

      #=> [1, 2, 3]
      - Source + Source

      zip(coll1, coll2) @@ -683,7 +687,7 @@

      Examples

      dictated by the first enum. In case the second list is shorter, values are filled with nil.

      - Source + Source diff --git a/docs/stable/ErlangError.html b/docs/stable/ErlangError.html index 9e35e5f11..c68f65886 100644 --- a/docs/stable/ErlangError.html +++ b/docs/stable/ErlangError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -50,55 +50,10 @@

      Fields (and defaults)

      Functions summary

      @@ -111,65 +66,11 @@

      Functions summary

      Functions

      -

      - exception(args) -

      -
      - Source -
      -

      - exception(args, self) -

      -
      - Source -

      message(exception)

      - Source -
      -

      - new() -

      -
      - Source -
      -

      - new(opts) -

      -
      - Source -
      -

      - original(record) -

      -
      - Source -
      -

      - original(value, record) -

      -
      - Source -
      -

      - to_keywords(record) -

      -
      - Source -
      -

      - update(keywords, record) -

      -
      - Source -
      -

      - update_original(function, record) -

      -
      - Source + Source
      diff --git a/docs/stable/ExUnit.AssertionError.html b/docs/stable/ExUnit.AssertionError.html index deffaeb0b..4a496fbf6 100644 --- a/docs/stable/ExUnit.AssertionError.html +++ b/docs/stable/ExUnit.AssertionError.html @@ -47,55 +47,7 @@

      Fields (and defaults)

      -

      Functions summary

      - @@ -103,67 +55,6 @@

      Functions summary

      -
      -

      Functions

      -
      -

      - exception(args) -

      -
      - Source -
      -

      - exception(args, self) -

      -
      - Source -
      -

      - message(record) -

      -
      - Source -
      -

      - message(value, record) -

      -
      - Source -
      -

      - new() -

      -
      - Source -
      -

      - new(opts) -

      -
      - Source -
      -

      - to_keywords(record) -

      -
      - Source -
      -

      - update(keywords, record) -

      -
      - Source -
      -

      - update_message(function, record) -

      -
      - Source -
      -
      - - - diff --git a/docs/stable/ExUnit.Assertions.html b/docs/stable/ExUnit.Assertions.html index f78aff867..4ea3951b1 100644 --- a/docs/stable/ExUnit.Assertions.html +++ b/docs/stable/ExUnit.Assertions.html @@ -46,7 +46,7 @@

      - Source + Source @@ -60,6 +60,11 @@

      Functions summary

      assert/2
    2885. +
    2886. + + assert/4 + +
    2887. assert_in_delta/4 @@ -102,6 +107,11 @@

      Macros summary

      assert/1
    2888. +
    2889. + + assert_receive/3 + +
    2890. assert_received/2 @@ -127,6 +137,11 @@

      Macros summary

      refute/1
    2891. +
    2892. + + refute_receive/3 + +
    2893. refute_received/2 @@ -153,7 +168,21 @@

      Examples

      assert false, "it will never be true"
       
      - Source + Source +
      +

      + assert(value, expected, actual, opts) +

      +

      Asserts the expected value is true. +If it fails, it raises an expectation error +using the given expected and actual values.

      + +

      Examples

      + +
      assert this > that, this, that, reason: "more than"
      +
      +
      + Source

      assert_in_delta(expected, received, delta, message // nil) @@ -166,7 +195,7 @@

      Examples

      assert_in_delta 10, 15, 4
      - Source + Source

      assert_raise(exception, function) @@ -181,7 +210,7 @@

      Examples

      end
      - Source + Source

      assert_raise(exception, message, function) @@ -196,7 +225,7 @@

      Examples

      end
      - Source + Source

      flunk(message // "Epic Fail!") @@ -208,7 +237,7 @@

      Examples

      flunk "This should raise an error"
       
      - Source + Source

      refute(not_expected, message) @@ -221,7 +250,7 @@

      Examples

      refute true, "This will obviously fail"
       
      - Source + Source

      refute_in_delta(expected, received, delta, message // nil) @@ -234,7 +263,7 @@

      Examples

      refute_in_delta 10, 11, 2
      - Source + Source @@ -260,7 +289,32 @@

      Examples

      assert true
       
      - Source + Source +
      +

      + assert_receive(expected, timeout // 100, message // nil) +

      +

      Assets a message was or is going to be received. Differently from +assert_received, it has a default timeout time of 100 miliseconds.

      + +

      The given expected content must be a pattern.

      + +

      Examples

      + +
      assert_receive :hello
      +
      + +

      Asserts against a larger timeout:

      + +
      assert_receive :hello, 20_000
      +
      + +

      You can also match against specific patterns:

      + +
      assert_received { :hello, _ }
      +
      +
      + Source

      assert_received(expected, message // nil) @@ -282,7 +336,7 @@

      Examples

      assert_received { :hello, _ }
      - Source + Source

      catch_error(expression) @@ -295,7 +349,7 @@

      Examples

      assert catch_error(error 1) == 1
       
      - Source + Source

      catch_exit(expression) @@ -308,7 +362,7 @@

      Examples

      assert catch_exit(exit 1) == 1
       
      - Source + Source

      catch_throw(expression) @@ -321,7 +375,7 @@

      Examples

      assert catch_throw(throw 1) == 1
       
      - Source + Source

      refute(expected) @@ -336,7 +390,27 @@

      Examples

      refute false
       
      - Source + Source +
      +

      + refute_receive(not_expected, timeout // 100, message // nil) +

      +

      Asserts a message was not received and won't be during +a timeout value.

      + +

      The not_expected contents must be a match pattern.

      + +

      Examples

      + +
      refute_receive :bye
      +
      + +

      Refute received with a explicit timeout:

      + +
      refute_receive :bye, 1000
      +
      +
      + Source

      refute_received(not_expected, message // nil) @@ -352,7 +426,7 @@

      Examples

      refute_received :bye
      - Source + Source diff --git a/docs/stable/ExUnit.CLIFormatter.html b/docs/stable/ExUnit.CLIFormatter.html index 8a2b18544..3f1dd41fe 100644 --- a/docs/stable/ExUnit.CLIFormatter.html +++ b/docs/stable/ExUnit.CLIFormatter.html @@ -44,12 +44,12 @@

      Functions summary

      • - case_finished/1 + case_finished/2
      • - case_started/1 + case_started/2
      • @@ -79,12 +79,12 @@

        Functions summary

      • - suite_finished/0 + suite_finished/1
      • - suite_started/0 + suite_started/1
      • @@ -94,12 +94,12 @@

        Functions summary

      • - test_finished/3 + test_finished/4
      • - test_started/2 + test_started/3
      • @@ -114,77 +114,77 @@

        Functions summary

        Functions

        -

        - case_finished(_) +

        + case_finished(_id, _test_case)

        - Source + Source
        -

        - case_started(_) +

        + case_started(_id, _test_case)

        - Source + Source

        code_change(_old, state, _extra)

        - Source + Source

        handle_call(arg1, arg2, state)

        - Source + Source

        handle_cast(arg1, state)

        - Source + Source

        handle_info(_msg, state)

        - Source + Source

        init(args)

        - Source + Source
        -

        - suite_finished() +

        + suite_finished(id)

        - Source + Source
        -

        - suite_started() +

        + suite_started(_opts)

        - Source + Source

        terminate(reason, state)

        - Source + Source
        -

        - test_finished(test_case, test, result) +

        + test_finished(id, test_case, test, result)

        - Source + Source
        -

        - test_started(_test_case, _test) +

        + test_started(_id, _test_case, _test)

        - Source + Source
        diff --git a/docs/stable/ExUnit.ExpectationError.html b/docs/stable/ExUnit.ExpectationError.html new file mode 100644 index 000000000..441757e55 --- /dev/null +++ b/docs/stable/ExUnit.ExpectationError.html @@ -0,0 +1,107 @@ + + + + ExUnit.ExpectationError + + + + + + + + + + + + +
        +

        + ExUnit.ExpectationError + + exception + +

        + + + + Source + + + + +

        Fields (and defaults)

        +
          + +
        • + + expected: nil + +
        • + +
        • + + actual: nil + +
        • + +
        • + + reason: "" + +
        • + +
        • + + negation: false + +
        • + +
        • + + prelude: "Expected" + +
        • + +
        + + + +

        Functions summary

        + + + + + + + + +
        +

        Functions

        +
        +

        + message(exception) +

        +
        + Source +
        +
        + + + + + +
        + + diff --git a/docs/stable/ExUnit.Formatter.html b/docs/stable/ExUnit.Formatter.html index 4cf10cf06..5ea9e8b14 100644 --- a/docs/stable/ExUnit.Formatter.html +++ b/docs/stable/ExUnit.Formatter.html @@ -50,32 +50,32 @@

        Callbacks summary

        • - test_finished/3 + test_finished/4
        • - test_started/2 + test_started/3
        • - case_finished/1 + case_finished/2
        • - case_started/1 + case_started/2
        • - suite_finished/0 + suite_finished/1
        • - suite_started/0 + suite_started/1
        • @@ -90,41 +90,41 @@

          Callbacks summary

          Callbacks

          -

          - test_finished(test_case(), test(), result()) +

          + test_finished(id(), test_case(), test(), result())

          - Source + Source
          -

          - test_started(test_case(), test()) +

          + test_started(id(), test_case(), test())

          - Source + Source
          -

          - case_finished(test_case()) +

          + case_finished(id(), test_case())

          - Source + Source
          -

          - case_started(test_case()) +

          + case_started(id(), test_case())

          - Source + Source
          -

          - suite_finished() +

          + suite_finished(id())

          - Source + Source
          -

          - suite_started() +

          + suite_started(opts :: list())

          - Source + Source
          diff --git a/docs/stable/ExUnit.html b/docs/stable/ExUnit.html index 24d2d817b..662c10e92 100644 --- a/docs/stable/ExUnit.html +++ b/docs/stable/ExUnit.html @@ -66,6 +66,26 @@

          Assertions

          Check ExUnit.Assertions for assertions documentation.

          +

          User config

          + +

          When started, ExUnit automatically reads a user configuration +from the following locations, in this order:

          + +
            +
          • $EXUNIT_CONFIG environment variable
          • +
          • $HOME/.ex_unit.exs
          • +
          + +

          If none found, no user config will be read.

          + +

          User config is an elixir file which should return a keyword list +with ex_unit options. Please note that explicit options passed +to start/1 or configure/1 will take precedence over user options.

          + +
          # User config example (~/.ex_unit.exs)
          +[formatter: ExUnit.Formatter.ANSI]
          +
          + @@ -98,6 +118,11 @@

          Functions summary

          start/1 +
        • + + stop/1 + +
        • user_options/1 @@ -118,68 +143,63 @@

          Functions

          after_spawn(callback)

          -

          Register a callback to be invoked every time a +

          Registers a callback to be invoked every time a new ExUnit process is spawned.

          - Source + Source

          configure(options)

          -

          Configure ExUnit.

          +

          Configures ExUnit.

          Options

          ExUnit supports the following options given to start:

            -
          • :formatter - The formatter that will print results
          • -
          • :max_cases - Maximum number of cases to run in parallel
          • +
          • :formatter - The formatter that will print results. + Defaults to ExUnit.CLIFormatter;

          • +
          • :max_cases - Maximum number of cases to run in parallel. + Defaults to :erlang.system_info(:schedulers_online);

          - Source + Source

          run()

          -

          API used to run the tests. A developer does not -need to call it directly.

          +

          API used to run the tests. It is invoked automatically +if ExUnit is started via ExUnit.start.

          + +

          Returns the number of failures.

          - Source + Source

          start(options // [])

          -

          Start ExUnit. Required to be invoked before loading -any file that uses ExUnit.Case. Check configure/1 -to see the supported options.

          - -

          This function will also try to read a user config from the following -locations, in this order:

          - -
            -
          • $EXUNIT_CONFIG environment variable
          • -
          • $HOME/.ex_unit.exs
          • -
          - -

          If none found, no user config will be read.

          - -

          User config is an elixir file which should return a keyword list -with ex_unit options. Please note that explicit options passed to start/1 -will take precedence over user options.

          +

          Starts up ExUnit and automatically set it up to run +tests at the VM exit. It accepts a set of options to +configure ExUnit (the same ones accepted by configure/1).

          -

          User config example (~/.ex_unit.exs)

          - -

          [formatter: ExUnit.Formatter.ANSI]

          +

          In case you want to run tests manually, skip calling this +function and rely on configure/1 and run/0 instead.

          - Source + Source +
          +

          + stop(_state) +

          +
          + Source

          user_options(user_config // nil)

          Returns the configured user options.

          - Source + Source
          diff --git a/docs/stable/Exception.html b/docs/stable/Exception.html index 5bcbc93ab..2d3e5066e 100644 --- a/docs/stable/Exception.html +++ b/docs/stable/Exception.html @@ -28,7 +28,7 @@

          Several convenience functions to work and pretty print -exceptions and backtraces.

          +exceptions and stacktraces.

          @@ -44,32 +44,27 @@

          Functions summary

          • - env_stacktrace/1 + format_entry/2
          • - format_file_line/1 + format_file_line/3
          • - format_file_line/2 - -
          • -
          • - - format_module_fun_arity/3 + format_stacktrace/1
          • - format_stacktrace/1 + normalize/1
          • - formatted_stacktrace/1 + print_stacktrace/1
          • @@ -84,50 +79,51 @@

            Functions summary

            Functions

            -

            - env_stacktrace(env) -

            -

            Returns a formatted stacktrace from the environment.

            -
            - Source -
            -

            - format_file_line(file_line) +

            + format_entry(entry, cwd // nil)

            -

            Formats file and line information present in stacktraces. -Expect them to be given in a keyword list.

            +

            Receives a tuple representing a stacktrace entry and formats it. +The current working directory may be given as argument, which +is used to prettify the stacktrace.

            - Source + Source
            -

            - format_file_line(file, line) +

            + format_file_line(file, line, cwd)

            -

            Formats the given file and line.

            -
            - Source +
            + Source
            -

            - format_module_fun_arity(module, fun, arity) +

            + format_stacktrace(trace // nil)

            -

            Receives a module, fun and arity and returns a string -representing such invocation. Arity may also be a list -of arguments. It follows the same syntax as in stacktraces.

            +

            Formats the stacktrace.

            + +

            A stacktrace must be given as argument. If not, this function +calculates the current stacktrace and formats it. As consequence, +the value of System.stacktrace is changed.

            - Source + Source
            -

            - format_stacktrace(arg1) +

            + normalize(exception)

            -

            Formats each line in the stacktrace.

            +

            Normalizes an exception converting Erlang exceptions +to Elixir exceptions. Useful when interfacing Erlang +code with Elixir code.

            - Source + Source
            -

            - formatted_stacktrace(trace // nil) +

            -

            Returns the stacktrace as a binary formatted as per format_stacktrace/1.

            +

            Prints the current stacktrace to standard output.

            + +

            A stacktrace must be given as argument. If not, this function +calculates the current stacktrace and formats it. As consequence, +the value of System.stacktrace is changed.

            - Source + Source
            diff --git a/docs/stable/File.CopyError.html b/docs/stable/File.CopyError.html index 81eda9de4..0c050f7e0 100644 --- a/docs/stable/File.CopyError.html +++ b/docs/stable/File.CopyError.html @@ -68,100 +68,10 @@

            Fields (and defaults)

            Functions summary

            @@ -174,119 +84,11 @@

            Functions summary

            Functions

            -

            - action(record) -

            -
            - Source -
            -

            - action(value, record) -

            -
            - Source -
            -

            - destination(record) -

            -
            - Source -
            -

            - destination(value, record) -

            -
            - Source -
            -

            - exception(args) -

            -
            - Source -
            -

            - exception(args, self) -

            -
            - Source -

            message(exception)

            Source -
            -

            - new() -

            -
            - Source -
            -

            - new(opts) -

            -
            - Source -
            -

            - reason(record) -

            -
            - Source -
            -

            - reason(value, record) -

            -
            - Source -
            -

            - source(record) -

            -
            - Source -
            -

            - source(value, record) -

            -
            - Source -
            -

            - to_keywords(record) -

            -
            - Source -
            -

            - update(keywords, record) -

            -
            - Source -
            -

            - update_action(function, record) -

            -
            - Source -
            -

            - update_destination(function, record) -

            -
            - Source -
            -

            - update_reason(function, record) -

            -
            - Source -
            -

            - update_source(function, record) -

            -
            - Source
            diff --git a/docs/stable/File.Error.html b/docs/stable/File.Error.html index 785ade120..24ec1fad1 100644 --- a/docs/stable/File.Error.html +++ b/docs/stable/File.Error.html @@ -62,85 +62,10 @@

            Fields (and defaults)

            Functions summary

            @@ -153,101 +78,11 @@

            Functions summary

            Functions

            -

            - action(record) -

            -
            - Source -
            -

            - action(value, record) -

            -
            - Source -
            -

            - exception(args) -

            -
            - Source -
            -

            - exception(args, self) -

            -
            - Source -

            message(exception)

            Source -
            -

            - new() -

            -
            - Source -
            -

            - new(opts) -

            -
            - Source -
            -

            - path(record) -

            -
            - Source -
            -

            - path(value, record) -

            -
            - Source -
            -

            - reason(record) -

            -
            - Source -
            -

            - reason(value, record) -

            -
            - Source -
            -

            - to_keywords(record) -

            -
            - Source -
            -

            - update(keywords, record) -

            -
            - Source -
            -

            - update_action(function, record) -

            -
            - Source -
            -

            - update_path(function, record) -

            -
            - Source -
            -

            - update_reason(function, record) -

            -
            - Source
            diff --git a/docs/stable/File.IteratorError.html b/docs/stable/File.IteratorError.html index 9d97e9e25..4aff72bd1 100644 --- a/docs/stable/File.IteratorError.html +++ b/docs/stable/File.IteratorError.html @@ -50,55 +50,10 @@

            Fields (and defaults)

            Functions summary

            @@ -111,65 +66,11 @@

            Functions summary

            Functions

            -

            - exception(args) -

            -
            - Source -
            -

            - exception(args, self) -

            -
            - Source -

            message(exception)

            Source -
            -

            - new() -

            -
            - Source -
            -

            - new(opts) -

            -
            - Source -
            -

            - reason(record) -

            -
            - Source -
            -

            - reason(value, record) -

            -
            - Source -
            -

            - to_keywords(record) -

            -
            - Source -
            -

            - update(keywords, record) -

            -
            - Source -
            -

            - update_reason(function, record) -

            -
            - Source
            diff --git a/docs/stable/File.Stat.html b/docs/stable/File.Stat.html index fd721bf67..e231e5de2 100644 --- a/docs/stable/File.Stat.html +++ b/docs/stable/File.Stat.html @@ -153,495 +153,12 @@

            Fields (and defaults)

            -

            Functions summary

            - - -
            -

            Functions

            -
            -

            - access(record) -

            -
            - Source -
            -

            - access(value, record) -

            -
            - Source -
            -

            - atime(record) -

            -
            - Source -
            -

            - atime(value, record) -

            -
            - Source -
            -

            - ctime(record) -

            -
            - Source -
            -

            - ctime(value, record) -

            -
            - Source -
            -

            - gid(record) -

            -
            - Source -
            -

            - gid(value, record) -

            -
            - Source -
            -

            - inode(record) -

            -
            - Source -
            -

            - inode(value, record) -

            -
            - Source -
            -

            - links(record) -

            -
            - Source -
            -

            - links(value, record) -

            -
            - Source -
            -

            - major_device(record) -

            -
            - Source -
            -

            - major_device(value, record) -

            -
            - Source -
            -

            - minor_device(record) -

            -
            - Source -
            -

            - minor_device(value, record) -

            -
            - Source -
            -

            - mode(record) -

            -
            - Source -
            -

            - mode(value, record) -

            -
            - Source -
            -

            - mtime(record) -

            -
            - Source -
            -

            - mtime(value, record) -

            -
            - Source -
            -

            - new() -

            -
            - Source -
            -

            - new(opts) -

            -
            - Source -
            -

            - size(record) -

            -
            - Source -
            -

            - size(value, record) -

            -
            - Source -
            -

            - to_keywords(record) -

            -
            - Source -
            -

            - type(record) -

            -
            - Source -
            -

            - type(value, record) -

            -
            - Source -
            -

            - uid(record) -

            -
            - Source -
            -

            - uid(value, record) -

            -
            - Source -
            -

            - update(keywords, record) -

            -
            - Source -
            -

            - update_access(function, record) -

            -
            - Source -
            -

            - update_atime(function, record) -

            -
            - Source -
            -

            - update_ctime(function, record) -

            -
            - Source -
            -

            - update_gid(function, record) -

            -
            - Source -
            -

            - update_inode(function, record) -

            -
            - Source -
            -

            - update_links(function, record) -

            -
            - Source -
            -

            - update_major_device(function, record) -

            -
            - Source -
            -

            - update_minor_device(function, record) -

            -
            - Source -
            -

            - update_mode(function, record) -

            -
            - Source -
            -

            - update_mtime(function, record) -

            -
            - Source -
            -

            - update_size(function, record) -

            -
            - Source -
            -

            - update_type(function, record) -

            -
            - Source -
            -

            - update_uid(function, record) -

            -
            - Source -
            -
            - diff --git a/docs/stable/File.html b/docs/stable/File.html index 0b0d4f556..9840a74ec 100644 --- a/docs/stable/File.html +++ b/docs/stable/File.html @@ -27,12 +27,11 @@

            -

            This module contains function to manipulate files, -filenames and the filesystem. Many of the functions -that interact with the filesystem have their naming -based on its UNIX variants. For example, deleting a -file is done with File.rm. Getting its stats with -File.stat.

            +

            This module contains function to manipulate files. +Many of the functions that interact with the filesystem +have their naming based on its UNIX variants. For +example, deleting a file is done with File.rm. +Getting its stats with File.stat.

            In order to write and read files, one must use the functions in the IO module. By default, a file is @@ -88,16 +87,6 @@

            Functions summary

            • - - basename/1 - -
            • -
            • - - basename/2 - -
            • -
            • biniterator/1 @@ -177,31 +166,11 @@

              Functions summary

              dir?/1
            • -
            • - - dirname/1 - -
            • exists?/1
            • -
            • - - expand_path/1 - -
            • -
            • - - expand_path/2 - -
            • -
            • - - extname/1 - -
            • iterator/1 @@ -217,16 +186,6 @@

              Functions summary

              iterator!/2
            • -
            • - - join/1 - -
            • -
            • - - join/2 - -
            • mkdir/1 @@ -312,21 +271,6 @@

              Functions summary

              rmdir!/1
            • -
            • - - rootname/1 - -
            • -
            • - - rootname/2 - -
            • -
            • - - split/1 - -
            • stat/2 @@ -347,11 +291,6 @@

              Functions summary

              touch!/2
            • -
            • - - wildcard/1 - -
            • write/3 @@ -384,51 +323,6 @@

              Functions summary

              Functions

              -

              - basename(path) -

              -

              Returns the last component of the path or the path -itself if it does not contain any directory separators.

              - -

              If the given path is a char list, returns a char list. -Otherwise returns a binary.

              - -

              Examples

              - -
              File.basename("foo")
              -#=> "foo"
              -
              -File.basename("foo/bar")
              -#=> "bar"
              -
              -File.basename("/")
              -#=> ""
              -
              -
              - Source -
              -

              - basename(path, extension) -

              -

              Returns the last component of path with the extension -stripped. This function should be used to remove a specific -extension which might, or might not, be there.

              - -

              If the given path is a char list, returns a char list. -Otherwise returns a binary.

              - -

              Examples

              - -
              File.basename("~/foo/bar.ex", ".ex")
              -#=> "bar"
              -File.basename("~/foo/bar.exs", ".ex")
              -#=> "bar.exs"
              -File.basename("~/foo/bar.old.ex", ".ex")
              -#=> "bar.old"
              -
              -
              - Source -

              biniterator(device)

              @@ -436,7 +330,7 @@

              Examples

              be passed into Enum to iterate line by line as a binary. Check iterator/1 for more information.

              - Source + Source

              biniterator(file, mode) @@ -445,7 +339,7 @@

              Examples

              returns its biniterator. Fails for the same reasons as File.open.

              - Source + Source

            biniterator!(file, mode // []) @@ -453,7 +347,7 @@

            Examples

            Same as biniterator/2 but raises if the file cannot be opened.

            - Source + Source

            cd(path) @@ -461,14 +355,14 @@

            Examples

            Sets the current working directory. Returns :ok if successful, { :error, reason } otherwise.

            - Source + Source

            cd!(path)

            The same as cd/0, but raises an exception if it fails.

            - Source + Source

            cd!(path, function) @@ -480,7 +374,7 @@

            Examples

            Raises an error if retrieving or changing the current directory fails.

            - Source + Source

            close(io_device) @@ -492,7 +386,7 @@

            Examples

            close/1 might return an old write error and not even try to close the file. See open/2.

            - Source + Source

            copy(source, destination, bytes_count // :infinity) @@ -511,7 +405,7 @@

            Examples

            Typical error reasons are the same as in open/2, read/1 and write/2.

            - Source + Source

            copy!(source, destination, bytes_count // :infinity) @@ -519,7 +413,7 @@

            Examples

            The same as copy/3 but raises an File.CopyError if it fails. Returns the bytes_copied otherwise.

            - Source + Source

            cp(source, destination, callback // fn _, _ -> true end) @@ -542,7 +436,7 @@

            Examples

            It returns :ok in case of success, returns { :error, reason } otherwise.

            - Source + Source

            cp!(source, destination, callback // fn _, _ -> true end) @@ -550,7 +444,7 @@

            Examples

            The same as cp/3, but raises File.CopyError if it fails. Returns the list of copied files otherwise.

            - Source + Source

            cp_r(source, destination, callback // fn _, _ -> true end) @@ -600,7 +494,7 @@

            Examples

            end
            - Source + Source

          cp_r!(source, destination, callback // fn _, _ -> true end) @@ -608,7 +502,7 @@

          Examples

          The same as cp_r/3, but raises File.CopyError if it fails. Returns the list of copied files otherwise.

          - Source + Source

          cwd() @@ -618,37 +512,21 @@

          Examples

          directories of the current directory. For this reason, returns { :ok, cwd } in case of success, { :error, reason } otherwise.

          - Source + Source

          cwd!()

          The same as cwd/0, but raises an exception if it fails.

          - Source + Source

          dir?(path)

          Returns true if the path is a directory.

          - Source -
          -

          - dirname(path) -

          -

          Return the directory component of path.

          - -

          If the given path is a char list, returns a char list. -Otherwise returns a binary.

          - -

          Examples

          - -
          File.dirname("/foo/bar.ex")
          -#=> "foo"
          -
          -
          - Source + Source

          exists?(path) @@ -669,59 +547,7 @@

          Examples

          #=> true
          - Source -
          -

          - expand_path(path) -

          -

          Expands the path by returning its absolute name and expanding -any . and .. characters.

          - -

          If the given path is a char list, returns a char list. -Otherwise returns a binary.

          - -

          Examples

          - -
          File.expand_path("/foo/bar/../bar") == "/foo/bar"
          -
          -
          - Source -
          -

          - expand_path(path, relative_to) -

          -

          Expands the path to the relative location and expanding -any . and .. characters. If the path is already an -absolute path, the relative location is ignored.

          - -

          If the given path is a char list, returns a char list. -Otherwise returns a binary.

          - -

          Examples

          - -
          File.expand_path("foo/bar/../bar", "/baz") == "/baz/foo/bar"
          -File.expand_path("/foo/bar/../bar", "/baz") == "/foo/bar"
          -
          -
          - Source -
          -

          - extname(path) -

          -

          Return the extension of the last component of path.

          - -

          If the given path is a char list, returns a char list. -Otherwise returns a binary.

          - -

          Examples

          - -
          File.extname("foo.erl")
          -#=> ".erl"
          -File.extname("~/foo/bar")
          -#=> ""
          -
          -
          - Source + Source

          iterator(device) @@ -747,7 +573,7 @@

          Examples

          end
          - Source + Source

          iterator(file, mode) @@ -756,7 +582,7 @@

          Examples

          returns its iterator. Fails for the same reasons as File.open.

          - Source + Source

          iterator!(file, mode // []) @@ -764,44 +590,7 @@

          Examples

          Same as iterator/2 but raises if the file cannot be opened.

          - Source -
          -

          - join(paths) -

          -

          Returns a string with one or more paths components joint by the path separator. -This function should be used to convert a list of strings in a path.

          - -

          If the given paths are a char list, returns a char list. -Otherwise returns a binary.

          - -

          Examples

          - -
          File.join(["~", "foo"])
          -#=> "~/foo"
          -File.join(["foo"])
          -#=> "foo"
          -File.join(["/", "foo", "bar"])
          -#=> "/foo/bar"
          -
          -
          - Source -
          -

          - join(left, right) -

          -

          Join two paths.

          - -

          If the given paths are a char list, returns a char list. -Otherwise returns a binary.

          - -

          Examples

          - -
          File.join("foo", "bar")
          -#=> "foo/bar"
          -
          -
          - Source + Source

          mkdir(path) @@ -820,14 +609,14 @@

          Examples

          On some platforms, :enoent is returned instead.
        - Source + Source

        mkdir!(path)

        Same as mkdir, but raises an exception in case of failure. Otherwise :ok.

        - Source + Source

        mkdir_p(path) @@ -843,14 +632,14 @@

        Examples

      • :enotdir - A component of path is not a directory.
      - Source + Source

      mkdir_p!(path)

      Same as mkdir_p, but raises an exception in case of failure. Otherwise :ok.

      - Source + Source

      open(path, modes // []) @@ -905,7 +694,7 @@

      Examples

      File.close(file)
      - Source + Source

      open(path, modes, function) @@ -925,12 +714,12 @@

      Examples

      Examples

      -
      File.open!("foo.txt", [:read, :write], fn(file) ->
      +
      File.open!("file.txt", [:read, :write], fn(file) ->
         IO.readline(file)
       end)
       
      - Source + Source

      open!(path, modes // []) @@ -938,7 +727,7 @@

      Examples

      Same as open/2 but raises an error if file could not be opened. Returns the io_device otherwise.

      - Source + Source

      open!(path, modes, function) @@ -946,7 +735,7 @@

      Examples

      Same as open/3 but raises an error if file could not be opened. Returns the function result otherwise.

      - Source + Source

      read(path) @@ -968,7 +757,7 @@

      Examples

      You can use :file.format_error(reason) to get a descriptive string of the error.

      - Source + Source

      read!(path) @@ -976,7 +765,7 @@

      Examples

      Returns binary with the contents of the given filename or raises File.Error if an error occurs.

      - Source + Source

      regular?(path) @@ -988,7 +777,7 @@

      Examples

      File.regular? __FILE__ #=> true
       
      - Source + Source

      rm(path) @@ -1009,21 +798,21 @@

      Examples

      Examples

      -
      File.rm('foo.txt')
      +
      File.rm('file.txt')
       #=> :ok
       
       File.rm('tmp_dir/')
       #=> {:error, :eperm}
       
      - Source + Source

      rm!(path)

      Same as rm, but raises an exception in case of failure. Otherwise :ok.

      - Source + Source

      rm_rf(path) @@ -1045,7 +834,7 @@

      Examples

      #=> { :ok, [] }
      - Source + Source

      rm_rf!(path) @@ -1053,7 +842,7 @@

      Examples

      Same as rm_rf/1 but raises File.Error in case of failures, otherwise the list of files or directories removed.

      - Source + Source

      rmdir(path) @@ -1066,73 +855,18 @@

      Examples

      File.rddir('tmp_dir')
       #=> :ok
       
      -File.rmdir('foo.txt')
      +File.rmdir('file.txt')
       #=> {:error, :enotdir}
       
      - Source + Source

      rmdir!(path)

      Same as rmdir/1, but raises an exception in case of failure. Otherwise :ok.

      - Source -
      -

      - rootname(path) -

      -

      Returns the path with the extension stripped.

      - -

      If the given path is a char list, returns a char list. -Otherwise returns a binary.

      - -

      Examples

      - -
      File.rootname("/foo/bar")
      -#=> "/foo/bar"
      -File.rootname("/foo/bar.ex")
      -#=> "/foo/bar"
      -
      -
      - Source -
      -

      - rootname(path, extension) -

      -

      Returns the path with the extension stripped. This function should be used to -remove a specific extension which might, or might not, be there.

      - -

      If the given path is a char list, returns a char list. -Otherwise returns a binary.

      - -

      Examples

      - -
      File.rootname("/foo/bar.erl", ".erl")
      -#=> "/foo/bar"
      -File.rootname("/foo/bar.erl", ".ex")
      -#=> "/foo/bar.erl"
      -
      -
      - Source -
      -

      - split(path) -

      -

      Returns a list with the path splitted by the path separator. -If an empty string is given, then it returns the root path.

      - -

      Examples

      - -
       File.split("")
      - #=> ["/"]
      - File.split("foo")
      - #=> ["foo"]
      - File.split("/foo/bar")
      - #=> ["/", "foo", "bar"]
      -
      -
      - Source + Source

      stat(path, opts // []) @@ -1151,7 +885,7 @@

      Options

      Default is local.
    2894. - Source + Source

      stat!(path, opts // []) @@ -1159,7 +893,7 @@

      Options

      Same as stat but returns the File.Stat directly and throws File.Error if an error is returned.

      - Source + Source

      touch(path, time // :calendar.local_time()) @@ -1167,7 +901,7 @@

      Options

      Updates modification time (mtime) and access time (atime) of the given file. File is created if it doesn’t exist.

      - Source + Source

      touch!(path, time // :calendar.local_time()) @@ -1175,47 +909,7 @@

      Options

      Same as touch/1 but raises an exception if it fails. Returns :ok otherwise.

      - Source -
      -

      - wildcard(glob) -

      -

      Traverses files and directories according to the given glob expression.

      - -

      The wildcard string looks like an ordinary filename, except that certain -"wildcard characters" are interpreted in a special way. The following -characters are special:

      - -
        -
      • ? - Matches one character.
      • -
      • * - Matches any number of characters up to the end of - the filename, the next dot, or the next slash.
      • -
      • ** - Two adjacent *'s used as a single pattern will - match all files and zero or more directories and subdirectories.
      • -
      • [char1,char2,...] - Matches any of the characters listed. Two characters - separated by a hyphen will match a range of characters.
      • -
      • {item1,item2,...} - Matches one of the alternatives.
      • -
      - -

      Other characters represent themselves. Only filenames that have exactly -the same character in the same position will match. Note that matching -is case-sensitive; i.e. "a" will not match "A".

      - -

      Examples

      - -

      Imagine you have a directory called projects with three Elixir projects -inside of it: elixir, exdoc and dynamo. You can find all .beam files -inside their ebin directories all projects as follows:

      - -
      File.wildcard("projects/*/ebin/**/*.beam")
      -
      - -

      If you want to search for both .beam and .app files, you could do:

      - -
      File.wildcard("projects/*/ebin/**/*.{beam,app}")
      -
      -
      - Source + Source

      write(path, content, modes // []) @@ -1235,14 +929,14 @@

      Examples

    2895. :eisdir - The named file is a directory.
    2896. - Source + Source

      write!(path, content, modes // [])

      Same as write/3 but raises an exception if it fails, returns :ok otherwise.

      - Source + Source

      write_stat(path, stat, opts // []) @@ -1250,7 +944,7 @@

      Examples

      Writes the given File.Stat back to the filesystem at the given path. Returns :ok or { :error, reason }.

      - Source + Source

      write_stat!(path, stat, opts // []) @@ -1258,7 +952,7 @@

      Examples

      Same as write_stat/3 but raises an exception if it fails. Returns :ok otherwise.

      - Source + Source
      diff --git a/docs/stable/FunctionClauseError.html b/docs/stable/FunctionClauseError.html index a8169c45e..7125199dd 100644 --- a/docs/stable/FunctionClauseError.html +++ b/docs/stable/FunctionClauseError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -62,85 +62,10 @@

      Fields (and defaults)

      Functions summary

      @@ -153,101 +78,11 @@

      Functions summary

      Functions

      -

      - arity(record) -

      -
      - Source -
      -

      - arity(value, record) -

      -
      - Source -
      -

      - exception(args) -

      -
      - Source -
      -

      - exception(args, self) -

      -
      - Source -
      -

      - function(record) -

      -
      - Source -
      -

      - function(value, record) -

      -
      - Source -

      message(exception)

      - Source -
      -

      - module(record) -

      -
      - Source -
      -

      - module(value, record) -

      -
      - Source -
      -

      - new() -

      -
      - Source -
      -

      - new(opts) -

      -
      - Source -
      -

      - to_keywords(record) -

      -
      - Source -
      -

      - update(keywords, record) -

      -
      - Source -
      -

      - update_arity(function, record) -

      -
      - Source -
      -

      - update_function(function, record) -

      -
      - Source -
      -

      - update_module(function, record) -

      -
      - Source + Source
      diff --git a/docs/stable/GenServer.Behaviour.html b/docs/stable/GenServer.Behaviour.html index 156591578..155cdf677 100644 --- a/docs/stable/GenServer.Behaviour.html +++ b/docs/stable/GenServer.Behaviour.html @@ -27,46 +27,92 @@

      -

      By using this module, you get default GenServer callbacks -for init, handle_call, handle_info, handle_cast, -terminate and code_change. Since these functions are -defined as overridable, they can be customized and fallback -to the default behaviour by calling super.

      +

      This module is a convenience to define GenServer callbacks in Elixir.

      -

      This module also tags the behavior as :genserver. For more -information on genserver, please refer to the Erlang -documentation:

      - -

      http://www.erlang.org/doc/man/gen_server.html -http://www.erlang.org/doc/design_principles/gen_server_concepts.html

      +

      A server is responsible to react to messages received from client +and a GenServer is an OTP behaviour that encapsulates common server +functionalities.

      Example

      +

      Bellow follows an example of a GenServer that push and pop items +into a stack:

      +
      defmodule MyServer do
         use GenServer.Behaviour
       
         # Callbacks
       
      -  def handle_call(:peek, _from, [h|_] = state) do
      -    { :reply, h, state }
      +  def handle_call(:pop, _from, [h|t]) do
      +    { :reply, h, t }
         end
       
      -  # Default behaviour
      -  def handle_call(request, from, config) do
      -    super(request, from, config)
      +  def handle_call(_request, _from, _config) do
      +    # Call the default implementation from GenServer.Behaviour
      +    super
         end
       
      -  def handle_cast({ :push, item }, state) do
      -    { :noreply, [item|state] }
      +  def handle_cast({ :push, item }, config) do
      +    { :noreply, [item|config] }
         end
       
      -  # Default cast behaviour
      -  def handle_cast(request, config) do
      -    super(request, config)
      +  def handle_cast(_request, _config) do
      +    super
         end
       end
      +
      +{ :ok, pid } = :gen_server.start_link(MyServer, [:hello], [])
      +
      +:gen_server.call(pid, :pop)
      +#=> :hello
      +
      +:gen_server.cast(pid, { :push, :world })
      +#=> :ok
      +
      +:gen_server.call(pid, :pop)
      +#=> :world
      +
      + +

      Notice we never call the server callbacks directly, they are called +by OTP whenever we interact with the server. cast messages are +asynchronous while call ones are synchronous. In the case of +GenServer's, there are 8 different values a callback such as +handle_call or handle_cast can return:

      + +
      { :reply, reply, new_state }
      +{ :reply, reply, new_state, timeout }
      +{ :reply, reply, new_state, :hibernate }
      +{ :noreply, new_state }
      +{ :noreply, new_state, timeout }
      +{ :noreply, new_state, :hibernate }
      +{ :stop, reason, new_state }
      +{ :stop, reason, reply, new_state }
       
      +

      There are 6 callbacks required to be implemented in a GenServer. The +GenServer.Behaviour module defines all of them automatically, but +allows us to customize the ones we need. The list of callbacks are:

      + +
        +
      • init(args) - invoked when the server is started;
      • +
      • handle_call(msg, from, state) - invoked to handle call messages;
      • +
      • handle_cast(msg, state) - invoked to handle cast messages;
      • +
      • handle_info(msg, state) - handle all other messages which are +normally received by processes;
      • +
      • terminate(reason, state) - called when the server is about to +terminate, useful for cleaning up;
      • +
      • code_change(old_vsn, state, extra) - called when the application +code is being upgraded live (hot code swap);
      • +
      + +

      Starting and sending messages to the gen_server is done +via Erlang's :gen_server module. For more information, +please refer to the following:

      + +

      http://www.erlang.org/doc/man/gen_server.html +http://www.erlang.org/doc/design_principles/gen_server_concepts.html +http://learnyousomeerlang.com/clients-and-servers

      +
      diff --git a/docs/stable/HashDict.html b/docs/stable/HashDict.html index 9a4ba49da..d3adf03d4 100644 --- a/docs/stable/HashDict.html +++ b/docs/stable/HashDict.html @@ -27,12 +27,12 @@

      -

      This module implements a dictionary type based on -hashing of the keys. It is a simple wrapper around -Erlang's dict module -and exposed via the Dict module.

      +

      A key-value store.

      -

      Check the Dict module for examples and documentation.

      +

      The HashDict is meant to work well with both small and +large set of keys and it is an implementation of the Dict +behaviour. For more information about the functions and +their APIs, please consult the Dict module.

      @@ -47,6 +47,41 @@

      Functions summary

      @@ -73,39 +143,143 @@

      Functions summary

      Functions

      +

      + delete(dict, key) +

      +

      Deletes a value from the dict.

      +
      + Source +
      +

      + empty(_) +

      +

      Returns an empty dict.

      +
      + Source +
      +

      + get(dict, key, default // nil) +

      +

      Gets the value under key from the dict.

      +
      + Source +
      +

      + get!(dict, key) +

      +

      Gets the value under key from the dict, +raises KeyError if such key does not exist.

      +
      + Source +
      +

      + has_key?(dict, key) +

      +

      Checks if the dict has the given key.

      +
      + Source +
      +

      + keys(dict) +

      +

      Get all keys in the dict.

      +
      + Source +
      +

      + merge(dict, enum, callback // fn _k, _v1, v2 -> v2 end) +

      +

      Merges two dictionaries.

      +
      + Source +

      new()

      Creates a new empty dict.

      - Source + Source

      new(pairs)

      -

      Creates a new dict from a list of pairs.

      +

      Creates a new dict from the given enumerable.

      Examples

      HashDict.new [{:b,1},{:a,2}]
      -#=> [a: 1, b: 2]
      +#=> HashDict[a: 1, b: 2]
       
      - Source + Source

      new(list, transform)

      -

      Creates a new dict from a list of elements with the +

      Creates a new dict from the enumerable with the help of the transformation function.

      Examples

      HashDict.new ["a", "b"], fn x -> {x, x} end
      -#=> ["a": "a", "b": "b"]
      +#=> HashDict[{ "a", "a" }, { "b", "b" }]
       
      - Source + Source +
      +

      + put(dict, key, value) +

      +

      Puts the given key and value in the dict.

      +
      + Source +
      +

      + put_new(dict, key, value) +

      +

      Puts the given value under key in the dictionary +only if one does not exist yet.

      +
      + Source +
      +

      + size(dict) +

      +

      Returns the dict size.

      +
      + Source +
      +

      + to_list(dict) +

      +

      Converts the dict to a list.

      +
      + Source +
      +

      + update(dict, key, fun) +

      +

      Updates the key in the dictionary according +to the given function. Raises if the key does +not exist in the dictionary.

      +
      + Source +
      +

      + update(dict, key, initial, fun) +

      +

      Updates the key in the dictionary according +to the given function. Adds initial value if +the key does not exist in the dicionary.

      +
      + Source +
      +

      + values(dict) +

      +

      Get all values in the dict.

      +
      + Source
      diff --git a/docs/stable/IEx.Helpers.html b/docs/stable/IEx.Helpers.html index 6826188c8..9168bad82 100644 --- a/docs/stable/IEx.Helpers.html +++ b/docs/stable/IEx.Helpers.html @@ -173,7 +173,7 @@

      Examples

      Flushes all messages sent to the shell and prints them out

      - Source + Source

      h() @@ -187,7 +187,7 @@

      Examples

      Purges and reloads specified module

      - Source + Source

      m() @@ -202,7 +202,7 @@

      Examples

      Reloads all modules that were already reloaded at some point with r/1.

      - Source + Source

      r(module) @@ -212,7 +212,7 @@

      Examples

      Please note that all the modules defined in the specified files are recompiled and reloaded.

      - Source + Source

      v() @@ -228,7 +228,7 @@

      Examples

      values to lookup query's value from latest to earliest. For instance, v(-1) returns the latest result.

      - Source + Source @@ -273,7 +273,7 @@

      Examples

      s(list_to_atom/1)
      - Source + Source

      t(module) @@ -288,7 +288,7 @@

      Examples

      t(Enum.t)
      - Source + Source diff --git a/docs/stable/IO.html b/docs/stable/IO.html index 794b3fb4c..369c6a166 100644 --- a/docs/stable/IO.html +++ b/docs/stable/IO.html @@ -164,7 +164,7 @@

      Functions

      NFS file system.

      - Source + Source

      gets(device // :stdio, prompt) @@ -180,7 +180,7 @@

      Functions

      NFS file system.

      - Source + Source

      inspect(device // :stdio, item, opts // []) @@ -188,7 +188,7 @@

      Functions

      Inspects and writes the given argument to the device followed by a new line. Returns the item given.

      - Source + Source

      puts(device // :stdio, item) diff --git a/docs/stable/Kernel.CLI.html b/docs/stable/Kernel.CLI.html index aa4b3f9b3..92a9a18dd 100644 --- a/docs/stable/Kernel.CLI.html +++ b/docs/stable/Kernel.CLI.html @@ -78,7 +78,7 @@

      Functions

      wait_until_finished()

      -

      Wait until the CLI finishes procesing options.

      +

      Wait until the CLI finishes processing options.

      Source
      diff --git a/docs/stable/Kernel.SpecialForms.html b/docs/stable/Kernel.SpecialForms.html index ed0c9bb43..9b1c37037 100644 --- a/docs/stable/Kernel.SpecialForms.html +++ b/docs/stable/Kernel.SpecialForms.html @@ -27,9 +27,13 @@

      -

      In this module we define Elixir special forms. Those are called -special forms because they cannot be overridden by the developer -and sometimes have lexical scope (like alias, import, etc).

      +

      In this module we define Elixir special forms. Special forms +cannot be overriden by the developer and are the basic +building blocks of Elixir code.

      + +

      Some of those forms are lexical (like alias, import, etc). +The macros {}, [] and <<>> are also special forms used +to define data structures, respectively tuples, lists and binaries.

      This module also documents Elixir's pseudo variables (__MODULE__, __FILE__, __ENV__ and __CALLER__). Pseudo variables return @@ -100,6 +104,11 @@

      Macros summary

      alias/2 +
    2897. + + alias!/1 + +
    2898. bc/1 @@ -135,6 +144,16 @@

      Macros summary

      unquote_splicing/1
    2899. +
    2900. + + var!/1 + +
    2901. +
    2902. + + var!/2 + +
    2903. {}/1 @@ -162,8 +181,135 @@

      Examples

      :<<>>.(1,2,3)
       << 1, 2, 3 >>
       
      + +

      Bitstring types

      + +

      A bitstring may contain many parts and those may have +specific types. Most of the time, Elixir will figure out +the part's type and won't require any work from you:

      + +
      <<102, "oo">>
      +#=> "foo"
      +
      + +

      Above we have two parts: the first is an integer and the +second is a binary. If we use any other Elixir expression, +Elixir can no longer guess the type:

      + +
      rest = "oo"
      +<<102, rest>>
      +#=> ** (ArgumentError) argument error
      +
      + +

      When a variable or expression is given as a binary part, +Elixir defaults the type of that part to an unsigned +little-endian integer. In the example above, since we haven't +specified a type, Elixir expected an integer but we passed a +binary, resulting in ArgumentError. We can solve this by +explicitly tagging it as a binary:

      + +
      <<102, rest :: binary>>
      +
      + +

      The type can be integer, float, binary, bytes, bitstring, +bits, utf8, utf16 or utf32, e.g.:

      + +
      <<102 :: float, rest :: binary>>
      +
      + +

      Integer can be any arbitrary precision integer. A float is an +IEEE 754 binary32 or binary64 floating point number. A bitstring +is an arbitrary series of bits. A binary is a special case of +bitstring that has a total size divisible by 8.

      + +

      The utf8, utf16, and utf32 types are for UTF code points.

      + +

      The bits type is an alias for bitstring. The bytes type is an +alias for binary.

      + +

      The signedness can also be given as signed or unsigned. The +signedness only matters for matching. If unspecified, it +defaults to unsigned. Example:

      + +
      <<-100 :: signed, rest :: binary>> = <<-100, "foo">>
      +#=> <<156,102,111,111>>
      +
      + +

      This match would have failed if we did not specify that the +value -100 is signed. If we're matching into a variable instead +of a value, the signedness won't be checked; rather, the number +will simply be interpreted as having the given (or implied) +signedness, e.g.:

      + +
      <<val, rest :: binary>> = <<-100, "foo">>
      +val
      +#=> 156
      +
      + +

      Here, val is interpreted as unsigned.

      + +

      Signedness is only relevant on integers.

      + +

      The endianness of a part can be big, little or native (the +latter meaning it will be resolved at VM load time). Passing +many options can be done by giving a list:

      + +
      <<102 :: [integer, native], rest :: binary>>
      +
      + +

      Or:

      + +
      <<102 :: [unsigned, big, integer], rest :: binary>>
      +
      + +

      And so on.

      + +

      Endianness only makes sense for integers and some UTF code +point types (utf16 and utf32).

      + +

      Finally, we can also specify size and unit for each part. The +unit is multiplied by the size to give the effective size of +the part:

      + +
      <<102, rest :: [size(2), unit(8)]>> = "foo"
      +"foo"
      +
      +<<102, rest :: size(16)>> = "foo"
      +"foo"
      +
      +<<102, rest :: size(32)>> = "foo"
      +** (MatchError) no match of right hand side value: "foo"
      +
      + +

      In the example above, the first two expressions matches +because the string "foo" takes 24 bits and we are matching +against a part of 24 bits as well, 8 of which are taken by +the integer 102 and the remaining 16 bits are specified on +the rest. On the last example, we expect a rest with size 32, +which won't match.

      + +

      Size and unit are not applicable to utf8, utf16, and utf32.

      + +

      The default size for integers is 8. For floats, it is 64. For +binaries, it is the size of the binary. Only the last binary +in a binary match can use the default size (all others must +have their size specified explicitly). Bitstrings do not have +a default size.

      + +

      Size can also be specified using a syntax shortcut. Instead of +writing size(8), one can write just 8 and it will be interpreted +as size(8)

      + +
      << 1 :: 3 >> == << 1 :: size(3) >> #=> true
      +
      + +

      The default unit for integers, floats, and bitstrings is 1. For +binaries, it is 8.

      + +

      For floats, unit * size must result in 32 or 64, corresponding +to binary32 and binary64, respectively.

    2904. - Source + Source

      [args] @@ -176,7 +322,7 @@

      Examples

      [ 1, 2, 3 ]
      - Source + Source

      __ENV__() @@ -185,7 +331,7 @@

      Examples

      record. In the environment you can access the current filename, line numbers, set up aliases, the current function and others.

      - Source + Source

      __FILE__() @@ -194,7 +340,7 @@

      Examples

      Although the file can be accessed in the ENV, this macro is a convenient shortcut.

      - Source + Source

      __MODULE__() @@ -203,7 +349,7 @@

      Examples

      Although the module can be accessed in the ENV, this macro is a convenient shortcut.

      - Source + Source

      args @@ -212,19 +358,19 @@

      Examples

      It is usually compiled to an atom:

      quote do: Foo.Bar
      -{ :__aliases__, 0, [:Foo,:Bar] }
      +{ :__aliases__, [], [:Foo,:Bar] }
       

      Elixir represents Foo.Bar as __aliases__ so calls can be unambiguously identified by the operator :.. For example:

      quote do: Foo.bar
      -{{:.,0,[{:__aliases__,0,[:Foo]},:bar]},0,[]}
      +{{:.,[],[{:__aliases__,[],[:Foo]},:bar]},[],[]}
       

      Whenever an expression iterator sees a :. as the tuple key, -it can be sure that it represents a call and the second element -of the arguments list is an atom.

      +it can be sure that it represents a call and the second argument +is the list is an atom.

      On the other hand, aliases holds some properties:

      @@ -237,7 +383,7 @@

      Examples

      4) When the head element of aliases is not an atom, it is expanded at runtime:

        quote do: some_var.Foo
      -  {:__aliases__,0,[{:some_var,0,:quoted},:Bar]}
      +  {:__aliases__,[],[{:some_var,[],:quoted},:Bar]}
       

      Since some_var is not available at compilation time, the compiler @@ -246,7 +392,7 @@

      Examples

        Module.concat [some_var, Foo]
       
      - Source + Source

      args @@ -256,10 +402,10 @@

      Examples

      and should not be invoked directly:

      quote do: (1; 2; 3)
      -#=> { :__block__, 0, [1,2,3] }
      +#=> { :__block__, [], [1,2,3] }
       
      - Source + Source

      __scope__(opts, args) @@ -275,7 +421,7 @@

      Examples

      Check quote/1 for more information.

      - Source + Source

      alias(module, opts) @@ -319,7 +465,16 @@

      Lexical scope

      have lexical scope. This means you can set up aliases inside specific functions and it won't affect the overall scope.

      - Source + Source +
      +

      + alias!(alias) +

      +

      When used inside quoting, marks that the alias should not +be hygienezed. This means the alias will be expanded when +the macro is expanded.

      +
      + Source

      bc(args) @@ -333,7 +488,7 @@

      Lexical scope

      "helloworld"
      - Source + Source

      import(module, opts) @@ -411,7 +566,7 @@

      Alias/Require shortcut

      also accepts as: as an option so it automatically sets up an alias. Please check alias for more information.

      - Source + Source

      lc(args) @@ -459,7 +614,7 @@

      Alias/Require shortcut

      [{213,45,132},{64,76,32},{76,0,0},{234,32,15}]
      - Source + Source

      quote(opts, list2) @@ -469,14 +624,14 @@

      Alias/Require shortcut

      Examples

      quote do: sum(1, 2, 3)
      -#=> { :sum, 0, [1, 2, 3] }
      +#=> { :sum, [], [1, 2, 3] }
       
      -

      Homoiconicity

      +

      Explanation

      -

      Elixir is an homoiconic language. Any Elixir program can be -represented using its own data structures. The building block -of Elixir homoiconicity is a tuple with three elements, for example:

      +

      Any Elixir code can be represented using Elixir data structures. +The building block of Elixir homoiconicity is a tuple with three +elements, for example:

      { :sum, 1, [1, 2, 3] }
       
      @@ -490,8 +645,22 @@

      Homoiconicity

    2905. The second element of the tuple is always an integer representing the line number;
    2906. The third element of the tuple are the arguments for the -function call. The third argument may be an atom, meaning -that it may be a variable.
    2907. +function call. The third argument may be an atom, which is +usually a variable (or a local call); + + +

      Options

      + +
        +
      • :hygiene - When false, disables hygiene for variables, aliases and imports;
      • +
      • :unquote - When false, disables unquoting. Useful when you have a quote + inside another quote and want to control which quote is + able to unquote;
      • +
      • :location - When set to :keep, keeps the current line and file on quotes. + Read the Stacktrace information section below for more information;
      • +
      • :expand_aliases - When false, do not expand aliases;
      • +
      • :expand_imports - When false, do not expand imports;
      • +
      • :var_context - The context for quoted variables. Defaults to the current module;

      Macro literals

      @@ -509,9 +678,21 @@

      Macro literals

      Hygiene

      -

      Elixir macros are hygienic regarding to variables. This means -a variable defined in a macro cannot affect the scope where -the macro is included. Consider the following example:

      +

      Elixir macros are hygienic. This means aliases and imports +defined inside the quoted often refer to the context that +defined the macro.

      + +

      Furthermore, variables inside quote are also hygienic. That +said, a variable defined in a macro cannot affect the scope +where the macro is included.

      + +

      The option hygiene can turn off all the hygiene mechanisms +defined below. However, they can also be changed in a one by +one basis.

      + +

      Hygiene in variables

      + +

      Consider the following example:

      defmodule Hygiene do
         defmacro no_interference do
      @@ -527,10 +708,10 @@ 

      Hygiene

      In the example above, a returns 10 even if the macro -is apparently setting it to 1 because the variables defined -in the macro does not affect the context the macro is -executed. If you want to set or get a variable, you can do -it with the help of the var! macro:

      +is apparently setting it to 1 because variables defined +in the macro does not affect the context the macro is executed. +If you want to set or get a variable in the user context, you +can do it with the help of the var! macro:

      defmodule NoHygiene do
         defmacro interference do
      @@ -545,32 +726,132 @@ 

      Hygiene

      a #=> 1
      -

      Notice that aliases are not hygienic in Elixir, ambiguity -must be solved by prepending Elixir:

      +

      It is important to understand that quoted variables are scoped +to the module they are defined. That said, even if two modules +define the same quoted variable a, their values are going +to be independent:

      -
      quote do
      -  Elixir.Foo #=> Access the root Foo
      -  Foo        #=> Access the Foo alias in the current module
      -                 (if any is set), then fallback to Elixir.Foo
      +
      defmodule Hygiene1 do
      +  defmacro var1 do
      +    quote do: a = 1
      +  end
      +end
      +
      +defmodule Hygiene2 do
      +  defmacro var2 do
      +    quote do: a = 2
      +  end
       end
       
      -

      Options

      +

      Calling macros var1 and var2 are not going to change their +each other values for a. This is useful because quoted +variables from different modules cannot conflict. If you desire +to explicitly access a variable from another module, we can once +again use var! macro, but explicitly passing a second argument:

      -
        -
      • :hygiene - When false, disables hygiene;
      • -
      • :unquote - When false, disables unquoting. Useful when you have a quote -inside another quote and want to control which quote is able to unquote;
      • -
      • :location - When set to :keep, keeps the current line and file on quotes. - Read the Stacktrace information section below for more information;
      • -
      +
      # Access the variable a from Hygiene1
      +quote do: var!(a, Hygiene1) = 2
      +
      + +

      Another option is to set the var_context option, affecting +all variables in the block:

      + +
      quote var_context: Hygiene1, do: a = 2
      +
      + +

      Hygiene in aliases

      + +

      Aliases inside quote are expanded by default. +Consider the following example:

      + +
      defmodule Hygiene do
      +  alias HashDict, as: D
      +
      +  defmacro no_interference do
      +    quote do: D.new
      +  end
      +end
      +
      +require Hygiene
      +Hygiene.no_interference #=> HashDict[]
      +
      + +

      Notice that, even though the alias D is not available +in the context the macro is expanded, the code above works +because D was expanded when the quote was generated.

      + +

      There are two ways to disable this behaviour. By giving +the expand_aliases equals to false to quote or by using +the alias! macro inside the quote:

      + +
      defmodule NoHygiene do
      +  defmacro interference do
      +    quote do: alias!(D).new
      +  end
      +end
      +
      +require NoHygiene
      +NoHygiene.interference #=> UndefinedFunctionError
      +
      + +

      Hygiene in imports

      + +

      Similar to aliases, imports in Elixir hygienic. Consider the +following code:

      + +
      defmodule Hygiene do
      +  defmacrop get_size do
      +    quote do
      +      size("hello")
      +    end
      +  end
      +
      +  def return_size do
      +    import Kernel, except: [size: 1]
      +    get_size
      +  end
      +end
      +
      +Hygiene.return_size #=> 5
      +
      + +

      Notice how return_size returns 5 even though the size/1 +function is not imported.

      + +

      Elixir is smart enough to delay the resolution to the latest +moment possible. So, if you call size("hello") inside quote, +but no size/1 function is available, it is then expanded on +the caller:

      + +
      defmodule Lazy do
      +  defmacrop get_size do
      +    import Kernel, except: [size: 1]
      +
      +    quote do
      +      size([a: 1, b: 2])
      +    end
      +  end
      +
      +  def return_size do
      +    import Kernel, except: [size: 1]
      +    import Dict, only: [size: 1]
      +    get_size
      +  end
      +end
      +
      +Lazy.return_size #=> 2
      +
      + +

      As in aliases, imports expansion can be explicitly disabled +via the expand_imports option.

      Stacktrace information

      One of Elixir goals is to provide proper stacktrace whenever there is an exception. In order to work properly with macros, the default behavior -in quote is to set the line to 0. When a macro is invoked and the quoted -expressions is expanded, 0 is replaced by the line of the call site.

      +in quote is to not set a line. When a macro is invoked and the quoted +expressions is expanded, the call site line is inserted.

      This is a good behavior for the majority of the cases, except if the macro is defining new functions. Consider this example:

      @@ -584,8 +865,8 @@

      Stacktrace information

      However, if there is an exception in any of these functions, we want the stacktrace to point to the GenServer.Behaviour and not the line that calls use GenServer.Behaviour. For this reason, there is an -option called :location that when set to :keep keeps these proper -semantics:

      +option called :location that when set to :keep keeps the original +line and file lines instead of setting them to 0:

      quote location: :keep do
         def handle_call(request, _from, state) do
      @@ -596,10 +877,10 @@ 

      Stacktrace information

      It is important to warn though that location: :keep evaluates the code as if it was defined inside GenServer.Behaviour file, in -particular, the macro __FILE__ will always point to -GenServer.Behaviour file.

      +particular, the macro __FILE__ and exceptions happening inside +the quote will always point to GenServer.Behaviour file.

      - Source + Source

      require(module, opts) @@ -630,7 +911,7 @@

      Alias shortcut

      require also accepts as: as an option so it automatically sets up an alias. Please check alias for more information.

      - Source + Source

      unquote(expr) @@ -649,17 +930,17 @@

      Examples

      Which would then return:

      -
      { :sum, 0, [1, { :value, 0, quoted }, 3] }
      +
      { :sum, [], [1, { :value, [], quoted }, 3] }
       

      Which is not the expected result. For this, we use unquote:

      value = 13
       quote do: sum(1, unquote(value), 3)
      -#=> { :sum, 0, [1, 13, 3] }
      +#=> { :sum, [], [1, 13, 3] }
       
      - Source + Source

      unquote_splicing(expr) @@ -671,10 +952,29 @@

      Examples

      values = [2,3,4]
       quote do: sum(1, unquote_splicing(values), 5)
      -#=> { :sum, 0, [1, 2, 3, 4, 5] }
      +#=> { :sum, [], [1, 2, 3, 4, 5] }
       
      - Source + Source +
      +

      + var!(var) +

      +

      When used inside quoting, marks that the variable should +not be hygienized. The argument can be either a variable +node (i.e. a tuple with three elements where the last +one is an atom) or an atom representing the variable name. +Check quote/2 for more information.

      +
      + Source +
      +

      + var!(var, context) +

      +

      Defines a variable in the given context. +Check quote/2 for more information.

      +
      + Source

      {args} @@ -687,7 +987,7 @@

      Examples

      { 1, 2, 3 }
      - Source + Source diff --git a/docs/stable/Kernel.Typespec.html b/docs/stable/Kernel.Typespec.html index 111ff35ad..f9fafdf38 100644 --- a/docs/stable/Kernel.Typespec.html +++ b/docs/stable/Kernel.Typespec.html @@ -105,7 +105,7 @@

      Functions

      Notes

      Elixir discourages the use of type string() as it might be confused -with binaries which are referred to as "strings" in Elixir (as opposed to +with binaries which are referred to as "strings" in Elixir (as opposed to character lists). In order to use the type that is called string() in Erlang, one has to use the char_list() type which is a synonym to string(). If yu use string(), you'll get a warning from the compiler.

      @@ -236,7 +236,7 @@

      Functions

      The module has to have a corresponding beam file on the file system.

      - Source + Source

      beam_specs(module) @@ -249,7 +249,7 @@

      Functions

      The module has to have a corresponding beam file on the file system.

      - Source + Source

      beam_types(module) @@ -262,28 +262,28 @@

      Functions

      The module has to have a corresponding beam file on the file system.

      - Source + Source

      define_callback(module, tuple, definition)

      Defines a callback by receiving Erlang's typespec.

      - Source + Source

      define_spec(module, tuple, definition)

      Defines a spec by receiving Erlang's typespec.

      - Source + Source

      define_type(module, kind, type)

      Defines a type, typep or opaque by receiving Erlang's typespec.

      - Source + Source

      defines_callback?(module, name, arity) @@ -291,7 +291,7 @@

      Functions

      Returns true if the current module defines a callback. This function is only available for modules being compiled.

      - Source + Source

      defines_spec?(module, name, arity) @@ -299,7 +299,7 @@

      Functions

      Returns true if the current module defines a given spec. This function is only available for modules being compiled.

      - Source + Source

      defines_type?(module, name, arity) @@ -308,21 +308,21 @@

      Functions

      (private, opaque or not). This function is only available for modules being compiled.

      - Source + Source

      spec_to_ast(name, arg2)

      Converts a spec clause back to Elixir AST.

      - Source + Source

      type_to_ast(arg1)

      Converts a type clause back to Elixir AST.

      - Source + Source
      @@ -342,7 +342,7 @@

      Examples

      @callback add(number, number) :: number
       
      - Source + Source

      defopaque(type) @@ -368,7 +368,7 @@

      Examples

      @spec add(number, number) :: number
       
      - Source + Source

      deftype(type) diff --git a/docs/stable/Kernel.html b/docs/stable/Kernel.html index 271af6f2d..7a5419c16 100644 --- a/docs/stable/Kernel.html +++ b/docs/stable/Kernel.html @@ -346,6 +346,11 @@

      Functions summary

      raise/2 +
    2908. + + raise/3 + +
    2909. round/1 @@ -733,6 +738,11 @@

      Macros summary

      is_range/1
    2910. +
    2911. + + is_record/1 + +
    2912. is_record/2 @@ -805,12 +815,12 @@

      Macros summary

    2913. - var!/1 + xor/2
    2914. - xor/2 + |>/2
    2915. @@ -841,7 +851,7 @@

      Examples

      abs(-3) #=> 3
    2916. - Source + Source

      apply(fun, args) @@ -854,7 +864,7 @@

      Examples

      #=> 4
      - Source + Source

      apply(module, fun, args) @@ -867,7 +877,7 @@

      Examples

      #=> [3,2,1]
      - Source + Source

      atom_to_binary(atom, encoding) @@ -883,7 +893,7 @@

      Examples

      atom_to_binary(:elixir, :utf8) #=> "elixir"
       
      - Source + Source

      atom_to_list(atom) @@ -895,7 +905,7 @@

      Examples

      atom_to_list(:elixir) #=> 'elixir'
       
      - Source + Source

      binary_part(binary, start, length) @@ -918,7 +928,7 @@

      Examples

      binary_part "foo", 3, -1 #=> 1
       
      - Source + Source

      binary_to_atom(binary, encoding) @@ -933,21 +943,21 @@

      Examples

      binary_to_atom("elixir", :utf8) #=> :elixir
       
      - Source + Source

      binary_to_existing_atom(binary, encoding)

      Works like binary_to_atom/2, but the atom must already exist.

      - Source + Source

      binary_to_list(binary)

      Returns a list of integers which correspond to the bytes of binary.

      - Source + Source

      binary_to_list(binary, start, stop) @@ -956,7 +966,7 @@

      Examples

      from position start to position stop in binary. Positions in the binary are numbered starting from 1.

      - Source + Source

      binary_to_term(binary) @@ -970,7 +980,7 @@

      Examples

      binary_to_term(term_to_binary("foo")) #=> "foo"
       
      - Source + Source

      binary_to_term(binary, options) @@ -993,7 +1003,7 @@

      Examples

      binary_to_term(term_to_binary("foo"), [:safe])
       
      - Source + Source

      bit_size(bitstring) @@ -1008,7 +1018,7 @@

      Examples

      bit_size(<<1,2,3>>) #=> 24
      - Source + Source

      bitstring_to_list(bitstring) @@ -1017,7 +1027,7 @@

      Examples

      number of bits in the binary is not divisible by 8, the last element of the list will be a bitstring containing the remaining bits (1 up to 7 bits).

      - Source + Source

      byte_size(bitstring) @@ -1034,7 +1044,7 @@

      Examples

      byte_size(<<1,2,3>>) #=> 3
      - Source + Source

      exit(reason) @@ -1049,14 +1059,14 @@

      Examples

      exit(:seems_bad)
      - Source + Source

      float(number)

      Converts the given number to a float. Allowed in guard clauses.

      - Source + Source

      float_to_list(number) @@ -1069,7 +1079,7 @@

      Examples

      #=> '7.00000000000000000000e+00'
      - Source + Source

      function_exported?(module, function, arity) @@ -1084,14 +1094,14 @@

      Examples

      it is not loaded. Check Code.ensure_loaded/1 for more information.

      - Source + Source

      hd(list)

      Returns the head of a list, raises badarg if the list is empty.

      - Source + Source

      integer_to_list(number) @@ -1104,7 +1114,7 @@

      Examples

      #=> '7'
      - Source + Source

      integer_to_list(number, base) @@ -1118,7 +1128,7 @@

      Examples

      #=> "3FF"
      - Source + Source

      iolist_size(item) @@ -1131,7 +1141,7 @@

      Examples

      #=> 4
      - Source + Source

      iolist_to_binary(item) @@ -1148,7 +1158,7 @@

      Examples

      #=> <<1,2,3,1,2,3,4,5,4,6>>
      - Source + Source

      is_alive() @@ -1156,7 +1166,7 @@

      Examples

      Returns true if the local node is alive; that is, if the node can be part of a distributed system.

      - Source + Source

      is_atom(term) @@ -1165,7 +1175,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      is_binary(term) @@ -1176,7 +1186,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      is_bitstring(term) @@ -1185,7 +1195,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      is_boolean(term) @@ -1195,7 +1205,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      is_float(term) @@ -1204,7 +1214,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      is_function(term) @@ -1213,7 +1223,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      is_function(term, arity) @@ -1223,7 +1233,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      is_integer(term) @@ -1232,7 +1242,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      is_list(term) @@ -1241,7 +1251,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      is_number(term) @@ -1251,7 +1261,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      is_pid(term) @@ -1260,7 +1270,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      is_port(term) @@ -1269,7 +1279,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      is_reference(term) @@ -1278,7 +1288,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      is_tuple(term) @@ -1287,7 +1297,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      length(list) @@ -1301,7 +1311,7 @@

      Examples

      length([1,2,3,4,5,6,7,8,9]) #=> 9
       
      - Source + Source

      list_to_atom(char_list) @@ -1313,7 +1323,7 @@

      Examples

      list_to_atom('elixir') #=> :elixir
       
      - Source + Source

      list_to_binary(char_list) @@ -1325,7 +1335,7 @@

      Examples

      list_to_binary('Elixir') #=> "Elixir"
       
      - Source + Source

      list_to_bitstring(bitstring_list) @@ -1343,7 +1353,7 @@

      Examples

      #=> <<1,2,3,1,2,3,4,5,4,6,7|4>>
      - Source + Source

      list_to_existing_atom(char_list) @@ -1351,7 +1361,7 @@

      Examples

      Returns the atom whose text representation is char_list, but only if there already exists such atom.

      - Source + Source

      list_to_float(char_list) @@ -1363,7 +1373,7 @@

      Examples

      list_to_float('2.2017764e+0') #=> 2.2017764
       
      - Source + Source

      list_to_integer(char_list) @@ -1375,7 +1385,7 @@

      Examples

      list_to_integer('123') #=> 123
       
      - Source + Source

      list_to_integer(char_list, base) @@ -1387,7 +1397,7 @@

      Examples

      list_to_integer('3FF', 16) #=> 1023
       
      - Source + Source

      list_to_pid(char_list) @@ -1406,7 +1416,7 @@

      Examples

      list_to_pid('<0.41>') #=> <0.4.1>
       
      - Source + Source

      list_to_tuple(list) @@ -1418,7 +1428,7 @@

      Examples

      list_to_tuple([:share, [:elixir, 163]]). #=> {:share, [:elixir, 163]}
       
      - Source + Source

      macro_exported?(module, macro, arity) @@ -1430,7 +1440,7 @@

      Examples

      it is not loaded. Check Code.ensure_loaded/1 for more information.

      - Source + Source

      make_ref() @@ -1446,7 +1456,7 @@

      Examples

      #=> #Ref<0.0.0.135>
      - Source + Source

      max(first, second) @@ -1460,7 +1470,7 @@

      Examples

      max(1, 2) #=> 2
       
      - Source + Source

      min(first, second) @@ -1474,7 +1484,7 @@

      Examples

      min(1, 2) #=> 1
       
      - Source + Source

      node() @@ -1484,7 +1494,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      node(arg) @@ -1495,7 +1505,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      pid_to_list(pid) @@ -1511,15 +1521,17 @@

      Warning:

      It should not be used in application programs.

      - Source + Source

      raise(msg)

      Raises an error.

      -

      If the argument is a binary, it raises RuntimeError with the message. -If anything else, becomes a call to raise(argument, []).

      +

      If the argument is a binary, it raises RuntimeError +using the given argument as message.

      + +

      If anything else, becomes a call to raise(argument, []).

      Examples

      @@ -1534,7 +1546,7 @@

      Examples

      end
      - Source + Source

      raise(exception, args) @@ -1546,20 +1558,42 @@

      Examples

      structure.

      Any module defined via defexception automatically -defines exception(args) that returns a new instance -of the record and a exception(args, current) that -updates the current exception.

      - -

      Re-raising an exception will retrieve the previous -stacktrace so it keps the properties of the original -exception.

      +defines both exception(args) and exception(args, current) +that creates a new and updates the given exception.

      Examples

      raise ArgumentError, message: "Sample"
       
      - Source + Source +
      +

      + raise(exception, args, stacktrace) +

      +

      Re-raises an exception with the given stacktrace.

      + +

      Examples

      + +
      try do
      +  raise "Oops"
      +rescue
      +  exception ->
      +    stacktrace = System.stacktrace
      +    if exception.message == "Oops" do
      +      raise exception, [], stacktrace
      +    end
      +end
      +
      + +

      Notice that System.stacktrace returns the stacktrace +of the last exception. That said, it is common to assign +the stacktrace as the first expression inside a rescue +clause as any other exception potentially raised (and +rescued) in between the rescue clause and the raise call +may change the System.stacktrace value.

      +
      + Source

      round(number) @@ -1572,7 +1606,7 @@

      Examples

      round(5.5) #=> 6
       
      - Source + Source

      self() @@ -1580,7 +1614,7 @@

      Examples

      Returns the pid (process identifier) of the calling process. Allowed in guard clauses.

      - Source + Source

      size(arg) @@ -1588,7 +1622,7 @@

      Examples

      Returns the size of the given argument, which must be a tuple or a binary. If possible, please use tuplesize or binarysize.

      - Source + Source

      spawn(fun) @@ -1608,7 +1642,7 @@

      Examples

      end
      - Source + Source

      spawn(module, fun, args) @@ -1624,7 +1658,7 @@

      Examples

      spawn(SomeModule, :function, [1,2,3])
       
      - Source + Source

      spawn_link(fun) @@ -1645,7 +1679,7 @@

      Examples

      end
      - Source + Source

      spawn_link(module, fun, args) @@ -1661,7 +1695,7 @@

      Examples

      spawn_link(SomeModule, :function, [1,2,3])
       
      - Source + Source

      term_to_binary(term) @@ -1673,7 +1707,7 @@

      Examples

      to a file in an efficient way, or sending an Erlang term to some type of communications channel not supported by distributed :

      - Source + Source

      term_to_binary(term, opts) @@ -1687,21 +1721,21 @@

      Examples

      for more details
      - Source + Source

      throw(term)

      A non-local return from a function. Check try/2 for more information.

      - Source + Source

      tl(list)

      Returns the tail of a list. Raises ArgumentError if the list is empty.

      - Source + Source

      trunc(number) @@ -1714,21 +1748,21 @@

      Examples

      trunc(5.5) #=> 5
       
      - Source + Source

      tuple_size(tuple)

      Returns the size of a tuple.

      - Source + Source

      tuple_to_list(tuple)

      Converts a tuple to a list.

      - Source + Source
      @@ -1810,7 +1844,7 @@

      Examples

      this operator accepts any expression as arguments, not only booleans, however it is not allowed in guards.

      - Source + Source

      left * right @@ -1895,7 +1929,7 @@

      Examples

      3 in 1..3 #=> true
      - Source + Source

      left / right @@ -1913,43 +1947,10 @@

      Examples

      Source

      - left /> right + />(left, right)

      -

      /> is called the pipeline operator as it is useful -to write pipeline style expressions. This operator -tntroduces the expression on the left as the first -argument to the expression on the right.

      - -

      Examples

      - -
      [1,[2],3] /> List.flatten /> Enum.map(&1 * 2)
      -#=> [2,4,6]
      -
      - -

      The expression above is simply translated to:

      - -
      Enum.map(List.flatten([1,[2],3]), &1 * 2)
      -
      - -

      Please be aware of operator precendence, when using -this operator. For example, the following expression:

      - -
      String.graphemes "Hello" /> Enum.reverse
      -
      - -

      Is translated to:

      - -
      String.graphemes("Hello" /> Enum.reverse)
      -
      - -

      Which will result in an error as Enum.Iterator protocol -is not defined for binaries. Adding explicit parenthesis -is recommended:

      - -
      String.graphemes("Hello") /> Enum.reverse
      -
      -
      - Source +
      + Source

      left < right @@ -2011,7 +2012,7 @@

      Examples

      x #=> "bar"
      - Source + Source

      left == right @@ -2064,7 +2065,7 @@

      Examples

      "abcd" =~ %r/e/ #=> nil
      - Source + Source

      left > right @@ -2140,7 +2141,7 @@

      Examples

      time and not at runtime. Check the module Module for other functions to manipulate module attributes.

      - Source + Source

      __B__(string, list2) @@ -2154,7 +2155,7 @@

      Examples

      %B(f#{o}o) #=> "f\#{o}o"
      - Source + Source

      __C__(arg1, list2) @@ -2168,7 +2169,7 @@

      Examples

      %C(f#{o}o) #=> 'f\#{o}o'
      - Source + Source

      __R__(arg1, options) @@ -2181,7 +2182,7 @@

      Examples

      Regex.match? %R(f#{1,3}o), "f#o"  #=> true
       
      - Source + Source

      __b__(arg1, list2) @@ -2195,7 +2196,7 @@

      Examples

      %b(f#{:o}o) #=> "foo"
      - Source + Source

      __c__(arg1, list2) @@ -2209,7 +2210,7 @@

      Examples

      %c(f#{:o}o) #=> 'foo'
      - Source + Source

      __r__(arg1, options) @@ -2221,7 +2222,7 @@

      Examples

      Regex.match? %r(foo), "foo"  #=> true
       
      - Source + Source

      access(element, args) @@ -2295,7 +2296,7 @@

      Examples

      access a, 1 #=> :a
      - Source + Source

      left and right @@ -2322,7 +2323,7 @@

      Examples

      atom_to_binary :my_atom #=> "my_atom"
       
      - Source + Source

      binary_to_atom(some_binary) @@ -2335,7 +2336,7 @@

      Examples

      binary_to_atom "my_atom" #=> :my_atom
       
      - Source + Source

      binary_to_existing_atom(some_binary) @@ -2348,7 +2349,7 @@

      Examples

      binary_to_existing_atom "my_atom" #=> :my_atom
      - Source + Source

      binary_to_float(some_binary) @@ -2360,7 +2361,7 @@

      Examples

      binary_to_float "2.2017764e+0" #=> 2.2017764
       
      - Source + Source

      binary_to_integer(some_binary) @@ -2372,7 +2373,7 @@

      Examples

      binary_to_integer "123" #=> 123
       
      - Source + Source

      binary_to_integer(some_binary, base) @@ -2385,7 +2386,7 @@

      Examples

      binary_to_integer("3FF", 16) #=> 1023
       
      - Source + Source

      case(condition, blocks) @@ -2438,7 +2439,7 @@

      Examples

      end
      - Source + Source

      cond(list1) @@ -2458,7 +2459,7 @@

      Examples

      end
      - Source + Source

      def(name, list2) @@ -2535,7 +2536,7 @@

      Dynamic generation with atoms

      because each entry k is a an atom and invoking def unquote(k)() would be invalid Elixir syntax.

      - Source + Source

      def(name, args, guards, list4) @@ -2572,7 +2573,7 @@

      Examples

      def name, args, guards, do: exprs
      - Source + Source

      defdelegate(funs, opts) @@ -2618,7 +2619,7 @@

      Examples

      #=> [3,2,1]
      - Source + Source

      defexception(name, fields, opts // [], do_block // []) @@ -2634,7 +2635,7 @@

      Examples

      2) Exceptions must implement message/1 as API that return a binary as result;

      - Source + Source

      defimpl(name, opts, do_block // []) @@ -2642,7 +2643,7 @@

      Examples

      Defines an implementation for the given protocol. See defprotocol/2 for examples.

      - Source + Source

      defmodule(name, list2) @@ -2690,7 +2691,7 @@

      Dynamic names

      Elixir will accept any module name as long as the expression returns an atom.

      - Source + Source

      defoverridable(tuples) @@ -2699,7 +2700,7 @@

      Dynamic names

      An overridable function is lazily defined, allowing a developer to customize it.

      - Source + Source

      defp(name, list2) @@ -2723,14 +2724,14 @@

      Examples

      In the example above, sum is private and accessing it through Foo.sum will raise an error.

      - Source + Source

      defp(name, args, guards, list4)

      The same as def/4 but generates a private function.

      - Source + Source

      defprotocol(name, list2) @@ -2823,30 +2824,33 @@

      Selecting implementations

      Protocols + Records

      -

      The real benefit of protocols comes when mixed with records. For instance, -imagine we have a module called RedBlack that provides an API to create -and manipulate Red-Black trees. This module represents such trees via a -record named RedBlack.Tree and we want this tree to be considered blank -in case it has no items. To achieve this, the developer just needs to -implement the protocol for RedBlack.Tree:

      +

      The real benefit of protocols comes when mixed with records. +For instance, imagine we have a module called RedBlack that +provides an API to create and manipulate Red-Black trees. This +module represents such trees via a record named RedBlack.Tree +and we want this tree to be considered blank in case it has no +items. To achieve this, the developer just needs to implement +the protocol for RedBlack.Tree:

      defimpl Blank, for: RedBlack.Tree do
         def blank?(tree), do: RedBlack.empty?(tree)
       end
       
      -

      In the example above, we have implemented blank? for RedBlack.Tree -that simply delegates to RedBlack.empty? passing the tree as argument. -This implementation doesn't need to be defined inside the RedBlack -tree or inside the record, but anywhere in the code.

      +

      In the example above, we have implemented blank? for +RedBlack.Tree that simply delegates to RedBlack.empty? passing +the tree as argument. This implementation doesn't need to be defined +inside the RedBlack tree or inside the record, but anywhere in +the code.

      -

      Finally, since records are simply tuples, one can add a default protocol -implementation to any record by defining a default implementation for tuples.

      +

      Finally, since records are simply tuples, one can add a default +protocol implementation to any record by defining a default +implementation for tuples.

      Types

      -

      As in records, defining a protocol automatically defines a type named t, -which can be used as:

      +

      As in records, defining a protocol automatically defines a type +named t, which can be used as:

      @spec present?(Blank.t) :: boolean
       def present?(blank) do
      @@ -2857,7 +2861,7 @@ 

      Types

      The @spec above expresses that all types allowed to implement the given protocol are valid argument types for the given function.

      - Source + Source

      defrecord(name, fields, opts // [], do_block // []) @@ -2966,7 +2970,7 @@

      Types

      When defining a type, all the fields not mentioned in the type are assumed to have type term.

      - Source + Source

      defrecordp(name, fields) @@ -3014,7 +3018,7 @@

      Examples

      name #=> "José"
      - Source + Source

      destructure(left, right) @@ -3055,7 +3059,7 @@

      Examples

      the first value from the right side. Otherwise, it will raise a CaseClauseError.

      - Source + Source

      div(left, right) @@ -3069,7 +3073,7 @@

      Examples

      div 5, 2 #=> 2
       
      - Source + Source

      elem(tuple, index) @@ -3085,7 +3089,7 @@

      Example

      elem(tuple, 1) #=> :bar
      - Source + Source

      float_to_binary(some_float) @@ -3098,7 +3102,7 @@

      Examples

      float_to_binary 7.0 #=> "7.00000000000000000000e+00"
       
      - Source + Source

      function(args) @@ -3180,7 +3184,7 @@

      Function retrieval

      f.([1,[2],3]) #=> [1,2,3]
      - Source + Source

      if(condition, clauses) @@ -3224,7 +3228,7 @@

      Blocks examples

      If you want to compare more than two clauses, you can use the cond/1 macro.

      - Source + Source

      left in right @@ -3266,12 +3270,12 @@

      Clauses

      In this case, Elixir will automatically expand it and define the variable for us.

      - Source + Source

      inspect(arg, opts // [])

      -

      Inspect the given arguments according to the Binary.Inspect protocol.

      +

      Inspect the given arguments according to the Binary.Inspect protocol.

      Options

      @@ -3281,7 +3285,7 @@

      Options

    2917. :raw - tuples are not formatted as the inspect protocol, they are always shown as tuples, defaults to false;

    2918. :limit - the limit of items that are shown in tuples, bitstrings and -lists. Do not apply to strings;

    2919. +lists. Does not apply to strings;

      Examples

      @@ -3289,8 +3293,16 @@

      Examples

      inspect(:foo)
       #=> ":foo"
       
      + +

      Notice the inspect protocol does not necessarily return a valid Elixir +terms representation. In such cases, the inspected result must start +with #. For example, inspecting a function will return:

      + +
      inspect &1 + &2
      +#=> #Function<...>
      +
      - Source + Source

      integer_to_binary(some_integer) @@ -3303,7 +3315,7 @@

      Examples

      integer_to_binary 123 #=> "123"
       
      - Source + Source

      integer_to_binary(some_integer, base) @@ -3316,7 +3328,7 @@

      Examples

      integer_to_binary 77 #=> "77"
       
      - Source + Source

      is_exception(thing) @@ -3329,14 +3341,21 @@

      Examples

      is_exception(1) #=> false
      - Source + Source

      is_range(thing)

      Check if the given argument is a range.

      - Source + Source +
      +

      + is_record(thing) +

      +

      Check if the given argument is a record.

      +
      + Source

      is_record(thing, kind) @@ -3353,14 +3372,14 @@

      Examples

      is_record(Config.new, List) #=> false
      - Source + Source

      is_regex(thing)

      Check if the given argument is a regex.

      - Source + Source

      match?(left, right) @@ -3387,7 +3406,7 @@

      Examples

      Enum.filter list, match?({:a, x } when x < 2, &1)
      - Source + Source

      nil?(x) @@ -3401,7 +3420,7 @@

      Examples

      nil? nil #=> true
      - Source + Source

      not arg @@ -3477,7 +3496,7 @@

      Examples

      will occur immediately.

      - Source + Source

      rem(left, right) @@ -3491,7 +3510,7 @@

      Examples

      rem 5, 2 #=> 1
       
      - Source + Source

      setelem(tuple, index, value) @@ -3507,7 +3526,7 @@

      Example

      setelem(tuple, 0, :baz) #=> { :baz, :bar, 3 }
      - Source + Source

      to_binary(arg) @@ -3521,7 +3540,7 @@

      Examples

      #=> "foo"
      - Source + Source

      to_char_list(arg) @@ -3534,7 +3553,7 @@

      Examples

      #=> 'foo'
      - Source + Source

      try(args) @@ -3651,7 +3670,7 @@

      Variable visibility

      end
      - Source + Source

      unless(clause, options) @@ -3660,7 +3679,7 @@

      Variable visibility

      unless a value evalutes to true. Check if for examples and documentation.

      - Source + Source

      use(module, args // []) @@ -3697,16 +3716,7 @@

      Examples

      end
      - Source -
      -

      - var!(var) -

      -

      When used inside quoting, marks that the variable should not -be hygienezed. Check Kernel.SpecialForms.quote/1 for more -information.

      -
      - Source + Source

      left xor right @@ -3721,6 +3731,45 @@

      Examples

      Source +
      +

      + left |> right +

      +

      |> is called the pipeline operator as it is useful +to write pipeline style expressions. This operator +tntroduces the expression on the left as the first +argument to the expression on the right.

      + +

      Examples

      + +
      [1,[2],3] |> List.flatten |> Enum.map(&1 * 2)
      +#=> [2,4,6]
      +
      + +

      The expression above is simply translated to:

      + +
      Enum.map(List.flatten([1,[2],3]), &1 * 2)
      +
      + +

      Please be aware of operator precendence, when using +this operator. For example, the following expression:

      + +
      String.graphemes "Hello" |> Enum.reverse
      +
      + +

      Is translated to:

      + +
      String.graphemes("Hello" |> Enum.reverse)
      +
      + +

      Which will result in an error as Enum.Iterator protocol +is not defined for binaries. Adding explicit parenthesis +is recommended:

      + +
      String.graphemes("Hello") |> Enum.reverse
      +
      +
      + Source

      left || right @@ -3741,7 +3790,7 @@

      Examples

      this operator accepts any expression as arguments, not only booleans, however it is not allowed in guards.

      - Source + Source diff --git a/docs/stable/KeyError.html b/docs/stable/KeyError.html index db307b332..b2b9893b3 100644 --- a/docs/stable/KeyError.html +++ b/docs/stable/KeyError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -50,55 +50,10 @@

      Fields (and defaults)

      Functions summary

      @@ -111,65 +66,11 @@

      Functions summary

      Functions

      -

      - exception(args) -

      -
      - Source -
      -

      - exception(args, self) -

      -
      - Source -
      -

      - key(record) -

      -
      - Source -
      -

      - key(value, record) -

      -
      - Source -

      message(exception)

      - Source -
      -

      - new() -

      -
      - Source -
      -

      - new(opts) -

      -
      - Source -
      -

      - to_keywords(record) -

      -
      - Source -
      -

      - update(keywords, record) -

      -
      - Source -
      -

      - update_key(function, record) -

      -
      - Source + Source
      diff --git a/docs/stable/Keyword.html b/docs/stable/Keyword.html index 9ba61189e..11a174d02 100644 --- a/docs/stable/Keyword.html +++ b/docs/stable/Keyword.html @@ -126,6 +126,11 @@

      Functions summary

      put/3 +
    2920. + + put_new/3 + +
    2921. update/3 @@ -181,7 +186,7 @@

      Examples

      #=> true - Source + Source

      from_enum(enum) @@ -252,7 +257,7 @@

      Examples

      #=> false
      - Source + Source

      keys(keywords) @@ -286,7 +291,7 @@

      Examples

      #=> [a:3, b:2, d: 4]
      - Source + Source

      merge(d1, d2, fun) @@ -302,7 +307,7 @@

      Examples

      #=> [a:4, b:2, d: 4]
      - Source + Source

      new() @@ -343,7 +348,7 @@

      Examples

      put(keywords, key, value)

      -

      Sets the given value under key.

      +

      Puts the given value under key.

      If a previous value is already stored, all entries are removed and the value is overriden.

      @@ -355,6 +360,20 @@

      Examples

      Source +
      +

      + put_new(keywords, key, value) +

      +

      Puts the given value under key unless the entry key +already exists.

      + +

      Examples

      + +
      Keyword.put_new [a: 1, b: 2], :a, 3
      +#=> [a: 1, b: 2]
      +
      +
      + Source

      update(list1, key, fun) @@ -370,7 +389,7 @@

      Examples

      #=> KeyError
      - Source + Source

      update(list1, key, initial, fun) @@ -386,7 +405,7 @@

      Examples

      #=> [a: 1, b: 11]
      - Source + Source

      values(keywords) diff --git a/docs/stable/List.Chars.Atom.html b/docs/stable/List.Chars.Atom.html index 5939205b2..b672659fb 100644 --- a/docs/stable/List.Chars.Atom.html +++ b/docs/stable/List.Chars.Atom.html @@ -36,7 +36,15 @@

      +

      Functions summary

      + @@ -44,6 +52,19 @@

      +
      +

      Functions

      +
      +

      + to_char_list(atom) +

      +
      + Source +
      +
      + + +

      diff --git a/docs/stable/List.Chars.BitString.html b/docs/stable/List.Chars.BitString.html index 7230cf1c2..0e87f7dd2 100644 --- a/docs/stable/List.Chars.BitString.html +++ b/docs/stable/List.Chars.BitString.html @@ -36,7 +36,15 @@

      +

      Functions summary

      + @@ -44,6 +52,19 @@

      +
      +

      Functions

      +
      +

      + to_char_list(bitstring) +

      +
      + Source +
      +
      + + + diff --git a/docs/stable/List.Chars.List.html b/docs/stable/List.Chars.List.html index 918a04826..5abba51c1 100644 --- a/docs/stable/List.Chars.List.html +++ b/docs/stable/List.Chars.List.html @@ -36,7 +36,15 @@

      +

      Functions summary

      + @@ -44,6 +52,19 @@

      +
      +

      Functions

      +
      +

      + to_char_list(list) +

      +
      + Source +
      +
      + + + diff --git a/docs/stable/List.Chars.Number.html b/docs/stable/List.Chars.Number.html index 234e6a32d..477665e1d 100644 --- a/docs/stable/List.Chars.Number.html +++ b/docs/stable/List.Chars.Number.html @@ -36,7 +36,15 @@

      +

      Functions summary

      + @@ -44,6 +52,19 @@

      +
      +

      Functions

      +
      +

      + to_char_list(integer) +

      +
      + Source +
      +
      + + + diff --git a/docs/stable/List.Dict.html b/docs/stable/List.Dict.html new file mode 100644 index 000000000..6942a809a --- /dev/null +++ b/docs/stable/List.Dict.html @@ -0,0 +1,276 @@ + + + + List.Dict + + + + + + + + + + + + +
      +

      + List.Dict + +

      + + +
      +

      A Dict implementation that works on lists of two-items tuples.

      + +

      For more information about the functions and their APIs, please +consult the Dict module.

      + +
      + + + Source + + + + + + +

      Functions summary

      + + + + + + + + +
      +

      Functions

      +
      +

      + delete(dict, key) +

      +

      Deletes the entry under the given key from the dict.

      +
      + Source +
      +

      + empty(_dict) +

      +

      Returns an empty List.Dict.

      +
      + Source +
      +

      + get(dict, key, default // nil) +

      +

      Returns the value under key from the given +dict or default if no key is set.

      +
      + Source +
      +

      + get!(dict, key) +

      +

      Returns the value under the given key +raises KeyError if the key does not exist.

      +
      + Source +
      +

      + has_key?(dict, key) +

      +

      Returns true if the dict has the given key.

      +
      + Source +
      +

      + keys(dict) +

      +

      Returns all keys in the dict.

      +
      + Source +
      +

      + merge(dict, enum, callback // fn _k, _v1, v2 -> v2 end) +

      +

      Merges the given Enumerable into the dict.

      +
      + Source +
      +

      + new() +

      +

      Returns a new List.Dict, i.e. an empty list.

      +
      + Source +
      +

      + new(pairs) +

      +

      Creates a new List.Dict from the given pairs.

      +
      + Source +
      +

      + new(list, transform) +

      +

      Creates a new List.Dict from the given pairs +via the given transformation function.

      +
      + Source +
      +

      + put(dict, key, val) +

      +

      Puts the given key-value pair in the dict.

      +
      + Source +
      +

      + put_new(dict, key, val) +

      +

      Puts the given key-value pair in the dict +if no entry exists yet.

      +
      + Source +
      +

      + size(dict) +

      +

      Returns the dict size.

      +
      + Source +
      +

      + to_list(dict) +

      +

      Converts the dict to a list.

      +
      + Source +
      +

      + update(list1, key, fun) +

      +

      Updates the key in the dict according to the given function.

      +
      + Source +
      +

      + update(list1, key, initial, fun) +

      +

      Updates the key in the dict according to the given function +or uses the given initial value if no entry exists.

      +
      + Source +
      +

      + values(dict) +

      +

      Returns all values in the dict.

      +
      + Source +
      +
      + + + + + +
      + + diff --git a/docs/stable/List.html b/docs/stable/List.html index 83bdad2fc..75aca8a52 100644 --- a/docs/stable/List.html +++ b/docs/stable/List.html @@ -408,7 +408,7 @@

      Examples

      #=> [[1, 2, 3], [:a, :b, :c]] - Source + Source

      wrap(list) @@ -422,7 +422,7 @@

      Examples

      List.wrap [1,2,3] #=> [1,2,3]
       
      - Source + Source

      zip(list_of_lists) @@ -438,7 +438,7 @@

      Examples

      #=> [{1, 3, 5}]
      - Source + Source diff --git a/docs/stable/Macro.Env.html b/docs/stable/Macro.Env.html index 5ddaf60db..c44f3587f 100644 --- a/docs/stable/Macro.Env.html +++ b/docs/stable/Macro.Env.html @@ -29,8 +29,27 @@

      -

      A record that contains compile time environment information, -It can be accessed at any time by calling ENV.

      +

      A record that holds compile time environment information.

      + +

      The current environment can be accessed at any time as +__ENV__. Inside macros, the caller environment can be +accessed as __CALLER__. It contains the following fields:

      + +
        +
      • module - the current module name.
      • +
      • file - the current file name as a binary
      • +
      • line - the current line as an integer
      • +
      • function - a tuple as { atom, integer }, where the first +element is the function name and the seconds its arity. Returns +nil if not inside a function
      • +
      • aliases - a list of two item tuples, where the first +item is the aliased name and the second the actual name
      • +
      • context - the context of the environment. It can be nil +(default context), inside a guard or inside an assign
      • +
      • requires - the list of required modules
      • +
      • functions - a list of functions imported from each module
      • +
      • macros - a list of macros imported from each module
      • +
      @@ -104,56 +123,6 @@

      Fields (and defaults)

      Functions summary

      • - - aliases/1 - -
      • -
      • - - aliases/2 - -
      • -
      • - - context/1 - -
      • -
      • - - context/2 - -
      • -
      • - - file/1 - -
      • -
      • - - file/2 - -
      • -
      • - - function/1 - -
      • -
      • - - function/2 - -
      • -
      • - - functions/1 - -
      • -
      • - - functions/2 - -
      • -
      • in_guard?/1 @@ -163,16 +132,6 @@

        Functions summary

        in_match?/1
      • -
      • - - line/1 - -
      • -
      • - - line/2 - -
      • location/1 @@ -180,97 +139,7 @@

        Functions summary

      • - macros/1 - -
      • -
      • - - macros/2 - -
      • -
      • - - module/1 - -
      • -
      • - - module/2 - -
      • -
      • - - new/0 - -
      • -
      • - - new/1 - -
      • -
      • - - requires/1 - -
      • -
      • - - requires/2 - -
      • -
      • - - to_keywords/1 - -
      • -
      • - - update/2 - -
      • -
      • - - update_aliases/2 - -
      • -
      • - - update_context/2 - -
      • -
      • - - update_file/2 - -
      • -
      • - - update_function/2 - -
      • -
      • - - update_functions/2 - -
      • -
      • - - update_line/2 - -
      • -
      • - - update_macros/2 - -
      • -
      • - - update_module/2 - -
      • -
      • - - update_requires/2 + stacktrace/1
      • @@ -285,82 +154,13 @@

        Functions summary

        Functions

        -

        - aliases(record) -

        -

        Returns a list of two item tuples, where the first -item is the aliased name and the second the actual name.

        -
        - Source -
        -

        - aliases(value, record) -

        -
        - Source -
        -

        - context(record) -

        -

        Returns the context of the environment. It can be nil -(default context), inside a guard or inside an assign.

        -
        - Source -
        -

        - context(value, record) -

        -
        - Source -
        -

        - file(record) -

        -

        Returns the current file name as a binary.

        -
        - Source -
        -

        - file(value, record) -

        -
        - Source -
        -

        - function(record) -

        -

        Returns a tuple as { Atom, Integer }, where the first element -is the function name and the seconds its arity. Returns nil -if not inside a function.

        -
        - Source -
        -

        - function(value, record) -

        -
        - Source -
        -

        - functions(record) -

        -

        Returns a list of functions imported from each module.

        -
        - Source -
        -

        - functions(value, record) -

        -
        - Source -

        in_guard?(record)

        Returns wether the compilation environment is currently inside a guard.

        - Source + Source

        in_match?(record) @@ -368,20 +168,7 @@

        Functions

        Returns wether the compilation environment is currently inside a match clause.

        - Source -
        -

        - line(record) -

        -

        Returns the current line as an integer.

        -
        - Source -
        -

        - line(value, record) -

        -
        - Source + Source

        location(record) @@ -389,124 +176,14 @@

        Functions

        Returns a keyword list containing the file and line information as keys.

        - Source -
        -

        - macros(record) -

        -

        Returns a list of macros imported from each module.

        -
        - Source + Source
        -

        - macros(value, record) +

        + stacktrace(record)

        -
        - Source -
        -

        - module(record) -

        -

        Returns the current module name.

        -
        - Source -
        -

        - module(value, record) -

        -
        - Source -
        -

        - new() -

        -
        - Source -
        -

        - new(opts) -

        -
        - Source -
        -

        - requires(record) -

        -

        Returns the list of required modules.

        +

        Returns the environment stacktrace.

        - Source -
        -

        - requires(value, record) -

        -
        - Source -
        -

        - to_keywords(record) -

        -
        - Source -
        -

        - update(keywords, record) -

        -
        - Source -
        -

        - update_aliases(function, record) -

        -
        - Source -
        -

        - update_context(function, record) -

        -
        - Source -
        -

        - update_file(function, record) -

        -
        - Source -
        -

        - update_function(function, record) -

        -
        - Source -
        -

        - update_functions(function, record) -

        -
        - Source -
        -

        - update_line(function, record) -

        -
        - Source -
        -

        - update_macros(function, record) -

        -
        - Source -
        -

        - update_module(function, record) -

        -
        - Source -
        -

        - update_requires(function, record) -

        -
        - Source + Source
        diff --git a/docs/stable/Macro.html b/docs/stable/Macro.html index 0ab1ed027..0efb339ac 100644 --- a/docs/stable/Macro.html +++ b/docs/stable/Macro.html @@ -122,7 +122,7 @@

        Functions

        do_safe_term(terms)

        - Source + Source

        escape(tuple) @@ -137,7 +137,7 @@

        Examples

        #=> :foo Macro.escape({ :a, :b, :c }) -#=> { :{}, 0, [:a, :b, :c] } +#=> { :{}, [], [:a, :b, :c] }
        Source @@ -203,7 +203,7 @@

        Examples

        The compilation will fail because My.Module when quoted is not an atom, but a syntax tree as follow:

        -
        {:__aliases__, 0, [:My, :Module] }
        +
        {:__aliases__, [], [:My, :Module] }
         

        That said, we need to expand the aliases node above to an @@ -237,7 +237,7 @@

        Examples

        end
        - Source + Source

        extract_args(expr) @@ -269,7 +269,7 @@

        Examples

        evaluate code) and returns :ok unless a given term is unsafe, which is returned as { :unsafe, term }.

        - Source + Source

        to_binary(tree) @@ -282,7 +282,7 @@

        Examples

        #=> "foo.bar(1, 2, 3)"
        - Source + Source

        unescape_binary(chars) @@ -292,9 +292,9 @@

        Examples

        Check unescape_binary/2 for information on how to customize the escaping map.

        -

        In this setup, Elixir will escape the following: \b, \d, -\e, \f, \n, \r, \s, \t and \v. Octals are also -escaped according to the latin1 set they represent.

        +

        In this setup, Elixir will escape the following: \a, \b, +\d, \e, \f, \n, \r, \s, \t and \v. Octals are +also escaped according to the latin1 set they represent.

        This function is commonly used on sigil implementations (like %r, %b and others).

        @@ -323,7 +323,8 @@

        Map

        representing the number of the characters it wants to unescape. Here is the default mapping function implemented by Elixir:

        -
        def unescape_map(?b), do: ?\b
        +
        def unescape_map(?a), do: ?\a
        +def unescape_map(?b), do: ?\b
         def unescape_map(?d), do: ?\d
         def unescape_map(?e), do: ?\e
         def unescape_map(?f), do: ?\f
        @@ -355,7 +356,7 @@ 

        Examples

        Macro.unescape_binary "example\\n", unescape_map(&1)
         
        - Source + Source

        unescape_tokens(tokens) @@ -367,7 +368,7 @@

        Examples

        when implementing your own sigils. Check the implementation of Kernel.__b__ for examples.

        - Source + Source

        unescape_tokens(tokens, map) @@ -375,7 +376,7 @@

        Examples

        Unescape the given tokens according to the given map. Check unescape_tokens/1 and unescaped/2 for more information.

        - Source + Source
        diff --git a/docs/stable/MatchError.html b/docs/stable/MatchError.html index 72f662c02..4639fa521 100644 --- a/docs/stable/MatchError.html +++ b/docs/stable/MatchError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -50,55 +50,10 @@

        Fields (and defaults)

        Functions summary

        @@ -111,65 +66,11 @@

        Functions summary

        Functions

        -

        - actual(record) -

        -
        - Source -
        -

        - actual(value, record) -

        -
        - Source -
        -

        - exception(args) -

        -
        - Source -
        -

        - exception(args, self) -

        -
        - Source -

        message(exception)

        - Source -
        -

        - new() -

        -
        - Source -
        -

        - new(opts) -

        -
        - Source -
        -

        - to_keywords(record) -

        -
        - Source -
        -

        - update(keywords, record) -

        -
        - Source -
        -

        - update_actual(function, record) -

        -
        - Source + Source
        diff --git a/docs/stable/Mix.Dep.html b/docs/stable/Mix.Dep.html index dc90515ee..7560e4255 100644 --- a/docs/stable/Mix.Dep.html +++ b/docs/stable/Mix.Dep.html @@ -92,264 +92,12 @@

        Fields (and defaults)

        -

        Functions summary

        - - -
        -

        Functions

        -
        -

        - app(record) -

        -
        - Source -
        -

        - app(value, record) -

        -
        - Source -
        -

        - new() -

        -
        - Source -
        -

        - new(opts) -

        -
        - Source -
        -

        - opts(record) -

        -
        - Source -
        -

        - opts(value, record) -

        -
        - Source -
        -

        - project(record) -

        -
        - Source -
        -

        - project(value, record) -

        -
        - Source -
        -

        - requirement(record) -

        -
        - Source -
        -

        - requirement(value, record) -

        -
        - Source -
        -

        - scm(record) -

        -
        - Source -
        -

        - scm(value, record) -

        -
        - Source -
        -

        - status(record) -

        -
        - Source -
        -

        - status(value, record) -

        -
        - Source -
        -

        - to_keywords(record) -

        -
        - Source -
        -

        - update(keywords, record) -

        -
        - Source -
        -

        - update_app(function, record) -

        -
        - Source -
        -

        - update_opts(function, record) -

        -
        - Source -
        -

        - update_project(function, record) -

        -
        - Source -
        -

        - update_requirement(function, record) -

        -
        - Source -
        -

        - update_scm(function, record) -

        -
        - Source -
        -

        - update_status(function, record) -

        -
        - Source -
        -
        - diff --git a/docs/stable/Mix.Deps.Lock.html b/docs/stable/Mix.Deps.Lock.html deleted file mode 100644 index c7b0b2874..000000000 --- a/docs/stable/Mix.Deps.Lock.html +++ /dev/null @@ -1,101 +0,0 @@ - - - - Mix.Deps.Lock - - - - - - - - - - - - -
        -

        - Mix.Deps.Lock - -

        - - -
        -

        This is the module responsible to manage mix.lock file.

        - -
        - - - Source - - - - - - -

        Functions summary

        - - - - - - - - -
        -

        Functions

        -
        -

        - lockfile() -

        -

        Returns the lockfile path.

        -
        - Source -
        -

        - read(file // lockfile) -

        -

        Read the file, returns a keyword list containing -the app name and its current lock information.

        -
        - Source -
        -

        - write(file // lockfile, dict) -

        -

        Receives a keyword list and writes it to the disk.

        -
        - Source -
        -
        - - - - - -
        - - diff --git a/docs/stable/Mix.Error.html b/docs/stable/Mix.Error.html index e617924c7..91cbab0f5 100644 --- a/docs/stable/Mix.Error.html +++ b/docs/stable/Mix.Error.html @@ -53,75 +53,7 @@

        Fields (and defaults)

        -

        Functions summary

        - @@ -129,91 +61,6 @@

        Functions summary

        -
        -

        Functions

        -
        -

        - exception(args) -

        -
        - Source -
        -

        - exception(args, self) -

        -
        - Source -
        -

        - message(record) -

        -
        - Source -
        -

        - message(value, record) -

        -
        - Source -
        -

        - mix_error(record) -

        -
        - Source -
        -

        - mix_error(value, record) -

        -
        - Source -
        -

        - new() -

        -
        - Source -
        -

        - new(opts) -

        -
        - Source -
        -

        - to_keywords(record) -

        -
        - Source -
        -

        - toggle_mix_error(record) -

        -
        - Source -
        -

        - update(keywords, record) -

        -
        - Source -
        -

        - update_message(function, record) -

        -
        - Source -
        -

        - update_mix_error(function, record) -

        -
        - Source -
        -
        - - - diff --git a/docs/stable/Mix.InvalidTaskError.html b/docs/stable/Mix.InvalidTaskError.html index 044b89a62..7adf4d5ab 100644 --- a/docs/stable/Mix.InvalidTaskError.html +++ b/docs/stable/Mix.InvalidTaskError.html @@ -56,75 +56,10 @@

        Fields (and defaults)

        Functions summary

        @@ -137,89 +72,11 @@

        Functions summary

        Functions

        -

        - exception(args) -

        -
        - Source -
        -

        - exception(args, self) -

        -
        - Source -

        message(exception)

        Source -
        -

        - mix_error(record) -

        -
        - Source -
        -

        - mix_error(value, record) -

        -
        - Source -
        -

        - new() -

        -
        - Source -
        -

        - new(opts) -

        -
        - Source -
        -

        - task(record) -

        -
        - Source -
        -

        - task(value, record) -

        -
        - Source -
        -

        - to_keywords(record) -

        -
        - Source -
        -

        - toggle_mix_error(record) -

        -
        - Source -
        -

        - update(keywords, record) -

        -
        - Source -
        -

        - update_mix_error(function, record) -

        -
        - Source -
        -

        - update_task(function, record) -

        -
        - Source
        diff --git a/docs/stable/Mix.NoProjectError.html b/docs/stable/Mix.NoProjectError.html index 82f5178b3..90b783d18 100644 --- a/docs/stable/Mix.NoProjectError.html +++ b/docs/stable/Mix.NoProjectError.html @@ -53,75 +53,7 @@

        Fields (and defaults)

        -

        Functions summary

        - @@ -129,91 +61,6 @@

        Functions summary

        -
        -

        Functions

        -
        -

        - exception(args) -

        -
        - Source -
        -

        - exception(args, self) -

        -
        - Source -
        -

        - message(record) -

        -
        - Source -
        -

        - message(value, record) -

        -
        - Source -
        -

        - mix_error(record) -

        -
        - Source -
        -

        - mix_error(value, record) -

        -
        - Source -
        -

        - new() -

        -
        - Source -
        -

        - new(opts) -

        -
        - Source -
        -

        - to_keywords(record) -

        -
        - Source -
        -

        - toggle_mix_error(record) -

        -
        - Source -
        -

        - update(keywords, record) -

        -
        - Source -
        -

        - update_message(function, record) -

        -
        - Source -
        -

        - update_mix_error(function, record) -

        -
        - Source -
        -
        - - - diff --git a/docs/stable/Mix.NoTaskError.html b/docs/stable/Mix.NoTaskError.html index 213d40a2d..87c96a1e2 100644 --- a/docs/stable/Mix.NoTaskError.html +++ b/docs/stable/Mix.NoTaskError.html @@ -56,75 +56,10 @@

        Fields (and defaults)

        Functions summary

        @@ -137,89 +72,11 @@

        Functions summary

        Functions

        -

        - exception(args) -

        -
        - Source -
        -

        - exception(args, self) -

        -
        - Source -

        message(exception)

        Source -
        -

        - mix_error(record) -

        -
        - Source -
        -

        - mix_error(value, record) -

        -
        - Source -
        -

        - new() -

        -
        - Source -
        -

        - new(opts) -

        -
        - Source -
        -

        - task(record) -

        -
        - Source -
        -

        - task(value, record) -

        -
        - Source -
        -

        - to_keywords(record) -

        -
        - Source -
        -

        - toggle_mix_error(record) -

        -
        - Source -
        -

        - update(keywords, record) -

        -
        - Source -
        -

        - update_mix_error(function, record) -

        -
        - Source -
        -

        - update_task(function, record) -

        -
        - Source
        diff --git a/docs/stable/Mix.OutOfDateDepsError.html b/docs/stable/Mix.OutOfDateDepsError.html index 52d41cafd..a4afa25c4 100644 --- a/docs/stable/Mix.OutOfDateDepsError.html +++ b/docs/stable/Mix.OutOfDateDepsError.html @@ -56,75 +56,10 @@

        Fields (and defaults)

        Functions summary

        @@ -137,89 +72,11 @@

        Functions summary

        Functions

        -

        - env(record) -

        -
        - Source -
        -

        - env(value, record) -

        -
        - Source -
        -

        - exception(args) -

        -
        - Source -
        -

        - exception(args, self) -

        -
        - Source -

        message(exception)

        Source -
        -

        - mix_error(record) -

        -
        - Source -
        -

        - mix_error(value, record) -

        -
        - Source -
        -

        - new() -

        -
        - Source -
        -

        - new(opts) -

        -
        - Source -
        -

        - to_keywords(record) -

        -
        - Source -
        -

        - toggle_mix_error(record) -

        -
        - Source -
        -

        - update(keywords, record) -

        -
        - Source -
        -

        - update_env(function, record) -

        -
        - Source -
        -

        - update_mix_error(function, record) -

        -
        - Source
        diff --git a/docs/stable/Mix.Project.html b/docs/stable/Mix.Project.html index b6549ba48..0681a64da 100644 --- a/docs/stable/Mix.Project.html +++ b/docs/stable/Mix.Project.html @@ -75,6 +75,11 @@

        Functions summary

        config/0 +
      • + + config_files/0 + +
      • get/0 @@ -108,7 +113,14 @@

        Functions

        Returns the project configuration already considering the current environment.

        - Source + Source +
        +

        + config_files() +

        +

        Returns a list of project config files (mix.exs and mix.lock).

        +
        + Source

        get() @@ -121,16 +133,16 @@

        Functions

        function raises Mix.NoProjectError in case no project is available.

        -

        Returns nil if no project./

        +

        Returns nil if no project.

        - Source + Source

        get!()

        Same as get/0 but raises an exception if no project.

        - Source + Source

        refresh() @@ -138,7 +150,7 @@

        Functions

        Refresh the project configuration. Usually required when the environment changes during a task.

        - Source + Source
        diff --git a/docs/stable/Mix.Task.html b/docs/stable/Mix.Task.html index ca28da80e..f26ca6d3e 100644 --- a/docs/stable/Mix.Task.html +++ b/docs/stable/Mix.Task.html @@ -129,7 +129,7 @@

        Functions

        Clears all invoked tasks, allowing them to be reinvoked. Returns an ordset with all the tasks invoked thus far.

        - Source + Source

        get(task) @@ -172,7 +172,7 @@

        Exceptions

        Reenables a given task so it can be executed again down the stack.

        - Source + Source

        run(task, args // []) diff --git a/docs/master/Mix.Tasks.Iex.html b/docs/stable/Mix.Tasks.App.Start.html similarity index 80% rename from docs/master/Mix.Tasks.Iex.html rename to docs/stable/Mix.Tasks.App.Start.html index 80c6f6303..f3ade2d1b 100644 --- a/docs/master/Mix.Tasks.Iex.html +++ b/docs/stable/Mix.Tasks.App.Start.html @@ -1,7 +1,7 @@ - Mix.Tasks.Iex + Mix.Tasks.App.Start @@ -21,16 +21,14 @@

        - Mix.Tasks.Iex + Mix.Tasks.App.Start

        -

        Starts an iex repl with your project settings.

        - -

        Before starting IEx, it invokes the prepare task -which defaults to compile and load your project.

        +

        Starts all registered apps. If no apps key exists, +it starts the current application.

        Command line options

        @@ -42,7 +40,7 @@

        Command line options

        - Source + Source @@ -72,7 +70,7 @@

        Functions

        run(args)

        - Source + Source
        diff --git a/docs/stable/Mix.Tasks.Compile.App.html b/docs/stable/Mix.Tasks.Compile.App.html index 32132466a..ed6f67653 100644 --- a/docs/stable/Mix.Tasks.Compile.App.html +++ b/docs/stable/Mix.Tasks.Compile.App.html @@ -40,17 +40,17 @@

        http://www.erlang.org/doc/design_principles/applications.html

        -

        Configuration

        +

        Command line options

          -
        • :app - The application name as a binary (required)
        • -
        • :version - The application version as a binary (required)
        • +
        • --force forces compilation regardless of mod times
        -

        Command line options

        +

        Configuration

          -
        • --force forces compilation regardless of mod times
        • +
        • :app - The application name as a binary (required)
        • +
        • :version - The application version as a binary (required)
        diff --git a/docs/stable/Mix.Tasks.Compile.Elixir.html b/docs/stable/Mix.Tasks.Compile.Elixir.html index 0e8732754..2c19174c2 100644 --- a/docs/stable/Mix.Tasks.Compile.Elixir.html +++ b/docs/stable/Mix.Tasks.Compile.Elixir.html @@ -48,20 +48,35 @@

        development cycles, for such, a developer can pass the --quick otion.

        +

        Command line options

        + +
          +
        • --force - forces compilation regardless of module times;
        • +
        • --quick, -q - only compile files that changed;
        • +
        +

        Configuration

          -
        • :elixirc_options - compilation options that applies +
        • :elixirc_paths - directories to find source files. +Defaults to ["lib"], can be configured as:

          + +

          [elixirc_paths: ["lib", "other"]]

        • +
        • :elixirc_options - compilation options that applies to Elixir's compiler, they are: :ignore_module_conflict, :docs and :debug_info. By default, uses the same -behaviour as Elixir

        • +behaviour as Elixir

          + +
            +
          • :compile_exts - extensions to compile whenever there +is a change:
          -

          Command line options

          +

          [compile_exts: [:ex]] +* :watch_exts - extensions to watch in order to trigger +a compilation:

          -
            -
          • --force - forces compilation regardless of module times;
          • -
          • --quick, -q - only compile files that changed;
          • +

            [watch_exts: [:ex, :eex]]

          @@ -97,7 +112,7 @@

          Functions

          run(args)

          - Source + Source diff --git a/docs/stable/Mix.Tasks.Compile.Erlang.html b/docs/stable/Mix.Tasks.Compile.Erlang.html new file mode 100644 index 000000000..e4afe82fd --- /dev/null +++ b/docs/stable/Mix.Tasks.Compile.Erlang.html @@ -0,0 +1,90 @@ + + + + Mix.Tasks.Compile.Erlang + + + + + + + + + + + + +
          +

          + Mix.Tasks.Compile.Erlang + +

          + + +
          +

          A task to compile Erlang source files.

          + +

          Command line options

          + +
            +
          • ERL_COMPILER_OPTIONS - can be used to give default compile options. +It's value must be a valid Erlang term. If the value is a list, it will +be used as is. If it is not a list, it will be put into a list.
          • +
          + +

          Configuration

          + +
            +
          • :erlc_options - compilation options that applies to Erlang compiler +By default, the following options are on: [:verbose, :report_errors, :report_warnings]
          • +
          + +
          + + + Source + + + + + + +

          Functions summary

          + + + + + + + + +
          +

          Functions

          +
          +

          + run(_) +

          +
          + Source +
          +
          + + + + + +
          + + diff --git a/docs/stable/Mix.Tasks.Compile.html b/docs/stable/Mix.Tasks.Compile.html index 29f4467a9..536d16f41 100644 --- a/docs/stable/Mix.Tasks.Compile.html +++ b/docs/stable/Mix.Tasks.Compile.html @@ -44,33 +44,23 @@

          Configuration

          [compilers: [:elixir, :mycompiler, :app]]
           
          +

          Command line options

          + +
            +
          • --list - List all enabled compilers.
          • +
          + +

          Remaining options are forwarded to underlying compilers.

          +

          Common configuration

          The following options are usually shared by different compilers:

            -
          • :source_paths - directories to find source files. -Defaults to ["lib"], can be configured as:

            - -

            [source_paths: ["lib", "other"]]

          • :compile_path - directory to output compiled files. Defaults to "ebin", can be configured as:

            [compile_path: "ebin"]

          • -
          • :watch_exts - extensions to watch in order to trigger -a compilation:

            - -

            [watch_exts: [:ex, :eex]]

          • -
          • :compile_exts - extensions to compile whenever there -is a change:

            - -

            [compile_exts: [:ex]]

          • -
          - -

          Command line options

          - -
            -
          • --list - List all enabled compilers.
          @@ -106,7 +96,7 @@

          Functions

          run(args)

          - Source + Source diff --git a/docs/stable/Mix.Tasks.Deps.Compile.html b/docs/stable/Mix.Tasks.Deps.Compile.html index fcc3e500c..820af8949 100644 --- a/docs/stable/Mix.Tasks.Deps.Compile.html +++ b/docs/stable/Mix.Tasks.Deps.Compile.html @@ -44,16 +44,9 @@

          The compilation can be customized by passing a compile option in the dependency:

          -
          { :some_dependency, "0.1.0", git: "...", compile: :compile_some_dependency }
          +
          { :some_dependency, "0.1.0", git: "...", compile: "command to compile" }
           
          -

          If the compile option is an atom, it will invoke the given atom -in the current project passing the app name as argument. Except -if the atom is :noop, where nothing is done.

          - -

          If a binary, it is considered to be command line instructions -which mix will use to shell out.

          - @@ -87,7 +80,7 @@

          Functions

          run(args)

          - Source + Source diff --git a/docs/stable/Mix.Tasks.Deps.Get.html b/docs/stable/Mix.Tasks.Deps.Get.html index 477547303..917dd743b 100644 --- a/docs/stable/Mix.Tasks.Deps.Get.html +++ b/docs/stable/Mix.Tasks.Deps.Get.html @@ -30,6 +30,12 @@

          Get all out of date dependencies, i.e. dependencies that are not available or have an invalid lock.

          +

          Command line options

          + +
            +
          • --no-compile skip compilation of dependencies
          • +
          + @@ -63,7 +69,7 @@

          Functions

          run(args)

          - Source + Source diff --git a/docs/stable/Mix.Tasks.Deps.Update.html b/docs/stable/Mix.Tasks.Deps.Update.html index 349e3be93..ee29f6e99 100644 --- a/docs/stable/Mix.Tasks.Deps.Update.html +++ b/docs/stable/Mix.Tasks.Deps.Update.html @@ -33,6 +33,12 @@

          be given to update specific ones. Recompiles the given projects after updating.

          +

          Command line options

          + +
            +
          • --no-compile skip compilation of dependencies
          • +
          + @@ -66,7 +72,7 @@

          Functions

          run(args)

          - Source + Source diff --git a/docs/stable/Mix.Tasks.Escriptize.html b/docs/stable/Mix.Tasks.Escriptize.html index b30333f2b..53ba699f2 100644 --- a/docs/stable/Mix.Tasks.Escriptize.html +++ b/docs/stable/Mix.Tasks.Escriptize.html @@ -29,11 +29,22 @@

          Generates an escript for the project.

          +

          Command line options

          + +
            +
          • --force forces compilation regardless of mod times

          • +
          • --no-compile skips compilation to .beam

          • +
          + +

          Configuration

          +

          The following options can be specified in your mix.exs file:

          • escript_name - the name of the generated escript Defaults to project name

          • +
          • escript_path - the path to write the escript to +Defaults to project name

          • escript_main_module - the module containing the main/1 function. Defaults to Project

          • escript_embed_elixir - if true embed elixir in the escript file. @@ -82,7 +93,7 @@

            Functions

            run(args)

            - Source + Source
          diff --git a/docs/stable/Mix.Tasks.New.html b/docs/stable/Mix.Tasks.New.html index 18b56df2d..82532352c 100644 --- a/docs/stable/Mix.Tasks.New.html +++ b/docs/stable/Mix.Tasks.New.html @@ -30,12 +30,17 @@

          Creates a new Elixir project. It expects the path of the project as argument.

          -
          mix new PATH [--app APP] [--module MODULE]
          +
          mix new PATH [--sup] [--app APP] [--module MODULE]
           

          A project at the given PATH will be created. The application name and module name will be retrieved -from the path, unless -app or --module is given.

          +from the path, unless one of -app or --module +is given.

          + +

          An --sup option can be given to generate an +app with a supervisor and an application module +that starts the supervisor.

          Examples

          @@ -45,6 +50,11 @@

          Examples

          Is equivalent to:

          mix new hello_world --app hello_world --module HelloWorld
          +
          + +

          To generate an app with supervisor and application behaviours:

          + +
          mix new hello_world --sup
           
          @@ -80,7 +90,7 @@

          Functions

          run(argv)

          - Source + Source diff --git a/docs/stable/Mix.Tasks.Run.html b/docs/stable/Mix.Tasks.Run.html index 5eac9c9fd..b06c93466 100644 --- a/docs/stable/Mix.Tasks.Run.html +++ b/docs/stable/Mix.Tasks.Run.html @@ -38,6 +38,8 @@

          Command line options

        • --require, -r - Requires a file before running the command
        • --parallel-require, -pr - Requires a file in parallel
        • --no-halt - Does not halt the system after running the command
        • +
        • --no-compile - Do not compile even if files require compilation;
        • +
        • --no-start - Do not start applications after compilation;

        Examples

        @@ -79,7 +81,7 @@

        Functions

        run(args)

        - Source + Source diff --git a/docs/stable/Mix.Tasks.Test.html b/docs/stable/Mix.Tasks.Test.html index c5a2433c6..16f8a4341 100644 --- a/docs/stable/Mix.Tasks.Test.html +++ b/docs/stable/Mix.Tasks.Test.html @@ -39,6 +39,15 @@

        A list of files can be given after the task name in order to select the files to compile.

        +

        Command line options

        + +
          +
        • --force - forces compilation regardless of module times;
        • +
        • --quick, -q - only compile files that changed;
        • +
        • --no-compile - do not compile even if files require compilation;
        • +
        • --no-start - do not start applications after compilation;
        • +
        +

        Configuration

        @@ -139,7 +139,7 @@

        Examples

        Mix.Utils.camelize "foo_bar" #=> "FooBar"
         
        - Source + Source

        command_to_module(command, at // Elixir) @@ -170,7 +170,7 @@

        Examples

        #=> "Compile.Elixir"
        - Source + Source

        config_merge(old, new) @@ -178,7 +178,7 @@

        Examples

        Merges two configs recursively, merging keyword lists and concatenating normal lists.

        - Source + Source

        extract_files(paths, exts) @@ -190,7 +190,7 @@

        Examples

        It ignores files which start with "."

        - Source + Source

        extract_stale(sources, targets) @@ -198,6 +198,14 @@

        Examples

        Extract all stale sources compared to the given targets.

        Source +
        +

        + mix_home() +

        +

        Gets the mix home. It defaults to ~/.mix unless the +MIX_HOME environment variable is set.

        +
        + Source

        module_name_to_command(module, nesting // 0) @@ -215,7 +223,7 @@

        Examples

        #=> "compile.elixir"
        - Source + Source

        preserving_mtime(path, fun) @@ -223,7 +231,7 @@

        Examples

        Executes a function but preserves the given path mtime properties.

        - Source + Source

        relative_to_cwd(path) @@ -231,7 +239,7 @@

        Examples

        Returns the given path string relative to the current working directory.

        - Source + Source

        source(module) @@ -269,14 +277,7 @@

        Examples

        Mix.Utils.camelize "sap_example" #=> "SapExample"
        - Source -
        -

        - user_home() -

        -

        Gets the user home attempting to consider OS system diferences.

        -
        - Source + Source
        diff --git a/docs/stable/Mix.html b/docs/stable/Mix.html index 53c298baf..bc1a279b6 100644 --- a/docs/stable/Mix.html +++ b/docs/stable/Mix.html @@ -81,7 +81,7 @@

        Functions summary

      • - start/0 + stop/1
      • @@ -101,7 +101,7 @@

        Functions

        Returns the mix environment.

        - Source + Source

        env(env) @@ -109,7 +109,7 @@

        Functions

        Changes the current mix env. Project configuration loaded per environment is not going to be reloaded.

        - Source + Source

        loadpaths() @@ -117,7 +117,7 @@

        Functions

        Starts mix and loads the project and dependencies into one step. Useful when invoking mix from an external tool.

        - Source + Source

        project() @@ -127,7 +127,7 @@

        Functions

        return an empty keyword list. This allows many mix tasks to work without a need for an underlying project.

        - Source + Source

        shell() @@ -139,21 +139,20 @@

        Functions

        allow developers to use a test shell, that simply sends the messages to the current process.

        - Source + Source

        shell(shell)

        Sets the current shell.

        - Source + Source
        -

        - start() +

        + stop(_state)

        -

        Starts the mix application and its dependencies.

        -
        - Source +
        + Source
        diff --git a/docs/stable/Node.html b/docs/stable/Node.html index 987b310f8..a427c34f1 100644 --- a/docs/stable/Node.html +++ b/docs/stable/Node.html @@ -124,7 +124,7 @@

        Functions

        Returns true if the local node is alive; that is, if the node can be part of a distributed system. Otherwise, it returns false.

        - Source + Source

        disconnect(node) @@ -136,7 +136,7 @@

        Functions

        See http://www.erlang.org/doc/man/erlang.html#disconnect_node-1 for more info.

        - Source + Source

        list() @@ -144,7 +144,7 @@

        Functions

        Returns a list of all visible nodes in the system, excluding the local node. Same as list(visible).

        - Source + Source

        list(args) @@ -155,7 +155,7 @@

        Functions

        See http://www.erlang.org/doc/man/erlang.html#nodes-1 for more info.

        - Source + Source

        monitor(node, flag) @@ -165,7 +165,7 @@

        Functions

        See http://www.erlang.org/doc/man/erlang.html#monitor_node-2 for more info.

        - Source + Source

        monitor(node, flag, options) @@ -175,14 +175,14 @@

        Functions

        See http://www.erlang.org/doc/man/erlang.html#monitor_node-3 for more info.

        - Source + Source

        self()

        Returns the current node. It returns the same as the built-in node().

        - Source + Source

        spawn(node, fun) @@ -193,7 +193,7 @@

        Functions

        Check http://www.erlang.org/doc/man/erlang.html#spawn-2 for the list of available options.

        - Source + Source

        spawn(node, fun, opts) @@ -204,7 +204,7 @@

        Functions

        Check http://www.erlang.org/doc/man/erlang.html#spawn_opt-3 for the list of available options.

        - Source + Source

        spawn(node, module, fun, args) @@ -216,7 +216,7 @@

        Functions

        Check http://www.erlang.org/doc/man/erlang.html#spawn-4 for the list of available options.

        - Source + Source

        spawn(node, module, fun, args, opts) @@ -228,7 +228,7 @@

        Functions

        Check http://www.erlang.org/doc/man/erlang.html#spawn_opt-5 for the list of available options.

        - Source + Source

        spawn_link(node, fun) @@ -239,7 +239,7 @@

        Functions

        (and due to the link, an exit signal with exit reason :noconnection will be received).

        - Source + Source

        spawn_link(node, module, fun, args) @@ -250,7 +250,7 @@

        Functions

        pid is returned (and due to the link, an exit signal with exit reason :noconnection will be received).

        - Source + Source diff --git a/docs/stable/OptionParser.html b/docs/stable/OptionParser.html index de952d0fd..1d57f362f 100644 --- a/docs/stable/OptionParser.html +++ b/docs/stable/OptionParser.html @@ -84,28 +84,35 @@

        Aliases

        #=> { [debug: true], [] }
        -

        Flags

        +

        Switches

        -

        A set of flags can be given as argument too. Those are considered -boolean and never consume the next value unless it is a boolean:

        +

        Extra information about switches can be given as argument too. This is useful +in order to say a switch must behave as a boolean, list, etc. The following +types are supported:

        -
        OptionParser.parse(["--unlock path/to/file"], flags: [:unlock])
        +
          +
        • :boolean - They never consume the next value unless it is true/false;
        • +
        + +

        Examples:

        + +
        OptionParser.parse(["--unlock path/to/file"], switches: [unlock: :boolean])
         #=> { [unlock: true], ["path/to/file"] }
         
        -OptionParser.parse(["--unlock false path/to/file"], flags: [:unlock])
        +OptionParser.parse(["--unlock false path/to/file"], switches: [unlock: :boolean])
         #=> { [unlock: false], ["path/to/file"] }
         

        Negation switches

        Any switches starting with --no- are always considered to be -booleans and never parse the next value.

        +booleans and never parse the next value:

        OptionParser.parse(["--no-op path/to/file"])
         #=> { [no_op: true], ["path/to/file"] }
         
        - Source + Source

        parse_head(argv, opts // []) @@ -121,7 +128,7 @@

        Example

        #=> { [source: "lib"], ["test/enum_test.exs", "--verbose"] }
        - Source + Source diff --git a/docs/stable/OrdDict.html b/docs/stable/OrdDict.html index e0f10ee22..90f4daeb2 100644 --- a/docs/stable/OrdDict.html +++ b/docs/stable/OrdDict.html @@ -37,7 +37,7 @@

        - Source + Source @@ -78,7 +78,7 @@

        Functions

        Creates a new empty dict.

        - Source + Source

        new(pairs) @@ -91,7 +91,7 @@

        Examples

        #=> [a: 1, b: 2]
        - Source + Source

        new(list, transform) @@ -105,7 +105,7 @@

        Examples

        #=> ["a": "a", "b": "b"]
        - Source + Source diff --git a/docs/stable/Path.html b/docs/stable/Path.html new file mode 100644 index 000000000..3f279561a --- /dev/null +++ b/docs/stable/Path.html @@ -0,0 +1,484 @@ + + + + Path + + + + + + + + + + + + +
        +

        + Path + +

        + + +
        +

        This module provides conveniences for manipulating or +retrieving filesystem paths.

        + +

        The functions on this module may receive a char list or +a binary as argument and will return the given type.

        + +

        The majority of the functions in this module do not +interact with the file system, unless some few functions +that needs to query the filesystem to retrieve paths +(like Path.wildcard and Path.expand).

        + +
        + + + Source + + + + + + +

        Functions summary

        + + + + + + + + +
        +

        Functions

        +
        +

        + absname(path) +

        +

        Converts the given filename and returns an absolute name. +Differently from Path.expand/1, no attempt is made to +resolve .., . or ~.

        + +

        Unix examples

        + +
        Path.absname("foo")
        +#=> "/usr/local/foo"
        +
        +Path.absname("../x")
        +#=> "/usr/local/../x"
        +
        + +

        Windows

        + +
        Path.absname("foo").
        +"D:/usr/local/foo"
        +Path.absname("../x").
        +"D:/usr/local/../x"
        +
        +
        + Source +
        +

        + absname(path, relative_to) +

        +

        Converts the given filename and returns an absolute name +relative to the given location. If the path is already +an absolute path, the relative path is ignored.

        + +

        Differently from Path.expand/2, no attempt is made to +resolve .., . or ~.

        + +

        Examples

        + +
        Path.absname("foo", "bar")
        +#=> "bar/foo"
        +
        +Path.absname("../x", "bar")
        +#=> "bar/../x"
        +
        +
        + Source +
        +

        + basename(path) +

        +

        Returns the last component of the path or the path +itself if it does not contain any directory separators.

        + +

        Examples

        + +
        Path.basename("foo")
        +#=> "foo"
        +
        +Path.basename("foo/bar")
        +#=> "bar"
        +
        +Path.basename("/")
        +#=> ""
        +
        +
        + Source +
        +

        + basename(path, extension) +

        +

        Returns the last component of path with the extension +stripped. This function should be used to remove a specific +extension which may, or may not, be there.

        + +

        Examples

        + +
        Path.basename("~/foo/bar.ex", ".ex")
        +#=> "bar"
        +Path.basename("~/foo/bar.exs", ".ex")
        +#=> "bar.exs"
        +Path.basename("~/foo/bar.old.ex", ".ex")
        +#=> "bar.old"
        +
        +
        + Source +
        +

        + dirname(path) +

        +

        Return the directory component of path.

        + +

        Examples

        + +
        Path.dirname("/foo/bar.ex")
        +#=> "foo"
        +
        +
        + Source +
        +

        + expand(path) +

        +

        Expands the path by returning its absolute name and expanding +any . and .. characters.

        + +

        Examples

        + +
        Path.expand("/foo/bar/../bar") == "/foo/bar"
        +
        +
        + Source +
        +

        + expand(path, relative_to) +

        +

        Expands the path to the relative location and expanding +any . and .. characters. If the path is already an +absolute path, the relative location is ignored.

        + +

        Examples

        + +
        Path.expand("foo/bar/../bar", "/baz") == "/baz/foo/bar"
        +Path.expand("/foo/bar/../bar", "/baz") == "/foo/bar"
        +
        +
        + Source +
        +

        + extname(path) +

        +

        Return the extension of the last component of path.

        + +

        Examples

        + +
        Path.extname("foo.erl")
        +#=> ".erl"
        +Path.extname("~/foo/bar")
        +#=> ""
        +
        +
        + Source +
        +

        + join(list1) +

        +

        Returns a string with one or more paths components joint by the path separator. +This function should be used to convert a list of strings in a path.

        + +

        Examples

        + +
        Path.join(["~", "foo"])
        +#=> "~/foo"
        +Path.join(["foo"])
        +#=> "foo"
        +Path.join(["/", "foo", "bar"])
        +#=> "/foo/bar"
        +
        +
        + Source +
        +

        + join(left, right) +

        +

        Joins two paths.

        + +

        Examples

        + +
        Path.join("foo", "bar")
        +#=> "foo/bar"
        +
        +
        + Source +
        +

        + relative(name) +

        +

        Forces the path to be a relative path.

        + +

        Unix examples

        + +
        Path.relative("/usr/local/bin")   #=> "usr/local/bin"
        +Path.relative("usr/local/bin")    #=> "usr/local/bin"
        +Path.relative("../usr/local/bin") #=> "../usr/local/bin"
        +
        + +

        Windows examples

        + +
        Path.relative("D:/usr/local/bin") #=> "usr/local/bin"
        +Path.relative("usr/local/bin")    #=> "usr/local/bin"
        +Path.relative("D:bar.ex")         #=> "bar.ex"
        +Path.relative("/bar/foo.ex")      #=> "bar/foo.ex"
        +
        +
        + Source +
        +

        + relative_to(path, from) +

        +

        Returns the given path relative to the given from path.

        + +

        This function does not query the filesystem, so it assumes +no symlinks in between the paths.

        + +

        In case a direct relative path cannot be found, it returns +the original path.

        + +

        Examples

        + +
        Path.relative_to("/usr/local/foo", "/usr/local") #=> "foo"
        +Path.relative_to("/usr/local/foo", "/") #=> "foo"
        +Path.relative_to("/usr/local/foo", "/etc") #=> "/usr/local/foo"
        +
        +
        + Source +
        +

        + rootname(path) +

        +

        Returns the path with the extension stripped.

        + +

        Examples

        + +
        Path.rootname("/foo/bar")
        +#=> "/foo/bar"
        +Path.rootname("/foo/bar.ex")
        +#=> "/foo/bar"
        +
        +
        + Source +
        +

        + rootname(path, extension) +

        +

        Returns the path with the extension stripped. This function should be used to +remove a specific extension which might, or might not, be there.

        + +

        Examples

        + +
        Path.rootname("/foo/bar.erl", ".erl")
        +#=> "/foo/bar"
        +Path.rootname("/foo/bar.erl", ".ex")
        +#=> "/foo/bar.erl"
        +
        +
        + Source +
        +

        + split(path) +

        +

        Returns a list with the path splitted by the path separator. +If an empty string is given, then it returns the root path.

        + +

        Examples

        + +
         Path.split("")
        + #=> ["/"]
        + Path.split("foo")
        + #=> ["foo"]
        + Path.split("/foo/bar")
        + #=> ["/", "foo", "bar"]
        +
        +
        + Source +
        +

        + type(name) +

        +

        Returns the path type.

        + +

        Unix examples

        + +
        Path.type("/usr/local/bin")   #=> :absolute
        +Path.type("usr/local/bin")    #=> :relative
        +Path.type("../usr/local/bin") #=> :relative
        +
        + +

        Windows examples

        + +
        Path.type("D:/usr/local/bin") #=> :absolute
        +Path.type("usr/local/bin")    #=> :relative
        +Path.type("D:bar.ex")         #=> :volumerelative
        +Path.type("/bar/foo.ex")      #=> :volumerelative
        +
        +
        + Source +
        +

        + wildcard(glob) +

        +

        Traverses paths according to the given glob expression.

        + +

        The wildcard looks like an ordinary path, except that certain +"wildcard characters" are interpreted in a special way. The +following characters are special:

        + +
          +
        • ? - Matches one character.
        • +
        • * - Matches any number of characters up to the end of + the filename, the next dot, or the next slash.
        • +
        • ** - Two adjacent *'s used as a single pattern will + match all files and zero or more directories and subdirectories.
        • +
        • [char1,char2,...] - Matches any of the characters listed. Two characters + separated by a hyphen will match a range of characters.
        • +
        • {item1,item2,...} - Matches one of the alternatives.
        • +
        + +

        Other characters represent themselves. Only paths that have +exactly the same character in the same position will match. Note +that matching is case-sensitive; i.e. "a" will not match "A".

        + +

        Examples

        + +

        Imagine you have a directory called projects with three Elixir projects +inside of it: elixir, exdoc and dynamo. You can find all .beam files +inside their ebin directories all projects as follows:

        + +
        Path.wildcard("projects/*/ebin/**/*.beam")
        +
        + +

        If you want to search for both .beam and .app files, you could do:

        + +
        Path.wildcard("projects/*/ebin/**/*.{beam,app}")
        +
        +
        + Source +
        +
        + + + + + +
        + + diff --git a/docs/stable/Process.html b/docs/stable/Process.html index 2550ec82b..e06b10b17 100644 --- a/docs/stable/Process.html +++ b/docs/stable/Process.html @@ -226,21 +226,21 @@

        Functions

        pid must refer to a process at the local node.

        - Source + Source

        delete()

        Deletes all items in the dictionary.

        - Source + Source

        delete(key)

        Deletes the given key from the dictionary.

        - Source + Source

        demonitor(monitor_ref, options // []) @@ -251,10 +251,10 @@

        Functions

        See http://www.erlang.org/doc/man/erlang.html#demonitor-2 for more info.

        - Source + Source

        - exit(pid, status) + exit(pid, reason)

        Sends an exit signal with the given reason to the pid.

        @@ -278,7 +278,7 @@

        Examples

        Process.exit(pid, :kill)
         
        - Source + Source

        flag(flag, value) @@ -288,7 +288,7 @@

        Examples

        See http://www.erlang.org/doc/man/erlang.html#process_flag-2 for more info.

        - Source + Source

        flag(pid, flag, value) @@ -299,37 +299,35 @@

        Examples

        See http://www.erlang.org/doc/man/erlang.html#process_flag-3 for more info.

        - Source + Source

        get()

        -

        Returns all key-values in the dictionary -with no specific ordering (i.e. they are -not a keyword list).

        +

        Returns all key-values in the dictionary.

        - Source + Source

        get(key, default // nil)

        Returns the value for the given key.

        - Source + Source

        get_keys(value)

        Returns all keys that have the given value.

        - Source + Source

        group_leader()

        Returns the pid of the group leader for the process which evaluates the function.

        - Source + Source

        group_leader(leader, pid) @@ -337,7 +335,7 @@

        Examples

        Sets the group leader of Pid to GroupLeader. Typically, this is used when a processes started from a certain shell should have another group leader than :init.

        - Source + Source

        info(pid) @@ -347,7 +345,7 @@

        Examples

        See http://www.erlang.org/doc/man/erlang.html#process_info-1 for more info.

        - Source + Source

        info(pid, spec) @@ -357,7 +355,7 @@

        Examples

        See http://www.erlang.org/doc/man/erlang.html#process_info-2 for more info.

        - Source + Source

        link(pid) @@ -367,7 +365,7 @@

        Examples

        See http://www.erlang.org/doc/man/erlang.html#link-1 for more info.

        - Source + Source

        list() @@ -381,7 +379,7 @@

        Examples

        See http://www.erlang.org/doc/man/erlang.html#processes-0 for more info.

        - Source + Source

        monitor(item) @@ -391,14 +389,14 @@

        Examples

        See http://www.erlang.org/doc/man/erlang.html#monitor-2 for more info.

        - Source + Source

        put(key, value)

        Stores the given key-value in the process dictionary.

        - Source + Source

        register(pid, name) @@ -409,21 +407,21 @@

        Examples

        See http://www.erlang.org/doc/man/erlang.html#register-2 for more info.

        - Source + Source

        registered()

        Returns a list of names which have been registered using register/2.

        - Source + Source

        self()

        Returns the current process.

        - Source + Source

        spawn(fun) @@ -431,7 +429,7 @@

        Examples

        Returns the pid of a new process started by the application of fun. It behaves exactly the same as Kernel.spawn/1.

        - Source + Source

        spawn(fun, opts) @@ -441,7 +439,7 @@

        Examples

        It also accepts extra options, for the list of available options check http://www.erlang.org/doc/man/erlang.html#spawn_opt-2

        - Source + Source

        spawn(mod, fun, args) @@ -452,7 +450,7 @@

        Examples

        It behaves exactly the same as the Kernel.spawn/3 function.

        - Source + Source

        spawn(mod, fun, args, opts) @@ -464,7 +462,7 @@

        Examples

        It also accepts extra options, for the list of available options check http://www.erlang.org/doc/man/erlang.html#spawn_opt-4

        - Source + Source

        spawn_link(fun) @@ -473,7 +471,7 @@

        Examples

        A link is created between the calling process and the new process, atomically.

        - Source + Source

        spawn_link(mod, fun, args) @@ -482,7 +480,7 @@

        Examples

        module.function(args). A link is created between the calling process and the new process, atomically. Otherwise works like spawn/3.

        - Source + Source

        spawn_monitor(fun) @@ -490,7 +488,7 @@

        Examples

        Returns the pid of a new process started by the application of fun and reference for a monitor created to the new process.

        - Source + Source

        spawn_monitor(mod, fun, args) @@ -499,7 +497,7 @@

        Examples

        and the process is monitored at the same time. Returns the pid and a reference for the monitor. Otherwise works like spawn/3.

        - Source + Source

        unlink(pid) @@ -510,7 +508,7 @@

        Examples

        See http://www.erlang.org/doc/man/erlang.html#unlink-1 for more info.

        - Source + Source

        unregister(name) @@ -519,7 +517,7 @@

        Examples

        See http://www.erlang.org/doc/man/erlang.html#unregister-1 for more info.

        - Source + Source

        whereis(name) @@ -529,7 +527,7 @@

        Examples

        See http://www.erlang.org/doc/man/erlang.html#whereis-1 for more info.

        - Source + Source diff --git a/docs/stable/Protocol.UndefinedError.html b/docs/stable/Protocol.UndefinedError.html index bf575437f..a0ff398dc 100644 --- a/docs/stable/Protocol.UndefinedError.html +++ b/docs/stable/Protocol.UndefinedError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -56,70 +56,10 @@

        Fields (and defaults)

        Functions summary

        @@ -132,83 +72,11 @@

        Functions summary

        Functions

        -

        - exception(args) -

        -
        - Source -
        -

        - exception(args, self) -

        -
        - Source -

        message(exception)

        - Source -
        -

        - new() -

        -
        - Source -
        -

        - new(opts) -

        -
        - Source -
        -

        - protocol(record) -

        -
        - Source -
        -

        - protocol(value, record) -

        -
        - Source -
        -

        - structure(record) -

        -
        - Source -
        -

        - structure(value, record) -

        -
        - Source -
        -

        - to_keywords(record) -

        -
        - Source -
        -

        - update(keywords, record) -

        -
        - Source -
        -

        - update_protocol(function, record) -

        -
        - Source -
        -

        - update_structure(function, record) -

        -
        - Source + Source
        diff --git a/docs/stable/Range.Iterator.Number.html b/docs/stable/Range.Iterator.Number.html index 0c1fe9718..8e7d0385e 100644 --- a/docs/stable/Range.Iterator.Number.html +++ b/docs/stable/Range.Iterator.Number.html @@ -36,7 +36,20 @@

        +

        Functions summary

        + @@ -44,6 +57,25 @@

        +
        +

        Functions

        +
        +

        + count(first, arg2) +

        +
        + Source +
        +

        + iterator(first, arg2) +

        +
        + Source +
        +
        + + + diff --git a/docs/stable/Range.html b/docs/stable/Range.html index 24fa0c8d9..28c55082a 100644 --- a/docs/stable/Range.html +++ b/docs/stable/Range.html @@ -58,132 +58,12 @@

        Fields (and defaults)

        -

        Functions summary

        - - -
        -

        Functions

        -
        -

        - first(record) -

        -
        - Source -
        -

        - first(value, record) -

        -
        - Source -
        -

        - last(record) -

        -
        - Source -
        -

        - last(value, record) -

        -
        - Source -
        -

        - new() -

        -
        - Source -
        -

        - new(opts) -

        -
        - Source -
        -

        - to_keywords(record) -

        -
        - Source -
        -

        - update(keywords, record) -

        -
        - Source -
        -

        - update_first(function, record) -

        -
        - Source -
        -

        - update_last(function, record) -

        -
        - Source -
        -
        - diff --git a/docs/stable/Record.html b/docs/stable/Record.html index d346d1816..b40504198 100644 --- a/docs/stable/Record.html +++ b/docs/stable/Record.html @@ -43,7 +43,7 @@

        Functions summary

        • - deffunctions/3 + deffunctions/2
        • @@ -63,7 +63,7 @@

          Functions summary

        • - deftypes/4 + deftypes/3
        • @@ -83,8 +83,8 @@

          Functions summary

          Functions

          -

          - deffunctions(values, _opts // [], env) +

          + deffunctions(values, env)

          Defines record functions skipping the module definition. This is called directly by defrecord. It expects the record @@ -94,7 +94,7 @@

          Examples

          defmodule CustomRecord do
             Record.deffunctions [:name, :age], __ENV__
          -  Record.deftypes [:name, :age], __ENV__
          +  Record.deftypes [:name, :age], [name: :binary, age: :integer], __ENV__
           end
           
          @@ -114,7 +114,7 @@

          Examples

          end
          - Source + Source

          defrecord(name, values, opts) @@ -136,12 +136,12 @@

          Examples

          Source
          -

          - deftypes(values, types, _opts // [], env) +

          + deftypes(values, types, env)

          Defines types and specs for the record.

          - Source + Source

          extract(name, opts) diff --git a/docs/stable/Regex.CompileError.html b/docs/stable/Regex.CompileError.html index 4b8e3454a..f4a673958 100644 --- a/docs/stable/Regex.CompileError.html +++ b/docs/stable/Regex.CompileError.html @@ -47,55 +47,7 @@

          Fields (and defaults)

          -

          Functions summary

          - @@ -103,67 +55,6 @@

          Functions summary

          -
          -

          Functions

          -
          -

          - exception(args) -

          -
          - Source -
          -

          - exception(args, self) -

          -
          - Source -
          -

          - message(record) -

          -
          - Source -
          -

          - message(value, record) -

          -
          - Source -
          -

          - new() -

          -
          - Source -
          -

          - new(opts) -

          -
          - Source -
          -

          - to_keywords(record) -

          -
          - Source -
          -

          - update(keywords, record) -

          -
          - Source -
          -

          - update_message(function, record) -

          -
          - Source -
          -
          - - -
          diff --git a/docs/stable/RuntimeError.html b/docs/stable/RuntimeError.html index 110d1e912..17b6a9586 100644 --- a/docs/stable/RuntimeError.html +++ b/docs/stable/RuntimeError.html @@ -29,7 +29,7 @@

          - Source + Source @@ -47,55 +47,7 @@

          Fields (and defaults)

          -

          Functions summary

          - @@ -103,67 +55,6 @@

          Functions summary

          -
          -

          Functions

          -
          -

          - exception(args) -

          -
          - Source -
          -

          - exception(args, self) -

          -
          - Source -
          -

          - message(record) -

          -
          - Source -
          -

          - message(value, record) -

          -
          - Source -
          -

          - new() -

          -
          - Source -
          -

          - new(opts) -

          -
          - Source -
          -

          - to_keywords(record) -

          -
          - Source -
          -

          - update(keywords, record) -

          -
          - Source -
          -

          - update_message(function, record) -

          -
          - Source -
          -
          - - - diff --git a/docs/stable/String.html b/docs/stable/String.html index 0381769b1..696c840d7 100644 --- a/docs/stable/String.html +++ b/docs/stable/String.html @@ -27,19 +27,87 @@

          -

          A string in Elixir is a utf-8 binary. This module -contains function to work with utf-8 data, its -codepoints and graphemes.

          +

          A string in Elixir is a UTF-8 encoded binary.

          + +

          The functions in this module act according to the +Unicode Standard, version 6.2.0. A codepoint is a +Unicode Character, which may be represented by one +or more bytes. For example, the character "é" is +represented with two bytes:

          + +
          string = "é"
          +#=> "é"
          +size(string)
          +#=> 2
          +
          + +

          Furthermore, this module also presents the concept of +graphemes, which are multiple characters that may be +"perceived as a single character" by readers. For example, +the same "é" character written above could be represented +by the letter "e" followed by the accent ́:

          + +
          string = "\x{0065}\x{0301}"
          +#=> "é"
          +size(string)
          +#=> 3
          +
          -

          Notice that graphemes is a superset of UTF-8 codepoints -which also contains named sequences as defined per -http://www.unicode.org/reports/tr34/. In short, graphemes -also contain multiple characters that are "perceived as -a single character" by readers.

          +

          Although the example above is made of two characters, it is +perceived by users as one.

          -

          For working with raw binaries, use Erlang's :binary +

          Graphemes can also be two characters that are interpreted +as one by some languages. For example, some languages may +consider "ch" as a grapheme. However, since this information +depends on the locale, it is not taken into account by this module.

          +

          In general, the functions in this module rely on the Unicode +Standard, but does not contain any of the locale specific +behaviour.

          + +

          Integer codepoints

          + +

          Although codepoints could be represented as integers, this +module represents all codepoints as binaries. For example:

          + +
          String.codepoints "josé" #=> ["j", "o", "s", "é"]
          +
          + +

          There are a couple of ways to retrieve a character integer +codepoint. One may use the ? special macro:

          + +
          ?j #=> 106
          +?é #=> 233
          +
          + +

          Or also via pattern matching:

          + +
          << eacute :: utf8 >> = "é"
          +eacute #=> 233
          +
          + +

          As we have seen above, codepoints can be inserted into +a string by their hexadecimal code:

          + +
          string = "jos\x{0065}\x{0301}"
          +#=> "josé"
          +
          + +

          Self-synchronization

          + +

          The UTF-8 encoding is self-synchronizing. This means that +if malformed data (i.e., data that is not possible according +to the definition of the encoding) is encountered, only one +codepoint needs to be rejected.

          + +

          This module relies on this behaviour to ignore such invalid +characters. For example, String.length is going to return +a correct result even if an invalid codepoint is fed into it.

          + +

          In the future, bang version of such functions may be +provided which will rather raise on such invalid data.

          +
          @@ -57,6 +125,11 @@

          Functions summary

          at/2
        • +
        • + + capitalize/1 + +
        • codepoints/1 @@ -132,6 +205,11 @@

          Functions summary

          rstrip/2
        • +
        • + + slice/3 + +
        • split/3 @@ -152,6 +230,11 @@

          Functions summary

          upcase/1
        • +
        • + + valid_codepoint?/1 + +
        @@ -179,12 +262,32 @@

        Examples

        String.at("elixir", -10) #=> nil
        - Source + Source +
        +

        + capitalize(string) +

        +

        Converts the first character in the given string to +titlecase and the remaining to downcase.

        + +

        This relies on the titlecase information provided +by the Unicode Standard. Note this function makes +no attempt in capitalizing all words in the string +(usually known as titlecase).

        + +

        Examples

        + +
        String.capitalize("abcd") #=> "Abcd"
        +String.capitalize("fin")   #=> "Fin"
        +String.capitalize("josé") #=> "José"
        +
        +
        + Source

        codepoints(string)

        -

        Returns a list with codepoints from an utf8 string.

        +

        Returns all codepoints in the string.

        Examples

        @@ -193,17 +296,13 @@

        Examples

        String.codepoints("ἅἪῼ") #=> ["ἅ","Ἢ","ῼ"]
        - Source + Source

        downcase(binary)

        Convert all characters on the given string to downcase.

        -

        This function relies on the simple lowercase mapping -available in Unicode 6.2.0, check http://unicode.org/reports/tr44/ -for more information.

        -

        Examples

        String.downcase("ABCD") #=> "abcd"
        @@ -211,7 +310,7 @@ 

        Examples

        String.downcase("JOSÉ") #=> "josé"
        - Source + Source

        duplicate(subject, n) @@ -224,7 +323,7 @@

        Examples

        String.duplicate("abc", 2) #=> "abcabc"
        - Source + Source

        first(string) @@ -237,18 +336,19 @@

        Examples

        String.first("եոգլի") #=> "ե"
        - Source + Source

        graphemes(string)

        -

        Returns unicode graphemes in the string

        +

        Returns unicode graphemes in the string.

        Examples

        -

        String.graphemes("Ā̀stute") # => ["Ā̀","s","t","u","t","e"]

        +
        String.graphemes("Ā̀stute") # => ["Ā̀","s","t","u","t","e"]
        +
        - Source + Source

        last(string) @@ -261,7 +361,7 @@

        Examples

        String.last("եոգլի") #=> "ի"
        - Source + Source

        length(string) @@ -274,7 +374,7 @@

        Examples

        String.length("եոգլի") #=> 5
        - Source + Source

        lstrip(binary) @@ -287,7 +387,7 @@

        Examples

        String.lstrip("   abc  ")       #=> "abc  "
         
        - Source + Source

        lstrip(other, char) @@ -299,7 +399,7 @@

        Examples

        String.lstrip("_  abc  _", ?_)  #=> "  abc  _"
         
        - Source + Source

        next_codepoint(string) @@ -308,14 +408,19 @@

        Examples

        The result is a tuple with the codepoint and the remaining of the string or :no_codepoint in case -the String reached its end.

        +the string reached its end.

        + +

        As the other functions in the String module, this +function does not check for the validity of the codepoint. +That said, if an invalid codepoint is found, it will +be returned by this function.

        Examples

        String.next_codepoint("josé") #=> { "j", "osé" }
         
        - Source + Source

        next_grapheme(string) @@ -331,7 +436,7 @@

        Examples

        String.next_grapheme("josé") #=> { "j", "osé" }
         
        - Source + Source

        printable?(arg1) @@ -344,19 +449,18 @@

        Examples

        String.printable?("abc") #=> true
         
        - Source + Source

        replace(subject, pattern, replacement, options // [])

        Returns a new binary based on subject by replacing the parts -matching pattern for replacement. If options is specified -with [global: true], then it will replace all matches, otherwise -it will replace just the first one.

        +matching pattern for replacement. By default, it replaces +all entries, except if the global option is set to false.

        -

        For the replaced part must be used in replacement, then the -position or the positions where it is to be inserted must be specified by using -the option insert_replaced.

        +

        If the replaced part must be used in replacement, then the +position or the positions where it is to be inserted must be +specified by using the option insert_replaced.

        Examples

        @@ -367,7 +471,7 @@

        Examples

        String.replace("a,b,c", ",", "[]", insert_replaced: [1,1]) #=> "a[,,]b[,,]c"
        - Source + Source

        rstrip(binary) @@ -380,7 +484,7 @@

        Examples

        String.rstrip("   abc  ")      #=> "   abc"
         
        - Source + Source

        rstrip(string, char) @@ -392,7 +496,25 @@

        Examples

        String.rstrip("   abc _", ?_)  #=> "   abc "
         
        - Source + Source +
        +

        + slice(string, start, len) +

        +

        Returns a substring starting at the offset given by the first, and +a length given by the second. +If the offset is greater than string length, than it returns nil.

        + +

        Examples

        + +
        String.slice("elixir", 1, 3) #=> "lix"
        +String.slice("elixir", 1, 10) #=> "lixir"
        +String.slice("elixir", 10, 3) #=> nil
        +String.slice("elixir", -4, 4) #=> "ixi"
        +String.slice("elixir", -10, 3) #=> nil
        +
        +
        + Source

        split(binary, pattern // " ", options // []) @@ -401,9 +523,10 @@

        Examples

        returning a list of these sub string. The pattern can be a string, a list of strings or a regular expression.

        -

        The string is split into two parts by default, unless -global option is true. If a pattern is not specified, -the string is split on whitespace occurrences.

        +

        The string is split into as many parts as possible by +default, unless the global option is set to false. +If a pattern is not specified, the string is split on +whitespace occurrences.

        It returns a list with the original string if the pattern can't be matched.

        @@ -421,7 +544,7 @@

        Examples

        String.split("a,b", %r{.}) #=> ["a,b"]
        - Source + Source

        strip(string) @@ -434,7 +557,7 @@

        Examples

        String.strip("   abc  ")       #=> "abc"
         
        - Source + Source

        strip(string, char) @@ -447,17 +570,13 @@

        Examples

        String.strip("a  abc  a", ?a)  #=> "  abc  "
         
        - Source + Source

        upcase(binary)

        Convert all characters on the given string to upcase.

        -

        This function relies on the simple uppercase mapping -available in Unicode 6.2.0, check http://unicode.org/reports/tr44/ -for more information.

        -

        Examples

        String.upcase("abcd") #=> "ABCD"
        @@ -465,7 +584,25 @@ 

        Examples

        String.upcase("josé") #=> "JOSÉ"
        - Source + Source +
        +

        + valid_codepoint?(arg1) +

        +

        Checks whether str is a valid codepoint.

        + +

        Note that the empty string is considered invalid, as are +strings containing multiple codepoints.

        + +

        Examples

        + +
        String.valid_codepoint?("a") #=> true
        +String.valid_codepoint?("ø") #=> true
        +String.valid_codepoint?("\xffff") #=> false
        +String.valid_codepoint?("asdf") #=> false
        +
        +
        + Source
        diff --git a/docs/stable/Supervisor.Behaviour.html b/docs/stable/Supervisor.Behaviour.html new file mode 100644 index 000000000..9505007a9 --- /dev/null +++ b/docs/stable/Supervisor.Behaviour.html @@ -0,0 +1,272 @@ + + + + Supervisor.Behaviour + + + + + + + + + + + + +
        +

        + Supervisor.Behaviour + +

        + + +
        +

        This module is a convenience to define Supervisor +callbacks in Elixir. By using this module, you get +the module behaviour automatically tagged as +:supervisor and some helper functions are imported +to make defining supervisors easier.

        + +

        For more information on supervisors, please check the +remaining functions defined in this module or refer to +the following:

        + +

        http://www.erlang.org/doc/man/supervisor.html +http://www.erlang.org/doc/design_principles/sup_princ.html +http://learnyousomeerlang.com/supervisors

        + +

        Example

        + +
        defmodule ExUnit.Sup do
        +  use Supervisor.Behaviour
        +
        +  def init(user_options) do
        +    tree = [ worker(ExUnit.Runner, [user_options]) ]
        +    supervise(tree, strategy: :one_for_one)
        +  end
        +end
        +
        +{ :ok, pid } = :supervisor.start_link(MyServer, [])
        +
        + +
        + + + Source + + + + + + +

        Functions summary

        + + + + + + + + +
        +

        Functions

        +
        +

        + supervise(children, options) +

        +

        Receives a list of children (worker or supervisors) to +supervise and a set of options. Returns a tuple containing +the supervisor specification.

        + +

        Examples

        + +
        supervise children, strategy: :one_for_one
        +
        + +

        Options

        + +
          +
        • :strategy - the restart strategy option It can be either +:one_for_one, :rest_for_one, :one_for_all and +:simple_one_for_one;

        • +
        • :max_restarts - the maximum amount of restarts allowed in +a time frame. Defaults to 5;

        • +
        • :max_seconds - the time frame in which max_restarts applies. +Defaults to 5;

        • +
        + +

        The :strategy option is required and by default maximum 5 restarts +are allowed in 5 seconds.

        + +

        Strategies

        + +
          +
        • :one_for_one - If a child process terminates, only that +process is restarted;

        • +
        • :one_for_all - If a child process terminates, all other child +processes are terminated and then all child processes, including +the terminated one, are restarted;

        • +
        • :rest_for_one - If a child process terminates, the "rest" of +the child processes, i.e. the child processes after the terminated +process in start order, are terminated. Then the terminated child +process and the rest of the child processes are restarted;

        • +
        • :simple_one_for_one - Similar to :one_for_one but suits better +when dynamically attaching children;

        • +
        +
        + Source +
        +

        + supervisor(module, args, options // []) +

        +

        Defines the given module as a supervisor which will be started +with the given arguments.

        + +
        supervisor ExUnit.Runner, [], restart: :permanent
        +
        + +

        By default, the function :start_link is invoked on the given module.

        + +

        Options

        + +
          +
        • :id - a name used to identify the child specification +internally by the supervisor. Defaults to the module name;

        • +
        • :function - the function to invoke on the child to start it. +Defaults to :start_link;

        • +
        • :restart - defines when the child process should restart. +Defaults to :permanent;

        • +
        • :shutdown - defines how a child process should be terminated. +Defaults to 5000;

        • +
        • :modules - it should be a list with one element [module], +where module is the name of the callback module only if the +child process is a supervisor, genserver or genfsm. If the +child process is a gen_event, modules should be :dynamic. +Defaults to a list with the given module;

        • +
        + +

        Restart values

        + +

        The following restart values are supported:

        + +
          +
        • :permanent - the child process is always restarted;

        • +
        • :temporary - the child process is never restarted (not even +when the supervisor's strategy is :rest_for_one or :one_for_all);

        • +
        • :transient - the child process is restarted only if it +terminates abnormally, i.e. with another exit reason than +:normal, :shutdown or { :shutdown, term };

        • +
        + +

        Shutdown values

        + +

        The following shutdown values are supported:

        + +
          +
        • :brutal_kill - the child process is unconditionally terminated +using exit(child, :kill);

        • +
        • :infinity - if the child process is a supervisor, it is a mechanism +to give the subtree enough time to shutdown. It can also be used with +workers with care;

        • +
        • Finally, it can also be any integer meaning that the supervisor tells +the child process to terminate by calling exit(child, :shutdown) and +then waits for an exit signal back. If no exit signal is received within +the specified time (in miliseconds), the child process is unconditionally +terminated using exit(child, :kill);

        • +
        +
        + Source +
        +

        + worker(module, args, options // []) +

        +

        Defines the given module as a worker which will be started +with the given arguments.

        + +
        worker ExUnit.Runner, [], restart: :permanent
        +
        + +

        By default, the function :start_link is invoked on the given module.

        + +

        Options

        + +
          +
        • :id - a name used to identify the child specification +internally by the supervisor. Defaults to the module name;

        • +
        • :function - the function to invoke on the child to start it. +Defaults to :start_link;

        • +
        • :restart - defines when the child process should restart. +Defaults to :permanent;

        • +
        • :shutdown - defines how a child process should be terminated. +Defaults to 5000;

        • +
        • :modules - it should be a list with one element [module], +where module is the name of the callback module only if the +child process is a supervisor, genserver or genfsm. If the +child process is a gen_event, modules should be :dynamic. +Defaults to a list with the given module;

        • +
        + +

        Restart values

        + +

        The following restart values are supported:

        + +
          +
        • :permanent - the child process is always restarted;

        • +
        • :temporary - the child process is never restarted (not even +when the supervisor's strategy is :rest_for_one or :one_for_all);

        • +
        • :transient - the child process is restarted only if it +terminates abnormally, i.e. with another exit reason than +:normal, :shutdown or { :shutdown, term };

        • +
        + +

        Shutdown values

        + +

        The following shutdown values are supported:

        + +
          +
        • :brutal_kill - the child process is unconditionally terminated +using exit(child, :kill);

        • +
        • :infinity - if the child process is a supervisor, it is a mechanism +to give the subtree enough time to shutdown. It can also be used with +workers with care;

        • +
        • Finally, it can also be any integer meaning that the supervisor tells +the child process to terminate by calling exit(child, :shutdown) and +then waits for an exit signal back. If no exit signal is received within +the specified time (in miliseconds), the child process is unconditionally +terminated using exit(child, :kill);

        • +
        +
        + Source +
        +
        + + + + + +
        + + diff --git a/docs/stable/SyntaxError.html b/docs/stable/SyntaxError.html index 8a9744be0..1ddb24bf4 100644 --- a/docs/stable/SyntaxError.html +++ b/docs/stable/SyntaxError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -62,85 +62,10 @@

        Fields (and defaults)

        Functions summary

        @@ -153,101 +78,11 @@

        Functions summary

        Functions

        -

        - description(record) -

        -
        - Source -
        -

        - description(value, record) -

        -
        - Source -
        -

        - exception(args) -

        -
        - Source -
        -

        - exception(args, self) -

        -
        - Source -
        -

        - file(record) -

        -
        - Source -
        -

        - file(value, record) -

        -
        - Source -
        -

        - line(record) -

        -
        - Source -
        -

        - line(value, record) -

        -
        - Source -

        message(exception)

        - Source -
        -

        - new() -

        -
        - Source -
        -

        - new(opts) -

        -
        - Source -
        -

        - to_keywords(record) -

        -
        - Source -
        -

        - update(keywords, record) -

        -
        - Source -
        -

        - update_description(function, record) -

        -
        - Source -
        -

        - update_file(function, record) -

        -
        - Source -
        -

        - update_line(function, record) -

        -
        - Source + Source
        diff --git a/docs/stable/System.NoAccessCwdError.html b/docs/stable/System.NoAccessCwdError.html new file mode 100644 index 000000000..ab34d3aeb --- /dev/null +++ b/docs/stable/System.NoAccessCwdError.html @@ -0,0 +1,62 @@ + + + + System.NoAccessCwdError + + + + + + + + + + + + +
        +

        + System.NoAccessCwdError + + exception + +

        + + + + Source + + + + +

        Fields (and defaults)

        +
          + +
        • + + message: "could not get a current working directory, the current location is not accessible" + +
        • + +
        + + + + + + + + + + + + + +
        + + diff --git a/docs/stable/Binary.Inspect.Any.html b/docs/stable/System.NoHomeError.html similarity index 61% rename from docs/stable/Binary.Inspect.Any.html rename to docs/stable/System.NoHomeError.html index 0ad69e6df..aa0db634d 100644 --- a/docs/stable/Binary.Inspect.Any.html +++ b/docs/stable/System.NoHomeError.html @@ -1,7 +1,7 @@ - Binary.Inspect.Any + System.NoHomeError @@ -21,29 +21,29 @@

        - Binary.Inspect.Any + System.NoHomeError - impl + exception

        -
        -

        For all other terms not implemented, we use the default -Erlang representation.

        -

        Examples

        + Source -
        inspect Process.self #=> "<0.35.0>"
        -
        - -
        - Source - - +

        Fields (and defaults)

        +
          + +
        • + + message: "could not find the user home, please set the HOME environment variable" + +
        • + +
        diff --git a/docs/stable/System.NoTmpDirError.html b/docs/stable/System.NoTmpDirError.html new file mode 100644 index 000000000..8acb2f144 --- /dev/null +++ b/docs/stable/System.NoTmpDirError.html @@ -0,0 +1,62 @@ + + + + System.NoTmpDirError + + + + + + + + + + + + +
        +

        + System.NoTmpDirError + + exception + +

        + + + + Source + + + + +

        Fields (and defaults)

        +
          + +
        • + + message: "could not get a writable temporary directory, please set the TMPDIR environment variable" + +
        • + +
        + + + + + + + + + + + + + +
        + + diff --git a/docs/stable/System.html b/docs/stable/System.html index f49f4b6b3..27a8cd615 100644 --- a/docs/stable/System.html +++ b/docs/stable/System.html @@ -63,6 +63,16 @@

        Functions summary

        cmd/1 +
      • + + cwd/0 + +
      • +
      • + + cwd!/0 + +
      • find_executable/1 @@ -103,6 +113,26 @@

        Functions summary

        stacktrace/0
      • +
      • + + tmp_dir/0 + +
      • +
      • + + tmp_dir!/0 + +
      • +
      • + + user_home/0 + +
      • +
      • + + user_home!/0 + +
      • version/0 @@ -125,26 +155,26 @@

        Functions

        Returns the list of command-line arguments passed to the program.

        - Source + Source
      • at_exit(fun)

        Registers a function that will be invoked at the end of program execution. Useful for -invoking a hook on scripted mode.

        +invoking a hook in a "script" mode.

        The function must expect the exit status code as argument.

        - Source + Source

        build_info()

        Returns a keywords list with version, git tag info and date.

        - Source + Source

        cmd(command) @@ -156,7 +186,22 @@

        Functions

        If command is a char list, a char list is returned. Returns a binary otherwise.

        - Source + Source +
        +

        + cwd() +

        +

        Returns the current working directory or nil if one +is not available.

        +
        + Source +
        +

        + cwd!() +

        +

        Returns the current working directory or raises System.NoAccessCwdError.

        +
        + Source

        find_executable(command) @@ -168,7 +213,7 @@

        Functions

        If command is a char list, a char list is returned. Returns a binary otherwise.

        - Source + Source

        get_env() @@ -177,7 +222,7 @@

        Functions

        given as a single string of the format "VarName=Value", where VarName is the name of the variable and Value its value.

        - Source + Source

        get_env(varname) @@ -186,7 +231,7 @@

        Functions

        varname as a binary, or nil if the environment variable is undefined.

        - Source + Source

        get_pid() @@ -196,7 +241,7 @@

        Functions

        See http://www.erlang.org/doc/man/os.html#getpid-0 for more info.

        - Source + Source

        halt(status // 0, options // []) @@ -230,7 +275,7 @@

        Examples

        System.halt(:abort)
        - Source + Source

        put_env(dict) @@ -238,28 +283,74 @@

        Examples

        Sets a new value for each environment variable corresponding to each key in dict.

        - Source + Source

        put_env(varname, value)

        Sets a new value for the environment variable varname.

        - Source + Source

        stacktrace()

        -

        Get the stacktrace.

        +

        Gets Elixir's stacktrace.

        + +

        Notice the Erlang VM (and therefore this function) does not +return the current stacktrace but rather the stacktrace of the +latest exception.

        - Source + Source +
        +

        + tmp_dir() +

        +

        Returns a writable temporary directory. +It searches for directories in the following order:

        + +
          +
        1. The directory named by the TMPDIR environment variable
        2. +
        3. The directory named by the TEMP environment variable
        4. +
        5. The directory named by the TMP environment variable
        6. +
        7. C:\TMP on Windows or /tmp on Unix
        8. +
        9. As a last resort, the current working directory
        10. +
        + +

        Returns nil if none of the above are writable.

        +
        + Source +
        +

        + tmp_dir!() +

        +

        Same as tmp_dir but raises System.NoTmpDirError +instead of returning nil if no temp dir is set.

        +
        + Source +
        +

        + user_home() +

        +

        Returns the user home (platform independent). +It returns nil if no user home is set.

        +
        + Source +
        +

        + user_home!() +

        +

        Same as user_home but raises System.NoHomeError +instead of returning nil if no user home is set.

        +
        + Source

        version()

        Returns Elixir's version as binary.

        - Source + Source
        diff --git a/docs/stable/SystemLimitError.html b/docs/stable/SystemLimitError.html index 6f73b2fee..7265a4da8 100644 --- a/docs/stable/SystemLimitError.html +++ b/docs/stable/SystemLimitError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -47,55 +47,7 @@

        Fields (and defaults)

        -

        Functions summary

        - @@ -103,67 +55,6 @@

        Functions summary

        -
        -

        Functions

        -
        -

        - exception(args) -

        -
        - Source -
        -

        - exception(args, self) -

        -
        - Source -
        -

        - message(record) -

        -
        - Source -
        -

        - message(value, record) -

        -
        - Source -
        -

        - new() -

        -
        - Source -
        -

        - new(opts) -

        -
        - Source -
        -

        - to_keywords(record) -

        -
        - Source -
        -

        - update(keywords, record) -

        -
        - Source -
        -

        - update_message(function, record) -

        -
        - Source -
        -
        - - - diff --git a/docs/stable/TokenMissingError.html b/docs/stable/TokenMissingError.html index 1e1b88e74..3c0a39bcd 100644 --- a/docs/stable/TokenMissingError.html +++ b/docs/stable/TokenMissingError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -62,85 +62,10 @@

        Fields (and defaults)

        Functions summary

        @@ -153,101 +78,11 @@

        Functions summary

        Functions

        -

        - description(record) -

        -
        - Source -
        -

        - description(value, record) -

        -
        - Source -
        -

        - exception(args) -

        -
        - Source -
        -

        - exception(args, self) -

        -
        - Source -
        -

        - file(record) -

        -
        - Source -
        -

        - file(value, record) -

        -
        - Source -
        -

        - line(record) -

        -
        - Source -
        -

        - line(value, record) -

        -
        - Source -

        message(exception)

        - Source -
        -

        - new() -

        -
        - Source -
        -

        - new(opts) -

        -
        - Source -
        -

        - to_keywords(record) -

        -
        - Source -
        -

        - update(keywords, record) -

        -
        - Source -
        -

        - update_description(function, record) -

        -
        - Source -
        -

        - update_file(function, record) -

        -
        - Source -
        -

        - update_line(function, record) -

        -
        - Source + Source
        diff --git a/docs/stable/URI.html b/docs/stable/URI.html index e985b8fd2..53d8f633b 100644 --- a/docs/stable/URI.html +++ b/docs/stable/URI.html @@ -91,7 +91,7 @@

        Functions

        Source

        - decode_query(q, dict // OrdDict.new()) + decode_query(q, dict // HashDict.new())

        Given a query string of the form "key1=value1&key=value2...", produces an orddict with one entry for each key-value pair. Each key and value will be a diff --git a/docs/stable/UndefinedFunctionError.html b/docs/stable/UndefinedFunctionError.html index 27b0d3a09..04665acbc 100644 --- a/docs/stable/UndefinedFunctionError.html +++ b/docs/stable/UndefinedFunctionError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -62,85 +62,10 @@

        Fields (and defaults)

        Functions summary

        @@ -153,101 +78,11 @@

        Functions summary

        Functions

        -

        - arity(record) -

        -
        - Source -
        -

        - arity(value, record) -

        -
        - Source -
        -

        - exception(args) -

        -
        - Source -
        -

        - exception(args, self) -

        -
        - Source -
        -

        - function(record) -

        -
        - Source -
        -

        - function(value, record) -

        -
        - Source -

        message(exception)

        - Source -
        -

        - module(record) -

        -
        - Source -
        -

        - module(value, record) -

        -
        - Source -
        -

        - new() -

        -
        - Source -
        -

        - new(opts) -

        -
        - Source -
        -

        - to_keywords(record) -

        -
        - Source -
        -

        - update(keywords, record) -

        -
        - Source -
        -

        - update_arity(function, record) -

        -
        - Source -
        -

        - update_function(function, record) -

        -
        - Source -
        -

        - update_module(function, record) -

        -
        - Source + Source
        diff --git a/docs/stable/js/full_list.js b/docs/stable/js/full_list.js index 8fc7e0bc7..2e4016283 100644 --- a/docs/stable/js/full_list.js +++ b/docs/stable/js/full_list.js @@ -20,7 +20,7 @@ function fullListSearch() { var fullName = link.attr('title').split(' ')[0]; searchCache.push({name:link.text(), fullName:fullName, node:$(this), link:link}); }); - + $('#search input').keyup(function(evnt) { if ((evnt.keyCode > ignoreKeyCodeMin && evnt.keyCode < ignoreKeyCodeMax) || evnt.keyCode == commandKey) @@ -35,7 +35,7 @@ function fullListSearch() { $('#full_list, #content').removeClass('insearch'); $('#full_list li').removeClass('found').each(function() { var link = $(this).find('.object_link a'); - link.text(link.text()); + link.text(link.text()); }); if (clicked) { clicked.parents('ul').each(function() { @@ -53,7 +53,7 @@ function fullListSearch() { searchItem(); } }); - + $('#search input').focus(); $('#full_list').after("
        "); } @@ -127,10 +127,10 @@ function linkList() { function collapse() { if (!$('#full_list').hasClass('class')) return; - $('#full_list.class a.toggle').click(function() { + $('#full_list.class a.toggle').click(function() { $(this).parent().toggleClass('collapsed').next().toggleClass('collapsed'); highlight(); - return false; + return false; }); $('#full_list.class ul').each(function() { $(this).addClass('collapsed').prev().addClass('collapsed'); diff --git a/docs/stable/modules_list.html b/docs/stable/modules_list.html index d901501c6..fc68c6a5f 100644 --- a/docs/stable/modules_list.html +++ b/docs/stable/modules_list.html @@ -16,7 +16,7 @@

        - Elixir v0.7.2 + Elixir v0.8.0

      +
    2922. + + + Tasks.Compile.Erlang + + Mix.Tasks.Compile.Erlang +
    2923. +
        + + +
      • + + run/1 + + Mix.Tasks.Compile.Erlang +
      • +
    2924. @@ -4623,24 +4796,6 @@

      Mix.Tasks.Help

    2925. - -
    2926. - - - Tasks.Iex - - Mix.Tasks.Iex -
    2927. -
        - - -
      • - - run/1 - - Mix.Tasks.Iex -
      • -
    2928. @@ -4822,49 +4977,49 @@

    2929. - module_name_to_command/2 + mix_home/0 Mix.Utils
    2930. - preserving_mtime/2 + module_name_to_command/2 Mix.Utils
    2931. - relative_to_cwd/1 + preserving_mtime/2 Mix.Utils
    2932. - source/1 + relative_to_cwd/1 Mix.Utils
    2933. - stale?/2 + source/1 Mix.Utils
    2934. - underscore/1 + stale?/2 Mix.Utils
    2935. - user_home/0 + underscore/1 Mix.Utils
    2936. @@ -4916,7 +5071,7 @@

    2937. - start/0 + stop/1 Mix
    2938. @@ -5231,6 +5386,136 @@

      OrdDict

    2939. + +
    2940. + + + Path + + Path +
    2941. +
    2942. @@ -5553,7 +5838,7 @@

    2943. - deffunctions/3 + deffunctions/2 Record
    2944. @@ -5581,7 +5866,7 @@

    2945. - deftypes/4 + deftypes/3 Record
    2946. @@ -5713,6 +5998,13 @@

      String

    2947. +
    2948. + + capitalize/1 + + String +
    2949. +
    2950. codepoints/1 @@ -5818,6 +6110,13 @@

      String

    2951. +
    2952. + + slice/3 + + String +
    2953. +
    2954. split/3 @@ -5846,6 +6145,45 @@

      String

    2955. +
    2956. + + valid_codepoint?/1 + + String +
    2957. + + +
    2958. + + + Supervisor.Behaviour + + Supervisor.Behaviour +
    2959. +
    2960. @@ -5885,6 +6223,20 @@

      System

    2961. +
    2962. + + cwd/0 + + System +
    2963. + +
    2964. + + cwd!/0 + + System +
    2965. +
    2966. find_executable/1 @@ -5943,21 +6295,38 @@

    2967. - version/0 + tmp_dir/0 System
    2968. - -
    2969. - - - Tuple - - Tuple -
    2970. -
    2971. diff --git a/docs/stable/protocols_list.html b/docs/stable/protocols_list.html index d2327c78a..6e20e63b2 100644 --- a/docs/stable/protocols_list.html +++ b/docs/stable/protocols_list.html @@ -16,7 +16,7 @@

      - Elixir v0.7.2 + Elixir v0.8.0

      diff --git a/docs/master/BadFunctionError.html b/docs/master/BadFunctionError.html index d52162522..f797d80fc 100644 --- a/docs/master/BadFunctionError.html +++ b/docs/master/BadFunctionError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -70,7 +70,7 @@

      Functions

      message(exception)

      - Source + Source diff --git a/docs/master/Binary.Dict.html b/docs/master/Binary.Dict.html deleted file mode 100644 index 2a71f9abf..000000000 --- a/docs/master/Binary.Dict.html +++ /dev/null @@ -1,117 +0,0 @@ - - - - Binary.Dict - - - - - - - - - - - - -
      -

      - Binary.Dict - -

      - - -
      -

      This module implements a dictionary that forces the keys to be -converted to binaries on insertion. Currently it is implemented -using an OrdDict, but this may change in the future.

      - -

      Check the Dict module for examples and documentation.

      - -
      - - - Source - - - - - - -

      Functions summary

      - - - - - - - - -
      -

      Functions

      -
      -

      - new() -

      -

      Creates a new empty dict.

      -
      - Source -
      -

      - new(pairs) -

      -

      Creates a new dict from a list of pairs.

      - -

      Examples

      - -
      Binary.Dict.new [{:b,1},{:a,2}]
      -#=> [a: 1, b: 2]
      -
      -
      - Source -
      -

      - new(list, transform) -

      -

      Creates a new dict from a list of elements with the -help of the transformation function.

      - -

      Examples

      - -
      Binary.Dict.new ["a", "b"], fn x -> {x, x} end
      -#=> ["a": "a", "b": "b"]
      -
      -
      - Source -
      -
      - - - - - -
      - - diff --git a/docs/master/Binary.Inspect.Function.html b/docs/master/Binary.Inspect.Function.html index 7abed6af3..594a95d4d 100644 --- a/docs/master/Binary.Inspect.Function.html +++ b/docs/master/Binary.Inspect.Function.html @@ -34,7 +34,7 @@

      - Source + Source @@ -64,7 +64,7 @@

      Functions

      inspect(function, _opts)

      - Source + Source diff --git a/docs/master/Binary.Inspect.HashDict.html b/docs/master/Binary.Inspect.HashDict.html index 05a0523ec..8310a21b1 100644 --- a/docs/master/Binary.Inspect.HashDict.html +++ b/docs/master/Binary.Inspect.HashDict.html @@ -29,7 +29,7 @@

      - Source + Source @@ -59,7 +59,7 @@

      Functions

      inspect(dict, opts)

      - Source + Source diff --git a/docs/master/Binary.Inspect.Number.html b/docs/master/Binary.Inspect.Number.html index 19ba12507..71c96d6f9 100644 --- a/docs/master/Binary.Inspect.Number.html +++ b/docs/master/Binary.Inspect.Number.html @@ -39,7 +39,7 @@

      Examples

      - Source + Source @@ -69,7 +69,7 @@

      Functions

      inspect(thing, _)

      - Source + Source diff --git a/docs/master/Binary.Inspect.PID.html b/docs/master/Binary.Inspect.PID.html index 014f2b907..523c5e439 100644 --- a/docs/master/Binary.Inspect.PID.html +++ b/docs/master/Binary.Inspect.PID.html @@ -34,7 +34,7 @@

      - Source + Source @@ -64,7 +64,7 @@

      Functions

      inspect(pid, _)

      - Source + Source diff --git a/docs/master/Binary.Inspect.Port.html b/docs/master/Binary.Inspect.Port.html index 704f6c138..8aafdc3d8 100644 --- a/docs/master/Binary.Inspect.Port.html +++ b/docs/master/Binary.Inspect.Port.html @@ -34,7 +34,7 @@

      - Source + Source @@ -64,7 +64,7 @@

      Functions

      inspect(port, _)

      - Source + Source diff --git a/docs/master/Binary.Inspect.Reference.html b/docs/master/Binary.Inspect.Reference.html index 75e428bc4..68be56e93 100644 --- a/docs/master/Binary.Inspect.Reference.html +++ b/docs/master/Binary.Inspect.Reference.html @@ -34,7 +34,7 @@

      - Source + Source @@ -64,7 +64,7 @@

      Functions

      inspect(ref, _)

      - Source + Source diff --git a/docs/master/Binary.Inspect.Regex.html b/docs/master/Binary.Inspect.Regex.html index f25b1e48d..78be58370 100644 --- a/docs/master/Binary.Inspect.Regex.html +++ b/docs/master/Binary.Inspect.Regex.html @@ -39,7 +39,7 @@

      Examples

      - Source + Source @@ -69,7 +69,7 @@

      Functions

      inspect(regex, opts)

      - Source + Source diff --git a/docs/master/Binary.Inspect.Tuple.html b/docs/master/Binary.Inspect.Tuple.html index 5d007c6e8..871a750c5 100644 --- a/docs/master/Binary.Inspect.Tuple.html +++ b/docs/master/Binary.Inspect.Tuple.html @@ -41,7 +41,7 @@

      Examples

      - Source + Source @@ -71,7 +71,7 @@

      Functions

      inspect(tuple, opts)

      - Source + Source diff --git a/docs/master/CaseClauseError.html b/docs/master/CaseClauseError.html index 5e01b7caf..baf5b128a 100644 --- a/docs/master/CaseClauseError.html +++ b/docs/master/CaseClauseError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -70,7 +70,7 @@

      Functions

      message(exception)

      - Source + Source diff --git a/docs/master/CompileError.html b/docs/master/CompileError.html index d8af90bc2..4adb8976b 100644 --- a/docs/master/CompileError.html +++ b/docs/master/CompileError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -82,7 +82,7 @@

      Functions

      message(exception)

      - Source + Source diff --git a/docs/master/Enum.Iterator.Binary.Dict.html b/docs/master/Enum.Iterator.Binary.Dict.html deleted file mode 100644 index 3aac32d21..000000000 --- a/docs/master/Enum.Iterator.Binary.Dict.html +++ /dev/null @@ -1,83 +0,0 @@ - - - - Enum.Iterator.Binary.Dict - - - - - - - - - - - - -
      -

      - Enum.Iterator.Binary.Dict - - impl - -

      - - - - Source - - - - - - -

      Functions summary

      - - - - - - - - -
      -

      Functions

      -
      -

      - count(arg1) -

      -
      - Source -
      -

      - iterator(arg1) -

      -
      - Source -
      -
      - - - - - -
      - - diff --git a/docs/master/Enum.Iterator.HashDict.html b/docs/master/Enum.Iterator.HashDict.html index 8b507ebd6..151f5e591 100644 --- a/docs/master/Enum.Iterator.HashDict.html +++ b/docs/master/Enum.Iterator.HashDict.html @@ -29,7 +29,7 @@

      - Source + Source @@ -64,13 +64,13 @@

      Functions

      count(dict)

      - Source + Source

      iterator(dict)

      - Source + Source
      diff --git a/docs/master/Enum.Iterator.Orddict.html b/docs/master/Enum.Iterator.Orddict.html deleted file mode 100644 index 59ee6956c..000000000 --- a/docs/master/Enum.Iterator.Orddict.html +++ /dev/null @@ -1,83 +0,0 @@ - - - - Enum.Iterator.OrdDict - - - - - - - - - - - - -
      -

      - Enum.Iterator.OrdDict - - impl - -

      - - - - Source - - - - - - -

      Functions summary

      - - - - - - - - -
      -

      Functions

      -
      -

      - count(arg1) -

      -
      - Source -
      -

      - iterator(arg1) -

      -
      - Source -
      -
      - - - - - -
      - - diff --git a/docs/master/Enum.Iterator.html b/docs/master/Enum.Iterator.html index 4847353f7..3e480e06d 100644 --- a/docs/master/Enum.Iterator.html +++ b/docs/master/Enum.Iterator.html @@ -51,12 +51,6 @@

      Implementations

        -
      • - - Binary.Dict - -
      • -
      • Function @@ -75,12 +69,6 @@

        Implementations

      • -
      • - - OrdDict - -
      • -
      • Range diff --git a/docs/master/Enum.OutOfBoundsError.html b/docs/master/Enum.OutOfBoundsError.html index c5e344942..2e3de19ca 100644 --- a/docs/master/Enum.OutOfBoundsError.html +++ b/docs/master/Enum.OutOfBoundsError.html @@ -29,7 +29,7 @@

        - Source + Source diff --git a/docs/master/ErlangError.html b/docs/master/ErlangError.html index c68f65886..aa5f9bbad 100644 --- a/docs/master/ErlangError.html +++ b/docs/master/ErlangError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -70,7 +70,7 @@

        Functions

        message(exception)

        - Source + Source diff --git a/docs/master/ExUnit.Callbacks.html b/docs/master/ExUnit.Callbacks.html new file mode 100644 index 000000000..3e645f943 --- /dev/null +++ b/docs/master/ExUnit.Callbacks.html @@ -0,0 +1,149 @@ + + + + ExUnit.Callbacks + + + + + + + + + + + + +
        +

        + ExUnit.Callbacks + +

        + + +
        +

        This module defines four callbacks: setup_all, teardown_all, +setup and teardown. Those callbacks are defined via macros +and receives a keyword list of metadata. The callback may +optionally define extra data which will be available in the test +cases.

        + +

        Examples

        + +
        defmodule AssertionTest do
        +  use ExUnit.Case, async: true
        +
        +  setup do
        +    IO.puts "This is a setup callback"
        +
        +    # Returns extra metadata
        +    { :ok, [hello: "world"] }
        +  end
        +
        +  setup context do
        +    # We can access the test name in the context
        +    IO.puts "Setting up: #{context[:test]}"
        +
        +    # The metadata returned by the previous setup as well
        +    assert context[:hello] == "world"
        +
        +    # No metadata
        +    :ok
        +  end
        +
        +  test "always pass" do
        +    assert true
        +  end
        +end
        +
        + +
        + + + Source + + + + + + + + +

        Macros summary

        + + + + + + + + +
        +

        Macros

        +
        +

        + setup(var // quote() do + _ +end, block) +

        +
        + Source +
        +

        + setup_all(var // quote() do + _ +end, block) +

        +
        + Source +
        +

        + teardown(var // quote() do + _ +end, block) +

        +
        + Source +
        +

        + teardown_all(var // quote() do + _ +end, block) +

        +
        + Source +
        +
        + + + +
        + + diff --git a/docs/master/ExUnit.Case.html b/docs/master/ExUnit.Case.html index 3a1845126..55b9af469 100644 --- a/docs/master/ExUnit.Case.html +++ b/docs/master/ExUnit.Case.html @@ -38,36 +38,21 @@

        when your test cases do not change any global state;

      -

      Callbacks

      - -

      ExUnit.Case defines four callbacks:

      - -
        -
      • setup_all() and teardown_all(context) which are executed -before and after all tests respectively;
      • -
      • setup(context, test) and teardown(context, test) which are -executed before and after each test, receiving the test name -as argument;
      • -
      - -

      Such callbacks are useful to clean up any side-effect a test may cause, -as for example, state in genservers, data on filesystem, or entries in -a database. Data can be passed in between such callbacks as context, -the context value returned by setup_all is passed down to all other -callbacks. The value can then be updated in setup which is passed -down to teardown.

      +

      This module automatically includes all callbacks defined +in ExUnit.Callbacks. Read it for more information.

      Examples

      -
      defmodule AssertionTest do
      -  use ExUnit.Case, async: true
      +

      defmodule AssertionTest do + use ExUnit.Case, async: true

      - def test_always_pass - assert true - end -end +
       def test_always_pass
      +   assert true
      + end
       
      +

      end

      + @@ -84,7 +69,7 @@

      Macros summary

      • - test/2 + test/3
      • @@ -99,8 +84,10 @@

        Macros summary

        Macros

        -

        - test(message, contents) +

        + test(message, var // quote() do + _ +end, contents)

        Provides a convenient macro that allows a test to be defined with a string. This macro automatically inserts @@ -116,7 +103,7 @@

        Examples

        end
      - Source + Source diff --git a/docs/master/ExUnit.CaseTemplate.html b/docs/master/ExUnit.CaseTemplate.html new file mode 100644 index 000000000..411a3a62d --- /dev/null +++ b/docs/master/ExUnit.CaseTemplate.html @@ -0,0 +1,104 @@ + + + + ExUnit.CaseTemplate + + + + + + + + + + + + +
      +

      + ExUnit.CaseTemplate + +

      + + +
      +

      This module allows a developer to define a test case +template to be used throughout his tests. This is useful +when there are a set of functions that should be shared +between tests or a set of setup/teardown callbacks.

      + +

      By using this module, the callbacks and assertions +available for regular test cases will also be available.

      + +

      Example

      + +
      defmodule MyCase do
      +  use ExUnit.CaseTemplate
      +
      +  setup do
      +    IO.puts "This will run before each test that uses this case"
      +  end
      +end
      +
      +defmodule MyTest do
      +  use MyCase, async: true
      +
      +  test "truth" do
      +    assert true
      +  end
      +end
      +
      + +
      + + + Source + + + + + + + + +

      Macros summary

      + + + + + + + + +
      +

      Macros

      +
      +

      + using(var // quote() do + _ +end, list2) +

      +

      Allows a developer to code to be invoked when +this module is used.

      +
      + Source +
      +
      + + + +
      + + diff --git a/docs/master/ExUnit.html b/docs/master/ExUnit.html index 662c10e92..ebaadefef 100644 --- a/docs/master/ExUnit.html +++ b/docs/master/ExUnit.html @@ -40,11 +40,13 @@

      Example

      # 2) Next we create a new TestCase and use ExUnit.Case defmodule AssertionTest do - # 3) Notice we pass async: true, this runs the test case in parallel + # 3) Notice we pass async: true, this runs the test case + # concurrently with other test cases use ExUnit.Case, async: true - # 4) A test is a method which name finishes with _test - def test_always_pass do + # 4) A test is a function whose name starts with + # test and receives a context + def test_always_pass(_) do assert true end @@ -62,9 +64,13 @@

      Example

      bin/elixir assertion_test.exs
       
      -

      Assertions

      +

      Case, callbacks and assertions

      -

      Check ExUnit.Assertions for assertions documentation.

      +

      Check ExUnit.Case and ExUnit.Callbacks for more information about +defining test cases.

      + +

      The ExUnit.Assertions module contains a set of macros to easily +generate assertions with appropriate error messages.

      User config

      @@ -99,11 +105,6 @@

      User config

      Functions summary

      • - - after_spawn/1 - -
      • -
      • configure/1 @@ -140,14 +141,6 @@

        Functions summary

        Functions

        -

        - after_spawn(callback) -

        -

        Registers a callback to be invoked every time a -new ExUnit process is spawned.

        -
        - Source -

        configure(options)

        @@ -164,7 +157,7 @@

        Options

        Defaults to :erlang.system_info(:schedulers_online);

      - Source + Source

      run() @@ -174,7 +167,7 @@

      Options

      Returns the number of failures.

      - Source + Source

      start(options // []) @@ -186,7 +179,7 @@

      Options

      In case you want to run tests manually, skip calling this function and rely on configure/1 and run/0 instead.

      - Source + Source

      stop(_state) @@ -199,7 +192,7 @@

      Options

      Returns the configured user options.

      - Source + Source
      diff --git a/docs/master/Exception.html b/docs/master/Exception.html index 2d3e5066e..7c650f79d 100644 --- a/docs/master/Exception.html +++ b/docs/master/Exception.html @@ -92,7 +92,7 @@

      Functions

      format_file_line(file, line, cwd)

      - Source + Source

      format_stacktrace(trace // nil) @@ -123,7 +123,7 @@

      Functions

      calculates the current stacktrace and formats it. As consequence, the value of System.stacktrace is changed.

      - Source + Source diff --git a/docs/master/File.html b/docs/master/File.html index 9840a74ec..d921f1233 100644 --- a/docs/master/File.html +++ b/docs/master/File.html @@ -35,7 +35,7 @@

      In order to write and read files, one must use the functions in the IO module. By default, a file is -opened on binary mode which requires the functions +opened in binary mode which requires the functions IO.binread, IO.binwrite and IO.binreadline to interact with the file. A developer may pass :utf8 as an option when opening the file and then all other @@ -330,7 +330,7 @@

      Functions

      be passed into Enum to iterate line by line as a binary. Check iterator/1 for more information.

      - Source + Source

      biniterator(file, mode) @@ -339,7 +339,7 @@

      Functions

      returns its biniterator. Fails for the same reasons as File.open.

      - Source + Source

      biniterator!(file, mode // []) @@ -347,7 +347,7 @@

      Functions

      Same as biniterator/2 but raises if the file cannot be opened.

      - Source + Source

      cd(path) @@ -355,14 +355,14 @@

      Functions

      Sets the current working directory. Returns :ok if successful, { :error, reason } otherwise.

      - Source + Source

      cd!(path)

      The same as cd/0, but raises an exception if it fails.

      - Source + Source

      cd!(path, function) @@ -374,7 +374,7 @@

      Functions

      Raises an error if retrieving or changing the current directory fails.

      - Source + Source

      close(io_device) @@ -386,7 +386,7 @@

      Functions

      close/1 might return an old write error and not even try to close the file. See open/2.

      - Source + Source

      copy(source, destination, bytes_count // :infinity) @@ -405,7 +405,7 @@

      Functions

      Typical error reasons are the same as in open/2, read/1 and write/2.

      - Source + Source

      copy!(source, destination, bytes_count // :infinity) @@ -413,7 +413,7 @@

      Functions

      The same as copy/3 but raises an File.CopyError if it fails. Returns the bytes_copied otherwise.

      - Source + Source

      cp(source, destination, callback // fn _, _ -> true end) @@ -436,7 +436,7 @@

      Functions

      It returns :ok in case of success, returns { :error, reason } otherwise.

      - Source + Source

      cp!(source, destination, callback // fn _, _ -> true end) @@ -444,7 +444,7 @@

      Functions

      The same as cp/3, but raises File.CopyError if it fails. Returns the list of copied files otherwise.

      - Source + Source

      cp_r(source, destination, callback // fn _, _ -> true end) @@ -494,7 +494,7 @@

      Examples

      end
      - Source + Source

      cp_r!(source, destination, callback // fn _, _ -> true end) @@ -502,7 +502,7 @@

      Examples

      The same as cp_r/3, but raises File.CopyError if it fails. Returns the list of copied files otherwise.

      - Source + Source

      cwd() @@ -512,21 +512,21 @@

      Examples

      directories of the current directory. For this reason, returns { :ok, cwd } in case of success, { :error, reason } otherwise.

      - Source + Source

      cwd!()

      The same as cwd/0, but raises an exception if it fails.

      - Source + Source

      dir?(path)

      Returns true if the path is a directory.

      - Source + Source

      exists?(path) @@ -547,7 +547,7 @@

      Examples

      #=> true
      - Source + Source

      iterator(device) @@ -573,7 +573,7 @@

      Examples

      end
      - Source + Source

      iterator(file, mode) @@ -582,7 +582,7 @@

      Examples

      returns its iterator. Fails for the same reasons as File.open.

      - Source + Source

      iterator!(file, mode // []) @@ -590,7 +590,7 @@

      Examples

      Same as iterator/2 but raises if the file cannot be opened.

      - Source + Source

      mkdir(path) @@ -609,14 +609,14 @@

      Examples

      On some platforms, :enoent is returned instead.
    2972. - Source + Source

      mkdir!(path)

      Same as mkdir, but raises an exception in case of failure. Otherwise :ok.

      - Source + Source

      mkdir_p(path) @@ -632,21 +632,27 @@

      Examples

    2973. :enotdir - A component of path is not a directory.
    2974. - Source + Source

      mkdir_p!(path)

      Same as mkdir_p, but raises an exception in case of failure. Otherwise :ok.

      - Source + Source

      open(path, modes // [])

      Opens the given path according to the given list of modes.

      -

      By default, the file is opened in read mode, as a binary with utf8 encoding.

      +

      In order to write and read files, one must use the functions +in the IO module. By default, a file is opened in binary mode +which requires the functions IO.binread, IO.binwrite and +IO.binreadline to interact with the file. A developer may pass +:utf8 as an option when opening the file and then all other +functions from IO are available, since they work directly with +Unicode data.

      The allowed modes:

      @@ -694,7 +700,7 @@

      Examples

      File.close(file)
      - Source + Source

      open(path, modes, function) @@ -719,7 +725,7 @@

      Examples

      end)
      - Source + Source

      open!(path, modes // []) @@ -727,7 +733,7 @@

      Examples

      Same as open/2 but raises an error if file could not be opened. Returns the io_device otherwise.

      - Source + Source

      open!(path, modes, function) @@ -735,7 +741,7 @@

      Examples

      Same as open/3 but raises an error if file could not be opened. Returns the function result otherwise.

      - Source + Source

      read(path) @@ -757,7 +763,7 @@

      Examples

      You can use :file.format_error(reason) to get a descriptive string of the error.

      - Source + Source

      read!(path) @@ -765,7 +771,7 @@

      Examples

      Returns binary with the contents of the given filename or raises File.Error if an error occurs.

      - Source + Source

      regular?(path) @@ -777,7 +783,7 @@

      Examples

      File.regular? __FILE__ #=> true
       
      - Source + Source

      rm(path) @@ -805,14 +811,14 @@

      Examples

      #=> {:error, :eperm}
      - Source + Source

      rm!(path)

      Same as rm, but raises an exception in case of failure. Otherwise :ok.

      - Source + Source

      rm_rf(path) @@ -834,7 +840,7 @@

      Examples

      #=> { :ok, [] }
      - Source + Source

      rm_rf!(path) @@ -842,7 +848,7 @@

      Examples

      Same as rm_rf/1 but raises File.Error in case of failures, otherwise the list of files or directories removed.

      - Source + Source

      rmdir(path) @@ -859,14 +865,14 @@

      Examples

      #=> {:error, :enotdir}
      - Source + Source

      rmdir!(path)

      Same as rmdir/1, but raises an exception in case of failure. Otherwise :ok.

      - Source + Source

      stat(path, opts // []) @@ -885,7 +891,7 @@

      Options

      Default is local.

    2975. - Source + Source

      stat!(path, opts // []) @@ -893,7 +899,7 @@

      Options

      Same as stat but returns the File.Stat directly and throws File.Error if an error is returned.

      - Source + Source

      touch(path, time // :calendar.local_time()) @@ -901,7 +907,7 @@

      Options

      Updates modification time (mtime) and access time (atime) of the given file. File is created if it doesn’t exist.

      - Source + Source

      touch!(path, time // :calendar.local_time()) @@ -909,7 +915,7 @@

      Options

      Same as touch/1 but raises an exception if it fails. Returns :ok otherwise.

      - Source + Source

      write(path, content, modes // []) @@ -929,14 +935,14 @@

      Options

    2976. :eisdir - The named file is a directory.
    2977. - Source + Source

      write!(path, content, modes // [])

      Same as write/3 but raises an exception if it fails, returns :ok otherwise.

      - Source + Source

      write_stat(path, stat, opts // []) @@ -944,7 +950,7 @@

      Options

      Writes the given File.Stat back to the filesystem at the given path. Returns :ok or { :error, reason }.

      - Source + Source

      write_stat!(path, stat, opts // []) @@ -952,7 +958,7 @@

      Options

      Same as write_stat/3 but raises an exception if it fails. Returns :ok otherwise.

      - Source + Source
      diff --git a/docs/master/FunctionClauseError.html b/docs/master/FunctionClauseError.html index 7125199dd..32cd76236 100644 --- a/docs/master/FunctionClauseError.html +++ b/docs/master/FunctionClauseError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -82,7 +82,7 @@

      Functions

      message(exception)

      - Source + Source diff --git a/docs/master/HashDict.html b/docs/master/HashDict.html index d3adf03d4..50c32bcc3 100644 --- a/docs/master/HashDict.html +++ b/docs/master/HashDict.html @@ -148,21 +148,21 @@

      Functions

      Deletes a value from the dict.

      - Source + Source

      empty(_)

      Returns an empty dict.

      - Source + Source

      get(dict, key, default // nil)

      Gets the value under key from the dict.

      - Source + Source

      get!(dict, key) @@ -170,35 +170,35 @@

      Functions

      Gets the value under key from the dict, raises KeyError if such key does not exist.

      - Source + Source

      has_key?(dict, key)

      Checks if the dict has the given key.

      - Source + Source

      keys(dict)

      Get all keys in the dict.

      - Source + Source

      merge(dict, enum, callback // fn _k, _v1, v2 -> v2 end)

      Merges two dictionaries.

      - Source + Source

      new()

      Creates a new empty dict.

      - Source + Source

      new(pairs) @@ -211,7 +211,7 @@

      Examples

      #=> HashDict[a: 1, b: 2]
      - Source + Source

      new(list, transform) @@ -225,14 +225,14 @@

      Examples

      #=> HashDict[{ "a", "a" }, { "b", "b" }]
      - Source + Source

      put(dict, key, value)

      Puts the given key and value in the dict.

      - Source + Source

      put_new(dict, key, value) @@ -240,21 +240,21 @@

      Examples

      Puts the given value under key in the dictionary only if one does not exist yet.

      - Source + Source

      size(dict)

      Returns the dict size.

      - Source + Source

      to_list(dict)

      Converts the dict to a list.

      - Source + Source

      update(dict, key, fun) @@ -263,7 +263,7 @@

      Examples

      to the given function. Raises if the key does not exist in the dictionary.

      - Source + Source

      update(dict, key, initial, fun) @@ -272,14 +272,14 @@

      Examples

      to the given function. Adds initial value if the key does not exist in the dicionary.

      - Source + Source

      values(dict)

      Get all values in the dict.

      - Source + Source
      diff --git a/docs/master/IO.ANSI.html b/docs/master/IO.ANSI.html new file mode 100644 index 000000000..ccb191541 --- /dev/null +++ b/docs/master/IO.ANSI.html @@ -0,0 +1,719 @@ + + + + IO.ANSI + + + + + + + + + + + + +
      +

      + IO.ANSI + +

      + + +
      +

      This module provides functionality to render ANSI escape sequences +(http://en.wikipedia.org/wiki/ANSI_escape_code) — characters embedded +in the text used to control formatting, color, and other output options +on video text terminals.

      + +

      Please be aware that in Erlang/OTP versions prior to R16, you will not +be able to render ANSI escape sequences in iex or erlang shell

      + +
      + + + Source + + + + + + +

      Functions summary

      + + + + + + + + +
      +

      Functions

      +
      +

      + black() +

      +

      Sets foreground color to black

      +
      + Source +
      +

      + black_background() +

      +

      Sets background color to black

      +
      + Source +
      + +

      Blink: off

      +
      + Source +
      + +

      Blink: Rapid. MS-DOS ANSI.SYS; 150 per minute or more; not widely supported

      +
      + Source +
      + +

      Blink: Slow. Less than 150 per minute

      +
      + Source +
      +

      + blue() +

      +

      Sets foreground color to blue

      +
      + Source +
      +

      + blue_background() +

      +

      Sets background color to blue

      +
      + Source +
      +

      + bright() +

      +

      Bright (increased intensity) or Bold

      +
      + Source +
      +

      + conceal() +

      +

      Conceal. Not widely supported

      +
      + Source +
      +

      + crossed_out() +

      +

      Crossed-out. Characters legible, but marked for deletion. Not widely supported.

      +
      + Source +
      +

      + cyan() +

      +

      Sets foreground color to cyan

      +
      + Source +
      +

      + cyan_background() +

      +

      Sets background color to cyan

      +
      + Source +
      +

      + default_background() +

      +

      Default background color

      +
      + Source +
      +

      + default_color() +

      +

      Default text color

      +
      + Source +
      +

      + encircled() +

      +

      Encircled

      +
      + Source +
      +

      + escape(string, emit // terminal?()) +

      +

      Escapes a string coverting named ANSI sequences into actual ANSI codes.

      + +

      The format for referring sequences is %{red} and %{red,bright} (for +multiple sequences)

      + +

      It will also force a %{reset} to get appended to every string. If you don't +want this behaviour, use escape_fragment/1 and escape_fragment/2.

      + +

      An optional boolean parameter can be passed to enable or disable +emitting actual ANSI codes. When false, no ANSI codes will emitted. +By default, standard output will be checked if it is a terminal capable +of handling these sequences (using terminal?/0 function)

      + +

      Example

      + +

      IO.ANSI.escape "Hello %{red,bright,green}yes" #=> + "Hello \e[31m\e[1m\e[32myes\e[0m"

      +
      + Source +
      +

      + escape_fragment(string, emit // terminal?()) +

      +

      Escapes a string coverting named ANSI sequences into actual ANSI codes.

      + +

      The format for referring sequences is %{red} and %{red,bright} (for +multiple sequences)

      + +

      An optional boolean parameter can be passed to enable or disable +emitting actual ANSI codes. When false, no ANSI codes will emitted. +By default, standard output will be checked if it is a terminal capable +of handling these sequences (using terminal?/0 function)

      + +

      Example

      + +

      IO.ANSI.escape "Hello %{red,bright,green}yes%{reset}" #=> + "Hello \e[31m\e[1m\e[32myes\e[0m"

      +
      + Source +
      +

      + faint() +

      +

      Faint (decreased intensity), not widely supported

      +
      + Source +
      +

      + font_1() +

      +

      Sets alternative font 1

      +
      + Source +
      +

      + font_2() +

      +

      Sets alternative font 2

      +
      + Source +
      +

      + font_3() +

      +

      Sets alternative font 3

      +
      + Source +
      +

      + font_4() +

      +

      Sets alternative font 4

      +
      + Source +
      +

      + font_5() +

      +

      Sets alternative font 5

      +
      + Source +
      +

      + font_6() +

      +

      Sets alternative font 6

      +
      + Source +
      +

      + font_7() +

      +

      Sets alternative font 7

      +
      + Source +
      +

      + font_8() +

      +

      Sets alternative font 8

      +
      + Source +
      +

      + font_9() +

      +

      Sets alternative font 9

      +
      + Source +
      +

      + framed() +

      +

      Framed

      +
      + Source +
      +

      + green() +

      +

      Sets foreground color to green

      +
      + Source +
      +

      + green_background() +

      +

      Sets background color to green

      +
      + Source +
      +

      + inverse() +

      +

      Image: Negative. Swap foreground and background

      +
      + Source +
      +

      + italic() +

      +

      Italic: on. Not widely supported. Sometimes treated as inverse.

      +
      + Source +
      +

      + magenta() +

      +

      Sets foreground color to magenta

      +
      + Source +
      +

      + magenta_background() +

      +

      Sets background color to magenta

      +
      + Source +
      +

      + no_underline() +

      +

      Underline: None

      +
      + Source +
      +

      + normal() +

      +

      Normal color or intensity

      +
      + Source +
      +

      + not_framed_encircled() +

      +

      Not framed or encircled

      +
      + Source +
      +

      + not_italic() +

      +

      Not italic

      +
      + Source +
      +

      + not_overlined() +

      +

      Not overlined

      +
      + Source +
      +

      + overlined() +

      +

      Overlined

      +
      + Source +
      +

      + primary_font() +

      +

      Sets primary (default) font

      +
      + Source +
      +

      + red() +

      +

      Sets foreground color to red

      +
      + Source +
      +

      + red_background() +

      +

      Sets background color to red

      +
      + Source +
      +

      + reset() +

      +

      Resets all attributes

      +
      + Source +
      +

      + reverse() +

      +

      Image: Negative. Swap foreground and background

      +
      + Source +
      +

      + terminal?(device // :erlang.group_leader()) +

      +

      Checks whether the default I/O device is a terminal or a file.

      + +

      Used to identify whether printing ANSI escape sequences will likely +be printed as intended.

      + +

      Please note that invoked while in shell (iex) in Erlang/OTP +prior to R16, terminal?/0 will always return false because +Erlang shell did not support ANSI escape sequences up until +R16.

      +
      + Source +
      +

      + underline() +

      +

      Underline: Single

      +
      + Source +
      +

      + white() +

      +

      Sets foreground color to white

      +
      + Source +
      +

      + white_background() +

      +

      Sets background color to white

      +
      + Source +
      +

      + yellow() +

      +

      Sets foreground color to yellow

      +
      + Source +
      +

      + yellow_background() +

      +

      Sets background color to yellow

      +
      + Source +
      +
      + + + + + +
      + + diff --git a/docs/master/IO.html b/docs/master/IO.html index 369c6a166..502c43f03 100644 --- a/docs/master/IO.html +++ b/docs/master/IO.html @@ -84,6 +84,11 @@

      Functions summary

      gets/2 +
    2978. + + inspect/2 + +
    2979. inspect/3 @@ -122,37 +127,37 @@

      Functions summary

      Functions

      - binread(device // :stdio, count) + binread(device // group_leader(), count)

      Reads count bytes from the IO device as binary, no unicode conversion happens.

      Check read/2 for more information.

      - Source + Source

      - binreadline(device // :stdio) + binreadline(device // group_leader())

      Reads a line from the IO device as binary, no unicode conversion happens.

      Check readline/1 for more information.

      - Source + Source

      - binwrite(device // :stdio, item) + binwrite(device // group_leader(), item)

      Writes the given argument to the given device as a binary, no unicode conversion happens.

      Check write/2 for more information.

      - Source + Source

      - getb(device // :stdio, prompt, count // 1) + getb(device // group_leader(), prompt, count // 1)

      Gets count bytes from the IO device. It returns:

      @@ -164,10 +169,10 @@

      Functions

      NFS file system.

    2980. - Source + Source

      - gets(device // :stdio, prompt) + gets(device // group_leader(), prompt)

      Reads a line from the IO device. It returns:

      @@ -180,27 +185,39 @@

      Functions

      NFS file system.

      - Source + Source
      -

      - inspect(device // :stdio, item, opts // []) +

      + inspect(item, opts // [])

      Inspects and writes the given argument to the device -followed by a new line. Returns the item given.

      +followed by a new line. A set of options can be given.

      + +

      Examples

      + +
      IO.inspect Process.list
      +
      +
      + Source +
      +

      + inspect(device, item, opts) +

      +

      Inspects the item with options using the given device.

      - Source + Source

      - puts(device // :stdio, item) + puts(device // group_leader(), item)

      Writes the argument to the device, similarly to write but adds a new line at the end. The argument is expected to be a chardata.

      - Source + Source

      - read(device // :stdio, count) + read(device // group_leader(), count)

      Reads count bytes from the IO device. It returns:

      @@ -212,10 +229,10 @@

      Functions

      NFS file system.

      - Source + Source

      - readline(device // :stdio) + readline(device // group_leader())

      Reads a line from the IO device. It returns:

      @@ -230,10 +247,10 @@

      Functions

      This function does the same as gets/2, except the prompt is not required as argument.

      - Source + Source

      - write(device // :stdio, item) + write(device // group_leader(), item)

      Writes the given argument to the given device. By default the device is the standard output. @@ -251,7 +268,7 @@

      Examples

      #=> "error"
      - Source + Source
      diff --git a/docs/master/Kernel.CLI.html b/docs/master/Kernel.CLI.html index 92a9a18dd..2ec5a7213 100644 --- a/docs/master/Kernel.CLI.html +++ b/docs/master/Kernel.CLI.html @@ -46,11 +46,6 @@

      Functions summary

      run/2 -
    2981. - - wait_until_finished/0 - -
    2982. @@ -73,14 +68,7 @@

      Functions

      This function is used by Elixir's CLI and also by escripts generated by Elixir.

      - Source -
      -

      - wait_until_finished() -

      -

      Wait until the CLI finishes processing options.

      -
      - Source + Source
      diff --git a/docs/master/Kernel.SpecialForms.html b/docs/master/Kernel.SpecialForms.html index 9b1c37037..4df9096c0 100644 --- a/docs/master/Kernel.SpecialForms.html +++ b/docs/master/Kernel.SpecialForms.html @@ -392,7 +392,7 @@

      Examples

        Module.concat [some_var, Foo]
       
      - Source + Source

      args @@ -405,7 +405,7 @@

      Examples

      #=> { :__block__, [], [1,2,3] }
      - Source + Source

      __scope__(opts, args) @@ -421,7 +421,7 @@

      Examples

      Check quote/1 for more information.

      - Source + Source

      alias(module, opts) @@ -474,7 +474,7 @@

      Lexical scope

      be hygienezed. This means the alias will be expanded when the macro is expanded.

      - Source + Source

      bc(args) @@ -488,7 +488,7 @@

      Lexical scope

      "helloworld"
      - Source + Source

      import(module, opts) @@ -614,10 +614,10 @@

      Alias/Require shortcut

      [{213,45,132},{64,76,32},{76,0,0},{234,32,15}]
      - Source + Source

      - quote(opts, list2) + quote(opts, block)

      Allows you to get the representation of any expression.

      @@ -652,15 +652,12 @@

      Explanation

      Options

        -
      • :hygiene - When false, disables hygiene for variables, aliases and imports;
      • :unquote - When false, disables unquoting. Useful when you have a quote inside another quote and want to control which quote is able to unquote;
      • :location - When set to :keep, keeps the current line and file on quotes. Read the Stacktrace information section below for more information;
      • -
      • :expand_aliases - When false, do not expand aliases;
      • -
      • :expand_imports - When false, do not expand imports;
      • -
      • :var_context - The context for quoted variables. Defaults to the current module;
      • +
      • :hygiene - Allows a developer to disable hygiene selectively;

      Macro literals

      @@ -678,17 +675,15 @@

      Macro literals

      Hygiene

      -

      Elixir macros are hygienic. This means aliases and imports -defined inside the quoted often refer to the context that -defined the macro.

      +

      Elixir macros are hygienic via means of deferred resolution.

      -

      Furthermore, variables inside quote are also hygienic. That -said, a variable defined in a macro cannot affect the scope -where the macro is included.

      +

      This means aliases and imports defined inside the quoted refer +to the context that defined the macro and not the context +where the macro is expanded.

      -

      The option hygiene can turn off all the hygiene mechanisms -defined below. However, they can also be changed in a one by -one basis.

      +

      Furthermore, variables inside quote are also hygienic: a +variable defined in a macro cannot affect the variables where +the macro is expanded.

      Hygiene in variables

      @@ -754,15 +749,14 @@

      Hygiene in variables

      quote do: var!(a, Hygiene1) = 2 -

      Another option is to set the var_context option, affecting -all variables in the block:

      +

      Hygiene for variables can be disabled overall as:

      -
      quote var_context: Hygiene1, do: a = 2
      +
      quote hygiene: [vars: false], do: x
       

      Hygiene in aliases

      -

      Aliases inside quote are expanded by default. +

      Aliases inside quote are hygienic by default. Consider the following example:

      defmodule Hygiene do
      @@ -774,25 +768,43 @@ 

      Hygiene in aliases

      end require Hygiene -Hygiene.no_interference #=> HashDict[] +Hygiene.no_interference #=> #HashDict<[]>

      Notice that, even though the alias D is not available in the context the macro is expanded, the code above works -because D was expanded when the quote was generated.

      +because D still expands to HashDict.

      -

      There are two ways to disable this behaviour. By giving -the expand_aliases equals to false to quote or by using -the alias! macro inside the quote:

      +

      In some particular cases you may want to access an alias +or a module defined in the caller. In such scenarios, you +can access it by disabling hygiene with hygiene: [aliases: false] +or by using the alias! macro inside the quote:

      -
      defmodule NoHygiene do
      +
      defmodule Hygiene do
      +  # This will expand to Elixir.Nested.hello
      +  defmacro no_interference do
      +    quote do: Nested.hello
      +  end
      +
      +  # This will expand to Nested.hello for
      +  # whatever is Nested in the caller
         defmacro interference do
      -    quote do: alias!(D).new
      +    quote do: alias!(Nested).hello
         end
       end
       
      -require NoHygiene
      -NoHygiene.interference #=> UndefinedFunctionError
      +defmodule Parent do
      +  defmodule Nested do
      +    def hello, do: "world"
      +  end
      +
      +  require Hygiene
      +  Hygiene.no_interference
      +  #=> ** (UndefinedFunctionError) ...
      +
      +  Hygiene.interference
      +  #=> "world"
      +end
       

      Hygiene in imports

      @@ -844,7 +856,7 @@

      Hygiene in imports

      As in aliases, imports expansion can be explicitly disabled -via the expand_imports option.

      +via the hygiene: [imports: false] option.

      Stacktrace information

      @@ -880,7 +892,7 @@

      Stacktrace information

      particular, the macro __FILE__ and exceptions happening inside the quote will always point to GenServer.Behaviour file.

      - Source + Source

      require(module, opts) @@ -940,7 +952,7 @@

      Examples

      #=> { :sum, [], [1, 13, 3] }
      - Source + Source

      unquote_splicing(expr) @@ -955,7 +967,7 @@

      Examples

      #=> { :sum, [], [1, 2, 3, 4, 5] }
      - Source + Source

      var!(var) @@ -966,7 +978,7 @@

      Examples

      one is an atom) or an atom representing the variable name. Check quote/2 for more information.

      - Source + Source

      var!(var, context) @@ -974,7 +986,7 @@

      Examples

      Defines a variable in the given context. Check quote/2 for more information.

      - Source + Source

      {args} diff --git a/docs/master/Kernel.Typespec.html b/docs/master/Kernel.Typespec.html index f9fafdf38..8c2a7b99b 100644 --- a/docs/master/Kernel.Typespec.html +++ b/docs/master/Kernel.Typespec.html @@ -107,7 +107,7 @@

      Notes

      Elixir discourages the use of type string() as it might be confused with binaries which are referred to as "strings" in Elixir (as opposed to character lists). In order to use the type that is called string() in Erlang, -one has to use the char_list() type which is a synonym to string(). If yu +one has to use the char_list() type which is a synonym for string(). If you use string(), you'll get a warning from the compiler.

      If you want to refer to the "string" type (the one operated by functions in the diff --git a/docs/master/Kernel.html b/docs/master/Kernel.html index 7a5419c16..d415cd8d4 100644 --- a/docs/master/Kernel.html +++ b/docs/master/Kernel.html @@ -483,11 +483,6 @@

      Macros summary

      //2 -
    2983. - - />/2 - -
    2984. </2 @@ -873,7 +868,7 @@

      Examples

      Examples

      -
      apply List, reverse, [[1,2,3]]
      +
      apply Enum, :reverse, [[1,2,3]]
       #=> [3,2,1]
       
    2985. @@ -962,7 +957,7 @@

      Examples

      binary_to_list(binary, start, stop)

      -

      As binarytolist/1, but returns a list of integers corresponding to the bytes +

      Like binarytolist/1, but returns a list of integers corresponding to the bytes from position start to position stop in binary. Positions in the binary are numbered starting from 1.

      @@ -1014,7 +1009,7 @@

      Examples

      Examples

      -
      bit_size(<<433|16,3|3>>) #=> 19
      +
      bit_size(<<433::16,3::3>>) #=> 19
       bit_size(<<1,2,3>>) #=> 24
       
      @@ -1040,7 +1035,7 @@

      Examples

      Examples

      -
      byte_size(<<433|16,3|3>>) #=> 3
      +
      byte_size(<<433::16,3::3>>) #=> 3
       byte_size(<<1,2,3>>) #=> 3
       
      @@ -1094,7 +1089,7 @@

      Examples

      it is not loaded. Check Code.ensure_loaded/1 for more information.

      - Source + Source

      hd(list) @@ -1347,10 +1342,10 @@

      Examples

      bin1 = <<1,2,3>>
       bin2 = <<4,5>>
      -bin3 = <<6,7|4>>
      +bin3 = <<6,7::4>>
       
       list_to_bitstring([bin1,1,[2,3,bin2],4|bin3])
      -#=> <<1,2,3,1,2,3,4,5,4,6,7|4>>
      +#=> <<1,2,3,1,2,3,4,5,4,6,7::size(4)>>
       
      Source @@ -1413,7 +1408,7 @@

      Warning:

      Examples

      -
      list_to_pid('<0.41>') #=> <0.4.1>
      +
      list_to_pid('<0.4.1>') #=> #PID<0.4.1>
       
      Source @@ -1440,7 +1435,7 @@

      Examples

      it is not loaded. Check Code.ensure_loaded/1 for more information.

      - Source + Source

      make_ref() @@ -1453,7 +1448,7 @@

      Examples

      Examples

      make_ref()
      -#=> #Ref<0.0.0.135>
      +#=> #Reference<0.0.0.135>
       
      Source @@ -1499,7 +1494,7 @@

      Examples

      node(arg)

      -

      Returns the node where the given argmuent is located. +

      Returns the node where the given argument is located. The argument can be a pid, a reference, or a port. If the local node is not alive, nonode@nohost is returned.

      @@ -1546,7 +1541,7 @@

      Examples

      end
      - Source + Source

      raise(exception, args) @@ -1566,7 +1561,7 @@

      Examples

      raise ArgumentError, message: "Sample"
       
      - Source + Source

      raise(exception, args, stacktrace) @@ -1593,7 +1588,7 @@

      Examples

      rescued) in between the rescue clause and the raise call may change the System.stacktrace value.

      - Source + Source

      round(number) @@ -1620,7 +1615,7 @@

      Examples

      size(arg)

      Returns the size of the given argument, which must be a tuple -or a binary. If possible, please use tuplesize or binarysize.

      +or a binary. If possible, please use tuple_size or binary_size.

      Source
      @@ -1634,10 +1629,10 @@

      Examples

      Examples

      -
      current = Process.self
      -child   = spawn(fn -> current <- { Process.self, 1 + 2 } end)
      +
      current = Kernel.self
      +child   = spawn(fn -> current <- { Kernel.self, 1 + 2 } end)
       
      -receive
      +receive do
         { ^child, 3 } -> IO.puts "Received 3 back"
       end
       
      @@ -1670,16 +1665,15 @@

      Examples

      Examples

      -
      current = Process.self
      -child   = spawn_link(fn -> current <- { Process.self, 1 + 2 } end)
      +
      current = Kernel.self
      +child   = spawn_link(fn -> current <- { Kernel.self, 1 + 2 } end)
       
      -receive
      -  { ^child, 3 } ->
      -    IO.puts "Received 3 back"
      +receive do
      +  { ^child, 3 } -> IO.puts "Received 3 back"
       end
       
      - Source + Source

      spawn_link(module, fun, args) @@ -1695,19 +1689,19 @@

      Examples

      spawn_link(SomeModule, :function, [1,2,3])
       
      - Source + Source

      term_to_binary(term)

      -

      Returns a binary data which is the result of encoding the given term +

      Returns a binary which is the result of encoding the given term according to the Erlang external term format.

      This can be used for a variety of purposes, for example, writing a term to a file in an efficient way, or sending an Erlang term to some type of communications channel not supported by distributed :

      - Source + Source

      term_to_binary(term, opts) @@ -1715,32 +1709,32 @@

      Examples

      The same as term_to_binary/1 but also supports two options:

      - Source + Source

      throw(term)

      A non-local return from a function. Check try/2 for more information.

      - Source + Source

      tl(list)

      Returns the tail of a list. Raises ArgumentError if the list is empty.

      - Source + Source

      trunc(number)

      -

      Returns an integer by the truncating the given number. +

      Returns an integer by truncating the given number. Allowed in guard clauses.

      Examples

      @@ -1748,21 +1742,21 @@

      Examples

      trunc(5.5) #=> 5
       
      - Source + Source

      tuple_size(tuple)

      Returns the size of a tuple.

      - Source + Source

      tuple_to_list(tuple)

      Converts a tuple to a list.

      - Source + Source
      @@ -1774,7 +1768,7 @@

      Macros

      !arg

      -

      It receives any argument and returns true if it is false +

      Receives any argument and returns true if it is false or nil. Returns false otherwise. Not allowed in guard clauses.

      @@ -1796,7 +1790,7 @@

      Examples

      This operator considers 1 and 1.0 to be equal. For strict comparison, use !== instead.

      -

      As Erlang, Elixir can compare any term. Allowed in guard clauses.

      +

      Like Erlang, Elixir can compare any term. Allowed in guard clauses.

      Examples

      @@ -1812,7 +1806,7 @@

      Examples

      left !== right

      Returns true if the two items are strictly not equal. -As Erlang, Elixir can compare any term. Allowed in guard clauses.

      +Like Erlang, Elixir can compare any term. Allowed in guard clauses.

      Examples

      @@ -1844,7 +1838,7 @@

      Examples

      this operator accepts any expression as arguments, not only booleans, however it is not allowed in guards.

      - Source + Source

      left * right @@ -1929,7 +1923,7 @@

      Examples

      3 in 1..3 #=> true
      - Source + Source

      left / right @@ -1945,18 +1939,12 @@

      Examples

      Source -
      -

      - />(left, right) -

      -
      - Source

      left < right

      -

      Return true if left is less than right. -As Erlang, Elixir can compare any term. Allowed in guard clauses.

      +

      Returns true if left is less than right. +Like Erlang, Elixir can compare any term. Allowed in guard clauses.

      Examples

      @@ -1975,7 +1963,7 @@

      Examples

      Examples

      -
      process = Process.self
      +
      process = Kernel.self
       process <- { :ok, "Sending myself a message" }
       
      @@ -1984,8 +1972,8 @@

      Examples

      left <= right

      -

      Return true if left is less than or equal to right. -As Erlang, Elixir can compare any term. Allowed in guard clauses.

      +

      Returns true if left is less than or equal to right. +Like Erlang, Elixir can compare any term. Allowed in guard clauses.

      Examples

      @@ -2012,7 +2000,7 @@

      Examples

      x #=> "bar"
      - Source + Source

      left == right @@ -2022,7 +2010,7 @@

      Examples

      This operator considers 1 and 1.0 to be equal. For strict comparison, use === instead.

      -

      As Erlang, Elixir can compare any term. Allowed in guard clauses.

      +

      Like Erlang, Elixir can compare any term. Allowed in guard clauses.

      Examples

      @@ -2039,7 +2027,7 @@

      Examples

      left === right

      Returns true if the two items are strictly equal. -As Erlang, Elixir can compare any term. Allowed in guard clauses.

      +Like Erlang, Elixir can compare any term. Allowed in guard clauses.

      Examples

      @@ -2065,13 +2053,13 @@

      Examples

      "abcd" =~ %r/e/ #=> nil
      - Source + Source

      left > right

      -

      Return true if left is more than right. -As Erlang, Elixir can compare any term. Allowed in guard clauses.

      +

      Returns true if left is more than right. +Like Erlang, Elixir can compare any term. Allowed in guard clauses.

      Examples

      @@ -2084,8 +2072,8 @@

      Examples

      left >= right

      -

      Return true if left is more than or equal to right. -As Erlang, Elixir can compare any term. Allowed in guard clauses.

      +

      Returns true if left is more than or equal to right. +Like Erlang, Elixir can compare any term. Allowed in guard clauses.

      Examples

      @@ -2141,7 +2129,7 @@

      Examples

      time and not at runtime. Check the module Module for other functions to manipulate module attributes.

      - Source + Source

      __B__(string, list2) @@ -2155,7 +2143,7 @@

      Examples

      %B(f#{o}o) #=> "f\#{o}o"
      - Source + Source

      __C__(arg1, list2) @@ -2169,7 +2157,7 @@

      Examples

      %C(f#{o}o) #=> 'f\#{o}o'
      - Source + Source

      __R__(arg1, options) @@ -2182,7 +2170,7 @@

      Examples

      Regex.match? %R(f#{1,3}o), "f#o"  #=> true
       
      - Source + Source

      __b__(arg1, list2) @@ -2196,7 +2184,7 @@

      Examples

      %b(f#{:o}o) #=> "foo"
      - Source + Source

      __c__(arg1, list2) @@ -2210,7 +2198,7 @@

      Examples

      %c(f#{:o}o) #=> 'foo'
      - Source + Source

      __r__(arg1, options) @@ -2222,7 +2210,7 @@

      Examples

      Regex.match? %r(foo), "foo"  #=> true
       
      - Source + Source

      access(element, args) @@ -2296,12 +2284,12 @@

      Examples

      access a, 1 #=> :a
      - Source + Source

      left and right

      -

      Boolean and. Arguments needs to necessarily be booleans. +

      Boolean and. Arguments must be booleans. Allowed in guard clauses.

      Examples

      @@ -2323,7 +2311,7 @@

      Examples

      atom_to_binary :my_atom #=> "my_atom"
       
      - Source + Source

      binary_to_atom(some_binary) @@ -2336,7 +2324,7 @@

      Examples

      binary_to_atom "my_atom" #=> :my_atom
       
      - Source + Source

      binary_to_existing_atom(some_binary) @@ -2349,7 +2337,7 @@

      Examples

      binary_to_existing_atom "my_atom" #=> :my_atom
      - Source + Source

      binary_to_float(some_binary) @@ -2361,7 +2349,7 @@

      Examples

      binary_to_float "2.2017764e+0" #=> 2.2017764
       
      - Source + Source

      binary_to_integer(some_binary) @@ -2373,7 +2361,7 @@

      Examples

      binary_to_integer "123" #=> 123
       
      - Source + Source

      binary_to_integer(some_binary, base) @@ -2386,7 +2374,7 @@

      Examples

      binary_to_integer("3FF", 16) #=> 1023
       
      - Source + Source

      case(condition, blocks) @@ -2439,7 +2427,7 @@

      Examples

      end
      - Source + Source

      cond(list1) @@ -2459,7 +2447,7 @@

      Examples

      end
      - Source + Source

      def(name, list2) @@ -2519,7 +2507,7 @@

      Dynamic generation with atoms

      defmacro defkv(keywords) do
         Enum.map keywords, fn {k,v} ->
           quote do
      -      def unquote(k).() do
      +      def unquote(k)() do
               unquote(v)
             end
           end
      @@ -2531,12 +2519,8 @@ 

      Dynamic generation with atoms

      defkv one: 1, two: 2
       
      - -

      Notice in the example above, we define the function as def unquote(k).() -because each entry k is a an atom and invoking def unquote(k)() -would be invalid Elixir syntax.

      - Source + Source

      def(name, args, guards, list4) @@ -2573,7 +2557,7 @@

      Examples

      def name, args, guards, do: exprs
      - Source + Source

      defdelegate(funs, opts) @@ -2619,7 +2603,7 @@

      Examples

      #=> [3,2,1]
      - Source + Source

      defexception(name, fields, opts // [], do_block // []) @@ -2635,7 +2619,7 @@

      Examples

      2) Exceptions must implement message/1 as API that return a binary as result;

      - Source + Source

      defimpl(name, opts, do_block // []) @@ -2643,7 +2627,7 @@

      Examples

      Defines an implementation for the given protocol. See defprotocol/2 for examples.

      - Source + Source

      defmodule(name, list2) @@ -2691,7 +2675,7 @@

      Dynamic names

      Elixir will accept any module name as long as the expression returns an atom.

      - Source + Source

      defoverridable(tuples) @@ -2700,7 +2684,7 @@

      Dynamic names

      An overridable function is lazily defined, allowing a developer to customize it.

      - Source + Source

      defp(name, list2) @@ -2724,14 +2708,14 @@

      Examples

      In the example above, sum is private and accessing it through Foo.sum will raise an error.

      - Source + Source

      defp(name, args, guards, list4)

      The same as def/4 but generates a private function.

      - Source + Source

      defprotocol(name, list2) @@ -2811,7 +2795,7 @@

      Selecting implementations

      If the protocol is invoked with a data type that is not an Atom, -nor Tuple, nor List, nor BitString, Elixir will now dispatch to +a Tuple, a List, or a BitString, Elixir will now dispatch to Any. That said, the default behavior could be implemented as:

      defimpl Blank, for: Any do
      @@ -2840,8 +2824,8 @@ 

      Protocols + Records

      In the example above, we have implemented blank? for RedBlack.Tree that simply delegates to RedBlack.empty? passing the tree as argument. This implementation doesn't need to be defined -inside the RedBlack tree or inside the record, but anywhere in -the code.

      +inside the RedBlack tree or inside the record; it can be defined +anywhere in the code.

      Finally, since records are simply tuples, one can add a default protocol implementation to any record by defining a default @@ -2861,7 +2845,7 @@

      Types

      The @spec above expresses that all types allowed to implement the given protocol are valid argument types for the given function.

      - Source + Source

      defrecord(name, fields, opts // [], do_block // []) @@ -2970,7 +2954,7 @@

      Types

      When defining a type, all the fields not mentioned in the type are assumed to have type term.

      - Source + Source

      defrecordp(name, fields) @@ -3018,16 +3002,15 @@

      Examples

      name #=> "José"
      - Source + Source

      destructure(left, right)

      -

      Allows you to destructure two lists, assigning each -term in the right to the left. Differently from pattern -matching via =, if the sizes of the left and right -lists don't match,, structuring simply stops instead -of raising an error.

      +

      Allows you to destructure two lists, assigning each term in the right to the +matching term in the left. Unlike pattern matching via =, if the sizes of +the left and right lists don't match, destructuring simply stops instead of +raising an error.

      Examples

      @@ -3038,7 +3021,7 @@

      Examples

      Notice in the example above, even though the right -size has more entries than the left, structuring works +size has more entries than the left, destructuring works fine. If the right size is smaller, the remaining items are simply assigned to nil:

      @@ -3059,7 +3042,7 @@

      Examples

      the first value from the right side. Otherwise, it will raise a CaseClauseError.

      - Source + Source

      div(left, right) @@ -3073,7 +3056,7 @@

      Examples

      div 5, 2 #=> 2
       
      - Source + Source

      elem(tuple, index) @@ -3089,7 +3072,7 @@

      Example

      elem(tuple, 1) #=> :bar
      - Source + Source

      float_to_binary(some_float) @@ -3102,7 +3085,7 @@

      Examples

      float_to_binary 7.0 #=> "7.00000000000000000000e+00"
       
      - Source + Source

      function(args) @@ -3142,7 +3125,7 @@

      Shortcut syntax

      end -

      Not only the example is shorter, it solves ambiguity issues. Since +

      Not only is the example shorter, it solves ambiguity issues. Since do/end always matches the furthest call, if we used the function macro as below:

      @@ -3177,14 +3160,14 @@

      Function retrieval

      The function macro can also be used to retrieve local or remote functions:

      -
      f = function(:is_atom, 2)
      +
      f = function(:is_atom, 1)
       f.(:foo) #=> true
       
       f = function(List, :flatten, 1)
       f.([1,[2],3]) #=> [1,2,3]
       
      - Source + Source

      if(condition, clauses) @@ -3228,7 +3211,7 @@

      Blocks examples

      If you want to compare more than two clauses, you can use the cond/1 macro.

      - Source + Source

      left in right @@ -3270,7 +3253,7 @@

      Clauses

      In this case, Elixir will automatically expand it and define the variable for us.

      - Source + Source

      inspect(arg, opts // []) @@ -3294,15 +3277,15 @@

      Examples

      #=> ":foo"
      -

      Notice the inspect protocol does not necessarily return a valid Elixir -terms representation. In such cases, the inspected result must start -with #. For example, inspecting a function will return:

      +

      Note that the inspect protocol does not necessarily return a valid +representation of an Elixir term. In such cases, the inspected result must +start with #. For example, inspecting a function will return:

      inspect &1 + &2
       #=> #Function<...>
       
      - Source + Source

      integer_to_binary(some_integer) @@ -3315,7 +3298,7 @@

      Examples

      integer_to_binary 123 #=> "123"
       
      - Source + Source

      integer_to_binary(some_integer, base) @@ -3328,12 +3311,12 @@

      Examples

      integer_to_binary 77 #=> "77"
       
      - Source + Source

      is_exception(thing)

      -

      Check if the given structure is an exception.

      +

      Checks if the given structure is an exception.

      Examples

      @@ -3341,26 +3324,26 @@

      Examples

      is_exception(1) #=> false
      - Source + Source

      is_range(thing)

      -

      Check if the given argument is a range.

      +

      Checks if the given argument is a range.

      - Source + Source

      is_record(thing)

      -

      Check if the given argument is a record.

      +

      Checks if the given argument is a record.

      - Source + Source

      is_record(thing, kind)

      -

      Check if the given structure is a record. It is basically +

      Checks if the given structure is a record. It is basically a convenient macro that checks the structure is a tuple and the first element matches the given kind.

      @@ -3372,14 +3355,14 @@

      Examples

      is_record(Config.new, List) #=> false
      - Source + Source

      is_regex(thing)

      -

      Check if the given argument is a regex.

      +

      Checks if the given argument is a regex.

      - Source + Source

      match?(left, right) @@ -3406,7 +3389,7 @@

      Examples

      Enum.filter list, match?({:a, x } when x < 2, &1)
      - Source + Source

      nil?(x) @@ -3420,12 +3403,12 @@

      Examples

      nil? nil #=> true
      - Source + Source

      not arg

      -

      Boolean not. Argument needs to necessarily be a boolean. +

      Boolean not. Argument must be a boolean. Allowed in guard clauses.

      Examples

      @@ -3439,7 +3422,7 @@

      Examples

      left or right

      -

      Boolean or. Arguments needs to necessarily be booleans. +

      Boolean or. Arguments must be booleans. Allowed in guard clauses.

      Examples

      @@ -3496,7 +3479,7 @@

      Examples

      will occur immediately.

      - Source + Source

      rem(left, right) @@ -3510,7 +3493,7 @@

      Examples

      rem 5, 2 #=> 1
       
      - Source + Source

      setelem(tuple, index, value) @@ -3526,7 +3509,7 @@

      Example

      setelem(tuple, 0, :baz) #=> { :baz, :bar, 3 }
      - Source + Source

      to_binary(arg) @@ -3540,7 +3523,7 @@

      Examples

      #=> "foo"
      - Source + Source

      to_char_list(arg) @@ -3553,7 +3536,7 @@

      Examples

      #=> 'foo'
      - Source + Source

      try(args) @@ -3670,7 +3653,7 @@

      Variable visibility

      end
      - Source + Source

      unless(clause, options) @@ -3679,7 +3662,7 @@

      Variable visibility

      unless a value evalutes to true. Check if for examples and documentation.

      - Source + Source

      use(module, args // []) @@ -3689,8 +3672,8 @@

      Variable visibility

      Examples

      -

      For example, in other to write tests using the ExUnit framework, -a developers should use the ExUnit.Case module:

      +

      For example, in order to write tests using the ExUnit framework, +a developer should use the ExUnit.Case module:

      defmodule AssertionTest do
         use ExUnit.Case, async: true
      @@ -3716,12 +3699,12 @@ 

      Examples

      end
      - Source + Source

      left xor right

      -

      Boolean xor. Arguments needs to necessarily be booleans. +

      Boolean xor. Arguments must be booleans. Allowed in guard clauses.

      Examples

      @@ -3769,7 +3752,7 @@

      Examples

      String.graphemes("Hello") |> Enum.reverse
       
      - Source + Source

      left || right @@ -3790,7 +3773,7 @@

      Examples

      this operator accepts any expression as arguments, not only booleans, however it is not allowed in guards.

      - Source + Source
      diff --git a/docs/master/KeyError.html b/docs/master/KeyError.html index b2b9893b3..0e401d4f9 100644 --- a/docs/master/KeyError.html +++ b/docs/master/KeyError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -70,7 +70,7 @@

      Functions

      message(exception)

      - Source + Source diff --git a/docs/master/Macro.html b/docs/master/Macro.html index 0efb339ac..6f5c62d51 100644 --- a/docs/master/Macro.html +++ b/docs/master/Macro.html @@ -122,7 +122,7 @@

      Functions

      do_safe_term(terms)

      - Source + Source

      escape(tuple) @@ -269,7 +269,7 @@

      Examples

      evaluate code) and returns :ok unless a given term is unsafe, which is returned as { :unsafe, term }.

      - Source + Source

      to_binary(tree) diff --git a/docs/master/MatchError.html b/docs/master/MatchError.html index 4639fa521..47a8fc5c6 100644 --- a/docs/master/MatchError.html +++ b/docs/master/MatchError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -70,7 +70,7 @@

      Functions

      message(exception)

      - Source + Source
      diff --git a/docs/master/Mix.Project.html b/docs/master/Mix.Project.html index 0681a64da..8ddfbadb8 100644 --- a/docs/master/Mix.Project.html +++ b/docs/master/Mix.Project.html @@ -120,7 +120,7 @@

      Functions

      Returns a list of project config files (mix.exs and mix.lock).

      - Source + Source

      get() diff --git a/docs/master/Mix.Tasks.Clean.html b/docs/master/Mix.Tasks.Clean.html index d6549952e..a874715bb 100644 --- a/docs/master/Mix.Tasks.Clean.html +++ b/docs/master/Mix.Tasks.Clean.html @@ -68,7 +68,7 @@

      Functions

      run(args)

      - Source + Source
      diff --git a/docs/master/Mix.Tasks.Compile.Erlang.html b/docs/master/Mix.Tasks.Compile.Erlang.html index e4afe82fd..47a748afd 100644 --- a/docs/master/Mix.Tasks.Compile.Erlang.html +++ b/docs/master/Mix.Tasks.Compile.Erlang.html @@ -29,21 +29,46 @@

      A task to compile Erlang source files.

      +

      When this task runs, it will first check the mod times of +all of the files. Every file will checked, if file or +file dependencies, like include files, was changed. +If file of his dependencies haven't been changed since the +last compilation, it will not compile. If file or one of his +dependency has changed, it will compile.

      + +

      For this reason, this task touches your :compile_path +directory and sets the modification time to the current +time and date at the end of each compilation. You can +force compilation regardless of mod times by passing +the --force option.

      +

      Command line options

        -
      • ERL_COMPILER_OPTIONS - can be used to give default compile options. -It's value must be a valid Erlang term. If the value is a list, it will -be used as is. If it is not a list, it will be put into a list.
      • +
      • --force - forces compilation regardless of module times

      Configuration

        -
      • :erlc_options - compilation options that applies to Erlang compiler -By default, the following options are on: [:verbose, :report_errors, :report_warnings]
      • +
      • ERL_COMPILER_OPTIONS - can be used to give default compile options. +It's value must be a valid Erlang term. If the value is a list, it will +be used as is. If it is not a list, it will be put into a list.

      • +
      • :erlc_paths - directories to find source files. +Defaults to ["src"], can be configured as:

        + +

        [erlc_paths: ["src", "other"]]

      • +
      • :erlc_include_path - directory for adding include files. +Defaults to "include", can be configured as:

        + +

        [erlc_include_path: "other"]

      • +
      • :erlc_options - compilation options that applies to Erlang's +compiler. :debug_info is enabled by default.

      +

      There are many available options here: + http://www.erlang.org/doc/man/compile.html#file-2

      +
      @@ -57,10 +82,25 @@

      Configuration

      Functions summary

      @@ -73,11 +113,37 @@

      Functions summary

      Functions

      +

      + extract_stale_pairs(dir1, ext1, dir2, ext2, force) +

      +

      Extract stale pairs considering the set of directories +and filename extensions. It first looks up the dir1 +for files with ext1 extensions and then recursively +try to find matching pairs in dir2 with ext2 +extension.

      +
      + Source +
      +

      + interpret_result(file, result, ext // "") +

      +

      Interprets compilation results and prints them to the console.

      +
      + Source +

      - run(_) + run(args)

      - Source + Source +
      +

      + to_erl_file(file) +

      +

      Converts the given file to a format accepted by +Erlang compilation tools.

      +
      + Source
      diff --git a/docs/master/Mix.Tasks.Compile.Leex.html b/docs/master/Mix.Tasks.Compile.Leex.html new file mode 100644 index 000000000..cf89b1605 --- /dev/null +++ b/docs/master/Mix.Tasks.Compile.Leex.html @@ -0,0 +1,99 @@ + + + + Mix.Tasks.Compile.Leex + + + + + + + + + + + + +
      +

      + Mix.Tasks.Compile.Leex + +

      + + +
      +

      A task to compile Leex source files.

      + +

      When this task runs, it will check the mod time of every file, and +if it has changed, then file will be compiled. Files will be +compiled in the same source directory with .erl extension. +You can force compilation regardless of mod times by passing +the --force option.

      + +

      Command line options

      + +
        +
      • --force - forces compilation regardless of module times;
      • +
      + +

      Configuration

      + +
        +
      • :erlc_paths - directories to find source files. +Defaults to ["src"], can be configured as:

        + +

        [erlc_paths: ["src", "other"]]

      • +
      • :leex_options - compilation options that applies +to Leex's compiler. There are many available options +here: http://www.erlang.org/doc/man/leex.html#file-2

      • +
      + +
      + + + Source + + + + + + +

      Functions summary

      + + + + + + + + +
      +

      Functions

      +
      +

      + run(args) +

      +
      + Source +
      +
      + + + + + +
      + + diff --git a/docs/master/Mix.Tasks.Compile.Yecc.html b/docs/master/Mix.Tasks.Compile.Yecc.html new file mode 100644 index 000000000..0b9b57518 --- /dev/null +++ b/docs/master/Mix.Tasks.Compile.Yecc.html @@ -0,0 +1,99 @@ + + + + Mix.Tasks.Compile.Yecc + + + + + + + + + + + + +
      +

      + Mix.Tasks.Compile.Yecc + +

      + + +
      +

      A task to compile Yecc source files.

      + +

      When this task runs, it will check the mod time of every file, and +if it has changed, then file will be compiled. Files will be +compiled in the same source directory with .erl extension. +You can force compilation regardless of mod times by passing +the --force option.

      + +

      Command line options

      + +
        +
      • --force - forces compilation regardless of module times;
      • +
      + +

      Configuration

      + +
        +
      • :erlc_paths - directories to find source files. +Defaults to ["src"], can be configured as:

        + +

        [erlc_paths: ["src", "other"]]

      • +
      • :yecc_options - compilation options that applies +to Yecc's compiler. There are many other available +options here: http://www.erlang.org/doc/man/yecc.html#file-1

      • +
      + +
      + + + Source + + + + + + +

      Functions summary

      + + + + + + + + +
      +

      Functions

      +
      +

      + run(args) +

      +
      + Source +
      +
      + + + + + +
      + + diff --git a/docs/master/Mix.Utils.html b/docs/master/Mix.Utils.html index 73497ed0c..24f0119a7 100644 --- a/docs/master/Mix.Utils.html +++ b/docs/master/Mix.Utils.html @@ -139,7 +139,7 @@

      Examples

      Mix.Utils.camelize "foo_bar" #=> "FooBar"
       
      - Source + Source

      command_to_module(command, at // Elixir) @@ -170,7 +170,7 @@

      Examples

      #=> "Compile.Elixir"
      - Source + Source

      config_merge(old, new) @@ -178,17 +178,16 @@

      Examples

      Merges two configs recursively, merging keyword lists and concatenating normal lists.

      - Source + Source

      - extract_files(paths, exts) + extract_files(paths, exts_or_pattern)

      -

      Extract files from a list of paths or from a wildcard.

      +

      Extract files from a list of paths.

      -

      If the list of paths contains a directory, the directory -is expanded according to the given pattern.

      - -

      It ignores files which start with "."

      +

      In case any of the paths is a directory, the directory is looped +recursively searching for the given extensions or the given pattern. +When looking up directories, files starting with "." are ignored.

      Source
      @@ -197,7 +196,7 @@

      Examples

      Extract all stale sources compared to the given targets.

      - Source + Source

      mix_home() @@ -223,15 +222,15 @@

      Examples

      #=> "compile.elixir"
      - Source + Source

      preserving_mtime(path, fun)

      -

      Executes a function but preserves the given path -mtime properties.

      +

      Executes a function but preserves the given path mtime +properties.

      - Source + Source

      relative_to_cwd(path) @@ -239,7 +238,7 @@

      Examples

      Returns the given path string relative to the current working directory.

      - Source + Source

      source(module) @@ -251,9 +250,10 @@

      Examples

      stale?(sources, targets)

      -

      Returns true if any of the sources are stale compared to the given target.

      +

      Returns true if any of the sources are stale +compared to the given target.

      - Source + Source

      underscore(atom) @@ -277,7 +277,7 @@

      Examples

      Mix.Utils.camelize "sap_example" #=> "SapExample"
      - Source + Source
      diff --git a/docs/master/Node.html b/docs/master/Node.html index a427c34f1..6e78bc0c7 100644 --- a/docs/master/Node.html +++ b/docs/master/Node.html @@ -46,6 +46,11 @@

      Functions summary

      alive?/0 +
    2986. + + connect/1 + +
    2987. disconnect/1 @@ -125,6 +130,17 @@

      Functions

      part of a distributed system. Otherwise, it returns false.

      Source +
      +

      + connect(node) +

      +

      Establishes a connection to Node. Returns true if successful, +false if not, and the atom :ignored if the local node is not +alive.

      + +

      See http://erlang.org/doc/man/net_kernel.html#connect_node-1 for more info.

      +
      + Source

      disconnect(node) @@ -193,7 +209,7 @@

      Functions

      Check http://www.erlang.org/doc/man/erlang.html#spawn-2 for the list of available options.

      - Source + Source

      spawn(node, fun, opts) @@ -204,7 +220,7 @@

      Functions

      Check http://www.erlang.org/doc/man/erlang.html#spawn_opt-3 for the list of available options.

      - Source + Source

      spawn(node, module, fun, args) @@ -216,7 +232,7 @@

      Functions

      Check http://www.erlang.org/doc/man/erlang.html#spawn-4 for the list of available options.

      - Source + Source

      spawn(node, module, fun, args, opts) @@ -228,7 +244,7 @@

      Functions

      Check http://www.erlang.org/doc/man/erlang.html#spawn_opt-5 for the list of available options.

      - Source + Source

      spawn_link(node, fun) @@ -239,7 +255,7 @@

      Functions

      (and due to the link, an exit signal with exit reason :noconnection will be received).

      - Source + Source

      spawn_link(node, module, fun, args) @@ -250,7 +266,7 @@

      Functions

      pid is returned (and due to the link, an exit signal with exit reason :noconnection will be received).

      - Source + Source diff --git a/docs/master/OptionParser.html b/docs/master/OptionParser.html index 1d57f362f..ea1916d02 100644 --- a/docs/master/OptionParser.html +++ b/docs/master/OptionParser.html @@ -86,12 +86,22 @@

      Aliases

      Switches

      -

      Extra information about switches can be given as argument too. This is useful -in order to say a switch must behave as a boolean, list, etc. The following -types are supported:

      +

      Extra information about switches can be given as argument too. +This is useful in order to say a switch must behave as a boolean +or if duplicated switches should be kept, overriden or accumulated.

      + +

      The following types are supported:

      + +
        +
      • :boolean - Mark the given switch as boolean. Boolean switches + never consumes the following value unless it is + true or false;
      • +
      + +

      The following extra options are supported:

        -
      • :boolean - They never consume the next value unless it is true/false;
      • +
      • :keep - Keep duplicated items in the list instead of overriding;

      Examples:

      @@ -112,7 +122,7 @@

      Negation switches

      #=> { [no_op: true], ["path/to/file"] } - Source + Source

      parse_head(argv, opts // []) @@ -128,7 +138,7 @@

      Example

      #=> { [source: "lib"], ["test/enum_test.exs", "--verbose"] }
      - Source + Source diff --git a/docs/master/OrdDict.html b/docs/master/OrdDict.html deleted file mode 100644 index 90f4daeb2..000000000 --- a/docs/master/OrdDict.html +++ /dev/null @@ -1,118 +0,0 @@ - - - - OrdDict - - - - - - - - - - - - -
      -

      - OrdDict - -

      - - -
      -

      This module implements a dictionary type that stores items -as a list of tuples. It is a simple wrapper around -Erlang's orddict module -and exposed via the Dict module.

      - -

      Check the Dict module for examples and documentation.

      - -
      - - - Source - - - - - - -

      Functions summary

      - - - - - - - - -
      -

      Functions

      -
      -

      - new() -

      -

      Creates a new empty dict.

      -
      - Source -
      -

      - new(pairs) -

      -

      Creates a new dict from a list of pairs.

      - -

      Examples

      - -
      OrdDict.new [{:b,1},{:a,2}]
      -#=> [a: 1, b: 2]
      -
      -
      - Source -
      -

      - new(list, transform) -

      -

      Creates a new dict from a list of elements with the -help of the transformation function.

      - -

      Examples

      - -
      OrdDict.new ["a", "b"], fn x -> {x, x} end
      -#=> ["a": "a", "b": "b"]
      -
      -
      - Source -
      -
      - - - - - -
      - - diff --git a/docs/master/Process.html b/docs/master/Process.html index e06b10b17..8706f03e4 100644 --- a/docs/master/Process.html +++ b/docs/master/Process.html @@ -146,11 +146,6 @@

      Functions summary

      registered/0
    2988. -
    2989. - - self/0 - -
    2990. spawn/1 @@ -233,14 +228,14 @@

      Functions

      Deletes all items in the dictionary.

      - Source + Source

      delete(key)

      Deletes the given key from the dictionary.

      - Source + Source

      demonitor(monitor_ref, options // []) @@ -251,7 +246,7 @@

      Functions

      See http://www.erlang.org/doc/man/erlang.html#demonitor-2 for more info.

      - Source + Source

      exit(pid, reason) @@ -278,7 +273,7 @@

      Examples

      Process.exit(pid, :kill)
       
      - Source + Source

      flag(flag, value) @@ -288,7 +283,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#process_flag-2 for more info.

      - Source + Source

      flag(pid, flag, value) @@ -299,35 +294,35 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#process_flag-3 for more info.

      - Source + Source

      get()

      Returns all key-values in the dictionary.

      - Source + Source

      get(key, default // nil)

      Returns the value for the given key.

      - Source + Source

      get_keys(value)

      Returns all keys that have the given value.

      - Source + Source

      group_leader()

      Returns the pid of the group leader for the process which evaluates the function.

      - Source + Source

      group_leader(leader, pid) @@ -335,7 +330,7 @@

      Examples

      Sets the group leader of Pid to GroupLeader. Typically, this is used when a processes started from a certain shell should have another group leader than :init.

      - Source + Source

      info(pid) @@ -345,7 +340,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#process_info-1 for more info.

      - Source + Source

      info(pid, spec) @@ -355,7 +350,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#process_info-2 for more info.

      - Source + Source

      link(pid) @@ -365,7 +360,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#link-1 for more info.

      - Source + Source

      list() @@ -379,7 +374,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#processes-0 for more info.

      - Source + Source

      monitor(item) @@ -389,14 +384,14 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#monitor-2 for more info.

      - Source + Source

      put(key, value)

      Stores the given key-value in the process dictionary.

      - Source + Source

      register(pid, name) @@ -407,21 +402,14 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#register-2 for more info.

      - Source + Source

      registered()

      Returns a list of names which have been registered using register/2.

      - Source -
      -

      - self() -

      -

      Returns the current process.

      -
      - Source + Source

      spawn(fun) @@ -429,7 +417,7 @@

      Examples

      Returns the pid of a new process started by the application of fun. It behaves exactly the same as Kernel.spawn/1.

      - Source + Source

      spawn(fun, opts) @@ -439,7 +427,7 @@

      Examples

      It also accepts extra options, for the list of available options check http://www.erlang.org/doc/man/erlang.html#spawn_opt-2

      - Source + Source

      spawn(mod, fun, args) @@ -450,7 +438,7 @@

      Examples

      It behaves exactly the same as the Kernel.spawn/3 function.

      - Source + Source

      spawn(mod, fun, args, opts) @@ -462,7 +450,7 @@

      Examples

      It also accepts extra options, for the list of available options check http://www.erlang.org/doc/man/erlang.html#spawn_opt-4

      - Source + Source

      spawn_link(fun) @@ -471,7 +459,7 @@

      Examples

      A link is created between the calling process and the new process, atomically.

      - Source + Source

      spawn_link(mod, fun, args) @@ -480,7 +468,7 @@

      Examples

      module.function(args). A link is created between the calling process and the new process, atomically. Otherwise works like spawn/3.

      - Source + Source

      spawn_monitor(fun) @@ -488,7 +476,7 @@

      Examples

      Returns the pid of a new process started by the application of fun and reference for a monitor created to the new process.

      - Source + Source

      spawn_monitor(mod, fun, args) @@ -497,7 +485,7 @@

      Examples

      and the process is monitored at the same time. Returns the pid and a reference for the monitor. Otherwise works like spawn/3.

      - Source + Source

      unlink(pid) @@ -508,7 +496,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#unlink-1 for more info.

      - Source + Source

      unregister(name) @@ -517,7 +505,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#unregister-1 for more info.

      - Source + Source

      whereis(name) @@ -527,7 +515,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#whereis-1 for more info.

      - Source + Source diff --git a/docs/master/Protocol.UndefinedError.html b/docs/master/Protocol.UndefinedError.html index a0ff398dc..d3fc53420 100644 --- a/docs/master/Protocol.UndefinedError.html +++ b/docs/master/Protocol.UndefinedError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -76,7 +76,7 @@

      Functions

      message(exception)

      - Source + Source diff --git a/docs/master/Regex.html b/docs/master/Regex.html index 760503fd0..3c31a3b3a 100644 --- a/docs/master/Regex.html +++ b/docs/master/Regex.html @@ -173,7 +173,7 @@

      Examples

      Regex.captures %r/c(?<foo>d)/g, "abcd"  #=> [{:foo, ["d"]}]
       
      - Source + Source

      compile(source, options // "") @@ -191,7 +191,7 @@

      Examples

      Compiles the regular expression according to the given options. Fails with Regex.CompileError if the regex cannot be compiled.

      - Source + Source

      groups(arg1) @@ -203,7 +203,7 @@

      Examples

      Regex.groups %r/(?<foo>foo)/g #=> ["foo"]
       
      - Source + Source

      index(arg1, string) @@ -218,7 +218,7 @@

      Examples

      Regex.index %r/e/, "abcd" #=> nil
      - Source + Source

      match?(arg1, string) @@ -231,7 +231,7 @@

      Examples

      Regex.match? %r/foo/, "bar" #=> false
      - Source + Source

      opts(arg1) @@ -243,14 +243,14 @@

      Examples

      Regex.opts %r(foo)m #=> 'm'
       
      - Source + Source

      re_pattern(arg1)

      Returns the underlying re_pattern in the regular expression.

      - Source + Source

      replace(arg1, string, replacement, options // []) @@ -272,7 +272,7 @@

      Examples

      Regex.replace(%r/(b)/, "abc", "[\\1]") #=> "a[b]c"
      - Source + Source

      run(regex, string, options // []) @@ -286,7 +286,7 @@

      Examples

      Regex.run %r/e/, "abcd" #=> nil
      - Source + Source

      scan(regex, string, options // []) @@ -303,7 +303,7 @@

      Examples

      Regex.scan %r/e/, "abcd" #=> []
      - Source + Source

      source(arg1) @@ -315,7 +315,7 @@

      Examples

      Regex.source %r(foo) #=> "foo"
       
      - Source + Source

      split(regex, string, options // []) @@ -323,7 +323,7 @@

      Examples

      Split the given target in the number of parts specified. If no ammount of parts is given, it defaults to :infinity.

      - Source + Source
      diff --git a/docs/master/RuntimeError.html b/docs/master/RuntimeError.html index 17b6a9586..e577fdb95 100644 --- a/docs/master/RuntimeError.html +++ b/docs/master/RuntimeError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/master/SyntaxError.html b/docs/master/SyntaxError.html index 1ddb24bf4..f55b48af5 100644 --- a/docs/master/SyntaxError.html +++ b/docs/master/SyntaxError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -82,7 +82,7 @@

      Functions

      message(exception)

      - Source + Source diff --git a/docs/master/SystemLimitError.html b/docs/master/SystemLimitError.html index 7265a4da8..e7c034a60 100644 --- a/docs/master/SystemLimitError.html +++ b/docs/master/SystemLimitError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/master/TokenMissingError.html b/docs/master/TokenMissingError.html index 3c0a39bcd..1bd8d0775 100644 --- a/docs/master/TokenMissingError.html +++ b/docs/master/TokenMissingError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -82,7 +82,7 @@

      Functions

      message(exception)

      - Source + Source diff --git a/docs/master/UndefinedFunctionError.html b/docs/master/UndefinedFunctionError.html index 04665acbc..c39e2844b 100644 --- a/docs/master/UndefinedFunctionError.html +++ b/docs/master/UndefinedFunctionError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -82,7 +82,7 @@

      Functions

      message(exception)

      - Source + Source diff --git a/docs/master/modules_list.html b/docs/master/modules_list.html index fc68c6a5f..57f6e21d7 100644 --- a/docs/master/modules_list.html +++ b/docs/master/modules_list.html @@ -16,7 +16,7 @@
    2991. - -
    2992. - - - Binary.Dict - - Binary.Dict -
    2993. -
        - - -
      • - - new/0 - - Binary.Dict -
      • - -
      • - - new/1 - - Binary.Dict -
      • - -
      • - - new/2 - - Binary.Dict -
      • -
    2994. @@ -1146,6 +1114,45 @@

      ExUnit.CLIFormatter

    2995. + +
    2996. + + + Callbacks + + ExUnit.Callbacks +
    2997. +
    2998. @@ -1159,11 +1166,29 @@

    2999. - test/2 + test/3 ExUnit.Case
    3000. + +
    3001. + + + CaseTemplate + + ExUnit.CaseTemplate +
    3002. +
        + + +
      • + + using/2 + + ExUnit.CaseTemplate +
      • +
    3003. @@ -1220,13 +1245,6 @@

      -
    3004. - - after_spawn/1 - - ExUnit -
    3005. -
    3006. configure/1 @@ -1961,7 +1979,375 @@

      IO

    3007. @@ -2463,13 +2849,6 @@

      Kernel

    3008. -
    3009. - - />/2 - - Kernel -
    3010. -
    3011. </2 @@ -4591,6 +4970,20 @@

      +
    3012. + + + Tasks.Compile.Leex + + Mix.Tasks.Compile.Leex +
    3013. +
        + + +
      • + + run/1 + + Mix.Tasks.Compile.Leex +
      • + +
      +
    3014. + + + Tasks.Compile.Yecc + + Mix.Tasks.Compile.Yecc +
    3015. +
        + + +
      • + + run/1 + + Mix.Tasks.Compile.Yecc +
      • +
    3016. @@ -5245,6 +5681,13 @@

      Node

    3017. +
    3018. + + connect/1 + + Node +
    3019. +
    3020. disconnect/1 @@ -5354,38 +5797,6 @@

      OptionParser

    3021. - -
    3022. - - - OrdDict - - OrdDict -
    3023. -
        - - -
      • - - new/0 - - OrdDict -
      • - -
      • - - new/1 - - OrdDict -
      • - -
      • - - new/2 - - OrdDict -
      • -
    3024. @@ -5741,13 +6152,6 @@

      Process

    3025. -
    3026. - - self/0 - - Process -
    3027. -
    3028. spawn/1 diff --git a/docs/master/protocols_list.html b/docs/master/protocols_list.html index 6e20e63b2..fb603231f 100644 --- a/docs/master/protocols_list.html +++ b/docs/master/protocols_list.html @@ -16,7 +16,7 @@
    3029. - -
    3030. - - - Binary.Dict - - Access.Binary.Dict -
    3031. -
        - - -
      • - - access/2 - - Access.Binary.Dict -
      • -
    3032. @@ -130,24 +112,6 @@

      Access.List

    3033. - -
    3034. - - - OrdDict - - Access.OrdDict -
    3035. -
        - - -
      • - - access/2 - - Access.OrdDict -
      • -
      @@ -492,31 +456,6 @@

      • - - - Binary.Dict - - Enum.Iterator.Binary.Dict -
      • -
          - - -
        • - - count/1 - - Enum.Iterator.Binary.Dict -
        • - -
        • - - iterator/1 - - Enum.Iterator.Binary.Dict -
        • - -
        -
      • Function @@ -590,31 +529,6 @@

        Enum.Iterator.List

      • -
      -
    3036. - - - OrdDict - - Enum.Iterator.OrdDict -
    3037. -
        - - -
      • - - count/1 - - Enum.Iterator.OrdDict -
      • - -
      • - - iterator/1 - - Enum.Iterator.OrdDict -
      • -
    3038. diff --git a/docs/master/records_list.html b/docs/master/records_list.html index 08c77a5de..1e06e3fdc 100644 --- a/docs/master/records_list.html +++ b/docs/master/records_list.html @@ -16,7 +16,7 @@

      - Elixir v0.8.0 + Elixir v0.8.1

      diff --git a/docs/stable/Access.OrdDict.html b/docs/stable/Access.OrdDict.html deleted file mode 100644 index 4d64bd824..000000000 --- a/docs/stable/Access.OrdDict.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - Access.OrdDict - - - - - - - - - - - - -
      -

      - Access.OrdDict - - impl - -

      - - - - Source - - - - - - -

      Functions summary

      - - - - - - - - -
      -

      Functions

      -
      -

      - access(dict, key) -

      -
      - Source -
      -
      - - - - - -
      - - diff --git a/docs/stable/Access.html b/docs/stable/Access.html index 7e5b75936..05836aec8 100644 --- a/docs/stable/Access.html +++ b/docs/stable/Access.html @@ -52,12 +52,6 @@

      Implementations

    3039. -
    3040. - - Binary.Dict - -
    3041. -
    3042. Function @@ -76,12 +70,6 @@

      Implementations

    3043. -
    3044. - - OrdDict - -
    3045. - diff --git a/docs/stable/ArgumentError.html b/docs/stable/ArgumentError.html index 55e962cf7..d0dc3d7b6 100644 --- a/docs/stable/ArgumentError.html +++ b/docs/stable/ArgumentError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/stable/ArithmeticError.html b/docs/stable/ArithmeticError.html index 803ab5bc5..57ba46960 100644 --- a/docs/stable/ArithmeticError.html +++ b/docs/stable/ArithmeticError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/stable/BadArityError.html b/docs/stable/BadArityError.html index 490017446..610242362 100644 --- a/docs/stable/BadArityError.html +++ b/docs/stable/BadArityError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -76,7 +76,7 @@

      Functions

      message(exception)

      - Source + Source diff --git a/docs/stable/BadFunctionError.html b/docs/stable/BadFunctionError.html index d52162522..f797d80fc 100644 --- a/docs/stable/BadFunctionError.html +++ b/docs/stable/BadFunctionError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -70,7 +70,7 @@

      Functions

      message(exception)

      - Source + Source diff --git a/docs/stable/Binary.Dict.html b/docs/stable/Binary.Dict.html deleted file mode 100644 index 2a71f9abf..000000000 --- a/docs/stable/Binary.Dict.html +++ /dev/null @@ -1,117 +0,0 @@ - - - - Binary.Dict - - - - - - - - - - - - -
      -

      - Binary.Dict - -

      - - -
      -

      This module implements a dictionary that forces the keys to be -converted to binaries on insertion. Currently it is implemented -using an OrdDict, but this may change in the future.

      - -

      Check the Dict module for examples and documentation.

      - -
      - - - Source - - - - - - -

      Functions summary

      - - - - - - - - -
      -

      Functions

      -
      -

      - new() -

      -

      Creates a new empty dict.

      -
      - Source -
      -

      - new(pairs) -

      -

      Creates a new dict from a list of pairs.

      - -

      Examples

      - -
      Binary.Dict.new [{:b,1},{:a,2}]
      -#=> [a: 1, b: 2]
      -
      -
      - Source -
      -

      - new(list, transform) -

      -

      Creates a new dict from a list of elements with the -help of the transformation function.

      - -

      Examples

      - -
      Binary.Dict.new ["a", "b"], fn x -> {x, x} end
      -#=> ["a": "a", "b": "b"]
      -
      -
      - Source -
      -
      - - - - - -
      - - diff --git a/docs/stable/Binary.Inspect.Function.html b/docs/stable/Binary.Inspect.Function.html index 7abed6af3..594a95d4d 100644 --- a/docs/stable/Binary.Inspect.Function.html +++ b/docs/stable/Binary.Inspect.Function.html @@ -34,7 +34,7 @@

      - Source + Source @@ -64,7 +64,7 @@

      Functions

      inspect(function, _opts)

      - Source + Source diff --git a/docs/stable/Binary.Inspect.HashDict.html b/docs/stable/Binary.Inspect.HashDict.html index 05a0523ec..8310a21b1 100644 --- a/docs/stable/Binary.Inspect.HashDict.html +++ b/docs/stable/Binary.Inspect.HashDict.html @@ -29,7 +29,7 @@

      - Source + Source @@ -59,7 +59,7 @@

      Functions

      inspect(dict, opts)

      - Source + Source diff --git a/docs/stable/Binary.Inspect.Number.html b/docs/stable/Binary.Inspect.Number.html index 19ba12507..71c96d6f9 100644 --- a/docs/stable/Binary.Inspect.Number.html +++ b/docs/stable/Binary.Inspect.Number.html @@ -39,7 +39,7 @@

      Examples

      - Source + Source @@ -69,7 +69,7 @@

      Functions

      inspect(thing, _)

      - Source + Source diff --git a/docs/stable/Binary.Inspect.PID.html b/docs/stable/Binary.Inspect.PID.html index 014f2b907..523c5e439 100644 --- a/docs/stable/Binary.Inspect.PID.html +++ b/docs/stable/Binary.Inspect.PID.html @@ -34,7 +34,7 @@

      - Source + Source @@ -64,7 +64,7 @@

      Functions

      inspect(pid, _)

      - Source + Source diff --git a/docs/stable/Binary.Inspect.Port.html b/docs/stable/Binary.Inspect.Port.html index 704f6c138..8aafdc3d8 100644 --- a/docs/stable/Binary.Inspect.Port.html +++ b/docs/stable/Binary.Inspect.Port.html @@ -34,7 +34,7 @@

      - Source + Source @@ -64,7 +64,7 @@

      Functions

      inspect(port, _)

      - Source + Source diff --git a/docs/stable/Binary.Inspect.Reference.html b/docs/stable/Binary.Inspect.Reference.html index 75e428bc4..68be56e93 100644 --- a/docs/stable/Binary.Inspect.Reference.html +++ b/docs/stable/Binary.Inspect.Reference.html @@ -34,7 +34,7 @@

      - Source + Source @@ -64,7 +64,7 @@

      Functions

      inspect(ref, _)

      - Source + Source diff --git a/docs/stable/Binary.Inspect.Regex.html b/docs/stable/Binary.Inspect.Regex.html index f25b1e48d..78be58370 100644 --- a/docs/stable/Binary.Inspect.Regex.html +++ b/docs/stable/Binary.Inspect.Regex.html @@ -39,7 +39,7 @@

      Examples

      - Source + Source @@ -69,7 +69,7 @@

      Functions

      inspect(regex, opts)

      - Source + Source diff --git a/docs/stable/Binary.Inspect.Tuple.html b/docs/stable/Binary.Inspect.Tuple.html index 5d007c6e8..871a750c5 100644 --- a/docs/stable/Binary.Inspect.Tuple.html +++ b/docs/stable/Binary.Inspect.Tuple.html @@ -41,7 +41,7 @@

      Examples

      - Source + Source @@ -71,7 +71,7 @@

      Functions

      inspect(tuple, opts)

      - Source + Source diff --git a/docs/stable/CaseClauseError.html b/docs/stable/CaseClauseError.html index 5e01b7caf..baf5b128a 100644 --- a/docs/stable/CaseClauseError.html +++ b/docs/stable/CaseClauseError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -70,7 +70,7 @@

      Functions

      message(exception)

      - Source + Source diff --git a/docs/stable/CompileError.html b/docs/stable/CompileError.html index d8af90bc2..4adb8976b 100644 --- a/docs/stable/CompileError.html +++ b/docs/stable/CompileError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -82,7 +82,7 @@

      Functions

      message(exception)

      - Source + Source diff --git a/docs/stable/Enum.Iterator.Binary.Dict.html b/docs/stable/Enum.Iterator.Binary.Dict.html deleted file mode 100644 index 3aac32d21..000000000 --- a/docs/stable/Enum.Iterator.Binary.Dict.html +++ /dev/null @@ -1,83 +0,0 @@ - - - - Enum.Iterator.Binary.Dict - - - - - - - - - - - - -
      -

      - Enum.Iterator.Binary.Dict - - impl - -

      - - - - Source - - - - - - -

      Functions summary

      - - - - - - - - -
      -

      Functions

      -
      -

      - count(arg1) -

      -
      - Source -
      -

      - iterator(arg1) -

      -
      - Source -
      -
      - - - - - -
      - - diff --git a/docs/stable/Enum.Iterator.HashDict.html b/docs/stable/Enum.Iterator.HashDict.html index 8b507ebd6..151f5e591 100644 --- a/docs/stable/Enum.Iterator.HashDict.html +++ b/docs/stable/Enum.Iterator.HashDict.html @@ -29,7 +29,7 @@

      - Source + Source @@ -64,13 +64,13 @@

      Functions

      count(dict)

      - Source + Source

      iterator(dict)

      - Source + Source
      diff --git a/docs/stable/Enum.Iterator.Orddict.html b/docs/stable/Enum.Iterator.Orddict.html deleted file mode 100644 index 59ee6956c..000000000 --- a/docs/stable/Enum.Iterator.Orddict.html +++ /dev/null @@ -1,83 +0,0 @@ - - - - Enum.Iterator.OrdDict - - - - - - - - - - - - -
      -

      - Enum.Iterator.OrdDict - - impl - -

      - - - - Source - - - - - - -

      Functions summary

      - - - - - - - - -
      -

      Functions

      -
      -

      - count(arg1) -

      -
      - Source -
      -

      - iterator(arg1) -

      -
      - Source -
      -
      - - - - - -
      - - diff --git a/docs/stable/Enum.Iterator.html b/docs/stable/Enum.Iterator.html index 4847353f7..3e480e06d 100644 --- a/docs/stable/Enum.Iterator.html +++ b/docs/stable/Enum.Iterator.html @@ -51,12 +51,6 @@

      Implementations

        -
      • - - Binary.Dict - -
      • -
      • Function @@ -75,12 +69,6 @@

        Implementations

      • -
      • - - OrdDict - -
      • -
      • Range diff --git a/docs/stable/Enum.OutOfBoundsError.html b/docs/stable/Enum.OutOfBoundsError.html index c5e344942..2e3de19ca 100644 --- a/docs/stable/Enum.OutOfBoundsError.html +++ b/docs/stable/Enum.OutOfBoundsError.html @@ -29,7 +29,7 @@

        - Source + Source diff --git a/docs/stable/ErlangError.html b/docs/stable/ErlangError.html index c68f65886..aa5f9bbad 100644 --- a/docs/stable/ErlangError.html +++ b/docs/stable/ErlangError.html @@ -29,7 +29,7 @@

        - Source + Source @@ -70,7 +70,7 @@

        Functions

        message(exception)

        - Source + Source diff --git a/docs/stable/ExUnit.Callbacks.html b/docs/stable/ExUnit.Callbacks.html new file mode 100644 index 000000000..3e645f943 --- /dev/null +++ b/docs/stable/ExUnit.Callbacks.html @@ -0,0 +1,149 @@ + + + + ExUnit.Callbacks + + + + + + + + + + + + +
        +

        + ExUnit.Callbacks + +

        + + +
        +

        This module defines four callbacks: setup_all, teardown_all, +setup and teardown. Those callbacks are defined via macros +and receives a keyword list of metadata. The callback may +optionally define extra data which will be available in the test +cases.

        + +

        Examples

        + +
        defmodule AssertionTest do
        +  use ExUnit.Case, async: true
        +
        +  setup do
        +    IO.puts "This is a setup callback"
        +
        +    # Returns extra metadata
        +    { :ok, [hello: "world"] }
        +  end
        +
        +  setup context do
        +    # We can access the test name in the context
        +    IO.puts "Setting up: #{context[:test]}"
        +
        +    # The metadata returned by the previous setup as well
        +    assert context[:hello] == "world"
        +
        +    # No metadata
        +    :ok
        +  end
        +
        +  test "always pass" do
        +    assert true
        +  end
        +end
        +
        + +
        + + + Source + + + + + + + + +

        Macros summary

        + + + + + + + + +
        +

        Macros

        +
        +

        + setup(var // quote() do + _ +end, block) +

        +
        + Source +
        +

        + setup_all(var // quote() do + _ +end, block) +

        +
        + Source +
        +

        + teardown(var // quote() do + _ +end, block) +

        +
        + Source +
        +

        + teardown_all(var // quote() do + _ +end, block) +

        +
        + Source +
        +
        + + + +
        + + diff --git a/docs/stable/ExUnit.Case.html b/docs/stable/ExUnit.Case.html index 3a1845126..55b9af469 100644 --- a/docs/stable/ExUnit.Case.html +++ b/docs/stable/ExUnit.Case.html @@ -38,36 +38,21 @@

        when your test cases do not change any global state;

      -

      Callbacks

      - -

      ExUnit.Case defines four callbacks:

      - -
        -
      • setup_all() and teardown_all(context) which are executed -before and after all tests respectively;
      • -
      • setup(context, test) and teardown(context, test) which are -executed before and after each test, receiving the test name -as argument;
      • -
      - -

      Such callbacks are useful to clean up any side-effect a test may cause, -as for example, state in genservers, data on filesystem, or entries in -a database. Data can be passed in between such callbacks as context, -the context value returned by setup_all is passed down to all other -callbacks. The value can then be updated in setup which is passed -down to teardown.

      +

      This module automatically includes all callbacks defined +in ExUnit.Callbacks. Read it for more information.

      Examples

      -
      defmodule AssertionTest do
      -  use ExUnit.Case, async: true
      +

      defmodule AssertionTest do + use ExUnit.Case, async: true

      - def test_always_pass - assert true - end -end +
       def test_always_pass
      +   assert true
      + end
       
      +

      end

      + @@ -84,7 +69,7 @@

      Macros summary

      • - test/2 + test/3
      • @@ -99,8 +84,10 @@

        Macros summary

        Macros

        -

        - test(message, contents) +

        + test(message, var // quote() do + _ +end, contents)

        Provides a convenient macro that allows a test to be defined with a string. This macro automatically inserts @@ -116,7 +103,7 @@

        Examples

        end
      - Source + Source diff --git a/docs/stable/ExUnit.CaseTemplate.html b/docs/stable/ExUnit.CaseTemplate.html new file mode 100644 index 000000000..411a3a62d --- /dev/null +++ b/docs/stable/ExUnit.CaseTemplate.html @@ -0,0 +1,104 @@ + + + + ExUnit.CaseTemplate + + + + + + + + + + + + +
      +

      + ExUnit.CaseTemplate + +

      + + +
      +

      This module allows a developer to define a test case +template to be used throughout his tests. This is useful +when there are a set of functions that should be shared +between tests or a set of setup/teardown callbacks.

      + +

      By using this module, the callbacks and assertions +available for regular test cases will also be available.

      + +

      Example

      + +
      defmodule MyCase do
      +  use ExUnit.CaseTemplate
      +
      +  setup do
      +    IO.puts "This will run before each test that uses this case"
      +  end
      +end
      +
      +defmodule MyTest do
      +  use MyCase, async: true
      +
      +  test "truth" do
      +    assert true
      +  end
      +end
      +
      + +
      + + + Source + + + + + + + + +

      Macros summary

      + + + + + + + + +
      +

      Macros

      +
      +

      + using(var // quote() do + _ +end, list2) +

      +

      Allows a developer to code to be invoked when +this module is used.

      +
      + Source +
      +
      + + + +
      + + diff --git a/docs/stable/ExUnit.html b/docs/stable/ExUnit.html index 662c10e92..ebaadefef 100644 --- a/docs/stable/ExUnit.html +++ b/docs/stable/ExUnit.html @@ -40,11 +40,13 @@

      Example

      # 2) Next we create a new TestCase and use ExUnit.Case defmodule AssertionTest do - # 3) Notice we pass async: true, this runs the test case in parallel + # 3) Notice we pass async: true, this runs the test case + # concurrently with other test cases use ExUnit.Case, async: true - # 4) A test is a method which name finishes with _test - def test_always_pass do + # 4) A test is a function whose name starts with + # test and receives a context + def test_always_pass(_) do assert true end @@ -62,9 +64,13 @@

      Example

      bin/elixir assertion_test.exs
       
      -

      Assertions

      +

      Case, callbacks and assertions

      -

      Check ExUnit.Assertions for assertions documentation.

      +

      Check ExUnit.Case and ExUnit.Callbacks for more information about +defining test cases.

      + +

      The ExUnit.Assertions module contains a set of macros to easily +generate assertions with appropriate error messages.

      User config

      @@ -99,11 +105,6 @@

      User config

      Functions summary

      • - - after_spawn/1 - -
      • -
      • configure/1 @@ -140,14 +141,6 @@

        Functions summary

        Functions

        -

        - after_spawn(callback) -

        -

        Registers a callback to be invoked every time a -new ExUnit process is spawned.

        -
        - Source -

        configure(options)

        @@ -164,7 +157,7 @@

        Options

        Defaults to :erlang.system_info(:schedulers_online);

      - Source + Source

      run() @@ -174,7 +167,7 @@

      Options

      Returns the number of failures.

      - Source + Source

      start(options // []) @@ -186,7 +179,7 @@

      Options

      In case you want to run tests manually, skip calling this function and rely on configure/1 and run/0 instead.

      - Source + Source

      stop(_state) @@ -199,7 +192,7 @@

      Options

      Returns the configured user options.

      - Source + Source
      diff --git a/docs/stable/Exception.html b/docs/stable/Exception.html index 2d3e5066e..7c650f79d 100644 --- a/docs/stable/Exception.html +++ b/docs/stable/Exception.html @@ -92,7 +92,7 @@

      Functions

      format_file_line(file, line, cwd)

      - Source + Source

      format_stacktrace(trace // nil) @@ -123,7 +123,7 @@

      Functions

      calculates the current stacktrace and formats it. As consequence, the value of System.stacktrace is changed.

      - Source + Source diff --git a/docs/stable/File.html b/docs/stable/File.html index 9840a74ec..d921f1233 100644 --- a/docs/stable/File.html +++ b/docs/stable/File.html @@ -35,7 +35,7 @@

      In order to write and read files, one must use the functions in the IO module. By default, a file is -opened on binary mode which requires the functions +opened in binary mode which requires the functions IO.binread, IO.binwrite and IO.binreadline to interact with the file. A developer may pass :utf8 as an option when opening the file and then all other @@ -330,7 +330,7 @@

      Functions

      be passed into Enum to iterate line by line as a binary. Check iterator/1 for more information.

      - Source + Source

      biniterator(file, mode) @@ -339,7 +339,7 @@

      Functions

      returns its biniterator. Fails for the same reasons as File.open.

      - Source + Source

      biniterator!(file, mode // []) @@ -347,7 +347,7 @@

      Functions

      Same as biniterator/2 but raises if the file cannot be opened.

      - Source + Source

      cd(path) @@ -355,14 +355,14 @@

      Functions

      Sets the current working directory. Returns :ok if successful, { :error, reason } otherwise.

      - Source + Source

      cd!(path)

      The same as cd/0, but raises an exception if it fails.

      - Source + Source

      cd!(path, function) @@ -374,7 +374,7 @@

      Functions

      Raises an error if retrieving or changing the current directory fails.

      - Source + Source

      close(io_device) @@ -386,7 +386,7 @@

      Functions

      close/1 might return an old write error and not even try to close the file. See open/2.

      - Source + Source

      copy(source, destination, bytes_count // :infinity) @@ -405,7 +405,7 @@

      Functions

      Typical error reasons are the same as in open/2, read/1 and write/2.

      - Source + Source

      copy!(source, destination, bytes_count // :infinity) @@ -413,7 +413,7 @@

      Functions

      The same as copy/3 but raises an File.CopyError if it fails. Returns the bytes_copied otherwise.

      - Source + Source

      cp(source, destination, callback // fn _, _ -> true end) @@ -436,7 +436,7 @@

      Functions

      It returns :ok in case of success, returns { :error, reason } otherwise.

      - Source + Source

      cp!(source, destination, callback // fn _, _ -> true end) @@ -444,7 +444,7 @@

      Functions

      The same as cp/3, but raises File.CopyError if it fails. Returns the list of copied files otherwise.

      - Source + Source

      cp_r(source, destination, callback // fn _, _ -> true end) @@ -494,7 +494,7 @@

      Examples

      end
      - Source + Source

      cp_r!(source, destination, callback // fn _, _ -> true end) @@ -502,7 +502,7 @@

      Examples

      The same as cp_r/3, but raises File.CopyError if it fails. Returns the list of copied files otherwise.

      - Source + Source

      cwd() @@ -512,21 +512,21 @@

      Examples

      directories of the current directory. For this reason, returns { :ok, cwd } in case of success, { :error, reason } otherwise.

      - Source + Source

      cwd!()

      The same as cwd/0, but raises an exception if it fails.

      - Source + Source

      dir?(path)

      Returns true if the path is a directory.

      - Source + Source

      exists?(path) @@ -547,7 +547,7 @@

      Examples

      #=> true
      - Source + Source

      iterator(device) @@ -573,7 +573,7 @@

      Examples

      end
      - Source + Source

      iterator(file, mode) @@ -582,7 +582,7 @@

      Examples

      returns its iterator. Fails for the same reasons as File.open.

      - Source + Source

      iterator!(file, mode // []) @@ -590,7 +590,7 @@

      Examples

      Same as iterator/2 but raises if the file cannot be opened.

      - Source + Source

      mkdir(path) @@ -609,14 +609,14 @@

      Examples

      On some platforms, :enoent is returned instead.
    3046. - Source + Source

      mkdir!(path)

      Same as mkdir, but raises an exception in case of failure. Otherwise :ok.

      - Source + Source

      mkdir_p(path) @@ -632,21 +632,27 @@

      Examples

    3047. :enotdir - A component of path is not a directory.
    3048. - Source + Source

      mkdir_p!(path)

      Same as mkdir_p, but raises an exception in case of failure. Otherwise :ok.

      - Source + Source

      open(path, modes // [])

      Opens the given path according to the given list of modes.

      -

      By default, the file is opened in read mode, as a binary with utf8 encoding.

      +

      In order to write and read files, one must use the functions +in the IO module. By default, a file is opened in binary mode +which requires the functions IO.binread, IO.binwrite and +IO.binreadline to interact with the file. A developer may pass +:utf8 as an option when opening the file and then all other +functions from IO are available, since they work directly with +Unicode data.

      The allowed modes:

      @@ -694,7 +700,7 @@

      Examples

      File.close(file)
      - Source + Source

      open(path, modes, function) @@ -719,7 +725,7 @@

      Examples

      end)
      - Source + Source

      open!(path, modes // []) @@ -727,7 +733,7 @@

      Examples

      Same as open/2 but raises an error if file could not be opened. Returns the io_device otherwise.

      - Source + Source

      open!(path, modes, function) @@ -735,7 +741,7 @@

      Examples

      Same as open/3 but raises an error if file could not be opened. Returns the function result otherwise.

      - Source + Source

      read(path) @@ -757,7 +763,7 @@

      Examples

      You can use :file.format_error(reason) to get a descriptive string of the error.

      - Source + Source

      read!(path) @@ -765,7 +771,7 @@

      Examples

      Returns binary with the contents of the given filename or raises File.Error if an error occurs.

      - Source + Source

      regular?(path) @@ -777,7 +783,7 @@

      Examples

      File.regular? __FILE__ #=> true
       
      - Source + Source

      rm(path) @@ -805,14 +811,14 @@

      Examples

      #=> {:error, :eperm}
      - Source + Source

      rm!(path)

      Same as rm, but raises an exception in case of failure. Otherwise :ok.

      - Source + Source

      rm_rf(path) @@ -834,7 +840,7 @@

      Examples

      #=> { :ok, [] }
      - Source + Source

      rm_rf!(path) @@ -842,7 +848,7 @@

      Examples

      Same as rm_rf/1 but raises File.Error in case of failures, otherwise the list of files or directories removed.

      - Source + Source

      rmdir(path) @@ -859,14 +865,14 @@

      Examples

      #=> {:error, :enotdir}
      - Source + Source

      rmdir!(path)

      Same as rmdir/1, but raises an exception in case of failure. Otherwise :ok.

      - Source + Source

      stat(path, opts // []) @@ -885,7 +891,7 @@

      Options

      Default is local.

    3049. - Source + Source

      stat!(path, opts // []) @@ -893,7 +899,7 @@

      Options

      Same as stat but returns the File.Stat directly and throws File.Error if an error is returned.

      - Source + Source

      touch(path, time // :calendar.local_time()) @@ -901,7 +907,7 @@

      Options

      Updates modification time (mtime) and access time (atime) of the given file. File is created if it doesn’t exist.

      - Source + Source

      touch!(path, time // :calendar.local_time()) @@ -909,7 +915,7 @@

      Options

      Same as touch/1 but raises an exception if it fails. Returns :ok otherwise.

      - Source + Source

      write(path, content, modes // []) @@ -929,14 +935,14 @@

      Options

    3050. :eisdir - The named file is a directory.
    3051. - Source + Source

      write!(path, content, modes // [])

      Same as write/3 but raises an exception if it fails, returns :ok otherwise.

      - Source + Source

      write_stat(path, stat, opts // []) @@ -944,7 +950,7 @@

      Options

      Writes the given File.Stat back to the filesystem at the given path. Returns :ok or { :error, reason }.

      - Source + Source

      write_stat!(path, stat, opts // []) @@ -952,7 +958,7 @@

      Options

      Same as write_stat/3 but raises an exception if it fails. Returns :ok otherwise.

      - Source + Source
      diff --git a/docs/stable/FunctionClauseError.html b/docs/stable/FunctionClauseError.html index 7125199dd..32cd76236 100644 --- a/docs/stable/FunctionClauseError.html +++ b/docs/stable/FunctionClauseError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -82,7 +82,7 @@

      Functions

      message(exception)

      - Source + Source diff --git a/docs/stable/HashDict.html b/docs/stable/HashDict.html index d3adf03d4..50c32bcc3 100644 --- a/docs/stable/HashDict.html +++ b/docs/stable/HashDict.html @@ -148,21 +148,21 @@

      Functions

      Deletes a value from the dict.

      - Source + Source

      empty(_)

      Returns an empty dict.

      - Source + Source

      get(dict, key, default // nil)

      Gets the value under key from the dict.

      - Source + Source

      get!(dict, key) @@ -170,35 +170,35 @@

      Functions

      Gets the value under key from the dict, raises KeyError if such key does not exist.

      - Source + Source

      has_key?(dict, key)

      Checks if the dict has the given key.

      - Source + Source

      keys(dict)

      Get all keys in the dict.

      - Source + Source

      merge(dict, enum, callback // fn _k, _v1, v2 -> v2 end)

      Merges two dictionaries.

      - Source + Source

      new()

      Creates a new empty dict.

      - Source + Source

      new(pairs) @@ -211,7 +211,7 @@

      Examples

      #=> HashDict[a: 1, b: 2]
      - Source + Source

      new(list, transform) @@ -225,14 +225,14 @@

      Examples

      #=> HashDict[{ "a", "a" }, { "b", "b" }]
      - Source + Source

      put(dict, key, value)

      Puts the given key and value in the dict.

      - Source + Source

      put_new(dict, key, value) @@ -240,21 +240,21 @@

      Examples

      Puts the given value under key in the dictionary only if one does not exist yet.

      - Source + Source

      size(dict)

      Returns the dict size.

      - Source + Source

      to_list(dict)

      Converts the dict to a list.

      - Source + Source

      update(dict, key, fun) @@ -263,7 +263,7 @@

      Examples

      to the given function. Raises if the key does not exist in the dictionary.

      - Source + Source

      update(dict, key, initial, fun) @@ -272,14 +272,14 @@

      Examples

      to the given function. Adds initial value if the key does not exist in the dicionary.

      - Source + Source

      values(dict)

      Get all values in the dict.

      - Source + Source
      diff --git a/docs/stable/IO.ANSI.html b/docs/stable/IO.ANSI.html new file mode 100644 index 000000000..ccb191541 --- /dev/null +++ b/docs/stable/IO.ANSI.html @@ -0,0 +1,719 @@ + + + + IO.ANSI + + + + + + + + + + + + +
      +

      + IO.ANSI + +

      + + +
      +

      This module provides functionality to render ANSI escape sequences +(http://en.wikipedia.org/wiki/ANSI_escape_code) — characters embedded +in the text used to control formatting, color, and other output options +on video text terminals.

      + +

      Please be aware that in Erlang/OTP versions prior to R16, you will not +be able to render ANSI escape sequences in iex or erlang shell

      + +
      + + + Source + + + + + + +

      Functions summary

      + + + + + + + + +
      +

      Functions

      +
      +

      + black() +

      +

      Sets foreground color to black

      +
      + Source +
      +

      + black_background() +

      +

      Sets background color to black

      +
      + Source +
      + +

      Blink: off

      +
      + Source +
      + +

      Blink: Rapid. MS-DOS ANSI.SYS; 150 per minute or more; not widely supported

      +
      + Source +
      + +

      Blink: Slow. Less than 150 per minute

      +
      + Source +
      +

      + blue() +

      +

      Sets foreground color to blue

      +
      + Source +
      +

      + blue_background() +

      +

      Sets background color to blue

      +
      + Source +
      +

      + bright() +

      +

      Bright (increased intensity) or Bold

      +
      + Source +
      +

      + conceal() +

      +

      Conceal. Not widely supported

      +
      + Source +
      +

      + crossed_out() +

      +

      Crossed-out. Characters legible, but marked for deletion. Not widely supported.

      +
      + Source +
      +

      + cyan() +

      +

      Sets foreground color to cyan

      +
      + Source +
      +

      + cyan_background() +

      +

      Sets background color to cyan

      +
      + Source +
      +

      + default_background() +

      +

      Default background color

      +
      + Source +
      +

      + default_color() +

      +

      Default text color

      +
      + Source +
      +

      + encircled() +

      +

      Encircled

      +
      + Source +
      +

      + escape(string, emit // terminal?()) +

      +

      Escapes a string coverting named ANSI sequences into actual ANSI codes.

      + +

      The format for referring sequences is %{red} and %{red,bright} (for +multiple sequences)

      + +

      It will also force a %{reset} to get appended to every string. If you don't +want this behaviour, use escape_fragment/1 and escape_fragment/2.

      + +

      An optional boolean parameter can be passed to enable or disable +emitting actual ANSI codes. When false, no ANSI codes will emitted. +By default, standard output will be checked if it is a terminal capable +of handling these sequences (using terminal?/0 function)

      + +

      Example

      + +

      IO.ANSI.escape "Hello %{red,bright,green}yes" #=> + "Hello \e[31m\e[1m\e[32myes\e[0m"

      +
      + Source +
      +

      + escape_fragment(string, emit // terminal?()) +

      +

      Escapes a string coverting named ANSI sequences into actual ANSI codes.

      + +

      The format for referring sequences is %{red} and %{red,bright} (for +multiple sequences)

      + +

      An optional boolean parameter can be passed to enable or disable +emitting actual ANSI codes. When false, no ANSI codes will emitted. +By default, standard output will be checked if it is a terminal capable +of handling these sequences (using terminal?/0 function)

      + +

      Example

      + +

      IO.ANSI.escape "Hello %{red,bright,green}yes%{reset}" #=> + "Hello \e[31m\e[1m\e[32myes\e[0m"

      +
      + Source +
      +

      + faint() +

      +

      Faint (decreased intensity), not widely supported

      +
      + Source +
      +

      + font_1() +

      +

      Sets alternative font 1

      +
      + Source +
      +

      + font_2() +

      +

      Sets alternative font 2

      +
      + Source +
      +

      + font_3() +

      +

      Sets alternative font 3

      +
      + Source +
      +

      + font_4() +

      +

      Sets alternative font 4

      +
      + Source +
      +

      + font_5() +

      +

      Sets alternative font 5

      +
      + Source +
      +

      + font_6() +

      +

      Sets alternative font 6

      +
      + Source +
      +

      + font_7() +

      +

      Sets alternative font 7

      +
      + Source +
      +

      + font_8() +

      +

      Sets alternative font 8

      +
      + Source +
      +

      + font_9() +

      +

      Sets alternative font 9

      +
      + Source +
      +

      + framed() +

      +

      Framed

      +
      + Source +
      +

      + green() +

      +

      Sets foreground color to green

      +
      + Source +
      +

      + green_background() +

      +

      Sets background color to green

      +
      + Source +
      +

      + inverse() +

      +

      Image: Negative. Swap foreground and background

      +
      + Source +
      +

      + italic() +

      +

      Italic: on. Not widely supported. Sometimes treated as inverse.

      +
      + Source +
      +

      + magenta() +

      +

      Sets foreground color to magenta

      +
      + Source +
      +

      + magenta_background() +

      +

      Sets background color to magenta

      +
      + Source +
      +

      + no_underline() +

      +

      Underline: None

      +
      + Source +
      +

      + normal() +

      +

      Normal color or intensity

      +
      + Source +
      +

      + not_framed_encircled() +

      +

      Not framed or encircled

      +
      + Source +
      +

      + not_italic() +

      +

      Not italic

      +
      + Source +
      +

      + not_overlined() +

      +

      Not overlined

      +
      + Source +
      +

      + overlined() +

      +

      Overlined

      +
      + Source +
      +

      + primary_font() +

      +

      Sets primary (default) font

      +
      + Source +
      +

      + red() +

      +

      Sets foreground color to red

      +
      + Source +
      +

      + red_background() +

      +

      Sets background color to red

      +
      + Source +
      +

      + reset() +

      +

      Resets all attributes

      +
      + Source +
      +

      + reverse() +

      +

      Image: Negative. Swap foreground and background

      +
      + Source +
      +

      + terminal?(device // :erlang.group_leader()) +

      +

      Checks whether the default I/O device is a terminal or a file.

      + +

      Used to identify whether printing ANSI escape sequences will likely +be printed as intended.

      + +

      Please note that invoked while in shell (iex) in Erlang/OTP +prior to R16, terminal?/0 will always return false because +Erlang shell did not support ANSI escape sequences up until +R16.

      +
      + Source +
      +

      + underline() +

      +

      Underline: Single

      +
      + Source +
      +

      + white() +

      +

      Sets foreground color to white

      +
      + Source +
      +

      + white_background() +

      +

      Sets background color to white

      +
      + Source +
      +

      + yellow() +

      +

      Sets foreground color to yellow

      +
      + Source +
      +

      + yellow_background() +

      +

      Sets background color to yellow

      +
      + Source +
      +
      + + + + + +
      + + diff --git a/docs/stable/IO.html b/docs/stable/IO.html index 369c6a166..502c43f03 100644 --- a/docs/stable/IO.html +++ b/docs/stable/IO.html @@ -84,6 +84,11 @@

      Functions summary

      gets/2 +
    3052. + + inspect/2 + +
    3053. inspect/3 @@ -122,37 +127,37 @@

      Functions summary

      Functions

      - binread(device // :stdio, count) + binread(device // group_leader(), count)

      Reads count bytes from the IO device as binary, no unicode conversion happens.

      Check read/2 for more information.

      - Source + Source

      - binreadline(device // :stdio) + binreadline(device // group_leader())

      Reads a line from the IO device as binary, no unicode conversion happens.

      Check readline/1 for more information.

      - Source + Source

      - binwrite(device // :stdio, item) + binwrite(device // group_leader(), item)

      Writes the given argument to the given device as a binary, no unicode conversion happens.

      Check write/2 for more information.

      - Source + Source

      - getb(device // :stdio, prompt, count // 1) + getb(device // group_leader(), prompt, count // 1)

      Gets count bytes from the IO device. It returns:

      @@ -164,10 +169,10 @@

      Functions

      NFS file system.

    3054. - Source + Source

      - gets(device // :stdio, prompt) + gets(device // group_leader(), prompt)

      Reads a line from the IO device. It returns:

      @@ -180,27 +185,39 @@

      Functions

      NFS file system.

      - Source + Source
      -

      - inspect(device // :stdio, item, opts // []) +

      + inspect(item, opts // [])

      Inspects and writes the given argument to the device -followed by a new line. Returns the item given.

      +followed by a new line. A set of options can be given.

      + +

      Examples

      + +
      IO.inspect Process.list
      +
      +
      + Source +
      +

      + inspect(device, item, opts) +

      +

      Inspects the item with options using the given device.

      - Source + Source

      - puts(device // :stdio, item) + puts(device // group_leader(), item)

      Writes the argument to the device, similarly to write but adds a new line at the end. The argument is expected to be a chardata.

      - Source + Source

      - read(device // :stdio, count) + read(device // group_leader(), count)

      Reads count bytes from the IO device. It returns:

      @@ -212,10 +229,10 @@

      Functions

      NFS file system.

      - Source + Source

      - readline(device // :stdio) + readline(device // group_leader())

      Reads a line from the IO device. It returns:

      @@ -230,10 +247,10 @@

      Functions

      This function does the same as gets/2, except the prompt is not required as argument.

      - Source + Source

      - write(device // :stdio, item) + write(device // group_leader(), item)

      Writes the given argument to the given device. By default the device is the standard output. @@ -251,7 +268,7 @@

      Examples

      #=> "error"
      - Source + Source
      diff --git a/docs/stable/Kernel.CLI.html b/docs/stable/Kernel.CLI.html index 92a9a18dd..2ec5a7213 100644 --- a/docs/stable/Kernel.CLI.html +++ b/docs/stable/Kernel.CLI.html @@ -46,11 +46,6 @@

      Functions summary

      run/2 -
    3055. - - wait_until_finished/0 - -
    3056. @@ -73,14 +68,7 @@

      Functions

      This function is used by Elixir's CLI and also by escripts generated by Elixir.

      - Source -
      -

      - wait_until_finished() -

      -

      Wait until the CLI finishes processing options.

      -
      - Source + Source
      diff --git a/docs/stable/Kernel.SpecialForms.html b/docs/stable/Kernel.SpecialForms.html index 9b1c37037..4df9096c0 100644 --- a/docs/stable/Kernel.SpecialForms.html +++ b/docs/stable/Kernel.SpecialForms.html @@ -392,7 +392,7 @@

      Examples

        Module.concat [some_var, Foo]
       
      - Source + Source

      args @@ -405,7 +405,7 @@

      Examples

      #=> { :__block__, [], [1,2,3] }
      - Source + Source

      __scope__(opts, args) @@ -421,7 +421,7 @@

      Examples

      Check quote/1 for more information.

      - Source + Source

      alias(module, opts) @@ -474,7 +474,7 @@

      Lexical scope

      be hygienezed. This means the alias will be expanded when the macro is expanded.

      - Source + Source

      bc(args) @@ -488,7 +488,7 @@

      Lexical scope

      "helloworld"
      - Source + Source

      import(module, opts) @@ -614,10 +614,10 @@

      Alias/Require shortcut

      [{213,45,132},{64,76,32},{76,0,0},{234,32,15}]
      - Source + Source

      - quote(opts, list2) + quote(opts, block)

      Allows you to get the representation of any expression.

      @@ -652,15 +652,12 @@

      Explanation

      Options

        -
      • :hygiene - When false, disables hygiene for variables, aliases and imports;
      • :unquote - When false, disables unquoting. Useful when you have a quote inside another quote and want to control which quote is able to unquote;
      • :location - When set to :keep, keeps the current line and file on quotes. Read the Stacktrace information section below for more information;
      • -
      • :expand_aliases - When false, do not expand aliases;
      • -
      • :expand_imports - When false, do not expand imports;
      • -
      • :var_context - The context for quoted variables. Defaults to the current module;
      • +
      • :hygiene - Allows a developer to disable hygiene selectively;

      Macro literals

      @@ -678,17 +675,15 @@

      Macro literals

      Hygiene

      -

      Elixir macros are hygienic. This means aliases and imports -defined inside the quoted often refer to the context that -defined the macro.

      +

      Elixir macros are hygienic via means of deferred resolution.

      -

      Furthermore, variables inside quote are also hygienic. That -said, a variable defined in a macro cannot affect the scope -where the macro is included.

      +

      This means aliases and imports defined inside the quoted refer +to the context that defined the macro and not the context +where the macro is expanded.

      -

      The option hygiene can turn off all the hygiene mechanisms -defined below. However, they can also be changed in a one by -one basis.

      +

      Furthermore, variables inside quote are also hygienic: a +variable defined in a macro cannot affect the variables where +the macro is expanded.

      Hygiene in variables

      @@ -754,15 +749,14 @@

      Hygiene in variables

      quote do: var!(a, Hygiene1) = 2 -

      Another option is to set the var_context option, affecting -all variables in the block:

      +

      Hygiene for variables can be disabled overall as:

      -
      quote var_context: Hygiene1, do: a = 2
      +
      quote hygiene: [vars: false], do: x
       

      Hygiene in aliases

      -

      Aliases inside quote are expanded by default. +

      Aliases inside quote are hygienic by default. Consider the following example:

      defmodule Hygiene do
      @@ -774,25 +768,43 @@ 

      Hygiene in aliases

      end require Hygiene -Hygiene.no_interference #=> HashDict[] +Hygiene.no_interference #=> #HashDict<[]>

      Notice that, even though the alias D is not available in the context the macro is expanded, the code above works -because D was expanded when the quote was generated.

      +because D still expands to HashDict.

      -

      There are two ways to disable this behaviour. By giving -the expand_aliases equals to false to quote or by using -the alias! macro inside the quote:

      +

      In some particular cases you may want to access an alias +or a module defined in the caller. In such scenarios, you +can access it by disabling hygiene with hygiene: [aliases: false] +or by using the alias! macro inside the quote:

      -
      defmodule NoHygiene do
      +
      defmodule Hygiene do
      +  # This will expand to Elixir.Nested.hello
      +  defmacro no_interference do
      +    quote do: Nested.hello
      +  end
      +
      +  # This will expand to Nested.hello for
      +  # whatever is Nested in the caller
         defmacro interference do
      -    quote do: alias!(D).new
      +    quote do: alias!(Nested).hello
         end
       end
       
      -require NoHygiene
      -NoHygiene.interference #=> UndefinedFunctionError
      +defmodule Parent do
      +  defmodule Nested do
      +    def hello, do: "world"
      +  end
      +
      +  require Hygiene
      +  Hygiene.no_interference
      +  #=> ** (UndefinedFunctionError) ...
      +
      +  Hygiene.interference
      +  #=> "world"
      +end
       

      Hygiene in imports

      @@ -844,7 +856,7 @@

      Hygiene in imports

      As in aliases, imports expansion can be explicitly disabled -via the expand_imports option.

      +via the hygiene: [imports: false] option.

      Stacktrace information

      @@ -880,7 +892,7 @@

      Stacktrace information

      particular, the macro __FILE__ and exceptions happening inside the quote will always point to GenServer.Behaviour file.

      - Source + Source

      require(module, opts) @@ -940,7 +952,7 @@

      Examples

      #=> { :sum, [], [1, 13, 3] }
      - Source + Source

      unquote_splicing(expr) @@ -955,7 +967,7 @@

      Examples

      #=> { :sum, [], [1, 2, 3, 4, 5] }
      - Source + Source

      var!(var) @@ -966,7 +978,7 @@

      Examples

      one is an atom) or an atom representing the variable name. Check quote/2 for more information.

      - Source + Source

      var!(var, context) @@ -974,7 +986,7 @@

      Examples

      Defines a variable in the given context. Check quote/2 for more information.

      - Source + Source

      {args} diff --git a/docs/stable/Kernel.Typespec.html b/docs/stable/Kernel.Typespec.html index f9fafdf38..8c2a7b99b 100644 --- a/docs/stable/Kernel.Typespec.html +++ b/docs/stable/Kernel.Typespec.html @@ -107,7 +107,7 @@

      Notes

      Elixir discourages the use of type string() as it might be confused with binaries which are referred to as "strings" in Elixir (as opposed to character lists). In order to use the type that is called string() in Erlang, -one has to use the char_list() type which is a synonym to string(). If yu +one has to use the char_list() type which is a synonym for string(). If you use string(), you'll get a warning from the compiler.

      If you want to refer to the "string" type (the one operated by functions in the diff --git a/docs/stable/Kernel.html b/docs/stable/Kernel.html index 7a5419c16..d415cd8d4 100644 --- a/docs/stable/Kernel.html +++ b/docs/stable/Kernel.html @@ -483,11 +483,6 @@

      Macros summary

      //2 -
    3057. - - />/2 - -
    3058. </2 @@ -873,7 +868,7 @@

      Examples

      Examples

      -
      apply List, reverse, [[1,2,3]]
      +
      apply Enum, :reverse, [[1,2,3]]
       #=> [3,2,1]
       
    3059. @@ -962,7 +957,7 @@

      Examples

      binary_to_list(binary, start, stop)

      -

      As binarytolist/1, but returns a list of integers corresponding to the bytes +

      Like binarytolist/1, but returns a list of integers corresponding to the bytes from position start to position stop in binary. Positions in the binary are numbered starting from 1.

      @@ -1014,7 +1009,7 @@

      Examples

      Examples

      -
      bit_size(<<433|16,3|3>>) #=> 19
      +
      bit_size(<<433::16,3::3>>) #=> 19
       bit_size(<<1,2,3>>) #=> 24
       
      @@ -1040,7 +1035,7 @@

      Examples

      Examples

      -
      byte_size(<<433|16,3|3>>) #=> 3
      +
      byte_size(<<433::16,3::3>>) #=> 3
       byte_size(<<1,2,3>>) #=> 3
       
      @@ -1094,7 +1089,7 @@

      Examples

      it is not loaded. Check Code.ensure_loaded/1 for more information.

      - Source + Source

      hd(list) @@ -1347,10 +1342,10 @@

      Examples

      bin1 = <<1,2,3>>
       bin2 = <<4,5>>
      -bin3 = <<6,7|4>>
      +bin3 = <<6,7::4>>
       
       list_to_bitstring([bin1,1,[2,3,bin2],4|bin3])
      -#=> <<1,2,3,1,2,3,4,5,4,6,7|4>>
      +#=> <<1,2,3,1,2,3,4,5,4,6,7::size(4)>>
       
      Source @@ -1413,7 +1408,7 @@

      Warning:

      Examples

      -
      list_to_pid('<0.41>') #=> <0.4.1>
      +
      list_to_pid('<0.4.1>') #=> #PID<0.4.1>
       
      Source @@ -1440,7 +1435,7 @@

      Examples

      it is not loaded. Check Code.ensure_loaded/1 for more information.

      - Source + Source

      make_ref() @@ -1453,7 +1448,7 @@

      Examples

      Examples

      make_ref()
      -#=> #Ref<0.0.0.135>
      +#=> #Reference<0.0.0.135>
       
      Source @@ -1499,7 +1494,7 @@

      Examples

      node(arg)

      -

      Returns the node where the given argmuent is located. +

      Returns the node where the given argument is located. The argument can be a pid, a reference, or a port. If the local node is not alive, nonode@nohost is returned.

      @@ -1546,7 +1541,7 @@

      Examples

      end
      - Source + Source

      raise(exception, args) @@ -1566,7 +1561,7 @@

      Examples

      raise ArgumentError, message: "Sample"
       
      - Source + Source

      raise(exception, args, stacktrace) @@ -1593,7 +1588,7 @@

      Examples

      rescued) in between the rescue clause and the raise call may change the System.stacktrace value.

      - Source + Source

      round(number) @@ -1620,7 +1615,7 @@

      Examples

      size(arg)

      Returns the size of the given argument, which must be a tuple -or a binary. If possible, please use tuplesize or binarysize.

      +or a binary. If possible, please use tuple_size or binary_size.

      Source
      @@ -1634,10 +1629,10 @@

      Examples

      Examples

      -
      current = Process.self
      -child   = spawn(fn -> current <- { Process.self, 1 + 2 } end)
      +
      current = Kernel.self
      +child   = spawn(fn -> current <- { Kernel.self, 1 + 2 } end)
       
      -receive
      +receive do
         { ^child, 3 } -> IO.puts "Received 3 back"
       end
       
      @@ -1670,16 +1665,15 @@

      Examples

      Examples

      -
      current = Process.self
      -child   = spawn_link(fn -> current <- { Process.self, 1 + 2 } end)
      +
      current = Kernel.self
      +child   = spawn_link(fn -> current <- { Kernel.self, 1 + 2 } end)
       
      -receive
      -  { ^child, 3 } ->
      -    IO.puts "Received 3 back"
      +receive do
      +  { ^child, 3 } -> IO.puts "Received 3 back"
       end
       
      - Source + Source

      spawn_link(module, fun, args) @@ -1695,19 +1689,19 @@

      Examples

      spawn_link(SomeModule, :function, [1,2,3])
       
      - Source + Source

      term_to_binary(term)

      -

      Returns a binary data which is the result of encoding the given term +

      Returns a binary which is the result of encoding the given term according to the Erlang external term format.

      This can be used for a variety of purposes, for example, writing a term to a file in an efficient way, or sending an Erlang term to some type of communications channel not supported by distributed :

      - Source + Source

      term_to_binary(term, opts) @@ -1715,32 +1709,32 @@

      Examples

      The same as term_to_binary/1 but also supports two options:

      - Source + Source

      throw(term)

      A non-local return from a function. Check try/2 for more information.

      - Source + Source

      tl(list)

      Returns the tail of a list. Raises ArgumentError if the list is empty.

      - Source + Source

      trunc(number)

      -

      Returns an integer by the truncating the given number. +

      Returns an integer by truncating the given number. Allowed in guard clauses.

      Examples

      @@ -1748,21 +1742,21 @@

      Examples

      trunc(5.5) #=> 5
       
      - Source + Source

      tuple_size(tuple)

      Returns the size of a tuple.

      - Source + Source

      tuple_to_list(tuple)

      Converts a tuple to a list.

      - Source + Source
      @@ -1774,7 +1768,7 @@

      Macros

      !arg

      -

      It receives any argument and returns true if it is false +

      Receives any argument and returns true if it is false or nil. Returns false otherwise. Not allowed in guard clauses.

      @@ -1796,7 +1790,7 @@

      Examples

      This operator considers 1 and 1.0 to be equal. For strict comparison, use !== instead.

      -

      As Erlang, Elixir can compare any term. Allowed in guard clauses.

      +

      Like Erlang, Elixir can compare any term. Allowed in guard clauses.

      Examples

      @@ -1812,7 +1806,7 @@

      Examples

      left !== right

      Returns true if the two items are strictly not equal. -As Erlang, Elixir can compare any term. Allowed in guard clauses.

      +Like Erlang, Elixir can compare any term. Allowed in guard clauses.

      Examples

      @@ -1844,7 +1838,7 @@

      Examples

      this operator accepts any expression as arguments, not only booleans, however it is not allowed in guards.

      - Source + Source

      left * right @@ -1929,7 +1923,7 @@

      Examples

      3 in 1..3 #=> true
      - Source + Source

      left / right @@ -1945,18 +1939,12 @@

      Examples

      Source -
      -

      - />(left, right) -

      -
      - Source

      left < right

      -

      Return true if left is less than right. -As Erlang, Elixir can compare any term. Allowed in guard clauses.

      +

      Returns true if left is less than right. +Like Erlang, Elixir can compare any term. Allowed in guard clauses.

      Examples

      @@ -1975,7 +1963,7 @@

      Examples

      Examples

      -
      process = Process.self
      +
      process = Kernel.self
       process <- { :ok, "Sending myself a message" }
       
      @@ -1984,8 +1972,8 @@

      Examples

      left <= right

      -

      Return true if left is less than or equal to right. -As Erlang, Elixir can compare any term. Allowed in guard clauses.

      +

      Returns true if left is less than or equal to right. +Like Erlang, Elixir can compare any term. Allowed in guard clauses.

      Examples

      @@ -2012,7 +2000,7 @@

      Examples

      x #=> "bar"
      - Source + Source

      left == right @@ -2022,7 +2010,7 @@

      Examples

      This operator considers 1 and 1.0 to be equal. For strict comparison, use === instead.

      -

      As Erlang, Elixir can compare any term. Allowed in guard clauses.

      +

      Like Erlang, Elixir can compare any term. Allowed in guard clauses.

      Examples

      @@ -2039,7 +2027,7 @@

      Examples

      left === right

      Returns true if the two items are strictly equal. -As Erlang, Elixir can compare any term. Allowed in guard clauses.

      +Like Erlang, Elixir can compare any term. Allowed in guard clauses.

      Examples

      @@ -2065,13 +2053,13 @@

      Examples

      "abcd" =~ %r/e/ #=> nil
      - Source + Source

      left > right

      -

      Return true if left is more than right. -As Erlang, Elixir can compare any term. Allowed in guard clauses.

      +

      Returns true if left is more than right. +Like Erlang, Elixir can compare any term. Allowed in guard clauses.

      Examples

      @@ -2084,8 +2072,8 @@

      Examples

      left >= right

      -

      Return true if left is more than or equal to right. -As Erlang, Elixir can compare any term. Allowed in guard clauses.

      +

      Returns true if left is more than or equal to right. +Like Erlang, Elixir can compare any term. Allowed in guard clauses.

      Examples

      @@ -2141,7 +2129,7 @@

      Examples

      time and not at runtime. Check the module Module for other functions to manipulate module attributes.

      - Source + Source

      __B__(string, list2) @@ -2155,7 +2143,7 @@

      Examples

      %B(f#{o}o) #=> "f\#{o}o"
      - Source + Source

      __C__(arg1, list2) @@ -2169,7 +2157,7 @@

      Examples

      %C(f#{o}o) #=> 'f\#{o}o'
      - Source + Source

      __R__(arg1, options) @@ -2182,7 +2170,7 @@

      Examples

      Regex.match? %R(f#{1,3}o), "f#o"  #=> true
       
      - Source + Source

      __b__(arg1, list2) @@ -2196,7 +2184,7 @@

      Examples

      %b(f#{:o}o) #=> "foo"
      - Source + Source

      __c__(arg1, list2) @@ -2210,7 +2198,7 @@

      Examples

      %c(f#{:o}o) #=> 'foo'
      - Source + Source

      __r__(arg1, options) @@ -2222,7 +2210,7 @@

      Examples

      Regex.match? %r(foo), "foo"  #=> true
       
      - Source + Source

      access(element, args) @@ -2296,12 +2284,12 @@

      Examples

      access a, 1 #=> :a
      - Source + Source

      left and right

      -

      Boolean and. Arguments needs to necessarily be booleans. +

      Boolean and. Arguments must be booleans. Allowed in guard clauses.

      Examples

      @@ -2323,7 +2311,7 @@

      Examples

      atom_to_binary :my_atom #=> "my_atom"
       
      - Source + Source

      binary_to_atom(some_binary) @@ -2336,7 +2324,7 @@

      Examples

      binary_to_atom "my_atom" #=> :my_atom
       
      - Source + Source

      binary_to_existing_atom(some_binary) @@ -2349,7 +2337,7 @@

      Examples

      binary_to_existing_atom "my_atom" #=> :my_atom
      - Source + Source

      binary_to_float(some_binary) @@ -2361,7 +2349,7 @@

      Examples

      binary_to_float "2.2017764e+0" #=> 2.2017764
       
      - Source + Source

      binary_to_integer(some_binary) @@ -2373,7 +2361,7 @@

      Examples

      binary_to_integer "123" #=> 123
       
      - Source + Source

      binary_to_integer(some_binary, base) @@ -2386,7 +2374,7 @@

      Examples

      binary_to_integer("3FF", 16) #=> 1023
       
      - Source + Source

      case(condition, blocks) @@ -2439,7 +2427,7 @@

      Examples

      end
      - Source + Source

      cond(list1) @@ -2459,7 +2447,7 @@

      Examples

      end
      - Source + Source

      def(name, list2) @@ -2519,7 +2507,7 @@

      Dynamic generation with atoms

      defmacro defkv(keywords) do
         Enum.map keywords, fn {k,v} ->
           quote do
      -      def unquote(k).() do
      +      def unquote(k)() do
               unquote(v)
             end
           end
      @@ -2531,12 +2519,8 @@ 

      Dynamic generation with atoms

      defkv one: 1, two: 2
       
      - -

      Notice in the example above, we define the function as def unquote(k).() -because each entry k is a an atom and invoking def unquote(k)() -would be invalid Elixir syntax.

      - Source + Source

      def(name, args, guards, list4) @@ -2573,7 +2557,7 @@

      Examples

      def name, args, guards, do: exprs
      - Source + Source

      defdelegate(funs, opts) @@ -2619,7 +2603,7 @@

      Examples

      #=> [3,2,1]
      - Source + Source

      defexception(name, fields, opts // [], do_block // []) @@ -2635,7 +2619,7 @@

      Examples

      2) Exceptions must implement message/1 as API that return a binary as result;

      - Source + Source

      defimpl(name, opts, do_block // []) @@ -2643,7 +2627,7 @@

      Examples

      Defines an implementation for the given protocol. See defprotocol/2 for examples.

      - Source + Source

      defmodule(name, list2) @@ -2691,7 +2675,7 @@

      Dynamic names

      Elixir will accept any module name as long as the expression returns an atom.

      - Source + Source

      defoverridable(tuples) @@ -2700,7 +2684,7 @@

      Dynamic names

      An overridable function is lazily defined, allowing a developer to customize it.

      - Source + Source

      defp(name, list2) @@ -2724,14 +2708,14 @@

      Examples

      In the example above, sum is private and accessing it through Foo.sum will raise an error.

      - Source + Source

      defp(name, args, guards, list4)

      The same as def/4 but generates a private function.

      - Source + Source

      defprotocol(name, list2) @@ -2811,7 +2795,7 @@

      Selecting implementations

      If the protocol is invoked with a data type that is not an Atom, -nor Tuple, nor List, nor BitString, Elixir will now dispatch to +a Tuple, a List, or a BitString, Elixir will now dispatch to Any. That said, the default behavior could be implemented as:

      defimpl Blank, for: Any do
      @@ -2840,8 +2824,8 @@ 

      Protocols + Records

      In the example above, we have implemented blank? for RedBlack.Tree that simply delegates to RedBlack.empty? passing the tree as argument. This implementation doesn't need to be defined -inside the RedBlack tree or inside the record, but anywhere in -the code.

      +inside the RedBlack tree or inside the record; it can be defined +anywhere in the code.

      Finally, since records are simply tuples, one can add a default protocol implementation to any record by defining a default @@ -2861,7 +2845,7 @@

      Types

      The @spec above expresses that all types allowed to implement the given protocol are valid argument types for the given function.

      - Source + Source

      defrecord(name, fields, opts // [], do_block // []) @@ -2970,7 +2954,7 @@

      Types

      When defining a type, all the fields not mentioned in the type are assumed to have type term.

      - Source + Source

      defrecordp(name, fields) @@ -3018,16 +3002,15 @@

      Examples

      name #=> "José"
      - Source + Source

      destructure(left, right)

      -

      Allows you to destructure two lists, assigning each -term in the right to the left. Differently from pattern -matching via =, if the sizes of the left and right -lists don't match,, structuring simply stops instead -of raising an error.

      +

      Allows you to destructure two lists, assigning each term in the right to the +matching term in the left. Unlike pattern matching via =, if the sizes of +the left and right lists don't match, destructuring simply stops instead of +raising an error.

      Examples

      @@ -3038,7 +3021,7 @@

      Examples

      Notice in the example above, even though the right -size has more entries than the left, structuring works +size has more entries than the left, destructuring works fine. If the right size is smaller, the remaining items are simply assigned to nil:

      @@ -3059,7 +3042,7 @@

      Examples

      the first value from the right side. Otherwise, it will raise a CaseClauseError.

      - Source + Source

      div(left, right) @@ -3073,7 +3056,7 @@

      Examples

      div 5, 2 #=> 2
       
      - Source + Source

      elem(tuple, index) @@ -3089,7 +3072,7 @@

      Example

      elem(tuple, 1) #=> :bar
      - Source + Source

      float_to_binary(some_float) @@ -3102,7 +3085,7 @@

      Examples

      float_to_binary 7.0 #=> "7.00000000000000000000e+00"
       
      - Source + Source

      function(args) @@ -3142,7 +3125,7 @@

      Shortcut syntax

      end -

      Not only the example is shorter, it solves ambiguity issues. Since +

      Not only is the example shorter, it solves ambiguity issues. Since do/end always matches the furthest call, if we used the function macro as below:

      @@ -3177,14 +3160,14 @@

      Function retrieval

      The function macro can also be used to retrieve local or remote functions:

      -
      f = function(:is_atom, 2)
      +
      f = function(:is_atom, 1)
       f.(:foo) #=> true
       
       f = function(List, :flatten, 1)
       f.([1,[2],3]) #=> [1,2,3]
       
      - Source + Source

      if(condition, clauses) @@ -3228,7 +3211,7 @@

      Blocks examples

      If you want to compare more than two clauses, you can use the cond/1 macro.

      - Source + Source

      left in right @@ -3270,7 +3253,7 @@

      Clauses

      In this case, Elixir will automatically expand it and define the variable for us.

      - Source + Source

      inspect(arg, opts // []) @@ -3294,15 +3277,15 @@

      Examples

      #=> ":foo"
      -

      Notice the inspect protocol does not necessarily return a valid Elixir -terms representation. In such cases, the inspected result must start -with #. For example, inspecting a function will return:

      +

      Note that the inspect protocol does not necessarily return a valid +representation of an Elixir term. In such cases, the inspected result must +start with #. For example, inspecting a function will return:

      inspect &1 + &2
       #=> #Function<...>
       
      - Source + Source

      integer_to_binary(some_integer) @@ -3315,7 +3298,7 @@

      Examples

      integer_to_binary 123 #=> "123"
       
      - Source + Source

      integer_to_binary(some_integer, base) @@ -3328,12 +3311,12 @@

      Examples

      integer_to_binary 77 #=> "77"
       
      - Source + Source

      is_exception(thing)

      -

      Check if the given structure is an exception.

      +

      Checks if the given structure is an exception.

      Examples

      @@ -3341,26 +3324,26 @@

      Examples

      is_exception(1) #=> false
      - Source + Source

      is_range(thing)

      -

      Check if the given argument is a range.

      +

      Checks if the given argument is a range.

      - Source + Source

      is_record(thing)

      -

      Check if the given argument is a record.

      +

      Checks if the given argument is a record.

      - Source + Source

      is_record(thing, kind)

      -

      Check if the given structure is a record. It is basically +

      Checks if the given structure is a record. It is basically a convenient macro that checks the structure is a tuple and the first element matches the given kind.

      @@ -3372,14 +3355,14 @@

      Examples

      is_record(Config.new, List) #=> false
      - Source + Source

      is_regex(thing)

      -

      Check if the given argument is a regex.

      +

      Checks if the given argument is a regex.

      - Source + Source

      match?(left, right) @@ -3406,7 +3389,7 @@

      Examples

      Enum.filter list, match?({:a, x } when x < 2, &1)
      - Source + Source

      nil?(x) @@ -3420,12 +3403,12 @@

      Examples

      nil? nil #=> true
      - Source + Source

      not arg

      -

      Boolean not. Argument needs to necessarily be a boolean. +

      Boolean not. Argument must be a boolean. Allowed in guard clauses.

      Examples

      @@ -3439,7 +3422,7 @@

      Examples

      left or right

      -

      Boolean or. Arguments needs to necessarily be booleans. +

      Boolean or. Arguments must be booleans. Allowed in guard clauses.

      Examples

      @@ -3496,7 +3479,7 @@

      Examples

      will occur immediately.

      - Source + Source

      rem(left, right) @@ -3510,7 +3493,7 @@

      Examples

      rem 5, 2 #=> 1
       
      - Source + Source

      setelem(tuple, index, value) @@ -3526,7 +3509,7 @@

      Example

      setelem(tuple, 0, :baz) #=> { :baz, :bar, 3 }
      - Source + Source

      to_binary(arg) @@ -3540,7 +3523,7 @@

      Examples

      #=> "foo"
      - Source + Source

      to_char_list(arg) @@ -3553,7 +3536,7 @@

      Examples

      #=> 'foo'
      - Source + Source

      try(args) @@ -3670,7 +3653,7 @@

      Variable visibility

      end
      - Source + Source

      unless(clause, options) @@ -3679,7 +3662,7 @@

      Variable visibility

      unless a value evalutes to true. Check if for examples and documentation.

      - Source + Source

      use(module, args // []) @@ -3689,8 +3672,8 @@

      Variable visibility

      Examples

      -

      For example, in other to write tests using the ExUnit framework, -a developers should use the ExUnit.Case module:

      +

      For example, in order to write tests using the ExUnit framework, +a developer should use the ExUnit.Case module:

      defmodule AssertionTest do
         use ExUnit.Case, async: true
      @@ -3716,12 +3699,12 @@ 

      Examples

      end
      - Source + Source

      left xor right

      -

      Boolean xor. Arguments needs to necessarily be booleans. +

      Boolean xor. Arguments must be booleans. Allowed in guard clauses.

      Examples

      @@ -3769,7 +3752,7 @@

      Examples

      String.graphemes("Hello") |> Enum.reverse
       
      - Source + Source

      left || right @@ -3790,7 +3773,7 @@

      Examples

      this operator accepts any expression as arguments, not only booleans, however it is not allowed in guards.

      - Source + Source
      diff --git a/docs/stable/KeyError.html b/docs/stable/KeyError.html index b2b9893b3..0e401d4f9 100644 --- a/docs/stable/KeyError.html +++ b/docs/stable/KeyError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -70,7 +70,7 @@

      Functions

      message(exception)

      - Source + Source diff --git a/docs/stable/Macro.html b/docs/stable/Macro.html index 0efb339ac..6f5c62d51 100644 --- a/docs/stable/Macro.html +++ b/docs/stable/Macro.html @@ -122,7 +122,7 @@

      Functions

      do_safe_term(terms)

      - Source + Source

      escape(tuple) @@ -269,7 +269,7 @@

      Examples

      evaluate code) and returns :ok unless a given term is unsafe, which is returned as { :unsafe, term }.

      - Source + Source

      to_binary(tree) diff --git a/docs/stable/MatchError.html b/docs/stable/MatchError.html index 4639fa521..47a8fc5c6 100644 --- a/docs/stable/MatchError.html +++ b/docs/stable/MatchError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -70,7 +70,7 @@

      Functions

      message(exception)

      - Source + Source
      diff --git a/docs/stable/Mix.Project.html b/docs/stable/Mix.Project.html index 0681a64da..8ddfbadb8 100644 --- a/docs/stable/Mix.Project.html +++ b/docs/stable/Mix.Project.html @@ -120,7 +120,7 @@

      Functions

      Returns a list of project config files (mix.exs and mix.lock).

      - Source + Source

      get() diff --git a/docs/stable/Mix.Tasks.Clean.html b/docs/stable/Mix.Tasks.Clean.html index d6549952e..a874715bb 100644 --- a/docs/stable/Mix.Tasks.Clean.html +++ b/docs/stable/Mix.Tasks.Clean.html @@ -68,7 +68,7 @@

      Functions

      run(args)

      - Source + Source
      diff --git a/docs/stable/Mix.Tasks.Compile.Erlang.html b/docs/stable/Mix.Tasks.Compile.Erlang.html index e4afe82fd..47a748afd 100644 --- a/docs/stable/Mix.Tasks.Compile.Erlang.html +++ b/docs/stable/Mix.Tasks.Compile.Erlang.html @@ -29,21 +29,46 @@

      A task to compile Erlang source files.

      +

      When this task runs, it will first check the mod times of +all of the files. Every file will checked, if file or +file dependencies, like include files, was changed. +If file of his dependencies haven't been changed since the +last compilation, it will not compile. If file or one of his +dependency has changed, it will compile.

      + +

      For this reason, this task touches your :compile_path +directory and sets the modification time to the current +time and date at the end of each compilation. You can +force compilation regardless of mod times by passing +the --force option.

      +

      Command line options

        -
      • ERL_COMPILER_OPTIONS - can be used to give default compile options. -It's value must be a valid Erlang term. If the value is a list, it will -be used as is. If it is not a list, it will be put into a list.
      • +
      • --force - forces compilation regardless of module times

      Configuration

        -
      • :erlc_options - compilation options that applies to Erlang compiler -By default, the following options are on: [:verbose, :report_errors, :report_warnings]
      • +
      • ERL_COMPILER_OPTIONS - can be used to give default compile options. +It's value must be a valid Erlang term. If the value is a list, it will +be used as is. If it is not a list, it will be put into a list.

      • +
      • :erlc_paths - directories to find source files. +Defaults to ["src"], can be configured as:

        + +

        [erlc_paths: ["src", "other"]]

      • +
      • :erlc_include_path - directory for adding include files. +Defaults to "include", can be configured as:

        + +

        [erlc_include_path: "other"]

      • +
      • :erlc_options - compilation options that applies to Erlang's +compiler. :debug_info is enabled by default.

      +

      There are many available options here: + http://www.erlang.org/doc/man/compile.html#file-2

      +
      @@ -57,10 +82,25 @@

      Configuration

      Functions summary

      @@ -73,11 +113,37 @@

      Functions summary

      Functions

      +

      + extract_stale_pairs(dir1, ext1, dir2, ext2, force) +

      +

      Extract stale pairs considering the set of directories +and filename extensions. It first looks up the dir1 +for files with ext1 extensions and then recursively +try to find matching pairs in dir2 with ext2 +extension.

      +
      + Source +
      +

      + interpret_result(file, result, ext // "") +

      +

      Interprets compilation results and prints them to the console.

      +
      + Source +

      - run(_) + run(args)

      - Source + Source +
      +

      + to_erl_file(file) +

      +

      Converts the given file to a format accepted by +Erlang compilation tools.

      +
      + Source
      diff --git a/docs/stable/Mix.Tasks.Compile.Leex.html b/docs/stable/Mix.Tasks.Compile.Leex.html new file mode 100644 index 000000000..cf89b1605 --- /dev/null +++ b/docs/stable/Mix.Tasks.Compile.Leex.html @@ -0,0 +1,99 @@ + + + + Mix.Tasks.Compile.Leex + + + + + + + + + + + + +
      +

      + Mix.Tasks.Compile.Leex + +

      + + +
      +

      A task to compile Leex source files.

      + +

      When this task runs, it will check the mod time of every file, and +if it has changed, then file will be compiled. Files will be +compiled in the same source directory with .erl extension. +You can force compilation regardless of mod times by passing +the --force option.

      + +

      Command line options

      + +
        +
      • --force - forces compilation regardless of module times;
      • +
      + +

      Configuration

      + +
        +
      • :erlc_paths - directories to find source files. +Defaults to ["src"], can be configured as:

        + +

        [erlc_paths: ["src", "other"]]

      • +
      • :leex_options - compilation options that applies +to Leex's compiler. There are many available options +here: http://www.erlang.org/doc/man/leex.html#file-2

      • +
      + +
      + + + Source + + + + + + +

      Functions summary

      + + + + + + + + +
      +

      Functions

      +
      +

      + run(args) +

      +
      + Source +
      +
      + + + + + +
      + + diff --git a/docs/stable/Mix.Tasks.Compile.Yecc.html b/docs/stable/Mix.Tasks.Compile.Yecc.html new file mode 100644 index 000000000..0b9b57518 --- /dev/null +++ b/docs/stable/Mix.Tasks.Compile.Yecc.html @@ -0,0 +1,99 @@ + + + + Mix.Tasks.Compile.Yecc + + + + + + + + + + + + +
      +

      + Mix.Tasks.Compile.Yecc + +

      + + +
      +

      A task to compile Yecc source files.

      + +

      When this task runs, it will check the mod time of every file, and +if it has changed, then file will be compiled. Files will be +compiled in the same source directory with .erl extension. +You can force compilation regardless of mod times by passing +the --force option.

      + +

      Command line options

      + +
        +
      • --force - forces compilation regardless of module times;
      • +
      + +

      Configuration

      + +
        +
      • :erlc_paths - directories to find source files. +Defaults to ["src"], can be configured as:

        + +

        [erlc_paths: ["src", "other"]]

      • +
      • :yecc_options - compilation options that applies +to Yecc's compiler. There are many other available +options here: http://www.erlang.org/doc/man/yecc.html#file-1

      • +
      + +
      + + + Source + + + + + + +

      Functions summary

      + + + + + + + + +
      +

      Functions

      +
      +

      + run(args) +

      +
      + Source +
      +
      + + + + + +
      + + diff --git a/docs/stable/Mix.Utils.html b/docs/stable/Mix.Utils.html index 73497ed0c..24f0119a7 100644 --- a/docs/stable/Mix.Utils.html +++ b/docs/stable/Mix.Utils.html @@ -139,7 +139,7 @@

      Examples

      Mix.Utils.camelize "foo_bar" #=> "FooBar"
       
      - Source + Source

      command_to_module(command, at // Elixir) @@ -170,7 +170,7 @@

      Examples

      #=> "Compile.Elixir"
      - Source + Source

      config_merge(old, new) @@ -178,17 +178,16 @@

      Examples

      Merges two configs recursively, merging keyword lists and concatenating normal lists.

      - Source + Source

      - extract_files(paths, exts) + extract_files(paths, exts_or_pattern)

      -

      Extract files from a list of paths or from a wildcard.

      +

      Extract files from a list of paths.

      -

      If the list of paths contains a directory, the directory -is expanded according to the given pattern.

      - -

      It ignores files which start with "."

      +

      In case any of the paths is a directory, the directory is looped +recursively searching for the given extensions or the given pattern. +When looking up directories, files starting with "." are ignored.

      Source
      @@ -197,7 +196,7 @@

      Examples

      Extract all stale sources compared to the given targets.

      - Source + Source

      mix_home() @@ -223,15 +222,15 @@

      Examples

      #=> "compile.elixir"
      - Source + Source

      preserving_mtime(path, fun)

      -

      Executes a function but preserves the given path -mtime properties.

      +

      Executes a function but preserves the given path mtime +properties.

      - Source + Source

      relative_to_cwd(path) @@ -239,7 +238,7 @@

      Examples

      Returns the given path string relative to the current working directory.

      - Source + Source

      source(module) @@ -251,9 +250,10 @@

      Examples

      stale?(sources, targets)

      -

      Returns true if any of the sources are stale compared to the given target.

      +

      Returns true if any of the sources are stale +compared to the given target.

      - Source + Source

      underscore(atom) @@ -277,7 +277,7 @@

      Examples

      Mix.Utils.camelize "sap_example" #=> "SapExample"
      - Source + Source
      diff --git a/docs/stable/Node.html b/docs/stable/Node.html index a427c34f1..6e78bc0c7 100644 --- a/docs/stable/Node.html +++ b/docs/stable/Node.html @@ -46,6 +46,11 @@

      Functions summary

      alive?/0 +
    3060. + + connect/1 + +
    3061. disconnect/1 @@ -125,6 +130,17 @@

      Functions

      part of a distributed system. Otherwise, it returns false.

      Source +
      +

      + connect(node) +

      +

      Establishes a connection to Node. Returns true if successful, +false if not, and the atom :ignored if the local node is not +alive.

      + +

      See http://erlang.org/doc/man/net_kernel.html#connect_node-1 for more info.

      +
      + Source

      disconnect(node) @@ -193,7 +209,7 @@

      Functions

      Check http://www.erlang.org/doc/man/erlang.html#spawn-2 for the list of available options.

      - Source + Source

      spawn(node, fun, opts) @@ -204,7 +220,7 @@

      Functions

      Check http://www.erlang.org/doc/man/erlang.html#spawn_opt-3 for the list of available options.

      - Source + Source

      spawn(node, module, fun, args) @@ -216,7 +232,7 @@

      Functions

      Check http://www.erlang.org/doc/man/erlang.html#spawn-4 for the list of available options.

      - Source + Source

      spawn(node, module, fun, args, opts) @@ -228,7 +244,7 @@

      Functions

      Check http://www.erlang.org/doc/man/erlang.html#spawn_opt-5 for the list of available options.

      - Source + Source

      spawn_link(node, fun) @@ -239,7 +255,7 @@

      Functions

      (and due to the link, an exit signal with exit reason :noconnection will be received).

      - Source + Source

      spawn_link(node, module, fun, args) @@ -250,7 +266,7 @@

      Functions

      pid is returned (and due to the link, an exit signal with exit reason :noconnection will be received).

      - Source + Source diff --git a/docs/stable/OptionParser.html b/docs/stable/OptionParser.html index 1d57f362f..ea1916d02 100644 --- a/docs/stable/OptionParser.html +++ b/docs/stable/OptionParser.html @@ -86,12 +86,22 @@

      Aliases

      Switches

      -

      Extra information about switches can be given as argument too. This is useful -in order to say a switch must behave as a boolean, list, etc. The following -types are supported:

      +

      Extra information about switches can be given as argument too. +This is useful in order to say a switch must behave as a boolean +or if duplicated switches should be kept, overriden or accumulated.

      + +

      The following types are supported:

      + +
        +
      • :boolean - Mark the given switch as boolean. Boolean switches + never consumes the following value unless it is + true or false;
      • +
      + +

      The following extra options are supported:

        -
      • :boolean - They never consume the next value unless it is true/false;
      • +
      • :keep - Keep duplicated items in the list instead of overriding;

      Examples:

      @@ -112,7 +122,7 @@

      Negation switches

      #=> { [no_op: true], ["path/to/file"] } - Source + Source

      parse_head(argv, opts // []) @@ -128,7 +138,7 @@

      Example

      #=> { [source: "lib"], ["test/enum_test.exs", "--verbose"] }
      - Source + Source diff --git a/docs/stable/OrdDict.html b/docs/stable/OrdDict.html deleted file mode 100644 index 90f4daeb2..000000000 --- a/docs/stable/OrdDict.html +++ /dev/null @@ -1,118 +0,0 @@ - - - - OrdDict - - - - - - - - - - - - -
      -

      - OrdDict - -

      - - -
      -

      This module implements a dictionary type that stores items -as a list of tuples. It is a simple wrapper around -Erlang's orddict module -and exposed via the Dict module.

      - -

      Check the Dict module for examples and documentation.

      - -
      - - - Source - - - - - - -

      Functions summary

      - - - - - - - - -
      -

      Functions

      -
      -

      - new() -

      -

      Creates a new empty dict.

      -
      - Source -
      -

      - new(pairs) -

      -

      Creates a new dict from a list of pairs.

      - -

      Examples

      - -
      OrdDict.new [{:b,1},{:a,2}]
      -#=> [a: 1, b: 2]
      -
      -
      - Source -
      -

      - new(list, transform) -

      -

      Creates a new dict from a list of elements with the -help of the transformation function.

      - -

      Examples

      - -
      OrdDict.new ["a", "b"], fn x -> {x, x} end
      -#=> ["a": "a", "b": "b"]
      -
      -
      - Source -
      -
      - - - - - -
      - - diff --git a/docs/stable/Process.html b/docs/stable/Process.html index e06b10b17..8706f03e4 100644 --- a/docs/stable/Process.html +++ b/docs/stable/Process.html @@ -146,11 +146,6 @@

      Functions summary

      registered/0
    3062. -
    3063. - - self/0 - -
    3064. spawn/1 @@ -233,14 +228,14 @@

      Functions

      Deletes all items in the dictionary.

      - Source + Source

      delete(key)

      Deletes the given key from the dictionary.

      - Source + Source

      demonitor(monitor_ref, options // []) @@ -251,7 +246,7 @@

      Functions

      See http://www.erlang.org/doc/man/erlang.html#demonitor-2 for more info.

      - Source + Source

      exit(pid, reason) @@ -278,7 +273,7 @@

      Examples

      Process.exit(pid, :kill)
       
      - Source + Source

      flag(flag, value) @@ -288,7 +283,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#process_flag-2 for more info.

      - Source + Source

      flag(pid, flag, value) @@ -299,35 +294,35 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#process_flag-3 for more info.

      - Source + Source

      get()

      Returns all key-values in the dictionary.

      - Source + Source

      get(key, default // nil)

      Returns the value for the given key.

      - Source + Source

      get_keys(value)

      Returns all keys that have the given value.

      - Source + Source

      group_leader()

      Returns the pid of the group leader for the process which evaluates the function.

      - Source + Source

      group_leader(leader, pid) @@ -335,7 +330,7 @@

      Examples

      Sets the group leader of Pid to GroupLeader. Typically, this is used when a processes started from a certain shell should have another group leader than :init.

      - Source + Source

      info(pid) @@ -345,7 +340,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#process_info-1 for more info.

      - Source + Source

      info(pid, spec) @@ -355,7 +350,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#process_info-2 for more info.

      - Source + Source

      link(pid) @@ -365,7 +360,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#link-1 for more info.

      - Source + Source

      list() @@ -379,7 +374,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#processes-0 for more info.

      - Source + Source

      monitor(item) @@ -389,14 +384,14 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#monitor-2 for more info.

      - Source + Source

      put(key, value)

      Stores the given key-value in the process dictionary.

      - Source + Source

      register(pid, name) @@ -407,21 +402,14 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#register-2 for more info.

      - Source + Source

      registered()

      Returns a list of names which have been registered using register/2.

      - Source -
      -

      - self() -

      -

      Returns the current process.

      -
      - Source + Source

      spawn(fun) @@ -429,7 +417,7 @@

      Examples

      Returns the pid of a new process started by the application of fun. It behaves exactly the same as Kernel.spawn/1.

      - Source + Source

      spawn(fun, opts) @@ -439,7 +427,7 @@

      Examples

      It also accepts extra options, for the list of available options check http://www.erlang.org/doc/man/erlang.html#spawn_opt-2

      - Source + Source

      spawn(mod, fun, args) @@ -450,7 +438,7 @@

      Examples

      It behaves exactly the same as the Kernel.spawn/3 function.

      - Source + Source

      spawn(mod, fun, args, opts) @@ -462,7 +450,7 @@

      Examples

      It also accepts extra options, for the list of available options check http://www.erlang.org/doc/man/erlang.html#spawn_opt-4

      - Source + Source

      spawn_link(fun) @@ -471,7 +459,7 @@

      Examples

      A link is created between the calling process and the new process, atomically.

      - Source + Source

      spawn_link(mod, fun, args) @@ -480,7 +468,7 @@

      Examples

      module.function(args). A link is created between the calling process and the new process, atomically. Otherwise works like spawn/3.

      - Source + Source

      spawn_monitor(fun) @@ -488,7 +476,7 @@

      Examples

      Returns the pid of a new process started by the application of fun and reference for a monitor created to the new process.

      - Source + Source

      spawn_monitor(mod, fun, args) @@ -497,7 +485,7 @@

      Examples

      and the process is monitored at the same time. Returns the pid and a reference for the monitor. Otherwise works like spawn/3.

      - Source + Source

      unlink(pid) @@ -508,7 +496,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#unlink-1 for more info.

      - Source + Source

      unregister(name) @@ -517,7 +505,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#unregister-1 for more info.

      - Source + Source

      whereis(name) @@ -527,7 +515,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#whereis-1 for more info.

      - Source + Source diff --git a/docs/stable/Protocol.UndefinedError.html b/docs/stable/Protocol.UndefinedError.html index a0ff398dc..d3fc53420 100644 --- a/docs/stable/Protocol.UndefinedError.html +++ b/docs/stable/Protocol.UndefinedError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -76,7 +76,7 @@

      Functions

      message(exception)

      - Source + Source diff --git a/docs/stable/Regex.html b/docs/stable/Regex.html index 760503fd0..3c31a3b3a 100644 --- a/docs/stable/Regex.html +++ b/docs/stable/Regex.html @@ -173,7 +173,7 @@

      Examples

      Regex.captures %r/c(?<foo>d)/g, "abcd"  #=> [{:foo, ["d"]}]
       
      - Source + Source

      compile(source, options // "") @@ -191,7 +191,7 @@

      Examples

      Compiles the regular expression according to the given options. Fails with Regex.CompileError if the regex cannot be compiled.

      - Source + Source

      groups(arg1) @@ -203,7 +203,7 @@

      Examples

      Regex.groups %r/(?<foo>foo)/g #=> ["foo"]
       
      - Source + Source

      index(arg1, string) @@ -218,7 +218,7 @@

      Examples

      Regex.index %r/e/, "abcd" #=> nil
      - Source + Source

      match?(arg1, string) @@ -231,7 +231,7 @@

      Examples

      Regex.match? %r/foo/, "bar" #=> false
      - Source + Source

      opts(arg1) @@ -243,14 +243,14 @@

      Examples

      Regex.opts %r(foo)m #=> 'm'
       
      - Source + Source

      re_pattern(arg1)

      Returns the underlying re_pattern in the regular expression.

      - Source + Source

      replace(arg1, string, replacement, options // []) @@ -272,7 +272,7 @@

      Examples

      Regex.replace(%r/(b)/, "abc", "[\\1]") #=> "a[b]c"
      - Source + Source

      run(regex, string, options // []) @@ -286,7 +286,7 @@

      Examples

      Regex.run %r/e/, "abcd" #=> nil
      - Source + Source

      scan(regex, string, options // []) @@ -303,7 +303,7 @@

      Examples

      Regex.scan %r/e/, "abcd" #=> []
      - Source + Source

      source(arg1) @@ -315,7 +315,7 @@

      Examples

      Regex.source %r(foo) #=> "foo"
       
      - Source + Source

      split(regex, string, options // []) @@ -323,7 +323,7 @@

      Examples

      Split the given target in the number of parts specified. If no ammount of parts is given, it defaults to :infinity.

      - Source + Source
      diff --git a/docs/stable/RuntimeError.html b/docs/stable/RuntimeError.html index 17b6a9586..e577fdb95 100644 --- a/docs/stable/RuntimeError.html +++ b/docs/stable/RuntimeError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/stable/SyntaxError.html b/docs/stable/SyntaxError.html index 1ddb24bf4..f55b48af5 100644 --- a/docs/stable/SyntaxError.html +++ b/docs/stable/SyntaxError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -82,7 +82,7 @@

      Functions

      message(exception)

      - Source + Source diff --git a/docs/stable/SystemLimitError.html b/docs/stable/SystemLimitError.html index 7265a4da8..e7c034a60 100644 --- a/docs/stable/SystemLimitError.html +++ b/docs/stable/SystemLimitError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/stable/TokenMissingError.html b/docs/stable/TokenMissingError.html index 3c0a39bcd..1bd8d0775 100644 --- a/docs/stable/TokenMissingError.html +++ b/docs/stable/TokenMissingError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -82,7 +82,7 @@

      Functions

      message(exception)

      - Source + Source diff --git a/docs/stable/UndefinedFunctionError.html b/docs/stable/UndefinedFunctionError.html index 04665acbc..c39e2844b 100644 --- a/docs/stable/UndefinedFunctionError.html +++ b/docs/stable/UndefinedFunctionError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -82,7 +82,7 @@

      Functions

      message(exception)

      - Source + Source diff --git a/docs/stable/modules_list.html b/docs/stable/modules_list.html index fc68c6a5f..57f6e21d7 100644 --- a/docs/stable/modules_list.html +++ b/docs/stable/modules_list.html @@ -16,7 +16,7 @@
    3065. - -
    3066. - - - Binary.Dict - - Binary.Dict -
    3067. -
        - - -
      • - - new/0 - - Binary.Dict -
      • - -
      • - - new/1 - - Binary.Dict -
      • - -
      • - - new/2 - - Binary.Dict -
      • -
    3068. @@ -1146,6 +1114,45 @@

      ExUnit.CLIFormatter

    3069. + +
    3070. + + + Callbacks + + ExUnit.Callbacks +
    3071. +
    3072. @@ -1159,11 +1166,29 @@

    3073. - test/2 + test/3 ExUnit.Case
    3074. + +
    3075. + + + CaseTemplate + + ExUnit.CaseTemplate +
    3076. +
        + + +
      • + + using/2 + + ExUnit.CaseTemplate +
      • +
    3077. @@ -1220,13 +1245,6 @@

      -
    3078. - - after_spawn/1 - - ExUnit -
    3079. -
    3080. configure/1 @@ -1961,7 +1979,375 @@

      IO

    3081. @@ -2463,13 +2849,6 @@

      Kernel

    3082. -
    3083. - - />/2 - - Kernel -
    3084. -
    3085. </2 @@ -4591,6 +4970,20 @@

      +
    3086. + + + Tasks.Compile.Leex + + Mix.Tasks.Compile.Leex +
    3087. +
        + + +
      • + + run/1 + + Mix.Tasks.Compile.Leex +
      • + +
      +
    3088. + + + Tasks.Compile.Yecc + + Mix.Tasks.Compile.Yecc +
    3089. +
        + + +
      • + + run/1 + + Mix.Tasks.Compile.Yecc +
      • +
    3090. @@ -5245,6 +5681,13 @@

      Node

    3091. +
    3092. + + connect/1 + + Node +
    3093. +
    3094. disconnect/1 @@ -5354,38 +5797,6 @@

      OptionParser

    3095. - -
    3096. - - - OrdDict - - OrdDict -
    3097. -
        - - -
      • - - new/0 - - OrdDict -
      • - -
      • - - new/1 - - OrdDict -
      • - -
      • - - new/2 - - OrdDict -
      • -
    3098. @@ -5741,13 +6152,6 @@

      Process

    3099. -
    3100. - - self/0 - - Process -
    3101. -
    3102. spawn/1 diff --git a/docs/stable/protocols_list.html b/docs/stable/protocols_list.html index 6e20e63b2..fb603231f 100644 --- a/docs/stable/protocols_list.html +++ b/docs/stable/protocols_list.html @@ -16,7 +16,7 @@
    3103. - -
    3104. - - - Binary.Dict - - Access.Binary.Dict -
    3105. -
        - - -
      • - - access/2 - - Access.Binary.Dict -
      • -
    3106. @@ -130,24 +112,6 @@

      Access.List

    3107. - -
    3108. - - - OrdDict - - Access.OrdDict -
    3109. -
        - - -
      • - - access/2 - - Access.OrdDict -
      • -
      @@ -492,31 +456,6 @@

      • - - - Binary.Dict - - Enum.Iterator.Binary.Dict -
      • -
          - - -
        • - - count/1 - - Enum.Iterator.Binary.Dict -
        • - -
        • - - iterator/1 - - Enum.Iterator.Binary.Dict -
        • - -
        -
      • Function @@ -590,31 +529,6 @@

        Enum.Iterator.List

      • -
      -
    3110. - - - OrdDict - - Enum.Iterator.OrdDict -
    3111. -
        - - -
      • - - count/1 - - Enum.Iterator.OrdDict -
      • - -
      • - - iterator/1 - - Enum.Iterator.OrdDict -
      • -
    3112. diff --git a/docs/stable/records_list.html b/docs/stable/records_list.html index 08c77a5de..1e06e3fdc 100644 --- a/docs/stable/records_list.html +++ b/docs/stable/records_list.html @@ -16,7 +16,7 @@

      - Elixir v0.8.0 + Elixir v0.8.1

      diff --git a/css/style.css b/css/style.css index f8358e6d6..b8bdd30fc 100644 --- a/css/style.css +++ b/css/style.css @@ -763,7 +763,7 @@ body.source div.menu li.source a { #copyright { text-align: center; font-size: 12px; - margin: 30px 0 0 10px; + margin: 10px; } /* Media Queries (mobile browsing) From 780cebc33d9529a17ae205e4c1ce4621436a5ef1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Fri, 5 Apr 2013 11:21:42 -0600 Subject: [PATCH 375/437] Split into three sections --- _includes/important-links.html | 13 ++++++++++--- getting_started/2.markdown | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/_includes/important-links.html b/_includes/important-links.html index bae278ab2..ee635ff32 100644 --- a/_includes/important-links.html +++ b/_includes/important-links.html @@ -1,12 +1,19 @@
      -

      Important Links

      +

      Join the Community

      +
      + + diff --git a/getting_started/2.markdown b/getting_started/2.markdown index ff6c9e1e0..ed7c8aa3a 100644 --- a/getting_started/2.markdown +++ b/getting_started/2.markdown @@ -575,7 +575,7 @@ You may not see exactly `<0.36.0>` back, but something similar. If there are no ...> end Too late -Notice we spawned a new process using the `spawn` function passing another function as argument. Elixir also supports `spawn_link`, which spawns a child process but keeps the parent and child connected. This way, if the child dies unexpectedly, the parent receives a notification. [`Process`](/docs/stable/Process.html) and [`Node`](/docs/stable/Node.html) modules contains many functions to manage processes, including spawning and get information about processes running in other nodes in the network. +Notice we spawned a new process using the `spawn` function passing another function as argument. [`Process`](/docs/stable/Process.html) and [`Node`](/docs/stable/Node.html) modules contains many functions to manage processes, including spawning and get information about processes running in other nodes in the network. We will go in more detail about those on chapter 6. ## 2.9 Exceptions From 29b8614e9fe1e322bd6f3102dd958cc49e596167 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sun, 7 Apr 2013 21:27:25 -0600 Subject: [PATCH 376/437] Add link to emacs mode --- _includes/important-links.html | 1 + 1 file changed, 1 insertion(+) diff --git a/_includes/important-links.html b/_includes/important-links.html index ee635ff32..f02ff5b58 100644 --- a/_includes/important-links.html +++ b/_includes/important-links.html @@ -20,6 +20,7 @@

      Important links

      Code editor support

      From 5ccc7c380ce0aa69a048dafccb6db57b126edc25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Fri, 12 Apr 2013 18:15:28 -0700 Subject: [PATCH 377/437] Update docs on master --- docs/master/Access.Atom.html | 8 +- docs/master/Access.Function.html | 8 +- docs/master/Access.HashDict.html | 8 +- docs/master/Access.List.html | 16 +- docs/master/Access.html | 8 +- docs/master/BadArityError.html | 6 +- docs/master/BadFunctionError.html | 6 +- docs/master/Behaviour.html | 6 +- docs/master/Binary.Chars.Atom.html | 6 +- docs/master/Binary.Chars.BitString.html | 6 +- docs/master/Binary.Chars.List.html | 12 +- docs/master/Binary.Chars.Number.html | 8 +- docs/master/Binary.Chars.html | 8 +- docs/master/Binary.Inspect.Atom.html | 17 +- docs/master/Binary.Inspect.BitString.html | 14 +- docs/master/Binary.Inspect.Function.html | 8 +- docs/master/Binary.Inspect.HashDict.html | 8 +- docs/master/Binary.Inspect.List.html | 17 +- docs/master/Binary.Inspect.Number.html | 11 +- docs/master/Binary.Inspect.PID.html | 8 +- docs/master/Binary.Inspect.Port.html | 8 +- docs/master/Binary.Inspect.Range.html | 6 +- docs/master/Binary.Inspect.Reference.html | 8 +- docs/master/Binary.Inspect.Regex.html | 11 +- docs/master/Binary.Inspect.Tuple.html | 14 +- docs/master/Binary.Inspect.html | 8 +- docs/master/Bitwise.html | 68 +- docs/master/CaseClauseError.html | 6 +- docs/master/Code.LoadError.html | 6 +- docs/master/Code.html | 94 +- docs/master/CompileError.html | 6 +- docs/master/Dict.html | 266 ++-- docs/master/EEx.Engine.html | 14 +- docs/master/EEx.SmartEngine.html | 10 +- docs/master/EEx.html | 28 +- docs/master/Enum.Iterator.Function.html | 12 +- docs/master/Enum.Iterator.HashDict.html | 12 +- docs/master/Enum.Iterator.List.html | 12 +- docs/master/Enum.Iterator.Range.html | 10 +- docs/master/Enum.Iterator.html | 12 +- docs/master/Enum.html | 310 +++-- docs/master/ErlangError.html | 6 +- docs/master/ExUnit.Assertions.html | 76 +- docs/master/ExUnit.CLIFormatter.html | 68 +- docs/master/ExUnit.Callbacks.html | 18 +- docs/master/ExUnit.Case.html | 6 +- docs/master/ExUnit.CaseTemplate.html | 6 +- docs/master/ExUnit.ExpectationError.html | 25 +- docs/master/ExUnit.Formatter.html | 44 +- docs/master/ExUnit.html | 50 +- docs/master/Exception.html | 22 +- docs/master/File.CopyError.html | 6 +- docs/master/File.Error.html | 6 +- docs/master/File.IteratorError.html | 6 +- docs/master/File.html | 219 ++- docs/master/FunctionClauseError.html | 6 +- docs/master/HashDict.html | 74 +- docs/master/IEx.Autocomplete.html | 6 +- docs/master/IEx.Helpers.html | 94 +- docs/master/IEx.Remsh.html | 6 +- docs/master/IEx.html | 22 +- docs/master/IO.ANSI.html | 210 ++- docs/master/IO.html | 46 +- docs/master/Kernel.CLI.html | 6 +- docs/master/Kernel.ParallelCompiler.html | 10 +- docs/master/Kernel.ParallelRequire.html | 6 +- docs/master/Kernel.SpecialForms.html | 233 ++-- docs/master/Kernel.Typespec.html | 68 +- docs/master/Kernel.html | 1433 ++++++++++++++------ docs/master/KeyError.html | 6 +- docs/master/Keyword.html | 165 ++- docs/master/List.Chars.Atom.html | 6 +- docs/master/List.Chars.BitString.html | 6 +- docs/master/List.Chars.List.html | 6 +- docs/master/List.Chars.Number.html | 6 +- docs/master/List.Chars.html | 8 +- docs/master/List.Dict.html | 70 +- docs/master/List.html | 197 +-- docs/master/Macro.Env.html | 18 +- docs/master/Macro.html | 85 +- docs/master/MatchError.html | 6 +- docs/master/Mix.Deps.html | 42 +- docs/master/Mix.Generator.html | 24 +- docs/master/Mix.InvalidTaskError.html | 6 +- docs/master/Mix.Local.html | 14 +- docs/master/Mix.NoTaskError.html | 6 +- docs/master/Mix.OutOfDateDepsError.html | 6 +- docs/master/Mix.Project.html | 22 +- docs/master/Mix.SCM.html | 52 +- docs/master/Mix.Shell.IO.html | 18 +- docs/master/Mix.Shell.Process.html | 22 +- docs/master/Mix.Shell.html | 24 +- docs/master/Mix.Task.html | 48 +- docs/master/Mix.Tasks.App.Start.html | 6 +- docs/master/Mix.Tasks.Clean.html | 6 +- docs/master/Mix.Tasks.Compile.App.html | 6 +- docs/master/Mix.Tasks.Compile.Elixir.html | 6 +- docs/master/Mix.Tasks.Compile.Erlang.html | 18 +- docs/master/Mix.Tasks.Compile.Leex.html | 6 +- docs/master/Mix.Tasks.Compile.Yecc.html | 6 +- docs/master/Mix.Tasks.Compile.html | 6 +- docs/master/Mix.Tasks.Deps.Check.html | 6 +- docs/master/Mix.Tasks.Deps.Clean.html | 6 +- docs/master/Mix.Tasks.Deps.Compile.html | 6 +- docs/master/Mix.Tasks.Deps.Get.html | 6 +- docs/master/Mix.Tasks.Deps.Loadpaths.html | 6 +- docs/master/Mix.Tasks.Deps.Unlock.html | 6 +- docs/master/Mix.Tasks.Deps.Update.html | 6 +- docs/master/Mix.Tasks.Deps.html | 6 +- docs/master/Mix.Tasks.Do.html | 6 +- docs/master/Mix.Tasks.Escriptize.html | 6 +- docs/master/Mix.Tasks.Help.html | 6 +- docs/master/Mix.Tasks.Loadpaths.html | 6 +- docs/master/Mix.Tasks.Local.Install.html | 6 +- docs/master/Mix.Tasks.Local.Uninstall.html | 6 +- docs/master/Mix.Tasks.Local.html | 6 +- docs/master/Mix.Tasks.New.html | 6 +- docs/master/Mix.Tasks.Run.html | 6 +- docs/master/Mix.Tasks.Test.html | 9 +- docs/master/Mix.Utils.html | 54 +- docs/master/Mix.html | 30 +- docs/master/Module.html | 119 +- docs/master/Node.html | 58 +- docs/master/OptionParser.html | 42 +- docs/master/Path.html | 172 ++- docs/master/Port.html | 38 +- docs/master/Process.html | 126 +- docs/master/Protocol.UndefinedError.html | 6 +- docs/master/Range.Iterator.Number.html | 10 +- docs/master/Range.Iterator.html | 12 +- docs/master/Record.html | 70 +- docs/master/Regex.html | 115 +- docs/master/String.html | 379 ++++-- docs/master/Supervisor.Behaviour.html | 14 +- docs/master/SyntaxError.html | 6 +- docs/master/System.html | 78 +- docs/master/TokenMissingError.html | 6 +- docs/master/URI.FTP.html | 10 +- docs/master/URI.HTTP.html | 10 +- docs/master/URI.HTTPS.html | 10 +- docs/master/URI.LDAP.html | 10 +- docs/master/URI.Parser.html | 10 +- docs/master/URI.SFTP.html | 10 +- docs/master/URI.TFTP.html | 10 +- docs/master/URI.html | 26 +- docs/master/UndefinedFunctionError.html | 6 +- docs/master/index.html | 2 +- docs/master/modules_list.html | 152 ++- docs/master/protocols_list.html | 2 +- docs/master/records_list.html | 20 +- 150 files changed, 4501 insertions(+), 2034 deletions(-) diff --git a/docs/master/Access.Atom.html b/docs/master/Access.Atom.html index cfaef7331..93b060e67 100644 --- a/docs/master/Access.Atom.html +++ b/docs/master/Access.Atom.html @@ -29,14 +29,14 @@

      - Source + Source -

      Functions summary

      +

      Functions summary

      • @@ -62,7 +62,9 @@

        Functions

        at compilation time. If we reach this, we should raise an exception.

      - Source + + Source + diff --git a/docs/master/Access.Function.html b/docs/master/Access.Function.html index 3641fcbf8..6c3b1811f 100644 --- a/docs/master/Access.Function.html +++ b/docs/master/Access.Function.html @@ -29,14 +29,14 @@

      - Source + Source -

      Functions summary

      +

      Functions summary

      • @@ -63,7 +63,9 @@

        Functions

        is useful because it allows a function to be passed as argument in places a dict would also fit.

        - Source + + Source + diff --git a/docs/master/Access.HashDict.html b/docs/master/Access.HashDict.html index 803c01df3..1fc3e6a9b 100644 --- a/docs/master/Access.HashDict.html +++ b/docs/master/Access.HashDict.html @@ -29,14 +29,14 @@

        - Source + Source -

        Functions summary

        +

        Functions summary

        • @@ -59,7 +59,9 @@

          Functions

          access(dict, key)

          - Source + + Source + diff --git a/docs/master/Access.List.html b/docs/master/Access.List.html index 4392d3825..039f84ecc 100644 --- a/docs/master/Access.List.html +++ b/docs/master/Access.List.html @@ -36,7 +36,7 @@

          -

          Functions summary

          +

          Functions summary

          • @@ -62,14 +62,18 @@

            Functions

            Examples

            -
            keywords = [a: 1, b: 2]
            -keywords[:a] #=> 1
            +
            iex> keywords = [a: 1, b: 2]
            +...> keywords[:a]
            +1
             
            -star_ratings = [{1.0, "★"}, {1.5, "★☆"}, {2.0, "★★"}]
            -star_ratings[1.5] #=> "★☆"
            +iex> star_ratings = [{1.0, "★"}, {1.5, "★☆"}, {2.0, "★★"}]
            +...> star_ratings[1.5]
            +"★☆"
             
            - Source + + Source + diff --git a/docs/master/Access.html b/docs/master/Access.html index 05836aec8..f5c601309 100644 --- a/docs/master/Access.html +++ b/docs/master/Access.html @@ -43,7 +43,7 @@

            Source -

            Implementations

            +

            Implementations

            • @@ -76,7 +76,7 @@

              Implementations

              -

              Functions summary

              +

              Functions summary

              • @@ -100,7 +100,9 @@

                Functions

                Receives the element being accessed and the access item.

                - Source + + Source + diff --git a/docs/master/BadArityError.html b/docs/master/BadArityError.html index 610242362..3c67ceecf 100644 --- a/docs/master/BadArityError.html +++ b/docs/master/BadArityError.html @@ -53,7 +53,7 @@

                Fields (and defaults)

                -

                Functions summary

                +

                Functions summary

                • @@ -76,7 +76,9 @@

                  Functions

                  message(exception)

                  - Source + + Source + diff --git a/docs/master/BadFunctionError.html b/docs/master/BadFunctionError.html index f797d80fc..a9e50c445 100644 --- a/docs/master/BadFunctionError.html +++ b/docs/master/BadFunctionError.html @@ -47,7 +47,7 @@

                  Fields (and defaults)

                  -

                  Functions summary

                  +

                  Functions summary

                  • @@ -70,7 +70,9 @@

                    Functions

                    message(exception)

                    - Source + + Source + diff --git a/docs/master/Behaviour.html b/docs/master/Behaviour.html index 055e314b0..9d1511984 100644 --- a/docs/master/Behaviour.html +++ b/docs/master/Behaviour.html @@ -82,7 +82,7 @@

                    Implementation

                    -

                    Macros summary

                    +

                    Macros summary

                    • @@ -106,7 +106,9 @@

                      Macros

                      Defines a callback according to the given type specification.

                      - Source + + Source + diff --git a/docs/master/Binary.Chars.Atom.html b/docs/master/Binary.Chars.Atom.html index 0a7726df0..b8ca4a619 100644 --- a/docs/master/Binary.Chars.Atom.html +++ b/docs/master/Binary.Chars.Atom.html @@ -36,7 +36,7 @@

                      -

                      Functions summary

                      +

                      Functions summary

                      • @@ -61,7 +61,9 @@

                        Functions

                        Convert the atom literally to a binary, except nil which is converted to an empty string.

                        - Source + + Source + diff --git a/docs/master/Binary.Chars.BitString.html b/docs/master/Binary.Chars.BitString.html index 2e297c089..dd6c9da4b 100644 --- a/docs/master/Binary.Chars.BitString.html +++ b/docs/master/Binary.Chars.BitString.html @@ -36,7 +36,7 @@

                        -

                        Functions summary

                        +

                        Functions summary

                        • @@ -60,7 +60,9 @@

                          Functions

                          Simply returns the binary itself.

                          - Source + + Source + diff --git a/docs/master/Binary.Chars.List.html b/docs/master/Binary.Chars.List.html index f1276dc7d..b86e507aa 100644 --- a/docs/master/Binary.Chars.List.html +++ b/docs/master/Binary.Chars.List.html @@ -36,7 +36,7 @@

                          -

                          Functions summary

                          +

                          Functions summary

                          • @@ -65,11 +65,15 @@

                            Functions

                            Examples

                            -
                            to_binary 'foo' #=> "foo"
                            -to_binary ["foo", 'bar'] #=> "foobar"
                            +
                            iex> to_binary 'foo'
                            +"foo"
                            +iex> to_binary ["foo", 'bar']
                            +"foobar"
                             
                            - Source + + Source + diff --git a/docs/master/Binary.Chars.Number.html b/docs/master/Binary.Chars.Number.html index 8880de46d..a9d1f0680 100644 --- a/docs/master/Binary.Chars.Number.html +++ b/docs/master/Binary.Chars.Number.html @@ -29,14 +29,14 @@

                            - Source + Source -

                            Functions summary

                            +

                            Functions summary

                            • @@ -60,7 +60,9 @@

                              Functions

                              Simply converts the number (integer or a float) to a binary.

                              - Source + + Source + diff --git a/docs/master/Binary.Chars.html b/docs/master/Binary.Chars.html index c2bccad36..e3b444ff9 100644 --- a/docs/master/Binary.Chars.html +++ b/docs/master/Binary.Chars.html @@ -46,7 +46,7 @@

                              Source -

                              Implementations

                              +

                              Implementations

                              • @@ -79,7 +79,7 @@

                                Implementations

                                -

                                Functions summary

                                +

                                Functions summary

                                • @@ -102,7 +102,9 @@

                                  Functions

                                  to_binary(thing)

                                  - Source + + Source + diff --git a/docs/master/Binary.Inspect.Atom.html b/docs/master/Binary.Inspect.Atom.html index a8e5c73e8..c3456d59b 100644 --- a/docs/master/Binary.Inspect.Atom.html +++ b/docs/master/Binary.Inspect.Atom.html @@ -38,22 +38,25 @@

                                  Examples

                                  -
                                  inspect(:foo)    #=> ":foo"
                                  -inspect(nil)     #=> "nil"
                                  -inspect(Foo.Bar) #=> "Foo.Bar"
                                  +
                                  iex> inspect(:foo)
                                  +":foo"
                                  +iex> inspect(nil)
                                  +"nil"
                                  +iex> inspect(Foo.Bar)
                                  +"Foo.Bar"
                                   
                                  - Source + Source -

                                  Functions summary

                                  +

                                  Functions summary

                                  • @@ -76,7 +79,9 @@

                                    Functions

                                    inspect(atom, _)

                                    - Source + + Source + diff --git a/docs/master/Binary.Inspect.BitString.html b/docs/master/Binary.Inspect.BitString.html index 29b836854..ae68fda85 100644 --- a/docs/master/Binary.Inspect.BitString.html +++ b/docs/master/Binary.Inspect.BitString.html @@ -34,21 +34,23 @@

                                    Examples

                                    -
                                    inspect("bar")   #=> "bar"
                                    -inspect("f\"oo") #=> "f\"oo"
                                    +
                                    iex> inspect("bar")
                                    +"\"bar\""
                                    +iex> inspect("f\"oo")
                                    +"\"f\\\"oo\""
                                     
                                    - Source + Source -

                                    Functions summary

                                    +

                                    Functions summary

                                    • @@ -71,7 +73,9 @@

                                      Functions

                                      inspect(thing, opts)

                                      - Source + + Source + diff --git a/docs/master/Binary.Inspect.Function.html b/docs/master/Binary.Inspect.Function.html index 594a95d4d..fda8c6e1a 100644 --- a/docs/master/Binary.Inspect.Function.html +++ b/docs/master/Binary.Inspect.Function.html @@ -34,14 +34,14 @@

                                      - Source + Source -

                                      Functions summary

                                      +

                                      Functions summary

                                      • @@ -64,7 +64,9 @@

                                        Functions

                                        inspect(function, _opts)

                                        - Source + + Source + diff --git a/docs/master/Binary.Inspect.HashDict.html b/docs/master/Binary.Inspect.HashDict.html index 8310a21b1..537eb06a9 100644 --- a/docs/master/Binary.Inspect.HashDict.html +++ b/docs/master/Binary.Inspect.HashDict.html @@ -29,14 +29,14 @@

                                        - Source + Source -

                                        Functions summary

                                        +

                                        Functions summary

                                        • @@ -59,7 +59,9 @@

                                          Functions

                                          inspect(dict, opts)

                                          - Source + + Source + diff --git a/docs/master/Binary.Inspect.List.html b/docs/master/Binary.Inspect.List.html index f6bb1fe73..c33640502 100644 --- a/docs/master/Binary.Inspect.List.html +++ b/docs/master/Binary.Inspect.List.html @@ -41,22 +41,25 @@

                                          Examples

                                          -
                                          inspect('bar')       #=> 'bar'
                                          -inspect([0|'bar'])   #=> "[0,98,97,114]"
                                          -inspect([:foo,:bar]) #=> "[:foo, :bar]"
                                          +
                                          iex> inspect('bar')
                                          +"'bar'"
                                          +iex> inspect([0|'bar'])
                                          +"[0,98,97,114]"
                                          +iex> inspect([:foo,:bar])
                                          +"[:foo,:bar]"
                                           
                                          - Source + Source -

                                          Functions summary

                                          +

                                          Functions summary

                                          • @@ -79,7 +82,9 @@

                                            Functions

                                            inspect(thing, opts)

                                            - Source + + Source + diff --git a/docs/master/Binary.Inspect.Number.html b/docs/master/Binary.Inspect.Number.html index 71c96d6f9..5bcb50ae8 100644 --- a/docs/master/Binary.Inspect.Number.html +++ b/docs/master/Binary.Inspect.Number.html @@ -33,20 +33,21 @@

                                            Examples

                                            -
                                            inspect(1) #=> "1"
                                            +
                                            iex> inspect(1)
                                            +"1"
                                             
                                            - Source + Source -

                                            Functions summary

                                            +

                                            Functions summary

                                            • @@ -69,7 +70,9 @@

                                              Functions

                                              inspect(thing, _)

                                              - Source + + Source + diff --git a/docs/master/Binary.Inspect.PID.html b/docs/master/Binary.Inspect.PID.html index 523c5e439..6d4c3d956 100644 --- a/docs/master/Binary.Inspect.PID.html +++ b/docs/master/Binary.Inspect.PID.html @@ -34,14 +34,14 @@

                                              - Source + Source -

                                              Functions summary

                                              +

                                              Functions summary

                                              • @@ -64,7 +64,9 @@

                                                Functions

                                                inspect(pid, _)

                                                - Source + + Source + diff --git a/docs/master/Binary.Inspect.Port.html b/docs/master/Binary.Inspect.Port.html index 8aafdc3d8..18cbf0c1b 100644 --- a/docs/master/Binary.Inspect.Port.html +++ b/docs/master/Binary.Inspect.Port.html @@ -34,14 +34,14 @@

                                                - Source + Source -

                                                Functions summary

                                                +

                                                Functions summary

                                                • @@ -64,7 +64,9 @@

                                                  Functions

                                                  inspect(port, _)

                                                  - Source + + Source + diff --git a/docs/master/Binary.Inspect.Range.html b/docs/master/Binary.Inspect.Range.html index af92c4386..f4ecd5222 100644 --- a/docs/master/Binary.Inspect.Range.html +++ b/docs/master/Binary.Inspect.Range.html @@ -36,7 +36,7 @@

                                                  -

                                                  Functions summary

                                                  +

                                                  Functions summary

                                                  • @@ -59,7 +59,9 @@

                                                    Functions

                                                    inspect(arg1, opts)

                                                    - Source + + Source + diff --git a/docs/master/Binary.Inspect.Reference.html b/docs/master/Binary.Inspect.Reference.html index 68be56e93..28c597f46 100644 --- a/docs/master/Binary.Inspect.Reference.html +++ b/docs/master/Binary.Inspect.Reference.html @@ -34,14 +34,14 @@

                                                    - Source + Source -

                                                    Functions summary

                                                    +

                                                    Functions summary

                                                    • @@ -64,7 +64,9 @@

                                                      Functions

                                                      inspect(ref, _)

                                                      - Source + + Source + diff --git a/docs/master/Binary.Inspect.Regex.html b/docs/master/Binary.Inspect.Regex.html index 78be58370..9a7a2ad44 100644 --- a/docs/master/Binary.Inspect.Regex.html +++ b/docs/master/Binary.Inspect.Regex.html @@ -33,20 +33,21 @@

                                                      Examples

                                                      -
                                                      inspect(%r/foo/m) #=> "%r\"foo\"m"
                                                      +
                                                      iex> inspect(%r/foo/m)
                                                      +"%r\"foo\"m"
                                                       
                                                      - Source + Source -

                                                      Functions summary

                                                      +

                                                      Functions summary

                                                      • @@ -69,7 +70,9 @@

                                                        Functions

                                                        inspect(regex, opts)

                                                        - Source + + Source + diff --git a/docs/master/Binary.Inspect.Tuple.html b/docs/master/Binary.Inspect.Tuple.html index 871a750c5..ca9699b61 100644 --- a/docs/master/Binary.Inspect.Tuple.html +++ b/docs/master/Binary.Inspect.Tuple.html @@ -34,21 +34,23 @@

                                                        Examples

                                                        -
                                                        inspect({1,2,3})            #=> "{1,2,3}"
                                                        -inspect(ArgumentError.new)  #=> ArgumentError[message: "argument error"]
                                                        +
                                                        iex> inspect({1,2,3})
                                                        +"{1,2,3}"
                                                        +iex> inspect(ArgumentError.new)
                                                        +"ArgumentError[message: \"argument error\"]"
                                                         
                                                        - Source + Source -

                                                        Functions summary

                                                        +

                                                        Functions summary

                                                        • @@ -71,7 +73,9 @@

                                                          Functions

                                                          inspect(tuple, opts)

                                                          - Source + + Source + diff --git a/docs/master/Binary.Inspect.html b/docs/master/Binary.Inspect.html index f24fb214b..7989caba7 100644 --- a/docs/master/Binary.Inspect.html +++ b/docs/master/Binary.Inspect.html @@ -43,7 +43,7 @@

                                                          Source -

                                                          Implementations

                                                          +

                                                          Implementations

                                                          • @@ -124,7 +124,7 @@

                                                            Implementations

                                                            -

                                                            Functions summary

                                                            +

                                                            Functions summary

                                                            • @@ -147,7 +147,9 @@

                                                              Functions

                                                              inspect(thing, opts)

                                                              - Source + + Source + diff --git a/docs/master/Bitwise.html b/docs/master/Bitwise.html index 5b1a86f55..17e6ffdcf 100644 --- a/docs/master/Bitwise.html +++ b/docs/master/Bitwise.html @@ -33,16 +33,20 @@

                                                              The easiest way to use is to simply import them into your module:

                                                              -
                                                              use Bitwise
                                                              +
                                                              iex> use Bitwise
                                                              +...> bnot 1
                                                              +-2
                                                               
                                                              -bnot 1   #=> -2
                                                              -1 &&& 1  #=> 1
                                                              +iex> use Bitwise
                                                              +...> 1 &&& 1
                                                              +1
                                                               

                                                              You can select to include only or skip operators by passing options:

                                                              -
                                                              use Bitwise, only_operators: true
                                                              -1 &&& 1 #=> 1
                                                              +
                                                              iex> use Bitwise, only_operators: true
                                                              +...> 1 &&& 1
                                                              +1
                                                               
                                                              @@ -57,7 +61,7 @@

                                                              -

                                                              Macros summary

                                                              +

                                                              Macros summary

                                                              • @@ -141,28 +145,36 @@

                                                                Macros

                                                                Bitwise and as operator.

                                                                - Source + + Source +

                                                                left <<< right

                                                                Arithmetic bitshift left as operator.

                                                                - Source + + Source +

                                                                left >>> right

                                                                Arithmetic bitshift right as operator.

                                                                - Source + + Source +

                                                                left ^^^ right

                                                                Bitwise xor as operator.

                                                                - Source + + Source +

                                                                __using__(options) @@ -175,63 +187,81 @@

                                                                Macros

                                                              • :skip_operators - Skip operators;
                                                              - Source + + Source +

                                                              band(left, right)

                                                              Bitwise and.

                                                              - Source + + Source +

                                                              bnot(expr)

                                                              Bitwise not.

                                                              - Source + + Source +

                                                              bor(left, right)

                                                              Bitwise or.

                                                              - Source + + Source +

                                                              bsl(left, right)

                                                              Arithmetic bitshift left.

                                                              - Source + + Source +

                                                              bsr(left, right)

                                                              Arithmetic bitshift right.

                                                              - Source + + Source +

                                                              bxor(left, right)

                                                              Bitwise xor.

                                                              - Source + + Source +

                                                              left ||| right

                                                              Bitwise or as operator.

                                                              - Source + + Source +

                                                              ~~~(expr)

                                                              Bitwise not as operator.

                                                              - Source + + Source +
                                                              diff --git a/docs/master/CaseClauseError.html b/docs/master/CaseClauseError.html index baf5b128a..c55f70bcc 100644 --- a/docs/master/CaseClauseError.html +++ b/docs/master/CaseClauseError.html @@ -47,7 +47,7 @@

                                                              Fields (and defaults)

                                                              -

                                                              Functions summary

                                                              +

                                                              Functions summary

                                                              • @@ -70,7 +70,9 @@

                                                                Functions

                                                                message(exception)

                                                                - Source + + Source + diff --git a/docs/master/Code.LoadError.html b/docs/master/Code.LoadError.html index d4388adca..32c74822a 100644 --- a/docs/master/Code.LoadError.html +++ b/docs/master/Code.LoadError.html @@ -47,7 +47,7 @@

                                                                Fields (and defaults)

                                                                -

                                                                Functions summary

                                                                +

                                                                Functions summary

                                                                • @@ -70,7 +70,9 @@

                                                                  Functions

                                                                  message(exception)

                                                                  - Source + + Source + diff --git a/docs/master/Code.html b/docs/master/Code.html index d8ddfbd97..ee791a161 100644 --- a/docs/master/Code.html +++ b/docs/master/Code.html @@ -43,7 +43,7 @@

                                                                  -

                                                                  Functions summary

                                                                  +

                                                                  Functions summary

                                                                  • @@ -153,7 +153,9 @@

                                                                    Functions

                                                                    Appends a path to Erlang VM code path. The path is expanded with Path.expand before added.

                                                                    - Source + + Source +

                                                                    compile_string(string, file // "nofile") @@ -164,7 +166,9 @@

                                                                    Functions

                                                                    For compiling many files at once, check Kernel.ParallelCompiler.

                                                                    - Source + + Source +

                                                                    compiler_options() @@ -172,7 +176,9 @@

                                                                    Functions

                                                                    Loads the compilation options from the code server. Check compiler_options/1 for more information.

                                                                    - Source + + Source +

                                                                    compiler_options(opts) @@ -192,7 +198,9 @@

                                                                    Functions

                                                                    without raising errors, false by default;
                                                                  - Source + + Source +

                                                                  delete_path(path) @@ -200,7 +208,9 @@

                                                                  Functions

                                                                  Deletes a path from Erlang VM code path. The path is expanded with Path.expand before deleted.

                                                                  - Source + + Source +

                                                                  ensure_compiled(module) @@ -217,7 +227,9 @@

                                                                  Functions

                                                                  Check ensure_loaded/1 for more information on module loading and when to use ensure_loaded/1 or ensure_compiled/1.

                                                                  - Source + + Source +

                                                                  ensure_compiled?(module) @@ -225,7 +237,9 @@

                                                                  Functions

                                                                  Similar to ensure_compiled/1, but returns a boolean in case it could be ensured or not.

                                                                  - Source + + Source +

                                                                  ensure_loaded(module) @@ -267,7 +281,9 @@

                                                                  Code.ensure_compiled

                                                                  must be used just in same rare conditions, usually involving macros that needs to invoke a module for callback information.

                                                                  - Source + + Source +

                                                                  ensure_loaded?(module) @@ -275,7 +291,9 @@

                                                                  Code.ensure_compiled

                                                                  Similar to ensure_loaded/1, but returns a boolean in case it could be ensured or not.

                                                                  - Source + + Source +

                                                                  eval(string, binding // [], opts // []) @@ -310,19 +328,21 @@

                                                                  Code.ensure_compiled

                                                                  Examples

                                                                  -
                                                                  Code.eval "a + b", [a: 1, b: 2], file: __ENV__.file, line: __ENV__.line
                                                                  -#=> { 3, [ {:a, 1}, {:b, 2} ] }
                                                                  +
                                                                  iex> Code.eval "a + b", [a: 1, b: 2], file: __ENV__.file, line: __ENV__.line
                                                                  +{ 3, [ {:a, 1}, {:b, 2} ] }
                                                                   

                                                                  For convenience, you can my pass __ENV__ as argument and all imports, requires and aliases will be automatically carried over:

                                                                  -
                                                                  Code.eval "a + b", [a: 1, b: 2], __ENV__
                                                                  -#=> { 3, [ {:a, 1}, {:b, 2} ] }
                                                                  +
                                                                  iex> Code.eval "a + b", [a: 1, b: 2], __ENV__
                                                                  +{ 3, [ {:a, 1}, {:b, 2} ] }
                                                                   
                                                                  - Source + + Source +

                                                                  eval_quoted(quoted, binding // [], opts // []) @@ -334,20 +354,22 @@

                                                                  Examples

                                                                  Examples

                                                                  -
                                                                  contents = quote hygiene: false, do: a + b
                                                                  -
                                                                  -Code.eval_quoted contents, [a: 1, b: 2], file: __ENV__.file, line: __ENV__.line
                                                                  -#=> { 3, [ {:a, 1}, {:b, 2} ] }
                                                                  +
                                                                  iex> contents = quote hygiene: [vars: false], do: a + b
                                                                  +...> Code.eval_quoted contents, [a: 1, b: 2], file: __ENV__.file, line: __ENV__.line
                                                                  +{ 3, [ {:a, 1}, {:b, 2} ] }
                                                                   

                                                                  For convenience, you can my pass __ENV__ as argument and all options will be automatically extracted from the environment:

                                                                  -
                                                                  Code.eval_quoted contents, [a: 1, b: 2], __ENV__
                                                                  -#=> { 3, [ {:a, 1}, {:b, 2} ] }
                                                                  +
                                                                  iex> contents = quote hygiene: [vars: false], do: a + b
                                                                  +...> Code.eval_quoted contents, [a: 1, b: 2], __ENV__
                                                                  +{ 3, [ {:a, 1}, {:b, 2} ] }
                                                                   
                                                                  - Source + + Source +

                                                                  load_file(file, relative_to // nil) @@ -363,14 +385,18 @@

                                                                  Examples

                                                                  a given file, the given file will be loaded N times. Check require_file if you don't want a file to be loaded concurrently.

                                                                  - Source + + Source +

                                                                  loaded_files()

                                                                  Returns all the loaded files.

                                                                  - Source + + Source +

                                                                  prepend_path(path) @@ -378,7 +404,9 @@

                                                                  Examples

                                                                  Prepends a path to Erlang VM code path. The path is expanded with Path.expand before added.

                                                                  - Source + + Source +

                                                                  require_file(file, relative_to // nil) @@ -395,7 +423,9 @@

                                                                  Examples

                                                                  file, the given file will be loaded only once. Check load_file if you want a file to be loaded concurrently.

                                                                  - Source + + Source +

                                                                  string_to_ast(string, opts // []) @@ -413,7 +443,9 @@

                                                                  Options

                                                                  when non-existing atoms are found by the tokenizer.

                                                                - Source + + Source +

                                                                string_to_ast!(string, opts // []) @@ -425,7 +457,9 @@

                                                                Options

                                                                Check Code.string_to_ast/2 for options information.

                                                                - Source + + Source +

                                                                unload_files(files) @@ -435,7 +469,9 @@

                                                                Options

                                                                calling this function only removes it from the list, allowing it to be required again.

                                                                - Source + + Source + diff --git a/docs/master/CompileError.html b/docs/master/CompileError.html index 4adb8976b..18c9dbc33 100644 --- a/docs/master/CompileError.html +++ b/docs/master/CompileError.html @@ -59,7 +59,7 @@

                                                                Fields (and defaults)

                                                                -

                                                                Functions summary

                                                                +

                                                                Functions summary

                                                                • @@ -82,7 +82,9 @@

                                                                  Functions

                                                                  message(exception)

                                                                  - Source + + Source + diff --git a/docs/master/Dict.html b/docs/master/Dict.html index c9c8c0318..734ed8134 100644 --- a/docs/master/Dict.html +++ b/docs/master/Dict.html @@ -43,13 +43,29 @@

                                                                  For simplicity's sake, in the examples below everytime new is used, it implies one of the module-specific -calls like the two above. Likewise, when the result of -a function invocation is shown in the form [a: 1, b: 2], -it implies that the returned value is actually of the -same dict type as the input one.

                                                                  +calls like above. Likewise, when the result of a function +invocation is shown in the form [a: 1, b: 2], it implies +that the returned value is actually of the same dict type +as the input one.

                                                                  -

                                                                  Keep in mind that all dicts are also required to -implement both Access and Enum.Iterator protocols.

                                                                  +

                                                                  Protocols

                                                                  + +

                                                                  Besides implementing the functions in this module, all +dictionaries are also required to implement the Access +protocol:

                                                                  + +
                                                                  iex> dict = HashDict.new
                                                                  +...> dict = Dict.put dict, :hello, :world
                                                                  +...> dict[:hello]
                                                                  +:world
                                                                  +
                                                                  + +

                                                                  And also the Enum.Iterator protocol, allowing one to write:

                                                                  + +
                                                                  Enum.each dict, fn { k, v } ->
                                                                  +  IO.puts "#{k}: #{v}"
                                                                  +end
                                                                  +
                                                                  @@ -61,7 +77,7 @@

                                                                  -

                                                                  Functions summary

                                                                  +

                                                                  Functions summary

                                                                  • @@ -145,7 +161,7 @@

                                                                    Functions summary

                                                                    -

                                                                    Callbacks summary

                                                                    +

                                                                    Callbacks summary

                                                                    • @@ -243,21 +259,28 @@

                                                                      Functions

                                                                      Examples

                                                                      -
                                                                      d = new [a: 1, b: 2]
                                                                      -Dict.delete d, :a      #=> [b: 2]
                                                                      +
                                                                      iex> d = HashDict.new [a: 1, b: 2]
                                                                      +...> d = Dict.delete d, :a
                                                                      +...> Dict.get d, :a
                                                                      +nil
                                                                       
                                                                      -d = new [b: 2]
                                                                      -Dict.delete d, :a      #=> [b: 2]
                                                                      +iex> d = HashDict.new [b: 2]
                                                                      +...> Dict.delete(d, :a) == d
                                                                      +true
                                                                       
                                                                      - Source + + Source +

                                                                      empty(dict)

                                                                      Returns an empty dict of the same type as dict.

                                                                      - Source + + Source +

                                                                      get(dict, key, default // nil) @@ -267,13 +290,22 @@

                                                                      Examples

                                                                      Examples

                                                                      -
                                                                      d = new [a: 1]
                                                                      -Dict.get d, :a     #=> 1
                                                                      -Dict.get d, :b     #=> nil
                                                                      -Dict.get d, :b, 3  #=> 3
                                                                      +
                                                                      iex> d = HashDict.new [a: 1]
                                                                      +...> Dict.get d, :a
                                                                      +1
                                                                      +
                                                                      +iex> d = HashDict.new [a: 1]
                                                                      +...> Dict.get d, :b
                                                                      +nil
                                                                      +
                                                                      +iex> d = HashDict.new [a: 1]
                                                                      +...> Dict.get d, :b, 3
                                                                      +3
                                                                       
                                                                      - Source + + Source +

                                                                      get!(dict, key) @@ -283,12 +315,17 @@

                                                                      Examples

                                                                      Examples

                                                                      -
                                                                      d = new [a: 1]
                                                                      -Dict.get d, :a     #=> 1
                                                                      -Dict.get d, :b     #=> raises KeyError[key: :b]
                                                                      +
                                                                      iex> d = HashDict.new [a: 1]
                                                                      +...> Dict.get d, :a
                                                                      +1
                                                                      +iex> d = HashDict.new [a: 1]
                                                                      +...> Dict.get! d, :b
                                                                      +** (KeyError) key not found: :b
                                                                       
                                                                      - Source + + Source +

                                                                      has_key?(dict, key) @@ -297,12 +334,18 @@

                                                                      Examples

                                                                      Examples

                                                                      -
                                                                      d = new [a: 1]
                                                                      -Dict.has_key?(d, :a)  #=> true
                                                                      -Dict.has_key?(d, :b)  #=> false
                                                                      +
                                                                      iex> d = HashDict.new [a: 1]
                                                                      +...> Dict.has_key?(d, :a)
                                                                      +true
                                                                      +
                                                                      +iex> d = HashDict.new [a: 1]
                                                                      +...> Dict.has_key?(d, :b)
                                                                      +false
                                                                       
                                                                      - Source + + Source +

                                                                      keys(dict) @@ -313,11 +356,14 @@

                                                                      Examples

                                                                      Examples

                                                                      -
                                                                      d = new [a: 1, b: 2]
                                                                      -Dict.keys d  #=> [:a,:b]
                                                                      +
                                                                      iex> d = HashDict.new [a: 1, b: 2]
                                                                      +...> Enum.sort Dict.keys d
                                                                      +[:a,:b]
                                                                       
                                                                      - Source + + Source +

                                                                      merge(dict, enum) @@ -327,13 +373,16 @@

                                                                      Examples

                                                                      Examples

                                                                      -
                                                                      d1 = new [a: 1, b: 2]
                                                                      -d2 = new [a: 3, d: 4]
                                                                      -Dict.merge d1, d2
                                                                      -#=> [a: 3, b: 2, d: 4]
                                                                      +
                                                                      iex> d1 = HashDict.new [a: 1, b: 2]
                                                                      +...> d2 = HashDict.new [a: 3, d: 4]
                                                                      +...> d = Dict.merge d1, d2
                                                                      +...> [a: Dict.get(d, :a), b: Dict.get(d, :b), d: Dict.get(d, :d)]
                                                                      +[a: 3, b: 2, d: 4]
                                                                       
                                                                      - Source + + Source +

                                                                      merge(dict, enum, fun) @@ -344,15 +393,18 @@

                                                                      Examples

                                                                      Examples

                                                                      -
                                                                      d1 = new [a: 1, b: 2]
                                                                      -d2 = new [a: 3, d: 4]
                                                                      -Dict.merge d1, d2, fn _k, v1, v2 ->
                                                                      -  v1 + v2
                                                                      -end
                                                                      -#=> [a: 4, b: 2, d: 4]
                                                                      +
                                                                      iex> d1 = HashDict.new [a: 1, b: 2]
                                                                      +...> d2 = HashDict.new [a: 3, d: 4]
                                                                      +...> d = Dict.merge d1, d2, fn _k, v1, v2 ->
                                                                      +...>   v1 + v2
                                                                      +...> end
                                                                      +...> [a: Dict.get(d, :a), b: Dict.get(d, :b), d: Dict.get(d, :d)]
                                                                      +[a: 4, b: 2, d: 4]
                                                                       
                                                                      - Source + + Source +

                                                                      put(dict, key, val) @@ -362,12 +414,15 @@

                                                                      Examples

                                                                      Examples

                                                                      -
                                                                      d = new [a: 1, b: 2]
                                                                      -Dict.put d, :a, 3
                                                                      -#=> [a: 3, b: 2]
                                                                      +
                                                                      iex> d = HashDict.new [a: 1, b: 2]
                                                                      +...> d = Dict.put d, :a, 3
                                                                      +...> Dict.get d, :a
                                                                      +3
                                                                       
                                                                      - Source + + Source +

                                                                      put_new(dict, key, val) @@ -376,12 +431,15 @@

                                                                      Examples

                                                                      Examples

                                                                      -
                                                                      d = new [a: 1, b: 2]
                                                                      -Dict.put_new d, :a, 3
                                                                      -#=> [a: 1, b: 2]
                                                                      +
                                                                      iex> d = HashDict.new [a: 1, b: 2]
                                                                      +...> d = Dict.put_new d, :a, 3
                                                                      +...> Dict.get d, :a
                                                                      +1
                                                                       
                                                                      - Source + + Source +

                                                                      size(dict) @@ -390,11 +448,14 @@

                                                                      Examples

                                                                      Examples

                                                                      -
                                                                      d = new [a: 1, b: 2]
                                                                      -Dict.size d  #=> 2
                                                                      +
                                                                      iex> d = HashDict.new [a: 1, b: 2]
                                                                      +...> Dict.size d
                                                                      +2
                                                                       
                                                                      - Source + + Source +

                                                                      to_list(dict) @@ -402,7 +463,9 @@

                                                                      Examples

                                                                      Returns a list of key-value pairs stored in dict. No particular order is enforced.

                                                                      - Source + + Source +

                                                                      update(dict, key, fun) @@ -412,12 +475,15 @@

                                                                      Examples

                                                                      Examples

                                                                      -
                                                                      d = new [a: 1, b: 2]
                                                                      -Dict.update d, :a, fn val -> -val end
                                                                      -#=> [a: -1, b: 2]
                                                                      +
                                                                      iex> d = HashDict.new [a: 1, b: 2]
                                                                      +...> d = Dict.update d, :a, fn val -> -val end
                                                                      +...> Dict.get d, :a
                                                                      +-1
                                                                       
                                                                      - Source + + Source +

                                                                      update(dict, key, initial, fun) @@ -428,12 +494,15 @@

                                                                      Examples

                                                                      Examples

                                                                      -
                                                                      d = new [a: 1, b: 2]
                                                                      -Dict.update d, :c, 3, fn val -> -val end
                                                                      -#=> [a: 1, b: 2, c: 3]
                                                                      +
                                                                      iex> d = HashDict.new [a: 1, b: 2]
                                                                      +...> d = Dict.update d, :c, 3, fn val -> -val end
                                                                      +...> Dict.get d, :c
                                                                      +3
                                                                       
                                                                      - Source + + Source +

                                                                      values(dict) @@ -442,11 +511,14 @@

                                                                      Examples

                                                                      Examples

                                                                      -
                                                                      d = new [a: 1, b: 2]
                                                                      -Dict.values d  #=> [1,2]
                                                                      +
                                                                      iex> d = HashDict.new [a: 1, b: 2]
                                                                      +...> Enum.sort Dict.values d
                                                                      +[1,2]
                                                                       
                                                                      - Source + + Source + @@ -461,97 +533,129 @@

                                                                      Callbacks

                                                                      values(t())

                                                                      - Source + + Source +

                                                                      update(t(), key(), value(), (value() -> value()))

                                                                      - Source + + Source +

                                                                      update(t(), key(), (value() -> value()))

                                                                      - Source + + Source +

                                                                      to_list(t())

                                                                      - Source + + Source +

                                                                      size(t())

                                                                      - Source + + Source +

                                                                      put_new(t(), key(), value())

                                                                      - Source + + Source +

                                                                      put(t(), key(), value())

                                                                      - Source + + Source +

                                                                      merge(t(), t(), (key(), value(), value() -> value()))

                                                                      - Source + + Source +

                                                                      merge(t(), t())

                                                                      - Source + + Source +

                                                                      keys(t())

                                                                      - Source + + Source +

                                                                      has_key?(t(), key())

                                                                      - Source + + Source +

                                                                      get!(t(), key())

                                                                      - Source + + Source +

                                                                      get(t(), key(), value())

                                                                      - Source + + Source +

                                                                      get(t(), key())

                                                                      - Source + + Source +

                                                                      empty(t())

                                                                      - Source + + Source +

                                                                      delete(t(), key())

                                                                      - Source + + Source +
                                                                      diff --git a/docs/master/EEx.Engine.html b/docs/master/EEx.Engine.html index bfb153eee..8c2f180c2 100644 --- a/docs/master/EEx.Engine.html +++ b/docs/master/EEx.Engine.html @@ -59,7 +59,7 @@

                                                                      -

                                                                      Functions summary

                                                                      +

                                                                      Functions summary

                                                                      • @@ -92,7 +92,9 @@

                                                                        Functions

                                                                        behaviour_info(atom1)

                                                                        - Source + + Source +

                                                                        handle_expr(buffer, list2, expr) @@ -105,14 +107,18 @@

                                                                        Functions

                                                                        All other markers are not implemented by this engine.

                                                                        - Source + + Source +

                                                                        handle_text(buffer, text)

                                                                        The default implementation simply concatenates text to the buffer.

                                                                        - Source + + Source +
                                                                        diff --git a/docs/master/EEx.SmartEngine.html b/docs/master/EEx.SmartEngine.html index 4ae1cf5de..1a87e1514 100644 --- a/docs/master/EEx.SmartEngine.html +++ b/docs/master/EEx.SmartEngine.html @@ -41,7 +41,7 @@

                                                                        -

                                                                        Functions summary

                                                                        +

                                                                        Functions summary

                                                                        • @@ -69,13 +69,17 @@

                                                                          Functions

                                                                          handle_expr(buffer, mark, expr)

                                                                          - Source + + Source +

                                                                          handle_text(buffer, text)

                                                                          - Source + + Source +
                                                                          diff --git a/docs/master/EEx.html b/docs/master/EEx.html index 8b5bc787f..1ff63367f 100644 --- a/docs/master/EEx.html +++ b/docs/master/EEx.html @@ -116,7 +116,7 @@

                                                                          Macros

                                                                          -

                                                                          Functions summary

                                                                          +

                                                                          Functions summary

                                                                          • @@ -143,7 +143,7 @@

                                                                            Functions summary

                                                                            -

                                                                            Macros summary

                                                                            +

                                                                            Macros summary

                                                                            • @@ -171,7 +171,9 @@

                                                                              Functions

                                                                              Get a filename and generate a quoted expression that can be evaluated by Elixir or compiled to a function.

                                                                              - Source + + Source +

                                                                              compile_string(source, options // []) @@ -179,7 +181,9 @@

                                                                              Functions

                                                                              Get a string source and generate a quoted expression that can be evaluated by Elixir or compiled to a function.

                                                                              - Source + + Source +

                                                                              eval_file(filename, bindings // [], options // []) @@ -196,7 +200,9 @@

                                                                              Examples

                                                                              #=> "foo baz"
                                                                      - Source + + Source +

                                                                      eval_string(source, bindings // [], options // []) @@ -209,7 +215,9 @@

                                                                      Examples

                                                                      #=> "foo baz"
                                                              - Source + + Source + @@ -243,7 +251,9 @@

                                                              Examples

                                                              Sample.sample(1, 2) #=> "3"
                                                              - Source + + Source +

                                                              function_from_string(kind, name, source, args // [], options // []) @@ -262,7 +272,9 @@

                                                              Examples

                                                              Sample.sample(1, 2) #=> "3"

                                                        - Source + + Source + diff --git a/docs/master/Enum.Iterator.Function.html b/docs/master/Enum.Iterator.Function.html index b100394e3..e0da8a50a 100644 --- a/docs/master/Enum.Iterator.Function.html +++ b/docs/master/Enum.Iterator.Function.html @@ -29,14 +29,14 @@

                                                        - Source + Source -

                                                        Functions summary

                                                        +

                                                        Functions summary

                                                        • @@ -64,13 +64,17 @@

                                                          Functions

                                                          count(function)

                                                          - Source + + Source +

                                                          iterator(function)

                                                          - Source + + Source +
                                                          diff --git a/docs/master/Enum.Iterator.HashDict.html b/docs/master/Enum.Iterator.HashDict.html index 151f5e591..4a5089a5e 100644 --- a/docs/master/Enum.Iterator.HashDict.html +++ b/docs/master/Enum.Iterator.HashDict.html @@ -29,14 +29,14 @@

                                                          - Source + Source -

                                                          Functions summary

                                                          +

                                                          Functions summary

                                                          • @@ -64,13 +64,17 @@

                                                            Functions

                                                            count(dict)

                                                            - Source + + Source +

                                                            iterator(dict)

                                                            - Source + + Source +
                                                            diff --git a/docs/master/Enum.Iterator.List.html b/docs/master/Enum.Iterator.List.html index ec6727148..9e201a3ca 100644 --- a/docs/master/Enum.Iterator.List.html +++ b/docs/master/Enum.Iterator.List.html @@ -29,14 +29,14 @@

                                                            - Source + Source -

                                                            Functions summary

                                                            +

                                                            Functions summary

                                                            • @@ -64,13 +64,17 @@

                                                              Functions

                                                              count(list)

                                                              - Source + + Source +

                                                              iterator(list)

                                                              - Source + + Source +
                                                              diff --git a/docs/master/Enum.Iterator.Range.html b/docs/master/Enum.Iterator.Range.html index 3be0a165c..97b766cc0 100644 --- a/docs/master/Enum.Iterator.Range.html +++ b/docs/master/Enum.Iterator.Range.html @@ -36,7 +36,7 @@

                                                              -

                                                              Functions summary

                                                              +

                                                              Functions summary

                                                              • @@ -64,13 +64,17 @@

                                                                Functions

                                                                count(range)

                                                                - Source + + Source +

                                                                iterator(range)

                                                                - Source + + Source +
                                                                diff --git a/docs/master/Enum.Iterator.html b/docs/master/Enum.Iterator.html index 3e480e06d..73b1e0d41 100644 --- a/docs/master/Enum.Iterator.html +++ b/docs/master/Enum.Iterator.html @@ -48,7 +48,7 @@

                                                                Source -

                                                                Implementations

                                                                +

                                                                Implementations

                                                                • @@ -81,7 +81,7 @@

                                                                  Implementations

                                                                  -

                                                                  Functions summary

                                                                  +

                                                                  Functions summary

                                                                  • @@ -110,7 +110,9 @@

                                                                    Functions

                                                                    The function used to retrieve the collection size.

                                                                    - Source + + Source +

                                                                    iterator(collection) @@ -144,7 +146,9 @@

                                                                    Iterating lists

                                                                    list and the Enum module will be able to take over the list and retrieve the proper iterator function.

                                                                    - Source + + Source + diff --git a/docs/master/Enum.html b/docs/master/Enum.html index 102194a5d..f751041e2 100644 --- a/docs/master/Enum.html +++ b/docs/master/Enum.html @@ -49,7 +49,7 @@

                                                                    -

                                                                    Functions summary

                                                                    +

                                                                    Functions summary

                                                                    • @@ -222,21 +222,25 @@

                                                                      Functions

                                                                      Examples

                                                                      -
                                                                      Enum.all? [2,4,6], fn(x) -> rem(x, 2) == 0 end
                                                                      -#=> true
                                                                      +
                                                                      iex> Enum.all? [2,4,6], fn(x) -> rem(x, 2) == 0 end
                                                                      +true
                                                                       
                                                                      -Enum.all? [2,3,4], fn(x) -> rem(x, 2) == 0 end
                                                                      -#=> false
                                                                      +iex> Enum.all? [2,3,4], fn(x) -> rem(x, 2) == 0 end
                                                                      +false
                                                                       

                                                                      If no function is given, it defaults to checking if all items in the collection evaluate to true.

                                                                      -
                                                                      Enum.all? [1,2,3]   #=> true
                                                                      -Enum.all? [1,nil,3] #=> false
                                                                      +
                                                                      iex> Enum.all? [1,2,3]
                                                                      +true
                                                                      +iex> Enum.all? [1,nil,3]
                                                                      +false
                                                                       
                                                                      - Source + + Source +

                                                                      any?(collection, fun // fn x -> x end) @@ -246,21 +250,25 @@

                                                                      Examples

                                                                      Examples

                                                                      -
                                                                      Enum.any? [2,4,6], fn(x) -> rem(x, 2) == 1 end
                                                                      -#=> false
                                                                      +
                                                                      iex> Enum.any? [2,4,6], fn(x) -> rem(x, 2) == 1 end
                                                                      +false
                                                                       
                                                                      -Enum.any? [2,3,4], fn(x) -> rem(x, 2) == 1 end
                                                                      -#=> true
                                                                      +iex> Enum.any? [2,3,4], fn(x) -> rem(x, 2) == 1 end
                                                                      +true
                                                                       

                                                                      If no function is given, it defaults to checking if at least one item in the collection evaluates to true.

                                                                      -
                                                                      Enum.any? [false,false,false] #=> false
                                                                      -Enum.any? [false,true,false]  #=> true
                                                                      +
                                                                      iex> Enum.any? [false,false,false]
                                                                      +false
                                                                      +iex> Enum.any? [false,true,false]
                                                                      +true
                                                                       
                                                                      - Source + + Source +

                                                                      at!(collection, n) @@ -273,12 +281,17 @@

                                                                      Examples

                                                                      ## Examples

                                                                      -
                                                                        Enum.at! [2,4,6], 0 #=> 2
                                                                      -  Enum.at! [2,4,6], 2 #=> 6
                                                                      -  Enum.at! [2,4,6], 4 #=> raises Enum.OutOfBoundsError
                                                                      +
                                                                        iex> Enum.at! [2,4,6], 0
                                                                      +  2
                                                                      +  iex> Enum.at! [2,4,6], 2
                                                                      +  6
                                                                      +  iex> Enum.at! [2,4,6], 4
                                                                      +  ** (Enum.OutOfBoundsError) out of bounds error
                                                                       
                                                                      - Source + + Source +

                                                                      count(collection) @@ -287,17 +300,22 @@

                                                                      Examples

                                                                      Examples

                                                                      -
                                                                      Enum.count [1,2,3] #=> 3
                                                                      +
                                                                      iex> Enum.count [1,2,3]
                                                                      +3
                                                                       
                                                                      - Source + + Source +

                                                                      count(collection, fun)

                                                                      Counts for how many items the function returns true.

                                                                      - Source + + Source +

                                                                      drop(collection, count) @@ -307,12 +325,17 @@

                                                                      Examples

                                                                      Examples

                                                                      -
                                                                      Enum.drop [1,2,3], 2  #=> [3]
                                                                      -Enum.drop [1,2,3], 10 #=> []
                                                                      -Enum.drop [1,2,3], 0  #=> [1,2,3]
                                                                      +
                                                                      iex> Enum.drop [1,2,3], 2
                                                                      +[3]
                                                                      +iex> Enum.drop [1,2,3], 10
                                                                      +[]
                                                                      +iex> Enum.drop [1,2,3], 0
                                                                      +[1,2,3]
                                                                       
                                                                      - Source + + Source +

                                                                      drop_while(collection, fun) @@ -322,11 +345,13 @@

                                                                      Examples

                                                                      Examples

                                                                      -
                                                                      Enum.drop_while [1,2,3,4,5], fn(x) -> x < 3 end
                                                                      -#=> [3,4,5]
                                                                      +
                                                                      iex> Enum.drop_while [1,2,3,4,5], fn(x) -> x < 3 end
                                                                      +[3,4,5]
                                                                       
                                                                      - Source + + Source +

                                                                      each(collection, fun) @@ -340,7 +365,9 @@

                                                                      Examples

                                                                      Enum.each ['some', 'example'], fn(x) -> IO.puts x end
                                                                       
                                                                      - Source + + Source +

                                                                      empty?(collection) @@ -349,11 +376,15 @@

                                                                      Examples

                                                                      Examples

                                                                      -
                                                                      Enum.empty? []      #=> true
                                                                      -Enum.empty? [1,2,3] #=> false
                                                                      +
                                                                      iex> Enum.empty? []
                                                                      +true
                                                                      +iex> Enum.empty? [1,2,3]
                                                                      +false
                                                                       
                                                                      - Source + + Source +

                                                                      filter(collection, fun) @@ -363,11 +394,13 @@

                                                                      Examples

                                                                      Examples

                                                                      -
                                                                      Enum.filter [1, 2, 3], fn(x) -> rem(x, 2) == 0 end
                                                                      -#=> [2]
                                                                      +
                                                                      iex> Enum.filter [1, 2, 3], fn(x) -> rem(x, 2) == 0 end
                                                                      +[2]
                                                                       
                                                                      - Source + + Source +

                                                                      filter_map(collection, filter, mapper) @@ -376,11 +409,13 @@

                                                                      Examples

                                                                      Examples

                                                                      -
                                                                      Enum.filter_map [1, 2, 3], fn(x) -> rem(x, 2) == 0 end, &1 * 2
                                                                      -#=> [4]
                                                                      +
                                                                      iex> Enum.filter_map [1, 2, 3], fn(x) -> rem(x, 2) == 0 end, &1 * 2
                                                                      +[4]
                                                                       
                                                                      - Source + + Source +

                                                                      find(collection, ifnone // nil, fun) @@ -390,17 +425,19 @@

                                                                      Examples

                                                                      Examples

                                                                      -
                                                                      Enum.find [2,4,6], fn(x) -> rem(x, 2) == 1 end
                                                                      -#=> nil
                                                                      +
                                                                      iex> Enum.find [2,4,6], fn(x) -> rem(x, 2) == 1 end
                                                                      +nil
                                                                       
                                                                      -Enum.find [2,4,6], 0, fn(x) -> rem(x, 2) == 1 end
                                                                      -#=> 0
                                                                      +iex> Enum.find [2,4,6], 0, fn(x) -> rem(x, 2) == 1 end
                                                                      +0
                                                                       
                                                                      -Enum.find [2,3,4], fn(x) -> rem(x, 2) == 1 end
                                                                      -#=> 3
                                                                      +iex> Enum.find [2,3,4], fn(x) -> rem(x, 2) == 1 end
                                                                      +3
                                                                       
                                                                      - Source + + Source +

                                                                      find_index(collection, fun) @@ -412,14 +449,16 @@

                                                                      Examples

                                                                      Examples

                                                                      -
                                                                      Enum.find_index [2,4,6], fn(x) -> rem(x, 2) == 1 end
                                                                      -#=> nil
                                                                      +
                                                                      iex> Enum.find_index [2,4,6], fn(x) -> rem(x, 2) == 1 end
                                                                      +nil
                                                                       
                                                                      -Enum.find_index [2,3,4], fn(x) -> rem(x, 2) == 1 end
                                                                      -#=> 2
                                                                      +iex> Enum.find_index [2,3,4], fn(x) -> rem(x, 2) == 1 end
                                                                      +1
                                                                       
                                                                      - Source + + Source +

                                                                      find_value(collection, ifnone // nil, fun) @@ -429,14 +468,16 @@

                                                                      Examples

                                                                      Examples

                                                                      -
                                                                      Enum.find_value [2,4,6], fn(x) -> rem(x, 2) == 1 end
                                                                      -#=> nil
                                                                      +
                                                                      iex> Enum.find_value [2,4,6], fn(x) -> rem(x, 2) == 1 end
                                                                      +nil
                                                                       
                                                                      -Enum.find_value [2,3,4], fn(x) -> rem(x, 2) == 1 end
                                                                      -#=> true
                                                                      +iex> Enum.find_value [2,3,4], fn(x) -> rem(x, 2) == 1 end
                                                                      +true
                                                                       
                                                                      - Source + + Source +

                                                                      first(collection) @@ -445,11 +486,15 @@

                                                                      Examples

                                                                      Examples

                                                                      -
                                                                      Enum.first []      #=> nil
                                                                      -Enum.first [1,2,3] #=> 1
                                                                      +
                                                                      iex> Enum.first []
                                                                      +nil
                                                                      +iex> Enum.first [1,2,3]
                                                                      +1
                                                                       
                                                                      - Source + + Source +

                                                                      join(collection, joiner // "") @@ -465,12 +510,17 @@

                                                                      Examples

                                                                      Examples

                                                                      -
                                                                      Enum.join([1,2,3])        #=> "123"
                                                                      -Enum.join([1,2,3], " = ") #=> "1 = 2 = 3"
                                                                      -Enum.join([1,2,3], ' = ') #=> '1 = 2 = 3'
                                                                      +
                                                                      iex> Enum.join([1,2,3])
                                                                      +"123"
                                                                      +iex> Enum.join([1,2,3], " = ")
                                                                      +"1 = 2 = 3"
                                                                      +iex> Enum.join([1,2,3], ' = ')
                                                                      +'1 = 2 = 3'
                                                                       
                                                                      - Source + + Source +

                                                                      map(collection, fun) @@ -484,14 +534,16 @@

                                                                      Examples

                                                                      Examples

                                                                      -
                                                                      Enum.map [1, 2, 3], fn(x) -> x * 2 end
                                                                      -#=> [2, 4, 6]
                                                                      +
                                                                      iex> Enum.map [1, 2, 3], fn(x) -> x * 2 end
                                                                      +[2, 4, 6]
                                                                       
                                                                      -Enum.map [a: 1, b: 2], fn({k, v}) -> { k, -v } end
                                                                      -#=> [a: -1, b: -2]
                                                                      +iex> Enum.map [a: 1, b: 2], fn({k, v}) -> { k, -v } end
                                                                      +[a: -1, b: -2]
                                                                       
                                                                      - Source + + Source +

                                                                      map_join(collection, joiner // "", mapper) @@ -507,12 +559,17 @@

                                                                      Examples

                                                                      Examples

                                                                      -
                                                                      Enum.map_join([1,2,3], &1 * 2)        #=> "246"
                                                                      -Enum.map_join([1,2,3], " = ", &1 * 2) #=> "2 = 4 = 6"
                                                                      -Enum.map_join([1,2,3], ' = ', &1 * 2) #=> '2 = 4 = 6'
                                                                      +
                                                                      iex> Enum.map_join([1,2,3], &1 * 2)
                                                                      +"246"
                                                                      +iex> Enum.map_join([1,2,3], " = ", &1 * 2)
                                                                      +"2 = 4 = 6"
                                                                      +iex> Enum.map_join([1,2,3], ' = ', &1 * 2)
                                                                      +'2 = 4 = 6'
                                                                       
                                                                      - Source + + Source +

                                                                      map_reduce(collection, acc, f) @@ -527,11 +584,13 @@

                                                                      Examples

                                                                      Examples

                                                                      -
                                                                      Enum.map_reduce [1, 2, 3], 0, fn(x, acc) -> { x * 2, x + acc } end
                                                                      -#=> { [2, 4, 6], 6 }
                                                                      +
                                                                      iex> Enum.map_reduce [1, 2, 3], 0, fn(x, acc) -> { x * 2, x + acc } end
                                                                      +{ [2, 4, 6], 6 }
                                                                       
                                                                      - Source + + Source +

                                                                      partition(collection, fun) @@ -542,11 +601,13 @@

                                                                      Examples

                                                                      Examples

                                                                      -
                                                                      Enum.partition [1, 2, 3], fn(x) -> rem(x, 2) == 0 end
                                                                      -#=> { [2], [1,3] }
                                                                      +
                                                                      iex> Enum.partition [1, 2, 3], fn(x) -> rem(x, 2) == 0 end
                                                                      +{ [2], [1,3] }
                                                                       
                                                                      - Source + + Source +

                                                                      reduce(collection, acc, fun) @@ -557,11 +618,13 @@

                                                                      Examples

                                                                      Examples

                                                                      -
                                                                      Enum.reduce [1, 2, 3], 0, fn(x, acc) -> x + acc end
                                                                      -#=> 6
                                                                      +
                                                                      iex> Enum.reduce [1, 2, 3], 0, fn(x, acc) -> x + acc end
                                                                      +6
                                                                       
                                                                      - Source + + Source +

                                                                      reverse(collection) @@ -570,11 +633,13 @@

                                                                      Examples

                                                                      Examples

                                                                      -
                                                                      Enum.reverse [1, 2, 3]
                                                                      -#=> [3, 2, 1]
                                                                      +
                                                                      iex> Enum.reverse [1, 2, 3]
                                                                      +[3, 2, 1]
                                                                       
                                                                      - Source + + Source +

                                                                      sort(collection) @@ -583,10 +648,13 @@

                                                                      Examples

                                                                      Examples

                                                                      -
                                                                      Enum.sort [3,2,1] #=> [1,2,3]
                                                                      +
                                                                      iex> Enum.sort [3,2,1]
                                                                      +[1,2,3]
                                                                       
                                                                      - Source + + Source +

                                                                      sort(collection, fun) @@ -595,10 +663,13 @@

                                                                      Examples

                                                                      Examples

                                                                      -
                                                                      Enum.sort [3,2,1], &1 > &2 #=> [1,2,3]
                                                                      +
                                                                      iex> Enum.sort [1,2,3], &1 > &2
                                                                      +[3,2,1]
                                                                       
                                                                      - Source + + Source +

                                                                      split(collection, count) @@ -614,28 +685,36 @@

                                                                      Examples

                                                                      Examples

                                                                      -
                                                                      Enum.split [1,2,3], 2  #=> { [1,2], [3] }
                                                                      -Enum.split [1,2,3], 10 #=> { [1,2,3], [] }
                                                                      -Enum.split [1,2,3], 0  #=> { [], [1,2,3] }
                                                                      -Enum.split [1,2,3], -1 #=> { [1,2], [3] }
                                                                      -Enum.split [1,2,3], -5 #=> { [], [1,2,3] }
                                                                      +
                                                                      iex> Enum.split [1,2,3], 2
                                                                      +{ [1,2], [3] }
                                                                      +iex> Enum.split [1,2,3], 10
                                                                      +{ [1,2,3], [] }
                                                                      +iex> Enum.split [1,2,3], 0
                                                                      +{ [], [1,2,3] }
                                                                      +iex> Enum.split [1,2,3], -1
                                                                      +{ [1,2], [3] }
                                                                      +iex> Enum.split [1,2,3], -5
                                                                      +{ [], [1,2,3] }
                                                                       
                                                                      - Source + + Source +

                                                                      split_while(collection, fun)

                                                                      -

                                                                      Splits collection at the first element, for which fun returns true. -Expects an ordered collection.

                                                                      +

                                                                      Splits collection in two while fun returns true.

                                                                      Examples

                                                                      -
                                                                      Enum.split_while [1,2,3,4], fn x -> x == 2 end
                                                                      -#=> { [1], [2, 3, 4] }
                                                                      +
                                                                      iex> Enum.split_while [1,2,3,4], fn(x) -> x < 3 end
                                                                      +{ [1, 2], [3, 4] }
                                                                       
                                                                      - Source + + Source +

                                                                      take(collection, count) @@ -645,12 +724,17 @@

                                                                      Examples

                                                                      Examples

                                                                      -
                                                                      Enum.take [1,2,3], 2  #=> [1,2]
                                                                      -Enum.take [1,2,3], 10 #=> [1,2,3]
                                                                      -Enum.take [1,2,3], 0  #=> []
                                                                      +
                                                                      iex> Enum.take [1,2,3], 2
                                                                      +[1,2]
                                                                      +iex> Enum.take [1,2,3], 10
                                                                      +[1,2,3]
                                                                      +iex> Enum.take [1,2,3], 0
                                                                      +[]
                                                                       
                                                                      - Source + + Source +

                                                                      take_while(collection, fun) @@ -660,11 +744,13 @@

                                                                      Examples

                                                                      Examples

                                                                      -
                                                                      Enum.take_while [1,2,3], fn(x) -> x < 3 end
                                                                      -#=> [1, 2]
                                                                      +
                                                                      iex> Enum.take_while [1,2,3], fn(x) -> x < 3 end
                                                                      +[1, 2]
                                                                       
                                                                      - Source + + Source +

                                                                      uniq(collection) @@ -673,11 +759,13 @@

                                                                      Examples

                                                                      Examples

                                                                      -
                                                                      Enum.uniq [1,2,3,2,1]
                                                                      -#=> [1, 2, 3]
                                                                      +
                                                                      iex> Enum.uniq [1,2,3,2,1]
                                                                      +[1, 2, 3]
                                                                       
                                                                      - Source + + Source +

                                                                      zip(coll1, coll2) @@ -687,7 +775,9 @@

                                                                      Examples

                                                                      dictated by the first enum. In case the second list is shorter, values are filled with nil.

                                                                      - Source + + Source + diff --git a/docs/master/ErlangError.html b/docs/master/ErlangError.html index aa5f9bbad..5ac451a9d 100644 --- a/docs/master/ErlangError.html +++ b/docs/master/ErlangError.html @@ -47,7 +47,7 @@

                                                                      Fields (and defaults)

                                                                      -

                                                                      Functions summary

                                                                      +

                                                                      Functions summary

                                                                      • @@ -70,7 +70,9 @@

                                                                        Functions

                                                                        message(exception)

                                                                        - Source + + Source + diff --git a/docs/master/ExUnit.Assertions.html b/docs/master/ExUnit.Assertions.html index 4ea3951b1..d29879a3c 100644 --- a/docs/master/ExUnit.Assertions.html +++ b/docs/master/ExUnit.Assertions.html @@ -46,14 +46,14 @@

                                                                        - Source + Source -

                                                                        Functions summary

                                                                        +

                                                                        Functions summary

                                                                        • @@ -100,7 +100,7 @@

                                                                          Functions summary

                                                                          -

                                                                          Macros summary

                                                                          +

                                                                          Macros summary

                                                                          • @@ -168,7 +168,9 @@

                                                                            Examples

                                                                            assert false, "it will never be true"
                                                                             
                                                                            - Source + + Source +

                                                                            assert(value, expected, actual, opts) @@ -182,7 +184,9 @@

                                                                            Examples

                                                                            assert this > that, this, that, reason: "more than"
                                                                             
                                                                            - Source + + Source +

                                                                            assert_in_delta(expected, received, delta, message // nil) @@ -195,7 +199,9 @@

                                                                            Examples

                                                                            assert_in_delta 10, 15, 4
                                                                      - Source + + Source +

                                                                      assert_raise(exception, function) @@ -210,7 +216,9 @@

                                                                      Examples

                                                                      end
                                                                      - Source + + Source +

                                                                      assert_raise(exception, message, function) @@ -225,7 +233,9 @@

                                                                      Examples

                                                                      end
                                                      - Source + + Source +

                                                      flunk(message // "Epic Fail!") @@ -237,7 +247,9 @@

                                                      Examples

                                                      flunk "This should raise an error"
                                                       
                                                      - Source + + Source +

                                                      refute(not_expected, message) @@ -250,7 +262,9 @@

                                                      Examples

                                                      refute true, "This will obviously fail"
                                                       
                                                      - Source + + Source +

                                                      refute_in_delta(expected, received, delta, message // nil) @@ -263,7 +277,9 @@

                                                      Examples

                                                      refute_in_delta 10, 11, 2
                                            - Source + + Source + @@ -289,7 +305,9 @@

                                            Examples

                                            assert true
                                             
                                            - Source + + Source +

                                            assert_receive(expected, timeout // 100, message // nil) @@ -311,10 +329,12 @@

                                            Examples

                                            You can also match against specific patterns:

                                            -
                                            assert_received { :hello, _ }
                                            +
                                            assert_receive { :hello, _ }
                                             
                                            - Source + + Source +

                                            assert_received(expected, message // nil) @@ -336,7 +356,9 @@

                                            Examples

                                            assert_received { :hello, _ }
                                          - Source + + Source +

                                          catch_error(expression) @@ -349,7 +371,9 @@

                                          Examples

                                          assert catch_error(error 1) == 1
                                           
                                          - Source + + Source +

                                          catch_exit(expression) @@ -362,7 +386,9 @@

                                          Examples

                                          assert catch_exit(exit 1) == 1
                                           
                                          - Source + + Source +

                                          catch_throw(expression) @@ -375,7 +401,9 @@

                                          Examples

                                          assert catch_throw(throw 1) == 1
                                           
                                          - Source + + Source +

                                          refute(expected) @@ -390,7 +418,9 @@

                                          Examples

                                          refute false
                                           
                                          - Source + + Source +

                                          refute_receive(not_expected, timeout // 100, message // nil) @@ -410,7 +440,9 @@

                                          Examples

                                          refute_receive :bye, 1000
                                           
                                          - Source + + Source +

                                          refute_received(not_expected, message // nil) @@ -426,7 +458,9 @@

                                          Examples

                                          refute_received :bye
                                    - Source + + Source + diff --git a/docs/master/ExUnit.CLIFormatter.html b/docs/master/ExUnit.CLIFormatter.html index 3f1dd41fe..73bfc9d70 100644 --- a/docs/master/ExUnit.CLIFormatter.html +++ b/docs/master/ExUnit.CLIFormatter.html @@ -40,7 +40,7 @@

                                    -

                                    Functions summary

                                    +

                                    Functions summary

                                    • @@ -79,7 +79,7 @@

                                      Functions summary

                                    • - suite_finished/1 + suite_finished/2
                                    • @@ -94,12 +94,12 @@

                                      Functions summary

                                    • - test_finished/4 + test_finished/2
                                    • - test_started/3 + test_started/2
                                    • @@ -118,73 +118,97 @@

                                      Functions

                                      case_finished(_id, _test_case)

                                      - Source + + Source +

                                      case_started(_id, _test_case)

                                      - Source + + Source +

                                      code_change(_old, state, _extra)

                                      - Source + + Source +

                                      handle_call(arg1, arg2, state)

                                      - Source + + Source +

                                      handle_cast(arg1, state)

                                      - Source + + Source +

                                      handle_info(_msg, state)

                                      - Source + + Source +

                                      init(args)

                                      - Source + + Source +
                                      -

                                      - suite_finished(id) +

                                      + suite_finished(id, ms)

                                      - Source + + Source +

                                      suite_started(_opts)

                                      - Source + + Source +

                                      terminate(reason, state)

                                      - Source + + Source +
                                      -

                                      - test_finished(id, test_case, test, result) +

                                      + test_finished(id, test)

                                      - Source + + Source +
                                      -

                                      - test_started(_id, _test_case, _test) +

                                      + test_started(_id, _test)

                                      - Source + + Source +
                                      diff --git a/docs/master/ExUnit.Callbacks.html b/docs/master/ExUnit.Callbacks.html index 3e645f943..42ef085ee 100644 --- a/docs/master/ExUnit.Callbacks.html +++ b/docs/master/ExUnit.Callbacks.html @@ -74,7 +74,7 @@

                                      Examples

                                      -

                                      Macros summary

                                      +

                                      Macros summary

                                      • @@ -114,7 +114,9 @@

                                        Macros

                                        end, block)

                                        - Source + + Source +

                                        setup_all(var // quote() do @@ -122,7 +124,9 @@

                                        Macros

                                        end, block)

                                        - Source + + Source +

                                        teardown(var // quote() do @@ -130,7 +134,9 @@

                                        Macros

                                        end, block)

                                        - Source + + Source +

                                        teardown_all(var // quote() do @@ -138,7 +144,9 @@

                                        Macros

                                        end, block)

                                        - Source + + Source +
                                        diff --git a/docs/master/ExUnit.Case.html b/docs/master/ExUnit.Case.html index 55b9af469..741e6c8d9 100644 --- a/docs/master/ExUnit.Case.html +++ b/docs/master/ExUnit.Case.html @@ -65,7 +65,7 @@

                                        Examples

                                        -

                                        Macros summary

                                        +

                                        Macros summary

                                        • @@ -103,7 +103,9 @@

                                          Examples

                                          end
                                  - Source + + Source + diff --git a/docs/master/ExUnit.CaseTemplate.html b/docs/master/ExUnit.CaseTemplate.html index 411a3a62d..859468a3e 100644 --- a/docs/master/ExUnit.CaseTemplate.html +++ b/docs/master/ExUnit.CaseTemplate.html @@ -66,7 +66,7 @@

                                  Example

                                  -

                                  Macros summary

                                  +

                                  Macros summary

                                  • @@ -93,7 +93,9 @@

                                    Macros

                                    Allows a developer to code to be invoked when this module is used.

                                    - Source + + Source + diff --git a/docs/master/ExUnit.ExpectationError.html b/docs/master/ExUnit.ExpectationError.html index 441757e55..5a0996039 100644 --- a/docs/master/ExUnit.ExpectationError.html +++ b/docs/master/ExUnit.ExpectationError.html @@ -67,13 +67,24 @@

                                    Fields (and defaults)

                                  • +
                                  • + + description: nil + +
                                  • +
                                  -

                                  Functions summary

                                  +

                                  Functions summary

                                  • + + full_reason/1 + +
                                  • +
                                  • message/1 @@ -90,11 +101,21 @@

                                    Functions summary

                                    Functions

                                    +

                                    + full_reason(exception) +

                                    +
                                    + + Source + +

                                    message(exception)

                                    - Source + + Source +
                                    diff --git a/docs/master/ExUnit.Formatter.html b/docs/master/ExUnit.Formatter.html index 5ea9e8b14..41fabf247 100644 --- a/docs/master/ExUnit.Formatter.html +++ b/docs/master/ExUnit.Formatter.html @@ -46,16 +46,16 @@

                                    -

                                    Callbacks summary

                                    +

                                    Callbacks summary

                                    • - test_finished/4 + test_finished/2
                                    • - test_started/3 + test_started/2
                                    • @@ -70,7 +70,7 @@

                                      Callbacks summary

                                    • - suite_finished/1 + suite_finished/2
                                    • @@ -90,41 +90,53 @@

                                      Callbacks summary

                                      Callbacks

                                      -

                                      - test_finished(id(), test_case(), test(), result()) +

                                      + test_finished(id(), test :: ExUnit.Test.t())

                                      - Source + + Source +
                                      -

                                      - test_started(id(), test_case(), test()) +

                                      + test_started(id(), test :: ExUnit.Test.t())

                                      - Source + + Source +

                                      case_finished(id(), test_case())

                                      - Source + + Source +

                                      case_started(id(), test_case())

                                      - Source + + Source +
                                      -

                                      - suite_finished(id()) +

                                      + suite_finished(id(), miliseconds :: pos_integer())

                                      - Source + + Source +

                                      suite_started(opts :: list())

                                      - Source + + Source +
                                      diff --git a/docs/master/ExUnit.html b/docs/master/ExUnit.html index ebaadefef..c294b6abb 100644 --- a/docs/master/ExUnit.html +++ b/docs/master/ExUnit.html @@ -72,26 +72,6 @@

                                      Case, callbacks and assertions

                                      The ExUnit.Assertions module contains a set of macros to easily generate assertions with appropriate error messages.

                                      -

                                      User config

                                      - -

                                      When started, ExUnit automatically reads a user configuration -from the following locations, in this order:

                                      - -
                                        -
                                      • $EXUNIT_CONFIG environment variable
                                      • -
                                      • $HOME/.ex_unit.exs
                                      • -
                                      - -

                                      If none found, no user config will be read.

                                      - -

                                      User config is an elixir file which should return a keyword list -with ex_unit options. Please note that explicit options passed -to start/1 or configure/1 will take precedence over user options.

                                      - -
                                      # User config example (~/.ex_unit.exs)
                                      -[formatter: ExUnit.Formatter.ANSI]
                                      -
                                      - @@ -102,7 +82,7 @@

                                      User config

                                      -

                                      Functions summary

                                      +

                                      Functions summary

                                      @@ -157,7 +132,9 @@

                                      Options

                                      Defaults to :erlang.system_info(:schedulers_online);

                                    - Source + + Source +

                                    run() @@ -167,7 +144,9 @@

                                    Options

                                    Returns the number of failures.

                                    - Source + + Source +

                                    start(options // []) @@ -179,20 +158,17 @@

                                    Options

                                    In case you want to run tests manually, skip calling this function and rely on configure/1 and run/0 instead.

                                    - Source + + Source +

                                    stop(_state)

                                    - Source -
                                    -

                                    - user_options(user_config // nil) -

                                    -

                                    Returns the configured user options.

                                    -
                                    - Source + + Source +
                                    diff --git a/docs/master/Exception.html b/docs/master/Exception.html index 7c650f79d..b51468ef4 100644 --- a/docs/master/Exception.html +++ b/docs/master/Exception.html @@ -40,7 +40,7 @@

                                    -

                                    Functions summary

                                    +

                                    Functions summary

                                    • @@ -86,13 +86,17 @@

                                      Functions

                                      The current working directory may be given as argument, which is used to prettify the stacktrace.

                                      - Source + + Source +

                                      format_file_line(file, line, cwd)

                                      - Source + + Source +

                                      format_stacktrace(trace // nil) @@ -103,7 +107,9 @@

                                      Functions

                                      calculates the current stacktrace and formats it. As consequence, the value of System.stacktrace is changed.

                                      - Source + + Source +

                                      normalize(exception) @@ -112,7 +118,9 @@

                                      Functions

                                      to Elixir exceptions. Useful when interfacing Erlang code with Elixir code.

                                      - Source + + Source +

                                      Functions

                                      calculates the current stacktrace and formats it. As consequence, the value of System.stacktrace is changed.

                                      - Source + + Source + diff --git a/docs/master/File.CopyError.html b/docs/master/File.CopyError.html index 0c050f7e0..3de5ec201 100644 --- a/docs/master/File.CopyError.html +++ b/docs/master/File.CopyError.html @@ -65,7 +65,7 @@

                                      Fields (and defaults)

                                      -

                                      Functions summary

                                      +

                                      Functions summary

                                      • @@ -88,7 +88,9 @@

                                        Functions

                                        message(exception)

                                        - Source + + Source + diff --git a/docs/master/File.Error.html b/docs/master/File.Error.html index 24ec1fad1..cc974f40c 100644 --- a/docs/master/File.Error.html +++ b/docs/master/File.Error.html @@ -59,7 +59,7 @@

                                        Fields (and defaults)

                                        -

                                        Functions summary

                                        +

                                        Functions summary

                                        • @@ -82,7 +82,9 @@

                                          Functions

                                          message(exception)

                                          - Source + + Source + diff --git a/docs/master/File.IteratorError.html b/docs/master/File.IteratorError.html index 4aff72bd1..677061581 100644 --- a/docs/master/File.IteratorError.html +++ b/docs/master/File.IteratorError.html @@ -47,7 +47,7 @@

                                          Fields (and defaults)

                                          -

                                          Functions summary

                                          +

                                          Functions summary

                                          • @@ -70,7 +70,9 @@

                                            Functions

                                            message(exception)

                                            - Source + + Source + diff --git a/docs/master/File.html b/docs/master/File.html index d921f1233..b2d4e93dc 100644 --- a/docs/master/File.html +++ b/docs/master/File.html @@ -84,7 +84,7 @@

                                            -

                                            Functions summary

                                            +

                                            Functions summary

                                            • @@ -186,6 +186,16 @@

                                              Functions summary

                                              iterator!/2
                                            • +
                                            • + + ls/1 + +
                                            • +
                                            • + + ls!/1 + +
                                            • mkdir/1 @@ -330,7 +340,9 @@

                                              Functions

                                              be passed into Enum to iterate line by line as a binary. Check iterator/1 for more information.

                                              - Source + + Source +

                                              biniterator(file, mode) @@ -339,7 +351,9 @@

                                              Functions

                                              returns its biniterator. Fails for the same reasons as File.open.

                                              - Source + + Source +

                                              biniterator!(file, mode // []) @@ -347,7 +361,9 @@

                                              Functions

                                              Same as biniterator/2 but raises if the file cannot be opened.

                                              - Source + + Source +

                                              cd(path) @@ -355,14 +371,18 @@

                                              Functions

                                              Sets the current working directory. Returns :ok if successful, { :error, reason } otherwise.

                                              - Source + + Source +

                                              cd!(path)

                                              The same as cd/0, but raises an exception if it fails.

                                              - Source + + Source +

                                              cd!(path, function) @@ -374,7 +394,9 @@

                                              Functions

                                              Raises an error if retrieving or changing the current directory fails.

                                              - Source + + Source +

                                              close(io_device) @@ -386,7 +408,9 @@

                                              Functions

                                              close/1 might return an old write error and not even try to close the file. See open/2.

                                              - Source + + Source +

                                              copy(source, destination, bytes_count // :infinity) @@ -405,7 +429,9 @@

                                              Functions

                                              Typical error reasons are the same as in open/2, read/1 and write/2.

                                              - Source + + Source +

                                              copy!(source, destination, bytes_count // :infinity) @@ -413,7 +439,9 @@

                                              Functions

                                              The same as copy/3 but raises an File.CopyError if it fails. Returns the bytes_copied otherwise.

                                              - Source + + Source +

                                              cp(source, destination, callback // fn _, _ -> true end) @@ -436,7 +464,9 @@

                                              Functions

                                              It returns :ok in case of success, returns { :error, reason } otherwise.

                                              - Source + + Source +

                                              cp!(source, destination, callback // fn _, _ -> true end) @@ -444,7 +474,9 @@

                                              Functions

                                              The same as cp/3, but raises File.CopyError if it fails. Returns the list of copied files otherwise.

                                              - Source + + Source +

                                              cp_r(source, destination, callback // fn _, _ -> true end) @@ -494,7 +526,9 @@

                                              Examples

                                              end
                            - Source + + Source +

                            cp_r!(source, destination, callback // fn _, _ -> true end) @@ -502,7 +536,9 @@

                            Examples

                            The same as cp_r/3, but raises File.CopyError if it fails. Returns the list of copied files otherwise.

                            - Source + + Source +

                            cwd() @@ -512,21 +548,27 @@

                            Examples

                            directories of the current directory. For this reason, returns { :ok, cwd } in case of success, { :error, reason } otherwise.

                            - Source + + Source +

                            cwd!()

                            The same as cwd/0, but raises an exception if it fails.

                            - Source + + Source +

                            dir?(path)

                            Returns true if the path is a directory.

                            - Source + + Source +

                            exists?(path) @@ -547,7 +589,9 @@

                            Examples

                            #=> true
            - Source + + Source +

            iterator(device) @@ -565,7 +609,8 @@

            Examples

            quotes per single quotes and write each line to a target file is shown below:

            -
            source = File.iterator("README.md")
            +
            { :ok, device } = File.open("README.md")
            +source = File.iterator(device)
             File.open "NEWREADME.md", [:write], fn(target) ->
               Enum.each source, fn(line) ->
                 IO.write target, Regex.replace(%r/"/, line, "'")
            @@ -573,7 +618,9 @@ 

            Examples

            end
            - Source + + Source +

            iterator(file, mode) @@ -582,7 +629,9 @@

            Examples

            returns its iterator. Fails for the same reasons as File.open.

            - Source + + Source +

            iterator!(file, mode // []) @@ -590,7 +639,31 @@

            Examples

            Same as iterator/2 but raises if the file cannot be opened.

            - Source + + Source + +
            +

            + ls(path // ".") +

            +

            Returns list of files in the given directory.

            + +

            It returns { :ok, [files] } in case of success, +{ :error, reason } otherwise.

            +
            + + Source + +
            +

            + ls!(dir // ".") +

            +

            The same as ls/1 but raises File.Error +in case of an error.

            +
            + + Source +

            mkdir(path) @@ -609,14 +682,18 @@

            Examples

            On some platforms, :enoent is returned instead.
          - Source + + Source +

          mkdir!(path)

          Same as mkdir, but raises an exception in case of failure. Otherwise :ok.

          - Source + + Source +

          mkdir_p(path) @@ -632,14 +709,18 @@

          Examples

        • :enotdir - A component of path is not a directory.
        - Source + + Source +

        mkdir_p!(path)

        Same as mkdir_p, but raises an exception in case of failure. Otherwise :ok.

        - Source + + Source +

        open(path, modes // []) @@ -700,7 +781,9 @@

        Examples

        File.close(file)
        - Source + + Source +

        open(path, modes, function) @@ -720,12 +803,14 @@

        Examples

        Examples

        -
        File.open!("file.txt", [:read, :write], fn(file) ->
        +
        File.open("file.txt", [:read, :write], fn(file) ->
           IO.readline(file)
         end)
         
        - Source + + Source +

        open!(path, modes // []) @@ -733,7 +818,9 @@

        Examples

        Same as open/2 but raises an error if file could not be opened. Returns the io_device otherwise.

        - Source + + Source +

        open!(path, modes, function) @@ -741,7 +828,9 @@

        Examples

        Same as open/3 but raises an error if file could not be opened. Returns the function result otherwise.

        - Source + + Source +

        read(path) @@ -763,7 +852,9 @@

        Examples

        You can use :file.format_error(reason) to get a descriptive string of the error.

        - Source + + Source +

        read!(path) @@ -771,7 +862,9 @@

        Examples

        Returns binary with the contents of the given filename or raises File.Error if an error occurs.

        - Source + + Source +

        regular?(path) @@ -783,7 +876,9 @@

        Examples

        File.regular? __FILE__ #=> true
         
        - Source + + Source +

        rm(path) @@ -811,14 +906,18 @@

        Examples

        #=> {:error, :eperm}
        - Source + + Source +

        rm!(path)

        Same as rm, but raises an exception in case of failure. Otherwise :ok.

        - Source + + Source +

        rm_rf(path) @@ -840,7 +939,9 @@

        Examples

        #=> { :ok, [] }
        - Source + + Source +

        rm_rf!(path) @@ -848,7 +949,9 @@

        Examples

        Same as rm_rf/1 but raises File.Error in case of failures, otherwise the list of files or directories removed.

        - Source + + Source +

        rmdir(path) @@ -865,14 +968,18 @@

        Examples

        #=> {:error, :enotdir}
        - Source + + Source +

        rmdir!(path)

        Same as rmdir/1, but raises an exception in case of failure. Otherwise :ok.

        - Source + + Source +

        stat(path, opts // []) @@ -891,7 +998,9 @@

        Options

        Default is local.
      - Source + + Source +

      stat!(path, opts // []) @@ -899,7 +1008,9 @@

      Options

      Same as stat but returns the File.Stat directly and throws File.Error if an error is returned.

      - Source + + Source +

      touch(path, time // :calendar.local_time()) @@ -907,7 +1018,9 @@

      Options

      Updates modification time (mtime) and access time (atime) of the given file. File is created if it doesn’t exist.

      - Source + + Source +

      touch!(path, time // :calendar.local_time()) @@ -915,7 +1028,9 @@

      Options

      Same as touch/1 but raises an exception if it fails. Returns :ok otherwise.

      - Source + + Source +

      write(path, content, modes // []) @@ -935,14 +1050,18 @@

      Options

    3113. :eisdir - The named file is a directory.
    3114. - Source + + Source +

      write!(path, content, modes // [])

      Same as write/3 but raises an exception if it fails, returns :ok otherwise.

      - Source + + Source +

      write_stat(path, stat, opts // []) @@ -950,7 +1069,9 @@

      Options

      Writes the given File.Stat back to the filesystem at the given path. Returns :ok or { :error, reason }.

      - Source + + Source +

      write_stat!(path, stat, opts // []) @@ -958,7 +1079,9 @@

      Options

      Same as write_stat/3 but raises an exception if it fails. Returns :ok otherwise.

      - Source + + Source +
      diff --git a/docs/master/FunctionClauseError.html b/docs/master/FunctionClauseError.html index 32cd76236..7151988e6 100644 --- a/docs/master/FunctionClauseError.html +++ b/docs/master/FunctionClauseError.html @@ -59,7 +59,7 @@

      Fields (and defaults)

      -

      Functions summary

      +

      Functions summary

      • @@ -82,7 +82,9 @@

        Functions

        message(exception)

        - Source + + Source + diff --git a/docs/master/HashDict.html b/docs/master/HashDict.html index 50c32bcc3..098522ace 100644 --- a/docs/master/HashDict.html +++ b/docs/master/HashDict.html @@ -44,7 +44,7 @@

        -

        Functions summary

        +

        Functions summary

        • @@ -148,21 +148,27 @@

          Functions

          Deletes a value from the dict.

          - Source + + Source +

          empty(_)

          Returns an empty dict.

          - Source + + Source +

          get(dict, key, default // nil)

          Gets the value under key from the dict.

          - Source + + Source +

          get!(dict, key) @@ -170,35 +176,45 @@

          Functions

          Gets the value under key from the dict, raises KeyError if such key does not exist.

          - Source + + Source +

          has_key?(dict, key)

          Checks if the dict has the given key.

          - Source + + Source +

          keys(dict)

          Get all keys in the dict.

          - Source + + Source +

          merge(dict, enum, callback // fn _k, _v1, v2 -> v2 end)

          Merges two dictionaries.

          - Source + + Source +

          new()

          Creates a new empty dict.

          - Source + + Source +

          new(pairs) @@ -208,10 +224,12 @@

          Functions

          Examples

          HashDict.new [{:b,1},{:a,2}]
          -#=> HashDict[a: 1, b: 2]
          +#=> #HashDict<[a: 2, b: 1]>
           
          - Source + + Source +

          new(list, transform) @@ -222,17 +240,21 @@

          Examples

          Examples

          HashDict.new ["a", "b"], fn x -> {x, x} end
          -#=> HashDict[{ "a", "a" }, { "b", "b" }]
          +#=> #HashDict<[{"a","a"},{"b","b"}]>
           
          - Source + + Source +

          put(dict, key, value)

          Puts the given key and value in the dict.

          - Source + + Source +

          put_new(dict, key, value) @@ -240,21 +262,27 @@

          Examples

          Puts the given value under key in the dictionary only if one does not exist yet.

          - Source + + Source +

          size(dict)

          Returns the dict size.

          - Source + + Source +

          to_list(dict)

          Converts the dict to a list.

          - Source + + Source +

          update(dict, key, fun) @@ -263,7 +291,9 @@

          Examples

          to the given function. Raises if the key does not exist in the dictionary.

          - Source + + Source +

          update(dict, key, initial, fun) @@ -272,14 +302,18 @@

          Examples

          to the given function. Adds initial value if the key does not exist in the dicionary.

          - Source + + Source +

          values(dict)

          Get all values in the dict.

          - Source + + Source +
          diff --git a/docs/master/IEx.Autocomplete.html b/docs/master/IEx.Autocomplete.html index 1adbb5e45..fe5735391 100644 --- a/docs/master/IEx.Autocomplete.html +++ b/docs/master/IEx.Autocomplete.html @@ -39,7 +39,7 @@

          -

          Functions summary

          +

          Functions summary

          • @@ -62,7 +62,9 @@

            Functions

            expand(expr)

            - Source + + Source + diff --git a/docs/master/IEx.Helpers.html b/docs/master/IEx.Helpers.html index 9168bad82..d9432d54c 100644 --- a/docs/master/IEx.Helpers.html +++ b/docs/master/IEx.Helpers.html @@ -40,15 +40,17 @@

            • c/2 - compiles a file in the given path
            • +
            • cd/1 - changes the current directory
            • +
            • flush/0 — flush all messages sent to the shell
            • h/0, h/1 - prints help/documentation
            • -
            • t/1 — prints type information
            • -
            • s/1 — prints spec information
            • +
            • l/1 - loads given module beam code by purging the current version
            • m/0 - prints loaded modules
            • +
            • pwd/0 - prints the current working directory
            • r/0, r/1 - recompiles and reloads the given module's source file
            • -
            • l/1 - loads given module beam code by purging the current version
            • +
            • s/1 — prints spec information
            • +
            • t/1 — prints type information
            • v/0 - prints all commands and values
            • v/1 - retrieves nth value from console
            • -
            • flush/0 — flush all messages sent to the shell

            Help for functions in this module can be consulted @@ -74,13 +76,18 @@

            -

            Functions summary

            +

            Functions summary

            • c/2
            • +
            • + + cd/1 + +
            • flush/0 @@ -101,6 +108,11 @@

              Functions summary

              m/0
            • +
            • + + pwd/0 + +
            • r/0 @@ -126,7 +138,7 @@

              Functions summary

              -

              Macros summary

              +

              Macros summary

              • @@ -163,38 +175,66 @@

                Functions

                Examples

                c ["foo.ex"], "ebin"
                -#=> Foo
                +#=> [Foo]
                 
                - Source + + Source + +
                +

                + cd(directory) +

                +

                Changes the shell directory to the given path.

                +
                + + Source +

                flush()

                Flushes all messages sent to the shell and prints them out

                - Source + + Source +

                h()

                Shows the documentation for IEx.Helpers.

                - Source + + Source +

                l(module)

                Purges and reloads specified module

                - Source + + Source +

                m()

                Returns the name and module of all modules loaded.

                - Source + + Source + +
                +

                + pwd() +

                +

                Prints the current working directory.

                +
                + + Source +

                r() @@ -202,7 +242,9 @@

                Examples

                Reloads all modules that were already reloaded at some point with r/1.

                - Source + + Source +

                r(module) @@ -212,14 +254,18 @@

                Examples

                Please note that all the modules defined in the specified files are recompiled and reloaded.

                - Source + + Source +

                v()

                Prints commands history and their result.

                - Source + + Source +

                v(n) @@ -228,7 +274,9 @@

                Examples

                values to lookup query's value from latest to earliest. For instance, v(-1) returns the latest result.

                - Source + + Source + @@ -257,7 +305,9 @@

                Examples

                h Enum.all? - Source + + Source +

                s(module) @@ -273,12 +323,14 @@

                Examples

                s(list_to_atom/1)
                - Source + + Source +

                t(module)

                -

                Prints all types for the given module or prints out a specified type's +

                Prints all types for the given module or prints out a specified type's specification

                Examples

                @@ -288,7 +340,9 @@

                Examples

                t(Enum.t)
                - Source + + Source +
                diff --git a/docs/master/IEx.Remsh.html b/docs/master/IEx.Remsh.html index dccec5b12..65dd784a1 100644 --- a/docs/master/IEx.Remsh.html +++ b/docs/master/IEx.Remsh.html @@ -52,7 +52,7 @@

                -

                Functions summary

                +

                Functions summary

                • @@ -75,7 +75,9 @@

                  Functions

                  expand(node)

                  - Source + + Source + diff --git a/docs/master/IEx.html b/docs/master/IEx.html index e59273ac1..e912bcfe5 100644 --- a/docs/master/IEx.html +++ b/docs/master/IEx.html @@ -50,7 +50,7 @@

                  -

                  Functions summary

                  +

                  Functions summary

                  • @@ -94,35 +94,45 @@

                    Functions

                    Returns registered after spawn callbacks.

                    - Source + + Source +

                    after_spawn(fun)

                    Registers a function to be invoked after IEx process is spawned.

                    - Source + + Source +

                    inspect_opts()

                    Returns currently registered inspect options.

                    - Source + + Source +

                    inspect_opts(opts)

                    Registers options used on inspect.

                    - Source + + Source +

                    started?()

                    Returns true if IEx was properly started.

                    - Source + + Source +
                    diff --git a/docs/master/IO.ANSI.html b/docs/master/IO.ANSI.html index ccb191541..a9dc2aae3 100644 --- a/docs/master/IO.ANSI.html +++ b/docs/master/IO.ANSI.html @@ -45,7 +45,7 @@

                    -

                    Functions summary

                    +

                    Functions summary

                    • @@ -319,105 +319,135 @@

                      Functions

                      Sets foreground color to black

                      - Source + + Source +

                      black_background()

                      Sets background color to black

                      - Source + + Source +

                      Blink: off

                      - Source + + Source +

                      Blink: Rapid. MS-DOS ANSI.SYS; 150 per minute or more; not widely supported

                      - Source + + Source +

                      Blink: Slow. Less than 150 per minute

                      - Source + + Source +

                      blue()

                      Sets foreground color to blue

                      - Source + + Source +

                      blue_background()

                      Sets background color to blue

                      - Source + + Source +

                      bright()

                      Bright (increased intensity) or Bold

                      - Source + + Source +

                      conceal()

                      Conceal. Not widely supported

                      - Source + + Source +

                      crossed_out()

                      Crossed-out. Characters legible, but marked for deletion. Not widely supported.

                      - Source + + Source +

                      cyan()

                      Sets foreground color to cyan

                      - Source + + Source +

                      cyan_background()

                      Sets background color to cyan

                      - Source + + Source +

                      default_background()

                      Default background color

                      - Source + + Source +

                      default_color()

                      Default text color

                      - Source + + Source +

                      encircled()

                      Encircled

                      - Source + + Source +

                      escape(string, emit // terminal?()) @@ -437,10 +467,12 @@

                      Functions

                      Example

                      -

                      IO.ANSI.escape "Hello %{red,bright,green}yes" #=> +

                      iex> IO.ANSI.escape "Hello %{red,bright,green}yes" "Hello \e[31m\e[1m\e[32myes\e[0m"

                      - Source + + Source +

                      escape_fragment(string, emit // terminal?()) @@ -457,206 +489,264 @@

                      Example

                      Example

                      -

                      IO.ANSI.escape "Hello %{red,bright,green}yes%{reset}" #=> +

                      iex> IO.ANSI.escape "Hello %{red,bright,green}yes" "Hello \e[31m\e[1m\e[32myes\e[0m"

                      - Source + + Source +

                      faint()

                      Faint (decreased intensity), not widely supported

                      - Source + + Source +

                      font_1()

                      Sets alternative font 1

                      - Source + + Source +

                      font_2()

                      Sets alternative font 2

                      - Source + + Source +

                      font_3()

                      Sets alternative font 3

                      - Source + + Source +

                      font_4()

                      Sets alternative font 4

                      - Source + + Source +

                      font_5()

                      Sets alternative font 5

                      - Source + + Source +

                      font_6()

                      Sets alternative font 6

                      - Source + + Source +

                      font_7()

                      Sets alternative font 7

                      - Source + + Source +

                      font_8()

                      Sets alternative font 8

                      - Source + + Source +

                      font_9()

                      Sets alternative font 9

                      - Source + + Source +

                      framed()

                      Framed

                      - Source + + Source +

                      green()

                      Sets foreground color to green

                      - Source + + Source +

                      green_background()

                      Sets background color to green

                      - Source + + Source +

                      inverse()

                      Image: Negative. Swap foreground and background

                      - Source + + Source +

                      italic()

                      Italic: on. Not widely supported. Sometimes treated as inverse.

                      - Source + + Source +

                      magenta()

                      Sets foreground color to magenta

                      - Source + + Source +

                      magenta_background()

                      Sets background color to magenta

                      - Source + + Source +

                      no_underline()

                      Underline: None

                      - Source + + Source +

                      normal()

                      Normal color or intensity

                      - Source + + Source +

                      not_framed_encircled()

                      Not framed or encircled

                      - Source + + Source +

                      not_italic()

                      Not italic

                      - Source + + Source +

                      not_overlined()

                      Not overlined

                      - Source + + Source +

                      overlined()

                      Overlined

                      - Source + + Source +

                      primary_font()

                      Sets primary (default) font

                      - Source + + Source +

                      red()

                      Sets foreground color to red

                      - Source + + Source +

                      red_background()

                      Sets background color to red

                      - Source + + Source +

                      reset()

                      Resets all attributes

                      - Source + + Source +

                      reverse()

                      Image: Negative. Swap foreground and background

                      - Source + + Source +

                      terminal?(device // :erlang.group_leader()) @@ -671,42 +761,54 @@

                      Example

                      Erlang shell did not support ANSI escape sequences up until R16.

                      - Source + + Source +

                      underline()

                      Underline: Single

                      - Source + + Source +

                      white()

                      Sets foreground color to white

                      - Source + + Source +

                      white_background()

                      Sets background color to white

                      - Source + + Source +

                      yellow()

                      Sets foreground color to yellow

                      - Source + + Source +

                      yellow_background()

                      Sets background color to yellow

                      - Source + + Source +
                      diff --git a/docs/master/IO.html b/docs/master/IO.html index 502c43f03..7d022a6b2 100644 --- a/docs/master/IO.html +++ b/docs/master/IO.html @@ -57,7 +57,7 @@

                      -

                      Functions summary

                      +

                      Functions summary

                      • @@ -134,7 +134,9 @@

                        Functions

                        Check read/2 for more information.

                        - Source + + Source +

                        binreadline(device // group_leader()) @@ -144,7 +146,9 @@

                        Functions

                        Check readline/1 for more information.

                        - Source + + Source +

                        binwrite(device // group_leader(), item) @@ -154,7 +158,9 @@

                        Functions

                        Check write/2 for more information.

                        - Source + + Source +

                        getb(device // group_leader(), prompt, count // 1) @@ -169,7 +175,9 @@

                        Functions

                        NFS file system.

                      - Source + + Source +

                      gets(device // group_leader(), prompt) @@ -185,7 +193,9 @@

                      Functions

                      NFS file system.

                    - Source + + Source +

                    inspect(item, opts // []) @@ -198,14 +208,18 @@

                    Examples

                    IO.inspect Process.list
                     
                    - Source + + Source +

                    inspect(device, item, opts)

                    Inspects the item with options using the given device.

                    - Source + + Source +

                    puts(device // group_leader(), item) @@ -214,7 +228,9 @@

                    Examples

                    but adds a new line at the end. The argument is expected to be a chardata.

                    - Source + + Source +

                    read(device // group_leader(), count) @@ -229,7 +245,9 @@

                    Examples

                    NFS file system.

                  - Source + + Source +

                  readline(device // group_leader()) @@ -247,7 +265,9 @@

                  Examples

                  This function does the same as gets/2, except the prompt is not required as argument.

                  - Source + + Source +

                  write(device // group_leader(), item) @@ -268,7 +288,9 @@

                  Examples

                  #=> "error"
                  - Source + + Source + diff --git a/docs/master/Kernel.CLI.html b/docs/master/Kernel.CLI.html index 2ec5a7213..8a5977726 100644 --- a/docs/master/Kernel.CLI.html +++ b/docs/master/Kernel.CLI.html @@ -39,7 +39,7 @@

                  -

                  Functions summary

                  +

                  Functions summary

                  • @@ -68,7 +68,9 @@

                    Functions

                    This function is used by Elixir's CLI and also by escripts generated by Elixir.

                    - Source + + Source + diff --git a/docs/master/Kernel.ParallelCompiler.html b/docs/master/Kernel.ParallelCompiler.html index 3fd745332..6ce506b69 100644 --- a/docs/master/Kernel.ParallelCompiler.html +++ b/docs/master/Kernel.ParallelCompiler.html @@ -39,7 +39,7 @@

                    -

                    Functions summary

                    +

                    Functions summary

                    • @@ -76,7 +76,9 @@

                      Functions

                      A callback that is invoked every time a file is compiled with its name can be optionally given as argument.

                      - Source + + Source +

                      files_to_path(files, path, callback // default_callback) @@ -84,7 +86,9 @@

                      Functions

                      Compiles the given files to the given path. Read files/2 for more information.

                      - Source + + Source +
                      diff --git a/docs/master/Kernel.ParallelRequire.html b/docs/master/Kernel.ParallelRequire.html index 1c441f715..e15fce868 100644 --- a/docs/master/Kernel.ParallelRequire.html +++ b/docs/master/Kernel.ParallelRequire.html @@ -39,7 +39,7 @@

                      -

                      Functions summary

                      +

                      Functions summary

                      • @@ -66,7 +66,9 @@

                        Functions

                        A callback that is invoked every time a file is required can be optionally given as argument.

                        - Source + + Source + diff --git a/docs/master/Kernel.SpecialForms.html b/docs/master/Kernel.SpecialForms.html index 4df9096c0..a640ea5a6 100644 --- a/docs/master/Kernel.SpecialForms.html +++ b/docs/master/Kernel.SpecialForms.html @@ -57,7 +57,7 @@

                        -

                        Macros summary

                        +

                        Macros summary

                        • @@ -101,12 +101,12 @@

                          Macros summary

                        • - alias/2 + alias/0
                        • - alias!/1 + alias/2
                        • @@ -134,16 +134,6 @@

                          Macros summary

                          require/2
                        • -
                        • - - unquote/1 - -
                        • -
                        • - - unquote_splicing/1 - -
                        • var!/1 @@ -178,7 +168,7 @@

                          Macros

                          Examples

                          -
                          :<<>>.(1,2,3)
                          +
                          iex> << 1, 2, 3 >>
                           << 1, 2, 3 >>
                           
                          @@ -188,17 +178,17 @@

                          Bitstring types

                          specific types. Most of the time, Elixir will figure out the part's type and won't require any work from you:

                          -
                          <<102, "oo">>
                          -#=> "foo"
                          +
                          iex> <<102, "oo">>
                          +"foo"
                           

                          Above we have two parts: the first is an integer and the second is a binary. If we use any other Elixir expression, Elixir can no longer guess the type:

                          -
                          rest = "oo"
                          -<<102, rest>>
                          -#=> ** (ArgumentError) argument error
                          +
                          iex> rest = "oo"
                          +...> <<102, rest>>
                          +** (ArgumentError) argument error
                           

                          When a variable or expression is given as a binary part, @@ -231,8 +221,8 @@

                          Bitstring types

                          signedness only matters for matching. If unspecified, it defaults to unsigned. Example:

                          -
                          <<-100 :: signed, rest :: binary>> = <<-100, "foo">>
                          -#=> <<156,102,111,111>>
                          +
                          iex> <<-100 :: signed, _rest :: binary>> = <<-100, "foo">>
                          +<<156,102,111,111>>
                           

                          This match would have failed if we did not specify that the @@ -241,9 +231,9 @@

                          Bitstring types

                          will simply be interpreted as having the given (or implied) signedness, e.g.:

                          -
                          <<val, rest :: binary>> = <<-100, "foo">>
                          -val
                          -#=> 156
                          +
                          iex> <<val, _rest :: binary>> = <<-100, "foo">>
                          +...> val
                          +156
                           

                          Here, val is interpreted as unsigned.

                          @@ -271,13 +261,13 @@

                          Bitstring types

                          unit is multiplied by the size to give the effective size of the part:

                          -
                          <<102, rest :: [size(2), unit(8)]>> = "foo"
                          +
                          iex> <<102, _rest :: [size(2), unit(8)]>> = "foo"
                           "foo"
                           
                          -<<102, rest :: size(16)>> = "foo"
                          +iex> <<102, _rest :: size(16)>> = "foo"
                           "foo"
                           
                          -<<102, rest :: size(32)>> = "foo"
                          +iex> <<102, _rest :: size(32)>> = "foo"
                           ** (MatchError) no match of right hand side value: "foo"
                           
                          @@ -300,7 +290,8 @@

                          Bitstring types

                          writing size(8), one can write just 8 and it will be interpreted as size(8)

                          -
                          << 1 :: 3 >> == << 1 :: size(3) >> #=> true
                          +
                          iex> << 1 :: 3 >> == << 1 :: size(3) >>
                          +true
                           

                          The default unit for integers, floats, and bitstrings is 1. For @@ -309,7 +300,9 @@

                          Bitstring types

                          For floats, unit * size must result in 32 or 64, corresponding to binary32 and binary64, respectively.

                          - Source + + Source +

                          [args] @@ -322,7 +315,9 @@

                          Examples

                          [ 1, 2, 3 ]
                          - Source + + Source +

                          __ENV__() @@ -331,7 +326,9 @@

                          Examples

                          record. In the environment you can access the current filename, line numbers, set up aliases, the current function and others.

                          - Source + + Source +

                          __FILE__() @@ -340,7 +337,9 @@

                          Examples

                          Although the file can be accessed in the ENV, this macro is a convenient shortcut.

                          - Source + + Source +

                          __MODULE__() @@ -349,7 +348,9 @@

                          Examples

                          Although the module can be accessed in the ENV, this macro is a convenient shortcut.

                          - Source + + Source +

                          args @@ -357,14 +358,14 @@

                          Examples

                          This is the special form used to hold aliases information. It is usually compiled to an atom:

                          -
                          quote do: Foo.Bar
                          +
                          quote do: Foo.Bar #=>
                           { :__aliases__, [], [:Foo,:Bar] }
                           

                          Elixir represents Foo.Bar as __aliases__ so calls can be unambiguously identified by the operator :.. For example:

                          -
                          quote do: Foo.bar
                          +
                          quote do: Foo.bar #=>
                           {{:.,[],[{:__aliases__,[],[:Foo]},:bar]},[],[]}
                           
                          @@ -392,7 +393,9 @@

                          Examples

                            Module.concat [some_var, Foo]
                           
                          - Source + + Source +

                          args @@ -401,11 +404,13 @@

                          Examples

                          of expressions in Elixir. This special form is private and should not be invoked directly:

                          -
                          quote do: (1; 2; 3)
                          -#=> { :__block__, [], [1,2,3] }
                          +
                          iex> quote do: (1; 2; 3)
                          +{ :__block__, [], [1,2,3] }
                           
                          - Source + + Source +

                          __scope__(opts, args) @@ -421,7 +426,20 @@

                          Examples

                          Check quote/1 for more information.

                          - Source + + Source + +
                          +

                          + alias() +

                          +

                          When used inside quoting, marks that the alias should not +be hygienezed. This means the alias will be expanded when +the macro is expanded.

                          +
                          + + Source +

                          alias(module, opts) @@ -465,16 +483,9 @@

                          Lexical scope

                          have lexical scope. This means you can set up aliases inside specific functions and it won't affect the overall scope.

                          - Source -
                          -

                          - alias!(alias) -

                          -

                          When used inside quoting, marks that the alias should not -be hygienezed. This means the alias will be expanded when -the macro is expanded.

                          -
                          - Source + + Source +

                          bc(args) @@ -484,11 +495,13 @@

                          Lexical scope

                          be a bitstring. For example, here is how to remove all spaces from a string:

                          -
                          bc <<c>> inbits " hello world ", c != ? , do: <<c>>
                          +
                          iex> bc <<c>> inbits " hello world ", c != ? , do: <<c>>
                           "helloworld"
                           
                          - Source + + Source +

                          import(module, opts) @@ -502,8 +515,9 @@

                          Examples

                          import those functions and reference them as local functions, for example:

                          -
                          import List
                          -flatten([1,[2],3]) #=> [1,2,3]
                          +
                          iex> import List
                          +...> flatten([1,[2],3])
                          +[1,2,3]
                           

                          Selector

                          @@ -565,16 +579,25 @@

                          Alias/Require shortcut

                          All imported modules are also required by default. import also accepts as: as an option so it automatically sets up an alias. Please check alias for more information.

                          + +

                          Ambiguous function/macro names

                          + +

                          If two modules A and B are imported and they both contain +a foo function with an arity of 1, an error is only emitted +if an ambiguous call to foo/1 is actually made; that is, the +errors are emitted lazily, not eagerly.

                          - Source + + Source +

                          lc(args)

                          List comprehensions allow you to quickly build a list from another list:

                          -
                          lc n inlist [1,2,3,4], do: n * 2
                          -#=> [2,4,6,8]
                          +
                          iex> lc n inlist [1,2,3,4], do: n * 2
                          +[2,4,6,8]
                           

                          A comprehension accepts many generators and also filters. Generators @@ -582,39 +605,41 @@

                          Alias/Require shortcut

                          to loop lists and bitstrings:

                          # A list generator:
                          -lc n inlist [1,2,3,4], do: n * 2
                          -#=> [2,4,6,8]
                          +iex> lc n inlist [1,2,3,4], do: n * 2
                          +[2,4,6,8]
                           
                           # A bit string generator:
                          -lc <<n>> inbits <<1,2,3,4>>, do: n * 2
                          -#=> [2,4,6,8]
                          +iex> lc <<n>> inbits <<1,2,3,4>>, do: n * 2
                          +[2,4,6,8]
                           
                           # A generator from a variable:
                          -list = [1,2,3,4]
                          -lc n inlist list, do: n * 2
                          -#=> [2,4,6,8]
                          +iex> list = [1,2,3,4]
                          +...> lc n inlist list, do: n * 2
                          +[2,4,6,8]
                           
                           # A comprehension with two generators
                          -lc x inlist [1,2], y inlist [2,3], do: x*y
                          -#=> [2,3,4,6]
                          +iex> lc x inlist [1,2], y inlist [2,3], do: x*y
                          +[2,3,4,6]
                           

                          Filters can also be given:

                          # A comprehension with a generator and a filter
                          -lc n inlist [1,2,3,4,5,6], rem(n, 2) == 0, do: n
                          -#=> [2,4,6]
                          +iex> lc n inlist [1,2,3,4,5,6], rem(n, 2) == 0, do: n
                          +[2,4,6]
                           

                          Bit string generators are quite useful when you need to organize bit string streams:

                          iex> pixels = <<213,45,132,64,76,32,76,0,0,234,32,15>>
                          -iex> lc <<r:8,g:8,b:8>> inbits pixels, do: {r,g,b}
                          +iex> lc <<r::8,g::8,b::8>> inbits pixels, do: {r,g,b}
                           [{213,45,132},{64,76,32},{76,0,0},{234,32,15}]
                           
                          - Source + + Source +

                          quote(opts, block) @@ -623,8 +648,8 @@

                          Alias/Require shortcut

                          Examples

                          -
                          quote do: sum(1, 2, 3)
                          -#=> { :sum, [], [1, 2, 3] }
                          +
                          iex> quote do: sum(1, 2, 3)
                          +{ :sum, [], [1, 2, 3] }
                           

                          Explanation

                          @@ -892,7 +917,9 @@

                          Stacktrace information

                          particular, the macro __FILE__ and exceptions happening inside the quote will always point to GenServer.Behaviour file.

                          - Source + + Source +

                          require(module, opts) @@ -923,51 +950,9 @@

                          Alias shortcut

                          require also accepts as: as an option so it automatically sets up an alias. Please check alias for more information.

                          - Source -
                          -

                          - unquote(expr) -

                          -

                          Unquotes the given expression from inside a macro.

                          - -

                          Examples

                          - -

                          Imagine the situation you have a variable name and -you want to inject it inside some quote. The first attempt -would be:

                          - -
                          value = 13
                          -quote do: sum(1, value, 3)
                          -
                          - -

                          Which would then return:

                          - -
                          { :sum, [], [1, { :value, [], quoted }, 3] }
                          -
                          - -

                          Which is not the expected result. For this, we use unquote:

                          - -
                          value = 13
                          -quote do: sum(1, unquote(value), 3)
                          -#=> { :sum, [], [1, 13, 3] }
                          -
                          -
                          - Source -
                          -

                          - unquote_splicing(expr) -

                          -

                          Unquotes the given list expanding its arguments. Similar -to unquote.

                          - -

                          Examples

                          - -
                          values = [2,3,4]
                          -quote do: sum(1, unquote_splicing(values), 5)
                          -#=> { :sum, [], [1, 2, 3, 4, 5] }
                          -
                          -
                          - Source + + Source +

                          var!(var) @@ -978,7 +963,9 @@

                          Examples

                          one is an atom) or an atom representing the variable name. Check quote/2 for more information.

                          - Source + + Source +

                          var!(var, context) @@ -986,7 +973,9 @@

                          Examples

                          Defines a variable in the given context. Check quote/2 for more information.

                          - Source + + Source +

                          {args} @@ -999,7 +988,9 @@

                          Examples

                          { 1, 2, 3 }
                          - Source + + Source + diff --git a/docs/master/Kernel.Typespec.html b/docs/master/Kernel.Typespec.html index 8c2a7b99b..044d3dc6e 100644 --- a/docs/master/Kernel.Typespec.html +++ b/docs/master/Kernel.Typespec.html @@ -126,7 +126,7 @@

                          Notes

                          -

                          Functions summary

                          +

                          Functions summary

                          • @@ -188,7 +188,7 @@

                            Functions summary

                            -

                            Macros summary

                            +

                            Macros summary

                            • @@ -236,7 +236,9 @@

                              Functions

                              The module has to have a corresponding beam file on the file system.

                              - Source + + Source +

                              beam_specs(module) @@ -249,7 +251,9 @@

                              Functions

                              The module has to have a corresponding beam file on the file system.

                              - Source + + Source +

                              beam_types(module) @@ -262,28 +266,36 @@

                              Functions

                              The module has to have a corresponding beam file on the file system.

                              - Source + + Source +

                              define_callback(module, tuple, definition)

                              Defines a callback by receiving Erlang's typespec.

                              - Source + + Source +

                              define_spec(module, tuple, definition)

                              Defines a spec by receiving Erlang's typespec.

                              - Source + + Source +

                              define_type(module, kind, type)

                              Defines a type, typep or opaque by receiving Erlang's typespec.

                              - Source + + Source +

                              defines_callback?(module, name, arity) @@ -291,7 +303,9 @@

                              Functions

                              Returns true if the current module defines a callback. This function is only available for modules being compiled.

                              - Source + + Source +

                              defines_spec?(module, name, arity) @@ -299,7 +313,9 @@

                              Functions

                              Returns true if the current module defines a given spec. This function is only available for modules being compiled.

                              - Source + + Source +

                              defines_type?(module, name, arity) @@ -308,21 +324,27 @@

                              Functions

                              (private, opaque or not). This function is only available for modules being compiled.

                              - Source + + Source +

                              spec_to_ast(name, arg2)

                              Converts a spec clause back to Elixir AST.

                              - Source + + Source +

                              type_to_ast(arg1)

                              Converts a type clause back to Elixir AST.

                              - Source + + Source +
                              @@ -342,7 +364,9 @@

                              Examples

                              @callback add(number, number) :: number
                               
                              - Source + + Source +

                              defopaque(type) @@ -355,7 +379,9 @@

                              Examples

                              @opaque my_type :: atom
                               
                              - Source + + Source +

                              defspec(spec) @@ -368,7 +394,9 @@

                              Examples

                              @spec add(number, number) :: number
                               
                              - Source + + Source +

                              deftype(type) @@ -381,7 +409,9 @@

                              Examples

                              @type my_type :: atom
                               
                              - Source + + Source +

                              deftypep(type) @@ -394,7 +424,9 @@

                              Examples

                              @typep my_type :: atom
                               
                              - Source + + Source + diff --git a/docs/master/Kernel.html b/docs/master/Kernel.html index d415cd8d4..9bac708fd 100644 --- a/docs/master/Kernel.html +++ b/docs/master/Kernel.html @@ -54,23 +54,13 @@

                              -

                              Functions summary

                              +

                              Functions summary

                              • abs/1
                              • -
                              • - - apply/2 - -
                              • -
                              • - - apply/3 - -
                              • atom_to_binary/2 @@ -426,7 +416,7 @@

                                Functions summary

                                -

                                Macros summary

                                +

                                Macros summary

                                • @@ -548,6 +538,11 @@

                                  Macros summary

                                  __R__/2
                                • +
                                • + + __W__/2 + +
                                • __b__/2 @@ -563,6 +558,11 @@

                                  Macros summary

                                  __r__/2
                                • +
                                • + + __w__/2 + +
                                • access/2 @@ -573,6 +573,16 @@

                                  Macros summary

                                  and/2
                                • +
                                • + + apply/2 + +
                                • +
                                • + + apply/3 + +
                                • atom_to_binary/1 @@ -673,6 +683,11 @@

                                  Macros summary

                                  defrecordp/2
                                • +
                                • + + delete_elem/2 + +
                                • destructure/2 @@ -693,11 +708,26 @@

                                  Macros summary

                                  float_to_binary/1
                                • +
                                • + + float_to_binary/2 + +
                                • function/1
                                • +
                                • + + function/2 + +
                                • +
                                • + + function/3 + +
                                • if/2 @@ -708,6 +738,11 @@

                                  Macros summary

                                  in/2
                                • +
                                • + + insert_elem/3 + +
                                • inspect/2 @@ -780,7 +815,7 @@

                                  Macros summary

                                • - setelem/3 + set_elem/3
                                • @@ -842,37 +877,15 @@

                                  Functions

                                  Examples

                                  -
                                  abs(-3.33) #=> 3.33
                                  -abs(-3)    #=> 3
                                  +
                                  iex> abs(-3.33)
                                  +3.33
                                  +iex> abs(-3)
                                  +3
                                   
                                  - Source -
                                  -

                                  - apply(fun, args) -

                                  -

                                  Invokes the given fun with the array of arguments args.

                                  - -

                                  Examples

                                  - -
                                  apply fn x -> x * 2 end, [2]
                                  -#=> 4
                                  -
                                  -
                                  - Source -
                                  -

                                  - apply(module, fun, args) -

                                  -

                                  Invokes the given fun from module with the array of arguments args.

                                  - -

                                  Examples

                                  - -
                                  apply Enum, :reverse, [[1,2,3]]
                                  -#=> [3,2,1]
                                  -
                                  -
                                  - Source + + Source +

                                  atom_to_binary(atom, encoding) @@ -885,10 +898,13 @@

                                  Examples

                                  Examples

                                  -
                                  atom_to_binary(:elixir, :utf8) #=> "elixir"
                                  +
                                  iex> atom_to_binary(:elixir, :utf8)
                                  +"elixir"
                                   
                                  - Source + + Source +

                                  atom_to_list(atom) @@ -897,10 +913,13 @@

                                  Examples

                                  Examples

                                  -
                                  atom_to_list(:elixir) #=> 'elixir'
                                  +
                                  iex> atom_to_list(:elixir)
                                  +'elixir'
                                   
                                  - Source + + Source +

                                  binary_part(binary, start, length) @@ -915,15 +934,19 @@

                                  Examples

                                  Examples

                                  -
                                  binary_part "foo", 1, 2 #=> "oo"
                                  +
                                  iex> binary_part "foo", 1, 2
                                  +"oo"
                                   

                                  A negative length can be used to extract bytes at the end of a binary:

                                  -
                                  binary_part "foo", 3, -1 #=> 1
                                  +
                                  iex> binary_part "foo", 3, -1
                                  +"o"
                                   
                                  - Source + + Source +

                                  binary_to_atom(binary, encoding) @@ -935,24 +958,31 @@

                                  Examples

                                  Examples

                                  -
                                  binary_to_atom("elixir", :utf8) #=> :elixir
                                  +
                                  iex> binary_to_atom("elixir", :utf8)
                                  +:elixir
                                   
                                  - Source + + Source +

                                  binary_to_existing_atom(binary, encoding)

                                  Works like binary_to_atom/2, but the atom must already exist.

                                  - Source + + Source +

                                  binary_to_list(binary)

                                  Returns a list of integers which correspond to the bytes of binary.

                                  - Source + + Source +

                                  binary_to_list(binary, start, stop) @@ -961,7 +991,9 @@

                                  Examples

                                  from position start to position stop in binary. Positions in the binary are numbered starting from 1.

                                  - Source + + Source +

                                  binary_to_term(binary) @@ -972,10 +1004,13 @@

                                  Examples

                                  Examples

                                  -
                                  binary_to_term(term_to_binary("foo")) #=> "foo"
                                  +
                                  iex> binary_to_term(term_to_binary("foo"))
                                  +"foo"
                                   
                                  - Source + + Source +

                                  binary_to_term(binary, options) @@ -995,10 +1030,13 @@

                                  Examples

                                  Examples

                                  -
                                  binary_to_term(term_to_binary("foo"), [:safe])
                                  +
                                  iex> binary_to_term(term_to_binary("foo"), [:safe])
                                  +"foo"
                                   
                                  - Source + + Source +

                                  bit_size(bitstring) @@ -1009,11 +1047,15 @@

                                  Examples

                                  Examples

                                  -
                                  bit_size(<<433::16,3::3>>) #=> 19
                                  -bit_size(<<1,2,3>>) #=> 24
                                  +
                                  iex> bit_size(<<433::16,3::3>>)
                                  +19
                                  +iex> bit_size(<<1,2,3>>)
                                  +24
                                   
                                  - Source + + Source +

                                  bitstring_to_list(bitstring) @@ -1022,7 +1064,9 @@

                                  Examples

                                  number of bits in the binary is not divisible by 8, the last element of the list will be a bitstring containing the remaining bits (1 up to 7 bits).

                                  - Source + + Source +

                                  byte_size(bitstring) @@ -1035,11 +1079,15 @@

                                  Examples

                                  Examples

                                  -
                                  byte_size(<<433::16,3::3>>) #=> 3
                                  -byte_size(<<1,2,3>>) #=> 3
                                  +
                                  iex> byte_size(<<433::16,3::3>>)
                                  +3
                                  +iex> byte_size(<<1,2,3>>)
                                  +3
                                   
                                  - Source + + Source +

                                  exit(reason) @@ -1054,14 +1102,18 @@

                                  Examples

                                  exit(:seems_bad)
                                  - Source + + Source +

                                  float(number)

                                  Converts the given number to a float. Allowed in guard clauses.

                                  - Source + + Source +

                                  float_to_list(number) @@ -1070,11 +1122,13 @@

                                  Examples

                                  Examples

                                  -
                                  float_to_list(7.0)
                                  -#=> '7.00000000000000000000e+00'
                                  +
                                  iex> float_to_list(7.0)
                                  +'7.00000000000000000000e+00'
                                   
                                  - Source + + Source +

                                  function_exported?(module, function, arity) @@ -1089,14 +1143,18 @@

                                  Examples

                                  it is not loaded. Check Code.ensure_loaded/1 for more information.

                                  - Source + + Source +

                                  hd(list)

                                  Returns the head of a list, raises badarg if the list is empty.

                                  - Source + + Source +

                                  integer_to_list(number) @@ -1105,11 +1163,13 @@

                                  Examples

                                  Examples

                                  -
                                  integer_to_list(7)
                                  -#=> '7'
                                  +
                                  iex> integer_to_list(7)
                                  +'7'
                                   
                                  - Source + + Source +

                                  integer_to_list(number, base) @@ -1119,11 +1179,13 @@

                                  Examples

                                  Examples

                                  -
                                  integer_to_list(1023, 16).
                                  -#=> "3FF"
                                  +
                                  iex> integer_to_list(1023, 16)
                                  +'3FF'
                                   
                                  - Source + + Source +

                                  iolist_size(item) @@ -1132,11 +1194,13 @@

                                  Examples

                                  Examples

                                  -
                                  iolist_size([1,2|<<3,4>>])
                                  -#=> 4
                                  +
                                  iex> iolist_size([1,2|<<3,4>>])
                                  +4
                                   
                                  - Source + + Source +

                                  iolist_to_binary(item) @@ -1145,15 +1209,16 @@

                                  Examples

                                  Examples

                                  -
                                  bin1 = <<1,2,3>>
                                  -bin2 = <<4,5>>
                                  -bin3 = <<6>>
                                  -
                                  -iolist_to_binary([bin1,1,[2,3,bin2],4|bin3])
                                  -#=> <<1,2,3,1,2,3,4,5,4,6>>
                                  +
                                  iex> bin1 = <<1,2,3>>
                                  +...> bin2 = <<4,5>>
                                  +...> bin3 = <<6>>
                                  +...> iolist_to_binary([bin1,1,[2,3,bin2],4|bin3])
                                  +<<1,2,3,1,2,3,4,5,4,6>>
                                   
                                  - Source + + Source +

                                  is_alive() @@ -1161,7 +1226,9 @@

                                  Examples

                                  Returns true if the local node is alive; that is, if the node can be part of a distributed system.

                                  - Source + + Source +

                                  is_atom(term) @@ -1170,7 +1237,9 @@

                                  Examples

                                  Allowed in guard tests.

                                  - Source + + Source +

                                  is_binary(term) @@ -1181,7 +1250,9 @@

                                  Examples

                                  Allowed in guard tests.

                                  - Source + + Source +

                                  is_bitstring(term) @@ -1190,7 +1261,9 @@

                                  Examples

                                  Allowed in guard tests.

                                  - Source + + Source +

                                  is_boolean(term) @@ -1200,7 +1273,9 @@

                                  Examples

                                  Allowed in guard tests.

                                  - Source + + Source +

                                  is_float(term) @@ -1209,7 +1284,9 @@

                                  Examples

                                  Allowed in guard tests.

                                  - Source + + Source +

                                  is_function(term) @@ -1218,7 +1295,9 @@

                                  Examples

                                  Allowed in guard tests.

                                  - Source + + Source +

                                  is_function(term, arity) @@ -1228,7 +1307,9 @@

                                  Examples

                                  Allowed in guard tests.

                                  - Source + + Source +

                                  is_integer(term) @@ -1237,7 +1318,9 @@

                                  Examples

                                  Allowed in guard tests.

                                  - Source + + Source +

                                  is_list(term) @@ -1246,7 +1329,9 @@

                                  Examples

                                  Allowed in guard tests.

                                  - Source + + Source +

                                  is_number(term) @@ -1256,7 +1341,9 @@

                                  Examples

                                  Allowed in guard tests.

                                  - Source + + Source +

                                  is_pid(term) @@ -1265,7 +1352,9 @@

                                  Examples

                                  Allowed in guard tests.

                                  - Source + + Source +

                                  is_port(term) @@ -1274,7 +1363,9 @@

                                  Examples

                                  Allowed in guard tests.

                                  - Source + + Source +

                                  is_reference(term) @@ -1283,7 +1374,9 @@

                                  Examples

                                  Allowed in guard tests.

                                  - Source + + Source +

                                  is_tuple(term) @@ -1292,7 +1385,9 @@

                                  Examples

                                  Allowed in guard tests.

                                  - Source + + Source +

                                  length(list) @@ -1303,10 +1398,13 @@

                                  Examples

                                  Examples

                                  -
                                  length([1,2,3,4,5,6,7,8,9]) #=> 9
                                  +
                                  iex> length([1,2,3,4,5,6,7,8,9])
                                  +9
                                   
                                  - Source + + Source +

                                  list_to_atom(char_list) @@ -1315,10 +1413,13 @@

                                  Examples

                                  Examples

                                  -
                                  list_to_atom('elixir') #=> :elixir
                                  +
                                  iex> list_to_atom('elixir')
                                  +:elixir
                                   
                                  - Source + + Source +

                                  list_to_binary(char_list) @@ -1327,10 +1428,13 @@

                                  Examples

                                  Examples

                                  -
                                  list_to_binary('Elixir') #=> "Elixir"
                                  +
                                  iex> list_to_binary('Elixir')
                                  +"Elixir"
                                   
                                  - Source + + Source +

                                  list_to_bitstring(bitstring_list) @@ -1340,15 +1444,16 @@

                                  Examples

                                  Examples

                                  -
                                  bin1 = <<1,2,3>>
                                  -bin2 = <<4,5>>
                                  -bin3 = <<6,7::4>>
                                  -
                                  -list_to_bitstring([bin1,1,[2,3,bin2],4|bin3])
                                  -#=> <<1,2,3,1,2,3,4,5,4,6,7::size(4)>>
                                  +
                                  iex> bin1 = <<1,2,3>>
                                  +...> bin2 = <<4,5>>
                                  +...> bin3 = <<6,7::4>>
                                  +...> list_to_bitstring([bin1,1,[2,3,bin2],4|bin3])
                                  +<<1,2,3,1,2,3,4,5,4,6,7::size(4)>>
                                   
                                  - Source + + Source +

                                  list_to_existing_atom(char_list) @@ -1356,7 +1461,9 @@

                                  Examples

                                  Returns the atom whose text representation is char_list, but only if there already exists such atom.

                                  - Source + + Source +

                                  list_to_float(char_list) @@ -1365,10 +1472,13 @@

                                  Examples

                                  Examples

                                  -
                                  list_to_float('2.2017764e+0') #=> 2.2017764
                                  +
                                  iex> list_to_float('2.2017764e+0')
                                  +2.2017764
                                   
                                  - Source + + Source +

                                  list_to_integer(char_list) @@ -1377,10 +1487,13 @@

                                  Examples

                                  Examples

                                  -
                                  list_to_integer('123') #=> 123
                                  +
                                  iex> list_to_integer('123')
                                  +123
                                   
                                  - Source + + Source +

                                  list_to_integer(char_list, base) @@ -1389,10 +1502,13 @@

                                  Examples

                                  Examples

                                  -
                                  list_to_integer('3FF', 16) #=> 1023
                                  +
                                  iex> list_to_integer('3FF', 16)
                                  +1023
                                   
                                  - Source + + Source +

                                  list_to_pid(char_list) @@ -1411,7 +1527,9 @@

                                  Examples

                                  list_to_pid('<0.4.1>') #=> #PID<0.4.1>
                                   
                                  - Source + + Source +

                                  list_to_tuple(list) @@ -1420,10 +1538,13 @@

                                  Examples

                                  Examples

                                  -
                                  list_to_tuple([:share, [:elixir, 163]]). #=> {:share, [:elixir, 163]}
                                  +
                                  iex> list_to_tuple([:share, [:elixir, 163]])
                                  +{:share, [:elixir, 163]}
                                   
                                  - Source + + Source +

                                  macro_exported?(module, macro, arity) @@ -1435,7 +1556,9 @@

                                  Examples

                                  it is not loaded. Check Code.ensure_loaded/1 for more information.

                                  - Source + + Source +

                                  make_ref() @@ -1447,11 +1570,12 @@

                                  Examples

                                  Examples

                                  -
                                  make_ref()
                                  -#=> #Reference<0.0.0.135>
                                  +
                                  make_ref() #=> #Reference<0.0.0.135>
                                   
                                  - Source + + Source +

                                  max(first, second) @@ -1462,10 +1586,13 @@

                                  Examples

                                  Examples

                                  -
                                  max(1, 2) #=> 2
                                  +
                                  iex> max(1, 2)
                                  +2
                                   
                                  - Source + + Source +

                                  min(first, second) @@ -1476,10 +1603,13 @@

                                  Examples

                                  Examples

                                  -
                                  min(1, 2) #=> 1
                                  +
                                  iex> min(1, 2)
                                  +1
                                   
                                  - Source + + Source +

                                  node() @@ -1489,7 +1619,9 @@

                                  Examples

                                  Allowed in guard tests.

                                  - Source + + Source +

                                  node(arg) @@ -1500,7 +1632,9 @@

                                  Examples

                                  Allowed in guard tests.

                                  - Source + + Source +

                                  pid_to_list(pid) @@ -1516,7 +1650,9 @@

                                  Warning:

                                  It should not be used in application programs.

                                  - Source + + Source +

                                  raise(msg) @@ -1535,13 +1671,15 @@

                                  Examples

                                  try do 1 + :foo rescue - x in [BadargError] -> + x in [ArithmeticError] -> IO.puts "that was expected" raise x end
                          - Source + + Source +

                          raise(exception, args) @@ -1558,10 +1696,13 @@

                          Examples

                          Examples

                          -
                          raise ArgumentError, message: "Sample"
                          +
                          iex> raise ArgumentError, message: "Sample"
                          +** (ArgumentError) Sample
                           
                          - Source + + Source +

                          raise(exception, args, stacktrace) @@ -1588,7 +1729,9 @@

                          Examples

                          rescued) in between the rescue clause and the raise call may change the System.stacktrace value.

                          - Source + + Source +

                          round(number) @@ -1598,10 +1741,13 @@

                          Examples

                          Examples

                          -
                          round(5.5) #=> 6
                          +
                          iex> round(5.5)
                          +6
                           
                          - Source + + Source +

                          self() @@ -1609,7 +1755,9 @@

                          Examples

                          Returns the pid (process identifier) of the calling process. Allowed in guard clauses.

                          - Source + + Source +

                          size(arg) @@ -1617,7 +1765,9 @@

                          Examples

                          Returns the size of the given argument, which must be a tuple or a binary. If possible, please use tuple_size or binary_size.

                          - Source + + Source +

                          spawn(fun) @@ -1637,7 +1787,9 @@

                          Examples

                          end
                          - Source + + Source +

                          spawn(module, fun, args) @@ -1653,7 +1805,9 @@

                          Examples

                          spawn(SomeModule, :function, [1,2,3])
                           
                          - Source + + Source +

                          spawn_link(fun) @@ -1673,7 +1827,9 @@

                          Examples

                          end
                          - Source + + Source +

                          spawn_link(module, fun, args) @@ -1689,7 +1845,9 @@

                          Examples

                          spawn_link(SomeModule, :function, [1,2,3])
                           
                          - Source + + Source +

                          term_to_binary(term) @@ -1701,7 +1859,9 @@

                          Examples

                          to a file in an efficient way, or sending an Erlang term to some type of communications channel not supported by distributed :

                          - Source + + Source +

                          term_to_binary(term, opts) @@ -1715,21 +1875,27 @@

                          Examples

                          for more details
                        - Source + + Source +

                        throw(term)

                        A non-local return from a function. Check try/2 for more information.

                        - Source + + Source +

                        tl(list)

                        Returns the tail of a list. Raises ArgumentError if the list is empty.

                        - Source + + Source +

                        trunc(number) @@ -1739,24 +1905,31 @@

                        Examples

                        Examples

                        -
                        trunc(5.5) #=> 5
                        +
                        iex> trunc(5.5)
                        +5
                         
                        - Source + + Source +

                        tuple_size(tuple)

                        Returns the size of a tuple.

                        - Source + + Source +

                        tuple_to_list(tuple)

                        Converts a tuple to a list.

                        - Source + + Source +
                        @@ -1774,13 +1947,19 @@

                        Macros

                        Examples

                        -
                        !1        #=> false
                        -![1,2,3]  #=> false
                        -!false    #=> true
                        -!nil      #=> true
                        +
                        iex> !1
                        +false
                        +iex> ![1,2,3]
                        +false
                        +iex> !false
                        +true
                        +iex> !nil
                        +true
                         
                        - Source + + Source +

                        left != right @@ -1794,13 +1973,15 @@

                        Examples

                        Examples

                        -
                        1 != 2
                        -#=> true
                        -1 != 1.0
                        -#=> false
                        +
                        iex> 1 != 2
                        +true
                        +iex> 1 != 1.0
                        +false
                         
                        - Source + + Source +

                        left !== right @@ -1810,14 +1991,16 @@

                        Examples

                        Examples

                        -
                        1 !== 2
                        -#=> true
                        +
                        iex> 1 !== 2
                        +true
                         
                        -1 !== 1.0
                        -#=> true
                        +iex> 1 !== 1.0
                        +true
                         
                        - Source + + Source +

                        left && right @@ -1828,17 +2011,23 @@

                        Examples

                        Examples

                        -
                        true && true         #=> true
                        -nil && true          #=> nil
                        -true && 1            #=> 1
                        -false && error(:bad) #=> false
                        +
                        iex> true && true
                        +true
                        +iex> nil && true
                        +nil
                        +iex> true && 1
                        +1
                        +iex> false && throw(:bad)
                        +false
                         

                        Notice that, differently from Erlang and operator, this operator accepts any expression as arguments, not only booleans, however it is not allowed in guards.

                        - Source + + Source +

                        left * right @@ -1847,10 +2036,13 @@

                        Examples

                        Examples

                        -
                        1 * 2 #=> 2
                        +
                        iex> 1 * 2
                        +2
                         
                        - Source + + Source +

                        left + right @@ -1859,10 +2051,13 @@

                        Examples

                        Examples

                        -
                        1 + 2 #=> 3
                        +
                        iex> 1 + 2
                        +3
                         
                        - Source + + Source +

                        left ++ right @@ -1871,14 +2066,16 @@

                        Examples

                        Examples

                        -
                        [1] ++ [2,3]
                        -#=> [1,2,3]
                        +
                        iex> [1] ++ [2,3]
                        +[1,2,3]
                         
                        -'foo' ++ 'bar'
                        -#=> 'foobar'
                        +iex> 'foo' ++ 'bar'
                        +'foobar'
                         
                        - Source + + Source +

                        left - right @@ -1887,10 +2084,13 @@

                        Examples

                        Examples

                        -
                        1 - 2 #=> -1
                        +
                        iex> 1 - 2
                        +-1
                         
                        - Source + + Source +

                        left -- right @@ -1900,14 +2100,16 @@

                        Examples

                        Examples

                        -
                        [1,2,3] -- [1,2]
                        -#=> [3]
                        +
                        iex> [1,2,3] -- [1,2]
                        +[3]
                         
                        -[1,2,3,2,1] -- [1,2,2]
                        -#=> [3,1]
                        +iex> [1,2,3,2,1] -- [1,2,2]
                        +[3,1]
                         
                        - Source + + Source +

                        first .. last @@ -1917,13 +2119,19 @@

                        Examples

                        Examples

                        -
                        0 in 1..3 #=> false
                        -1 in 1..3 #=> true
                        -2 in 1..3 #=> true
                        -3 in 1..3 #=> true
                        +
                        iex> 0 in 1..3
                        +false
                        +iex> 1 in 1..3
                        +true
                        +iex> 2 in 1..3
                        +true
                        +iex> 3 in 1..3
                        +true
                         
                        - Source + + Source +

                        left / right @@ -1934,11 +2142,15 @@

                        Examples

                        Examples

                        -
                        1 / 2 #=> 0.5
                        -2 / 1 #=> 2.0
                        +
                        iex> 1 / 2
                        +0.5
                        +iex> 2 / 1
                        +2.0
                         
                        - Source + + Source +

                        left < right @@ -1948,11 +2160,13 @@

                        Examples

                        Examples

                        -
                        1 < 2
                        -#=> true
                        +
                        iex> 1 < 2
                        +true
                         
                        - Source + + Source +

                        pid <- msg @@ -1967,7 +2181,9 @@

                        Examples

                        process <- { :ok, "Sending myself a message" }
                        - Source + + Source +

                        left <= right @@ -1977,11 +2193,13 @@

                        Examples

                        Examples

                        -
                        1 <= 2
                        -#=> true
                        +
                        iex> 1 <= 2
                        +true
                         
                        - Source + + Source +

                        left <> right @@ -1990,17 +2208,21 @@

                        Examples

                        Examples

                        -
                        "foo" <> "bar" #=> "foobar"
                        +
                        iex> "foo" <> "bar"
                        +"foobar"
                         

                        The <> operator can also be used in guard clauses as long as the first part is a literal binary:

                        -
                        "foo" <> x = "foobar"
                        -x #=> "bar"
                        +
                        iex> "foo" <> x = "foobar"
                        +...> x
                        +"bar"
                         
                        - Source + + Source +

                        left == right @@ -2014,14 +2236,16 @@

                        Examples

                        Examples

                        -
                        1 == 2
                        -#=> false
                        +
                        iex> 1 == 2
                        +false
                         
                        -1 == 1.0
                        -#=> true
                        +iex> 1 == 1.0
                        +true
                         
                        - Source + + Source +

                        left === right @@ -2031,14 +2255,16 @@

                        Examples

                        Examples

                        -
                        1 === 2
                        -#=> false
                        +
                        iex> 1 === 2
                        +false
                         
                        -1 === 1.0
                        -#=> false
                        +iex> 1 === 1.0
                        +false
                         
                        - Source + + Source +

                        left =~ right @@ -2049,11 +2275,15 @@

                        Examples

                        Examples

                        -
                        "abcd" =~ %r/c(d)/  #=> 2
                        -"abcd" =~ %r/e/     #=> nil
                        +
                        iex> "abcd" =~ %r/c(d)/
                        +2
                        +iex> "abcd" =~ %r/e/
                        +nil
                         
                        - Source + + Source +

                        left > right @@ -2063,11 +2293,13 @@

                        Examples

                        Examples

                        -
                        1 > 2
                        -#=> false
                        +
                        iex> 1 > 2
                        +false
                         
                        - Source + + Source +

                        left >= right @@ -2077,11 +2309,13 @@

                        Examples

                        Examples

                        -
                        1 >= 2
                        -#=> false
                        +
                        iex> 1 >= 2
                        +false
                         
                        - Source + + Source +

                        @expr @@ -2129,7 +2363,9 @@

                        Examples

                        time and not at runtime. Check the module Module for other functions to manipulate module attributes.

                        - Source + + Source +

                        __B__(string, list2) @@ -2139,11 +2375,15 @@

                        Examples

                        Examples

                        -
                        %B(foo)      #=> "foo"
                        -%B(f#{o}o)  #=> "f\#{o}o"
                        +
                        iex> %B(foo)
                        +"foo"
                        +iex> %B(f#{o}o)
                        +"f\#{o}o"
                         
                        - Source + + Source +

                        __C__(arg1, list2) @@ -2153,11 +2393,15 @@

                        Examples

                        Examples

                        -
                        %C(foo)      #=> 'foo'
                        -%C(f#{o}o)  #=> 'f\#{o}o'
                        +
                        iex> %C(foo)
                        +'foo'
                        +iex> %C(f#{o}o)
                        +'f\#{o}o'
                         
                        - Source + + Source +

                        __R__(arg1, options) @@ -2167,10 +2411,37 @@

                        Examples

                        Examples

                        -
                        Regex.match? %R(f#{1,3}o), "f#o"  #=> true
                        +
                        iex> Regex.match? %R(f#{1,3}o), "f#o"
                        +true
                        +
                        +
                        + + Source + +
                        +

                        + __W__(arg1, modifiers) +

                        +

                        Handles the sigil %W. It returns a list of "words" split by whitespace +without escaping nor interpreting interpolations.

                        + +

                        Modifiers

                        + +
                          +
                        • b: binaries (default)
                        • +
                        • a: atoms
                        • +
                        • c: char lists
                        • +
                        + +

                        Examples

                        + +
                        iex> %W(foo #{bar} baz)
                        +["foo", "\#{bar}", "baz"]
                         
                        - Source + + Source +

                        __b__(arg1, list2) @@ -2180,11 +2451,15 @@

                        Examples

                        Examples

                        -
                        %b(foo)       #=> "foo"
                        -%b(f#{:o}o)  #=> "foo"
                        +
                        iex> %b(foo)
                        +"foo"
                        +iex> %b(f#{:o}o)
                        +"foo"
                         
                        - Source + + Source +

                        __c__(arg1, list2) @@ -2194,11 +2469,15 @@

                        Examples

                        Examples

                        -
                        %c(foo)       #=> 'foo'
                        -%c(f#{:o}o)  #=> 'foo'
                        +
                        iex> %c(foo)
                        +'foo'
                        +iex> %c(f#{:o}o)
                        +'foo'
                         
                        - Source + + Source +

                        __r__(arg1, options) @@ -2207,10 +2486,40 @@

                        Examples

                        Examples

                        -
                        Regex.match? %r(foo), "foo"  #=> true
                        +
                        iex> Regex.match? %r(foo), "foo"
                        +true
                         
                        - Source + + Source + +
                        +

                        + __w__(arg1, modifiers) +

                        +

                        Handles the sigil %w. It returns a list of "words" split by whitespace.

                        + +

                        Modifiers

                        + +
                          +
                        • b: binaries (default)
                        • +
                        • a: atoms
                        • +
                        • c: char lists
                        • +
                        + +

                        Examples

                        + +
                        iex> %w(foo #{:bar} baz)
                        +["foo", "bar", "baz"]
                        +iex> %w(--source test/enum_test.exs)
                        +["--source", "test/enum_test.exs"]
                        +iex> %w(foo bar baz)a
                        +[:foo, :bar, :baz]
                        +
                        +
                        + + Source +

                        access(element, args) @@ -2276,15 +2585,10 @@

                        Atoms

                        In this case, "Hello" will be printed twice (one per each field).

                        - -

                        Examples

                        - -
                        a = { :a, :b, :c }
                        -a[1] #=> :a
                        -access a, 1 #=> :a
                        -
                        - Source + + Source +

                        left and right @@ -2294,11 +2598,43 @@

                        Examples

                        Examples

                        -
                        true and false
                        -#=> false
                        +
                        iex> true and false
                        +false
                         
                        - Source + + Source + +
                        +

                        + apply(fun, args) +

                        +

                        Invokes the given fun with the array of arguments args.

                        + +

                        Examples

                        + +
                        iex> apply fn x -> x * 2 end, [2]
                        +4
                        +
                        +
                        + + Source + +
                        +

                        + apply(module, fun, args) +

                        +

                        Invokes the given fun from module with the array of arguments args.

                        + +

                        Examples

                        + +
                        iex> apply Enum, :reverse, [[1,2,3]]
                        +[3,2,1]
                        +
                        +
                        + + Source +

                        atom_to_binary(some_atom) @@ -2308,10 +2644,13 @@

                        Examples

                        Examples

                        -
                        atom_to_binary :my_atom #=> "my_atom"
                        +
                        iex> atom_to_binary :my_atom
                        +"my_atom"
                         
                        - Source + + Source +

                        binary_to_atom(some_binary) @@ -2321,10 +2660,13 @@

                        Examples

                        Examples

                        -
                        binary_to_atom "my_atom" #=> :my_atom
                        +
                        iex> binary_to_atom "my_atom"
                        +:my_atom
                         
                        - Source + + Source +

                        binary_to_existing_atom(some_binary) @@ -2333,11 +2675,17 @@

                        Examples

                        Examples

                        -
                        :my_atom                          #=> :my_atom
                        -binary_to_existing_atom "my_atom" #=> :my_atom
                        +
                        iex> :my_atom
                        +...> binary_to_existing_atom "my_atom"
                        +:my_atom
                        +
                        +iex> binary_to_existing_atom "this_atom_will_never_exist"
                        +** (ArgumentError) argument error
                         
                        - Source + + Source +

                        binary_to_float(some_binary) @@ -2346,10 +2694,13 @@

                        Examples

                        Examples

                        -
                        binary_to_float "2.2017764e+0" #=> 2.2017764
                        +
                        iex> binary_to_float "2.2017764e+0"
                        +2.2017764
                         
                        - Source + + Source +

                        binary_to_integer(some_binary) @@ -2358,10 +2709,13 @@

                        Examples

                        Examples

                        -
                        binary_to_integer "123" #=> 123
                        +
                        iex> binary_to_integer "123"
                        +123
                         
                        - Source + + Source +

                        binary_to_integer(some_binary, base) @@ -2371,10 +2725,13 @@

                        Examples

                        Examples

                        -
                        binary_to_integer("3FF", 16) #=> 1023
                        +
                        iex> binary_to_integer("3FF", 16)
                        +1023
                         
                        - Source + + Source +

                        case(condition, blocks) @@ -2427,7 +2784,9 @@

                        Examples

                        end
                        - Source + + Source +

                        cond(list1) @@ -2438,7 +2797,7 @@

                        Examples

                        Examples

                        cond do
                        -  1 + 1 == 2 ->
                        +  1 + 1 == 1 ->
                             "This will never match"
                           2 * 2 != 4 ->
                             "Nor this"
                        @@ -2447,7 +2806,9 @@ 

                        Examples

                        end
                        - Source + + Source +

                        def(name, list2) @@ -2474,53 +2835,10 @@

                        Examples

                        In the example above, we defined a function sum that receives two arguments and sum them.

                        - -

                        Dynamic generation with atoms

                        - -

                        Elixir follows the same rule as Erlang when it comes to -function invocations. Calling a function is the same thing -as "invoking at atom". That said, we could invoke a function -named sum in these two equivalent ways:

                        - -
                        sum(1, 2)
                        -:sum.(1, 2)
                        -
                        - -

                        We can also use the atom format to define functions:

                        - -
                        defmodule Foo do
                        -  def :sum.(a, b) do
                        -    a + b
                        -  end
                        -end
                        -
                        - -

                        In general, a developer never needs to use the format above -except when he wants to dynamically define functions with macros. -In such scenarios, the name needs to be given dynamically via -the unquoting mechanism.

                        - -

                        Imagine a macro that receives keywords and defines a function -for each entry in the keyword, using the key as function name -and the value as the value returned by the function:

                        - -
                        defmacro defkv(keywords) do
                        -  Enum.map keywords, fn {k,v} ->
                        -    quote do
                        -      def unquote(k)() do
                        -        unquote(v)
                        -      end
                        -    end
                        -  end
                        -end
                        -
                        - -

                        This macro could be invoked as:

                        - -
                        defkv one: 1, two: 2
                        -
                        - Source + + Source +

                        def(name, args, guards, list4) @@ -2557,7 +2875,9 @@

                        Examples

                        def name, args, guards, do: exprs
                        - Source + + Source +

                        defdelegate(funs, opts) @@ -2603,7 +2923,9 @@

                        Examples

                        #=> [3,2,1]
                        - Source + + Source +

                        defexception(name, fields, opts // [], do_block // []) @@ -2619,7 +2941,9 @@

                        Examples

                        2) Exceptions must implement message/1 as API that return a binary as result;

                        - Source + + Source +

                        defimpl(name, opts, do_block // []) @@ -2627,7 +2951,9 @@

                        Examples

                        Defines an implementation for the given protocol. See defprotocol/2 for examples.

                        - Source + + Source +

                        defmodule(name, list2) @@ -2675,7 +3001,9 @@

                        Dynamic names

                        Elixir will accept any module name as long as the expression returns an atom.

                        - Source + + Source +

                        defoverridable(tuples) @@ -2684,7 +3012,9 @@

                        Dynamic names

                        An overridable function is lazily defined, allowing a developer to customize it.

                        - Source + + Source +

                        defp(name, list2) @@ -2708,14 +3038,18 @@

                        Examples

                        In the example above, sum is private and accessing it through Foo.sum will raise an error.

                        - Source + + Source +

                        defp(name, args, guards, list4)

                        The same as def/4 but generates a private function.

                        - Source + + Source +

                        defprotocol(name, list2) @@ -2824,7 +3158,7 @@

                        Protocols + Records

                        In the example above, we have implemented blank? for RedBlack.Tree that simply delegates to RedBlack.empty? passing the tree as argument. This implementation doesn't need to be defined -inside the RedBlack tree or inside the record; it can be defined +inside the RedBlack tree or inside the record; it can be defined anywhere in the code.

                        Finally, since records are simply tuples, one can add a default @@ -2845,7 +3179,9 @@

                        Types

                        The @spec above expresses that all types allowed to implement the given protocol are valid argument types for the given function.

                        - Source + + Source +

                        defrecord(name, fields, opts // [], do_block // []) @@ -2930,6 +3266,33 @@

                        Access syntax

                        Which provides faster get and set times for record operations.

                        +

                        Compile-time introspection

                        + +

                        At the compile time, one can access following information about the record +from within the record module:

                        + +
                          +
                        • @record_fields — a keyword list of record fields with defaults
                        • +
                        • @record_types — a keyword list of record fields with types

                          + +

                          defrecord Foo, bar: nil do + recordtype bar: nil | integer + IO.inspect @recordfields + IO.inspect @record_types + end

                        • +
                        + +

                        prints out

                        + +
                         [bar: nil]
                        + [bar: {:|,[line: ...],[nil,{:integer,[line: ...],nil}]}]
                        +
                        + +

                        where the last line is a quoted representation of

                        + +
                         [bar: nil | integer]
                        +
                        +

                        Documentation

                        By default records are not documented and have @moduledoc set to false.

                        @@ -2953,8 +3316,20 @@

                        Types

                        When defining a type, all the fields not mentioned in the type are assumed to have type term.

                        + +

                        Importing records

                        + +

                        It is also possible to import a public record (a record, defined using +defrecord) as a set of private macros (as if it was defined using defrecordp):

                        + +
                        Record.import Config, as: :config
                        +
                        + +

                        See Record.import/2 and defrecordp/2 documentation for more information

                        - Source + + Source +

                        defrecordp(name, fields) @@ -3002,7 +3377,31 @@

                        Examples

                        name #=> "José"
                        - Source + + Source + +
                        +

                        + delete_elem(tuple, index) +

                        +

                        Define delete_elem to delete element from a tuple according to +Elixir conventions (i.e. it expects the tuple as first argument, +zero-index based).

                        + +

                        Please note that in versions of Erlang prior to R16B there is no BIF +for this operation and it is emulated by converting the tuple to a list +and back and is, therefore, inefficient.

                        + +

                        Example

                        + +
                        iex> tuple = { :foo, :bar, :baz }
                        +...> delete_elem(tuple, 0)
                        +{ :bar, :baz }
                        +
                        +
                        + + Source +

                        destructure(left, right) @@ -3014,10 +3413,9 @@

                        Examples

                        Examples

                        -
                        destructure [x,y,z], [1,2,3,4,5]
                        -x #=> 1
                        -y #=> 2
                        -z #=> 3
                        +
                        iex> destructure [x,y,z], [1,2,3,4,5]
                        +...> {x, y, z}
                        +{1, 2, 3}
                         

                        Notice in the example above, even though the right @@ -3025,10 +3423,9 @@

                        Examples

                        fine. If the right size is smaller, the remaining items are simply assigned to nil:

                        -
                        destructure [x,y,z], [1]
                        -x #=> 1
                        -y #=> nil
                        -z #=> nil
                        +
                        iex> destructure [x,y,z], [1]
                        +...> {x, y, z}
                        +{1, nil, nil}
                         

                        The left side supports any expression you would use @@ -3042,7 +3439,9 @@

                        Examples

                        the first value from the right side. Otherwise, it will raise a CaseClauseError.

                        - Source + + Source +

                        div(left, right) @@ -3053,10 +3452,13 @@

                        Examples

                        Examples

                        -
                        div 5, 2 #=> 2
                        +
                        iex> div 5, 2
                        +2
                         
                        - Source + + Source +

                        elem(tuple, index) @@ -3068,11 +3470,14 @@

                        Examples

                        Example

                        -
                        tuple = { :foo, :bar, 3 }
                        -elem(tuple, 1) #=> :bar
                        +
                        iex> tuple = { :foo, :bar, 3 }
                        +...> elem(tuple, 1)
                        +:bar
                         
                        - Source + + Source +

                        float_to_binary(some_float) @@ -3082,10 +3487,36 @@

                        Example

                        Examples

                        -
                        float_to_binary 7.0 #=> "7.00000000000000000000e+00"
                        +
                        iex> float_to_binary 7.0
                        +"7.00000000000000000000e+00"
                         
                        - Source + + Source + +
                        +

                        + float_to_binary(some_float, options) +

                        +

                        Returns a binary which corresponds to the text representation +of some_float.

                        + +

                        Options

                        + +
                          +
                        • :decimals — number of decimal points to show
                        • +
                        • :scientific — number of decimal points to show, in scientific format
                        • +
                        • :compact — If true, use the most compact representation. Ignored with the scientific option
                        • +
                        + +

                        Examples

                        + +
                        float_to_binary 7.1, [decimals: 2, compact: true] #=> "7.1"
                        +
                        +
                        + + Source +

                        function(args) @@ -3094,11 +3525,11 @@

                        Examples

                        Examples

                        -
                        sum = function do
                        -  (x, y) -> x + y
                        -end
                        -
                        -sum.(1, 2) #=> 3
                        +
                        iex> sum = function do
                        +...>   (x, y) -> x + y
                        +...> end
                        +...> sum.(1, 2)
                        +3
                         

                        Notice that a function needs to be invoked using the dot between @@ -3107,12 +3538,12 @@

                        Examples

                        Multiple clauses can be specified as in case, receive and similar macros:

                        -
                        sum = function do
                        -  x, y when y > 0 -> x + y
                        -  x, y -> x - y
                        -end
                        -
                        -sum.(1, 2) #=> 3
                        +
                        iex> sum = function do
                        +...>   x, y when y > 0 -> x + y
                        +...>   x, y -> x - y
                        +...> end
                        +...> sum.(1, 2)
                        +3
                         

                        Shortcut syntax

                        @@ -3154,20 +3585,74 @@

                        Shortcut syntax

                        x -> x * 2 end)
                        +
                        + + Source + +
                        +

                        + function(function, arity) +

                        +

                        Retrieves a local or an imported function.

                        + +

                        Examples

                        + +
                        iex> f = function(:is_atom, 1)
                        +...> f.(:foo)
                        +true
                        +
                        + +

                        Notice that local functions cannot be retrieved dynamically, +the following, for example, wouldn't work:

                        + +
                        some_fun = :is_atom
                        +function(some_fun, 1)
                        +
                        + +

                        In such cases, one should use function/3:

                        -

                        Function retrieval

                        +
                        some_fun = :is_atom
                        +function(SomeModule, some_fun, 1)
                        +
                        -

                        The function macro can also be used to retrieve local or remote -functions:

                        +

                        Shortcut syntax

                        -
                        f = function(:is_atom, 1)
                        -f.(:foo) #=> true
                        +

                        One can use a shortcut syntax to retrieve such functions, +that resembles Erlang's fun:

                        -f = function(List, :flatten, 1) -f.([1,[2],3]) #=> [1,2,3] +
                        f = function(is_atom/1)
                        +f.(:foo)
                         
                        - Source + + Source + +
                        +

                        + function(module, function, arity) +

                        +

                        Retrieves a function from a module.

                        + +

                        Examples

                        + +
                        iex> f = function(Kernel, :is_atom, 1)
                        +...> f.(:foo)
                        +true
                        +
                        + +

                        Shortcut syntax

                        + +

                        One can use a shortcut syntax to retrieve such functions, +that resembles Erlang's fun:

                        + +
                        iex> f = function(Kernel.is_atom/1)
                        +...> f.(:foo)
                        +true
                        +
                        +
                        + + Source +

                        if(condition, clauses) @@ -3211,7 +3696,9 @@

                        Blocks examples

                        If you want to compare more than two clauses, you can use the cond/1 macro.

                        - Source + + Source +

                        left in right @@ -3222,8 +3709,9 @@

                        Blocks examples

                        Examples

                        -
                        x = 1
                        -x in [1,2,3] #=> true
                        +
                        iex> x = 1
                        +...> x in [1,2,3]
                        +true
                         

                        This macro simply translates the expression above to:

                        @@ -3253,7 +3741,31 @@

                        Clauses

                        In this case, Elixir will automatically expand it and define the variable for us.

                        - Source + + Source + +
                        +

                        + insert_elem(tuple, index, value) +

                        +

                        Define insert_elem to insert element into a tuple according to +Elixir conventions (i.e. it expects the tuple as first argument, +zero-index based).

                        + +

                        Please note that in versions of Erlang prior to R16B there is no BIF +for this operation and it is emulated by converting the tuple to a list +and back and is, therefore, inefficient.

                        + +

                        Example

                        + +
                        iex> tuple = { :bar, :baz }
                        +...> insert_elem(tuple, 0, :foo)
                        +{ :foo, :bar, :baz }
                        +
                        +
                        + + Source +

                        inspect(arg, opts // []) @@ -3273,8 +3785,8 @@

                        Options

                        Examples

                        -
                        inspect(:foo)
                        -#=> ":foo"
                        +
                        iex> inspect(:foo)
                        +":foo"
                         

                        Note that the inspect protocol does not necessarily return a valid @@ -3285,7 +3797,9 @@

                        Examples

                        #=> #Function<...>
                        - Source + + Source +

                        integer_to_binary(some_integer) @@ -3295,10 +3809,13 @@

                        Examples

                        Examples

                        -
                        integer_to_binary 123 #=> "123"
                        +
                        iex> integer_to_binary 123
                        +"123"
                         
                        - Source + + Source +

                        integer_to_binary(some_integer, base) @@ -3308,10 +3825,13 @@

                        Examples

                        Examples

                        -
                        integer_to_binary 77 #=> "77"
                        +
                        iex> integer_to_binary 77
                        +"77"
                         
                        - Source + + Source +

                        is_exception(thing) @@ -3320,25 +3840,33 @@

                        Examples

                        Examples

                        -
                        is_exception(Error.new) #=> true
                        -is_exception(1)         #=> false
                        +
                        iex> is_exception((fn -> ArithmeticError.new end).())
                        +true
                        +iex> is_exception((fn -> 1 end).())
                        +false
                         
                        - Source + + Source +

                        is_range(thing)

                        Checks if the given argument is a range.

                        - Source + + Source +

                        is_record(thing)

                        Checks if the given argument is a record.

                        - Source + + Source +

                        is_record(thing, kind) @@ -3355,14 +3883,18 @@

                        Examples

                        is_record(Config.new, List) #=> false
                        - Source + + Source +

                        is_regex(thing)

                        Checks if the given argument is a regex.

                        - Source + + Source +

                        match?(left, right) @@ -3372,9 +3904,12 @@

                        Examples

                        Examples

                        -
                        match?(1, 1) #=> true
                        -match?(1, 2) #=> false
                        -match?({1,_}, {1,2}) #=> true
                        +
                        iex> match?(1, 1)
                        +true
                        +iex> match?(1, 2)
                        +false
                        +iex> match?({1,_}, {1,2})
                        +true
                         

                        Match can also be used to filter or find a value in an enumerable:

                        @@ -3389,7 +3924,9 @@

                        Examples

                        Enum.filter list, match?({:a, x } when x < 2, &1)
                        - Source + + Source +

                        nil?(x) @@ -3399,11 +3936,15 @@

                        Examples

                        Examples

                        -
                        nil? 1    #=> false
                        -nil? nil  #=> true
                        +
                        iex> nil? 1
                        +false
                        +iex> nil? nil
                        +true
                         
                        - Source + + Source +

                        not arg @@ -3413,11 +3954,13 @@

                        Examples

                        Examples

                        -
                        not false
                        -#=> true
                        +
                        iex> not false
                        +true
                         
                        - Source + + Source +

                        left or right @@ -3427,11 +3970,13 @@

                        Examples

                        Examples

                        -
                        true or false
                        -#=> true
                        +
                        iex> true or false
                        +true
                         
                        - Source + + Source +

                        receive(args) @@ -3479,7 +4024,9 @@

                        Examples

                        will occur immediately.

                      - Source + + Source +

                      rem(left, right) @@ -3490,26 +4037,30 @@

                      Examples

                      Examples

                      -
                      rem 5, 2 #=> 1
                      +
                      iex> rem 5, 2
                      +1
                       
                      - Source + + Source +
                      -

                      - setelem(tuple, index, value) +

                      + set_elem(tuple, index, value)

                      -

                      Define setelem to set Tuple element according to Elixir conventions +

                      Define set_elem to set Tuple element according to Elixir conventions (i.e. it expects the tuple as first argument, zero-index based).

                      -

                      It is implemented as a macro so it can be used in guards.

                      -

                      Example

                      -
                      tuple = { :foo, :bar, 3 }
                      -setelem(tuple, 0, :baz) #=> { :baz, :bar, 3 }
                      +
                      iex> tuple = { :foo, :bar, 3 }
                      +...> set_elem(tuple, 0, :baz)
                      +{ :baz, :bar, 3 }
                       
                      - Source + + Source +

                      to_binary(arg) @@ -3519,11 +4070,13 @@

                      Example

                      Examples

                      -
                      to_binary(:foo)
                      -#=> "foo"
                      +
                      iex> to_binary(:foo)
                      +"foo"
                       
                      - Source + + Source +

                      to_char_list(arg) @@ -3532,11 +4085,13 @@

                      Examples

                      Examples

                      -
                      to_char_list(:foo)
                      -#=> 'foo'
                      +
                      iex> to_char_list(:foo)
                      +'foo'
                       
                      - Source + + Source +

                      try(args) @@ -3653,7 +4208,9 @@

                      Variable visibility

                      end
                      - Source + + Source +

                      unless(clause, options) @@ -3662,7 +4219,9 @@

                      Variable visibility

                      unless a value evalutes to true. Check if for examples and documentation.

                      - Source + + Source +

                      use(module, args // []) @@ -3699,7 +4258,9 @@

                      Examples

                      end
                      - Source + + Source +

                      left xor right @@ -3709,11 +4270,13 @@

                      Examples

                      Examples

                      -
                      true xor false
                      -#=> true
                      +
                      iex> true xor false
                      +true
                       
                      - Source + + Source +

                      left |> right @@ -3725,8 +4288,8 @@

                      Examples

                      Examples

                      -
                      [1,[2],3] |> List.flatten |> Enum.map(&1 * 2)
                      -#=> [2,4,6]
                      +
                      iex> [1,[2],3] |> List.flatten |> Enum.map(&1 * 2)
                      +[2,4,6]
                       

                      The expression above is simply translated to:

                      @@ -3752,7 +4315,9 @@

                      Examples

                      String.graphemes("Hello") |> Enum.reverse
                       
                      - Source + + Source +

                      left || right @@ -3763,17 +4328,23 @@

                      Examples

                      Examples

                      -
                      false || false       #=> false
                      -nil || true          #=> true
                      -false || 1           #=> 1
                      -true || error(:bad)  #=> true
                      +
                      iex> false || false
                      +false
                      +iex> nil || true
                      +true
                      +iex> false || 1
                      +1
                      +iex> true || throw(:bad)
                      +true
                       

                      Notice that, differently from Erlang or operator, this operator accepts any expression as arguments, not only booleans, however it is not allowed in guards.

                      - Source + + Source + diff --git a/docs/master/KeyError.html b/docs/master/KeyError.html index 0e401d4f9..4f6847a95 100644 --- a/docs/master/KeyError.html +++ b/docs/master/KeyError.html @@ -47,7 +47,7 @@

                      Fields (and defaults)

                      -

                      Functions summary

                      +

                      Functions summary

                      • @@ -70,7 +70,9 @@

                        Functions

                        message(exception)

                        - Source + + Source + diff --git a/docs/master/Keyword.html b/docs/master/Keyword.html index 11a174d02..b1bfe9cba 100644 --- a/docs/master/Keyword.html +++ b/docs/master/Keyword.html @@ -49,7 +49,7 @@

                        -

                        Functions summary

                        +

                        Functions summary

                        • @@ -168,11 +168,15 @@

                          Functions

                          Examples

                          -
                          Keyword.delete [a: 1, b: 2], :a   #=> [b: 2]
                          -Keyword.delete [b: 2], :a         #=> [b: 2]
                          +
                          iex> Keyword.delete [a: 1, b: 2], :a
                          +[b: 2]
                          +iex> Keyword.delete [b: 2], :a
                          +[b: 2]
                           
                          - Source + + Source +

                          equal?(left, right) @@ -182,11 +186,13 @@

                          Examples

                          Examples

                          -
                          Keyword.equal? [a: 1, b: 2], [b: 2, a: 1]
                          -#=> true
                          +
                          iex> Keyword.equal? [a: 1, b: 2], [b: 2, a: 1]
                          +true
                           
                          - Source + + Source +

                          from_enum(enum) @@ -195,7 +201,9 @@

                          Examples

                          which behaves as a dict, Keyword.from_enum do not remove duplicated entries.

                          - Source + + Source +

                          get(keywords, key, default // nil) @@ -210,12 +218,17 @@

                          Examples

                          Examples

                          -
                          Keyword.get [a: 1], :a      #=> 1
                          -Keyword.get [a: 1], :b      #=> nil
                          -Keyword.get [a: 1], :b, 3   #=> 3
                          +
                          iex> Keyword.get [a: 1], :a
                          +1
                          +iex> Keyword.get [a: 1], :b
                          +nil
                          +iex> Keyword.get [a: 1], :b, 3
                          +3
                           
                          - Source + + Source +

                          get!(keywords, key) @@ -225,11 +238,15 @@

                          Examples

                          Examples

                          -
                          Keyword.get! [a: 1], :a      #=> 1
                          -Keyword.get! [a: 1], :b      #=> raises KeyError[key: :b]
                          +
                          iex> Keyword.get! [a: 1], :a
                          +1
                          +iex> Keyword.get! [a: 1], :b
                          +** (KeyError) key not found: :b
                           
                          - Source + + Source +

                          get_values(keywords, key) @@ -238,11 +255,13 @@

                          Examples

                          Examples

                          -
                          Keyword.get_values [a: 1, a: 2], :a
                          -#=> [1,2]
                          +
                          iex> Keyword.get_values [a: 1, a: 2], :a
                          +[1,2]
                           
                          - Source + + Source +

                          has_key?(keywords, key) @@ -251,13 +270,15 @@

                          Examples

                          Examples

                          -
                          Keyword.has_key?([a: 1], :a)
                          -#=> true
                          -Keyword.has_key?([a: 1], :b)
                          -#=> false
                          +
                          iex> Keyword.has_key?([a: 1], :a)
                          +true
                          +iex> Keyword.has_key?([a: 1], :b)
                          +false
                           
                          - Source + + Source +

                          keys(keywords) @@ -267,17 +288,22 @@

                          Examples

                          Examples

                          -
                          Keyword.keys [a: 1, b: 2] #=> [:a,:b]
                          +
                          iex> Keyword.keys [a: 1, b: 2]
                          +[:a,:b]
                           
                          - Source + + Source +

                          keyword?(arg1)

                          Checks if the given argument is a keywords list or not

                          - Source + + Source +

                          merge(d1, d2) @@ -287,11 +313,13 @@

                          Examples

                          Examples

                          -
                          Keyword.merge [a: 1, b: 2], [a: 3, d: 4]
                          -#=> [a:3, b:2, d: 4]
                          +
                          iex> Enum.sort Keyword.merge [a: 1, b: 2], [a: 3, d: 4]
                          +[a: 3, b: 2, d: 4]
                           
                          - Source + + Source +

                          merge(d1, d2, fun) @@ -301,20 +329,24 @@

                          Examples

                          Examples

                          -
                          Keyword.merge [a: 1, b: 2], [a: 3, d: 4], fn _k, v1, v2 ->
                          -  v1 + v2
                          -end
                          -#=> [a:4, b:2, d: 4]
                          +
                          iex> Keyword.merge [a: 1, b: 2], [a: 3, d: 4], fn _k, v1, v2 ->
                          +...>  v1 + v2
                          +iex> end
                          +[a: 4, b: 2, d: 4]
                           
                          - Source + + Source +

                          new()

                          Returns an empty keyword list, i.e. an empty list.

                          - Source + + Source +

                          new(pairs) @@ -324,11 +356,13 @@

                          Examples

                          Examples

                          -
                          Keyword.new [{:b,1},{:a,2}]
                          -#=> [a: 2, b: 1]
                          +
                          iex> Keyword.new [{:b,1},{:a,2}]
                          +[a: 2, b: 1]
                           
                          - Source + + Source +

                          new(pairs, transform) @@ -339,11 +373,13 @@

                          Examples

                          Examples

                          -
                          Keyword.new [:a, :b], fn x -> {x,x} end
                          -#=> [a: :a, b: :b]
                          +
                          iex> Enum.sort Keyword.new [:a, :b], fn x -> {x,x} end
                          +[a: :a, b: :b]
                           
                          - Source + + Source +

                          put(keywords, key, value) @@ -355,11 +391,13 @@

                          Examples

                          Examples

                          -
                          Keyword.put [a: 1, b: 2], :a, 3
                          -#=> [a: 3, b: 2]
                          +
                          iex> Keyword.put [a: 1, b: 2], :a, 3
                          +[a: 3, b: 2]
                           
                          - Source + + Source +

                          put_new(keywords, key, value) @@ -369,11 +407,13 @@

                          Examples

                          Examples

                          -
                          Keyword.put_new [a: 1, b: 2], :a, 3
                          -#=> [a: 1, b: 2]
                          +
                          iex> Keyword.put_new [a: 1, b: 2], :a, 3
                          +[a: 1, b: 2]
                           
                          - Source + + Source +

                          update(list1, key, fun) @@ -383,13 +423,15 @@

                          Examples

                          Examples

                          -
                          Keyword.update([a: 1], :a, &1 * 2)
                          -#=> [a: 2]
                          -Keyword.update([a: 1], :b, &1 * 2)
                          -#=> KeyError
                          +
                          iex> Keyword.update([a: 1], :a, &1 * 2)
                          +[a: 2]
                          +iex> Keyword.update([a: 1], :b, &1 * 2)
                          +** (KeyError) key not found: :b
                           
                          - Source + + Source +

                          update(list1, key, initial, fun) @@ -399,13 +441,15 @@

                          Examples

                          Examples

                          -
                          Keyword.update([a: 1], :a, 13, &1 * 2)
                          -#=> [a: 2]
                          -Keyword.update([a: 1], :b, 11, &1 * 2)
                          -#=> [a: 1, b: 11]
                          +
                          iex> Keyword.update([a: 1], :a, 13, &1 * 2)
                          +[a: 2]
                          +iex> Keyword.update([a: 1], :b, 11, &1 * 2)
                          +[a: 1, b: 11]
                           
                          - Source + + Source +

                          values(keywords) @@ -414,10 +458,13 @@

                          Examples

                          Examples

                          -
                          Keyword.values [a: 1, b: 2] #=> [1,2]
                          +
                          iex> Keyword.values [a: 1, b: 2]
                          +[1,2]
                           
                          - Source + + Source + diff --git a/docs/master/List.Chars.Atom.html b/docs/master/List.Chars.Atom.html index b672659fb..1dfc40ead 100644 --- a/docs/master/List.Chars.Atom.html +++ b/docs/master/List.Chars.Atom.html @@ -36,7 +36,7 @@

                          -

                          Functions summary

                          +

                          Functions summary

                          • @@ -59,7 +59,9 @@

                            Functions

                            to_char_list(atom)

                            - Source + + Source + diff --git a/docs/master/List.Chars.BitString.html b/docs/master/List.Chars.BitString.html index 0e87f7dd2..cbee8f544 100644 --- a/docs/master/List.Chars.BitString.html +++ b/docs/master/List.Chars.BitString.html @@ -36,7 +36,7 @@

                            -

                            Functions summary

                            +

                            Functions summary

                            • @@ -59,7 +59,9 @@

                              Functions

                              to_char_list(bitstring)

                              - Source + + Source + diff --git a/docs/master/List.Chars.List.html b/docs/master/List.Chars.List.html index 5abba51c1..96748e2d1 100644 --- a/docs/master/List.Chars.List.html +++ b/docs/master/List.Chars.List.html @@ -36,7 +36,7 @@

                              -

                              Functions summary

                              +

                              Functions summary

                              • @@ -59,7 +59,9 @@

                                Functions

                                to_char_list(list)

                                - Source + + Source + diff --git a/docs/master/List.Chars.Number.html b/docs/master/List.Chars.Number.html index 477665e1d..56e96f457 100644 --- a/docs/master/List.Chars.Number.html +++ b/docs/master/List.Chars.Number.html @@ -36,7 +36,7 @@

                                -

                                Functions summary

                                +

                                Functions summary

                                • @@ -59,7 +59,9 @@

                                  Functions

                                  to_char_list(integer)

                                  - Source + + Source + diff --git a/docs/master/List.Chars.html b/docs/master/List.Chars.html index 0c725d8a0..fd9d2c6e9 100644 --- a/docs/master/List.Chars.html +++ b/docs/master/List.Chars.html @@ -43,7 +43,7 @@

                                  Source -

                                  Implementations

                                  +

                                  Implementations

                                  • @@ -76,7 +76,7 @@

                                    Implementations

                                    -

                                    Functions summary

                                    +

                                    Functions summary

                                    • @@ -99,7 +99,9 @@

                                      Functions

                                      to_char_list(thing)

                                      - Source + + Source + diff --git a/docs/master/List.Dict.html b/docs/master/List.Dict.html index 6942a809a..50e357014 100644 --- a/docs/master/List.Dict.html +++ b/docs/master/List.Dict.html @@ -42,7 +42,7 @@

                                      -

                                      Functions summary

                                      +

                                      Functions summary

                                      • @@ -146,14 +146,18 @@

                                        Functions

                                        Deletes the entry under the given key from the dict.

                                        - Source + + Source +

                                        empty(_dict)

                                        Returns an empty List.Dict.

                                        - Source + + Source +

                                        get(dict, key, default // nil) @@ -161,7 +165,9 @@

                                        Functions

                                        Returns the value under key from the given dict or default if no key is set.

                                        - Source + + Source +

                                        get!(dict, key) @@ -169,42 +175,54 @@

                                        Functions

                                        Returns the value under the given key raises KeyError if the key does not exist.

                                        - Source + + Source +

                                        has_key?(dict, key)

                                        Returns true if the dict has the given key.

                                        - Source + + Source +

                                        keys(dict)

                                        Returns all keys in the dict.

                                        - Source + + Source +

                                        merge(dict, enum, callback // fn _k, _v1, v2 -> v2 end)

                                        Merges the given Enumerable into the dict.

                                        - Source + + Source +

                                        new()

                                        Returns a new List.Dict, i.e. an empty list.

                                        - Source + + Source +

                                        new(pairs)

                                        Creates a new List.Dict from the given pairs.

                                        - Source + + Source +

                                        new(list, transform) @@ -212,14 +230,18 @@

                                        Functions

                                        Creates a new List.Dict from the given pairs via the given transformation function.

                                        - Source + + Source +

                                        put(dict, key, val)

                                        Puts the given key-value pair in the dict.

                                        - Source + + Source +

                                        put_new(dict, key, val) @@ -227,28 +249,36 @@

                                        Functions

                                        Puts the given key-value pair in the dict if no entry exists yet.

                                        - Source + + Source +

                                        size(dict)

                                        Returns the dict size.

                                        - Source + + Source +

                                        to_list(dict)

                                        Converts the dict to a list.

                                        - Source + + Source +

                                        update(list1, key, fun)

                                        Updates the key in the dict according to the given function.

                                        - Source + + Source +

                                        update(list1, key, initial, fun) @@ -256,14 +286,18 @@

                                        Functions

                                        Updates the key in the dict according to the given function or uses the given initial value if no entry exists.

                                        - Source + + Source +

                                        values(dict)

                                        Returns all values in the dict.

                                        - Source + + Source +
                                        diff --git a/docs/master/List.html b/docs/master/List.html index 75aca8a52..fe0b41ab6 100644 --- a/docs/master/List.html +++ b/docs/master/List.html @@ -46,7 +46,7 @@

                                        -

                                        Functions summary

                                        +

                                        Functions summary

                                        • @@ -157,11 +157,13 @@

                                          Functions

                                          Examples

                                          -
                                          List.concat [[1,[2],3], [4], [5,6]]
                                          -#=> [1,[2],3,4,5,6]
                                          +
                                          iex> List.concat [[1,[2],3], [4], [5,6]]
                                          +[1,[2],3,4,5,6]
                                           
                                          - Source + + Source +

                                          concat(list, elements) @@ -174,11 +176,13 @@

                                          Examples

                                          Examples

                                          -
                                          List.concat [1,2,3], [4,5,6]
                                          -#=> [1,2,3,4,5,6]
                                          +
                                          iex> List.concat [1,2,3], [4,5,6]
                                          +[1,2,3,4,5,6]
                                           
                                          - Source + + Source +

                                          delete(list, item) @@ -189,11 +193,13 @@

                                          Examples

                                          Examples

                                          -
                                          List.delete([1,2,3], 1)
                                          -#=> [2,3]
                                          +
                                          iex> List.delete([1,2,3], 1)
                                          +[2,3]
                                           
                                          - Source + + Source +

                                          duplicate(elem, n) @@ -202,14 +208,16 @@

                                          Examples

                                          Examples

                                          -
                                          List.duplicate "hello", 3
                                          -#=> ["hello","hello","hello"]
                                          +
                                          iex> List.duplicate "hello", 3
                                          +["hello","hello","hello"]
                                           
                                          -List.duplicate [1,2], 2
                                          -#=> [[1,2],[1,2]]
                                          +iex> List.duplicate [1,2], 2
                                          +[[1,2],[1,2]]
                                           
                                          - Source + + Source +

                                          flatten(list) @@ -220,20 +228,24 @@

                                          Examples

                                          Examples

                                          -
                                          List.flatten [1,[[2],3]]
                                          -#=> [1,2,3]
                                          +
                                          iex> List.flatten [1,[[2],3]]
                                          +[1,2,3]
                                           
                                          -List.flatten [1,[[2],3]], [4,5]
                                          -#=> [1,2,3,4,5]
                                          +iex> List.flatten [1,[[2],3]], [4,5]
                                          +[1,2,3,4,5]
                                           
                                          - Source + + Source +

                                          flatten(list, tail)

                                          - Source + + Source +

                                          foldl(list, acc, function) @@ -243,14 +255,16 @@

                                          Examples

                                          Examples

                                          -
                                          List.foldl [5,5], 10, fn x, acc -> x + acc end
                                          -#=> 20
                                          +
                                          iex> List.foldl [5,5], 10, fn x, acc -> x + acc end
                                          +20
                                           
                                          -List.foldl [1,2,3,4], 0, fn x, acc -> x - acc end
                                          -#=> 2
                                          +iex> List.foldl [1,2,3,4], 0, fn x, acc -> x - acc end
                                          +2
                                           
                                          - Source + + Source +

                                          foldr(list, acc, function) @@ -260,11 +274,13 @@

                                          Examples

                                          Examples

                                          -
                                          List.foldr [1,2,3,4], 0, fn x, acc -> x - acc end
                                          -#=> -2
                                          +
                                          iex> List.foldr [1,2,3,4], 0, fn x, acc -> x - acc end
                                          +-2
                                           
                                          - Source + + Source +

                                          keydelete(list, key, position) @@ -275,17 +291,19 @@

                                          Examples

                                          Examples

                                          -
                                          List.keydelete([a: 1, b: 2], :a, 0)
                                          -#=> [{ :b, 2 }]
                                          +
                                          iex> List.keydelete([a: 1, b: 2], :a, 0)
                                          +[{ :b, 2 }]
                                           
                                          -List.keydelete([a: 1, b: 2], 2, 1)
                                          -#=> [{ :a, 1 }]
                                          +iex> List.keydelete([a: 1, b: 2], 2, 1)
                                          +[{ :a, 1 }]
                                           
                                          -List.keydelete([a: 1, b: 2], :c, 0)
                                          -#=> [{ :a, 1 }, { :b, 2 }]
                                          +iex> List.keydelete([a: 1, b: 2], :c, 0)
                                          +[{ :a, 1 }, { :b, 2 }]
                                           
                                          - Source + + Source +

                                          keyfind(list, key, position, default // nil) @@ -296,17 +314,19 @@

                                          Examples

                                          Examples

                                          -
                                          List.keyfind([a: 1, b: 2], :a, 0)
                                          -#=> { :a, 1 }
                                          +
                                          iex> List.keyfind([a: 1, b: 2], :a, 0)
                                          +{ :a, 1 }
                                           
                                          -List.keyfind([a: 1, b: 2], 2, 1)
                                          -#=> { :b, 2 }
                                          +iex> List.keyfind([a: 1, b: 2], 2, 1)
                                          +{ :b, 2 }
                                           
                                          -List.keyfind([a: 1, b: 2], :c, 0)
                                          -#=> nil
                                          +iex> List.keyfind([a: 1, b: 2], :c, 0)
                                          +nil
                                           
                                          - Source + + Source +

                                          keymember?(list, key, position) @@ -317,17 +337,19 @@

                                          Examples

                                          Examples

                                          -
                                          List.keymember?([a: 1, b: 2], :a, 0)
                                          -#=> true
                                          +
                                          iex> List.keymember?([a: 1, b: 2], :a, 0)
                                          +true
                                           
                                          -List.keymember?([a: 1, b: 2], 2, 1)
                                          -#=> true
                                          +iex> List.keymember?([a: 1, b: 2], 2, 1)
                                          +true
                                           
                                          -List.keymember?([a: 1, b: 2], :c, 0)
                                          -#=> false
                                          +iex> List.keymember?([a: 1, b: 2], :c, 0)
                                          +false
                                           
                                          - Source + + Source +

                                          keyreplace(list, key, position, new_tuple) @@ -337,11 +359,13 @@

                                          Examples

                                          Examples

                                          -
                                          List.keyreplace([a: 1, b: 2], :a, 0, { :a, 3 })
                                          -#=> [a: 3, b: 2]
                                          +
                                          iex> List.keyreplace([a: 1, b: 2], :a, 0, { :a, 3 })
                                          +[a: 3, b: 2]
                                           
                                          - Source + + Source +

                                          keystore(list, key, position, new_tuple) @@ -352,11 +376,13 @@

                                          Examples

                                          Examples

                                          -
                                          List.keystore([a: 1, b: 2], :a, 0, { :a, 3 })
                                          -#=> [a: 3, b: 2]
                                          +
                                          iex> List.keystore([a: 1, b: 2], :a, 0, { :a, 3 })
                                          +[a: 3, b: 2]
                                           
                                          - Source + + Source +

                                          last(list) @@ -365,15 +391,17 @@

                                          Examples

                                          Examples

                                          -
                                          List.last []
                                          -#=> nil
                                          -List.last [1]
                                          -#=> 1
                                          -List.last [1, 2, 3]
                                          -#=> 3
                                          +
                                          iex> List.last []
                                          +nil
                                          +iex> List.last [1]
                                          +1
                                          +iex> List.last [1, 2, 3]
                                          +3
                                           
                                          - Source + + Source +

                                          member?(list, term) @@ -384,14 +412,16 @@

                                          Examples

                                          Examples

                                          -
                                          List.member? [1,2,3], 1
                                          -#=> true
                                          +
                                          iex> List.member? [1,2,3], 1
                                          +true
                                           
                                          -List.member? [1,2,3], 0
                                          -#=> false
                                          +iex> List.member? [1,2,3], 0
                                          +false
                                           
                                          - Source + + Source +

                                          unzip(list) @@ -401,14 +431,16 @@

                                          Examples

                                          Examples

                                          -
                                          List.unzip [{1, 2}, {3, 4}]
                                          -#=> [[1, 3], [2, 4]]
                                          +
                                          iex> List.unzip [{1, 2}, {3, 4}]
                                          +[[1, 3], [2, 4]]
                                           
                                          -List.unzip [{1, :a, "apple"}, {2, :b, "banana"}, {3, :c}]
                                          -#=> [[1, 2, 3], [:a, :b, :c]]
                                          +iex> List.unzip [{1, :a, "apple"}, {2, :b, "banana"}, {3, :c}]
                                          +[[1, 2, 3], [:a, :b, :c]]
                                           
                                          - Source + + Source +

                                          wrap(list) @@ -419,10 +451,13 @@

                                          Examples

                                          Examples

                                          -
                                          List.wrap [1,2,3] #=> [1,2,3]
                                          +
                                          iex> List.wrap [1,2,3]
                                          +[1,2,3]
                                           
                                          - Source + + Source +

                                          zip(list_of_lists) @@ -431,14 +466,16 @@

                                          Examples

                                          Examples

                                          -
                                          List.zip [[1, 2], [3, 4], [5, 6]]
                                          -#=> [{1, 3, 5}, {2, 4, 6}]
                                          +
                                          iex> List.zip [[1, 2], [3, 4], [5, 6]]
                                          +[{1, 3, 5}, {2, 4, 6}]
                                           
                                          -List.zip [[1, 2], [3], [5, 6]]
                                          -#=> [{1, 3, 5}]
                                          +iex> List.zip [[1, 2], [3], [5, 6]]
                                          +[{1, 3, 5}]
                                           
                                          - Source + + Source + diff --git a/docs/master/Macro.Env.html b/docs/master/Macro.Env.html index c44f3587f..862c4b00c 100644 --- a/docs/master/Macro.Env.html +++ b/docs/master/Macro.Env.html @@ -120,7 +120,7 @@

                                          Fields (and defaults)

                                          -

                                          Functions summary

                                          +

                                          Functions summary

                                          • @@ -160,7 +160,9 @@

                                            Functions

                                            Returns wether the compilation environment is currently inside a guard.

                                            - Source + + Source +

                                            in_match?(record) @@ -168,7 +170,9 @@

                                            Functions

                                            Returns wether the compilation environment is currently inside a match clause.

                                            - Source + + Source +

                                            location(record) @@ -176,14 +180,18 @@

                                            Functions

                                            Returns a keyword list containing the file and line information as keys.

                                            - Source + + Source +

                                            stacktrace(record)

                                            Returns the environment stacktrace.

                                            - Source + + Source +
                                            diff --git a/docs/master/Macro.html b/docs/master/Macro.html index 6f5c62d51..a07303c79 100644 --- a/docs/master/Macro.html +++ b/docs/master/Macro.html @@ -39,7 +39,7 @@

                                            -

                                            Functions summary

                                            +

                                            Functions summary

                                            • @@ -96,7 +96,7 @@

                                              Functions summary

                                              -

                                              Macros summary

                                              +

                                              Macros summary

                                              • @@ -122,25 +122,28 @@

                                                Functions

                                                do_safe_term(terms)

                                                - Source + + Source +

                                                - escape(tuple) + escape(expr)

                                                -

                                                Recursively escapes the given value so it can be inserted -into a syntax tree. Structures that are valid syntax nodes -(like atoms, integers, binaries) are represented by themselves.

                                                +

                                                Recursively escapes a value so it can be inserted +into a syntax tree.

                                                Examples

                                                -
                                                Macro.escape(:foo)
                                                -#=> :foo
                                                +
                                                iex> Macro.escape(:foo)
                                                +:foo
                                                 
                                                -Macro.escape({ :a, :b, :c })
                                                -#=> { :{}, [], [:a, :b, :c] }
                                                +iex> Macro.escape({ :a, :b, :c })
                                                +{ :{}, [], [:a, :b, :c] }
                                                 
                                                - Source + + Source +

                                                expand(aliases, env) @@ -158,10 +161,13 @@

                                                Examples

                                                In case the expression cannot be expanded, it returns the expression itself.

                                                Notice that Macro.expand is not recursive and it does not -expand child expressions. For example, !some_macro will expand as:

                                                +expand child expressions. In this example

                                                -
                                                iex> IO.puts Macro.to_binary Macro.expand(quote(do: !some_macro), __ENV__)
                                                -case some_macro do
                                                +

                                                Macro.expand(quote(do: !somemacro), _ENV__)

                                                + +

                                                !some_macro will expand to something like:

                                                + +
                                                case some_macro do
                                                   false -> true
                                                   nil   -> true
                                                   _     -> false
                                                @@ -237,7 +243,9 @@ 

                                                Examples

                                                end
                                                - Source + + Source +

                                                extract_args(expr) @@ -254,12 +262,13 @@

                                                Examples

                                                extract_args(quote do: foo)        == { :foo, [] }
                                                 extract_args(quote do: foo())      == { :foo, [] }
                                                -extract_args(quote do: :foo.())    == { :foo, [] }
                                                 extract_args(quote do: foo(1,2,3)) == { :foo, [1,2,3] }
                                                 extract_args(quote do: 1.(1,2,3))  == :error
                                                 
                                                - Source + + Source +

                                                safe_term(terms) @@ -269,7 +278,9 @@

                                                Examples

                                                evaluate code) and returns :ok unless a given term is unsafe, which is returned as { :unsafe, term }.

                                                - Source + + Source +

                                                to_binary(tree) @@ -278,11 +289,13 @@

                                                Examples

                                                Examples

                                                -
                                                Macro.to_binary(quote do: foo.bar(1, 2, 3))
                                                -#=> "foo.bar(1, 2, 3)"
                                                +
                                                iex> Macro.to_binary(quote do: foo.bar(1, 2, 3))
                                                +"foo.bar(1, 2, 3)"
                                                 
                                                - Source + + Source +

                                                unescape_binary(chars) @@ -301,14 +314,16 @@

                                                Examples

                                                Examples

                                                -
                                                Macro.unescape_binary "example\\n"
                                                -#=> "example\n"
                                                +
                                                iex> Macro.unescape_binary "example\\n"
                                                +"example\n"
                                                 

                                                In the example above, we pass a string with \n escaped and we return a version with it unescaped.

                                                - Source + + Source +

                                                unescape_binary(chars, map) @@ -356,7 +371,9 @@

                                                Examples

                                                Macro.unescape_binary "example\\n", unescape_map(&1)
                                                 
                                                - Source + + Source +

                                                unescape_tokens(tokens) @@ -368,7 +385,9 @@

                                                Examples

                                                when implementing your own sigils. Check the implementation of Kernel.__b__ for examples.

                                                - Source + + Source +

                                                unescape_tokens(tokens, map) @@ -376,7 +395,9 @@

                                                Examples

                                                Unescape the given tokens according to the given map. Check unescape_tokens/1 and unescaped/2 for more information.

                                                - Source + + Source +
                                                @@ -391,7 +412,9 @@

                                                Macros

                                                Returns a list of binary operators. This is available as a macro so it can be used in guard clauses.

                                                - Source + + Source +

                                                unary_ops() @@ -399,7 +422,9 @@

                                                Macros

                                                Returns a list of unary operators. This is available as a macro so it can be used in guard clauses.

                                                - Source + + Source +
                                                diff --git a/docs/master/MatchError.html b/docs/master/MatchError.html index 47a8fc5c6..7b131b744 100644 --- a/docs/master/MatchError.html +++ b/docs/master/MatchError.html @@ -47,7 +47,7 @@

                                                Fields (and defaults)

                                                -

                                                Functions summary

                                                +

                                                Functions summary

                                                • @@ -70,7 +70,9 @@

                                                  Functions

                                                  message(exception)

                                                  - Source + + Source + diff --git a/docs/master/Mix.Deps.html b/docs/master/Mix.Deps.html index 018965bc1..64a247905 100644 --- a/docs/master/Mix.Deps.html +++ b/docs/master/Mix.Deps.html @@ -39,7 +39,7 @@

                                                  -

                                                  Functions summary

                                                  +

                                                  Functions summary

                                                  • @@ -113,7 +113,9 @@

                                                    Exceptions

                                                    This function raises an exception in case the developer provides a dependency in the wrong format.

                                                    - Source + + Source +

                                                    all(acc, callback) @@ -121,14 +123,18 @@

                                                    Exceptions

                                                    Returns all dependencies but with a custom callback and accumulator.

                                                    - Source + + Source +

                                                    available?(arg1)

                                                    Check if a dependency is available.

                                                    - Source + + Source +

                                                    by_name!(given) @@ -136,35 +142,45 @@

                                                    Exceptions

                                                    Receives a list of deps names and returns deps records. Raises an error if the dependency does not exist.

                                                    - Source + + Source +

                                                    check_lock(dep, lock)

                                                    Checks the lock for the given dependency and update its status accordingly.

                                                    - Source + + Source +

                                                    format_dep(arg1)

                                                    Format the dependency for printing.

                                                    - Source + + Source +

                                                    format_status(arg1)

                                                    Formats the status of a dependency.

                                                    - Source + + Source +

                                                    ok?(arg1)

                                                    Check if a dependency is ok.

                                                    - Source + + Source +

                                                    out_of_date?(dep) @@ -173,14 +189,18 @@

                                                    Exceptions

                                                    lock status. Therefore, be sure to call check_lock before invoking this function.

                                                    - Source + + Source +

                                                    update(dep)

                                                    Updates the dependency inside the given project.

                                                    - Source + + Source +
                                                    diff --git a/docs/master/Mix.Generator.html b/docs/master/Mix.Generator.html index a0e5e8b34..2298c993e 100644 --- a/docs/master/Mix.Generator.html +++ b/docs/master/Mix.Generator.html @@ -39,7 +39,7 @@

                                                    -

                                                    Functions summary

                                                    +

                                                    Functions summary

                                                    • @@ -56,7 +56,7 @@

                                                      Functions summary

                                                      -

                                                      Macros summary

                                                      +

                                                      Macros summary

                                                      • @@ -88,7 +88,9 @@

                                                        Functions

                                                        Creates a directory if one does not exist yet.

                                                        - Source + + Source +

                                                        create_file(path, contents) @@ -96,7 +98,9 @@

                                                        Functions

                                                        Creates a file with the given contents. If the file already exists, asks for user confirmation.

                                                        - Source + + Source +
                                                        @@ -119,7 +123,9 @@

                                                        Macros

                                                        For more information, check EEx.SmartEngine.

                                                        - Source + + Source +

                                                        embed_text(name, contents) @@ -129,7 +135,9 @@

                                                        Macros

                                                        It will define a private function with the name followed by _text that expects no argument.

                                                        - Source + + Source +

                                                        from_file(path) @@ -141,7 +149,9 @@

                                                        Macros

                                                        embed_template :lib, from_file("../templates/lib.eex")
                                                         
                                                        - Source + + Source + diff --git a/docs/master/Mix.InvalidTaskError.html b/docs/master/Mix.InvalidTaskError.html index 7adf4d5ab..15e4c4e1a 100644 --- a/docs/master/Mix.InvalidTaskError.html +++ b/docs/master/Mix.InvalidTaskError.html @@ -53,7 +53,7 @@

                                                        Fields (and defaults)

                                                        -

                                                        Functions summary

                                                        +

                                                        Functions summary

                                                        • @@ -76,7 +76,9 @@

                                                          Functions

                                                          message(exception)

                                                          - Source + + Source + diff --git a/docs/master/Mix.Local.html b/docs/master/Mix.Local.html index 91432f176..57d56bb0a 100644 --- a/docs/master/Mix.Local.html +++ b/docs/master/Mix.Local.html @@ -39,7 +39,7 @@

                                                          -

                                                          Functions summary

                                                          +

                                                          Functions summary

                                                          • @@ -73,21 +73,27 @@

                                                            Functions

                                                            Returns all tasks modules in .mix/tasks.

                                                            - Source + + Source +

                                                            append_tasks()

                                                            Append local tasks path into Erlang code path.

                                                            - Source + + Source +

                                                            tasks_path()

                                                            The path for local tasks.

                                                            - Source + + Source +
                                                            diff --git a/docs/master/Mix.NoTaskError.html b/docs/master/Mix.NoTaskError.html index 87c96a1e2..bc60525c6 100644 --- a/docs/master/Mix.NoTaskError.html +++ b/docs/master/Mix.NoTaskError.html @@ -53,7 +53,7 @@

                                                            Fields (and defaults)

                                                            -

                                                            Functions summary

                                                            +

                                                            Functions summary

                                                            • @@ -76,7 +76,9 @@

                                                              Functions

                                                              message(exception)

                                                              - Source + + Source + diff --git a/docs/master/Mix.OutOfDateDepsError.html b/docs/master/Mix.OutOfDateDepsError.html index a4afa25c4..4e8977731 100644 --- a/docs/master/Mix.OutOfDateDepsError.html +++ b/docs/master/Mix.OutOfDateDepsError.html @@ -53,7 +53,7 @@

                                                              Fields (and defaults)

                                                              -

                                                              Functions summary

                                                              +

                                                              Functions summary

                                                              • @@ -76,7 +76,9 @@

                                                                Functions

                                                                message(exception)

                                                                - Source + + Source + diff --git a/docs/master/Mix.Project.html b/docs/master/Mix.Project.html index 8ddfbadb8..9b747e353 100644 --- a/docs/master/Mix.Project.html +++ b/docs/master/Mix.Project.html @@ -68,7 +68,7 @@

                                                                Examples

                                                                -

                                                                Functions summary

                                                                +

                                                                Functions summary

                                                                • @@ -113,14 +113,18 @@

                                                                  Functions

                                                                  Returns the project configuration already considering the current environment.

                                                                  - Source + + Source +

                                                                  config_files()

                                                                  Returns a list of project config files (mix.exs and mix.lock).

                                                                  - Source + + Source +

                                                                  get() @@ -135,14 +139,18 @@

                                                                  Functions

                                                                  Returns nil if no project.

                                                                  - Source + + Source +

                                                                  get!()

                                                                  Same as get/0 but raises an exception if no project.

                                                                  - Source + + Source +

                                                                  refresh() @@ -150,7 +158,9 @@

                                                                  Functions

                                                                  Refresh the project configuration. Usually required when the environment changes during a task.

                                                                  - Source + + Source +
                                                                  diff --git a/docs/master/Mix.SCM.html b/docs/master/Mix.SCM.html index ead5d3aa9..cfa0ecd0f 100644 --- a/docs/master/Mix.SCM.html +++ b/docs/master/Mix.SCM.html @@ -42,7 +42,7 @@

                                                                  -

                                                                  Functions summary

                                                                  +

                                                                  Functions summary

                                                                  • @@ -66,7 +66,7 @@

                                                                    Functions summary

                                                                    -

                                                                    Callbacks summary

                                                                    +

                                                                    Callbacks summary

                                                                    • @@ -126,21 +126,27 @@

                                                                      Functions

                                                                      Returns all available SCM.

                                                                      - Source + + Source +

                                                                      register(mod)

                                                                      Register the scm repository with the given key and mod.

                                                                      - Source + + Source +

                                                                      register_builtin()

                                                                      Register builtin SCMs.

                                                                      - Source + + Source +
                                                                      @@ -156,7 +162,9 @@

                                                                      Callbacks

                                                                      This behavior function should clean the given dependency.

                                                                      - Source + + Source +

                                                                      equals?(opts1 :: opts(), opts2 :: opts()) @@ -165,7 +173,9 @@

                                                                      Callbacks

                                                                      same repository. The options are guaranteed to belong to the same SCM.

                                                                      - Source + + Source +

                                                                      matches_lock?(opts()) @@ -175,7 +185,9 @@

                                                                      Callbacks

                                                                      SCMs do not require a lock, for such, this function can simply return true.

                                                                      - Source + + Source +

                                                                      update(opts()) @@ -189,7 +201,9 @@

                                                                      Callbacks

                                                                      It must return the current lock.

                                                                      - Source + + Source +

                                                                      checkout(opts()) @@ -201,7 +215,9 @@

                                                                      Callbacks

                                                                      no lock is given and the repository can be checked out to the latest version.

                                                                      - Source + + Source +

                                                                      checked_out?(opts()) @@ -209,7 +225,9 @@

                                                                      Callbacks

                                                                      This behavior function returns a boolean if the dependency is available.

                                                                      - Source + + Source +

                                                                      accepts_options(opts()) @@ -227,7 +245,9 @@

                                                                      Callbacks

                                                                      sense for the Git SCM, it will return an update list of options while other SCMs would simply return nil.

                                                                      - Source + + Source +

                                                                      format_lock(lock()) @@ -235,7 +255,9 @@

                                                                      Callbacks

                                                                      Returns an Elixir term that contains relevant SCM lock information for printing.

                                                                      - Source + + Source +

                                                                      format(opts()) @@ -243,7 +265,9 @@

                                                                      Callbacks

                                                                      Returns an Elixir term that contains relevant SCM information for printing.

                                                                      - Source + + Source +
                                                                      diff --git a/docs/master/Mix.Shell.IO.html b/docs/master/Mix.Shell.IO.html index f74380962..ece26e7a9 100644 --- a/docs/master/Mix.Shell.IO.html +++ b/docs/master/Mix.Shell.IO.html @@ -40,7 +40,7 @@

                                                                      -

                                                                      Functions summary

                                                                      +

                                                                      Functions summary

                                                                      • @@ -80,21 +80,27 @@

                                                                        Functions

                                                                        Executes the given command and prints its output to stdout as it comes.

                                                                        - Source + + Source +

                                                                        error(message)

                                                                        Writes an error message to the shell followed by new line.

                                                                        - Source + + Source +

                                                                        info(message)

                                                                        Writes a message to the shell followed by new line.

                                                                        - Source + + Source +

                                                                        yes?(message) @@ -103,7 +109,9 @@

                                                                        Functions

                                                                        He must press enter or type anything that matches the a "yes" regex %r/^Y(es)?$/i.

                                                                        - Source + + Source + diff --git a/docs/master/Mix.Shell.Process.html b/docs/master/Mix.Shell.Process.html index 51be639b1..65188eed2 100644 --- a/docs/master/Mix.Shell.Process.html +++ b/docs/master/Mix.Shell.Process.html @@ -52,7 +52,7 @@

                                                                        -

                                                                        Functions summary

                                                                        +

                                                                        Functions summary

                                                                        • @@ -97,14 +97,18 @@

                                                                          Functions

                                                                          Executes the given command and fowards its messages to the current process.

                                                                          - Source + + Source +

                                                                          error(message)

                                                                          Simply forwards the message to the current process.

                                                                          - Source + + Source +

                                                                          flush(callback // fn x -> x end) @@ -117,14 +121,18 @@

                                                                          Examples

                                                                          flush IO.inspect(&1)
                                                                           
                                                                          - Source + + Source +

                                                                          info(message)

                                                                          Simply forwards the message to the current process.

                                                                          - Source + + Source +

                                                                          yes?(message) @@ -138,7 +146,9 @@

                                                                          Examples

                                                                          If one does not exist, it will abort since there no shell process input given. Value must be true or false.

                                                                          - Source + + Source + diff --git a/docs/master/Mix.Shell.html b/docs/master/Mix.Shell.html index 9f0220358..5149dc237 100644 --- a/docs/master/Mix.Shell.html +++ b/docs/master/Mix.Shell.html @@ -41,7 +41,7 @@

                                                                          -

                                                                          Functions summary

                                                                          +

                                                                          Functions summary

                                                                          • @@ -55,7 +55,7 @@

                                                                            Functions summary

                                                                            -

                                                                            Callbacks summary

                                                                            +

                                                                            Callbacks summary

                                                                            • @@ -91,7 +91,9 @@

                                                                              Functions

                                                                              An implementation of the command callback that is shared accross different shells.

                                                                              - Source + + Source + @@ -108,28 +110,36 @@

                                                                              Callbacks

                                                                              Executes the given command and returns its exit status.

                                                                              - Source + + Source +

                                                                              yes?(message :: binary())

                                                                              Asks the user for confirmation.

                                                                              - Source + + Source +

                                                                              error(message :: binary())

                                                                              Warns about the given error message.

                                                                              - Source + + Source +

                                                                              info(message :: binary())

                                                                              Informs the given message.

                                                                              - Source + + Source +
                                                                              diff --git a/docs/master/Mix.Task.html b/docs/master/Mix.Task.html index f26ca6d3e..1d804212a 100644 --- a/docs/master/Mix.Task.html +++ b/docs/master/Mix.Task.html @@ -41,7 +41,7 @@

                                                                              -

                                                                              Functions summary

                                                                              +

                                                                              Functions summary

                                                                              • @@ -100,7 +100,7 @@

                                                                                Functions summary

                                                                                -

                                                                                Callbacks summary

                                                                                +

                                                                                Callbacks summary

                                                                                • @@ -121,7 +121,9 @@

                                                                                  Functions

                                                                                  Returns all loaded modules. Modules that were not yet loaded won't show up. Check load_all/0 if you want to preload all tasks.

                                                                                  - Source + + Source +

                                                                                  clear() @@ -129,7 +131,9 @@

                                                                                  Functions

                                                                                  Clears all invoked tasks, allowing them to be reinvoked. Returns an ordset with all the tasks invoked thus far.

                                                                                  - Source + + Source +

                                                                                  get(task) @@ -143,21 +147,27 @@

                                                                                  Exceptions

                                                                                • Mix.InvalidTaskError - raised if the task is not a valid Mix.Task
                                                                                - Source + + Source +

                                                                                hidden?(module)

                                                                                Checks if the task is hidden or not. Returns a boolean.

                                                                                - Source + + Source +

                                                                                load_all()

                                                                                Loads all tasks in all code paths.

                                                                                - Source + + Source +

                                                                                moduledoc(module) @@ -165,14 +175,18 @@

                                                                                Exceptions

                                                                                Gets the moduledoc for the given module. Returns the moduledoc or nil.

                                                                                - Source + + Source +

                                                                                reenable(task)

                                                                                Reenables a given task so it can be executed again down the stack.

                                                                                - Source + + Source +

                                                                                run(task, args // []) @@ -187,7 +201,9 @@

                                                                                Exceptions

                                                                                It may raise an exception if the task was not found or it is invalid. Check get/2 for more information.

                                                                                - Source + + Source +

                                                                                shortdoc(module) @@ -195,14 +211,18 @@

                                                                                Exceptions

                                                                                Gets the shortdoc for the given module. Returns the shortdoc or nil.

                                                                                - Source + + Source +

                                                                                task_name(module)

                                                                                Returns the task name for the given module.

                                                                                - Source + + Source +
                                                                                @@ -219,7 +239,9 @@

                                                                                Callbacks

                                                                                A task needs to implement run which receives a list of command line args.

                                                                                - Source + + Source + diff --git a/docs/master/Mix.Tasks.App.Start.html b/docs/master/Mix.Tasks.App.Start.html index f3ade2d1b..db8f1d39e 100644 --- a/docs/master/Mix.Tasks.App.Start.html +++ b/docs/master/Mix.Tasks.App.Start.html @@ -47,7 +47,7 @@

                                                                                Command line options

                                                                                -

                                                                                Functions summary

                                                                                +

                                                                                Functions summary

                                                                                • @@ -70,7 +70,9 @@

                                                                                  Functions

                                                                                  run(args)

                                                                                  - Source + + Source + diff --git a/docs/master/Mix.Tasks.Clean.html b/docs/master/Mix.Tasks.Clean.html index a874715bb..3b736c4f1 100644 --- a/docs/master/Mix.Tasks.Clean.html +++ b/docs/master/Mix.Tasks.Clean.html @@ -45,7 +45,7 @@

                                                                                  Command line options

                                                                                  -

                                                                                  Functions summary

                                                                                  +

                                                                                  Functions summary

                                                                                  • @@ -68,7 +68,9 @@

                                                                                    Functions

                                                                                    run(args)

                                                                                    - Source + + Source + diff --git a/docs/master/Mix.Tasks.Compile.App.html b/docs/master/Mix.Tasks.Compile.App.html index ed6f67653..3ceecb851 100644 --- a/docs/master/Mix.Tasks.Compile.App.html +++ b/docs/master/Mix.Tasks.Compile.App.html @@ -63,7 +63,7 @@

                                                                                    Configuration

                                                                                    -

                                                                                    Functions summary

                                                                                    +

                                                                                    Functions summary

                                                                                    • @@ -86,7 +86,9 @@

                                                                                      Functions

                                                                                      run(args)

                                                                                      - Source + + Source + diff --git a/docs/master/Mix.Tasks.Compile.Elixir.html b/docs/master/Mix.Tasks.Compile.Elixir.html index 2c19174c2..dd474a0b5 100644 --- a/docs/master/Mix.Tasks.Compile.Elixir.html +++ b/docs/master/Mix.Tasks.Compile.Elixir.html @@ -89,7 +89,7 @@

                                                                                      Configuration

                                                                                      -

                                                                                      Functions summary

                                                                                      +

                                                                                      Functions summary

                                                                                      • @@ -112,7 +112,9 @@

                                                                                        Functions

                                                                                        run(args)

                                                                                        - Source + + Source + diff --git a/docs/master/Mix.Tasks.Compile.Erlang.html b/docs/master/Mix.Tasks.Compile.Erlang.html index 47a748afd..eea51104f 100644 --- a/docs/master/Mix.Tasks.Compile.Erlang.html +++ b/docs/master/Mix.Tasks.Compile.Erlang.html @@ -79,7 +79,7 @@

                                                                                        Configuration

                                                                                        -

                                                                                        Functions summary

                                                                                        +

                                                                                        Functions summary

                                                                                        • @@ -122,20 +122,26 @@

                                                                                          Functions

                                                                                          try to find matching pairs in dir2 with ext2 extension.

                                                                                          - Source + + Source +

                                                                                          interpret_result(file, result, ext // "")

                                                                                          Interprets compilation results and prints them to the console.

                                                                                          - Source + + Source +

                                                                                          run(args)

                                                                                          - Source + + Source +

                                                                                          to_erl_file(file) @@ -143,7 +149,9 @@

                                                                                          Functions

                                                                                          Converts the given file to a format accepted by Erlang compilation tools.

                                                                                          - Source + + Source +
                                                                                          diff --git a/docs/master/Mix.Tasks.Compile.Leex.html b/docs/master/Mix.Tasks.Compile.Leex.html index cf89b1605..2c92de341 100644 --- a/docs/master/Mix.Tasks.Compile.Leex.html +++ b/docs/master/Mix.Tasks.Compile.Leex.html @@ -63,7 +63,7 @@

                                                                                          Configuration

                                                                                          -

                                                                                          Functions summary

                                                                                          +

                                                                                          Functions summary

                                                                                          • @@ -86,7 +86,9 @@

                                                                                            Functions

                                                                                            run(args)

                                                                                            - Source + + Source + diff --git a/docs/master/Mix.Tasks.Compile.Yecc.html b/docs/master/Mix.Tasks.Compile.Yecc.html index 0b9b57518..5c4cad9a0 100644 --- a/docs/master/Mix.Tasks.Compile.Yecc.html +++ b/docs/master/Mix.Tasks.Compile.Yecc.html @@ -63,7 +63,7 @@

                                                                                            Configuration

                                                                                            -

                                                                                            Functions summary

                                                                                            +

                                                                                            Functions summary

                                                                                            • @@ -86,7 +86,9 @@

                                                                                              Functions

                                                                                              run(args)

                                                                                              - Source + + Source + diff --git a/docs/master/Mix.Tasks.Compile.html b/docs/master/Mix.Tasks.Compile.html index 536d16f41..f768cc94a 100644 --- a/docs/master/Mix.Tasks.Compile.html +++ b/docs/master/Mix.Tasks.Compile.html @@ -73,7 +73,7 @@

                                                                                              Common configuration

                                                                                              -

                                                                                              Functions summary

                                                                                              +

                                                                                              Functions summary

                                                                                              • @@ -96,7 +96,9 @@

                                                                                                Functions

                                                                                                run(args)

                                                                                                - Source + + Source + diff --git a/docs/master/Mix.Tasks.Deps.Check.html b/docs/master/Mix.Tasks.Deps.Check.html index fd6055c8d..f1ba5b0da 100644 --- a/docs/master/Mix.Tasks.Deps.Check.html +++ b/docs/master/Mix.Tasks.Deps.Check.html @@ -43,7 +43,7 @@

                                                                                                -

                                                                                                Functions summary

                                                                                                +

                                                                                                Functions summary

                                                                                                • @@ -66,7 +66,9 @@

                                                                                                  Functions

                                                                                                  run(_)

                                                                                                  - Source + + Source + diff --git a/docs/master/Mix.Tasks.Deps.Clean.html b/docs/master/Mix.Tasks.Deps.Clean.html index f6938f846..e412ab513 100644 --- a/docs/master/Mix.Tasks.Deps.Clean.html +++ b/docs/master/Mix.Tasks.Deps.Clean.html @@ -43,7 +43,7 @@

                                                                                                  -

                                                                                                  Functions summary

                                                                                                  +

                                                                                                  Functions summary

                                                                                                  • @@ -66,7 +66,9 @@

                                                                                                    Functions

                                                                                                    run(args)

                                                                                                    - Source + + Source + diff --git a/docs/master/Mix.Tasks.Deps.Compile.html b/docs/master/Mix.Tasks.Deps.Compile.html index 820af8949..d73f9cf5c 100644 --- a/docs/master/Mix.Tasks.Deps.Compile.html +++ b/docs/master/Mix.Tasks.Deps.Compile.html @@ -57,7 +57,7 @@

                                                                                                    -

                                                                                                    Functions summary

                                                                                                    +

                                                                                                    Functions summary

                                                                                                    • @@ -80,7 +80,9 @@

                                                                                                      Functions

                                                                                                      run(args)

                                                                                                      - Source + + Source + diff --git a/docs/master/Mix.Tasks.Deps.Get.html b/docs/master/Mix.Tasks.Deps.Get.html index 917dd743b..ec3a23176 100644 --- a/docs/master/Mix.Tasks.Deps.Get.html +++ b/docs/master/Mix.Tasks.Deps.Get.html @@ -46,7 +46,7 @@

                                                                                                      Command line options

                                                                                                      -

                                                                                                      Functions summary

                                                                                                      +

                                                                                                      Functions summary

                                                                                                      • @@ -69,7 +69,9 @@

                                                                                                        Functions

                                                                                                        run(args)

                                                                                                        - Source + + Source + diff --git a/docs/master/Mix.Tasks.Deps.Loadpaths.html b/docs/master/Mix.Tasks.Deps.Loadpaths.html index 7977a449c..a127bb3c8 100644 --- a/docs/master/Mix.Tasks.Deps.Loadpaths.html +++ b/docs/master/Mix.Tasks.Deps.Loadpaths.html @@ -40,7 +40,7 @@

                                                                                                        -

                                                                                                        Functions summary

                                                                                                        +

                                                                                                        Functions summary

                                                                                                        • @@ -63,7 +63,9 @@

                                                                                                          Functions

                                                                                                          run(args)

                                                                                                          - Source + + Source + diff --git a/docs/master/Mix.Tasks.Deps.Unlock.html b/docs/master/Mix.Tasks.Deps.Unlock.html index e3d24b718..c8ec9f6e9 100644 --- a/docs/master/Mix.Tasks.Deps.Unlock.html +++ b/docs/master/Mix.Tasks.Deps.Unlock.html @@ -40,7 +40,7 @@

                                                                                                          -

                                                                                                          Functions summary

                                                                                                          +

                                                                                                          Functions summary

                                                                                                          • @@ -63,7 +63,9 @@

                                                                                                            Functions

                                                                                                            run(args)

                                                                                                            - Source + + Source + diff --git a/docs/master/Mix.Tasks.Deps.Update.html b/docs/master/Mix.Tasks.Deps.Update.html index ee29f6e99..5e741da03 100644 --- a/docs/master/Mix.Tasks.Deps.Update.html +++ b/docs/master/Mix.Tasks.Deps.Update.html @@ -49,7 +49,7 @@

                                                                                                            Command line options

                                                                                                            -

                                                                                                            Functions summary

                                                                                                            +

                                                                                                            Functions summary

                                                                                                            • @@ -72,7 +72,9 @@

                                                                                                              Functions

                                                                                                              run(args)

                                                                                                              - Source + + Source + diff --git a/docs/master/Mix.Tasks.Deps.html b/docs/master/Mix.Tasks.Deps.html index c0733bdea..62059709f 100644 --- a/docs/master/Mix.Tasks.Deps.html +++ b/docs/master/Mix.Tasks.Deps.html @@ -46,7 +46,7 @@

                                                                                                              -

                                                                                                              Functions summary

                                                                                                              +

                                                                                                              Functions summary

                                                                                                              • @@ -69,7 +69,9 @@

                                                                                                                Functions

                                                                                                                run(_)

                                                                                                                - Source + + Source + diff --git a/docs/master/Mix.Tasks.Do.html b/docs/master/Mix.Tasks.Do.html index 2c6b906fe..78c9ca75f 100644 --- a/docs/master/Mix.Tasks.Do.html +++ b/docs/master/Mix.Tasks.Do.html @@ -47,7 +47,7 @@

                                                                                                                Examples

                                                                                                                -

                                                                                                                Functions summary

                                                                                                                +

                                                                                                                Functions summary

                                                                                                                • @@ -70,7 +70,9 @@

                                                                                                                  Functions

                                                                                                                  run(args)

                                                                                                                  - Source + + Source + diff --git a/docs/master/Mix.Tasks.Escriptize.html b/docs/master/Mix.Tasks.Escriptize.html index 53ba699f2..bfefce2b3 100644 --- a/docs/master/Mix.Tasks.Escriptize.html +++ b/docs/master/Mix.Tasks.Escriptize.html @@ -70,7 +70,7 @@

                                                                                                                  Configuration

                                                                                                                  -

                                                                                                                  Functions summary

                                                                                                                  +

                                                                                                                  Functions summary

                                                                                                                  • @@ -93,7 +93,9 @@

                                                                                                                    Functions

                                                                                                                    run(args)

                                                                                                                    - Source + + Source + diff --git a/docs/master/Mix.Tasks.Help.html b/docs/master/Mix.Tasks.Help.html index 7dc5a8610..6fa36d35c 100644 --- a/docs/master/Mix.Tasks.Help.html +++ b/docs/master/Mix.Tasks.Help.html @@ -47,7 +47,7 @@

                                                                                                                    Arguments

                                                                                                                    -

                                                                                                                    Functions summary

                                                                                                                    +

                                                                                                                    Functions summary

                                                                                                                    • @@ -70,7 +70,9 @@

                                                                                                                      Functions

                                                                                                                      run(list1)

                                                                                                                      - Source + + Source + diff --git a/docs/master/Mix.Tasks.Loadpaths.html b/docs/master/Mix.Tasks.Loadpaths.html index 3b0d5ab4a..d36615647 100644 --- a/docs/master/Mix.Tasks.Loadpaths.html +++ b/docs/master/Mix.Tasks.Loadpaths.html @@ -49,7 +49,7 @@

                                                                                                                      Configuration

                                                                                                                      -

                                                                                                                      Functions summary

                                                                                                                      +

                                                                                                                      Functions summary

                                                                                                                      • @@ -72,7 +72,9 @@

                                                                                                                        Functions

                                                                                                                        run(args)

                                                                                                                        - Source + + Source + diff --git a/docs/master/Mix.Tasks.Local.Install.html b/docs/master/Mix.Tasks.Local.Install.html index 627f47f26..83eec4cc6 100644 --- a/docs/master/Mix.Tasks.Local.Install.html +++ b/docs/master/Mix.Tasks.Local.Install.html @@ -50,7 +50,7 @@

                                                                                                                        -

                                                                                                                        Functions summary

                                                                                                                        +

                                                                                                                        Functions summary

                                                                                                                        • @@ -73,7 +73,9 @@

                                                                                                                          Functions

                                                                                                                          run(argv)

                                                                                                                          - Source + + Source + diff --git a/docs/master/Mix.Tasks.Local.Uninstall.html b/docs/master/Mix.Tasks.Local.Uninstall.html index 1e6ffc217..12aef7faf 100644 --- a/docs/master/Mix.Tasks.Local.Uninstall.html +++ b/docs/master/Mix.Tasks.Local.Uninstall.html @@ -42,7 +42,7 @@

                                                                                                                          -

                                                                                                                          Functions summary

                                                                                                                          +

                                                                                                                          Functions summary

                                                                                                                          • @@ -65,7 +65,9 @@

                                                                                                                            Functions

                                                                                                                            run(argv)

                                                                                                                            - Source + + Source + diff --git a/docs/master/Mix.Tasks.Local.html b/docs/master/Mix.Tasks.Local.html index f9eee6719..09396ced5 100644 --- a/docs/master/Mix.Tasks.Local.html +++ b/docs/master/Mix.Tasks.Local.html @@ -39,7 +39,7 @@

                                                                                                                            -

                                                                                                                            Functions summary

                                                                                                                            +

                                                                                                                            Functions summary

                                                                                                                            • @@ -62,7 +62,9 @@

                                                                                                                              Functions

                                                                                                                              run(list1)

                                                                                                                              - Source + + Source + diff --git a/docs/master/Mix.Tasks.New.html b/docs/master/Mix.Tasks.New.html index 82532352c..cf968fa29 100644 --- a/docs/master/Mix.Tasks.New.html +++ b/docs/master/Mix.Tasks.New.html @@ -67,7 +67,7 @@

                                                                                                                              Examples

                                                                                                                              -

                                                                                                                              Functions summary

                                                                                                                              +

                                                                                                                              Functions summary

                                                                                                                              • @@ -90,7 +90,9 @@

                                                                                                                                Functions

                                                                                                                                run(argv)

                                                                                                                                - Source + + Source + diff --git a/docs/master/Mix.Tasks.Run.html b/docs/master/Mix.Tasks.Run.html index b06c93466..a74524ef8 100644 --- a/docs/master/Mix.Tasks.Run.html +++ b/docs/master/Mix.Tasks.Run.html @@ -58,7 +58,7 @@

                                                                                                                                Examples

                                                                                                                                -

                                                                                                                                Functions summary

                                                                                                                                +

                                                                                                                                Functions summary

                                                                                                                                • @@ -81,7 +81,9 @@

                                                                                                                                  Functions

                                                                                                                                  run(args)

                                                                                                                                  - Source + + Source + diff --git a/docs/master/Mix.Tasks.Test.html b/docs/master/Mix.Tasks.Test.html index 16f8a4341..a55052d07 100644 --- a/docs/master/Mix.Tasks.Test.html +++ b/docs/master/Mix.Tasks.Test.html @@ -42,6 +42,7 @@

                                                                                                                                  Command line options

                                                                                                                                    +
                                                                                                                                  • --cover - the directory to include coverage results;
                                                                                                                                  • --force - forces compilation regardless of module times;
                                                                                                                                  • --quick, -q - only compile files that changed;
                                                                                                                                  • --no-compile - do not compile even if files require compilation;
                                                                                                                                  • @@ -57,6 +58,8 @@

                                                                                                                                    Configuration

                                                                                                                                    Defaults to *_test.exs.

                                                                                                                                  • :test_helper - a file that sets up whatever is necessary for testing. Defaults to test/test_helper.exs.

                                                                                                                                  • +
                                                                                                                                  • :test_coverage - the directory to include test coverage results. +Defaults to nil.

                                                                                                                                  @@ -69,7 +72,7 @@

                                                                                                                                  Configuration

                                                                                                                                  -

                                                                                                                                  Functions summary

                                                                                                                                  +

                                                                                                                                  Functions summary

                                                                                                                                  • @@ -92,7 +95,9 @@

                                                                                                                                    Functions

                                                                                                                                    run(args)

                                                                                                                                    - Source + + Source + diff --git a/docs/master/Mix.Utils.html b/docs/master/Mix.Utils.html index 24f0119a7..870687313 100644 --- a/docs/master/Mix.Utils.html +++ b/docs/master/Mix.Utils.html @@ -50,7 +50,7 @@

                                                                                                                                    Conversions

                                                                                                                                    -

                                                                                                                                    Functions summary

                                                                                                                                    +

                                                                                                                                    Functions summary

                                                                                                                                    • @@ -139,7 +139,9 @@

                                                                                                                                      Examples

                                                                                                                                      Mix.Utils.camelize "foo_bar" #=> "FooBar"
                                                                                                                                       
                                                                                                                                      - Source + + Source +

                                                                                                                                      command_to_module(command, at // Elixir) @@ -157,7 +159,9 @@

                                                                                                                                      Examples

                                                                                                                                      #=> { :module, Mix.Tasks.Compile }
                                          - Source + + Source +

                                          command_to_module_name(s) @@ -170,7 +174,9 @@

                                          Examples

                                          #=> "Compile.Elixir"
                          - Source + + Source +

                          config_merge(old, new) @@ -178,7 +184,9 @@

                          Examples

                          Merges two configs recursively, merging keyword lists and concatenating normal lists.

                          - Source + + Source +

                          extract_files(paths, exts_or_pattern) @@ -189,14 +197,18 @@

                          Examples

                          recursively searching for the given extensions or the given pattern. When looking up directories, files starting with "." are ignored.

                          - Source + + Source +

                          extract_stale(sources, targets)

                          Extract all stale sources compared to the given targets.

                          - Source + + Source +

                          mix_home() @@ -204,7 +216,9 @@

                          Examples

                          Gets the mix home. It defaults to ~/.mix unless the MIX_HOME environment variable is set.

                          - Source + + Source +

                          module_name_to_command(module, nesting // 0) @@ -222,7 +236,9 @@

                          Examples

                          #=> "compile.elixir"
                          - Source + + Source +

                          preserving_mtime(path, fun) @@ -230,7 +246,9 @@

                          Examples

                          Executes a function but preserves the given path mtime properties.

                          - Source + + Source +

                          relative_to_cwd(path) @@ -238,14 +256,18 @@

                          Examples

                          Returns the given path string relative to the current working directory.

                          - Source + + Source +

                          source(module)

                          Gets the source location of a module as a binary.

                          - Source + + Source +

                          stale?(sources, targets) @@ -253,7 +275,9 @@

                          Examples

                          Returns true if any of the sources are stale compared to the given target.

                          - Source + + Source +

                          underscore(atom) @@ -277,7 +301,9 @@

                          Examples

                          Mix.Utils.camelize "sap_example" #=> "SapExample"
                          - Source + + Source + diff --git a/docs/master/Mix.html b/docs/master/Mix.html index bc1a279b6..0a33689f7 100644 --- a/docs/master/Mix.html +++ b/docs/master/Mix.html @@ -47,7 +47,7 @@

                          -

                          Functions summary

                          +

                          Functions summary

                          • @@ -101,7 +101,9 @@

                            Functions

                            Returns the mix environment.

                            - Source + + Source +

                            env(env) @@ -109,7 +111,9 @@

                            Functions

                            Changes the current mix env. Project configuration loaded per environment is not going to be reloaded.

                            - Source + + Source +

                            loadpaths() @@ -117,7 +121,9 @@

                            Functions

                            Starts mix and loads the project and dependencies into one step. Useful when invoking mix from an external tool.

                            - Source + + Source +

                            project() @@ -127,7 +133,9 @@

                            Functions

                            return an empty keyword list. This allows many mix tasks to work without a need for an underlying project.

                            - Source + + Source +

                            shell() @@ -139,20 +147,26 @@

                            Functions

                            allow developers to use a test shell, that simply sends the messages to the current process.

                            - Source + + Source +

                            shell(shell)

                            Sets the current shell.

                            - Source + + Source +

                            stop(_state)

                            - Source + + Source +
                            diff --git a/docs/master/Module.html b/docs/master/Module.html index b845183c1..be531269a 100644 --- a/docs/master/Module.html +++ b/docs/master/Module.html @@ -46,7 +46,7 @@

                            -

                            Functions summary

                            +

                            Functions summary

                            • @@ -177,7 +177,9 @@

                              Examples

                              end - Source + + Source +

                              concat(list) @@ -187,12 +189,17 @@

                              Examples

                              Examples

                              -
                              Module.concat [Foo, Bar]    #=> Foo.Bar
                              -Module.concat [Foo, "Bar"]  #=> Foo.Bar
                              -Module.concat [Foo, 'Bar']  #=> Foo.Bar
                              +
                              iex> Module.concat [Foo, Bar]
                              +Foo.Bar
                              +iex> Module.concat [Foo, "Bar"]
                              +Foo.Bar
                              +iex> Module.concat [Foo, 'Bar']
                              +Foo.Bar
                               
                              - Source + + Source +

                              concat(left, right) @@ -202,12 +209,17 @@

                              Examples

                              Examples

                              -
                              Module.concat Foo, Bar    #=> Foo.Bar
                              -Module.concat Foo, "Bar"  #=> Foo.Bar
                              -Module.concat Foo, 'Bar'  #=> Foo.Bar
                              +
                              iex> Module.concat Foo, Bar
                              +Foo.Bar
                              +iex> Module.concat Foo, "Bar"
                              +Foo.Bar
                              +iex> Module.concat Foo, 'Bar'
                              +Foo.Bar
                               
                              - Source + + Source +

                              create(module, quoted, opts // []) @@ -241,7 +253,9 @@

                              Differences with defmodule

                              when defining the module, while defmodule automatically shares the same environment.

                              - Source + + Source +

                              defines?(module, tuple) @@ -258,7 +272,9 @@

                              Examples

                              end
                              - Source + + Source +

                              defines?(module, tuple, kind) @@ -276,7 +292,9 @@

                              Examples

                              end
                              - Source + + Source +

                              definitions_in(module) @@ -291,7 +309,9 @@

                              Examples

                              end
                              - Source + + Source +

                              definitions_in(module, kind) @@ -308,7 +328,9 @@

                              Examples

                              end
                              - Source + + Source +

                              delete_attribute(module, key) @@ -323,7 +345,9 @@

                              Examples

                              end
                              - Source + + Source +

                              eval_quoted(module, quoted, binding // [], opts // []) @@ -356,7 +380,9 @@

                              Examples

                              Foo.sum(1, 2) #=> 3
                              - Source + + Source +

                              get_attribute(module, key) @@ -377,7 +403,9 @@

                              Examples

                              end
                              - Source + + Source +

                              make_overridable(module, tuples) @@ -386,7 +414,9 @@

                              Examples

                              An overridable function is lazily defined, allowing a developer to customize it.

                              - Source + + Source +

                              open?(module) @@ -394,14 +424,18 @@

                              Examples

                              Check if a module is open, i.e. it is currently being defined and its attributes and functions can be modified.

                              - Source + + Source +

                              overridable?(module, tuple)

                              Returns true if the given tuple in module is marked as overridable.

                              - Source + + Source +

                              put_attribute(module, key, value) @@ -417,7 +451,9 @@

                              Examples

                              end
                              - Source + + Source +

                              register_attribute(module, new, opts // []) @@ -432,7 +468,8 @@

                              Options

                              • :accumulate - Several calls to the same attribute will -accumulate instead of override the previous one;

                              • +accumulate instead of override the previous one. New attributes +are always added to the top of the accumulated list.

                              • :persist - The attribute will be persisted in the Erlang Abstract Format. Useful when interfacing with Erlang libraries.

                              @@ -454,7 +491,9 @@

                              Examples

                              end
                              - Source + + Source +

                              safe_concat(list) @@ -466,14 +505,16 @@

                              Examples

                              Examples

                              -
                              Module.safe_concat [Unknown, Module]
                              -#=> ArgumentError
                              +
                              iex> Module.safe_concat [Unknown, Module]
                              +** (ArgumentError) argument error
                               
                              -Module.safe_concat [List, Chars]
                              -#=> List.Chars
                              +iex> Module.safe_concat [List, Chars]
                              +List.Chars
                               
                              - Source + + Source +

                              safe_concat(left, right) @@ -485,14 +526,16 @@

                              Examples

                              Examples

                              -
                              Module.safe_concat Unknown, Module
                              -#=> ArgumentError
                              +
                              iex> Module.safe_concat Unknown, Module
                              +** (ArgumentError) argument error
                               
                              -Module.safe_concat List, Chars
                              -#=> List.Chars
                              +iex> Module.safe_concat List, Chars
                              +List.Chars
                               
                              - Source + + Source +

                              split(module) @@ -505,14 +548,18 @@

                              Examples

                              #=> ["Very", "Long", "Module", "Name", "And", "Even", "Longer"]
                              - Source + + Source +

                              to_binary(module)

                              Convert a module name to binary without the Elixir prefix.

                              - Source + + Source +
                              diff --git a/docs/master/Node.html b/docs/master/Node.html index 6e78bc0c7..a65dc48d5 100644 --- a/docs/master/Node.html +++ b/docs/master/Node.html @@ -39,7 +39,7 @@

                              -

                              Functions summary

                              +

                              Functions summary

                              • @@ -129,7 +129,9 @@

                                Functions

                                Returns true if the local node is alive; that is, if the node can be part of a distributed system. Otherwise, it returns false.

                                - Source + + Source +

                                connect(node) @@ -140,7 +142,9 @@

                                Functions

                                See http://erlang.org/doc/man/net_kernel.html#connect_node-1 for more info.

                                - Source + + Source +

                                disconnect(node) @@ -152,7 +156,9 @@

                                Functions

                                See http://www.erlang.org/doc/man/erlang.html#disconnect_node-1 for more info.

                                - Source + + Source +

                                list() @@ -160,7 +166,9 @@

                                Functions

                                Returns a list of all visible nodes in the system, excluding the local node. Same as list(visible).

                                - Source + + Source +

                                list(args) @@ -171,7 +179,9 @@

                                Functions

                                See http://www.erlang.org/doc/man/erlang.html#nodes-1 for more info.

                                - Source + + Source +

                                monitor(node, flag) @@ -181,7 +191,9 @@

                                Functions

                                See http://www.erlang.org/doc/man/erlang.html#monitor_node-2 for more info.

                                - Source + + Source +

                                monitor(node, flag, options) @@ -191,14 +203,18 @@

                                Functions

                                See http://www.erlang.org/doc/man/erlang.html#monitor_node-3 for more info.

                                - Source + + Source +

                                self()

                                Returns the current node. It returns the same as the built-in node().

                                - Source + + Source +

                                spawn(node, fun) @@ -209,7 +225,9 @@

                                Functions

                                Check http://www.erlang.org/doc/man/erlang.html#spawn-2 for the list of available options.

                                - Source + + Source +

                                spawn(node, fun, opts) @@ -220,7 +238,9 @@

                                Functions

                                Check http://www.erlang.org/doc/man/erlang.html#spawn_opt-3 for the list of available options.

                                - Source + + Source +

                                spawn(node, module, fun, args) @@ -232,7 +252,9 @@

                                Functions

                                Check http://www.erlang.org/doc/man/erlang.html#spawn-4 for the list of available options.

                                - Source + + Source +

                                spawn(node, module, fun, args, opts) @@ -244,7 +266,9 @@

                                Functions

                                Check http://www.erlang.org/doc/man/erlang.html#spawn_opt-5 for the list of available options.

                                - Source + + Source +

                                spawn_link(node, fun) @@ -255,7 +279,9 @@

                                Functions

                                (and due to the link, an exit signal with exit reason :noconnection will be received).

                                - Source + + Source +

                                spawn_link(node, module, fun, args) @@ -266,7 +292,9 @@

                                Functions

                                pid is returned (and due to the link, an exit signal with exit reason :noconnection will be received).

                                - Source + + Source + diff --git a/docs/master/OptionParser.html b/docs/master/OptionParser.html index ea1916d02..d4d34dca4 100644 --- a/docs/master/OptionParser.html +++ b/docs/master/OptionParser.html @@ -34,7 +34,7 @@

                                -

                                Functions summary

                                +

                                Functions summary

                                • @@ -66,22 +66,22 @@

                                  Functions

                                  Examples

                                  -
                                  OptionParser.parse(["--debug"])
                                  -#=> { [debug: true], [] }
                                  +
                                  iex> OptionParser.parse(["--debug"])
                                  +{ [debug: true], [] }
                                   
                                  -OptionParser.parse(["--source", "lib"])
                                  -#=> { [source: "lib"], [] }
                                  +iex> OptionParser.parse(["--source", "lib"])
                                  +{ [source: "lib"], [] }
                                   
                                  -OptionParser.parse(["--source", "lib", "test/enum_test.exs", "--verbose"])
                                  -#=> { [source: "lib", verbose: true], ["test/enum_test.exs"] }
                                  +iex> OptionParser.parse(["--source", "lib", "test/enum_test.exs", "--verbose"])
                                  +{ [source: "lib", verbose: true], ["test/enum_test.exs"] }
                                   

                                  Aliases

                                  A set of aliases can be given as second argument:

                                  -
                                  OptionParser.parse(["-d"], aliases: [d: :debug])
                                  -#=> { [debug: true], [] }
                                  +
                                  iex> OptionParser.parse(["-d"], aliases: [d: :debug])
                                  +{ [debug: true], [] }
                                   

                                  Switches

                                  @@ -106,11 +106,11 @@

                                  Switches

                                  Examples:

                                  -
                                  OptionParser.parse(["--unlock path/to/file"], switches: [unlock: :boolean])
                                  -#=> { [unlock: true], ["path/to/file"] }
                                  +
                                  iex> OptionParser.parse(["--unlock", "path/to/file"], switches: [unlock: :boolean])
                                  +{ [unlock: true], ["path/to/file"] }
                                   
                                  -OptionParser.parse(["--unlock false path/to/file"], switches: [unlock: :boolean])
                                  -#=> { [unlock: false], ["path/to/file"] }
                                  +iex> OptionParser.parse(["--unlock", "false", "path/to/file"], switches: [unlock: :boolean])
                                  +{ [unlock: false], ["path/to/file"] }
                                   

                                  Negation switches

                                  @@ -118,11 +118,13 @@

                                  Negation switches

                                  Any switches starting with --no- are always considered to be booleans and never parse the next value:

                                  -
                                  OptionParser.parse(["--no-op path/to/file"])
                                  -#=> { [no_op: true], ["path/to/file"] }
                                  +
                                  iex> OptionParser.parse(["--no-op", "path/to/file"])
                                  +{ [no_op: true], ["path/to/file"] }
                                   
                                  - Source + + Source +

                                  parse_head(argv, opts // []) @@ -134,11 +136,13 @@

                                  Negation switches

                                  Example

                                  -
                                  OptionParser.parse_head(["--source", "lib", "test/enum_test.exs", "--verbose"])
                                  -#=> { [source: "lib"], ["test/enum_test.exs", "--verbose"] }
                                  +
                                  iex> OptionParser.parse_head(["--source", "lib", "test/enum_test.exs", "--verbose"])
                                  +{ [source: "lib"], ["test/enum_test.exs", "--verbose"] }
                                   
                                  - Source + + Source + diff --git a/docs/master/Path.html b/docs/master/Path.html index 3f279561a..30c25447e 100644 --- a/docs/master/Path.html +++ b/docs/master/Path.html @@ -48,7 +48,7 @@

                                  -

                                  Functions summary

                                  +

                                  Functions summary

                                  • @@ -171,7 +171,9 @@

                                    Windows

                                    "D:/usr/local/../x"
                                  - Source + + Source +

                                  absname(path, relative_to) @@ -185,14 +187,16 @@

                                  Windows

                                  Examples

                                  -
                                  Path.absname("foo", "bar")
                                  -#=> "bar/foo"
                                  +
                                  iex> Path.absname("foo", "bar")
                                  +"bar/foo"
                                   
                                  -Path.absname("../x", "bar")
                                  -#=> "bar/../x"
                                  +iex> Path.absname("../x", "bar")
                                  +"bar/../x"
                                   
                                  - Source + + Source +

                                  basename(path) @@ -202,17 +206,19 @@

                                  Examples

                                  Examples

                                  -
                                  Path.basename("foo")
                                  -#=> "foo"
                                  +
                                  iex> Path.basename("foo")
                                  +"foo"
                                   
                                  -Path.basename("foo/bar")
                                  -#=> "bar"
                                  +iex> Path.basename("foo/bar")
                                  +"bar"
                                   
                                  -Path.basename("/")
                                  -#=> ""
                                  +iex> Path.basename("/")
                                  +""
                                   
                                  - Source + + Source +

                                  basename(path, extension) @@ -223,15 +229,17 @@

                                  Examples

                                  Examples

                                  -
                                  Path.basename("~/foo/bar.ex", ".ex")
                                  -#=> "bar"
                                  -Path.basename("~/foo/bar.exs", ".ex")
                                  -#=> "bar.exs"
                                  -Path.basename("~/foo/bar.old.ex", ".ex")
                                  -#=> "bar.old"
                                  +
                                  iex> Path.basename("~/foo/bar.ex", ".ex")
                                  +"bar"
                                  +iex> Path.basename("~/foo/bar.exs", ".ex")
                                  +"bar.exs"
                                  +iex> Path.basename("~/foo/bar.old.ex", ".ex")
                                  +"bar.old"
                                   
                                  - Source + + Source +

                                  dirname(path) @@ -244,7 +252,9 @@

                                  Examples

                                  #=> "foo"
                                  - Source + + Source +

                                  expand(path) @@ -254,10 +264,13 @@

                                  Examples

                                  Examples

                                  -
                                  Path.expand("/foo/bar/../bar") == "/foo/bar"
                                  +
                                  iex> Path.expand("/foo/bar/../bar")
                                  +"/foo/bar"
                                   
                                  - Source + + Source +

                                  expand(path, relative_to) @@ -268,11 +281,15 @@

                                  Examples

                                  Examples

                                  -
                                  Path.expand("foo/bar/../bar", "/baz") == "/baz/foo/bar"
                                  -Path.expand("/foo/bar/../bar", "/baz") == "/foo/bar"
                                  +
                                  iex> Path.expand("foo/bar/../bar", "/baz")
                                  +"/baz/foo/bar"
                                  +iex> Path.expand("/foo/bar/../bar", "/baz")
                                  +"/foo/bar"
                                   
                                  - Source + + Source +

                                  extname(path) @@ -281,13 +298,15 @@

                                  Examples

                                  Examples

                                  -
                                  Path.extname("foo.erl")
                                  -#=> ".erl"
                                  -Path.extname("~/foo/bar")
                                  -#=> ""
                                  +
                                  iex> Path.extname("foo.erl")
                                  +".erl"
                                  +iex> Path.extname("~/foo/bar")
                                  +""
                                   
                                  - Source + + Source +

                                  join(list1) @@ -297,15 +316,17 @@

                                  Examples

                                  Examples

                                  -
                                  Path.join(["~", "foo"])
                                  -#=> "~/foo"
                                  -Path.join(["foo"])
                                  -#=> "foo"
                                  -Path.join(["/", "foo", "bar"])
                                  -#=> "/foo/bar"
                                  +
                                  iex> Path.join(["~", "foo"])
                                  +"~/foo"
                                  +iex> Path.join(["foo"])
                                  +"foo"
                                  +iex> Path.join(["/", "foo", "bar"])
                                  +"/foo/bar"
                                   
                                  - Source + + Source +

                                  join(left, right) @@ -314,11 +335,13 @@

                                  Examples

                                  Examples

                                  -
                                  Path.join("foo", "bar")
                                  -#=> "foo/bar"
                                  +
                                  iex> Path.join("foo", "bar")
                                  +"foo/bar"
                                   
                                  - Source + + Source +

                                  relative(name) @@ -340,7 +363,9 @@

                                  Windows examples

                                  Path.relative("/bar/foo.ex") #=> "bar/foo.ex"
                                  - Source + + Source +

                                  relative_to(path, from) @@ -355,12 +380,17 @@

                                  Windows examples

                                  Examples

                                  -
                                  Path.relative_to("/usr/local/foo", "/usr/local") #=> "foo"
                                  -Path.relative_to("/usr/local/foo", "/") #=> "foo"
                                  -Path.relative_to("/usr/local/foo", "/etc") #=> "/usr/local/foo"
                                  +
                                  iex> Path.relative_to("/usr/local/foo", "/usr/local")
                                  +"foo"
                                  +iex> Path.relative_to("/usr/local/foo", "/")
                                  +"usr/local/foo"
                                  +iex> Path.relative_to("/usr/local/foo", "/etc")
                                  +"/usr/local/foo"
                                   
                                  - Source + + Source +

                                  rootname(path) @@ -369,13 +399,15 @@

                                  Examples

                                  Examples

                                  -
                                  Path.rootname("/foo/bar")
                                  -#=> "/foo/bar"
                                  -Path.rootname("/foo/bar.ex")
                                  -#=> "/foo/bar"
                                  +
                                  iex> Path.rootname("/foo/bar")
                                  +"/foo/bar"
                                  +iex> Path.rootname("/foo/bar.ex")
                                  +"/foo/bar"
                                   
                                  - Source + + Source +

                                  rootname(path, extension) @@ -385,13 +417,15 @@

                                  Examples

                                  Examples

                                  -
                                  Path.rootname("/foo/bar.erl", ".erl")
                                  -#=> "/foo/bar"
                                  -Path.rootname("/foo/bar.erl", ".ex")
                                  -#=> "/foo/bar.erl"
                                  +
                                  iex> Path.rootname("/foo/bar.erl", ".erl")
                                  +"/foo/bar"
                                  +iex> Path.rootname("/foo/bar.erl", ".ex")
                                  +"/foo/bar.erl"
                                   
                                  - Source + + Source +

                                  split(path) @@ -401,15 +435,17 @@

                                  Examples

                                  Examples

                                  -
                                   Path.split("")
                                  - #=> ["/"]
                                  - Path.split("foo")
                                  - #=> ["foo"]
                                  - Path.split("/foo/bar")
                                  - #=> ["/", "foo", "bar"]
                                  +
                                   iex> Path.split("")
                                  + ["/"]
                                  + iex> Path.split("foo")
                                  + ["foo"]
                                  + iex> Path.split("/foo/bar")
                                  + ["/", "foo", "bar"]
                                   
                                  - Source + + Source +

                                  type(name) @@ -431,7 +467,9 @@

                                  Windows examples

                                  Path.type("/bar/foo.ex") #=> :volumerelative
                                  - Source + + Source +

                                  wildcard(glob) @@ -471,7 +509,9 @@

                                  Examples

                                  Path.wildcard("projects/*/ebin/**/*.{beam,app}")
                                   
                                  - Source + + Source + diff --git a/docs/master/Port.html b/docs/master/Port.html index 534cb3f37..66e25c2ff 100644 --- a/docs/master/Port.html +++ b/docs/master/Port.html @@ -39,7 +39,7 @@

                                  -

                                  Functions summary

                                  +

                                  Functions summary

                                  • @@ -103,63 +103,81 @@

                                    Functions

                                    - Source + + Source +

                                    command(port, data, options // [])

                                    - Source + + Source +

                                    control(port, operation, data)

                                    - Source + + Source +
                                    diff --git a/docs/master/Process.html b/docs/master/Process.html index 8706f03e4..4fc6ca715 100644 --- a/docs/master/Process.html +++ b/docs/master/Process.html @@ -44,7 +44,7 @@

                                    -

                                    Functions summary

                                    +

                                    Functions summary

                                    • @@ -221,21 +221,27 @@

                                      Functions

                                      pid must refer to a process at the local node.

                                      - Source + + Source +

                                      delete()

                                      Deletes all items in the dictionary.

                                      - Source + + Source +

                                      delete(key)

                                      Deletes the given key from the dictionary.

                                      - Source + + Source +

                                      demonitor(monitor_ref, options // []) @@ -246,7 +252,9 @@

                                      Functions

                                      See http://www.erlang.org/doc/man/erlang.html#demonitor-2 for more info.

                                      - Source + + Source +

                                      exit(pid, reason) @@ -273,7 +281,9 @@

                                      Examples

                                      Process.exit(pid, :kill)
                                       
                                      - Source + + Source +

                                      flag(flag, value) @@ -283,7 +293,9 @@

                                      Examples

                                      See http://www.erlang.org/doc/man/erlang.html#process_flag-2 for more info.

                                      - Source + + Source +

                                      flag(pid, flag, value) @@ -294,35 +306,45 @@

                                      Examples

                                      See http://www.erlang.org/doc/man/erlang.html#process_flag-3 for more info.

                                      - Source + + Source +

                                      get()

                                      Returns all key-values in the dictionary.

                                      - Source + + Source +

                                      get(key, default // nil)

                                      Returns the value for the given key.

                                      - Source + + Source +

                                      get_keys(value)

                                      Returns all keys that have the given value.

                                      - Source + + Source +

                                      group_leader()

                                      Returns the pid of the group leader for the process which evaluates the function.

                                      - Source + + Source +

                                      group_leader(leader, pid) @@ -330,7 +352,9 @@

                                      Examples

                                      Sets the group leader of Pid to GroupLeader. Typically, this is used when a processes started from a certain shell should have another group leader than :init.

                                      - Source + + Source +

                                      info(pid) @@ -340,7 +364,9 @@

                                      Examples

                                      See http://www.erlang.org/doc/man/erlang.html#process_info-1 for more info.

                                      - Source + + Source +

                                      info(pid, spec) @@ -350,7 +376,9 @@

                                      Examples

                                      See http://www.erlang.org/doc/man/erlang.html#process_info-2 for more info.

                                      - Source + + Source +

                                      link(pid) @@ -360,7 +388,9 @@

                                      Examples

                                      See http://www.erlang.org/doc/man/erlang.html#link-1 for more info.

                                      - Source + + Source +

                                      list() @@ -374,7 +404,9 @@

                                      Examples

                                      See http://www.erlang.org/doc/man/erlang.html#processes-0 for more info.

                                      - Source + + Source +

                                      monitor(item) @@ -384,14 +416,18 @@

                                      Examples

                                      See http://www.erlang.org/doc/man/erlang.html#monitor-2 for more info.

                                      - Source + + Source +

                                      put(key, value)

                                      Stores the given key-value in the process dictionary.

                                      - Source + + Source +

                                      register(pid, name) @@ -402,14 +438,18 @@

                                      Examples

                                      See http://www.erlang.org/doc/man/erlang.html#register-2 for more info.

                                      - Source + + Source +

                                      registered()

                                      Returns a list of names which have been registered using register/2.

                                      - Source + + Source +

                                      spawn(fun) @@ -417,7 +457,9 @@

                                      Examples

                                      Returns the pid of a new process started by the application of fun. It behaves exactly the same as Kernel.spawn/1.

                                      - Source + + Source +

                                      spawn(fun, opts) @@ -427,7 +469,9 @@

                                      Examples

                                      It also accepts extra options, for the list of available options check http://www.erlang.org/doc/man/erlang.html#spawn_opt-2

                                      - Source + + Source +

                                      spawn(mod, fun, args) @@ -438,7 +482,9 @@

                                      Examples

                                      It behaves exactly the same as the Kernel.spawn/3 function.

                                      - Source + + Source +

                                      spawn(mod, fun, args, opts) @@ -450,7 +496,9 @@

                                      Examples

                                      It also accepts extra options, for the list of available options check http://www.erlang.org/doc/man/erlang.html#spawn_opt-4

                                      - Source + + Source +

                                      spawn_link(fun) @@ -459,7 +507,9 @@

                                      Examples

                                      A link is created between the calling process and the new process, atomically.

                                      - Source + + Source +

                                      spawn_link(mod, fun, args) @@ -468,7 +518,9 @@

                                      Examples

                                      module.function(args). A link is created between the calling process and the new process, atomically. Otherwise works like spawn/3.

                                      - Source + + Source +

                                      spawn_monitor(fun) @@ -476,7 +528,9 @@

                                      Examples

                                      Returns the pid of a new process started by the application of fun and reference for a monitor created to the new process.

                                      - Source + + Source +

                                      spawn_monitor(mod, fun, args) @@ -485,7 +539,9 @@

                                      Examples

                                      and the process is monitored at the same time. Returns the pid and a reference for the monitor. Otherwise works like spawn/3.

                                      - Source + + Source +

                                      unlink(pid) @@ -496,7 +552,9 @@

                                      Examples

                                      See http://www.erlang.org/doc/man/erlang.html#unlink-1 for more info.

                                      - Source + + Source +

                                      unregister(name) @@ -505,7 +563,9 @@

                                      Examples

                                      See http://www.erlang.org/doc/man/erlang.html#unregister-1 for more info.

                                      - Source + + Source +

                                      whereis(name) @@ -515,7 +575,9 @@

                                      Examples

                                      See http://www.erlang.org/doc/man/erlang.html#whereis-1 for more info.

                                      - Source + + Source + diff --git a/docs/master/Protocol.UndefinedError.html b/docs/master/Protocol.UndefinedError.html index d3fc53420..918c910d5 100644 --- a/docs/master/Protocol.UndefinedError.html +++ b/docs/master/Protocol.UndefinedError.html @@ -53,7 +53,7 @@

                                      Fields (and defaults)

                                      -

                                      Functions summary

                                      +

                                      Functions summary

                                      • @@ -76,7 +76,9 @@

                                        Functions

                                        message(exception)

                                        - Source + + Source + diff --git a/docs/master/Range.Iterator.Number.html b/docs/master/Range.Iterator.Number.html index 8e7d0385e..a0f24e170 100644 --- a/docs/master/Range.Iterator.Number.html +++ b/docs/master/Range.Iterator.Number.html @@ -36,7 +36,7 @@

                                        -

                                        Functions summary

                                        +

                                        Functions summary

                                        • @@ -64,13 +64,17 @@

                                          Functions

                                          count(first, arg2)

                                          - Source + + Source +

                                          iterator(first, arg2)

                                          - Source + + Source +
                                          diff --git a/docs/master/Range.Iterator.html b/docs/master/Range.Iterator.html index 5527b3806..24f96124e 100644 --- a/docs/master/Range.Iterator.html +++ b/docs/master/Range.Iterator.html @@ -32,7 +32,7 @@

                                          Source -

                                          Implementations

                                          +

                                          Implementations

                                          • @@ -47,7 +47,7 @@

                                            Implementations

                                            -

                                            Functions summary

                                            +

                                            Functions summary

                                            • @@ -76,7 +76,9 @@

                                              Functions

                                              Count how many items are in the range.

                                              - Source + + Source +

                                              iterator(first, range) @@ -87,7 +89,9 @@

                                              Functions

                                              a tuple with two elements: the given item and the next item in the iteration.

                                              - Source + + Source + diff --git a/docs/master/Record.html b/docs/master/Record.html index b40504198..9879d03cb 100644 --- a/docs/master/Record.html +++ b/docs/master/Record.html @@ -39,7 +39,7 @@

                                              -

                                              Functions summary

                                              +

                                              Functions summary

                                              • @@ -48,7 +48,7 @@

                                                Functions summary

                                              • - defmacros/3 + defmacros/4
                                              • @@ -76,6 +76,16 @@

                                                Functions summary

                                                +

                                                Macros summary

                                                + + @@ -98,10 +108,12 @@

                                                Examples

                                                end - Source + + Source +
                                                -

                                                - defmacros(name, values, env) +

                                                + defmacros(name, values, env, tag // nil)

                                                Defines macros for manipulating records. This is called directly by defrecordp. It expects the macro name, the @@ -114,7 +126,9 @@

                                                Examples

                                                end
                                                - Source + + Source +

                                                defrecord(name, values, opts) @@ -124,7 +138,9 @@

                                                Examples

                                                This is invoked directly by Kernel.defrecord, so check it for more information and documentation.

                                                - Source + + Source +

                                                defrecordp(name, fields) @@ -134,14 +150,18 @@

                                                Examples

                                                in values. This is invoked directly by Kernel.defrecordp, so check it for more information and documentation.

                                                - Source + + Source +

                                                deftypes(values, types, env)

                                                Defines types and specs for the record.

                                                - Source + + Source +

                                                extract(name, opts) @@ -154,12 +174,42 @@

                                                Examples

                                                defrecord FileInfo, Record.extract(:file_info, from_lib: "kernel/include/file.hrl")
                                                 
                                                - Source + + Source + +
                                                +

                                                Macros

                                                +
                                                +

                                                + import(module, list2) +

                                                +

                                                Import public record definition as a set of private macros (as defined by defrecordp/2)

                                                + +

                                                Usage

                                                + +

                                                Record.import Record.Module, as: macro_name

                                                + +

                                                Example

                                                + +

                                                defmodule Test do + Record.import File.Stat, as: :file_stat

                                                + +
                                                 def size(file_stat(size: size)), do: size
                                                +
                                                + +

                                                end

                                                +
                                                + + Source + +
                                                +
                                                + diff --git a/docs/master/Regex.html b/docs/master/Regex.html index 3c31a3b3a..755416c60 100644 --- a/docs/master/Regex.html +++ b/docs/master/Regex.html @@ -84,7 +84,7 @@

                                                -

                                                Functions summary

                                                +

                                                Functions summary

                                                • @@ -166,14 +166,18 @@

                                                  Functions

                                                  captures(regex, string, options // [])

                                                  -

                                                  Returns the given captures as a list of tuples.

                                                  +

                                                  Returns the given captures as a list of tuples. +Requires the regex to be compiled with the groups option.

                                                  Examples

                                                  -
                                                  Regex.captures %r/c(?<foo>d)/g, "abcd"  #=> [{:foo, ["d"]}]
                                                  +
                                                  iex> Regex.captures %r/c(?<foo>d)/g, "abcd"
                                                  +[foo: "d"]
                                                   
                                                  - Source + + Source +

                                                  compile(source, options // "") @@ -183,7 +187,9 @@

                                                  Examples

                                                  It returns { :ok, regex } in case of success, { :error, reason } otherwise.

                                                  - Source + + Source +

                                                  compile!(source, options // "") @@ -191,7 +197,9 @@

                                                  Examples

                                                  Compiles the regular expression according to the given options. Fails with Regex.CompileError if the regex cannot be compiled.

                                                  - Source + + Source +

                                                  groups(arg1) @@ -200,10 +208,13 @@

                                                  Examples

                                                  Examples

                                                  -
                                                  Regex.groups %r/(?<foo>foo)/g #=> ["foo"]
                                                  +
                                                  iex> Regex.groups %r/(?<foo>foo)/g
                                                  +[:foo]
                                                   
                                                  - Source + + Source +

                                                  index(arg1, string) @@ -214,11 +225,15 @@

                                                  Examples

                                                  Examples

                                                  -
                                                  Regex.index %r/c(d)/, "abcd"  #=> 3
                                                  -Regex.index %r/e/, "abcd"     #=> nil
                                                  +
                                                  iex> Regex.index %r/c(d)/, "abcd"
                                                  +2
                                                  +iex> Regex.index %r/e/, "abcd"
                                                  +nil
                                                   
                                                  - Source + + Source +

                                                  match?(arg1, string) @@ -227,30 +242,39 @@

                                                  Examples

                                                  Examples

                                                  -
                                                  Regex.match? %r/foo/, "foo" #=> true
                                                  -Regex.match? %r/foo/, "bar" #=> false
                                                  +
                                                  iex> Regex.match? %r/foo/, "foo"
                                                  +true
                                                  +iex> Regex.match? %r/foo/, "bar"
                                                  +false
                                                   
                                                  - Source + + Source +

                                                  opts(arg1)

                                                  -

                                                  Returns the regex options as a list.

                                                  +

                                                  Returns the regex options as a string.

                                                  Examples

                                                  -
                                                  Regex.opts %r(foo)m #=> 'm'
                                                  +
                                                  iex> Regex.opts %r(foo)m
                                                  +"m"
                                                   
                                                  - Source + + Source +

                                                  re_pattern(arg1)

                                                  -

                                                  Returns the underlying re_pattern in the regular expression.

                                                  +

                                                  Returns the underlying re_pattern in the regular expression.

                                                  - Source + + Source +

                                                  replace(arg1, string, replacement, options // []) @@ -265,14 +289,21 @@

                                                  Examples

                                                  Examples

                                                  -
                                                  Regex.replace(%r/d/, "abc", "d")       #=> "abc"
                                                  -Regex.replace(%r/b/, "abc", "d")       #=> "adc"
                                                  -Regex.replace(%r/b/, "abc", "[&]")     #=> "a[b]c"
                                                  -Regex.replace(%r/b/, "abc", "[\\&]")   #=> "a[&]c"
                                                  -Regex.replace(%r/(b)/, "abc", "[\\1]") #=> "a[b]c"
                                                  +
                                                  iex> Regex.replace(%r/d/, "abc", "d")
                                                  +"abc"
                                                  +iex> Regex.replace(%r/b/, "abc", "d")
                                                  +"adc"
                                                  +iex> Regex.replace(%r/b/, "abc", "[&]")
                                                  +"a[b]c"
                                                  +iex> Regex.replace(%r/b/, "abc", "[\\&]")
                                                  +"a[&]c"
                                                  +iex> Regex.replace(%r/(b)/, "abc", "[\\1]")
                                                  +"a[b]c"
                                                   
                                                  - Source + + Source +

                                                  run(regex, string, options // []) @@ -282,11 +313,15 @@

                                                  Examples

                                                  Examples

                                                  -
                                                  Regex.run %r/c(d)/, "abcd"  #=> ["cd", "d"]
                                                  -Regex.run %r/e/, "abcd"     #=> nil
                                                  +
                                                  iex> Regex.run %r/c(d)/, "abcd"
                                                  +["cd", "d"]
                                                  +iex> Regex.run %r/e/, "abcd"
                                                  +nil
                                                   
                                                  - Source + + Source +

                                                  scan(regex, string, options // []) @@ -298,12 +333,17 @@

                                                  Examples

                                                  Examples

                                                  -
                                                  Regex.scan %r/c(d|e)/, "abcd abce"   #=> [["d"], ["e"]]
                                                  -Regex.scan %r/c(?:d|e)/, "abcd abce" #=> ["cd", "ce"]
                                                  -Regex.scan %r/e/, "abcd"             #=> []
                                                  +
                                                  iex> Regex.scan %r/c(d|e)/, "abcd abce"
                                                  +[["d"], ["e"]]
                                                  +iex> Regex.scan %r/c(?:d|e)/, "abcd abce"
                                                  +["cd", "ce"]
                                                  +iex> Regex.scan %r/e/, "abcd"
                                                  +[]
                                                   
                                                  - Source + + Source +

                                                  source(arg1) @@ -312,10 +352,13 @@

                                                  Examples

                                                  Examples

                                                  -
                                                  Regex.source %r(foo) #=> "foo"
                                                  +
                                                  iex> Regex.source %r(foo)
                                                  +"foo"
                                                   
                                                  - Source + + Source +

                                                  split(regex, string, options // []) @@ -323,7 +366,9 @@

                                                  Examples

                                                  Split the given target in the number of parts specified. If no ammount of parts is given, it defaults to :infinity.

                                                  - Source + + Source +
                                                  diff --git a/docs/master/String.html b/docs/master/String.html index 696c840d7..f277b9503 100644 --- a/docs/master/String.html +++ b/docs/master/String.html @@ -27,18 +27,41 @@

                                                  -

                                                  A string in Elixir is a UTF-8 encoded binary.

                                                  +

                                                  A String in Elixir is a UTF-8 encoded binary.

                                                  + +

                                                  String and binary operations

                                                  The functions in this module act according to the -Unicode Standard, version 6.2.0. A codepoint is a -Unicode Character, which may be represented by one -or more bytes. For example, the character "é" is -represented with two bytes:

                                                  - -
                                                  string = "é"
                                                  -#=> "é"
                                                  -size(string)
                                                  -#=> 2
                                                  +Unicode Standard, version 6.2.0. For example,
                                                  +titlecase, downcase, strip are provided by this
                                                  +module.

                                                  + +

                                                  Besides this module, Elixir provides more low-level +operations that works directly with binaries. Some +of those can be found in the Kernel module, as:

                                                  + +
                                                    +
                                                  • binary_part/2 and binary_part/3 - retrieves part of the binary
                                                  • +
                                                  • bit_size/1 and byte_size/1 - size related functions
                                                  • +
                                                  • is_bitstring/1 and is_binary/1 - type checking function
                                                  • +
                                                  • Plus a bunch of conversion functions, like binary_to_atom/2, +binary_to_integer/2, binary_to_term/1 and their opposite +like integer_to_binary/2
                                                  • +
                                                  + +

                                                  Finally, the :binary module +provides a couple other functions that works on the byte level.

                                                  + +

                                                  Codepoints and graphemes

                                                  + +

                                                  As per the Unicode Standard, a codepoint is an Unicode +Character, which may be represented by one or more bytes. +For example, the character "é" is represented with two +bytes:

                                                  + +
                                                  iex> string = "é"
                                                  +...> byte_size(string)
                                                  +2
                                                   

                                                  Furthermore, this module also presents the concept of @@ -47,10 +70,9 @@

                                                  the same "é" character written above could be represented by the letter "e" followed by the accent ́:

                                                  -
                                                  string = "\x{0065}\x{0301}"
                                                  -#=> "é"
                                                  -size(string)
                                                  -#=> 3
                                                  +
                                                  iex> string = "\x{0065}\x{0301}"
                                                  +...> byte_size(string)
                                                  +3
                                                   

                                                  Although the example above is made of two characters, it is @@ -69,29 +91,33 @@

                                                  Integer codepoints

                                                  Although codepoints could be represented as integers, this -module represents all codepoints as binaries. For example:

                                                  +module represents all codepoints as strings. For example:

                                                  -
                                                  String.codepoints "josé" #=> ["j", "o", "s", "é"]
                                                  +
                                                  iex> String.codepoints "josé"
                                                  +["j", "o", "s", "é"]
                                                   

                                                  There are a couple of ways to retrieve a character integer codepoint. One may use the ? special macro:

                                                  -
                                                  ?j #=> 106
                                                  -?é #=> 233
                                                  +
                                                  iex> ?j
                                                  +106
                                                  +iex> ?é
                                                  +233
                                                   

                                                  Or also via pattern matching:

                                                  -
                                                  << eacute :: utf8 >> = "é"
                                                  -eacute #=> 233
                                                  +
                                                  iex> << eacute :: utf8 >> = "é"
                                                  +...> eacute
                                                  +233
                                                   

                                                  As we have seen above, codepoints can be inserted into a string by their hexadecimal code:

                                                  -
                                                  string = "jos\x{0065}\x{0301}"
                                                  -#=> "josé"
                                                  +
                                                  "jos\x{0065}\x{0301}" #=>
                                                  +"josé"
                                                   

                                                  Self-synchronization

                                                  @@ -105,8 +131,10 @@

                                                  Self-synchronization

                                                  characters. For example, String.length is going to return a correct result even if an invalid codepoint is fed into it.

                                                  -

                                                  In the future, bang version of such functions may be -provided which will rather raise on such invalid data.

                                                  +

                                                  In other words, this module expects invalid data to be detected +when retrieving data from the external source. For example, a +driver that reads strings from a database will be the one +responsible to check the validity of the encoding.

                                                  @@ -118,7 +146,7 @@

                                                  Self-synchronization

                                                  -

                                                  Functions summary

                                                  +

                                                  Functions summary

                                                  • @@ -210,6 +238,11 @@

                                                    Functions summary

                                                    slice/3
                                                  • +
                                                  • + + split/1 + +
                                                  • split/3 @@ -255,14 +288,21 @@

                                                    Functions

                                                    Examples

                                                    -
                                                    String.at("elixir", 0) #=> "e"
                                                    -String.at("elixir", 1) #=> "l"
                                                    -String.at("elixir", 10) #=> nil
                                                    -String.at("elixir", -1) #=> "r"
                                                    -String.at("elixir", -10) #=> nil
                                                    +
                                                    iex> String.at("elixir", 0)
                                                    +"e"
                                                    +iex> String.at("elixir", 1)
                                                    +"l"
                                                    +iex> String.at("elixir", 10)
                                                    +nil
                                                    +iex> String.at("elixir", -1)
                                                    +"r"
                                                    +iex> String.at("elixir", -10)
                                                    +nil
                                                     
                                                    - Source + + Source +

                                                    capitalize(string) @@ -277,12 +317,17 @@

                                                    Examples

                                                    Examples

                                                    -
                                                    String.capitalize("abcd") #=> "Abcd"
                                                    -String.capitalize("fin")   #=> "Fin"
                                                    -String.capitalize("josé") #=> "José"
                                                    +
                                                    iex> String.capitalize("abcd")
                                                    +"Abcd"
                                                    +iex> String.capitalize("fin")
                                                    +"Fin"
                                                    +iex> String.capitalize("josé")
                                                    +"José"
                                                     
                                                    - Source + + Source +

                                                    codepoints(string) @@ -291,12 +336,17 @@

                                                    Examples

                                                    Examples

                                                    -
                                                    String.codepoints("josé")         #=> ["j", "o", "s", "é"]
                                                    -String.codepoints("оптими зации") #=> ["о","п","т","и","м","и"," ","з","а","ц","и","и"]
                                                    -String.codepoints("ἅἪῼ")          #=> ["ἅ","Ἢ","ῼ"]
                                                    +
                                                    iex> String.codepoints("josé")
                                                    +["j", "o", "s", "é"]
                                                    +iex> String.codepoints("оптими зации")
                                                    +["о","п","т","и","м","и"," ","з","а","ц","и","и"]
                                                    +iex> String.codepoints("ἅἪῼ")
                                                    +["ἅ","Ἢ","ῼ"]
                                                     
                                                    - Source + + Source +

                                                    downcase(binary) @@ -305,12 +355,17 @@

                                                    Examples

                                                    Examples

                                                    -
                                                    String.downcase("ABCD") #=> "abcd"
                                                    -String.downcase("AB 123 XPTO") #=> "ab 123 xpto"
                                                    -String.downcase("JOSÉ") #=> "josé"
                                                    +
                                                    iex> String.downcase("ABCD")
                                                    +"abcd"
                                                    +iex> String.downcase("AB 123 XPTO")
                                                    +"ab 123 xpto"
                                                    +iex> String.downcase("JOSÉ")
                                                    +"josé"
                                                     
                                                    - Source + + Source +

                                                    duplicate(subject, n) @@ -319,11 +374,15 @@

                                                    Examples

                                                    Examples

                                                    -
                                                    String.duplicate("abc", 1) #=> "abc"
                                                    -String.duplicate("abc", 2) #=> "abcabc"
                                                    +
                                                    iex> String.duplicate("abc", 1)
                                                    +"abc"
                                                    +iex> String.duplicate("abc", 2)
                                                    +"abcabc"
                                                     
                                                    - Source + + Source +

                                                    first(string) @@ -332,11 +391,15 @@

                                                    Examples

                                                    Examples

                                                    -
                                                    String.first("elixir")  #=> "e"
                                                    -String.first("եոգլի") #=> "ե"
                                                    +
                                                    iex> String.first("elixir")
                                                    +"e"
                                                    +iex> String.first("եոգլի")
                                                    +"ե"
                                                     
                                                    - Source + + Source +

                                                    graphemes(string) @@ -345,10 +408,13 @@

                                                    Examples

                                                    Examples

                                                    -
                                                    String.graphemes("Ā̀stute") # => ["Ā̀","s","t","u","t","e"]
                                                    +
                                                    iex> String.graphemes("Ā̀stute")
                                                    +["Ā̀","s","t","u","t","e"]
                                                     
                                                    - Source + + Source +

                                                    last(string) @@ -357,11 +423,15 @@

                                                    Examples

                                                    Examples

                                                    -
                                                    String.last("elixir")  #=> "r"
                                                    -String.last("եոգլի") #=> "ի"
                                                    +
                                                    iex> String.last("elixir")
                                                    +"r"
                                                    +iex> String.last("եոգլի")
                                                    +"ի"
                                                     
                                                    - Source + + Source +

                                                    length(string) @@ -370,24 +440,31 @@

                                                    Examples

                                                    Examples

                                                    -
                                                    String.length("elixir")  #=> 6
                                                    -String.length("եոգլի") #=> 5
                                                    +
                                                    iex> String.length("elixir")
                                                    +6
                                                    +iex> String.length("եոգլի")
                                                    +5
                                                     
                                                    - Source + + Source +

                                                    lstrip(binary)

                                                    -

                                                    Returns a string where leading whitespace characters -have been removed.

                                                    +

                                                    Returns a string where leading Unicode whitespace +has been removed.

                                                    Examples

                                                    -
                                                    String.lstrip("   abc  ")       #=> "abc  "
                                                    +
                                                    iex> String.lstrip("   abc  ")
                                                    +"abc  "
                                                     
                                                    - Source + + Source +

                                                    lstrip(other, char) @@ -396,10 +473,13 @@

                                                    Examples

                                                    Examples

                                                    -
                                                    String.lstrip("_  abc  _", ?_)  #=> "  abc  _"
                                                    +
                                                    iex> String.lstrip("_  abc  _", ?_)
                                                    +"  abc  _"
                                                     
                                                    - Source + + Source +

                                                    next_codepoint(string) @@ -417,10 +497,13 @@

                                                    Examples

                                                    Examples

                                                    -
                                                    String.next_codepoint("josé") #=> { "j", "osé" }
                                                    +
                                                    iex> String.next_codepoint("josé")
                                                    +{ "j", "osé" }
                                                     
                                                    - Source + + Source +

                                                    next_grapheme(string) @@ -433,10 +516,13 @@

                                                    Examples

                                                    Examples

                                                    -
                                                    String.next_grapheme("josé") #=> { "j", "osé" }
                                                    +
                                                    iex> String.next_grapheme("josé")
                                                    +{ "j", "osé" }
                                                     
                                                    - Source + + Source +

                                                    printable?(arg1) @@ -446,10 +532,13 @@

                                                    Examples

                                                    Examples

                                                    -
                                                    String.printable?("abc") #=> true
                                                    +
                                                    iex> String.printable?("abc")
                                                    +true
                                                     
                                                    - Source + + Source +

                                                    replace(subject, pattern, replacement, options // []) @@ -464,27 +553,37 @@

                                                    Examples

                                                    Examples

                                                    -
                                                    String.replace("a,b,c", ",", "-") #=> "a-b-c"
                                                    -String.replace("a,b,c", ",", "-", global: false) #=> "a-b,c"
                                                    -String.replace("a,b,c", "b", "[]", insert_replaced: 1) #=> "a,[b],c"
                                                    -String.replace("a,b,c", ",", "[]", insert_replaced: 2) #=> "a[],b[],c"
                                                    -String.replace("a,b,c", ",", "[]", insert_replaced: [1,1]) #=> "a[,,]b[,,]c"
                                                    +
                                                    iex> String.replace("a,b,c", ",", "-")
                                                    +"a-b-c"
                                                    +iex> String.replace("a,b,c", ",", "-", global: false)
                                                    +"a-b,c"
                                                    +iex> String.replace("a,b,c", "b", "[]", insert_replaced: 1)
                                                    +"a,[b],c"
                                                    +iex> String.replace("a,b,c", ",", "[]", insert_replaced: 2)
                                                    +"a[],b[],c"
                                                    +iex> String.replace("a,b,c", ",", "[]", insert_replaced: [1,1])
                                                    +"a[,,]b[,,]c"
                                                     
                                                    - Source + + Source +

                                                    rstrip(binary)

                                                    -

                                                    Returns a string where trailing whitespace characters -and new line have been removed.

                                                    +

                                                    Returns a string where trailing Unicode whitespace +has been removed.

                                                    Examples

                                                    -
                                                    String.rstrip("   abc  ")      #=> "   abc"
                                                    +
                                                    iex> String.rstrip("   abc  ")
                                                    +"   abc"
                                                     
                                                    - Source + + Source +

                                                    rstrip(string, char) @@ -493,10 +592,13 @@

                                                    Examples

                                                    Examples

                                                    -
                                                    String.rstrip("   abc _", ?_)  #=> "   abc "
                                                    +
                                                    iex> String.rstrip("   abc _", ?_)
                                                    +"   abc "
                                                     
                                                    - Source + + Source +

                                                    slice(string, start, len) @@ -507,17 +609,24 @@

                                                    Examples

                                                    Examples

                                                    -
                                                    String.slice("elixir", 1, 3) #=> "lix"
                                                    -String.slice("elixir", 1, 10) #=> "lixir"
                                                    -String.slice("elixir", 10, 3) #=> nil
                                                    -String.slice("elixir", -4, 4) #=> "ixi"
                                                    -String.slice("elixir", -10, 3) #=> nil
                                                    +
                                                    iex> String.slice("elixir", 1, 3)
                                                    +"lix"
                                                    +iex> String.slice("elixir", 1, 10)
                                                    +"lixir"
                                                    +iex> String.slice("elixir", 10, 3)
                                                    +nil
                                                    +iex> String.slice("elixir", -4, 4)
                                                    +"ixir"
                                                    +iex> String.slice("elixir", -10, 3)
                                                    +nil
                                                     
                                                    - Source + + Source +
                                                    -

                                                    - split(binary, pattern // " ", options // []) +

                                                    + split(binary)

                                                    Divides a string into sub string based on a pattern, returning a list of these sub string. The pattern can @@ -526,38 +635,64 @@

                                                    Examples

                                                    The string is split into as many parts as possible by default, unless the global option is set to false. If a pattern is not specified, the string is split on -whitespace occurrences.

                                                    +Unicode whitespace occurrences with leading and trailing +whitespace ignored.

                                                    It returns a list with the original string if the pattern can't be matched.

                                                    Examples

                                                    -
                                                    String.split("a,b,c", ",")  #=> ["a", "b", "c"]
                                                    -String.split("a,b,c", ",", global: false)  #=> ["a", "b,c"]
                                                    -
                                                    -String.split("foo bar")     #=> ["foo", "bar"]
                                                    -String.split("1,2 3,4", [" ", ","]) #=> ["1", "2", "3", "4"]
                                                    -
                                                    -String.split("a,b,c", %r{,}) #=> ["a", "b", "c"]
                                                    -String.split("a,b,c", %r{,}, global: false)  #=> ["a", "b,c"]
                                                    -String.split("a,b", %r{.})   #=> ["a,b"]
                                                    +
                                                    iex> String.split("foo bar")
                                                    +["foo", "bar"]
                                                    +iex> String.split("foo" <> <<194,133>> <> "bar")
                                                    +["foo", "bar"]
                                                    +iex> String.split(" foo bar ")
                                                    +["foo", "bar"]
                                                    +
                                                    +iex> String.split("a,b,c", ",")
                                                    +["a", "b", "c"]
                                                    +iex> String.split("a,b,c", ",", global: false)
                                                    +["a", "b,c"]
                                                    +
                                                    +iex> String.split("1,2 3,4", [" ", ","])
                                                    +["1", "2", "3", "4"]
                                                    +
                                                    +iex> String.split("a,b,c", %r{,})
                                                    +["a", "b", "c"]
                                                    +iex> String.split("a,b,c", %r{,}, global: false)
                                                    +["a", "b,c"]
                                                    +iex> String.split("a,b", %r{\.})
                                                    +["a,b"]
                                                     
                                                    - Source + + Source + +
                                                    +

                                                    + split(binary, pattern, options // []) +

                                                    +
                                                    + + Source +

                                                    strip(string)

                                                    -

                                                    Returns a string where leading/trailing whitespace -and new line characters have been removed.

                                                    +

                                                    Returns a string where leading/trailing Unicode whitespace +has been removed.

                                                    Examples

                                                    -
                                                    String.strip("   abc  ")       #=> "abc"
                                                    +
                                                    iex> String.strip("   abc  ")
                                                    +"abc"
                                                     
                                                    - Source + + Source +

                                                    strip(string, char) @@ -567,10 +702,13 @@

                                                    Examples

                                                    Examples

                                                    -
                                                    String.strip("a  abc  a", ?a)  #=> "  abc  "
                                                    +
                                                    iex> String.strip("a  abc  a", ?a)
                                                    +"  abc  "
                                                     
                                                    - Source + + Source +

                                                    upcase(binary) @@ -579,12 +717,17 @@

                                                    Examples

                                                    Examples

                                                    -
                                                    String.upcase("abcd") #=> "ABCD"
                                                    -String.upcase("ab 123 xpto") #=> "AB 123 XPTO"
                                                    -String.upcase("josé") #=> "JOSÉ"
                                                    +
                                                    iex> String.upcase("abcd")
                                                    +"ABCD"
                                                    +iex> String.upcase("ab 123 xpto")
                                                    +"AB 123 XPTO"
                                                    +iex> String.upcase("josé")
                                                    +"JOSÉ"
                                                     
                                                    - Source + + Source +

                                                    valid_codepoint?(arg1) @@ -596,13 +739,19 @@

                                                    Examples

                                                    Examples

                                                    -
                                                    String.valid_codepoint?("a") #=> true
                                                    -String.valid_codepoint?("ø") #=> true
                                                    -String.valid_codepoint?("\xffff") #=> false
                                                    -String.valid_codepoint?("asdf") #=> false
                                                    +
                                                    iex> String.valid_codepoint?("a")
                                                    +true
                                                    +iex> String.valid_codepoint?("ø")
                                                    +true
                                                    +iex> String.valid_codepoint?("\xffff")
                                                    +false
                                                    +iex> String.valid_codepoint?("asdf")
                                                    +false
                                                     
                                                    - Source + + Source + diff --git a/docs/master/Supervisor.Behaviour.html b/docs/master/Supervisor.Behaviour.html index 9505007a9..118b17a41 100644 --- a/docs/master/Supervisor.Behaviour.html +++ b/docs/master/Supervisor.Behaviour.html @@ -65,7 +65,7 @@

                                                    Example

                                                    -

                                                    Functions summary

                                                    +

                                                    Functions summary

                                                    • @@ -137,7 +137,9 @@

                                                      Strategies

                                                      when dynamically attaching children;

                                                    - Source + + Source +

                                                    supervisor(module, args, options // []) @@ -198,7 +200,9 @@

                                                    Shutdown values

                                                    terminated using exit(child, :kill);

                                                  - Source + + Source +

                                                  worker(module, args, options // []) @@ -259,7 +263,9 @@

                                                  Shutdown values

                                                  terminated using exit(child, :kill);

                                                - Source + + Source + diff --git a/docs/master/SyntaxError.html b/docs/master/SyntaxError.html index f55b48af5..efb4f2c2c 100644 --- a/docs/master/SyntaxError.html +++ b/docs/master/SyntaxError.html @@ -59,7 +59,7 @@

                                                Fields (and defaults)

                                                -

                                                Functions summary

                                                +

                                                Functions summary

                                                • @@ -82,7 +82,9 @@

                                                  Functions

                                                  message(exception)

                                                  - Source + + Source + diff --git a/docs/master/System.html b/docs/master/System.html index 27a8cd615..ddceecccb 100644 --- a/docs/master/System.html +++ b/docs/master/System.html @@ -41,7 +41,7 @@

                                                  -

                                                  Functions summary

                                                  +

                                                  Functions summary

                                                  • @@ -155,7 +155,9 @@

                                                    Functions

                                                    Returns the list of command-line arguments passed to the program.

                                                    - Source + + Source +

                                                    at_exit(fun) @@ -167,14 +169,18 @@

                                                    Functions

                                                    The function must expect the exit status code as argument.

                                                    - Source + + Source +

                                                    build_info()

                                                    Returns a keywords list with version, git tag info and date.

                                                    - Source + + Source +

                                                    cmd(command) @@ -186,7 +192,9 @@

                                                    Functions

                                                    If command is a char list, a char list is returned. Returns a binary otherwise.

                                                    - Source + + Source +

                                                    cwd() @@ -194,14 +202,18 @@

                                                    Functions

                                                    Returns the current working directory or nil if one is not available.

                                                    - Source + + Source +

                                                    cwd!()

                                                    Returns the current working directory or raises System.NoAccessCwdError.

                                                    - Source + + Source +

                                                    find_executable(command) @@ -213,7 +225,9 @@

                                                    Functions

                                                    If command is a char list, a char list is returned. Returns a binary otherwise.

                                                    - Source + + Source +

                                                    get_env() @@ -222,7 +236,9 @@

                                                    Functions

                                                    given as a single string of the format "VarName=Value", where VarName is the name of the variable and Value its value.

                                                    - Source + + Source +

                                                    get_env(varname) @@ -231,7 +247,9 @@

                                                    Functions

                                                    varname as a binary, or nil if the environment variable is undefined.

                                                    - Source + + Source +

                                                    get_pid() @@ -241,7 +259,9 @@

                                                    Functions

                                                    See http://www.erlang.org/doc/man/os.html#getpid-0 for more info.

                                                    - Source + + Source +

                                                    halt(status // 0, options // []) @@ -275,7 +295,9 @@

                                                    Examples

                                                    System.halt(:abort)
                                                    - Source + + Source +

                                                    put_env(dict) @@ -283,14 +305,18 @@

                                                    Examples

                                                    Sets a new value for each environment variable corresponding to each key in dict.

                                                    - Source + + Source +

                                                    put_env(varname, value)

                                                    Sets a new value for the environment variable varname.

                                                    - Source + + Source +

                                                    stacktrace() @@ -301,7 +327,9 @@

                                                    Examples

                                                    return the current stacktrace but rather the stacktrace of the latest exception.

                                                    - Source + + Source +

                                                    tmp_dir() @@ -319,7 +347,9 @@

                                                    Examples

                                                    Returns nil if none of the above are writable.

                                                    - Source + + Source +

                                                    tmp_dir!() @@ -327,7 +357,9 @@

                                                    Examples

                                                    Same as tmp_dir but raises System.NoTmpDirError instead of returning nil if no temp dir is set.

                                                    - Source + + Source +

                                                    user_home() @@ -335,7 +367,9 @@

                                                    Examples

                                                    Returns the user home (platform independent). It returns nil if no user home is set.

                                                    - Source + + Source +

                                                    user_home!() @@ -343,14 +377,18 @@

                                                    Examples

                                                    Same as user_home but raises System.NoHomeError instead of returning nil if no user home is set.

                                                    - Source + + Source +

                                                    version()

                                                    Returns Elixir's version as binary.

                                                    - Source + + Source +
                                                    diff --git a/docs/master/TokenMissingError.html b/docs/master/TokenMissingError.html index 1bd8d0775..d5bb2562a 100644 --- a/docs/master/TokenMissingError.html +++ b/docs/master/TokenMissingError.html @@ -59,7 +59,7 @@

                                                    Fields (and defaults)

                                                    -

                                                    Functions summary

                                                    +

                                                    Functions summary

                                                    • @@ -82,7 +82,9 @@

                                                      Functions

                                                      message(exception)

                                                      - Source + + Source + diff --git a/docs/master/URI.FTP.html b/docs/master/URI.FTP.html index 52ed99a34..0e56ce9cf 100644 --- a/docs/master/URI.FTP.html +++ b/docs/master/URI.FTP.html @@ -34,7 +34,7 @@

                                                      -

                                                      Functions summary

                                                      +

                                                      Functions summary

                                                      • @@ -62,13 +62,17 @@

                                                        Functions

                                                        default_port()

                                                        - Source + + Source +

                                                        parse(info)

                                                        - Source + + Source +
                                                        diff --git a/docs/master/URI.HTTP.html b/docs/master/URI.HTTP.html index 04d64bdc3..cb2402140 100644 --- a/docs/master/URI.HTTP.html +++ b/docs/master/URI.HTTP.html @@ -34,7 +34,7 @@

                                                        -

                                                        Functions summary

                                                        +

                                                        Functions summary

                                                        • @@ -62,13 +62,17 @@

                                                          Functions

                                                          default_port()

                                                          - Source + + Source +

                                                          parse(info)

                                                          - Source + + Source +
                                                          diff --git a/docs/master/URI.HTTPS.html b/docs/master/URI.HTTPS.html index 9cc348b3f..4f9f37eb1 100644 --- a/docs/master/URI.HTTPS.html +++ b/docs/master/URI.HTTPS.html @@ -34,7 +34,7 @@

                                                          -

                                                          Functions summary

                                                          +

                                                          Functions summary

                                                          • @@ -62,13 +62,17 @@

                                                            Functions

                                                            default_port()

                                                            - Source + + Source +

                                                            parse(info)

                                                            - Source + + Source +
                                                            diff --git a/docs/master/URI.LDAP.html b/docs/master/URI.LDAP.html index 1e79fbe19..e2f274e11 100644 --- a/docs/master/URI.LDAP.html +++ b/docs/master/URI.LDAP.html @@ -34,7 +34,7 @@

                                                            -

                                                            Functions summary

                                                            +

                                                            Functions summary

                                                            • @@ -62,13 +62,17 @@

                                                              Functions

                                                              default_port()

                                                              - Source + + Source +

                                                              parse(info)

                                                              - Source + + Source +
                                                              diff --git a/docs/master/URI.Parser.html b/docs/master/URI.Parser.html index 6d20499fc..10fb4d5e8 100644 --- a/docs/master/URI.Parser.html +++ b/docs/master/URI.Parser.html @@ -46,7 +46,7 @@

                                                              -

                                                              Callbacks summary

                                                              +

                                                              Callbacks summary

                                                              • @@ -75,14 +75,18 @@

                                                                Callbacks

                                                                Responsible for returning the default port.

                                                                - Source + + Source +

                                                                parse(uri_info :: URI.Info.t())

                                                                Responsible for parsing extra URL information.

                                                                - Source + + Source +
                                                                diff --git a/docs/master/URI.SFTP.html b/docs/master/URI.SFTP.html index 56ed7c888..fa6cd87c6 100644 --- a/docs/master/URI.SFTP.html +++ b/docs/master/URI.SFTP.html @@ -34,7 +34,7 @@

                                                                -

                                                                Functions summary

                                                                +

                                                                Functions summary

                                                                From d3569867410f9557cbb49b8970be0586cfcd0116 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Tue, 16 Apr 2013 18:50:05 -0700 Subject: [PATCH 379/437] Add missing doc pages --- docs/master/ExUnit.DocTest.html | 193 ++++++++++++++++++++++++++++++++ docs/master/ExUnit.Test.html | 81 ++++++++++++++ 2 files changed, 274 insertions(+) create mode 100644 docs/master/ExUnit.DocTest.html create mode 100644 docs/master/ExUnit.Test.html diff --git a/docs/master/ExUnit.DocTest.html b/docs/master/ExUnit.DocTest.html new file mode 100644 index 000000000..42e0372f8 --- /dev/null +++ b/docs/master/ExUnit.DocTest.html @@ -0,0 +1,193 @@ + + + + ExUnit.DocTest + + + + + + + + + + + + +
                                                                +

                                                                + ExUnit.DocTest + +

                                                                + + +
                                                                +

                                                                ExUnit.DocTest implements functionality similar to Python's +doctest.

                                                                + +

                                                                In a nutshell, it allows us to generate tests from the code +examples existing in module/function/macro's documentation. +In order to do that, one needs to invoke doctest/1 macro +from their test case and write their examples according +to some guidelines.

                                                                + +

                                                                The syntax for examples is as follows. Every new test starts +on a new line, with an "iex>" prefix. Multiline expressions +can be employed if the following lines start with either +"...>" (recommended) or "iex>" prefix.

                                                                + +

                                                                The expected result should start at the next line after "iex>" +or "...>" line(s) and is terminated either by a newline, new +"iex>" prefix or end of the string literal.

                                                                + +

                                                                Examples

                                                                + +

                                                                Currently, the only way to run doctests is to include them into +an ExUnit case with a doctest macro:

                                                                + +
                                                                defmodule MyModule.Test do
                                                                +  use ExUnit.Case, async: true
                                                                +  doctest MyModule
                                                                +end
                                                                +
                                                                + +

                                                                The doctest macro is going to loop all functions and macros +defined in MyModule, parsing their documentation in search for +code examples.

                                                                + +

                                                                A very basic example is:

                                                                + +
                                                                iex> 1+1
                                                                +2
                                                                +
                                                                + +

                                                                Multiline is also supported:

                                                                + +
                                                                iex> Enum.map [1,2,3], fn(x) ->
                                                                +...>   x * 2
                                                                +...> end
                                                                +[2,4,6]
                                                                +
                                                                + +

                                                                Similarly to iex you can use numbers in your "prompts":

                                                                + +
                                                                iex(1)> [1+2,
                                                                +...(1)>  3]
                                                                +[3,3]
                                                                +
                                                                + +

                                                                This is useful in two use cases:

                                                                + +
                                                                  +
                                                                • Being able to refer to specific numbered scenarios
                                                                • +
                                                                • Copy-pasting examples from an actual iex sessions
                                                                • +
                                                                + +

                                                                We also allow you to select or skip some functions when calling +doctest. See its documentation documentation for more info.

                                                                + +

                                                                Exceptions

                                                                + +

                                                                You can also showcase expressions raising an exception, for example:

                                                                + +
                                                                iex(1)> binary_to_atom((fn() -> 1 end).())
                                                                +** (ArgumentError) argument error
                                                                +
                                                                + +

                                                                What DocTest will be looking for is a line starting with "** (" and it +will parse it accordingly to extract the exception name and the message. +At this moment, the exception parser would make the parser treat the next +line as a start of a completely new expression (if it is prefixed with iex>) +or a no-op line with documentation. Thus, multiline messages are not +supported.

                                                                + +

                                                                When not to use doctest

                                                                + +

                                                                In general, doctests are not recommended when your code examples contain +side effects. For example, if a doctest prints to standard output, doctest +will not try to capture the output.

                                                                + +

                                                                Similarly, doctest does not run in any kind of side box. So any module +defined in a code example is going to linger throughout the whole test suite +run.

                                                                + +
                                                                + + + Source + + + + + + + + +

                                                                Macros summary

                                                                + + + + + + + + +
                                                                +

                                                                Macros

                                                                +
                                                                +

                                                                + doctest(mod, opts // []) +

                                                                +

                                                                This macro is used to generate ExUnit test cases for doctests.

                                                                + +

                                                                There are three ways this macro can be used:

                                                                + +
                                                                  +
                                                                • doctest(Module) — will generate tests for all doctests found +in the module Module
                                                                • +
                                                                + +

                                                                Options can also be supplied:

                                                                + +
                                                                  +
                                                                • :except — generate tests for all functions except those listed + (list of {function, arity} tuples)

                                                                • +
                                                                • :only — generate tests only forfunctions listed + (list of {function, arity} tuples)

                                                                • +
                                                                • :import — when true, one can test a function defined in the module + without referring to the module name. However, this is not + feasible when there is a clash with a number module like + Kernel. In these cases, import should be set to false + and a full M.f construct should be used.

                                                                • +
                                                                + +

                                                                Examples

                                                                + +
                                                                doctest MyModule, except: [trick_fun: 1]
                                                                +
                                                                + +

                                                                This macro is auto-imported into every ExUnit.Case.

                                                                +
                                                                + + Source + +
                                                                +
                                                                + + + +
                                                                + + diff --git a/docs/master/ExUnit.Test.html b/docs/master/ExUnit.Test.html new file mode 100644 index 000000000..534bebb47 --- /dev/null +++ b/docs/master/ExUnit.Test.html @@ -0,0 +1,81 @@ + + + + ExUnit.Test + + + + + + + + + + + + +
                                                                +

                                                                + ExUnit.Test + + record + +

                                                                + + +
                                                                +

                                                                A record that keeps information about the test. +It is received by formatters and also accessible +in the metadata under the key :test.

                                                                + +
                                                                + + + Source + + + + +

                                                                Fields (and defaults)

                                                                +
                                                                  + +
                                                                • + + name: nil + +
                                                                • + +
                                                                • + + case: nil + +
                                                                • + +
                                                                • + + failure: nil + +
                                                                • + +
                                                                + + + + + + + + + + + + + +
                                                                + + From 9ba3dd5ea0421553c3e1ef4bf0e211902ec414f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Tue, 16 Apr 2013 20:18:14 -0700 Subject: [PATCH 380/437] Update top.html --- _includes/top.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_includes/top.html b/_includes/top.html index 14bb01209..8ecce51fa 100644 --- a/_includes/top.html +++ b/_includes/top.html @@ -32,7 +32,7 @@

                                                                - +

                                                              From d2731aa082afba16925dc6c36ca9587306416f8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Fri, 19 Apr 2013 09:01:06 -0600 Subject: [PATCH 381/437] Google Summer of Code 2013 blog post --- ...13-04-19-google-summer-of-code-2013.markdown | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 _posts/2013-04-19-google-summer-of-code-2013.markdown diff --git a/_posts/2013-04-19-google-summer-of-code-2013.markdown b/_posts/2013-04-19-google-summer-of-code-2013.markdown new file mode 100644 index 000000000..f351b0990 --- /dev/null +++ b/_posts/2013-04-19-google-summer-of-code-2013.markdown @@ -0,0 +1,17 @@ +--- +layout: post +title: Google Summer of Code 2013 +author: José Valim +category: Announcements +excerpt: Elixir is taking part of Google Summer of Code 2013! Are you a student? Join us! +--- + +We are pleased to announce that Elixir is taking part of Google Summer of Code 2013 as member of the [BEAM Community](http://beamcommunity.github.io). This means that students all around the world can get paid to work on Elixir during the summer! + +The rules require students to be enrolled full or part-time, to be at least 18 years old on or before May 27, 2013. You can find more information on [Google Summer of Code 2013 website](http://www.google-melange.com/gsoc/homepage/google/gsoc2013). + +We have put up [a list of ideas we would like to see and explore in Elixir](https://github.com/beamcommunity/beamcommunity.github.com/wiki/Project:-Elixir) that students can use as a basis, but students are also free to send their own proposals. If your proposal gets accepted, Google will pay you $5000 over the course of three months to work on your proposal. Student can start submitting their proposals on April 22 and the deadline is May 23. + +Note the [BEAM Community](http://beamcommunity.github.io) hosts other projects on the Erlang VM, so don't forget to check them out too! + +We hope to work with you during this summer! If you have more questions, feel free to e-mail the [BEAM Community mailing list](https://groups.google.com/d/forum/beam-community) or talk to us on `#beam-community` on irc.freenode.net. From d1b208c137ce515a0c3a0bfc5fa5827cb413afa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Fri, 19 Apr 2013 10:09:11 -0600 Subject: [PATCH 382/437] Wrap on 80 lines to make review easier --- ...-04-19-google-summer-of-code-2013.markdown | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/_posts/2013-04-19-google-summer-of-code-2013.markdown b/_posts/2013-04-19-google-summer-of-code-2013.markdown index f351b0990..8ee91dc43 100644 --- a/_posts/2013-04-19-google-summer-of-code-2013.markdown +++ b/_posts/2013-04-19-google-summer-of-code-2013.markdown @@ -6,12 +6,23 @@ category: Announcements excerpt: Elixir is taking part of Google Summer of Code 2013! Are you a student? Join us! --- -We are pleased to announce that Elixir is taking part of Google Summer of Code 2013 as member of the [BEAM Community](http://beamcommunity.github.io). This means that students all around the world can get paid to work on Elixir during the summer! +We are pleased to announce that Elixir is taking part of Google Summer of Code 2013 +as member of the [BEAM Community](http://beamcommunity.github.io). This means that +students all around the world can get paid to work on Elixir during the summer! -The rules require students to be enrolled full or part-time, to be at least 18 years old on or before May 27, 2013. You can find more information on [Google Summer of Code 2013 website](http://www.google-melange.com/gsoc/homepage/google/gsoc2013). +The rules require students to be enrolled in college full or part-time, and to be +at least 18 years by May 27, 2013. You can find more information on +[Google Summer of Code 2013 website](http://www.google-melange.com/gsoc/homepage/google/gsoc2013). -We have put up [a list of ideas we would like to see and explore in Elixir](https://github.com/beamcommunity/beamcommunity.github.com/wiki/Project:-Elixir) that students can use as a basis, but students are also free to send their own proposals. If your proposal gets accepted, Google will pay you $5000 over the course of three months to work on your proposal. Student can start submitting their proposals on April 22 and the deadline is May 23. +We have put up [a list of ideas we would like to see and explore in Elixir](https://github.com/beamcommunity/beamcommunity.github.com/wiki/Project:-Elixir) +that students can use as a basis, but students are also free to send their own +proposals. If your proposal gets accepted, Google will pay you $5000 over the +course of three months to work on Elixir. Students can start submitting their +proposals on April 22 and the deadline is May 23. -Note the [BEAM Community](http://beamcommunity.github.io) hosts other projects on the Erlang VM, so don't forget to check them out too! +Note the [BEAM Community](http://beamcommunity.github.io) hosts other projects +on the Erlang VM, so don't forget to check them out too! -We hope to work with you during this summer! If you have more questions, feel free to e-mail the [BEAM Community mailing list](https://groups.google.com/d/forum/beam-community) or talk to us on `#beam-community` on irc.freenode.net. +We hope to work with you during this summer! If you have more questions, feel free +to e-mail the [BEAM Community mailing list](https://groups.google.com/d/forum/beam-community) +or talk to us on `#beam-community` on irc.freenode.net. From a2051df9a8ac828d9e0a73fc84b2bf775f2d7b28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Fri, 19 Apr 2013 10:19:36 -0600 Subject: [PATCH 383/437] More fixes --- _posts/2013-04-19-google-summer-of-code-2013.markdown | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/_posts/2013-04-19-google-summer-of-code-2013.markdown b/_posts/2013-04-19-google-summer-of-code-2013.markdown index 8ee91dc43..9622226ca 100644 --- a/_posts/2013-04-19-google-summer-of-code-2013.markdown +++ b/_posts/2013-04-19-google-summer-of-code-2013.markdown @@ -3,10 +3,10 @@ layout: post title: Google Summer of Code 2013 author: José Valim category: Announcements -excerpt: Elixir is taking part of Google Summer of Code 2013! Are you a student? Join us! +excerpt: Elixir is taking part in Google Summer of Code 2013! Are you a student? Join us! --- -We are pleased to announce that Elixir is taking part of Google Summer of Code 2013 +We are pleased to announce that Elixir is taking part in Google Summer of Code 2013 as member of the [BEAM Community](http://beamcommunity.github.io). This means that students all around the world can get paid to work on Elixir during the summer! @@ -14,7 +14,7 @@ The rules require students to be enrolled in college full or part-time, and to b at least 18 years by May 27, 2013. You can find more information on [Google Summer of Code 2013 website](http://www.google-melange.com/gsoc/homepage/google/gsoc2013). -We have put up [a list of ideas we would like to see and explore in Elixir](https://github.com/beamcommunity/beamcommunity.github.com/wiki/Project:-Elixir) +We have published [a list of ideas we would like to see and explore in Elixir](https://github.com/beamcommunity/beamcommunity.github.com/wiki/Project:-Elixir) that students can use as a basis, but students are also free to send their own proposals. If your proposal gets accepted, Google will pay you $5000 over the course of three months to work on Elixir. Students can start submitting their @@ -24,5 +24,5 @@ Note the [BEAM Community](http://beamcommunity.github.io) hosts other projects on the Erlang VM, so don't forget to check them out too! We hope to work with you during this summer! If you have more questions, feel free -to e-mail the [BEAM Community mailing list](https://groups.google.com/d/forum/beam-community) +to join the [BEAM Community mailing list](https://groups.google.com/d/forum/beam-community) or talk to us on `#beam-community` on irc.freenode.net. From f384edb793f68084e3306a4cf8650b80cad57397 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Fri, 19 Apr 2013 10:21:47 -0600 Subject: [PATCH 384/437] BEAM Community rewrite --- _posts/2013-04-19-google-summer-of-code-2013.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_posts/2013-04-19-google-summer-of-code-2013.markdown b/_posts/2013-04-19-google-summer-of-code-2013.markdown index 9622226ca..b025579f6 100644 --- a/_posts/2013-04-19-google-summer-of-code-2013.markdown +++ b/_posts/2013-04-19-google-summer-of-code-2013.markdown @@ -20,8 +20,8 @@ proposals. If your proposal gets accepted, Google will pay you $5000 over the course of three months to work on Elixir. Students can start submitting their proposals on April 22 and the deadline is May 23. -Note the [BEAM Community](http://beamcommunity.github.io) hosts other projects -on the Erlang VM, so don't forget to check them out too! +Note the BEAM Community serves as a mentoring organization for many other projects +that run on the Erlang VM, including Elixir. To see the full list, [visit the website](http://beamcommunity.github.io). We hope to work with you during this summer! If you have more questions, feel free to join the [BEAM Community mailing list](https://groups.google.com/d/forum/beam-community) From f43dcc8e74aa69fcb6c12516d0041f5c1f106543 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sat, 20 Apr 2013 17:53:11 -0600 Subject: [PATCH 385/437] Elixir v0.8.2 released --- docs/master/Code.html | 28 +- docs/master/Enum.Iterator.Function.html | 6 +- docs/master/Enum.Iterator.List.html | 6 +- docs/master/Enum.Iterator.html | 58 +- docs/master/Enum.html | 62 +- docs/master/GenEvent.Behaviour.html | 104 ++ docs/master/Kernel.html | 165 +-- docs/master/Macro.html | 41 +- docs/master/index.html | 2 +- docs/master/modules_list.html | 34 +- docs/master/protocols_list.html | 2 +- docs/master/records_list.html | 2 +- docs/stable/Access.Atom.html | 8 +- docs/stable/Access.Function.html | 8 +- docs/stable/Access.HashDict.html | 8 +- docs/stable/Access.List.html | 16 +- docs/stable/Access.html | 8 +- docs/stable/BadArityError.html | 6 +- docs/stable/BadFunctionError.html | 6 +- docs/stable/Behaviour.html | 6 +- docs/stable/Binary.Chars.Atom.html | 6 +- docs/stable/Binary.Chars.BitString.html | 6 +- docs/stable/Binary.Chars.List.html | 12 +- docs/stable/Binary.Chars.Number.html | 8 +- docs/stable/Binary.Chars.html | 8 +- docs/stable/Binary.Inspect.Atom.html | 17 +- docs/stable/Binary.Inspect.BitString.html | 14 +- docs/stable/Binary.Inspect.Function.html | 8 +- docs/stable/Binary.Inspect.HashDict.html | 8 +- docs/stable/Binary.Inspect.List.html | 17 +- docs/stable/Binary.Inspect.Number.html | 11 +- docs/stable/Binary.Inspect.PID.html | 8 +- docs/stable/Binary.Inspect.Port.html | 8 +- docs/stable/Binary.Inspect.Range.html | 6 +- docs/stable/Binary.Inspect.Reference.html | 8 +- docs/stable/Binary.Inspect.Regex.html | 11 +- docs/stable/Binary.Inspect.Tuple.html | 14 +- docs/stable/Binary.Inspect.html | 8 +- docs/stable/Bitwise.html | 68 +- docs/stable/CaseClauseError.html | 6 +- docs/stable/Code.LoadError.html | 6 +- docs/stable/Code.html | 114 +- docs/stable/CompileError.html | 6 +- docs/stable/Dict.html | 266 ++-- docs/stable/EEx.Engine.html | 14 +- docs/stable/EEx.SmartEngine.html | 10 +- docs/stable/EEx.html | 28 +- docs/stable/Enum.Iterator.Function.html | 12 +- docs/stable/Enum.Iterator.HashDict.html | 12 +- docs/stable/Enum.Iterator.List.html | 12 +- docs/stable/Enum.Iterator.Range.html | 10 +- docs/stable/Enum.Iterator.html | 66 +- docs/stable/Enum.html | 312 +++-- docs/stable/ErlangError.html | 6 +- docs/stable/ExUnit.Assertions.html | 76 +- docs/stable/ExUnit.CLIFormatter.html | 68 +- docs/stable/ExUnit.Callbacks.html | 18 +- docs/stable/ExUnit.Case.html | 6 +- docs/stable/ExUnit.CaseTemplate.html | 6 +- docs/stable/ExUnit.DocTest.html | 193 +++ docs/stable/ExUnit.ExpectationError.html | 25 +- docs/stable/ExUnit.Formatter.html | 44 +- docs/stable/ExUnit.Test.html | 81 ++ docs/stable/ExUnit.html | 50 +- docs/stable/Exception.html | 22 +- docs/stable/File.CopyError.html | 6 +- docs/stable/File.Error.html | 6 +- docs/stable/File.IteratorError.html | 6 +- docs/stable/File.html | 219 ++- docs/stable/FunctionClauseError.html | 6 +- docs/stable/GenEvent.Behaviour.html | 104 ++ docs/stable/HashDict.html | 74 +- docs/stable/IEx.Autocomplete.html | 6 +- docs/stable/IEx.Helpers.html | 94 +- docs/stable/IEx.Remsh.html | 6 +- docs/stable/IEx.html | 22 +- docs/stable/IO.ANSI.html | 210 ++- docs/stable/IO.html | 46 +- docs/stable/Kernel.CLI.html | 6 +- docs/stable/Kernel.ParallelCompiler.html | 10 +- docs/stable/Kernel.ParallelRequire.html | 6 +- docs/stable/Kernel.SpecialForms.html | 233 ++-- docs/stable/Kernel.Typespec.html | 68 +- docs/stable/Kernel.html | 1408 ++++++++++++++------ docs/stable/KeyError.html | 6 +- docs/stable/Keyword.html | 165 ++- docs/stable/List.Chars.Atom.html | 6 +- docs/stable/List.Chars.BitString.html | 6 +- docs/stable/List.Chars.List.html | 6 +- docs/stable/List.Chars.Number.html | 6 +- docs/stable/List.Chars.html | 8 +- docs/stable/List.Dict.html | 70 +- docs/stable/List.html | 197 +-- docs/stable/Macro.Env.html | 18 +- docs/stable/Macro.html | 110 +- docs/stable/MatchError.html | 6 +- docs/stable/Mix.Deps.html | 42 +- docs/stable/Mix.Generator.html | 24 +- docs/stable/Mix.InvalidTaskError.html | 6 +- docs/stable/Mix.Local.html | 14 +- docs/stable/Mix.NoTaskError.html | 6 +- docs/stable/Mix.OutOfDateDepsError.html | 6 +- docs/stable/Mix.Project.html | 22 +- docs/stable/Mix.SCM.html | 52 +- docs/stable/Mix.Shell.IO.html | 18 +- docs/stable/Mix.Shell.Process.html | 22 +- docs/stable/Mix.Shell.html | 24 +- docs/stable/Mix.Task.html | 48 +- docs/stable/Mix.Tasks.App.Start.html | 6 +- docs/stable/Mix.Tasks.Clean.html | 6 +- docs/stable/Mix.Tasks.Compile.App.html | 6 +- docs/stable/Mix.Tasks.Compile.Elixir.html | 6 +- docs/stable/Mix.Tasks.Compile.Erlang.html | 18 +- docs/stable/Mix.Tasks.Compile.Leex.html | 6 +- docs/stable/Mix.Tasks.Compile.Yecc.html | 6 +- docs/stable/Mix.Tasks.Compile.html | 6 +- docs/stable/Mix.Tasks.Deps.Check.html | 6 +- docs/stable/Mix.Tasks.Deps.Clean.html | 6 +- docs/stable/Mix.Tasks.Deps.Compile.html | 6 +- docs/stable/Mix.Tasks.Deps.Get.html | 6 +- docs/stable/Mix.Tasks.Deps.Loadpaths.html | 6 +- docs/stable/Mix.Tasks.Deps.Unlock.html | 6 +- docs/stable/Mix.Tasks.Deps.Update.html | 6 +- docs/stable/Mix.Tasks.Deps.html | 6 +- docs/stable/Mix.Tasks.Do.html | 6 +- docs/stable/Mix.Tasks.Escriptize.html | 6 +- docs/stable/Mix.Tasks.Help.html | 6 +- docs/stable/Mix.Tasks.Loadpaths.html | 6 +- docs/stable/Mix.Tasks.Local.Install.html | 6 +- docs/stable/Mix.Tasks.Local.Uninstall.html | 6 +- docs/stable/Mix.Tasks.Local.html | 6 +- docs/stable/Mix.Tasks.New.html | 6 +- docs/stable/Mix.Tasks.Run.html | 6 +- docs/stable/Mix.Tasks.Test.html | 9 +- docs/stable/Mix.Utils.html | 54 +- docs/stable/Mix.html | 30 +- docs/stable/Module.html | 119 +- docs/stable/Node.html | 58 +- docs/stable/OptionParser.html | 42 +- docs/stable/Path.html | 172 ++- docs/stable/Port.html | 38 +- docs/stable/Process.html | 126 +- docs/stable/Protocol.UndefinedError.html | 6 +- docs/stable/Range.Iterator.Number.html | 10 +- docs/stable/Range.Iterator.html | 12 +- docs/stable/Record.html | 70 +- docs/stable/Regex.html | 115 +- docs/stable/String.html | 379 ++++-- docs/stable/Supervisor.Behaviour.html | 14 +- docs/stable/SyntaxError.html | 6 +- docs/stable/System.html | 78 +- docs/stable/TokenMissingError.html | 6 +- docs/stable/URI.FTP.html | 10 +- docs/stable/URI.HTTP.html | 10 +- docs/stable/URI.HTTPS.html | 10 +- docs/stable/URI.LDAP.html | 10 +- docs/stable/URI.Parser.html | 10 +- docs/stable/URI.SFTP.html | 10 +- docs/stable/URI.TFTP.html | 10 +- docs/stable/URI.html | 26 +- docs/stable/UndefinedFunctionError.html | 6 +- docs/stable/index.html | 2 +- docs/stable/modules_list.html | 170 ++- docs/stable/protocols_list.html | 2 +- docs/stable/records_list.html | 20 +- packages.html | 1 + 166 files changed, 5214 insertions(+), 2304 deletions(-) create mode 100644 docs/master/GenEvent.Behaviour.html create mode 100644 docs/stable/ExUnit.DocTest.html create mode 100644 docs/stable/ExUnit.Test.html create mode 100644 docs/stable/GenEvent.Behaviour.html diff --git a/docs/master/Code.html b/docs/master/Code.html index ee791a161..350120b65 100644 --- a/docs/master/Code.html +++ b/docs/master/Code.html @@ -50,6 +50,11 @@

                                                              Functions summary

                                                              append_path/1
                                                            • +
                                                            • + + compile_quoted/2 + +
                                                            • compile_string/2 @@ -156,6 +161,17 @@

                                                              Functions

                                                              Source +
                                                              +

                                                              + compile_quoted(quoted, file // "nofile") +

                                                              +

                                                              Compiles the quoted expression and returns a list of tuples where +the first element is the module name and the second one is its +binary.

                                                              +
                                                              + + Source +

                                                              compile_string(string, file // "nofile") @@ -228,7 +244,7 @@

                                                              Functions

                                                              and when to use ensure_loaded/1 or ensure_compiled/1.

                                                              - Source + Source

                                                              @@ -238,7 +254,7 @@

                                                              Functions

                                                              it could be ensured or not.

                                                              - Source + Source

                                                              @@ -282,7 +298,7 @@

                                                              Code.ensure_compiled

                                                              that needs to invoke a module for callback information.

                                                              - Source + Source

                                                              @@ -292,7 +308,7 @@

                                                              Code.ensure_compiled

                                                              it could be ensured or not.

                                                              - Source + Source

                                                              @@ -430,8 +446,8 @@

                                                              Examples

                                                              string_to_ast(string, opts // [])

                                                              -

                                                              Converts the given string to AST. It returns { :ok, ast } -if it succeeds, { :error, { line, error, token } } otherwise.

                                                              +

                                                              Converts the given string to AST. It returns { :ok, ast } +if it succeeds, { :error, { line, error, token } } otherwise.

                                                              Options

                                                              diff --git a/docs/master/Enum.Iterator.Function.html b/docs/master/Enum.Iterator.Function.html index e0da8a50a..a45c90549 100644 --- a/docs/master/Enum.Iterator.Function.html +++ b/docs/master/Enum.Iterator.Function.html @@ -29,7 +29,7 @@

                                                              - Source + Source @@ -65,7 +65,7 @@

                                                              Functions

                                                              - Source + Source

                                                              @@ -73,7 +73,7 @@

                                                              Functions

                                                              - Source + Source
                                                              diff --git a/docs/master/Enum.Iterator.List.html b/docs/master/Enum.Iterator.List.html index 9e201a3ca..3a93fb259 100644 --- a/docs/master/Enum.Iterator.List.html +++ b/docs/master/Enum.Iterator.List.html @@ -29,7 +29,7 @@

                                                              - Source + Source @@ -65,7 +65,7 @@

                                                              Functions

                                                              - Source + Source

                                                              @@ -73,7 +73,7 @@

                                                              Functions

                                                              - Source + Source
                                                              diff --git a/docs/master/Enum.Iterator.html b/docs/master/Enum.Iterator.html index 73b1e0d41..a543dd0e2 100644 --- a/docs/master/Enum.Iterator.html +++ b/docs/master/Enum.Iterator.html @@ -29,18 +29,19 @@

                                                              -

                                                              This is the protocol used by the Enum module. -Usually, when you invoke a function in the module Enum, -the first argument passed to Enum is a collection which -is forwarded to this protocol in order to retrieve information -on how to iterate the collection. That said, when:

                                                              +

                                                              This is the protocol used by the Enum module.

                                                              + +

                                                              Usually, when you invoke a function in the module Enum, the first argument +passed to it is a collection which is forwarded to this protocol in order to +retrieve information on how to iterate the collection.

                                                              + +

                                                              For example, in the expression

                                                              Enum.map [1,2,3], &1 * 2
                                                               
                                                              -

                                                              Is invoked, it invokes Enum.Iterator.iterator([1,2,3]) -which returns all the information required by Enum. -Read each function documentation below for more information.

                                                              +

                                                              Enum.map invokes Enum.Iterator.iterator([1,2,3]) to retrieve the iterator +function that will drive the iteration process.

                                                              @@ -108,46 +109,47 @@

                                                              Functions

                                                              count(collection)

                                                              -

                                                              The function used to retrieve the collection size.

                                                              +

                                                              The function used to retrieve the collection's size.

                                                              - Source + Source

                                                              iterator(collection)

                                                              -

                                                              Iteration in Elixir happens with the help of a iterator -function. Every time this function is called, it must -return a tuple with two elements. The first element -is the next item and the second can be any Elixir term -which the function is going to receive as argument the -next time it is invoked.

                                                              +

                                                              This function must return a tuple of the form { iter, step } where +iter is a function that yields successive values from the collection +each time it is invoked and step is the first step of iteration.

                                                              -

                                                              When there are no more items to be iterated, the function -must return the atom :stop.

                                                              +

                                                              Iteration in Elixir happens with the help of an iterator function (named +iter in the paragraph above). When it is invoked, it must return a tuple +with two elements. The first element is the next successive value from the +collection and the second element can be any Elixir term which iter is +going to receive as its argument the next time it is invoked.

                                                              -

                                                              In order to retrieve this iterator function, Elixir invokes -Enum.Iterator.iterator(collection) which should return a -tuple with two elements: the first element is the iterator -function and the second is the first step of iteration.

                                                              +

                                                              When there are no more items left to yield, iter must return the atom +:stop.

                                                              -

                                                              As an example, here is the implementation of iterator for lists:

                                                              +

                                                              As an example, here is the implementation of iterator for lists:

                                                              def iterator(list),   do: { iterate(&1), iterate(list) }
                                                               defp iterate([h|t]),  do: { h, t }
                                                               defp iterate([]),     do: :stop
                                                               
                                                              +

                                                              Here, iterate is the iterator function and { h, t } is a step of +iteration.

                                                              +

                                                              Iterating lists

                                                              -

                                                              If a data structure needs to be converted to a list in order -to be iterated, the iterator function can simply return the -list and the Enum module will be able to take over the list -and retrieve the proper iterator function.

                                                              +

                                                              As a special case, if a data structure needs to be converted to a list in +order to be iterated, iterator can simply return the list and the Enum +module will be able to take over the list and produce a proper iterator +function for it.

                                                              - Source + Source
                                                              diff --git a/docs/master/Enum.html b/docs/master/Enum.html index f751041e2..ef65abe4a 100644 --- a/docs/master/Enum.html +++ b/docs/master/Enum.html @@ -42,7 +42,7 @@

                                                              - Source + Source @@ -239,7 +239,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -267,7 +267,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -290,7 +290,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -305,7 +305,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -314,7 +314,7 @@

                                                              Examples

                                                              Counts for how many items the function returns true.

                                                              - Source + Source

                                                              @@ -334,7 +334,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -350,7 +350,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -366,7 +366,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -383,7 +383,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -399,7 +399,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -414,7 +414,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -436,7 +436,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -457,7 +457,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -476,7 +476,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -493,7 +493,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -519,7 +519,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -542,7 +542,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -568,7 +568,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -589,7 +589,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -606,7 +606,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -623,7 +623,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -638,7 +638,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -653,7 +653,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -668,7 +668,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -698,7 +698,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -713,7 +713,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -733,7 +733,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -749,7 +749,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -764,7 +764,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -776,7 +776,7 @@

                                                              Examples

                                                              values are filled with nil.

                                                              - Source + Source diff --git a/docs/master/GenEvent.Behaviour.html b/docs/master/GenEvent.Behaviour.html new file mode 100644 index 000000000..ace9b1c6a --- /dev/null +++ b/docs/master/GenEvent.Behaviour.html @@ -0,0 +1,104 @@ + + + + GenEvent.Behaviour + + + + + + + + + + + + +
                                                              +

                                                              + GenEvent.Behaviour + +

                                                              + + +
                                                              +

                                                              This module is a convenience to define GenEvent callbacks in Elixir.

                                                              + +

                                                              GenEvent is an OTP behaviour that encapsulates event handling functionality.

                                                              + +

                                                              Example

                                                              + +

                                                              Bellow follows an example of a GenEvent that stores notifications +until they are fetched:

                                                              + +
                                                              defmodule MyEventHandler do
                                                              +  use GenEvent.Behaviour
                                                              +
                                                              +  # Callbacks
                                                              +
                                                              +  def init(_) do
                                                              +    { :ok, [] }
                                                              +  end
                                                              +
                                                              +  def handle_event({:notification, x}, notifications) do
                                                              +    { :ok, [x|notifications] }
                                                              +  end
                                                              +
                                                              +  def handle_call(:notifications, notifications) do
                                                              +    {:ok, Enum.reverse(notifications), []}
                                                              +  end
                                                              +
                                                              +end
                                                              +
                                                              +{ :ok, pid } = :gen_event.start_link
                                                              +
                                                              +:gen_event.add_handler(pid, MyEventHandler, [])
                                                              +
                                                              +:gen_event.notify(pid, {:notification, 1})
                                                              +:gen_event.notify(pid, {:notification, 2})
                                                              +
                                                              +:gen_event.call(pid, MyEventHandler, :notifications)
                                                              +#=> [1, 2]
                                                              +
                                                              +:gen_event.call(pid, MyEventHandler, :notifications)
                                                              +#=> []
                                                              +
                                                              + +

                                                              Notice we never call the server callbacks directly, they are called +by OTP whenever we interact with the server.

                                                              + +

                                                              Starting and sending messages to gen_event is done +via Erlang's :gen_event module. For more information, +please refer to the following:

                                                              + +

                                                              http://www.erlang.org/doc/man/gen_event.html +http://learnyousomeerlang.com/event-handlers

                                                              + +
                                                              + + + Source + + + + + + + + + + + + + + + + +
                                                              + + diff --git a/docs/master/Kernel.html b/docs/master/Kernel.html index 9bac708fd..239331a7f 100644 --- a/docs/master/Kernel.html +++ b/docs/master/Kernel.html @@ -718,11 +718,6 @@

                                                              Macros summary

                                                              function/1
                                                            • -
                                                            • - - function/2 - -
                                                            • function/3 @@ -1144,7 +1139,7 @@

                                                              Examples

                                                              information.

                                                              - Source + Source

                                                              @@ -1557,7 +1552,7 @@

                                                              Examples

                                                              information.

                                                              - Source + Source

                                                              @@ -1678,7 +1673,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -1701,7 +1696,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -1730,7 +1725,7 @@

                                                              Examples

                                                              may change the System.stacktrace value.

                                                              - Source + Source

                                                              @@ -2026,7 +2021,7 @@

                                                              Examples

                                                              not only booleans, however it is not allowed in guards.

                                                              - Source + Source

                                                              @@ -2130,7 +2125,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -2221,7 +2216,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -2282,7 +2277,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -2364,7 +2359,7 @@

                                                              Examples

                                                              to manipulate module attributes.

                                                              - Source + Source

                                                              @@ -2382,7 +2377,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -2400,7 +2395,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -2416,7 +2411,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -2440,7 +2435,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -2458,7 +2453,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -2476,7 +2471,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -2491,7 +2486,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -2518,7 +2513,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -2587,7 +2582,7 @@

                                                              Atoms

                                                              In this case, "Hello" will be printed twice (one per each field).

                                                              - Source + Source

                                                              @@ -2649,7 +2644,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -2665,7 +2660,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -2684,7 +2679,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -2699,7 +2694,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -2714,7 +2709,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -2730,7 +2725,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -2785,7 +2780,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -2807,7 +2802,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -2924,7 +2919,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -3440,7 +3435,7 @@

                                                              Examples

                                                              it will raise a CaseClauseError.

                                                              - Source + Source

                                                              @@ -3492,7 +3487,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -3515,15 +3510,16 @@

                                                              Examples

                                                              - Source + Source

                                                              function(args)

                                                              -

                                                              Returns an anonymous function based on the given arguments.

                                                              +

                                                              Construct an anonymous function based on the given expression +or retrieve an existing one.

                                                              -

                                                              Examples

                                                              +

                                                              Function composition

                                                              iex> sum = function do
                                                               ...>   (x, y) -> x + y
                                                              @@ -3546,6 +3542,27 @@ 

                                                              Examples

                                                              3
                                                              +

                                                              All clauses must expect the same number of arguments.

                                                              + +

                                                              Function retrieval

                                                              + +

                                                              The function macro can also be used to retrieve local, imported +and remote functions.

                                                              + +
                                                              # Retrieve local/import
                                                              +iex> f = function(is_atom/1)
                                                              +iex> f.(:foo)
                                                              +true
                                                              +
                                                              +# Retrieve remote
                                                              +iex> f = function(Kernel.is_atom/1)
                                                              +iex> f.(:foo)
                                                              +true
                                                              +
                                                              + +

                                                              In case a function needs to be dynamically retrieved based on its +module, name or arity, use function/3 instead.

                                                              +

                                                              Shortcut syntax

                                                              In order to reduce verbosity, functions in Elixir can be written @@ -3587,51 +3604,13 @@

                                                              Shortcut syntax

                                                              - Source - -
                                                              -

                                                              - function(function, arity) -

                                                              -

                                                              Retrieves a local or an imported function.

                                                              - -

                                                              Examples

                                                              - -
                                                              iex> f = function(:is_atom, 1)
                                                              -...> f.(:foo)
                                                              -true
                                                              -
                                                              - -

                                                              Notice that local functions cannot be retrieved dynamically, -the following, for example, wouldn't work:

                                                              - -
                                                              some_fun = :is_atom
                                                              -function(some_fun, 1)
                                                              -
                                                              - -

                                                              In such cases, one should use function/3:

                                                              - -
                                                              some_fun = :is_atom
                                                              -function(SomeModule, some_fun, 1)
                                                              -
                                                              - -

                                                              Shortcut syntax

                                                              - -

                                                              One can use a shortcut syntax to retrieve such functions, -that resembles Erlang's fun:

                                                              - -
                                                              f = function(is_atom/1)
                                                              -f.(:foo)
                                                              -
                                                              -
                                                              - - Source + Source

                                                              function(module, function, arity)

                                                              -

                                                              Retrieves a function from a module.

                                                              +

                                                              Retrieves a function with given name and arity from a module.

                                                              Examples

                                                              @@ -3639,19 +3618,9 @@

                                                              Examples

                                                              ...> f.(:foo) true - -

                                                              Shortcut syntax

                                                              - -

                                                              One can use a shortcut syntax to retrieve such functions, -that resembles Erlang's fun:

                                                              - -
                                                              iex> f = function(Kernel.is_atom/1)
                                                              -...> f.(:foo)
                                                              -true
                                                              -
                                                              - Source + Source

                                                              @@ -3697,7 +3666,7 @@

                                                              Blocks examples

                                                              macro.

                                                              - Source + Source

                                                              @@ -3742,7 +3711,7 @@

                                                              Clauses

                                                              the variable for us.

                                                              - Source + Source

                                                              @@ -3814,7 +3783,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -3830,7 +3799,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -4025,7 +3994,7 @@

                                                              Examples

                                                            - Source + Source

                                                            @@ -4209,7 +4178,7 @@

                                                            Variable visibility

                                                            - Source + Source

                                                            @@ -4220,7 +4189,7 @@

                                                            Variable visibility

                                                            and documentation.

                                                            - Source + Source

                                                            @@ -4316,7 +4285,7 @@

                                                            Examples

                                                            - Source + Source

                                                            @@ -4343,7 +4312,7 @@

                                                            Examples

                                                            not only booleans, however it is not allowed in guards.

                                                            - Source + Source diff --git a/docs/master/Macro.html b/docs/master/Macro.html index a07303c79..a4861ebae 100644 --- a/docs/master/Macro.html +++ b/docs/master/Macro.html @@ -42,11 +42,6 @@

                                                            Functions summary

                                                            • - - do_safe_term/1 - -
                                                            • -
                                                            • escape/1 @@ -118,14 +113,6 @@

                                                              Macros summary

                                                              Functions

                                                              -

                                                              - do_safe_term(terms) -

                                                              -
                                                              - - Source - -

                                                              escape(expr)

                                                              @@ -244,7 +231,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -279,7 +266,7 @@

                                                              Examples

                                                              which is returned as { :unsafe, term }.

                                                              - Source + Source

                                                              @@ -294,7 +281,7 @@

                                                              Examples

                                                              - Source + Source

                                                              @@ -329,8 +316,8 @@

                                                              Examples

                                                              unescape_binary(chars, map)

                                                              Unescape the given chars according to the map given. -Check unescape/1 if you want to use the same map as -Elixir single- and double-quoted strings.

                                                              +Check unescape_binary/1 if you want to use the same map +as Elixir single- and double-quoted strings.

                                                              Map

                                                              @@ -379,24 +366,26 @@

                                                              Examples

                                                              unescape_tokens(tokens)

                                                              Unescape the given tokens according to the default map. -Check unescape/1 and unescape/2 for more information -about unescaping. Only tokens that are binaries are -unescaped, all others are ignored. This function is useful -when implementing your own sigils. Check the implementation -of Kernel.__b__ for examples.

                                                              +Check unescape_binary/1 and unescape_binary/2 for more +information about unescaping.

                                                              + +

                                                              Only tokens that are binaries are unescaped, all others are +ignored. This function is useful when implementing your own +sigils. Check the implementation of Kernel.__b__ +for examples.

                                                              - Source + Source

                                                              unescape_tokens(tokens, map)

                                                              Unescape the given tokens according to the given map. -Check unescape_tokens/1 and unescaped/2 for more information.

                                                              +Check unescape_tokens/1 and unescape_binary/2 for more information.

                                                              - Source + Source
                                                              diff --git a/docs/master/index.html b/docs/master/index.html index 106a4e59d..dcfbc64c0 100644 --- a/docs/master/index.html +++ b/docs/master/index.html @@ -3,7 +3,7 @@ - Elixir v0.8.2.dev Documentation + Elixir v0.8.2 Documentation diff --git a/docs/master/modules_list.html b/docs/master/modules_list.html index ff79f6ad6..9c0517820 100644 --- a/docs/master/modules_list.html +++ b/docs/master/modules_list.html @@ -16,7 +16,7 @@
                                                            • +
                                                            • + + compile_quoted/2 + + Code +
                                                            • +
                                                            • compile_string/2 @@ -1677,6 +1684,17 @@

                                                              File

                                                            • +
                                                            +
                                                          • + + + GenEvent.Behaviour + + GenEvent.Behaviour +
                                                          • +
                                                              + +
                                                          • @@ -3329,13 +3347,6 @@

                                                            Kernel

                                                          • -
                                                          • - - function/2 - - Kernel -
                                                          • -
                                                          • function/3 @@ -4339,13 +4350,6 @@

                                                            Macro

                                                          • -
                                                          • - - do_safe_term/1 - - Macro -
                                                          • -
                                                          • escape/1 diff --git a/docs/master/protocols_list.html b/docs/master/protocols_list.html index 1c4ee0aa5..305562548 100644 --- a/docs/master/protocols_list.html +++ b/docs/master/protocols_list.html @@ -16,7 +16,7 @@

                                                            - Elixir v0.8.2.dev + Elixir v0.8.2

                                                            diff --git a/docs/stable/Access.Function.html b/docs/stable/Access.Function.html index 3641fcbf8..6c3b1811f 100644 --- a/docs/stable/Access.Function.html +++ b/docs/stable/Access.Function.html @@ -29,14 +29,14 @@

                                                            - Source + Source -

                                                            Functions summary

                                                            +

                                                            Functions summary

                                                            • @@ -63,7 +63,9 @@

                                                              Functions

                                                              is useful because it allows a function to be passed as argument in places a dict would also fit.

                                                            - Source + + Source + diff --git a/docs/stable/Access.HashDict.html b/docs/stable/Access.HashDict.html index 803c01df3..1fc3e6a9b 100644 --- a/docs/stable/Access.HashDict.html +++ b/docs/stable/Access.HashDict.html @@ -29,14 +29,14 @@

                                                            - Source + Source -

                                                            Functions summary

                                                            +

                                                            Functions summary

                                                            • @@ -59,7 +59,9 @@

                                                              Functions

                                                              access(dict, key)

                                                              - Source + + Source + diff --git a/docs/stable/Access.List.html b/docs/stable/Access.List.html index 4392d3825..039f84ecc 100644 --- a/docs/stable/Access.List.html +++ b/docs/stable/Access.List.html @@ -36,7 +36,7 @@

                                                              -

                                                              Functions summary

                                                              +

                                                              Functions summary

                                                              • @@ -62,14 +62,18 @@

                                                                Functions

                                                                Examples

                                                                -
                                                                keywords = [a: 1, b: 2]
                                                                -keywords[:a] #=> 1
                                                                +
                                                                iex> keywords = [a: 1, b: 2]
                                                                +...> keywords[:a]
                                                                +1
                                                                 
                                                                -star_ratings = [{1.0, "★"}, {1.5, "★☆"}, {2.0, "★★"}]
                                                                -star_ratings[1.5] #=> "★☆"
                                                                +iex> star_ratings = [{1.0, "★"}, {1.5, "★☆"}, {2.0, "★★"}]
                                                                +...> star_ratings[1.5]
                                                                +"★☆"
                                                                 
                                                                - Source + + Source + diff --git a/docs/stable/Access.html b/docs/stable/Access.html index 05836aec8..f5c601309 100644 --- a/docs/stable/Access.html +++ b/docs/stable/Access.html @@ -43,7 +43,7 @@

                                                                Source -

                                                                Implementations

                                                                +

                                                                Implementations

                                                                • @@ -76,7 +76,7 @@

                                                                  Implementations

                                                                  -

                                                                  Functions summary

                                                                  +

                                                                  Functions summary

                                                                  • @@ -100,7 +100,9 @@

                                                                    Functions

                                                                    Receives the element being accessed and the access item.

                                                                    - Source + + Source + diff --git a/docs/stable/BadArityError.html b/docs/stable/BadArityError.html index 610242362..3c67ceecf 100644 --- a/docs/stable/BadArityError.html +++ b/docs/stable/BadArityError.html @@ -53,7 +53,7 @@

                                                                    Fields (and defaults)

                                                                    -

                                                                    Functions summary

                                                                    +

                                                                    Functions summary

                                                                    • @@ -76,7 +76,9 @@

                                                                      Functions

                                                                      message(exception)

                                                                      - Source + + Source + diff --git a/docs/stable/BadFunctionError.html b/docs/stable/BadFunctionError.html index f797d80fc..a9e50c445 100644 --- a/docs/stable/BadFunctionError.html +++ b/docs/stable/BadFunctionError.html @@ -47,7 +47,7 @@

                                                                      Fields (and defaults)

                                                                      -

                                                                      Functions summary

                                                                      +

                                                                      Functions summary

                                                                      • @@ -70,7 +70,9 @@

                                                                        Functions

                                                                        message(exception)

                                                                        - Source + + Source + diff --git a/docs/stable/Behaviour.html b/docs/stable/Behaviour.html index 055e314b0..9d1511984 100644 --- a/docs/stable/Behaviour.html +++ b/docs/stable/Behaviour.html @@ -82,7 +82,7 @@

                                                                        Implementation

                                                                        -

                                                                        Macros summary

                                                                        +

                                                                        Macros summary

                                                                        • @@ -106,7 +106,9 @@

                                                                          Macros

                                                                          Defines a callback according to the given type specification.

                                                                          - Source + + Source + diff --git a/docs/stable/Binary.Chars.Atom.html b/docs/stable/Binary.Chars.Atom.html index 0a7726df0..b8ca4a619 100644 --- a/docs/stable/Binary.Chars.Atom.html +++ b/docs/stable/Binary.Chars.Atom.html @@ -36,7 +36,7 @@

                                                                          -

                                                                          Functions summary

                                                                          +

                                                                          Functions summary

                                                                          • @@ -61,7 +61,9 @@

                                                                            Functions

                                                                            Convert the atom literally to a binary, except nil which is converted to an empty string.

                                                                            - Source + + Source + diff --git a/docs/stable/Binary.Chars.BitString.html b/docs/stable/Binary.Chars.BitString.html index 2e297c089..dd6c9da4b 100644 --- a/docs/stable/Binary.Chars.BitString.html +++ b/docs/stable/Binary.Chars.BitString.html @@ -36,7 +36,7 @@

                                                                            -

                                                                            Functions summary

                                                                            +

                                                                            Functions summary

                                                                            • @@ -60,7 +60,9 @@

                                                                              Functions

                                                                              Simply returns the binary itself.

                                                                              - Source + + Source + diff --git a/docs/stable/Binary.Chars.List.html b/docs/stable/Binary.Chars.List.html index f1276dc7d..b86e507aa 100644 --- a/docs/stable/Binary.Chars.List.html +++ b/docs/stable/Binary.Chars.List.html @@ -36,7 +36,7 @@

                                                                              -

                                                                              Functions summary

                                                                              +

                                                                              Functions summary

                                                                              • @@ -65,11 +65,15 @@

                                                                                Functions

                                                                                Examples

                                                                                -
                                                                                to_binary 'foo' #=> "foo"
                                                                                -to_binary ["foo", 'bar'] #=> "foobar"
                                                                                +
                                                                                iex> to_binary 'foo'
                                                                                +"foo"
                                                                                +iex> to_binary ["foo", 'bar']
                                                                                +"foobar"
                                                                                 
                                                                                - Source + + Source + diff --git a/docs/stable/Binary.Chars.Number.html b/docs/stable/Binary.Chars.Number.html index 8880de46d..a9d1f0680 100644 --- a/docs/stable/Binary.Chars.Number.html +++ b/docs/stable/Binary.Chars.Number.html @@ -29,14 +29,14 @@

                                                                                - Source + Source -

                                                                                Functions summary

                                                                                +

                                                                                Functions summary

                                                                                • @@ -60,7 +60,9 @@

                                                                                  Functions

                                                                                  Simply converts the number (integer or a float) to a binary.

                                                                                  - Source + + Source + diff --git a/docs/stable/Binary.Chars.html b/docs/stable/Binary.Chars.html index c2bccad36..e3b444ff9 100644 --- a/docs/stable/Binary.Chars.html +++ b/docs/stable/Binary.Chars.html @@ -46,7 +46,7 @@

                                                                                  Source -

                                                                                  Implementations

                                                                                  +

                                                                                  Implementations

                                                                                  • @@ -79,7 +79,7 @@

                                                                                    Implementations

                                                                                    -

                                                                                    Functions summary

                                                                                    +

                                                                                    Functions summary

                                                                                    • @@ -102,7 +102,9 @@

                                                                                      Functions

                                                                                      to_binary(thing)

                                                                                      - Source + + Source + diff --git a/docs/stable/Binary.Inspect.Atom.html b/docs/stable/Binary.Inspect.Atom.html index a8e5c73e8..c3456d59b 100644 --- a/docs/stable/Binary.Inspect.Atom.html +++ b/docs/stable/Binary.Inspect.Atom.html @@ -38,22 +38,25 @@

                                                                                      Examples

                                                                                      -
                                                                                      inspect(:foo)    #=> ":foo"
                                                                                      -inspect(nil)     #=> "nil"
                                                                                      -inspect(Foo.Bar) #=> "Foo.Bar"
                                                                                      +
                                                                                      iex> inspect(:foo)
                                                                                      +":foo"
                                                                                      +iex> inspect(nil)
                                                                                      +"nil"
                                                                                      +iex> inspect(Foo.Bar)
                                                                                      +"Foo.Bar"
                                                                                       
                                                                                      - Source + Source -

                                                                                      Functions summary

                                                                                      +

                                                                                      Functions summary

                                                                                      • @@ -76,7 +79,9 @@

                                                                                        Functions

                                                                                        inspect(atom, _)

                                                                                        - Source + + Source + diff --git a/docs/stable/Binary.Inspect.BitString.html b/docs/stable/Binary.Inspect.BitString.html index 29b836854..ae68fda85 100644 --- a/docs/stable/Binary.Inspect.BitString.html +++ b/docs/stable/Binary.Inspect.BitString.html @@ -34,21 +34,23 @@

                                                                                        Examples

                                                                                        -
                                                                                        inspect("bar")   #=> "bar"
                                                                                        -inspect("f\"oo") #=> "f\"oo"
                                                                                        +
                                                                                        iex> inspect("bar")
                                                                                        +"\"bar\""
                                                                                        +iex> inspect("f\"oo")
                                                                                        +"\"f\\\"oo\""
                                                                                         
                                                                                        - Source + Source -

                                                                                        Functions summary

                                                                                        +

                                                                                        Functions summary

                                                                                        • @@ -71,7 +73,9 @@

                                                                                          Functions

                                                                                          inspect(thing, opts)

                                                                                          - Source + + Source + diff --git a/docs/stable/Binary.Inspect.Function.html b/docs/stable/Binary.Inspect.Function.html index 594a95d4d..fda8c6e1a 100644 --- a/docs/stable/Binary.Inspect.Function.html +++ b/docs/stable/Binary.Inspect.Function.html @@ -34,14 +34,14 @@

                                                                                          - Source + Source -

                                                                                          Functions summary

                                                                                          +

                                                                                          Functions summary

                                                                                          • @@ -64,7 +64,9 @@

                                                                                            Functions

                                                                                            inspect(function, _opts)

                                                                                            - Source + + Source + diff --git a/docs/stable/Binary.Inspect.HashDict.html b/docs/stable/Binary.Inspect.HashDict.html index 8310a21b1..537eb06a9 100644 --- a/docs/stable/Binary.Inspect.HashDict.html +++ b/docs/stable/Binary.Inspect.HashDict.html @@ -29,14 +29,14 @@

                                                                                            - Source + Source -

                                                                                            Functions summary

                                                                                            +

                                                                                            Functions summary

                                                                                            • @@ -59,7 +59,9 @@

                                                                                              Functions

                                                                                              inspect(dict, opts)

                                                                                              - Source + + Source + diff --git a/docs/stable/Binary.Inspect.List.html b/docs/stable/Binary.Inspect.List.html index f6bb1fe73..c33640502 100644 --- a/docs/stable/Binary.Inspect.List.html +++ b/docs/stable/Binary.Inspect.List.html @@ -41,22 +41,25 @@

                                                                                              Examples

                                                                                              -
                                                                                              inspect('bar')       #=> 'bar'
                                                                                              -inspect([0|'bar'])   #=> "[0,98,97,114]"
                                                                                              -inspect([:foo,:bar]) #=> "[:foo, :bar]"
                                                                                              +
                                                                                              iex> inspect('bar')
                                                                                              +"'bar'"
                                                                                              +iex> inspect([0|'bar'])
                                                                                              +"[0,98,97,114]"
                                                                                              +iex> inspect([:foo,:bar])
                                                                                              +"[:foo,:bar]"
                                                                                               
                                                                                              - Source + Source -

                                                                                              Functions summary

                                                                                              +

                                                                                              Functions summary

                                                                                              • @@ -79,7 +82,9 @@

                                                                                                Functions

                                                                                                inspect(thing, opts)

                                                                                                - Source + + Source + diff --git a/docs/stable/Binary.Inspect.Number.html b/docs/stable/Binary.Inspect.Number.html index 71c96d6f9..5bcb50ae8 100644 --- a/docs/stable/Binary.Inspect.Number.html +++ b/docs/stable/Binary.Inspect.Number.html @@ -33,20 +33,21 @@

                                                                                                Examples

                                                                                                -
                                                                                                inspect(1) #=> "1"
                                                                                                +
                                                                                                iex> inspect(1)
                                                                                                +"1"
                                                                                                 
                                                                                                - Source + Source -

                                                                                                Functions summary

                                                                                                +

                                                                                                Functions summary

                                                                                                • @@ -69,7 +70,9 @@

                                                                                                  Functions

                                                                                                  inspect(thing, _)

                                                                                                  - Source + + Source + diff --git a/docs/stable/Binary.Inspect.PID.html b/docs/stable/Binary.Inspect.PID.html index 523c5e439..6d4c3d956 100644 --- a/docs/stable/Binary.Inspect.PID.html +++ b/docs/stable/Binary.Inspect.PID.html @@ -34,14 +34,14 @@

                                                                                                  - Source + Source -

                                                                                                  Functions summary

                                                                                                  +

                                                                                                  Functions summary

                                                                                                  • @@ -64,7 +64,9 @@

                                                                                                    Functions

                                                                                                    inspect(pid, _)

                                                                                                    - Source + + Source + diff --git a/docs/stable/Binary.Inspect.Port.html b/docs/stable/Binary.Inspect.Port.html index 8aafdc3d8..18cbf0c1b 100644 --- a/docs/stable/Binary.Inspect.Port.html +++ b/docs/stable/Binary.Inspect.Port.html @@ -34,14 +34,14 @@

                                                                                                    - Source + Source -

                                                                                                    Functions summary

                                                                                                    +

                                                                                                    Functions summary

                                                                                                    • @@ -64,7 +64,9 @@

                                                                                                      Functions

                                                                                                      inspect(port, _)

                                                                                                      - Source + + Source + diff --git a/docs/stable/Binary.Inspect.Range.html b/docs/stable/Binary.Inspect.Range.html index af92c4386..f4ecd5222 100644 --- a/docs/stable/Binary.Inspect.Range.html +++ b/docs/stable/Binary.Inspect.Range.html @@ -36,7 +36,7 @@

                                                                                                      -

                                                                                                      Functions summary

                                                                                                      +

                                                                                                      Functions summary

                                                                                                      • @@ -59,7 +59,9 @@

                                                                                                        Functions

                                                                                                        inspect(arg1, opts)

                                                                                                        - Source + + Source + diff --git a/docs/stable/Binary.Inspect.Reference.html b/docs/stable/Binary.Inspect.Reference.html index 68be56e93..28c597f46 100644 --- a/docs/stable/Binary.Inspect.Reference.html +++ b/docs/stable/Binary.Inspect.Reference.html @@ -34,14 +34,14 @@

                                                                                                        - Source + Source -

                                                                                                        Functions summary

                                                                                                        +

                                                                                                        Functions summary

                                                                                                        • @@ -64,7 +64,9 @@

                                                                                                          Functions

                                                                                                          inspect(ref, _)

                                                                                                          - Source + + Source + diff --git a/docs/stable/Binary.Inspect.Regex.html b/docs/stable/Binary.Inspect.Regex.html index 78be58370..9a7a2ad44 100644 --- a/docs/stable/Binary.Inspect.Regex.html +++ b/docs/stable/Binary.Inspect.Regex.html @@ -33,20 +33,21 @@

                                                                                                          Examples

                                                                                                          -
                                                                                                          inspect(%r/foo/m) #=> "%r\"foo\"m"
                                                                                                          +
                                                                                                          iex> inspect(%r/foo/m)
                                                                                                          +"%r\"foo\"m"
                                                                                                           
                                                                                                          - Source + Source -

                                                                                                          Functions summary

                                                                                                          +

                                                                                                          Functions summary

                                                                                                          • @@ -69,7 +70,9 @@

                                                                                                            Functions

                                                                                                            inspect(regex, opts)

                                                                                                            - Source + + Source + diff --git a/docs/stable/Binary.Inspect.Tuple.html b/docs/stable/Binary.Inspect.Tuple.html index 871a750c5..ca9699b61 100644 --- a/docs/stable/Binary.Inspect.Tuple.html +++ b/docs/stable/Binary.Inspect.Tuple.html @@ -34,21 +34,23 @@

                                                                                                            Examples

                                                                                                            -
                                                                                                            inspect({1,2,3})            #=> "{1,2,3}"
                                                                                                            -inspect(ArgumentError.new)  #=> ArgumentError[message: "argument error"]
                                                                                                            +
                                                                                                            iex> inspect({1,2,3})
                                                                                                            +"{1,2,3}"
                                                                                                            +iex> inspect(ArgumentError.new)
                                                                                                            +"ArgumentError[message: \"argument error\"]"
                                                                                                             
                                                                                                            - Source + Source -

                                                                                                            Functions summary

                                                                                                            +

                                                                                                            Functions summary

                                                                                                            • @@ -71,7 +73,9 @@

                                                                                                              Functions

                                                                                                              inspect(tuple, opts)

                                                                                                              - Source + + Source + diff --git a/docs/stable/Binary.Inspect.html b/docs/stable/Binary.Inspect.html index f24fb214b..7989caba7 100644 --- a/docs/stable/Binary.Inspect.html +++ b/docs/stable/Binary.Inspect.html @@ -43,7 +43,7 @@

                                                                                                              Source -

                                                                                                              Implementations

                                                                                                              +

                                                                                                              Implementations

                                                                                                              • @@ -124,7 +124,7 @@

                                                                                                                Implementations

                                                                                                                -

                                                                                                                Functions summary

                                                                                                                +

                                                                                                                Functions summary

                                                                                                                • @@ -147,7 +147,9 @@

                                                                                                                  Functions

                                                                                                                  inspect(thing, opts)

                                                                                                                  - Source + + Source + diff --git a/docs/stable/Bitwise.html b/docs/stable/Bitwise.html index 5b1a86f55..17e6ffdcf 100644 --- a/docs/stable/Bitwise.html +++ b/docs/stable/Bitwise.html @@ -33,16 +33,20 @@

                                                                                                                  The easiest way to use is to simply import them into your module:

                                                                                                                  -
                                                                                                                  use Bitwise
                                                                                                                  +
                                                                                                                  iex> use Bitwise
                                                                                                                  +...> bnot 1
                                                                                                                  +-2
                                                                                                                   
                                                                                                                  -bnot 1   #=> -2
                                                                                                                  -1 &&& 1  #=> 1
                                                                                                                  +iex> use Bitwise
                                                                                                                  +...> 1 &&& 1
                                                                                                                  +1
                                                                                                                   

                                                                                                                  You can select to include only or skip operators by passing options:

                                                                                                                  -
                                                                                                                  use Bitwise, only_operators: true
                                                                                                                  -1 &&& 1 #=> 1
                                                                                                                  +
                                                                                                                  iex> use Bitwise, only_operators: true
                                                                                                                  +...> 1 &&& 1
                                                                                                                  +1
                                                                                                                   
                                                                                                                  @@ -57,7 +61,7 @@

                                                                                                                  -

                                                                                                                  Macros summary

                                                                                                                  +

                                                                                                                  Macros summary

                                                                                                                  • @@ -141,28 +145,36 @@

                                                                                                                    Macros

                                                                                                                    Bitwise and as operator.

                                                                                                                    - Source + + Source +

                                                                                                                    left <<< right

                                                                                                                    Arithmetic bitshift left as operator.

                                                                                                                    - Source + + Source +

                                                                                                                    left >>> right

                                                                                                                    Arithmetic bitshift right as operator.

                                                                                                                    - Source + + Source +

                                                                                                                    left ^^^ right

                                                                                                                    Bitwise xor as operator.

                                                                                                                    - Source + + Source +

                                                                                                                    __using__(options) @@ -175,63 +187,81 @@

                                                                                                                    Macros

                                                                                                                  • :skip_operators - Skip operators;
                                                                                                                  - Source + + Source +

                                                                                                                  band(left, right)

                                                                                                                  Bitwise and.

                                                                                                                  - Source + + Source +

                                                                                                                  bnot(expr)

                                                                                                                  Bitwise not.

                                                                                                                  - Source + + Source +

                                                                                                                  bor(left, right)

                                                                                                                  Bitwise or.

                                                                                                                  - Source + + Source +

                                                                                                                  bsl(left, right)

                                                                                                                  Arithmetic bitshift left.

                                                                                                                  - Source + + Source +

                                                                                                                  bsr(left, right)

                                                                                                                  Arithmetic bitshift right.

                                                                                                                  - Source + + Source +

                                                                                                                  bxor(left, right)

                                                                                                                  Bitwise xor.

                                                                                                                  - Source + + Source +

                                                                                                                  left ||| right

                                                                                                                  Bitwise or as operator.

                                                                                                                  - Source + + Source +

                                                                                                                  ~~~(expr)

                                                                                                                  Bitwise not as operator.

                                                                                                                  - Source + + Source +
                                                                                                                  diff --git a/docs/stable/CaseClauseError.html b/docs/stable/CaseClauseError.html index baf5b128a..c55f70bcc 100644 --- a/docs/stable/CaseClauseError.html +++ b/docs/stable/CaseClauseError.html @@ -47,7 +47,7 @@

                                                                                                                  Fields (and defaults)

                                                                                                                  -

                                                                                                                  Functions summary

                                                                                                                  +

                                                                                                                  Functions summary

                                                                                                                  • @@ -70,7 +70,9 @@

                                                                                                                    Functions

                                                                                                                    message(exception)

                                                                                                                    - Source + + Source + diff --git a/docs/stable/Code.LoadError.html b/docs/stable/Code.LoadError.html index d4388adca..32c74822a 100644 --- a/docs/stable/Code.LoadError.html +++ b/docs/stable/Code.LoadError.html @@ -47,7 +47,7 @@

                                                                                                                    Fields (and defaults)

                                                                                                                    -

                                                                                                                    Functions summary

                                                                                                                    +

                                                                                                                    Functions summary

                                                                                                                    • @@ -70,7 +70,9 @@

                                                                                                                      Functions

                                                                                                                      message(exception)

                                                                                                                      - Source + + Source + diff --git a/docs/stable/Code.html b/docs/stable/Code.html index d8ddfbd97..350120b65 100644 --- a/docs/stable/Code.html +++ b/docs/stable/Code.html @@ -43,13 +43,18 @@

                                                                                                                      -

                                                                                                                      Functions summary

                                                                                                                      +

                                                                                                                      Functions summary

                                                                                                                      • append_path/1
                                                                                                                      • +
                                                                                                                      • + + compile_quoted/2 + +
                                                                                                                      • compile_string/2 @@ -153,7 +158,20 @@

                                                                                                                        Functions

                                                                                                                        Appends a path to Erlang VM code path. The path is expanded with Path.expand before added.

                                                                                                                        - Source + + Source + +
                                                                                                                        +

                                                                                                                        + compile_quoted(quoted, file // "nofile") +

                                                                                                                        +

                                                                                                                        Compiles the quoted expression and returns a list of tuples where +the first element is the module name and the second one is its +binary.

                                                                                                                        +
                                                                                                                        + + Source +

                                                                                                                        compile_string(string, file // "nofile") @@ -164,7 +182,9 @@

                                                                                                                        Functions

                                                                                                                        For compiling many files at once, check Kernel.ParallelCompiler.

                                                                                                                        - Source + + Source +

                                                                                                                        compiler_options() @@ -172,7 +192,9 @@

                                                                                                                        Functions

                                                                                                                        Loads the compilation options from the code server. Check compiler_options/1 for more information.

                                                                                                                        - Source + + Source +

                                                                                                                        compiler_options(opts) @@ -192,7 +214,9 @@

                                                                                                                        Functions

                                                                                                                        without raising errors, false by default;
                                                                                                                      - Source + + Source +

                                                                                                                      delete_path(path) @@ -200,7 +224,9 @@

                                                                                                                      Functions

                                                                                                                      Deletes a path from Erlang VM code path. The path is expanded with Path.expand before deleted.

                                                                                                                      - Source + + Source +

                                                                                                                      ensure_compiled(module) @@ -217,7 +243,9 @@

                                                                                                                      Functions

                                                                                                                      Check ensure_loaded/1 for more information on module loading and when to use ensure_loaded/1 or ensure_compiled/1.

                                                                                                                      - Source + + Source +

                                                                                                                      ensure_compiled?(module) @@ -225,7 +253,9 @@

                                                                                                                      Functions

                                                                                                                      Similar to ensure_compiled/1, but returns a boolean in case it could be ensured or not.

                                                                                                                      - Source + + Source +

                                                                                                                      ensure_loaded(module) @@ -267,7 +297,9 @@

                                                                                                                      Code.ensure_compiled

                                                                                                                      must be used just in same rare conditions, usually involving macros that needs to invoke a module for callback information.

                                                                                                                      - Source + + Source +

                                                                                                                      ensure_loaded?(module) @@ -275,7 +307,9 @@

                                                                                                                      Code.ensure_compiled

                                                                                                                      Similar to ensure_loaded/1, but returns a boolean in case it could be ensured or not.

                                                                                                                      - Source + + Source +

                                                                                                                      eval(string, binding // [], opts // []) @@ -310,19 +344,21 @@

                                                                                                                      Code.ensure_compiled

                                                                                                                      Examples

                                                                                                                      -
                                                                                                                      Code.eval "a + b", [a: 1, b: 2], file: __ENV__.file, line: __ENV__.line
                                                                                                                      -#=> { 3, [ {:a, 1}, {:b, 2} ] }
                                                                                                                      +
                                                                                                                      iex> Code.eval "a + b", [a: 1, b: 2], file: __ENV__.file, line: __ENV__.line
                                                                                                                      +{ 3, [ {:a, 1}, {:b, 2} ] }
                                                                                                                       

                                                                                                                      For convenience, you can my pass __ENV__ as argument and all imports, requires and aliases will be automatically carried over:

                                                                                                                      -
                                                                                                                      Code.eval "a + b", [a: 1, b: 2], __ENV__
                                                                                                                      -#=> { 3, [ {:a, 1}, {:b, 2} ] }
                                                                                                                      +
                                                                                                                      iex> Code.eval "a + b", [a: 1, b: 2], __ENV__
                                                                                                                      +{ 3, [ {:a, 1}, {:b, 2} ] }
                                                                                                                       
                                                                                                                      - Source + + Source +

                                                                                                                      eval_quoted(quoted, binding // [], opts // []) @@ -334,20 +370,22 @@

                                                                                                                      Examples

                                                                                                                      Examples

                                                                                                                      -
                                                                                                                      contents = quote hygiene: false, do: a + b
                                                                                                                      -
                                                                                                                      -Code.eval_quoted contents, [a: 1, b: 2], file: __ENV__.file, line: __ENV__.line
                                                                                                                      -#=> { 3, [ {:a, 1}, {:b, 2} ] }
                                                                                                                      +
                                                                                                                      iex> contents = quote hygiene: [vars: false], do: a + b
                                                                                                                      +...> Code.eval_quoted contents, [a: 1, b: 2], file: __ENV__.file, line: __ENV__.line
                                                                                                                      +{ 3, [ {:a, 1}, {:b, 2} ] }
                                                                                                                       

                                                                                                                      For convenience, you can my pass __ENV__ as argument and all options will be automatically extracted from the environment:

                                                                                                                      -
                                                                                                                      Code.eval_quoted contents, [a: 1, b: 2], __ENV__
                                                                                                                      -#=> { 3, [ {:a, 1}, {:b, 2} ] }
                                                                                                                      +
                                                                                                                      iex> contents = quote hygiene: [vars: false], do: a + b
                                                                                                                      +...> Code.eval_quoted contents, [a: 1, b: 2], __ENV__
                                                                                                                      +{ 3, [ {:a, 1}, {:b, 2} ] }
                                                                                                                       
                                                                                                                      - Source + + Source +

                                                                                                                      load_file(file, relative_to // nil) @@ -363,14 +401,18 @@

                                                                                                                      Examples

                                                                                                                      a given file, the given file will be loaded N times. Check require_file if you don't want a file to be loaded concurrently.

                                                                                                                      - Source + + Source +

                                                                                                                      loaded_files()

                                                                                                                      Returns all the loaded files.

                                                                                                                      - Source + + Source +

                                                                                                                      prepend_path(path) @@ -378,7 +420,9 @@

                                                                                                                      Examples

                                                                                                                      Prepends a path to Erlang VM code path. The path is expanded with Path.expand before added.

                                                                                                                      - Source + + Source +

                                                                                                                      require_file(file, relative_to // nil) @@ -395,13 +439,15 @@

                                                                                                                      Examples

                                                                                                                      file, the given file will be loaded only once. Check load_file if you want a file to be loaded concurrently.

                                                                                                                      - Source + + Source +

                                                                                                                      string_to_ast(string, opts // [])

                                                                                                                      -

                                                                                                                      Converts the given string to AST. It returns { :ok, ast } -if it succeeds, { :error, { line, error, token } } otherwise.

                                                                                                                      +

                                                                                                                      Converts the given string to AST. It returns { :ok, ast } +if it succeeds, { :error, { line, error, token } } otherwise.

                                                                                                                      Options

                                                                                                                      @@ -413,7 +459,9 @@

                                                                                                                      Options

                                                                                                                      when non-existing atoms are found by the tokenizer.

                                                                                                                    - Source + + Source +

                                                                                                                    string_to_ast!(string, opts // []) @@ -425,7 +473,9 @@

                                                                                                                    Options

                                                                                                                    Check Code.string_to_ast/2 for options information.

                                                                                                                    - Source + + Source +

                                                                                                                    unload_files(files) @@ -435,7 +485,9 @@

                                                                                                                    Options

                                                                                                                    calling this function only removes it from the list, allowing it to be required again.

                                                                                                                    - Source + + Source + diff --git a/docs/stable/CompileError.html b/docs/stable/CompileError.html index 4adb8976b..18c9dbc33 100644 --- a/docs/stable/CompileError.html +++ b/docs/stable/CompileError.html @@ -59,7 +59,7 @@

                                                                                                                    Fields (and defaults)

                                                                                                                    -

                                                                                                                    Functions summary

                                                                                                                    +

                                                                                                                    Functions summary

                                                                                                                    • @@ -82,7 +82,9 @@

                                                                                                                      Functions

                                                                                                                      message(exception)

                                                                                                                      - Source + + Source + diff --git a/docs/stable/Dict.html b/docs/stable/Dict.html index c9c8c0318..734ed8134 100644 --- a/docs/stable/Dict.html +++ b/docs/stable/Dict.html @@ -43,13 +43,29 @@

                                                                                                                      For simplicity's sake, in the examples below everytime new is used, it implies one of the module-specific -calls like the two above. Likewise, when the result of -a function invocation is shown in the form [a: 1, b: 2], -it implies that the returned value is actually of the -same dict type as the input one.

                                                                                                                      +calls like above. Likewise, when the result of a function +invocation is shown in the form [a: 1, b: 2], it implies +that the returned value is actually of the same dict type +as the input one.

                                                                                                                      -

                                                                                                                      Keep in mind that all dicts are also required to -implement both Access and Enum.Iterator protocols.

                                                                                                                      +

                                                                                                                      Protocols

                                                                                                                      + +

                                                                                                                      Besides implementing the functions in this module, all +dictionaries are also required to implement the Access +protocol:

                                                                                                                      + +
                                                                                                                      iex> dict = HashDict.new
                                                                                                                      +...> dict = Dict.put dict, :hello, :world
                                                                                                                      +...> dict[:hello]
                                                                                                                      +:world
                                                                                                                      +
                                                                                                                      + +

                                                                                                                      And also the Enum.Iterator protocol, allowing one to write:

                                                                                                                      + +
                                                                                                                      Enum.each dict, fn { k, v } ->
                                                                                                                      +  IO.puts "#{k}: #{v}"
                                                                                                                      +end
                                                                                                                      +
                                                                                                                      @@ -61,7 +77,7 @@

                                                                                                                      -

                                                                                                                      Functions summary

                                                                                                                      +

                                                                                                                      Functions summary

                                                                                                                      • @@ -145,7 +161,7 @@

                                                                                                                        Functions summary

                                                                                                                        -

                                                                                                                        Callbacks summary

                                                                                                                        +

                                                                                                                        Callbacks summary

                                                                                                                        • @@ -243,21 +259,28 @@

                                                                                                                          Functions

                                                                                                                          Examples

                                                                                                                          -
                                                                                                                          d = new [a: 1, b: 2]
                                                                                                                          -Dict.delete d, :a      #=> [b: 2]
                                                                                                                          +
                                                                                                                          iex> d = HashDict.new [a: 1, b: 2]
                                                                                                                          +...> d = Dict.delete d, :a
                                                                                                                          +...> Dict.get d, :a
                                                                                                                          +nil
                                                                                                                           
                                                                                                                          -d = new [b: 2]
                                                                                                                          -Dict.delete d, :a      #=> [b: 2]
                                                                                                                          +iex> d = HashDict.new [b: 2]
                                                                                                                          +...> Dict.delete(d, :a) == d
                                                                                                                          +true
                                                                                                                           
                                                                                                                          - Source + + Source +

                                                                                                                          empty(dict)

                                                                                                                          Returns an empty dict of the same type as dict.

                                                                                                                          - Source + + Source +

                                                                                                                          get(dict, key, default // nil) @@ -267,13 +290,22 @@

                                                                                                                          Examples

                                                                                                                          Examples

                                                                                                                          -
                                                                                                                          d = new [a: 1]
                                                                                                                          -Dict.get d, :a     #=> 1
                                                                                                                          -Dict.get d, :b     #=> nil
                                                                                                                          -Dict.get d, :b, 3  #=> 3
                                                                                                                          +
                                                                                                                          iex> d = HashDict.new [a: 1]
                                                                                                                          +...> Dict.get d, :a
                                                                                                                          +1
                                                                                                                          +
                                                                                                                          +iex> d = HashDict.new [a: 1]
                                                                                                                          +...> Dict.get d, :b
                                                                                                                          +nil
                                                                                                                          +
                                                                                                                          +iex> d = HashDict.new [a: 1]
                                                                                                                          +...> Dict.get d, :b, 3
                                                                                                                          +3
                                                                                                                           
                                                                                                                          - Source + + Source +

                                                                                                                          get!(dict, key) @@ -283,12 +315,17 @@

                                                                                                                          Examples

                                                                                                                          Examples

                                                                                                                          -
                                                                                                                          d = new [a: 1]
                                                                                                                          -Dict.get d, :a     #=> 1
                                                                                                                          -Dict.get d, :b     #=> raises KeyError[key: :b]
                                                                                                                          +
                                                                                                                          iex> d = HashDict.new [a: 1]
                                                                                                                          +...> Dict.get d, :a
                                                                                                                          +1
                                                                                                                          +iex> d = HashDict.new [a: 1]
                                                                                                                          +...> Dict.get! d, :b
                                                                                                                          +** (KeyError) key not found: :b
                                                                                                                           
                                                                                                                          - Source + + Source +

                                                                                                                          has_key?(dict, key) @@ -297,12 +334,18 @@

                                                                                                                          Examples

                                                                                                                          Examples

                                                                                                                          -
                                                                                                                          d = new [a: 1]
                                                                                                                          -Dict.has_key?(d, :a)  #=> true
                                                                                                                          -Dict.has_key?(d, :b)  #=> false
                                                                                                                          +
                                                                                                                          iex> d = HashDict.new [a: 1]
                                                                                                                          +...> Dict.has_key?(d, :a)
                                                                                                                          +true
                                                                                                                          +
                                                                                                                          +iex> d = HashDict.new [a: 1]
                                                                                                                          +...> Dict.has_key?(d, :b)
                                                                                                                          +false
                                                                                                                           
                                                                                                                          - Source + + Source +

                                                                                                                          keys(dict) @@ -313,11 +356,14 @@

                                                                                                                          Examples

                                                                                                                          Examples

                                                                                                                          -
                                                                                                                          d = new [a: 1, b: 2]
                                                                                                                          -Dict.keys d  #=> [:a,:b]
                                                                                                                          +
                                                                                                                          iex> d = HashDict.new [a: 1, b: 2]
                                                                                                                          +...> Enum.sort Dict.keys d
                                                                                                                          +[:a,:b]
                                                                                                                           
                                                                                                                          - Source + + Source +

                                                                                                                          merge(dict, enum) @@ -327,13 +373,16 @@

                                                                                                                          Examples

                                                                                                                          Examples

                                                                                                                          -
                                                                                                                          d1 = new [a: 1, b: 2]
                                                                                                                          -d2 = new [a: 3, d: 4]
                                                                                                                          -Dict.merge d1, d2
                                                                                                                          -#=> [a: 3, b: 2, d: 4]
                                                                                                                          +
                                                                                                                          iex> d1 = HashDict.new [a: 1, b: 2]
                                                                                                                          +...> d2 = HashDict.new [a: 3, d: 4]
                                                                                                                          +...> d = Dict.merge d1, d2
                                                                                                                          +...> [a: Dict.get(d, :a), b: Dict.get(d, :b), d: Dict.get(d, :d)]
                                                                                                                          +[a: 3, b: 2, d: 4]
                                                                                                                           
                                                                                                                          - Source + + Source +

                                                                                                                          merge(dict, enum, fun) @@ -344,15 +393,18 @@

                                                                                                                          Examples

                                                                                                                          Examples

                                                                                                                          -
                                                                                                                          d1 = new [a: 1, b: 2]
                                                                                                                          -d2 = new [a: 3, d: 4]
                                                                                                                          -Dict.merge d1, d2, fn _k, v1, v2 ->
                                                                                                                          -  v1 + v2
                                                                                                                          -end
                                                                                                                          -#=> [a: 4, b: 2, d: 4]
                                                                                                                          +
                                                                                                                          iex> d1 = HashDict.new [a: 1, b: 2]
                                                                                                                          +...> d2 = HashDict.new [a: 3, d: 4]
                                                                                                                          +...> d = Dict.merge d1, d2, fn _k, v1, v2 ->
                                                                                                                          +...>   v1 + v2
                                                                                                                          +...> end
                                                                                                                          +...> [a: Dict.get(d, :a), b: Dict.get(d, :b), d: Dict.get(d, :d)]
                                                                                                                          +[a: 4, b: 2, d: 4]
                                                                                                                           
                                                                                                                          - Source + + Source +

                                                                                                                          put(dict, key, val) @@ -362,12 +414,15 @@

                                                                                                                          Examples

                                                                                                                          Examples

                                                                                                                          -
                                                                                                                          d = new [a: 1, b: 2]
                                                                                                                          -Dict.put d, :a, 3
                                                                                                                          -#=> [a: 3, b: 2]
                                                                                                                          +
                                                                                                                          iex> d = HashDict.new [a: 1, b: 2]
                                                                                                                          +...> d = Dict.put d, :a, 3
                                                                                                                          +...> Dict.get d, :a
                                                                                                                          +3
                                                                                                                           
                                                                                                                          - Source + + Source +

                                                                                                                          put_new(dict, key, val) @@ -376,12 +431,15 @@

                                                                                                                          Examples

                                                                                                                          Examples

                                                                                                                          -
                                                                                                                          d = new [a: 1, b: 2]
                                                                                                                          -Dict.put_new d, :a, 3
                                                                                                                          -#=> [a: 1, b: 2]
                                                                                                                          +
                                                                                                                          iex> d = HashDict.new [a: 1, b: 2]
                                                                                                                          +...> d = Dict.put_new d, :a, 3
                                                                                                                          +...> Dict.get d, :a
                                                                                                                          +1
                                                                                                                           
                                                                                                                          - Source + + Source +

                                                                                                                          size(dict) @@ -390,11 +448,14 @@

                                                                                                                          Examples

                                                                                                                          Examples

                                                                                                                          -
                                                                                                                          d = new [a: 1, b: 2]
                                                                                                                          -Dict.size d  #=> 2
                                                                                                                          +
                                                                                                                          iex> d = HashDict.new [a: 1, b: 2]
                                                                                                                          +...> Dict.size d
                                                                                                                          +2
                                                                                                                           
                                                                                                                          - Source + + Source +

                                                                                                                          to_list(dict) @@ -402,7 +463,9 @@

                                                                                                                          Examples

                                                                                                                          Returns a list of key-value pairs stored in dict. No particular order is enforced.

                                                                                                                          - Source + + Source +

                                                                                                                          update(dict, key, fun) @@ -412,12 +475,15 @@

                                                                                                                          Examples

                                                                                                                          Examples

                                                                                                                          -
                                                                                                                          d = new [a: 1, b: 2]
                                                                                                                          -Dict.update d, :a, fn val -> -val end
                                                                                                                          -#=> [a: -1, b: 2]
                                                                                                                          +
                                                                                                                          iex> d = HashDict.new [a: 1, b: 2]
                                                                                                                          +...> d = Dict.update d, :a, fn val -> -val end
                                                                                                                          +...> Dict.get d, :a
                                                                                                                          +-1
                                                                                                                           
                                                                                                                          - Source + + Source +

                                                                                                                          update(dict, key, initial, fun) @@ -428,12 +494,15 @@

                                                                                                                          Examples

                                                                                                                          Examples

                                                                                                                          -
                                                                                                                          d = new [a: 1, b: 2]
                                                                                                                          -Dict.update d, :c, 3, fn val -> -val end
                                                                                                                          -#=> [a: 1, b: 2, c: 3]
                                                                                                                          +
                                                                                                                          iex> d = HashDict.new [a: 1, b: 2]
                                                                                                                          +...> d = Dict.update d, :c, 3, fn val -> -val end
                                                                                                                          +...> Dict.get d, :c
                                                                                                                          +3
                                                                                                                           
                                                                                                                          - Source + + Source +

                                                                                                                          values(dict) @@ -442,11 +511,14 @@

                                                                                                                          Examples

                                                                                                                          Examples

                                                                                                                          -
                                                                                                                          d = new [a: 1, b: 2]
                                                                                                                          -Dict.values d  #=> [1,2]
                                                                                                                          +
                                                                                                                          iex> d = HashDict.new [a: 1, b: 2]
                                                                                                                          +...> Enum.sort Dict.values d
                                                                                                                          +[1,2]
                                                                                                                           
                                                                                                                          - Source + + Source + @@ -461,97 +533,129 @@

                                                                                                                          Callbacks

                                                                                                                          values(t())

                                                                                                                          - Source + + Source +

                                                                                                                          update(t(), key(), value(), (value() -> value()))

                                                                                                                          - Source + + Source +

                                                                                                                          update(t(), key(), (value() -> value()))

                                                                                                                          - Source + + Source +

                                                                                                                          to_list(t())

                                                                                                                          - Source + + Source +

                                                                                                                          size(t())

                                                                                                                          - Source + + Source +

                                                                                                                          put_new(t(), key(), value())

                                                                                                                          - Source + + Source +

                                                                                                                          put(t(), key(), value())

                                                                                                                          - Source + + Source +

                                                                                                                          merge(t(), t(), (key(), value(), value() -> value()))

                                                                                                                          - Source + + Source +

                                                                                                                          merge(t(), t())

                                                                                                                          - Source + + Source +

                                                                                                                          keys(t())

                                                                                                                          - Source + + Source +

                                                                                                                          has_key?(t(), key())

                                                                                                                          - Source + + Source +

                                                                                                                          get!(t(), key())

                                                                                                                          - Source + + Source +

                                                                                                                          get(t(), key(), value())

                                                                                                                          - Source + + Source +

                                                                                                                          get(t(), key())

                                                                                                                          - Source + + Source +

                                                                                                                          empty(t())

                                                                                                                          - Source + + Source +

                                                                                                                          delete(t(), key())

                                                                                                                          - Source + + Source +
                                                                                                                          diff --git a/docs/stable/EEx.Engine.html b/docs/stable/EEx.Engine.html index bfb153eee..8c2f180c2 100644 --- a/docs/stable/EEx.Engine.html +++ b/docs/stable/EEx.Engine.html @@ -59,7 +59,7 @@

                                                                                                                          -

                                                                                                                          Functions summary

                                                                                                                          +

                                                                                                                          Functions summary

                                                                                                                          • @@ -92,7 +92,9 @@

                                                                                                                            Functions

                                                                                                                            behaviour_info(atom1)

                                                                                                                            - Source + + Source +

                                                                                                                            handle_expr(buffer, list2, expr) @@ -105,14 +107,18 @@

                                                                                                                            Functions

                                                                                                                            All other markers are not implemented by this engine.

                                                                                                                            - Source + + Source +

                                                                                                                            handle_text(buffer, text)

                                                                                                                            The default implementation simply concatenates text to the buffer.

                                                                                                                            - Source + + Source +
                                                                                                                            diff --git a/docs/stable/EEx.SmartEngine.html b/docs/stable/EEx.SmartEngine.html index 4ae1cf5de..1a87e1514 100644 --- a/docs/stable/EEx.SmartEngine.html +++ b/docs/stable/EEx.SmartEngine.html @@ -41,7 +41,7 @@

                                                                                                                            -

                                                                                                                            Functions summary

                                                                                                                            +

                                                                                                                            Functions summary

                                                                                                                            • @@ -69,13 +69,17 @@

                                                                                                                              Functions

                                                                                                                              handle_expr(buffer, mark, expr)

                                                                                                                              - Source + + Source +

                                                                                                                              handle_text(buffer, text)

                                                                                                                              - Source + + Source +
                                                                                                                              diff --git a/docs/stable/EEx.html b/docs/stable/EEx.html index 8b5bc787f..1ff63367f 100644 --- a/docs/stable/EEx.html +++ b/docs/stable/EEx.html @@ -116,7 +116,7 @@

                                                                                                                              Macros

                                                                                                                              -

                                                                                                                              Functions summary

                                                                                                                              +

                                                                                                                              Functions summary

                                                                                                                              • @@ -143,7 +143,7 @@

                                                                                                                                Functions summary

                                                                                                                                -

                                                                                                                                Macros summary

                                                                                                                                +

                                                                                                                                Macros summary

                                                                                                                                • @@ -171,7 +171,9 @@

                                                                                                                                  Functions

                                                                                                                                  Get a filename and generate a quoted expression that can be evaluated by Elixir or compiled to a function.

                                                                                                                                  - Source + + Source +

                                                                                                                                  compile_string(source, options // []) @@ -179,7 +181,9 @@

                                                                                                                                  Functions

                                                                                                                                  Get a string source and generate a quoted expression that can be evaluated by Elixir or compiled to a function.

                                                                                                                                  - Source + + Source +

                                                                                                                                  eval_file(filename, bindings // [], options // []) @@ -196,7 +200,9 @@

                                                                                                                                  Examples

                                                                                                                                  #=> "foo baz"
                                                                                                                          - Source + + Source +

                                                                                                                          eval_string(source, bindings // [], options // []) @@ -209,7 +215,9 @@

                                                                                                                          Examples

                                                                                                                          #=> "foo baz"
                                                                                                                  - Source + + Source + @@ -243,7 +251,9 @@

                                                                                                                  Examples

                                                                                                                  Sample.sample(1, 2) #=> "3"
                                                                                                                  - Source + + Source +

                                                                                                                  function_from_string(kind, name, source, args // [], options // []) @@ -262,7 +272,9 @@

                                                                                                                  Examples

                                                                                                                  Sample.sample(1, 2) #=> "3"

                                                                                                            - Source + + Source + diff --git a/docs/stable/Enum.Iterator.Function.html b/docs/stable/Enum.Iterator.Function.html index b100394e3..a45c90549 100644 --- a/docs/stable/Enum.Iterator.Function.html +++ b/docs/stable/Enum.Iterator.Function.html @@ -29,14 +29,14 @@

                                                                                                            - Source + Source -

                                                                                                            Functions summary

                                                                                                            +

                                                                                                            Functions summary

                                                                                                            • @@ -64,13 +64,17 @@

                                                                                                              Functions

                                                                                                              count(function)

                                                                                                              - Source + + Source +

                                                                                                              iterator(function)

                                                                                                              - Source + + Source +
                                                                                                              diff --git a/docs/stable/Enum.Iterator.HashDict.html b/docs/stable/Enum.Iterator.HashDict.html index 151f5e591..4a5089a5e 100644 --- a/docs/stable/Enum.Iterator.HashDict.html +++ b/docs/stable/Enum.Iterator.HashDict.html @@ -29,14 +29,14 @@

                                                                                                              - Source + Source -

                                                                                                              Functions summary

                                                                                                              +

                                                                                                              Functions summary

                                                                                                              • @@ -64,13 +64,17 @@

                                                                                                                Functions

                                                                                                                count(dict)

                                                                                                                - Source + + Source +

                                                                                                                iterator(dict)

                                                                                                                - Source + + Source +
                                                                                                                diff --git a/docs/stable/Enum.Iterator.List.html b/docs/stable/Enum.Iterator.List.html index ec6727148..3a93fb259 100644 --- a/docs/stable/Enum.Iterator.List.html +++ b/docs/stable/Enum.Iterator.List.html @@ -29,14 +29,14 @@

                                                                                                                - Source + Source -

                                                                                                                Functions summary

                                                                                                                +

                                                                                                                Functions summary

                                                                                                                • @@ -64,13 +64,17 @@

                                                                                                                  Functions

                                                                                                                  count(list)

                                                                                                                  - Source + + Source +

                                                                                                                  iterator(list)

                                                                                                                  - Source + + Source +
                                                                                                                  diff --git a/docs/stable/Enum.Iterator.Range.html b/docs/stable/Enum.Iterator.Range.html index 3be0a165c..97b766cc0 100644 --- a/docs/stable/Enum.Iterator.Range.html +++ b/docs/stable/Enum.Iterator.Range.html @@ -36,7 +36,7 @@

                                                                                                                  -

                                                                                                                  Functions summary

                                                                                                                  +

                                                                                                                  Functions summary

                                                                                                                  • @@ -64,13 +64,17 @@

                                                                                                                    Functions

                                                                                                                    count(range)

                                                                                                                    - Source + + Source +

                                                                                                                    iterator(range)

                                                                                                                    - Source + + Source +
                                                                                                                    diff --git a/docs/stable/Enum.Iterator.html b/docs/stable/Enum.Iterator.html index 3e480e06d..a543dd0e2 100644 --- a/docs/stable/Enum.Iterator.html +++ b/docs/stable/Enum.Iterator.html @@ -29,18 +29,19 @@

                                                                                                                    -

                                                                                                                    This is the protocol used by the Enum module. -Usually, when you invoke a function in the module Enum, -the first argument passed to Enum is a collection which -is forwarded to this protocol in order to retrieve information -on how to iterate the collection. That said, when:

                                                                                                                    +

                                                                                                                    This is the protocol used by the Enum module.

                                                                                                                    + +

                                                                                                                    Usually, when you invoke a function in the module Enum, the first argument +passed to it is a collection which is forwarded to this protocol in order to +retrieve information on how to iterate the collection.

                                                                                                                    + +

                                                                                                                    For example, in the expression

                                                                                                                    Enum.map [1,2,3], &1 * 2
                                                                                                                     
                                                                                                                    -

                                                                                                                    Is invoked, it invokes Enum.Iterator.iterator([1,2,3]) -which returns all the information required by Enum. -Read each function documentation below for more information.

                                                                                                                    +

                                                                                                                    Enum.map invokes Enum.Iterator.iterator([1,2,3]) to retrieve the iterator +function that will drive the iteration process.

                                                                                                                    @@ -48,7 +49,7 @@

                                                                                                                    Source -

                                                                                                                    Implementations

                                                                                                                    +

                                                                                                                    Implementations

                                                                                                                    • @@ -81,7 +82,7 @@

                                                                                                                      Implementations

                                                                                                                      -

                                                                                                                      Functions summary

                                                                                                                      +

                                                                                                                      Functions summary

                                                                                                                      • @@ -108,43 +109,48 @@

                                                                                                                        Functions

                                                                                                                        count(collection)

                                                                                                                        -

                                                                                                                        The function used to retrieve the collection size.

                                                                                                                        +

                                                                                                                        The function used to retrieve the collection's size.

                                                                                                                        - Source + + Source +

                                                                                                                        iterator(collection)

                                                                                                                        -

                                                                                                                        Iteration in Elixir happens with the help of a iterator -function. Every time this function is called, it must -return a tuple with two elements. The first element -is the next item and the second can be any Elixir term -which the function is going to receive as argument the -next time it is invoked.

                                                                                                                        +

                                                                                                                        This function must return a tuple of the form { iter, step } where +iter is a function that yields successive values from the collection +each time it is invoked and step is the first step of iteration.

                                                                                                                        -

                                                                                                                        When there are no more items to be iterated, the function -must return the atom :stop.

                                                                                                                        +

                                                                                                                        Iteration in Elixir happens with the help of an iterator function (named +iter in the paragraph above). When it is invoked, it must return a tuple +with two elements. The first element is the next successive value from the +collection and the second element can be any Elixir term which iter is +going to receive as its argument the next time it is invoked.

                                                                                                                        -

                                                                                                                        In order to retrieve this iterator function, Elixir invokes -Enum.Iterator.iterator(collection) which should return a -tuple with two elements: the first element is the iterator -function and the second is the first step of iteration.

                                                                                                                        +

                                                                                                                        When there are no more items left to yield, iter must return the atom +:stop.

                                                                                                                        -

                                                                                                                        As an example, here is the implementation of iterator for lists:

                                                                                                                        +

                                                                                                                        As an example, here is the implementation of iterator for lists:

                                                                                                                        def iterator(list),   do: { iterate(&1), iterate(list) }
                                                                                                                         defp iterate([h|t]),  do: { h, t }
                                                                                                                         defp iterate([]),     do: :stop
                                                                                                                         
                                                                                                                        +

                                                                                                                        Here, iterate is the iterator function and { h, t } is a step of +iteration.

                                                                                                                        +

                                                                                                                        Iterating lists

                                                                                                                        -

                                                                                                                        If a data structure needs to be converted to a list in order -to be iterated, the iterator function can simply return the -list and the Enum module will be able to take over the list -and retrieve the proper iterator function.

                                                                                                                        +

                                                                                                                        As a special case, if a data structure needs to be converted to a list in +order to be iterated, iterator can simply return the list and the Enum +module will be able to take over the list and produce a proper iterator +function for it.

                                                                                                                        - Source + + Source +
                                                                                                                        diff --git a/docs/stable/Enum.html b/docs/stable/Enum.html index 102194a5d..ef65abe4a 100644 --- a/docs/stable/Enum.html +++ b/docs/stable/Enum.html @@ -42,14 +42,14 @@

                                                                                                                        - Source + Source -

                                                                                                                        Functions summary

                                                                                                                        +

                                                                                                                        Functions summary

                                                                                                                        • @@ -222,21 +222,25 @@

                                                                                                                          Functions

                                                                                                                          Examples

                                                                                                                          -
                                                                                                                          Enum.all? [2,4,6], fn(x) -> rem(x, 2) == 0 end
                                                                                                                          -#=> true
                                                                                                                          +
                                                                                                                          iex> Enum.all? [2,4,6], fn(x) -> rem(x, 2) == 0 end
                                                                                                                          +true
                                                                                                                           
                                                                                                                          -Enum.all? [2,3,4], fn(x) -> rem(x, 2) == 0 end
                                                                                                                          -#=> false
                                                                                                                          +iex> Enum.all? [2,3,4], fn(x) -> rem(x, 2) == 0 end
                                                                                                                          +false
                                                                                                                           

                                                                                                                          If no function is given, it defaults to checking if all items in the collection evaluate to true.

                                                                                                                          -
                                                                                                                          Enum.all? [1,2,3]   #=> true
                                                                                                                          -Enum.all? [1,nil,3] #=> false
                                                                                                                          +
                                                                                                                          iex> Enum.all? [1,2,3]
                                                                                                                          +true
                                                                                                                          +iex> Enum.all? [1,nil,3]
                                                                                                                          +false
                                                                                                                           
                                                                                                                          - Source + + Source +

                                                                                                                          any?(collection, fun // fn x -> x end) @@ -246,21 +250,25 @@

                                                                                                                          Examples

                                                                                                                          Examples

                                                                                                                          -
                                                                                                                          Enum.any? [2,4,6], fn(x) -> rem(x, 2) == 1 end
                                                                                                                          -#=> false
                                                                                                                          +
                                                                                                                          iex> Enum.any? [2,4,6], fn(x) -> rem(x, 2) == 1 end
                                                                                                                          +false
                                                                                                                           
                                                                                                                          -Enum.any? [2,3,4], fn(x) -> rem(x, 2) == 1 end
                                                                                                                          -#=> true
                                                                                                                          +iex> Enum.any? [2,3,4], fn(x) -> rem(x, 2) == 1 end
                                                                                                                          +true
                                                                                                                           

                                                                                                                          If no function is given, it defaults to checking if at least one item in the collection evaluates to true.

                                                                                                                          -
                                                                                                                          Enum.any? [false,false,false] #=> false
                                                                                                                          -Enum.any? [false,true,false]  #=> true
                                                                                                                          +
                                                                                                                          iex> Enum.any? [false,false,false]
                                                                                                                          +false
                                                                                                                          +iex> Enum.any? [false,true,false]
                                                                                                                          +true
                                                                                                                           
                                                                                                                          - Source + + Source +

                                                                                                                          at!(collection, n) @@ -273,12 +281,17 @@

                                                                                                                          Examples

                                                                                                                          ## Examples

                                                                                                                          -
                                                                                                                            Enum.at! [2,4,6], 0 #=> 2
                                                                                                                          -  Enum.at! [2,4,6], 2 #=> 6
                                                                                                                          -  Enum.at! [2,4,6], 4 #=> raises Enum.OutOfBoundsError
                                                                                                                          +
                                                                                                                            iex> Enum.at! [2,4,6], 0
                                                                                                                          +  2
                                                                                                                          +  iex> Enum.at! [2,4,6], 2
                                                                                                                          +  6
                                                                                                                          +  iex> Enum.at! [2,4,6], 4
                                                                                                                          +  ** (Enum.OutOfBoundsError) out of bounds error
                                                                                                                           
                                                                                                                          - Source + + Source +

                                                                                                                          count(collection) @@ -287,17 +300,22 @@

                                                                                                                          Examples

                                                                                                                          Examples

                                                                                                                          -
                                                                                                                          Enum.count [1,2,3] #=> 3
                                                                                                                          +
                                                                                                                          iex> Enum.count [1,2,3]
                                                                                                                          +3
                                                                                                                           
                                                                                                                          - Source + + Source +

                                                                                                                          count(collection, fun)

                                                                                                                          Counts for how many items the function returns true.

                                                                                                                          - Source + + Source +

                                                                                                                          drop(collection, count) @@ -307,12 +325,17 @@

                                                                                                                          Examples

                                                                                                                          Examples

                                                                                                                          -
                                                                                                                          Enum.drop [1,2,3], 2  #=> [3]
                                                                                                                          -Enum.drop [1,2,3], 10 #=> []
                                                                                                                          -Enum.drop [1,2,3], 0  #=> [1,2,3]
                                                                                                                          +
                                                                                                                          iex> Enum.drop [1,2,3], 2
                                                                                                                          +[3]
                                                                                                                          +iex> Enum.drop [1,2,3], 10
                                                                                                                          +[]
                                                                                                                          +iex> Enum.drop [1,2,3], 0
                                                                                                                          +[1,2,3]
                                                                                                                           
                                                                                                                          - Source + + Source +

                                                                                                                          drop_while(collection, fun) @@ -322,11 +345,13 @@

                                                                                                                          Examples

                                                                                                                          Examples

                                                                                                                          -
                                                                                                                          Enum.drop_while [1,2,3,4,5], fn(x) -> x < 3 end
                                                                                                                          -#=> [3,4,5]
                                                                                                                          +
                                                                                                                          iex> Enum.drop_while [1,2,3,4,5], fn(x) -> x < 3 end
                                                                                                                          +[3,4,5]
                                                                                                                           
                                                                                                                          - Source + + Source +

                                                                                                                          each(collection, fun) @@ -340,7 +365,9 @@

                                                                                                                          Examples

                                                                                                                          Enum.each ['some', 'example'], fn(x) -> IO.puts x end
                                                                                                                           
                                                                                                                          - Source + + Source +

                                                                                                                          empty?(collection) @@ -349,11 +376,15 @@

                                                                                                                          Examples

                                                                                                                          Examples

                                                                                                                          -
                                                                                                                          Enum.empty? []      #=> true
                                                                                                                          -Enum.empty? [1,2,3] #=> false
                                                                                                                          +
                                                                                                                          iex> Enum.empty? []
                                                                                                                          +true
                                                                                                                          +iex> Enum.empty? [1,2,3]
                                                                                                                          +false
                                                                                                                           
                                                                                                                          - Source + + Source +

                                                                                                                          filter(collection, fun) @@ -363,11 +394,13 @@

                                                                                                                          Examples

                                                                                                                          Examples

                                                                                                                          -
                                                                                                                          Enum.filter [1, 2, 3], fn(x) -> rem(x, 2) == 0 end
                                                                                                                          -#=> [2]
                                                                                                                          +
                                                                                                                          iex> Enum.filter [1, 2, 3], fn(x) -> rem(x, 2) == 0 end
                                                                                                                          +[2]
                                                                                                                           
                                                                                                                          - Source + + Source +

                                                                                                                          filter_map(collection, filter, mapper) @@ -376,11 +409,13 @@

                                                                                                                          Examples

                                                                                                                          Examples

                                                                                                                          -
                                                                                                                          Enum.filter_map [1, 2, 3], fn(x) -> rem(x, 2) == 0 end, &1 * 2
                                                                                                                          -#=> [4]
                                                                                                                          +
                                                                                                                          iex> Enum.filter_map [1, 2, 3], fn(x) -> rem(x, 2) == 0 end, &1 * 2
                                                                                                                          +[4]
                                                                                                                           
                                                                                                                          - Source + + Source +

                                                                                                                          find(collection, ifnone // nil, fun) @@ -390,17 +425,19 @@

                                                                                                                          Examples

                                                                                                                          Examples

                                                                                                                          -
                                                                                                                          Enum.find [2,4,6], fn(x) -> rem(x, 2) == 1 end
                                                                                                                          -#=> nil
                                                                                                                          +
                                                                                                                          iex> Enum.find [2,4,6], fn(x) -> rem(x, 2) == 1 end
                                                                                                                          +nil
                                                                                                                           
                                                                                                                          -Enum.find [2,4,6], 0, fn(x) -> rem(x, 2) == 1 end
                                                                                                                          -#=> 0
                                                                                                                          +iex> Enum.find [2,4,6], 0, fn(x) -> rem(x, 2) == 1 end
                                                                                                                          +0
                                                                                                                           
                                                                                                                          -Enum.find [2,3,4], fn(x) -> rem(x, 2) == 1 end
                                                                                                                          -#=> 3
                                                                                                                          +iex> Enum.find [2,3,4], fn(x) -> rem(x, 2) == 1 end
                                                                                                                          +3
                                                                                                                           
                                                                                                                          - Source + + Source +

                                                                                                                          find_index(collection, fun) @@ -412,14 +449,16 @@

                                                                                                                          Examples

                                                                                                                          Examples

                                                                                                                          -
                                                                                                                          Enum.find_index [2,4,6], fn(x) -> rem(x, 2) == 1 end
                                                                                                                          -#=> nil
                                                                                                                          +
                                                                                                                          iex> Enum.find_index [2,4,6], fn(x) -> rem(x, 2) == 1 end
                                                                                                                          +nil
                                                                                                                           
                                                                                                                          -Enum.find_index [2,3,4], fn(x) -> rem(x, 2) == 1 end
                                                                                                                          -#=> 2
                                                                                                                          +iex> Enum.find_index [2,3,4], fn(x) -> rem(x, 2) == 1 end
                                                                                                                          +1
                                                                                                                           
                                                                                                                          - Source + + Source +

                                                                                                                          find_value(collection, ifnone // nil, fun) @@ -429,14 +468,16 @@

                                                                                                                          Examples

                                                                                                                          Examples

                                                                                                                          -
                                                                                                                          Enum.find_value [2,4,6], fn(x) -> rem(x, 2) == 1 end
                                                                                                                          -#=> nil
                                                                                                                          +
                                                                                                                          iex> Enum.find_value [2,4,6], fn(x) -> rem(x, 2) == 1 end
                                                                                                                          +nil
                                                                                                                           
                                                                                                                          -Enum.find_value [2,3,4], fn(x) -> rem(x, 2) == 1 end
                                                                                                                          -#=> true
                                                                                                                          +iex> Enum.find_value [2,3,4], fn(x) -> rem(x, 2) == 1 end
                                                                                                                          +true
                                                                                                                           
                                                                                                                          - Source + + Source +

                                                                                                                          first(collection) @@ -445,11 +486,15 @@

                                                                                                                          Examples

                                                                                                                          Examples

                                                                                                                          -
                                                                                                                          Enum.first []      #=> nil
                                                                                                                          -Enum.first [1,2,3] #=> 1
                                                                                                                          +
                                                                                                                          iex> Enum.first []
                                                                                                                          +nil
                                                                                                                          +iex> Enum.first [1,2,3]
                                                                                                                          +1
                                                                                                                           
                                                                                                                          - Source + + Source +

                                                                                                                          join(collection, joiner // "") @@ -465,12 +510,17 @@

                                                                                                                          Examples

                                                                                                                          Examples

                                                                                                                          -
                                                                                                                          Enum.join([1,2,3])        #=> "123"
                                                                                                                          -Enum.join([1,2,3], " = ") #=> "1 = 2 = 3"
                                                                                                                          -Enum.join([1,2,3], ' = ') #=> '1 = 2 = 3'
                                                                                                                          +
                                                                                                                          iex> Enum.join([1,2,3])
                                                                                                                          +"123"
                                                                                                                          +iex> Enum.join([1,2,3], " = ")
                                                                                                                          +"1 = 2 = 3"
                                                                                                                          +iex> Enum.join([1,2,3], ' = ')
                                                                                                                          +'1 = 2 = 3'
                                                                                                                           
                                                                                                                          - Source + + Source +

                                                                                                                          map(collection, fun) @@ -484,14 +534,16 @@

                                                                                                                          Examples

                                                                                                                          Examples

                                                                                                                          -
                                                                                                                          Enum.map [1, 2, 3], fn(x) -> x * 2 end
                                                                                                                          -#=> [2, 4, 6]
                                                                                                                          +
                                                                                                                          iex> Enum.map [1, 2, 3], fn(x) -> x * 2 end
                                                                                                                          +[2, 4, 6]
                                                                                                                           
                                                                                                                          -Enum.map [a: 1, b: 2], fn({k, v}) -> { k, -v } end
                                                                                                                          -#=> [a: -1, b: -2]
                                                                                                                          +iex> Enum.map [a: 1, b: 2], fn({k, v}) -> { k, -v } end
                                                                                                                          +[a: -1, b: -2]
                                                                                                                           
                                                                                                                          - Source + + Source +

                                                                                                                          map_join(collection, joiner // "", mapper) @@ -507,12 +559,17 @@

                                                                                                                          Examples

                                                                                                                          Examples

                                                                                                                          -
                                                                                                                          Enum.map_join([1,2,3], &1 * 2)        #=> "246"
                                                                                                                          -Enum.map_join([1,2,3], " = ", &1 * 2) #=> "2 = 4 = 6"
                                                                                                                          -Enum.map_join([1,2,3], ' = ', &1 * 2) #=> '2 = 4 = 6'
                                                                                                                          +
                                                                                                                          iex> Enum.map_join([1,2,3], &1 * 2)
                                                                                                                          +"246"
                                                                                                                          +iex> Enum.map_join([1,2,3], " = ", &1 * 2)
                                                                                                                          +"2 = 4 = 6"
                                                                                                                          +iex> Enum.map_join([1,2,3], ' = ', &1 * 2)
                                                                                                                          +'2 = 4 = 6'
                                                                                                                           
                                                                                                                          - Source + + Source +

                                                                                                                          map_reduce(collection, acc, f) @@ -527,11 +584,13 @@

                                                                                                                          Examples

                                                                                                                          Examples

                                                                                                                          -
                                                                                                                          Enum.map_reduce [1, 2, 3], 0, fn(x, acc) -> { x * 2, x + acc } end
                                                                                                                          -#=> { [2, 4, 6], 6 }
                                                                                                                          +
                                                                                                                          iex> Enum.map_reduce [1, 2, 3], 0, fn(x, acc) -> { x * 2, x + acc } end
                                                                                                                          +{ [2, 4, 6], 6 }
                                                                                                                           
                                                                                                                          - Source + + Source +

                                                                                                                          partition(collection, fun) @@ -542,11 +601,13 @@

                                                                                                                          Examples

                                                                                                                          Examples

                                                                                                                          -
                                                                                                                          Enum.partition [1, 2, 3], fn(x) -> rem(x, 2) == 0 end
                                                                                                                          -#=> { [2], [1,3] }
                                                                                                                          +
                                                                                                                          iex> Enum.partition [1, 2, 3], fn(x) -> rem(x, 2) == 0 end
                                                                                                                          +{ [2], [1,3] }
                                                                                                                           
                                                                                                                          - Source + + Source +

                                                                                                                          reduce(collection, acc, fun) @@ -557,11 +618,13 @@

                                                                                                                          Examples

                                                                                                                          Examples

                                                                                                                          -
                                                                                                                          Enum.reduce [1, 2, 3], 0, fn(x, acc) -> x + acc end
                                                                                                                          -#=> 6
                                                                                                                          +
                                                                                                                          iex> Enum.reduce [1, 2, 3], 0, fn(x, acc) -> x + acc end
                                                                                                                          +6
                                                                                                                           
                                                                                                                          - Source + + Source +

                                                                                                                          reverse(collection) @@ -570,11 +633,13 @@

                                                                                                                          Examples

                                                                                                                          Examples

                                                                                                                          -
                                                                                                                          Enum.reverse [1, 2, 3]
                                                                                                                          -#=> [3, 2, 1]
                                                                                                                          +
                                                                                                                          iex> Enum.reverse [1, 2, 3]
                                                                                                                          +[3, 2, 1]
                                                                                                                           
                                                                                                                          - Source + + Source +

                                                                                                                          sort(collection) @@ -583,10 +648,13 @@

                                                                                                                          Examples

                                                                                                                          Examples

                                                                                                                          -
                                                                                                                          Enum.sort [3,2,1] #=> [1,2,3]
                                                                                                                          +
                                                                                                                          iex> Enum.sort [3,2,1]
                                                                                                                          +[1,2,3]
                                                                                                                           
                                                                                                                          - Source + + Source +

                                                                                                                          sort(collection, fun) @@ -595,10 +663,13 @@

                                                                                                                          Examples

                                                                                                                          Examples

                                                                                                                          -
                                                                                                                          Enum.sort [3,2,1], &1 > &2 #=> [1,2,3]
                                                                                                                          +
                                                                                                                          iex> Enum.sort [1,2,3], &1 > &2
                                                                                                                          +[3,2,1]
                                                                                                                           
                                                                                                                          - Source + + Source +

                                                                                                                          split(collection, count) @@ -614,28 +685,36 @@

                                                                                                                          Examples

                                                                                                                          Examples

                                                                                                                          -
                                                                                                                          Enum.split [1,2,3], 2  #=> { [1,2], [3] }
                                                                                                                          -Enum.split [1,2,3], 10 #=> { [1,2,3], [] }
                                                                                                                          -Enum.split [1,2,3], 0  #=> { [], [1,2,3] }
                                                                                                                          -Enum.split [1,2,3], -1 #=> { [1,2], [3] }
                                                                                                                          -Enum.split [1,2,3], -5 #=> { [], [1,2,3] }
                                                                                                                          +
                                                                                                                          iex> Enum.split [1,2,3], 2
                                                                                                                          +{ [1,2], [3] }
                                                                                                                          +iex> Enum.split [1,2,3], 10
                                                                                                                          +{ [1,2,3], [] }
                                                                                                                          +iex> Enum.split [1,2,3], 0
                                                                                                                          +{ [], [1,2,3] }
                                                                                                                          +iex> Enum.split [1,2,3], -1
                                                                                                                          +{ [1,2], [3] }
                                                                                                                          +iex> Enum.split [1,2,3], -5
                                                                                                                          +{ [], [1,2,3] }
                                                                                                                           
                                                                                                                          - Source + + Source +

                                                                                                                          split_while(collection, fun)

                                                                                                                          -

                                                                                                                          Splits collection at the first element, for which fun returns true. -Expects an ordered collection.

                                                                                                                          +

                                                                                                                          Splits collection in two while fun returns true.

                                                                                                                          Examples

                                                                                                                          -
                                                                                                                          Enum.split_while [1,2,3,4], fn x -> x == 2 end
                                                                                                                          -#=> { [1], [2, 3, 4] }
                                                                                                                          +
                                                                                                                          iex> Enum.split_while [1,2,3,4], fn(x) -> x < 3 end
                                                                                                                          +{ [1, 2], [3, 4] }
                                                                                                                           
                                                                                                                          - Source + + Source +

                                                                                                                          take(collection, count) @@ -645,12 +724,17 @@

                                                                                                                          Examples

                                                                                                                          Examples

                                                                                                                          -
                                                                                                                          Enum.take [1,2,3], 2  #=> [1,2]
                                                                                                                          -Enum.take [1,2,3], 10 #=> [1,2,3]
                                                                                                                          -Enum.take [1,2,3], 0  #=> []
                                                                                                                          +
                                                                                                                          iex> Enum.take [1,2,3], 2
                                                                                                                          +[1,2]
                                                                                                                          +iex> Enum.take [1,2,3], 10
                                                                                                                          +[1,2,3]
                                                                                                                          +iex> Enum.take [1,2,3], 0
                                                                                                                          +[]
                                                                                                                           
                                                                                                                          - Source + + Source +

                                                                                                                          take_while(collection, fun) @@ -660,11 +744,13 @@

                                                                                                                          Examples

                                                                                                                          Examples

                                                                                                                          -
                                                                                                                          Enum.take_while [1,2,3], fn(x) -> x < 3 end
                                                                                                                          -#=> [1, 2]
                                                                                                                          +
                                                                                                                          iex> Enum.take_while [1,2,3], fn(x) -> x < 3 end
                                                                                                                          +[1, 2]
                                                                                                                           
                                                                                                                          - Source + + Source +

                                                                                                                          uniq(collection) @@ -673,11 +759,13 @@

                                                                                                                          Examples

                                                                                                                          Examples

                                                                                                                          -
                                                                                                                          Enum.uniq [1,2,3,2,1]
                                                                                                                          -#=> [1, 2, 3]
                                                                                                                          +
                                                                                                                          iex> Enum.uniq [1,2,3,2,1]
                                                                                                                          +[1, 2, 3]
                                                                                                                           
                                                                                                                          - Source + + Source +

                                                                                                                          zip(coll1, coll2) @@ -687,7 +775,9 @@

                                                                                                                          Examples

                                                                                                                          dictated by the first enum. In case the second list is shorter, values are filled with nil.

                                                                                                                          - Source + + Source + diff --git a/docs/stable/ErlangError.html b/docs/stable/ErlangError.html index aa5f9bbad..5ac451a9d 100644 --- a/docs/stable/ErlangError.html +++ b/docs/stable/ErlangError.html @@ -47,7 +47,7 @@

                                                                                                                          Fields (and defaults)

                                                                                                                          -

                                                                                                                          Functions summary

                                                                                                                          +

                                                                                                                          Functions summary

                                                                                                                          • @@ -70,7 +70,9 @@

                                                                                                                            Functions

                                                                                                                            message(exception)

                                                                                                                            - Source + + Source + diff --git a/docs/stable/ExUnit.Assertions.html b/docs/stable/ExUnit.Assertions.html index 4ea3951b1..d29879a3c 100644 --- a/docs/stable/ExUnit.Assertions.html +++ b/docs/stable/ExUnit.Assertions.html @@ -46,14 +46,14 @@

                                                                                                                            - Source + Source -

                                                                                                                            Functions summary

                                                                                                                            +

                                                                                                                            Functions summary

                                                                                                                            • @@ -100,7 +100,7 @@

                                                                                                                              Functions summary

                                                                                                                              -

                                                                                                                              Macros summary

                                                                                                                              +

                                                                                                                              Macros summary

                                                                                                                              • @@ -168,7 +168,9 @@

                                                                                                                                Examples

                                                                                                                                assert false, "it will never be true"
                                                                                                                                 
                                                                                                                                - Source + + Source +

                                                                                                                                assert(value, expected, actual, opts) @@ -182,7 +184,9 @@

                                                                                                                                Examples

                                                                                                                                assert this > that, this, that, reason: "more than"
                                                                                                                                 
                                                                                                                                - Source + + Source +

                                                                                                                                assert_in_delta(expected, received, delta, message // nil) @@ -195,7 +199,9 @@

                                                                                                                                Examples

                                                                                                                                assert_in_delta 10, 15, 4
                                                                                                                          - Source + + Source +

                                                                                                                          assert_raise(exception, function) @@ -210,7 +216,9 @@

                                                                                                                          Examples

                                                                                                                          end
                                                                                                                          - Source + + Source +

                                                                                                                          assert_raise(exception, message, function) @@ -225,7 +233,9 @@

                                                                                                                          Examples

                                                                                                                          end
                                                                                                          - Source + + Source +

                                                                                                          flunk(message // "Epic Fail!") @@ -237,7 +247,9 @@

                                                                                                          Examples

                                                                                                          flunk "This should raise an error"
                                                                                                           
                                                                                                          - Source + + Source +

                                                                                                          refute(not_expected, message) @@ -250,7 +262,9 @@

                                                                                                          Examples

                                                                                                          refute true, "This will obviously fail"
                                                                                                           
                                                                                                          - Source + + Source +

                                                                                                          refute_in_delta(expected, received, delta, message // nil) @@ -263,7 +277,9 @@

                                                                                                          Examples

                                                                                                          refute_in_delta 10, 11, 2
                                                                                                - Source + + Source + @@ -289,7 +305,9 @@

                                                                                                Examples

                                                                                                assert true
                                                                                                 
                                                                                                - Source + + Source +

                                                                                                assert_receive(expected, timeout // 100, message // nil) @@ -311,10 +329,12 @@

                                                                                                Examples

                                                                                                You can also match against specific patterns:

                                                                                                -
                                                                                                assert_received { :hello, _ }
                                                                                                +
                                                                                                assert_receive { :hello, _ }
                                                                                                 
                                                                                                - Source + + Source +

                                                                                                assert_received(expected, message // nil) @@ -336,7 +356,9 @@

                                                                                                Examples

                                                                                                assert_received { :hello, _ }
                                                                                              - Source + + Source +

                                                                                              catch_error(expression) @@ -349,7 +371,9 @@

                                                                                              Examples

                                                                                              assert catch_error(error 1) == 1
                                                                                               
                                                                                              - Source + + Source +

                                                                                              catch_exit(expression) @@ -362,7 +386,9 @@

                                                                                              Examples

                                                                                              assert catch_exit(exit 1) == 1
                                                                                               
                                                                                              - Source + + Source +

                                                                                              catch_throw(expression) @@ -375,7 +401,9 @@

                                                                                              Examples

                                                                                              assert catch_throw(throw 1) == 1
                                                                                               
                                                                                              - Source + + Source +

                                                                                              refute(expected) @@ -390,7 +418,9 @@

                                                                                              Examples

                                                                                              refute false
                                                                                               
                                                                                              - Source + + Source +

                                                                                              refute_receive(not_expected, timeout // 100, message // nil) @@ -410,7 +440,9 @@

                                                                                              Examples

                                                                                              refute_receive :bye, 1000
                                                                                               
                                                                                              - Source + + Source +

                                                                                              refute_received(not_expected, message // nil) @@ -426,7 +458,9 @@

                                                                                              Examples

                                                                                              refute_received :bye
                                                                                        - Source + + Source + diff --git a/docs/stable/ExUnit.CLIFormatter.html b/docs/stable/ExUnit.CLIFormatter.html index 3f1dd41fe..73bfc9d70 100644 --- a/docs/stable/ExUnit.CLIFormatter.html +++ b/docs/stable/ExUnit.CLIFormatter.html @@ -40,7 +40,7 @@

                                                                                        -

                                                                                        Functions summary

                                                                                        +

                                                                                        Functions summary

                                                                                        • @@ -79,7 +79,7 @@

                                                                                          Functions summary

                                                                                        • - suite_finished/1 + suite_finished/2
                                                                                        • @@ -94,12 +94,12 @@

                                                                                          Functions summary

                                                                                        • - test_finished/4 + test_finished/2
                                                                                        • - test_started/3 + test_started/2
                                                                                        • @@ -118,73 +118,97 @@

                                                                                          Functions

                                                                                          case_finished(_id, _test_case)

                                                                                          - Source + + Source +

                                                                                          case_started(_id, _test_case)

                                                                                          - Source + + Source +

                                                                                          code_change(_old, state, _extra)

                                                                                          - Source + + Source +

                                                                                          handle_call(arg1, arg2, state)

                                                                                          - Source + + Source +

                                                                                          handle_cast(arg1, state)

                                                                                          - Source + + Source +

                                                                                          handle_info(_msg, state)

                                                                                          - Source + + Source +

                                                                                          init(args)

                                                                                          - Source + + Source +
                                                                                          -

                                                                                          - suite_finished(id) +

                                                                                          + suite_finished(id, ms)

                                                                                          - Source + + Source +

                                                                                          suite_started(_opts)

                                                                                          - Source + + Source +

                                                                                          terminate(reason, state)

                                                                                          - Source + + Source +
                                                                                          -

                                                                                          - test_finished(id, test_case, test, result) +

                                                                                          + test_finished(id, test)

                                                                                          - Source + + Source +
                                                                                          -

                                                                                          - test_started(_id, _test_case, _test) +

                                                                                          + test_started(_id, _test)

                                                                                          - Source + + Source +
                                                                                          diff --git a/docs/stable/ExUnit.Callbacks.html b/docs/stable/ExUnit.Callbacks.html index 3e645f943..42ef085ee 100644 --- a/docs/stable/ExUnit.Callbacks.html +++ b/docs/stable/ExUnit.Callbacks.html @@ -74,7 +74,7 @@

                                                                                          Examples

                                                                                          -

                                                                                          Macros summary

                                                                                          +

                                                                                          Macros summary

                                                                                          • @@ -114,7 +114,9 @@

                                                                                            Macros

                                                                                            end, block)

                                                                                            - Source + + Source +

                                                                                            setup_all(var // quote() do @@ -122,7 +124,9 @@

                                                                                            Macros

                                                                                            end, block)

                                                                                            - Source + + Source +

                                                                                            teardown(var // quote() do @@ -130,7 +134,9 @@

                                                                                            Macros

                                                                                            end, block)

                                                                                            - Source + + Source +

                                                                                            teardown_all(var // quote() do @@ -138,7 +144,9 @@

                                                                                            Macros

                                                                                            end, block)

                                                                                            - Source + + Source +
                                                                                            diff --git a/docs/stable/ExUnit.Case.html b/docs/stable/ExUnit.Case.html index 55b9af469..741e6c8d9 100644 --- a/docs/stable/ExUnit.Case.html +++ b/docs/stable/ExUnit.Case.html @@ -65,7 +65,7 @@

                                                                                            Examples

                                                                                            -

                                                                                            Macros summary

                                                                                            +

                                                                                            Macros summary

                                                                                            • @@ -103,7 +103,9 @@

                                                                                              Examples

                                                                                              end
                                                                                      - Source + + Source + diff --git a/docs/stable/ExUnit.CaseTemplate.html b/docs/stable/ExUnit.CaseTemplate.html index 411a3a62d..859468a3e 100644 --- a/docs/stable/ExUnit.CaseTemplate.html +++ b/docs/stable/ExUnit.CaseTemplate.html @@ -66,7 +66,7 @@

                                                                                      Example

                                                                                      -

                                                                                      Macros summary

                                                                                      +

                                                                                      Macros summary

                                                                                      • @@ -93,7 +93,9 @@

                                                                                        Macros

                                                                                        Allows a developer to code to be invoked when this module is used.

                                                                                        - Source + + Source + diff --git a/docs/stable/ExUnit.DocTest.html b/docs/stable/ExUnit.DocTest.html new file mode 100644 index 000000000..42e0372f8 --- /dev/null +++ b/docs/stable/ExUnit.DocTest.html @@ -0,0 +1,193 @@ + + + + ExUnit.DocTest + + + + + + + + + + + + +
                                                                                        +

                                                                                        + ExUnit.DocTest + +

                                                                                        + + +
                                                                                        +

                                                                                        ExUnit.DocTest implements functionality similar to Python's +doctest.

                                                                                        + +

                                                                                        In a nutshell, it allows us to generate tests from the code +examples existing in module/function/macro's documentation. +In order to do that, one needs to invoke doctest/1 macro +from their test case and write their examples according +to some guidelines.

                                                                                        + +

                                                                                        The syntax for examples is as follows. Every new test starts +on a new line, with an "iex>" prefix. Multiline expressions +can be employed if the following lines start with either +"...>" (recommended) or "iex>" prefix.

                                                                                        + +

                                                                                        The expected result should start at the next line after "iex>" +or "...>" line(s) and is terminated either by a newline, new +"iex>" prefix or end of the string literal.

                                                                                        + +

                                                                                        Examples

                                                                                        + +

                                                                                        Currently, the only way to run doctests is to include them into +an ExUnit case with a doctest macro:

                                                                                        + +
                                                                                        defmodule MyModule.Test do
                                                                                        +  use ExUnit.Case, async: true
                                                                                        +  doctest MyModule
                                                                                        +end
                                                                                        +
                                                                                        + +

                                                                                        The doctest macro is going to loop all functions and macros +defined in MyModule, parsing their documentation in search for +code examples.

                                                                                        + +

                                                                                        A very basic example is:

                                                                                        + +
                                                                                        iex> 1+1
                                                                                        +2
                                                                                        +
                                                                                        + +

                                                                                        Multiline is also supported:

                                                                                        + +
                                                                                        iex> Enum.map [1,2,3], fn(x) ->
                                                                                        +...>   x * 2
                                                                                        +...> end
                                                                                        +[2,4,6]
                                                                                        +
                                                                                        + +

                                                                                        Similarly to iex you can use numbers in your "prompts":

                                                                                        + +
                                                                                        iex(1)> [1+2,
                                                                                        +...(1)>  3]
                                                                                        +[3,3]
                                                                                        +
                                                                                        + +

                                                                                        This is useful in two use cases:

                                                                                        + +
                                                                                          +
                                                                                        • Being able to refer to specific numbered scenarios
                                                                                        • +
                                                                                        • Copy-pasting examples from an actual iex sessions
                                                                                        • +
                                                                                        + +

                                                                                        We also allow you to select or skip some functions when calling +doctest. See its documentation documentation for more info.

                                                                                        + +

                                                                                        Exceptions

                                                                                        + +

                                                                                        You can also showcase expressions raising an exception, for example:

                                                                                        + +
                                                                                        iex(1)> binary_to_atom((fn() -> 1 end).())
                                                                                        +** (ArgumentError) argument error
                                                                                        +
                                                                                        + +

                                                                                        What DocTest will be looking for is a line starting with "** (" and it +will parse it accordingly to extract the exception name and the message. +At this moment, the exception parser would make the parser treat the next +line as a start of a completely new expression (if it is prefixed with iex>) +or a no-op line with documentation. Thus, multiline messages are not +supported.

                                                                                        + +

                                                                                        When not to use doctest

                                                                                        + +

                                                                                        In general, doctests are not recommended when your code examples contain +side effects. For example, if a doctest prints to standard output, doctest +will not try to capture the output.

                                                                                        + +

                                                                                        Similarly, doctest does not run in any kind of side box. So any module +defined in a code example is going to linger throughout the whole test suite +run.

                                                                                        + +
                                                                                        + + + Source + + + + + + + + +

                                                                                        Macros summary

                                                                                        + + + + + + + + +
                                                                                        +

                                                                                        Macros

                                                                                        +
                                                                                        +

                                                                                        + doctest(mod, opts // []) +

                                                                                        +

                                                                                        This macro is used to generate ExUnit test cases for doctests.

                                                                                        + +

                                                                                        There are three ways this macro can be used:

                                                                                        + +
                                                                                          +
                                                                                        • doctest(Module) — will generate tests for all doctests found +in the module Module
                                                                                        • +
                                                                                        + +

                                                                                        Options can also be supplied:

                                                                                        + +
                                                                                          +
                                                                                        • :except — generate tests for all functions except those listed + (list of {function, arity} tuples)

                                                                                        • +
                                                                                        • :only — generate tests only forfunctions listed + (list of {function, arity} tuples)

                                                                                        • +
                                                                                        • :import — when true, one can test a function defined in the module + without referring to the module name. However, this is not + feasible when there is a clash with a number module like + Kernel. In these cases, import should be set to false + and a full M.f construct should be used.

                                                                                        • +
                                                                                        + +

                                                                                        Examples

                                                                                        + +
                                                                                        doctest MyModule, except: [trick_fun: 1]
                                                                                        +
                                                                                        + +

                                                                                        This macro is auto-imported into every ExUnit.Case.

                                                                                        +
                                                                                        + + Source + +
                                                                                        +
                                                                                        + + + +
                                                                                        + + diff --git a/docs/stable/ExUnit.ExpectationError.html b/docs/stable/ExUnit.ExpectationError.html index 441757e55..5a0996039 100644 --- a/docs/stable/ExUnit.ExpectationError.html +++ b/docs/stable/ExUnit.ExpectationError.html @@ -67,13 +67,24 @@

                                                                                        Fields (and defaults)

                                                                                      • +
                                                                                      • + + description: nil + +
                                                                                      • +
                                                                                      -

                                                                                      Functions summary

                                                                                      +

                                                                                      Functions summary

                                                                                      • + + full_reason/1 + +
                                                                                      • +
                                                                                      • message/1 @@ -90,11 +101,21 @@

                                                                                        Functions summary

                                                                                        Functions

                                                                                        +

                                                                                        + full_reason(exception) +

                                                                                        +
                                                                                        + + Source + +

                                                                                        message(exception)

                                                                                        - Source + + Source +
                                                                                        diff --git a/docs/stable/ExUnit.Formatter.html b/docs/stable/ExUnit.Formatter.html index 5ea9e8b14..41fabf247 100644 --- a/docs/stable/ExUnit.Formatter.html +++ b/docs/stable/ExUnit.Formatter.html @@ -46,16 +46,16 @@

                                                                                        -

                                                                                        Callbacks summary

                                                                                        +

                                                                                        Callbacks summary

                                                                                        • - test_finished/4 + test_finished/2
                                                                                        • - test_started/3 + test_started/2
                                                                                        • @@ -70,7 +70,7 @@

                                                                                          Callbacks summary

                                                                                        • - suite_finished/1 + suite_finished/2
                                                                                        • @@ -90,41 +90,53 @@

                                                                                          Callbacks summary

                                                                                          Callbacks

                                                                                          -

                                                                                          - test_finished(id(), test_case(), test(), result()) +

                                                                                          + test_finished(id(), test :: ExUnit.Test.t())

                                                                                          - Source + + Source +
                                                                                          -

                                                                                          - test_started(id(), test_case(), test()) +

                                                                                          + test_started(id(), test :: ExUnit.Test.t())

                                                                                          - Source + + Source +

                                                                                          case_finished(id(), test_case())

                                                                                          - Source + + Source +

                                                                                          case_started(id(), test_case())

                                                                                          - Source + + Source +
                                                                                          -

                                                                                          - suite_finished(id()) +

                                                                                          + suite_finished(id(), miliseconds :: pos_integer())

                                                                                          - Source + + Source +

                                                                                          suite_started(opts :: list())

                                                                                          - Source + + Source +
                                                                                          diff --git a/docs/stable/ExUnit.Test.html b/docs/stable/ExUnit.Test.html new file mode 100644 index 000000000..534bebb47 --- /dev/null +++ b/docs/stable/ExUnit.Test.html @@ -0,0 +1,81 @@ + + + + ExUnit.Test + + + + + + + + + + + + +
                                                                                          +

                                                                                          + ExUnit.Test + + record + +

                                                                                          + + +
                                                                                          +

                                                                                          A record that keeps information about the test. +It is received by formatters and also accessible +in the metadata under the key :test.

                                                                                          + +
                                                                                          + + + Source + + + + +

                                                                                          Fields (and defaults)

                                                                                          +
                                                                                            + +
                                                                                          • + + name: nil + +
                                                                                          • + +
                                                                                          • + + case: nil + +
                                                                                          • + +
                                                                                          • + + failure: nil + +
                                                                                          • + +
                                                                                          + + + + + + + + + + + + + +
                                                                                          + + diff --git a/docs/stable/ExUnit.html b/docs/stable/ExUnit.html index ebaadefef..c294b6abb 100644 --- a/docs/stable/ExUnit.html +++ b/docs/stable/ExUnit.html @@ -72,26 +72,6 @@

                                                                                          Case, callbacks and assertions

                                                                                          The ExUnit.Assertions module contains a set of macros to easily generate assertions with appropriate error messages.

                                                                                          -

                                                                                          User config

                                                                                          - -

                                                                                          When started, ExUnit automatically reads a user configuration -from the following locations, in this order:

                                                                                          - -
                                                                                            -
                                                                                          • $EXUNIT_CONFIG environment variable
                                                                                          • -
                                                                                          • $HOME/.ex_unit.exs
                                                                                          • -
                                                                                          - -

                                                                                          If none found, no user config will be read.

                                                                                          - -

                                                                                          User config is an elixir file which should return a keyword list -with ex_unit options. Please note that explicit options passed -to start/1 or configure/1 will take precedence over user options.

                                                                                          - -
                                                                                          # User config example (~/.ex_unit.exs)
                                                                                          -[formatter: ExUnit.Formatter.ANSI]
                                                                                          -
                                                                                          - @@ -102,7 +82,7 @@

                                                                                          User config

                                                                                          -

                                                                                          Functions summary

                                                                                          +

                                                                                          Functions summary

                                                                                          @@ -157,7 +132,9 @@

                                                                                          Options

                                                                                          Defaults to :erlang.system_info(:schedulers_online);

                                                                                        - Source + + Source +

                                                                                        run() @@ -167,7 +144,9 @@

                                                                                        Options

                                                                                        Returns the number of failures.

                                                                                        - Source + + Source +

                                                                                        start(options // []) @@ -179,20 +158,17 @@

                                                                                        Options

                                                                                        In case you want to run tests manually, skip calling this function and rely on configure/1 and run/0 instead.

                                                                                        - Source + + Source +

                                                                                        stop(_state)

                                                                                        - Source -
                                                                                        -

                                                                                        - user_options(user_config // nil) -

                                                                                        -

                                                                                        Returns the configured user options.

                                                                                        -
                                                                                        - Source + + Source +
                                                                                        diff --git a/docs/stable/Exception.html b/docs/stable/Exception.html index 7c650f79d..b51468ef4 100644 --- a/docs/stable/Exception.html +++ b/docs/stable/Exception.html @@ -40,7 +40,7 @@

                                                                                        -

                                                                                        Functions summary

                                                                                        +

                                                                                        Functions summary

                                                                                        • @@ -86,13 +86,17 @@

                                                                                          Functions

                                                                                          The current working directory may be given as argument, which is used to prettify the stacktrace.

                                                                                          - Source + + Source +

                                                                                          format_file_line(file, line, cwd)

                                                                                          - Source + + Source +

                                                                                          format_stacktrace(trace // nil) @@ -103,7 +107,9 @@

                                                                                          Functions

                                                                                          calculates the current stacktrace and formats it. As consequence, the value of System.stacktrace is changed.

                                                                                          - Source + + Source +

                                                                                          normalize(exception) @@ -112,7 +118,9 @@

                                                                                          Functions

                                                                                          to Elixir exceptions. Useful when interfacing Erlang code with Elixir code.

                                                                                          - Source + + Source +

                                                                                          Functions

                                                                                          calculates the current stacktrace and formats it. As consequence, the value of System.stacktrace is changed.

                                                                                          - Source + + Source + diff --git a/docs/stable/File.CopyError.html b/docs/stable/File.CopyError.html index 0c050f7e0..3de5ec201 100644 --- a/docs/stable/File.CopyError.html +++ b/docs/stable/File.CopyError.html @@ -65,7 +65,7 @@

                                                                                          Fields (and defaults)

                                                                                          -

                                                                                          Functions summary

                                                                                          +

                                                                                          Functions summary

                                                                                          • @@ -88,7 +88,9 @@

                                                                                            Functions

                                                                                            message(exception)

                                                                                            - Source + + Source + diff --git a/docs/stable/File.Error.html b/docs/stable/File.Error.html index 24ec1fad1..cc974f40c 100644 --- a/docs/stable/File.Error.html +++ b/docs/stable/File.Error.html @@ -59,7 +59,7 @@

                                                                                            Fields (and defaults)

                                                                                            -

                                                                                            Functions summary

                                                                                            +

                                                                                            Functions summary

                                                                                            • @@ -82,7 +82,9 @@

                                                                                              Functions

                                                                                              message(exception)

                                                                                              - Source + + Source + diff --git a/docs/stable/File.IteratorError.html b/docs/stable/File.IteratorError.html index 4aff72bd1..677061581 100644 --- a/docs/stable/File.IteratorError.html +++ b/docs/stable/File.IteratorError.html @@ -47,7 +47,7 @@

                                                                                              Fields (and defaults)

                                                                                              -

                                                                                              Functions summary

                                                                                              +

                                                                                              Functions summary

                                                                                              • @@ -70,7 +70,9 @@

                                                                                                Functions

                                                                                                message(exception)

                                                                                                - Source + + Source + diff --git a/docs/stable/File.html b/docs/stable/File.html index d921f1233..b2d4e93dc 100644 --- a/docs/stable/File.html +++ b/docs/stable/File.html @@ -84,7 +84,7 @@

                                                                                                -

                                                                                                Functions summary

                                                                                                +

                                                                                                Functions summary

                                                                                                • @@ -186,6 +186,16 @@

                                                                                                  Functions summary

                                                                                                  iterator!/2
                                                                                                • +
                                                                                                • + + ls/1 + +
                                                                                                • +
                                                                                                • + + ls!/1 + +
                                                                                                • mkdir/1 @@ -330,7 +340,9 @@

                                                                                                  Functions

                                                                                                  be passed into Enum to iterate line by line as a binary. Check iterator/1 for more information.

                                                                                                  - Source + + Source +

                                                                                                  biniterator(file, mode) @@ -339,7 +351,9 @@

                                                                                                  Functions

                                                                                                  returns its biniterator. Fails for the same reasons as File.open.

                                                                                                  - Source + + Source +

                                                                                                  biniterator!(file, mode // []) @@ -347,7 +361,9 @@

                                                                                                  Functions

                                                                                                  Same as biniterator/2 but raises if the file cannot be opened.

                                                                                                  - Source + + Source +

                                                                                                  cd(path) @@ -355,14 +371,18 @@

                                                                                                  Functions

                                                                                                  Sets the current working directory. Returns :ok if successful, { :error, reason } otherwise.

                                                                                                  - Source + + Source +

                                                                                                  cd!(path)

                                                                                                  The same as cd/0, but raises an exception if it fails.

                                                                                                  - Source + + Source +

                                                                                                  cd!(path, function) @@ -374,7 +394,9 @@

                                                                                                  Functions

                                                                                                  Raises an error if retrieving or changing the current directory fails.

                                                                                                  - Source + + Source +

                                                                                                  close(io_device) @@ -386,7 +408,9 @@

                                                                                                  Functions

                                                                                                  close/1 might return an old write error and not even try to close the file. See open/2.

                                                                                                  - Source + + Source +

                                                                                                  copy(source, destination, bytes_count // :infinity) @@ -405,7 +429,9 @@

                                                                                                  Functions

                                                                                                  Typical error reasons are the same as in open/2, read/1 and write/2.

                                                                                                  - Source + + Source +

                                                                                                  copy!(source, destination, bytes_count // :infinity) @@ -413,7 +439,9 @@

                                                                                                  Functions

                                                                                                  The same as copy/3 but raises an File.CopyError if it fails. Returns the bytes_copied otherwise.

                                                                                                  - Source + + Source +

                                                                                                  cp(source, destination, callback // fn _, _ -> true end) @@ -436,7 +464,9 @@

                                                                                                  Functions

                                                                                                  It returns :ok in case of success, returns { :error, reason } otherwise.

                                                                                                  - Source + + Source +

                                                                                                  cp!(source, destination, callback // fn _, _ -> true end) @@ -444,7 +474,9 @@

                                                                                                  Functions

                                                                                                  The same as cp/3, but raises File.CopyError if it fails. Returns the list of copied files otherwise.

                                                                                                  - Source + + Source +

                                                                                                  cp_r(source, destination, callback // fn _, _ -> true end) @@ -494,7 +526,9 @@

                                                                                                  Examples

                                                                                                  end
                                                                                - Source + + Source +

                                                                                cp_r!(source, destination, callback // fn _, _ -> true end) @@ -502,7 +536,9 @@

                                                                                Examples

                                                                                The same as cp_r/3, but raises File.CopyError if it fails. Returns the list of copied files otherwise.

                                                                                - Source + + Source +

                                                                                cwd() @@ -512,21 +548,27 @@

                                                                                Examples

                                                                                directories of the current directory. For this reason, returns { :ok, cwd } in case of success, { :error, reason } otherwise.

                                                                                - Source + + Source +

                                                                                cwd!()

                                                                                The same as cwd/0, but raises an exception if it fails.

                                                                                - Source + + Source +

                                                                                dir?(path)

                                                                                Returns true if the path is a directory.

                                                                                - Source + + Source +

                                                                                exists?(path) @@ -547,7 +589,9 @@

                                                                                Examples

                                                                                #=> true
                                                                - Source + + Source +

                                                                iterator(device) @@ -565,7 +609,8 @@

                                                                Examples

                                                                quotes per single quotes and write each line to a target file is shown below:

                                                                -
                                                                source = File.iterator("README.md")
                                                                +
                                                                { :ok, device } = File.open("README.md")
                                                                +source = File.iterator(device)
                                                                 File.open "NEWREADME.md", [:write], fn(target) ->
                                                                   Enum.each source, fn(line) ->
                                                                     IO.write target, Regex.replace(%r/"/, line, "'")
                                                                @@ -573,7 +618,9 @@ 

                                                                Examples

                                                                end
                                                                - Source + + Source +

                                                                iterator(file, mode) @@ -582,7 +629,9 @@

                                                                Examples

                                                                returns its iterator. Fails for the same reasons as File.open.

                                                                - Source + + Source +

                                                                iterator!(file, mode // []) @@ -590,7 +639,31 @@

                                                                Examples

                                                                Same as iterator/2 but raises if the file cannot be opened.

                                                                - Source + + Source + +
                                                                +

                                                                + ls(path // ".") +

                                                                +

                                                                Returns list of files in the given directory.

                                                                + +

                                                                It returns { :ok, [files] } in case of success, +{ :error, reason } otherwise.

                                                                +
                                                                + + Source + +
                                                                +

                                                                + ls!(dir // ".") +

                                                                +

                                                                The same as ls/1 but raises File.Error +in case of an error.

                                                                +
                                                                + + Source +

                                                                mkdir(path) @@ -609,14 +682,18 @@

                                                                Examples

                                                                On some platforms, :enoent is returned instead.
                                                              - Source + + Source +

                                                              mkdir!(path)

                                                              Same as mkdir, but raises an exception in case of failure. Otherwise :ok.

                                                              - Source + + Source +

                                                              mkdir_p(path) @@ -632,14 +709,18 @@

                                                              Examples

                                                            • :enotdir - A component of path is not a directory.
                                                            - Source + + Source +

                                                            mkdir_p!(path)

                                                            Same as mkdir_p, but raises an exception in case of failure. Otherwise :ok.

                                                            - Source + + Source +

                                                            open(path, modes // []) @@ -700,7 +781,9 @@

                                                            Examples

                                                            File.close(file)
                                                            - Source + + Source +

                                                            open(path, modes, function) @@ -720,12 +803,14 @@

                                                            Examples

                                                            Examples

                                                            -
                                                            File.open!("file.txt", [:read, :write], fn(file) ->
                                                            +
                                                            File.open("file.txt", [:read, :write], fn(file) ->
                                                               IO.readline(file)
                                                             end)
                                                             
                                                            - Source + + Source +

                                                            open!(path, modes // []) @@ -733,7 +818,9 @@

                                                            Examples

                                                            Same as open/2 but raises an error if file could not be opened. Returns the io_device otherwise.

                                                            - Source + + Source +

                                                            open!(path, modes, function) @@ -741,7 +828,9 @@

                                                            Examples

                                                            Same as open/3 but raises an error if file could not be opened. Returns the function result otherwise.

                                                            - Source + + Source +

                                                            read(path) @@ -763,7 +852,9 @@

                                                            Examples

                                                            You can use :file.format_error(reason) to get a descriptive string of the error.

                                                            - Source + + Source +

                                                            read!(path) @@ -771,7 +862,9 @@

                                                            Examples

                                                            Returns binary with the contents of the given filename or raises File.Error if an error occurs.

                                                            - Source + + Source +

                                                            regular?(path) @@ -783,7 +876,9 @@

                                                            Examples

                                                            File.regular? __FILE__ #=> true
                                                             
                                                            - Source + + Source +

                                                            rm(path) @@ -811,14 +906,18 @@

                                                            Examples

                                                            #=> {:error, :eperm}
                                                            - Source + + Source +

                                                            rm!(path)

                                                            Same as rm, but raises an exception in case of failure. Otherwise :ok.

                                                            - Source + + Source +

                                                            rm_rf(path) @@ -840,7 +939,9 @@

                                                            Examples

                                                            #=> { :ok, [] }
                                                            - Source + + Source +

                                                            rm_rf!(path) @@ -848,7 +949,9 @@

                                                            Examples

                                                            Same as rm_rf/1 but raises File.Error in case of failures, otherwise the list of files or directories removed.

                                                            - Source + + Source +

                                                            rmdir(path) @@ -865,14 +968,18 @@

                                                            Examples

                                                            #=> {:error, :enotdir}
                                                            - Source + + Source +

                                                            rmdir!(path)

                                                            Same as rmdir/1, but raises an exception in case of failure. Otherwise :ok.

                                                            - Source + + Source +

                                                            stat(path, opts // []) @@ -891,7 +998,9 @@

                                                            Options

                                                            Default is local.
                                                          - Source + + Source +

                                                          stat!(path, opts // []) @@ -899,7 +1008,9 @@

                                                          Options

                                                          Same as stat but returns the File.Stat directly and throws File.Error if an error is returned.

                                                          - Source + + Source +

                                                          touch(path, time // :calendar.local_time()) @@ -907,7 +1018,9 @@

                                                          Options

                                                          Updates modification time (mtime) and access time (atime) of the given file. File is created if it doesn’t exist.

                                                          - Source + + Source +

                                                          touch!(path, time // :calendar.local_time()) @@ -915,7 +1028,9 @@

                                                          Options

                                                          Same as touch/1 but raises an exception if it fails. Returns :ok otherwise.

                                                          - Source + + Source +

                                                          write(path, content, modes // []) @@ -935,14 +1050,18 @@

                                                          Options

                                                        • :eisdir - The named file is a directory.
                                                        - Source + + Source +

                                                        write!(path, content, modes // [])

                                                        Same as write/3 but raises an exception if it fails, returns :ok otherwise.

                                                        - Source + + Source +

                                                        write_stat(path, stat, opts // []) @@ -950,7 +1069,9 @@

                                                        Options

                                                        Writes the given File.Stat back to the filesystem at the given path. Returns :ok or { :error, reason }.

                                                        - Source + + Source +

                                                        write_stat!(path, stat, opts // []) @@ -958,7 +1079,9 @@

                                                        Options

                                                        Same as write_stat/3 but raises an exception if it fails. Returns :ok otherwise.

                                                        - Source + + Source +
                                                        diff --git a/docs/stable/FunctionClauseError.html b/docs/stable/FunctionClauseError.html index 32cd76236..7151988e6 100644 --- a/docs/stable/FunctionClauseError.html +++ b/docs/stable/FunctionClauseError.html @@ -59,7 +59,7 @@

                                                        Fields (and defaults)

                                                        -

                                                        Functions summary

                                                        +

                                                        Functions summary

                                                        • @@ -82,7 +82,9 @@

                                                          Functions

                                                          message(exception)

                                                          - Source + + Source + diff --git a/docs/stable/GenEvent.Behaviour.html b/docs/stable/GenEvent.Behaviour.html new file mode 100644 index 000000000..ace9b1c6a --- /dev/null +++ b/docs/stable/GenEvent.Behaviour.html @@ -0,0 +1,104 @@ + + + + GenEvent.Behaviour + + + + + + + + + + + + +
                                                          +

                                                          + GenEvent.Behaviour + +

                                                          + + +
                                                          +

                                                          This module is a convenience to define GenEvent callbacks in Elixir.

                                                          + +

                                                          GenEvent is an OTP behaviour that encapsulates event handling functionality.

                                                          + +

                                                          Example

                                                          + +

                                                          Bellow follows an example of a GenEvent that stores notifications +until they are fetched:

                                                          + +
                                                          defmodule MyEventHandler do
                                                          +  use GenEvent.Behaviour
                                                          +
                                                          +  # Callbacks
                                                          +
                                                          +  def init(_) do
                                                          +    { :ok, [] }
                                                          +  end
                                                          +
                                                          +  def handle_event({:notification, x}, notifications) do
                                                          +    { :ok, [x|notifications] }
                                                          +  end
                                                          +
                                                          +  def handle_call(:notifications, notifications) do
                                                          +    {:ok, Enum.reverse(notifications), []}
                                                          +  end
                                                          +
                                                          +end
                                                          +
                                                          +{ :ok, pid } = :gen_event.start_link
                                                          +
                                                          +:gen_event.add_handler(pid, MyEventHandler, [])
                                                          +
                                                          +:gen_event.notify(pid, {:notification, 1})
                                                          +:gen_event.notify(pid, {:notification, 2})
                                                          +
                                                          +:gen_event.call(pid, MyEventHandler, :notifications)
                                                          +#=> [1, 2]
                                                          +
                                                          +:gen_event.call(pid, MyEventHandler, :notifications)
                                                          +#=> []
                                                          +
                                                          + +

                                                          Notice we never call the server callbacks directly, they are called +by OTP whenever we interact with the server.

                                                          + +

                                                          Starting and sending messages to gen_event is done +via Erlang's :gen_event module. For more information, +please refer to the following:

                                                          + +

                                                          http://www.erlang.org/doc/man/gen_event.html +http://learnyousomeerlang.com/event-handlers

                                                          + +
                                                          + + + Source + + + + + + + + + + + + + + + + +
                                                          + + diff --git a/docs/stable/HashDict.html b/docs/stable/HashDict.html index 50c32bcc3..098522ace 100644 --- a/docs/stable/HashDict.html +++ b/docs/stable/HashDict.html @@ -44,7 +44,7 @@

                                                          -

                                                          Functions summary

                                                          +

                                                          Functions summary

                                                          • @@ -148,21 +148,27 @@

                                                            Functions

                                                            Deletes a value from the dict.

                                                            - Source + + Source +

                                                            empty(_)

                                                            Returns an empty dict.

                                                            - Source + + Source +

                                                            get(dict, key, default // nil)

                                                            Gets the value under key from the dict.

                                                            - Source + + Source +

                                                            get!(dict, key) @@ -170,35 +176,45 @@

                                                            Functions

                                                            Gets the value under key from the dict, raises KeyError if such key does not exist.

                                                            - Source + + Source +

                                                            has_key?(dict, key)

                                                            Checks if the dict has the given key.

                                                            - Source + + Source +

                                                            keys(dict)

                                                            Get all keys in the dict.

                                                            - Source + + Source +

                                                            merge(dict, enum, callback // fn _k, _v1, v2 -> v2 end)

                                                            Merges two dictionaries.

                                                            - Source + + Source +

                                                            new()

                                                            Creates a new empty dict.

                                                            - Source + + Source +

                                                            new(pairs) @@ -208,10 +224,12 @@

                                                            Functions

                                                            Examples

                                                            HashDict.new [{:b,1},{:a,2}]
                                                            -#=> HashDict[a: 1, b: 2]
                                                            +#=> #HashDict<[a: 2, b: 1]>
                                                             
                                                            - Source + + Source +

                                                            new(list, transform) @@ -222,17 +240,21 @@

                                                            Examples

                                                            Examples

                                                            HashDict.new ["a", "b"], fn x -> {x, x} end
                                                            -#=> HashDict[{ "a", "a" }, { "b", "b" }]
                                                            +#=> #HashDict<[{"a","a"},{"b","b"}]>
                                                             
                                                            - Source + + Source +

                                                            put(dict, key, value)

                                                            Puts the given key and value in the dict.

                                                            - Source + + Source +

                                                            put_new(dict, key, value) @@ -240,21 +262,27 @@

                                                            Examples

                                                            Puts the given value under key in the dictionary only if one does not exist yet.

                                                            - Source + + Source +

                                                            size(dict)

                                                            Returns the dict size.

                                                            - Source + + Source +

                                                            to_list(dict)

                                                            Converts the dict to a list.

                                                            - Source + + Source +

                                                            update(dict, key, fun) @@ -263,7 +291,9 @@

                                                            Examples

                                                            to the given function. Raises if the key does not exist in the dictionary.

                                                            - Source + + Source +

                                                            update(dict, key, initial, fun) @@ -272,14 +302,18 @@

                                                            Examples

                                                            to the given function. Adds initial value if the key does not exist in the dicionary.

                                                            - Source + + Source +

                                                            values(dict)

                                                            Get all values in the dict.

                                                            - Source + + Source +
                                                            diff --git a/docs/stable/IEx.Autocomplete.html b/docs/stable/IEx.Autocomplete.html index 1adbb5e45..fe5735391 100644 --- a/docs/stable/IEx.Autocomplete.html +++ b/docs/stable/IEx.Autocomplete.html @@ -39,7 +39,7 @@

                                                            -

                                                            Functions summary

                                                            +

                                                            Functions summary

                                                            • @@ -62,7 +62,9 @@

                                                              Functions

                                                              expand(expr)

                                                              - Source + + Source + diff --git a/docs/stable/IEx.Helpers.html b/docs/stable/IEx.Helpers.html index 9168bad82..d9432d54c 100644 --- a/docs/stable/IEx.Helpers.html +++ b/docs/stable/IEx.Helpers.html @@ -40,15 +40,17 @@

                                                              • c/2 - compiles a file in the given path
                                                              • +
                                                              • cd/1 - changes the current directory
                                                              • +
                                                              • flush/0 — flush all messages sent to the shell
                                                              • h/0, h/1 - prints help/documentation
                                                              • -
                                                              • t/1 — prints type information
                                                              • -
                                                              • s/1 — prints spec information
                                                              • +
                                                              • l/1 - loads given module beam code by purging the current version
                                                              • m/0 - prints loaded modules
                                                              • +
                                                              • pwd/0 - prints the current working directory
                                                              • r/0, r/1 - recompiles and reloads the given module's source file
                                                              • -
                                                              • l/1 - loads given module beam code by purging the current version
                                                              • +
                                                              • s/1 — prints spec information
                                                              • +
                                                              • t/1 — prints type information
                                                              • v/0 - prints all commands and values
                                                              • v/1 - retrieves nth value from console
                                                              • -
                                                              • flush/0 — flush all messages sent to the shell

                                                              Help for functions in this module can be consulted @@ -74,13 +76,18 @@

                                                              -

                                                              Functions summary

                                                              +

                                                              Functions summary

                                                              • c/2
                                                              • +
                                                              • + + cd/1 + +
                                                              • flush/0 @@ -101,6 +108,11 @@

                                                                Functions summary

                                                                m/0
                                                              • +
                                                              • + + pwd/0 + +
                                                              • r/0 @@ -126,7 +138,7 @@

                                                                Functions summary

                                                                -

                                                                Macros summary

                                                                +

                                                                Macros summary

                                                                • @@ -163,38 +175,66 @@

                                                                  Functions

                                                                  Examples

                                                                  c ["foo.ex"], "ebin"
                                                                  -#=> Foo
                                                                  +#=> [Foo]
                                                                   
                                                                  - Source + + Source + +
                                                                  +

                                                                  + cd(directory) +

                                                                  +

                                                                  Changes the shell directory to the given path.

                                                                  +
                                                                  + + Source +

                                                                  flush()

                                                                  Flushes all messages sent to the shell and prints them out

                                                                  - Source + + Source +

                                                                  h()

                                                                  Shows the documentation for IEx.Helpers.

                                                                  - Source + + Source +

                                                                  l(module)

                                                                  Purges and reloads specified module

                                                                  - Source + + Source +

                                                                  m()

                                                                  Returns the name and module of all modules loaded.

                                                                  - Source + + Source + +
                                                                  +

                                                                  + pwd() +

                                                                  +

                                                                  Prints the current working directory.

                                                                  +
                                                                  + + Source +

                                                                  r() @@ -202,7 +242,9 @@

                                                                  Examples

                                                                  Reloads all modules that were already reloaded at some point with r/1.

                                                                  - Source + + Source +

                                                                  r(module) @@ -212,14 +254,18 @@

                                                                  Examples

                                                                  Please note that all the modules defined in the specified files are recompiled and reloaded.

                                                                  - Source + + Source +

                                                                  v()

                                                                  Prints commands history and their result.

                                                                  - Source + + Source +

                                                                  v(n) @@ -228,7 +274,9 @@

                                                                  Examples

                                                                  values to lookup query's value from latest to earliest. For instance, v(-1) returns the latest result.

                                                                  - Source + + Source + @@ -257,7 +305,9 @@

                                                                  Examples

                                                                  h Enum.all? - Source + + Source +

                                                                  s(module) @@ -273,12 +323,14 @@

                                                                  Examples

                                                                  s(list_to_atom/1)
                                                                  - Source + + Source +

                                                                  t(module)

                                                                  -

                                                                  Prints all types for the given module or prints out a specified type's +

                                                                  Prints all types for the given module or prints out a specified type's specification

                                                                  Examples

                                                                  @@ -288,7 +340,9 @@

                                                                  Examples

                                                                  t(Enum.t)
                                                                  - Source + + Source +
                                                                  diff --git a/docs/stable/IEx.Remsh.html b/docs/stable/IEx.Remsh.html index dccec5b12..65dd784a1 100644 --- a/docs/stable/IEx.Remsh.html +++ b/docs/stable/IEx.Remsh.html @@ -52,7 +52,7 @@

                                                                  -

                                                                  Functions summary

                                                                  +

                                                                  Functions summary

                                                                  • @@ -75,7 +75,9 @@

                                                                    Functions

                                                                    expand(node)

                                                                    - Source + + Source + diff --git a/docs/stable/IEx.html b/docs/stable/IEx.html index e59273ac1..e912bcfe5 100644 --- a/docs/stable/IEx.html +++ b/docs/stable/IEx.html @@ -50,7 +50,7 @@

                                                                    -

                                                                    Functions summary

                                                                    +

                                                                    Functions summary

                                                                    • @@ -94,35 +94,45 @@

                                                                      Functions

                                                                      Returns registered after spawn callbacks.

                                                                      - Source + + Source +

                                                                      after_spawn(fun)

                                                                      Registers a function to be invoked after IEx process is spawned.

                                                                      - Source + + Source +

                                                                      inspect_opts()

                                                                      Returns currently registered inspect options.

                                                                      - Source + + Source +

                                                                      inspect_opts(opts)

                                                                      Registers options used on inspect.

                                                                      - Source + + Source +

                                                                      started?()

                                                                      Returns true if IEx was properly started.

                                                                      - Source + + Source +
                                                                      diff --git a/docs/stable/IO.ANSI.html b/docs/stable/IO.ANSI.html index ccb191541..a9dc2aae3 100644 --- a/docs/stable/IO.ANSI.html +++ b/docs/stable/IO.ANSI.html @@ -45,7 +45,7 @@

                                                                      -

                                                                      Functions summary

                                                                      +

                                                                      Functions summary

                                                                      • @@ -319,105 +319,135 @@

                                                                        Functions

                                                                        Sets foreground color to black

                                                                        - Source + + Source +

                                                                        black_background()

                                                                        Sets background color to black

                                                                        - Source + + Source +

                                                                        Blink: off

                                                                        - Source + + Source +

                                                                        Blink: Rapid. MS-DOS ANSI.SYS; 150 per minute or more; not widely supported

                                                                        - Source + + Source +

                                                                        Blink: Slow. Less than 150 per minute

                                                                        - Source + + Source +

                                                                        blue()

                                                                        Sets foreground color to blue

                                                                        - Source + + Source +

                                                                        blue_background()

                                                                        Sets background color to blue

                                                                        - Source + + Source +

                                                                        bright()

                                                                        Bright (increased intensity) or Bold

                                                                        - Source + + Source +

                                                                        conceal()

                                                                        Conceal. Not widely supported

                                                                        - Source + + Source +

                                                                        crossed_out()

                                                                        Crossed-out. Characters legible, but marked for deletion. Not widely supported.

                                                                        - Source + + Source +

                                                                        cyan()

                                                                        Sets foreground color to cyan

                                                                        - Source + + Source +

                                                                        cyan_background()

                                                                        Sets background color to cyan

                                                                        - Source + + Source +

                                                                        default_background()

                                                                        Default background color

                                                                        - Source + + Source +

                                                                        default_color()

                                                                        Default text color

                                                                        - Source + + Source +

                                                                        encircled()

                                                                        Encircled

                                                                        - Source + + Source +

                                                                        escape(string, emit // terminal?()) @@ -437,10 +467,12 @@

                                                                        Functions

                                                                        Example

                                                                        -

                                                                        IO.ANSI.escape "Hello %{red,bright,green}yes" #=> +

                                                                        iex> IO.ANSI.escape "Hello %{red,bright,green}yes" "Hello \e[31m\e[1m\e[32myes\e[0m"

                                                                        - Source + + Source +

                                                                        escape_fragment(string, emit // terminal?()) @@ -457,206 +489,264 @@

                                                                        Example

                                                                        Example

                                                                        -

                                                                        IO.ANSI.escape "Hello %{red,bright,green}yes%{reset}" #=> +

                                                                        iex> IO.ANSI.escape "Hello %{red,bright,green}yes" "Hello \e[31m\e[1m\e[32myes\e[0m"

                                                                        - Source + + Source +

                                                                        faint()

                                                                        Faint (decreased intensity), not widely supported

                                                                        - Source + + Source +

                                                                        font_1()

                                                                        Sets alternative font 1

                                                                        - Source + + Source +

                                                                        font_2()

                                                                        Sets alternative font 2

                                                                        - Source + + Source +

                                                                        font_3()

                                                                        Sets alternative font 3

                                                                        - Source + + Source +

                                                                        font_4()

                                                                        Sets alternative font 4

                                                                        - Source + + Source +

                                                                        font_5()

                                                                        Sets alternative font 5

                                                                        - Source + + Source +

                                                                        font_6()

                                                                        Sets alternative font 6

                                                                        - Source + + Source +

                                                                        font_7()

                                                                        Sets alternative font 7

                                                                        - Source + + Source +

                                                                        font_8()

                                                                        Sets alternative font 8

                                                                        - Source + + Source +

                                                                        font_9()

                                                                        Sets alternative font 9

                                                                        - Source + + Source +

                                                                        framed()

                                                                        Framed

                                                                        - Source + + Source +

                                                                        green()

                                                                        Sets foreground color to green

                                                                        - Source + + Source +

                                                                        green_background()

                                                                        Sets background color to green

                                                                        - Source + + Source +

                                                                        inverse()

                                                                        Image: Negative. Swap foreground and background

                                                                        - Source + + Source +

                                                                        italic()

                                                                        Italic: on. Not widely supported. Sometimes treated as inverse.

                                                                        - Source + + Source +

                                                                        magenta()

                                                                        Sets foreground color to magenta

                                                                        - Source + + Source +

                                                                        magenta_background()

                                                                        Sets background color to magenta

                                                                        - Source + + Source +

                                                                        no_underline()

                                                                        Underline: None

                                                                        - Source + + Source +

                                                                        normal()

                                                                        Normal color or intensity

                                                                        - Source + + Source +

                                                                        not_framed_encircled()

                                                                        Not framed or encircled

                                                                        - Source + + Source +

                                                                        not_italic()

                                                                        Not italic

                                                                        - Source + + Source +

                                                                        not_overlined()

                                                                        Not overlined

                                                                        - Source + + Source +

                                                                        overlined()

                                                                        Overlined

                                                                        - Source + + Source +

                                                                        primary_font()

                                                                        Sets primary (default) font

                                                                        - Source + + Source +

                                                                        red()

                                                                        Sets foreground color to red

                                                                        - Source + + Source +

                                                                        red_background()

                                                                        Sets background color to red

                                                                        - Source + + Source +

                                                                        reset()

                                                                        Resets all attributes

                                                                        - Source + + Source +

                                                                        reverse()

                                                                        Image: Negative. Swap foreground and background

                                                                        - Source + + Source +

                                                                        terminal?(device // :erlang.group_leader()) @@ -671,42 +761,54 @@

                                                                        Example

                                                                        Erlang shell did not support ANSI escape sequences up until R16.

                                                                        - Source + + Source +

                                                                        underline()

                                                                        Underline: Single

                                                                        - Source + + Source +

                                                                        white()

                                                                        Sets foreground color to white

                                                                        - Source + + Source +

                                                                        white_background()

                                                                        Sets background color to white

                                                                        - Source + + Source +

                                                                        yellow()

                                                                        Sets foreground color to yellow

                                                                        - Source + + Source +

                                                                        yellow_background()

                                                                        Sets background color to yellow

                                                                        - Source + + Source +
                                                                        diff --git a/docs/stable/IO.html b/docs/stable/IO.html index 502c43f03..7d022a6b2 100644 --- a/docs/stable/IO.html +++ b/docs/stable/IO.html @@ -57,7 +57,7 @@

                                                                        -

                                                                        Functions summary

                                                                        +

                                                                        Functions summary

                                                                        • @@ -134,7 +134,9 @@

                                                                          Functions

                                                                          Check read/2 for more information.

                                                                          - Source + + Source +

                                                                          binreadline(device // group_leader()) @@ -144,7 +146,9 @@

                                                                          Functions

                                                                          Check readline/1 for more information.

                                                                          - Source + + Source +

                                                                          binwrite(device // group_leader(), item) @@ -154,7 +158,9 @@

                                                                          Functions

                                                                          Check write/2 for more information.

                                                                          - Source + + Source +

                                                                          getb(device // group_leader(), prompt, count // 1) @@ -169,7 +175,9 @@

                                                                          Functions

                                                                          NFS file system.

                                                                        - Source + + Source +

                                                                        gets(device // group_leader(), prompt) @@ -185,7 +193,9 @@

                                                                        Functions

                                                                        NFS file system.

                                                                      - Source + + Source +

                                                                      inspect(item, opts // []) @@ -198,14 +208,18 @@

                                                                      Examples

                                                                      IO.inspect Process.list
                                                                       
                                                                      - Source + + Source +

                                                                      inspect(device, item, opts)

                                                                      Inspects the item with options using the given device.

                                                                      - Source + + Source +

                                                                      puts(device // group_leader(), item) @@ -214,7 +228,9 @@

                                                                      Examples

                                                                      but adds a new line at the end. The argument is expected to be a chardata.

                                                                      - Source + + Source +

                                                                      read(device // group_leader(), count) @@ -229,7 +245,9 @@

                                                                      Examples

                                                                      NFS file system.

                                                                    - Source + + Source +

                                                                    readline(device // group_leader()) @@ -247,7 +265,9 @@

                                                                    Examples

                                                                    This function does the same as gets/2, except the prompt is not required as argument.

                                                                    - Source + + Source +

                                                                    write(device // group_leader(), item) @@ -268,7 +288,9 @@

                                                                    Examples

                                                                    #=> "error"
                                                                    - Source + + Source + diff --git a/docs/stable/Kernel.CLI.html b/docs/stable/Kernel.CLI.html index 2ec5a7213..8a5977726 100644 --- a/docs/stable/Kernel.CLI.html +++ b/docs/stable/Kernel.CLI.html @@ -39,7 +39,7 @@

                                                                    -

                                                                    Functions summary

                                                                    +

                                                                    Functions summary

                                                                    • @@ -68,7 +68,9 @@

                                                                      Functions

                                                                      This function is used by Elixir's CLI and also by escripts generated by Elixir.

                                                                      - Source + + Source + diff --git a/docs/stable/Kernel.ParallelCompiler.html b/docs/stable/Kernel.ParallelCompiler.html index 3fd745332..6ce506b69 100644 --- a/docs/stable/Kernel.ParallelCompiler.html +++ b/docs/stable/Kernel.ParallelCompiler.html @@ -39,7 +39,7 @@

                                                                      -

                                                                      Functions summary

                                                                      +

                                                                      Functions summary

                                                                      • @@ -76,7 +76,9 @@

                                                                        Functions

                                                                        A callback that is invoked every time a file is compiled with its name can be optionally given as argument.

                                                                        - Source + + Source +

                                                                        files_to_path(files, path, callback // default_callback) @@ -84,7 +86,9 @@

                                                                        Functions

                                                                        Compiles the given files to the given path. Read files/2 for more information.

                                                                        - Source + + Source +
                                                                        diff --git a/docs/stable/Kernel.ParallelRequire.html b/docs/stable/Kernel.ParallelRequire.html index 1c441f715..e15fce868 100644 --- a/docs/stable/Kernel.ParallelRequire.html +++ b/docs/stable/Kernel.ParallelRequire.html @@ -39,7 +39,7 @@

                                                                        -

                                                                        Functions summary

                                                                        +

                                                                        Functions summary

                                                                        • @@ -66,7 +66,9 @@

                                                                          Functions

                                                                          A callback that is invoked every time a file is required can be optionally given as argument.

                                                                          - Source + + Source + diff --git a/docs/stable/Kernel.SpecialForms.html b/docs/stable/Kernel.SpecialForms.html index 4df9096c0..a640ea5a6 100644 --- a/docs/stable/Kernel.SpecialForms.html +++ b/docs/stable/Kernel.SpecialForms.html @@ -57,7 +57,7 @@

                                                                          -

                                                                          Macros summary

                                                                          +

                                                                          Macros summary

                                                                          • @@ -101,12 +101,12 @@

                                                                            Macros summary

                                                                          • - alias/2 + alias/0
                                                                          • - alias!/1 + alias/2
                                                                          • @@ -134,16 +134,6 @@

                                                                            Macros summary

                                                                            require/2
                                                                          • -
                                                                          • - - unquote/1 - -
                                                                          • -
                                                                          • - - unquote_splicing/1 - -
                                                                          • var!/1 @@ -178,7 +168,7 @@

                                                                            Macros

                                                                            Examples

                                                                            -
                                                                            :<<>>.(1,2,3)
                                                                            +
                                                                            iex> << 1, 2, 3 >>
                                                                             << 1, 2, 3 >>
                                                                             
                                                                            @@ -188,17 +178,17 @@

                                                                            Bitstring types

                                                                            specific types. Most of the time, Elixir will figure out the part's type and won't require any work from you:

                                                                            -
                                                                            <<102, "oo">>
                                                                            -#=> "foo"
                                                                            +
                                                                            iex> <<102, "oo">>
                                                                            +"foo"
                                                                             

                                                                            Above we have two parts: the first is an integer and the second is a binary. If we use any other Elixir expression, Elixir can no longer guess the type:

                                                                            -
                                                                            rest = "oo"
                                                                            -<<102, rest>>
                                                                            -#=> ** (ArgumentError) argument error
                                                                            +
                                                                            iex> rest = "oo"
                                                                            +...> <<102, rest>>
                                                                            +** (ArgumentError) argument error
                                                                             

                                                                            When a variable or expression is given as a binary part, @@ -231,8 +221,8 @@

                                                                            Bitstring types

                                                                            signedness only matters for matching. If unspecified, it defaults to unsigned. Example:

                                                                            -
                                                                            <<-100 :: signed, rest :: binary>> = <<-100, "foo">>
                                                                            -#=> <<156,102,111,111>>
                                                                            +
                                                                            iex> <<-100 :: signed, _rest :: binary>> = <<-100, "foo">>
                                                                            +<<156,102,111,111>>
                                                                             

                                                                            This match would have failed if we did not specify that the @@ -241,9 +231,9 @@

                                                                            Bitstring types

                                                                            will simply be interpreted as having the given (or implied) signedness, e.g.:

                                                                            -
                                                                            <<val, rest :: binary>> = <<-100, "foo">>
                                                                            -val
                                                                            -#=> 156
                                                                            +
                                                                            iex> <<val, _rest :: binary>> = <<-100, "foo">>
                                                                            +...> val
                                                                            +156
                                                                             

                                                                            Here, val is interpreted as unsigned.

                                                                            @@ -271,13 +261,13 @@

                                                                            Bitstring types

                                                                            unit is multiplied by the size to give the effective size of the part:

                                                                            -
                                                                            <<102, rest :: [size(2), unit(8)]>> = "foo"
                                                                            +
                                                                            iex> <<102, _rest :: [size(2), unit(8)]>> = "foo"
                                                                             "foo"
                                                                             
                                                                            -<<102, rest :: size(16)>> = "foo"
                                                                            +iex> <<102, _rest :: size(16)>> = "foo"
                                                                             "foo"
                                                                             
                                                                            -<<102, rest :: size(32)>> = "foo"
                                                                            +iex> <<102, _rest :: size(32)>> = "foo"
                                                                             ** (MatchError) no match of right hand side value: "foo"
                                                                             
                                                                            @@ -300,7 +290,8 @@

                                                                            Bitstring types

                                                                            writing size(8), one can write just 8 and it will be interpreted as size(8)

                                                                            -
                                                                            << 1 :: 3 >> == << 1 :: size(3) >> #=> true
                                                                            +
                                                                            iex> << 1 :: 3 >> == << 1 :: size(3) >>
                                                                            +true
                                                                             

                                                                            The default unit for integers, floats, and bitstrings is 1. For @@ -309,7 +300,9 @@

                                                                            Bitstring types

                                                                            For floats, unit * size must result in 32 or 64, corresponding to binary32 and binary64, respectively.

                                                                            - Source + + Source +

                                                                            [args] @@ -322,7 +315,9 @@

                                                                            Examples

                                                                            [ 1, 2, 3 ]
                                                                            - Source + + Source +

                                                                            __ENV__() @@ -331,7 +326,9 @@

                                                                            Examples

                                                                            record. In the environment you can access the current filename, line numbers, set up aliases, the current function and others.

                                                                            - Source + + Source +

                                                                            __FILE__() @@ -340,7 +337,9 @@

                                                                            Examples

                                                                            Although the file can be accessed in the ENV, this macro is a convenient shortcut.

                                                                            - Source + + Source +

                                                                            __MODULE__() @@ -349,7 +348,9 @@

                                                                            Examples

                                                                            Although the module can be accessed in the ENV, this macro is a convenient shortcut.

                                                                            - Source + + Source +

                                                                            args @@ -357,14 +358,14 @@

                                                                            Examples

                                                                            This is the special form used to hold aliases information. It is usually compiled to an atom:

                                                                            -
                                                                            quote do: Foo.Bar
                                                                            +
                                                                            quote do: Foo.Bar #=>
                                                                             { :__aliases__, [], [:Foo,:Bar] }
                                                                             

                                                                            Elixir represents Foo.Bar as __aliases__ so calls can be unambiguously identified by the operator :.. For example:

                                                                            -
                                                                            quote do: Foo.bar
                                                                            +
                                                                            quote do: Foo.bar #=>
                                                                             {{:.,[],[{:__aliases__,[],[:Foo]},:bar]},[],[]}
                                                                             
                                                                            @@ -392,7 +393,9 @@

                                                                            Examples

                                                                              Module.concat [some_var, Foo]
                                                                             
                                                                            - Source + + Source +

                                                                            args @@ -401,11 +404,13 @@

                                                                            Examples

                                                                            of expressions in Elixir. This special form is private and should not be invoked directly:

                                                                            -
                                                                            quote do: (1; 2; 3)
                                                                            -#=> { :__block__, [], [1,2,3] }
                                                                            +
                                                                            iex> quote do: (1; 2; 3)
                                                                            +{ :__block__, [], [1,2,3] }
                                                                             
                                                                            - Source + + Source +

                                                                            __scope__(opts, args) @@ -421,7 +426,20 @@

                                                                            Examples

                                                                            Check quote/1 for more information.

                                                                            - Source + + Source + +
                                                                            +

                                                                            + alias() +

                                                                            +

                                                                            When used inside quoting, marks that the alias should not +be hygienezed. This means the alias will be expanded when +the macro is expanded.

                                                                            +
                                                                            + + Source +

                                                                            alias(module, opts) @@ -465,16 +483,9 @@

                                                                            Lexical scope

                                                                            have lexical scope. This means you can set up aliases inside specific functions and it won't affect the overall scope.

                                                                            - Source -
                                                                            -

                                                                            - alias!(alias) -

                                                                            -

                                                                            When used inside quoting, marks that the alias should not -be hygienezed. This means the alias will be expanded when -the macro is expanded.

                                                                            -
                                                                            - Source + + Source +

                                                                            bc(args) @@ -484,11 +495,13 @@

                                                                            Lexical scope

                                                                            be a bitstring. For example, here is how to remove all spaces from a string:

                                                                            -
                                                                            bc <<c>> inbits " hello world ", c != ? , do: <<c>>
                                                                            +
                                                                            iex> bc <<c>> inbits " hello world ", c != ? , do: <<c>>
                                                                             "helloworld"
                                                                             
                                                                            - Source + + Source +

                                                                            import(module, opts) @@ -502,8 +515,9 @@

                                                                            Examples

                                                                            import those functions and reference them as local functions, for example:

                                                                            -
                                                                            import List
                                                                            -flatten([1,[2],3]) #=> [1,2,3]
                                                                            +
                                                                            iex> import List
                                                                            +...> flatten([1,[2],3])
                                                                            +[1,2,3]
                                                                             

                                                                            Selector

                                                                            @@ -565,16 +579,25 @@

                                                                            Alias/Require shortcut

                                                                            All imported modules are also required by default. import also accepts as: as an option so it automatically sets up an alias. Please check alias for more information.

                                                                            + +

                                                                            Ambiguous function/macro names

                                                                            + +

                                                                            If two modules A and B are imported and they both contain +a foo function with an arity of 1, an error is only emitted +if an ambiguous call to foo/1 is actually made; that is, the +errors are emitted lazily, not eagerly.

                                                                            - Source + + Source +

                                                                            lc(args)

                                                                            List comprehensions allow you to quickly build a list from another list:

                                                                            -
                                                                            lc n inlist [1,2,3,4], do: n * 2
                                                                            -#=> [2,4,6,8]
                                                                            +
                                                                            iex> lc n inlist [1,2,3,4], do: n * 2
                                                                            +[2,4,6,8]
                                                                             

                                                                            A comprehension accepts many generators and also filters. Generators @@ -582,39 +605,41 @@

                                                                            Alias/Require shortcut

                                                                            to loop lists and bitstrings:

                                                                            # A list generator:
                                                                            -lc n inlist [1,2,3,4], do: n * 2
                                                                            -#=> [2,4,6,8]
                                                                            +iex> lc n inlist [1,2,3,4], do: n * 2
                                                                            +[2,4,6,8]
                                                                             
                                                                             # A bit string generator:
                                                                            -lc <<n>> inbits <<1,2,3,4>>, do: n * 2
                                                                            -#=> [2,4,6,8]
                                                                            +iex> lc <<n>> inbits <<1,2,3,4>>, do: n * 2
                                                                            +[2,4,6,8]
                                                                             
                                                                             # A generator from a variable:
                                                                            -list = [1,2,3,4]
                                                                            -lc n inlist list, do: n * 2
                                                                            -#=> [2,4,6,8]
                                                                            +iex> list = [1,2,3,4]
                                                                            +...> lc n inlist list, do: n * 2
                                                                            +[2,4,6,8]
                                                                             
                                                                             # A comprehension with two generators
                                                                            -lc x inlist [1,2], y inlist [2,3], do: x*y
                                                                            -#=> [2,3,4,6]
                                                                            +iex> lc x inlist [1,2], y inlist [2,3], do: x*y
                                                                            +[2,3,4,6]
                                                                             

                                                                            Filters can also be given:

                                                                            # A comprehension with a generator and a filter
                                                                            -lc n inlist [1,2,3,4,5,6], rem(n, 2) == 0, do: n
                                                                            -#=> [2,4,6]
                                                                            +iex> lc n inlist [1,2,3,4,5,6], rem(n, 2) == 0, do: n
                                                                            +[2,4,6]
                                                                             

                                                                            Bit string generators are quite useful when you need to organize bit string streams:

                                                                            iex> pixels = <<213,45,132,64,76,32,76,0,0,234,32,15>>
                                                                            -iex> lc <<r:8,g:8,b:8>> inbits pixels, do: {r,g,b}
                                                                            +iex> lc <<r::8,g::8,b::8>> inbits pixels, do: {r,g,b}
                                                                             [{213,45,132},{64,76,32},{76,0,0},{234,32,15}]
                                                                             
                                                                            - Source + + Source +

                                                                            quote(opts, block) @@ -623,8 +648,8 @@

                                                                            Alias/Require shortcut

                                                                            Examples

                                                                            -
                                                                            quote do: sum(1, 2, 3)
                                                                            -#=> { :sum, [], [1, 2, 3] }
                                                                            +
                                                                            iex> quote do: sum(1, 2, 3)
                                                                            +{ :sum, [], [1, 2, 3] }
                                                                             

                                                                            Explanation

                                                                            @@ -892,7 +917,9 @@

                                                                            Stacktrace information

                                                                            particular, the macro __FILE__ and exceptions happening inside the quote will always point to GenServer.Behaviour file.

                                                                            - Source + + Source +

                                                                            require(module, opts) @@ -923,51 +950,9 @@

                                                                            Alias shortcut

                                                                            require also accepts as: as an option so it automatically sets up an alias. Please check alias for more information.

                                                                            - Source -
                                                                            -

                                                                            - unquote(expr) -

                                                                            -

                                                                            Unquotes the given expression from inside a macro.

                                                                            - -

                                                                            Examples

                                                                            - -

                                                                            Imagine the situation you have a variable name and -you want to inject it inside some quote. The first attempt -would be:

                                                                            - -
                                                                            value = 13
                                                                            -quote do: sum(1, value, 3)
                                                                            -
                                                                            - -

                                                                            Which would then return:

                                                                            - -
                                                                            { :sum, [], [1, { :value, [], quoted }, 3] }
                                                                            -
                                                                            - -

                                                                            Which is not the expected result. For this, we use unquote:

                                                                            - -
                                                                            value = 13
                                                                            -quote do: sum(1, unquote(value), 3)
                                                                            -#=> { :sum, [], [1, 13, 3] }
                                                                            -
                                                                            -
                                                                            - Source -
                                                                            -

                                                                            - unquote_splicing(expr) -

                                                                            -

                                                                            Unquotes the given list expanding its arguments. Similar -to unquote.

                                                                            - -

                                                                            Examples

                                                                            - -
                                                                            values = [2,3,4]
                                                                            -quote do: sum(1, unquote_splicing(values), 5)
                                                                            -#=> { :sum, [], [1, 2, 3, 4, 5] }
                                                                            -
                                                                            -
                                                                            - Source + + Source +

                                                                            var!(var) @@ -978,7 +963,9 @@

                                                                            Examples

                                                                            one is an atom) or an atom representing the variable name. Check quote/2 for more information.

                                                                            - Source + + Source +

                                                                            var!(var, context) @@ -986,7 +973,9 @@

                                                                            Examples

                                                                            Defines a variable in the given context. Check quote/2 for more information.

                                                                            - Source + + Source +

                                                                            {args} @@ -999,7 +988,9 @@

                                                                            Examples

                                                                            { 1, 2, 3 }
                                                                            - Source + + Source + diff --git a/docs/stable/Kernel.Typespec.html b/docs/stable/Kernel.Typespec.html index 8c2a7b99b..044d3dc6e 100644 --- a/docs/stable/Kernel.Typespec.html +++ b/docs/stable/Kernel.Typespec.html @@ -126,7 +126,7 @@

                                                                            Notes

                                                                            -

                                                                            Functions summary

                                                                            +

                                                                            Functions summary

                                                                            • @@ -188,7 +188,7 @@

                                                                              Functions summary

                                                                              -

                                                                              Macros summary

                                                                              +

                                                                              Macros summary

                                                                              • @@ -236,7 +236,9 @@

                                                                                Functions

                                                                                The module has to have a corresponding beam file on the file system.

                                                                                - Source + + Source +

                                                                                beam_specs(module) @@ -249,7 +251,9 @@

                                                                                Functions

                                                                                The module has to have a corresponding beam file on the file system.

                                                                                - Source + + Source +

                                                                                beam_types(module) @@ -262,28 +266,36 @@

                                                                                Functions

                                                                                The module has to have a corresponding beam file on the file system.

                                                                                - Source + + Source +

                                                                                define_callback(module, tuple, definition)

                                                                                Defines a callback by receiving Erlang's typespec.

                                                                                - Source + + Source +

                                                                                define_spec(module, tuple, definition)

                                                                                Defines a spec by receiving Erlang's typespec.

                                                                                - Source + + Source +

                                                                                define_type(module, kind, type)

                                                                                Defines a type, typep or opaque by receiving Erlang's typespec.

                                                                                - Source + + Source +

                                                                                defines_callback?(module, name, arity) @@ -291,7 +303,9 @@

                                                                                Functions

                                                                                Returns true if the current module defines a callback. This function is only available for modules being compiled.

                                                                                - Source + + Source +

                                                                                defines_spec?(module, name, arity) @@ -299,7 +313,9 @@

                                                                                Functions

                                                                                Returns true if the current module defines a given spec. This function is only available for modules being compiled.

                                                                                - Source + + Source +

                                                                                defines_type?(module, name, arity) @@ -308,21 +324,27 @@

                                                                                Functions

                                                                                (private, opaque or not). This function is only available for modules being compiled.

                                                                                - Source + + Source +

                                                                                spec_to_ast(name, arg2)

                                                                                Converts a spec clause back to Elixir AST.

                                                                                - Source + + Source +

                                                                                type_to_ast(arg1)

                                                                                Converts a type clause back to Elixir AST.

                                                                                - Source + + Source +
                                                                                @@ -342,7 +364,9 @@

                                                                                Examples

                                                                                @callback add(number, number) :: number
                                                                                 
                                                                                - Source + + Source +

                                                                                defopaque(type) @@ -355,7 +379,9 @@

                                                                                Examples

                                                                                @opaque my_type :: atom
                                                                                 
                                                                                - Source + + Source +

                                                                                defspec(spec) @@ -368,7 +394,9 @@

                                                                                Examples

                                                                                @spec add(number, number) :: number
                                                                                 
                                                                                - Source + + Source +

                                                                                deftype(type) @@ -381,7 +409,9 @@

                                                                                Examples

                                                                                @type my_type :: atom
                                                                                 
                                                                                - Source + + Source +

                                                                                deftypep(type) @@ -394,7 +424,9 @@

                                                                                Examples

                                                                                @typep my_type :: atom
                                                                                 
                                                                                - Source + + Source + diff --git a/docs/stable/Kernel.html b/docs/stable/Kernel.html index d415cd8d4..239331a7f 100644 --- a/docs/stable/Kernel.html +++ b/docs/stable/Kernel.html @@ -54,23 +54,13 @@

                                                                                -

                                                                                Functions summary

                                                                                +

                                                                                Functions summary

                                                                                • abs/1
                                                                                • -
                                                                                • - - apply/2 - -
                                                                                • -
                                                                                • - - apply/3 - -
                                                                                • atom_to_binary/2 @@ -426,7 +416,7 @@

                                                                                  Functions summary

                                                                                  -

                                                                                  Macros summary

                                                                                  +

                                                                                  Macros summary

                                                                                  • @@ -548,6 +538,11 @@

                                                                                    Macros summary

                                                                                    __R__/2
                                                                                  • +
                                                                                  • + + __W__/2 + +
                                                                                  • __b__/2 @@ -563,6 +558,11 @@

                                                                                    Macros summary

                                                                                    __r__/2
                                                                                  • +
                                                                                  • + + __w__/2 + +
                                                                                  • access/2 @@ -573,6 +573,16 @@

                                                                                    Macros summary

                                                                                    and/2
                                                                                  • +
                                                                                  • + + apply/2 + +
                                                                                  • +
                                                                                  • + + apply/3 + +
                                                                                  • atom_to_binary/1 @@ -673,6 +683,11 @@

                                                                                    Macros summary

                                                                                    defrecordp/2
                                                                                  • +
                                                                                  • + + delete_elem/2 + +
                                                                                  • destructure/2 @@ -693,11 +708,21 @@

                                                                                    Macros summary

                                                                                    float_to_binary/1
                                                                                  • +
                                                                                  • + + float_to_binary/2 + +
                                                                                  • function/1
                                                                                  • +
                                                                                  • + + function/3 + +
                                                                                  • if/2 @@ -708,6 +733,11 @@

                                                                                    Macros summary

                                                                                    in/2
                                                                                  • +
                                                                                  • + + insert_elem/3 + +
                                                                                  • inspect/2 @@ -780,7 +810,7 @@

                                                                                    Macros summary

                                                                                  • - setelem/3 + set_elem/3
                                                                                  • @@ -842,37 +872,15 @@

                                                                                    Functions

                                                                                    Examples

                                                                                    -
                                                                                    abs(-3.33) #=> 3.33
                                                                                    -abs(-3)    #=> 3
                                                                                    +
                                                                                    iex> abs(-3.33)
                                                                                    +3.33
                                                                                    +iex> abs(-3)
                                                                                    +3
                                                                                     
                                                                                    - Source -
                                                                                    -

                                                                                    - apply(fun, args) -

                                                                                    -

                                                                                    Invokes the given fun with the array of arguments args.

                                                                                    - -

                                                                                    Examples

                                                                                    - -
                                                                                    apply fn x -> x * 2 end, [2]
                                                                                    -#=> 4
                                                                                    -
                                                                                    -
                                                                                    - Source -
                                                                                    -

                                                                                    - apply(module, fun, args) -

                                                                                    -

                                                                                    Invokes the given fun from module with the array of arguments args.

                                                                                    - -

                                                                                    Examples

                                                                                    - -
                                                                                    apply Enum, :reverse, [[1,2,3]]
                                                                                    -#=> [3,2,1]
                                                                                    -
                                                                                    -
                                                                                    - Source + + Source +

                                                                                    atom_to_binary(atom, encoding) @@ -885,10 +893,13 @@

                                                                                    Examples

                                                                                    Examples

                                                                                    -
                                                                                    atom_to_binary(:elixir, :utf8) #=> "elixir"
                                                                                    +
                                                                                    iex> atom_to_binary(:elixir, :utf8)
                                                                                    +"elixir"
                                                                                     
                                                                                    - Source + + Source +

                                                                                    atom_to_list(atom) @@ -897,10 +908,13 @@

                                                                                    Examples

                                                                                    Examples

                                                                                    -
                                                                                    atom_to_list(:elixir) #=> 'elixir'
                                                                                    +
                                                                                    iex> atom_to_list(:elixir)
                                                                                    +'elixir'
                                                                                     
                                                                                    - Source + + Source +

                                                                                    binary_part(binary, start, length) @@ -915,15 +929,19 @@

                                                                                    Examples

                                                                                    Examples

                                                                                    -
                                                                                    binary_part "foo", 1, 2 #=> "oo"
                                                                                    +
                                                                                    iex> binary_part "foo", 1, 2
                                                                                    +"oo"
                                                                                     

                                                                                    A negative length can be used to extract bytes at the end of a binary:

                                                                                    -
                                                                                    binary_part "foo", 3, -1 #=> 1
                                                                                    +
                                                                                    iex> binary_part "foo", 3, -1
                                                                                    +"o"
                                                                                     
                                                                                    - Source + + Source +

                                                                                    binary_to_atom(binary, encoding) @@ -935,24 +953,31 @@

                                                                                    Examples

                                                                                    Examples

                                                                                    -
                                                                                    binary_to_atom("elixir", :utf8) #=> :elixir
                                                                                    +
                                                                                    iex> binary_to_atom("elixir", :utf8)
                                                                                    +:elixir
                                                                                     
                                                                                    - Source + + Source +

                                                                                    binary_to_existing_atom(binary, encoding)

                                                                                    Works like binary_to_atom/2, but the atom must already exist.

                                                                                    - Source + + Source +

                                                                                    binary_to_list(binary)

                                                                                    Returns a list of integers which correspond to the bytes of binary.

                                                                                    - Source + + Source +

                                                                                    binary_to_list(binary, start, stop) @@ -961,7 +986,9 @@

                                                                                    Examples

                                                                                    from position start to position stop in binary. Positions in the binary are numbered starting from 1.

                                                                                    - Source + + Source +

                                                                                    binary_to_term(binary) @@ -972,10 +999,13 @@

                                                                                    Examples

                                                                                    Examples

                                                                                    -
                                                                                    binary_to_term(term_to_binary("foo")) #=> "foo"
                                                                                    +
                                                                                    iex> binary_to_term(term_to_binary("foo"))
                                                                                    +"foo"
                                                                                     
                                                                                    - Source + + Source +

                                                                                    binary_to_term(binary, options) @@ -995,10 +1025,13 @@

                                                                                    Examples

                                                                                    Examples

                                                                                    -
                                                                                    binary_to_term(term_to_binary("foo"), [:safe])
                                                                                    +
                                                                                    iex> binary_to_term(term_to_binary("foo"), [:safe])
                                                                                    +"foo"
                                                                                     
                                                                                    - Source + + Source +

                                                                                    bit_size(bitstring) @@ -1009,11 +1042,15 @@

                                                                                    Examples

                                                                                    Examples

                                                                                    -
                                                                                    bit_size(<<433::16,3::3>>) #=> 19
                                                                                    -bit_size(<<1,2,3>>) #=> 24
                                                                                    +
                                                                                    iex> bit_size(<<433::16,3::3>>)
                                                                                    +19
                                                                                    +iex> bit_size(<<1,2,3>>)
                                                                                    +24
                                                                                     
                                                                                    - Source + + Source +

                                                                                    bitstring_to_list(bitstring) @@ -1022,7 +1059,9 @@

                                                                                    Examples

                                                                                    number of bits in the binary is not divisible by 8, the last element of the list will be a bitstring containing the remaining bits (1 up to 7 bits).

                                                                                    - Source + + Source +

                                                                                    byte_size(bitstring) @@ -1035,11 +1074,15 @@

                                                                                    Examples

                                                                                    Examples

                                                                                    -
                                                                                    byte_size(<<433::16,3::3>>) #=> 3
                                                                                    -byte_size(<<1,2,3>>) #=> 3
                                                                                    +
                                                                                    iex> byte_size(<<433::16,3::3>>)
                                                                                    +3
                                                                                    +iex> byte_size(<<1,2,3>>)
                                                                                    +3
                                                                                     
                                                                                    - Source + + Source +

                                                                                    exit(reason) @@ -1054,14 +1097,18 @@

                                                                                    Examples

                                                                                    exit(:seems_bad)
                                                                                    - Source + + Source +

                                                                                    float(number)

                                                                                    Converts the given number to a float. Allowed in guard clauses.

                                                                                    - Source + + Source +

                                                                                    float_to_list(number) @@ -1070,11 +1117,13 @@

                                                                                    Examples

                                                                                    Examples

                                                                                    -
                                                                                    float_to_list(7.0)
                                                                                    -#=> '7.00000000000000000000e+00'
                                                                                    +
                                                                                    iex> float_to_list(7.0)
                                                                                    +'7.00000000000000000000e+00'
                                                                                     
                                                                                    - Source + + Source +

                                                                                    function_exported?(module, function, arity) @@ -1089,14 +1138,18 @@

                                                                                    Examples

                                                                                    it is not loaded. Check Code.ensure_loaded/1 for more information.

                                                                                    - Source + + Source +

                                                                                    hd(list)

                                                                                    Returns the head of a list, raises badarg if the list is empty.

                                                                                    - Source + + Source +

                                                                                    integer_to_list(number) @@ -1105,11 +1158,13 @@

                                                                                    Examples

                                                                                    Examples

                                                                                    -
                                                                                    integer_to_list(7)
                                                                                    -#=> '7'
                                                                                    +
                                                                                    iex> integer_to_list(7)
                                                                                    +'7'
                                                                                     
                                                                                    - Source + + Source +

                                                                                    integer_to_list(number, base) @@ -1119,11 +1174,13 @@

                                                                                    Examples

                                                                                    Examples

                                                                                    -
                                                                                    integer_to_list(1023, 16).
                                                                                    -#=> "3FF"
                                                                                    +
                                                                                    iex> integer_to_list(1023, 16)
                                                                                    +'3FF'
                                                                                     
                                                                                    - Source + + Source +

                                                                                    iolist_size(item) @@ -1132,11 +1189,13 @@

                                                                                    Examples

                                                                                    Examples

                                                                                    -
                                                                                    iolist_size([1,2|<<3,4>>])
                                                                                    -#=> 4
                                                                                    +
                                                                                    iex> iolist_size([1,2|<<3,4>>])
                                                                                    +4
                                                                                     
                                                                                    - Source + + Source +

                                                                                    iolist_to_binary(item) @@ -1145,15 +1204,16 @@

                                                                                    Examples

                                                                                    Examples

                                                                                    -
                                                                                    bin1 = <<1,2,3>>
                                                                                    -bin2 = <<4,5>>
                                                                                    -bin3 = <<6>>
                                                                                    -
                                                                                    -iolist_to_binary([bin1,1,[2,3,bin2],4|bin3])
                                                                                    -#=> <<1,2,3,1,2,3,4,5,4,6>>
                                                                                    +
                                                                                    iex> bin1 = <<1,2,3>>
                                                                                    +...> bin2 = <<4,5>>
                                                                                    +...> bin3 = <<6>>
                                                                                    +...> iolist_to_binary([bin1,1,[2,3,bin2],4|bin3])
                                                                                    +<<1,2,3,1,2,3,4,5,4,6>>
                                                                                     
                                                                                    - Source + + Source +

                                                                                    is_alive() @@ -1161,7 +1221,9 @@

                                                                                    Examples

                                                                                    Returns true if the local node is alive; that is, if the node can be part of a distributed system.

                                                                                    - Source + + Source +

                                                                                    is_atom(term) @@ -1170,7 +1232,9 @@

                                                                                    Examples

                                                                                    Allowed in guard tests.

                                                                                    - Source + + Source +

                                                                                    is_binary(term) @@ -1181,7 +1245,9 @@

                                                                                    Examples

                                                                                    Allowed in guard tests.

                                                                                    - Source + + Source +

                                                                                    is_bitstring(term) @@ -1190,7 +1256,9 @@

                                                                                    Examples

                                                                                    Allowed in guard tests.

                                                                                    - Source + + Source +

                                                                                    is_boolean(term) @@ -1200,7 +1268,9 @@

                                                                                    Examples

                                                                                    Allowed in guard tests.

                                                                                    - Source + + Source +

                                                                                    is_float(term) @@ -1209,7 +1279,9 @@

                                                                                    Examples

                                                                                    Allowed in guard tests.

                                                                                    - Source + + Source +

                                                                                    is_function(term) @@ -1218,7 +1290,9 @@

                                                                                    Examples

                                                                                    Allowed in guard tests.

                                                                                    - Source + + Source +

                                                                                    is_function(term, arity) @@ -1228,7 +1302,9 @@

                                                                                    Examples

                                                                                    Allowed in guard tests.

                                                                                    - Source + + Source +

                                                                                    is_integer(term) @@ -1237,7 +1313,9 @@

                                                                                    Examples

                                                                                    Allowed in guard tests.

                                                                                    - Source + + Source +

                                                                                    is_list(term) @@ -1246,7 +1324,9 @@

                                                                                    Examples

                                                                                    Allowed in guard tests.

                                                                                    - Source + + Source +

                                                                                    is_number(term) @@ -1256,7 +1336,9 @@

                                                                                    Examples

                                                                                    Allowed in guard tests.

                                                                                    - Source + + Source +

                                                                                    is_pid(term) @@ -1265,7 +1347,9 @@

                                                                                    Examples

                                                                                    Allowed in guard tests.

                                                                                    - Source + + Source +

                                                                                    is_port(term) @@ -1274,7 +1358,9 @@

                                                                                    Examples

                                                                                    Allowed in guard tests.

                                                                                    - Source + + Source +

                                                                                    is_reference(term) @@ -1283,7 +1369,9 @@

                                                                                    Examples

                                                                                    Allowed in guard tests.

                                                                                    - Source + + Source +

                                                                                    is_tuple(term) @@ -1292,7 +1380,9 @@

                                                                                    Examples

                                                                                    Allowed in guard tests.

                                                                                    - Source + + Source +

                                                                                    length(list) @@ -1303,10 +1393,13 @@

                                                                                    Examples

                                                                                    Examples

                                                                                    -
                                                                                    length([1,2,3,4,5,6,7,8,9]) #=> 9
                                                                                    +
                                                                                    iex> length([1,2,3,4,5,6,7,8,9])
                                                                                    +9
                                                                                     
                                                                                    - Source + + Source +

                                                                                    list_to_atom(char_list) @@ -1315,10 +1408,13 @@

                                                                                    Examples

                                                                                    Examples

                                                                                    -
                                                                                    list_to_atom('elixir') #=> :elixir
                                                                                    +
                                                                                    iex> list_to_atom('elixir')
                                                                                    +:elixir
                                                                                     
                                                                                    - Source + + Source +

                                                                                    list_to_binary(char_list) @@ -1327,10 +1423,13 @@

                                                                                    Examples

                                                                                    Examples

                                                                                    -
                                                                                    list_to_binary('Elixir') #=> "Elixir"
                                                                                    +
                                                                                    iex> list_to_binary('Elixir')
                                                                                    +"Elixir"
                                                                                     
                                                                                    - Source + + Source +

                                                                                    list_to_bitstring(bitstring_list) @@ -1340,15 +1439,16 @@

                                                                                    Examples

                                                                                    Examples

                                                                                    -
                                                                                    bin1 = <<1,2,3>>
                                                                                    -bin2 = <<4,5>>
                                                                                    -bin3 = <<6,7::4>>
                                                                                    -
                                                                                    -list_to_bitstring([bin1,1,[2,3,bin2],4|bin3])
                                                                                    -#=> <<1,2,3,1,2,3,4,5,4,6,7::size(4)>>
                                                                                    +
                                                                                    iex> bin1 = <<1,2,3>>
                                                                                    +...> bin2 = <<4,5>>
                                                                                    +...> bin3 = <<6,7::4>>
                                                                                    +...> list_to_bitstring([bin1,1,[2,3,bin2],4|bin3])
                                                                                    +<<1,2,3,1,2,3,4,5,4,6,7::size(4)>>
                                                                                     
                                                                                    - Source + + Source +

                                                                                    list_to_existing_atom(char_list) @@ -1356,7 +1456,9 @@

                                                                                    Examples

                                                                                    Returns the atom whose text representation is char_list, but only if there already exists such atom.

                                                                                    - Source + + Source +

                                                                                    list_to_float(char_list) @@ -1365,10 +1467,13 @@

                                                                                    Examples

                                                                                    Examples

                                                                                    -
                                                                                    list_to_float('2.2017764e+0') #=> 2.2017764
                                                                                    +
                                                                                    iex> list_to_float('2.2017764e+0')
                                                                                    +2.2017764
                                                                                     
                                                                                    - Source + + Source +

                                                                                    list_to_integer(char_list) @@ -1377,10 +1482,13 @@

                                                                                    Examples

                                                                                    Examples

                                                                                    -
                                                                                    list_to_integer('123') #=> 123
                                                                                    +
                                                                                    iex> list_to_integer('123')
                                                                                    +123
                                                                                     
                                                                                    - Source + + Source +

                                                                                    list_to_integer(char_list, base) @@ -1389,10 +1497,13 @@

                                                                                    Examples

                                                                                    Examples

                                                                                    -
                                                                                    list_to_integer('3FF', 16) #=> 1023
                                                                                    +
                                                                                    iex> list_to_integer('3FF', 16)
                                                                                    +1023
                                                                                     
                                                                                    - Source + + Source +

                                                                                    list_to_pid(char_list) @@ -1411,7 +1522,9 @@

                                                                                    Examples

                                                                                    list_to_pid('<0.4.1>') #=> #PID<0.4.1>
                                                                                     
                                                                                    - Source + + Source +

                                                                                    list_to_tuple(list) @@ -1420,10 +1533,13 @@

                                                                                    Examples

                                                                                    Examples

                                                                                    -
                                                                                    list_to_tuple([:share, [:elixir, 163]]). #=> {:share, [:elixir, 163]}
                                                                                    +
                                                                                    iex> list_to_tuple([:share, [:elixir, 163]])
                                                                                    +{:share, [:elixir, 163]}
                                                                                     
                                                                                    - Source + + Source +

                                                                                    macro_exported?(module, macro, arity) @@ -1435,7 +1551,9 @@

                                                                                    Examples

                                                                                    it is not loaded. Check Code.ensure_loaded/1 for more information.

                                                                                    - Source + + Source +

                                                                                    make_ref() @@ -1447,11 +1565,12 @@

                                                                                    Examples

                                                                                    Examples

                                                                                    -
                                                                                    make_ref()
                                                                                    -#=> #Reference<0.0.0.135>
                                                                                    +
                                                                                    make_ref() #=> #Reference<0.0.0.135>
                                                                                     
                                                                                    - Source + + Source +

                                                                                    max(first, second) @@ -1462,10 +1581,13 @@

                                                                                    Examples

                                                                                    Examples

                                                                                    -
                                                                                    max(1, 2) #=> 2
                                                                                    +
                                                                                    iex> max(1, 2)
                                                                                    +2
                                                                                     
                                                                                    - Source + + Source +

                                                                                    min(first, second) @@ -1476,10 +1598,13 @@

                                                                                    Examples

                                                                                    Examples

                                                                                    -
                                                                                    min(1, 2) #=> 1
                                                                                    +
                                                                                    iex> min(1, 2)
                                                                                    +1
                                                                                     
                                                                                    - Source + + Source +

                                                                                    node() @@ -1489,7 +1614,9 @@

                                                                                    Examples

                                                                                    Allowed in guard tests.

                                                                                    - Source + + Source +

                                                                                    node(arg) @@ -1500,7 +1627,9 @@

                                                                                    Examples

                                                                                    Allowed in guard tests.

                                                                                    - Source + + Source +

                                                                                    pid_to_list(pid) @@ -1516,7 +1645,9 @@

                                                                                    Warning:

                                                                                    It should not be used in application programs.

                                                                                    - Source + + Source +

                                                                                    raise(msg) @@ -1535,13 +1666,15 @@

                                                                                    Examples

                                                                                    try do 1 + :foo rescue - x in [BadargError] -> + x in [ArithmeticError] -> IO.puts "that was expected" raise x end
                                                                            - Source + + Source +

                                                                            raise(exception, args) @@ -1558,10 +1691,13 @@

                                                                            Examples

                                                                            Examples

                                                                            -
                                                                            raise ArgumentError, message: "Sample"
                                                                            +
                                                                            iex> raise ArgumentError, message: "Sample"
                                                                            +** (ArgumentError) Sample
                                                                             
                                                                            - Source + + Source +

                                                                            raise(exception, args, stacktrace) @@ -1588,7 +1724,9 @@

                                                                            Examples

                                                                            rescued) in between the rescue clause and the raise call may change the System.stacktrace value.

                                                                            - Source + + Source +

                                                                            round(number) @@ -1598,10 +1736,13 @@

                                                                            Examples

                                                                            Examples

                                                                            -
                                                                            round(5.5) #=> 6
                                                                            +
                                                                            iex> round(5.5)
                                                                            +6
                                                                             
                                                                            - Source + + Source +

                                                                            self() @@ -1609,7 +1750,9 @@

                                                                            Examples

                                                                            Returns the pid (process identifier) of the calling process. Allowed in guard clauses.

                                                                            - Source + + Source +

                                                                            size(arg) @@ -1617,7 +1760,9 @@

                                                                            Examples

                                                                            Returns the size of the given argument, which must be a tuple or a binary. If possible, please use tuple_size or binary_size.

                                                                            - Source + + Source +

                                                                            spawn(fun) @@ -1637,7 +1782,9 @@

                                                                            Examples

                                                                            end
                                                                            - Source + + Source +

                                                                            spawn(module, fun, args) @@ -1653,7 +1800,9 @@

                                                                            Examples

                                                                            spawn(SomeModule, :function, [1,2,3])
                                                                             
                                                                            - Source + + Source +

                                                                            spawn_link(fun) @@ -1673,7 +1822,9 @@

                                                                            Examples

                                                                            end
                                                                            - Source + + Source +

                                                                            spawn_link(module, fun, args) @@ -1689,7 +1840,9 @@

                                                                            Examples

                                                                            spawn_link(SomeModule, :function, [1,2,3])
                                                                             
                                                                            - Source + + Source +

                                                                            term_to_binary(term) @@ -1701,7 +1854,9 @@

                                                                            Examples

                                                                            to a file in an efficient way, or sending an Erlang term to some type of communications channel not supported by distributed :

                                                                            - Source + + Source +

                                                                            term_to_binary(term, opts) @@ -1715,21 +1870,27 @@

                                                                            Examples

                                                                            for more details
                                                                          - Source + + Source +

                                                                          throw(term)

                                                                          A non-local return from a function. Check try/2 for more information.

                                                                          - Source + + Source +

                                                                          tl(list)

                                                                          Returns the tail of a list. Raises ArgumentError if the list is empty.

                                                                          - Source + + Source +

                                                                          trunc(number) @@ -1739,24 +1900,31 @@

                                                                          Examples

                                                                          Examples

                                                                          -
                                                                          trunc(5.5) #=> 5
                                                                          +
                                                                          iex> trunc(5.5)
                                                                          +5
                                                                           
                                                                          - Source + + Source +

                                                                          tuple_size(tuple)

                                                                          Returns the size of a tuple.

                                                                          - Source + + Source +

                                                                          tuple_to_list(tuple)

                                                                          Converts a tuple to a list.

                                                                          - Source + + Source +
                                                                          @@ -1774,13 +1942,19 @@

                                                                          Macros

                                                                          Examples

                                                                          -
                                                                          !1        #=> false
                                                                          -![1,2,3]  #=> false
                                                                          -!false    #=> true
                                                                          -!nil      #=> true
                                                                          +
                                                                          iex> !1
                                                                          +false
                                                                          +iex> ![1,2,3]
                                                                          +false
                                                                          +iex> !false
                                                                          +true
                                                                          +iex> !nil
                                                                          +true
                                                                           
                                                                          - Source + + Source +

                                                                          left != right @@ -1794,13 +1968,15 @@

                                                                          Examples

                                                                          Examples

                                                                          -
                                                                          1 != 2
                                                                          -#=> true
                                                                          -1 != 1.0
                                                                          -#=> false
                                                                          +
                                                                          iex> 1 != 2
                                                                          +true
                                                                          +iex> 1 != 1.0
                                                                          +false
                                                                           
                                                                          - Source + + Source +

                                                                          left !== right @@ -1810,14 +1986,16 @@

                                                                          Examples

                                                                          Examples

                                                                          -
                                                                          1 !== 2
                                                                          -#=> true
                                                                          +
                                                                          iex> 1 !== 2
                                                                          +true
                                                                           
                                                                          -1 !== 1.0
                                                                          -#=> true
                                                                          +iex> 1 !== 1.0
                                                                          +true
                                                                           
                                                                          - Source + + Source +

                                                                          left && right @@ -1828,17 +2006,23 @@

                                                                          Examples

                                                                          Examples

                                                                          -
                                                                          true && true         #=> true
                                                                          -nil && true          #=> nil
                                                                          -true && 1            #=> 1
                                                                          -false && error(:bad) #=> false
                                                                          +
                                                                          iex> true && true
                                                                          +true
                                                                          +iex> nil && true
                                                                          +nil
                                                                          +iex> true && 1
                                                                          +1
                                                                          +iex> false && throw(:bad)
                                                                          +false
                                                                           

                                                                          Notice that, differently from Erlang and operator, this operator accepts any expression as arguments, not only booleans, however it is not allowed in guards.

                                                                          - Source + + Source +

                                                                          left * right @@ -1847,10 +2031,13 @@

                                                                          Examples

                                                                          Examples

                                                                          -
                                                                          1 * 2 #=> 2
                                                                          +
                                                                          iex> 1 * 2
                                                                          +2
                                                                           
                                                                          - Source + + Source +

                                                                          left + right @@ -1859,10 +2046,13 @@

                                                                          Examples

                                                                          Examples

                                                                          -
                                                                          1 + 2 #=> 3
                                                                          +
                                                                          iex> 1 + 2
                                                                          +3
                                                                           
                                                                          - Source + + Source +

                                                                          left ++ right @@ -1871,14 +2061,16 @@

                                                                          Examples

                                                                          Examples

                                                                          -
                                                                          [1] ++ [2,3]
                                                                          -#=> [1,2,3]
                                                                          +
                                                                          iex> [1] ++ [2,3]
                                                                          +[1,2,3]
                                                                           
                                                                          -'foo' ++ 'bar'
                                                                          -#=> 'foobar'
                                                                          +iex> 'foo' ++ 'bar'
                                                                          +'foobar'
                                                                           
                                                                          - Source + + Source +

                                                                          left - right @@ -1887,10 +2079,13 @@

                                                                          Examples

                                                                          Examples

                                                                          -
                                                                          1 - 2 #=> -1
                                                                          +
                                                                          iex> 1 - 2
                                                                          +-1
                                                                           
                                                                          - Source + + Source +

                                                                          left -- right @@ -1900,14 +2095,16 @@

                                                                          Examples

                                                                          Examples

                                                                          -
                                                                          [1,2,3] -- [1,2]
                                                                          -#=> [3]
                                                                          +
                                                                          iex> [1,2,3] -- [1,2]
                                                                          +[3]
                                                                           
                                                                          -[1,2,3,2,1] -- [1,2,2]
                                                                          -#=> [3,1]
                                                                          +iex> [1,2,3,2,1] -- [1,2,2]
                                                                          +[3,1]
                                                                           
                                                                          - Source + + Source +

                                                                          first .. last @@ -1917,13 +2114,19 @@

                                                                          Examples

                                                                          Examples

                                                                          -
                                                                          0 in 1..3 #=> false
                                                                          -1 in 1..3 #=> true
                                                                          -2 in 1..3 #=> true
                                                                          -3 in 1..3 #=> true
                                                                          +
                                                                          iex> 0 in 1..3
                                                                          +false
                                                                          +iex> 1 in 1..3
                                                                          +true
                                                                          +iex> 2 in 1..3
                                                                          +true
                                                                          +iex> 3 in 1..3
                                                                          +true
                                                                           
                                                                          - Source + + Source +

                                                                          left / right @@ -1934,11 +2137,15 @@

                                                                          Examples

                                                                          Examples

                                                                          -
                                                                          1 / 2 #=> 0.5
                                                                          -2 / 1 #=> 2.0
                                                                          +
                                                                          iex> 1 / 2
                                                                          +0.5
                                                                          +iex> 2 / 1
                                                                          +2.0
                                                                           
                                                                          - Source + + Source +

                                                                          left < right @@ -1948,11 +2155,13 @@

                                                                          Examples

                                                                          Examples

                                                                          -
                                                                          1 < 2
                                                                          -#=> true
                                                                          +
                                                                          iex> 1 < 2
                                                                          +true
                                                                           
                                                                          - Source + + Source +

                                                                          pid <- msg @@ -1967,7 +2176,9 @@

                                                                          Examples

                                                                          process <- { :ok, "Sending myself a message" }
                                                                          - Source + + Source +

                                                                          left <= right @@ -1977,11 +2188,13 @@

                                                                          Examples

                                                                          Examples

                                                                          -
                                                                          1 <= 2
                                                                          -#=> true
                                                                          +
                                                                          iex> 1 <= 2
                                                                          +true
                                                                           
                                                                          - Source + + Source +

                                                                          left <> right @@ -1990,17 +2203,21 @@

                                                                          Examples

                                                                          Examples

                                                                          -
                                                                          "foo" <> "bar" #=> "foobar"
                                                                          +
                                                                          iex> "foo" <> "bar"
                                                                          +"foobar"
                                                                           

                                                                          The <> operator can also be used in guard clauses as long as the first part is a literal binary:

                                                                          -
                                                                          "foo" <> x = "foobar"
                                                                          -x #=> "bar"
                                                                          +
                                                                          iex> "foo" <> x = "foobar"
                                                                          +...> x
                                                                          +"bar"
                                                                           
                                                                          - Source + + Source +

                                                                          left == right @@ -2014,14 +2231,16 @@

                                                                          Examples

                                                                          Examples

                                                                          -
                                                                          1 == 2
                                                                          -#=> false
                                                                          +
                                                                          iex> 1 == 2
                                                                          +false
                                                                           
                                                                          -1 == 1.0
                                                                          -#=> true
                                                                          +iex> 1 == 1.0
                                                                          +true
                                                                           
                                                                          - Source + + Source +

                                                                          left === right @@ -2031,14 +2250,16 @@

                                                                          Examples

                                                                          Examples

                                                                          -
                                                                          1 === 2
                                                                          -#=> false
                                                                          +
                                                                          iex> 1 === 2
                                                                          +false
                                                                           
                                                                          -1 === 1.0
                                                                          -#=> false
                                                                          +iex> 1 === 1.0
                                                                          +false
                                                                           
                                                                          - Source + + Source +

                                                                          left =~ right @@ -2049,11 +2270,15 @@

                                                                          Examples

                                                                          Examples

                                                                          -
                                                                          "abcd" =~ %r/c(d)/  #=> 2
                                                                          -"abcd" =~ %r/e/     #=> nil
                                                                          +
                                                                          iex> "abcd" =~ %r/c(d)/
                                                                          +2
                                                                          +iex> "abcd" =~ %r/e/
                                                                          +nil
                                                                           
                                                                          - Source + + Source +

                                                                          left > right @@ -2063,11 +2288,13 @@

                                                                          Examples

                                                                          Examples

                                                                          -
                                                                          1 > 2
                                                                          -#=> false
                                                                          +
                                                                          iex> 1 > 2
                                                                          +false
                                                                           
                                                                          - Source + + Source +

                                                                          left >= right @@ -2077,11 +2304,13 @@

                                                                          Examples

                                                                          Examples

                                                                          -
                                                                          1 >= 2
                                                                          -#=> false
                                                                          +
                                                                          iex> 1 >= 2
                                                                          +false
                                                                           
                                                                          - Source + + Source +

                                                                          @expr @@ -2129,7 +2358,9 @@

                                                                          Examples

                                                                          time and not at runtime. Check the module Module for other functions to manipulate module attributes.

                                                                          - Source + + Source +

                                                                          __B__(string, list2) @@ -2139,11 +2370,15 @@

                                                                          Examples

                                                                          Examples

                                                                          -
                                                                          %B(foo)      #=> "foo"
                                                                          -%B(f#{o}o)  #=> "f\#{o}o"
                                                                          +
                                                                          iex> %B(foo)
                                                                          +"foo"
                                                                          +iex> %B(f#{o}o)
                                                                          +"f\#{o}o"
                                                                           
                                                                          - Source + + Source +

                                                                          __C__(arg1, list2) @@ -2153,11 +2388,15 @@

                                                                          Examples

                                                                          Examples

                                                                          -
                                                                          %C(foo)      #=> 'foo'
                                                                          -%C(f#{o}o)  #=> 'f\#{o}o'
                                                                          +
                                                                          iex> %C(foo)
                                                                          +'foo'
                                                                          +iex> %C(f#{o}o)
                                                                          +'f\#{o}o'
                                                                           
                                                                          - Source + + Source +

                                                                          __R__(arg1, options) @@ -2167,10 +2406,37 @@

                                                                          Examples

                                                                          Examples

                                                                          -
                                                                          Regex.match? %R(f#{1,3}o), "f#o"  #=> true
                                                                          +
                                                                          iex> Regex.match? %R(f#{1,3}o), "f#o"
                                                                          +true
                                                                          +
                                                                          +
                                                                          + + Source + +
                                                                          +

                                                                          + __W__(arg1, modifiers) +

                                                                          +

                                                                          Handles the sigil %W. It returns a list of "words" split by whitespace +without escaping nor interpreting interpolations.

                                                                          + +

                                                                          Modifiers

                                                                          + +
                                                                            +
                                                                          • b: binaries (default)
                                                                          • +
                                                                          • a: atoms
                                                                          • +
                                                                          • c: char lists
                                                                          • +
                                                                          + +

                                                                          Examples

                                                                          + +
                                                                          iex> %W(foo #{bar} baz)
                                                                          +["foo", "\#{bar}", "baz"]
                                                                           
                                                                          - Source + + Source +

                                                                          __b__(arg1, list2) @@ -2180,11 +2446,15 @@

                                                                          Examples

                                                                          Examples

                                                                          -
                                                                          %b(foo)       #=> "foo"
                                                                          -%b(f#{:o}o)  #=> "foo"
                                                                          +
                                                                          iex> %b(foo)
                                                                          +"foo"
                                                                          +iex> %b(f#{:o}o)
                                                                          +"foo"
                                                                           
                                                                          - Source + + Source +

                                                                          __c__(arg1, list2) @@ -2194,11 +2464,15 @@

                                                                          Examples

                                                                          Examples

                                                                          -
                                                                          %c(foo)       #=> 'foo'
                                                                          -%c(f#{:o}o)  #=> 'foo'
                                                                          +
                                                                          iex> %c(foo)
                                                                          +'foo'
                                                                          +iex> %c(f#{:o}o)
                                                                          +'foo'
                                                                           
                                                                          - Source + + Source +

                                                                          __r__(arg1, options) @@ -2207,10 +2481,40 @@

                                                                          Examples

                                                                          Examples

                                                                          -
                                                                          Regex.match? %r(foo), "foo"  #=> true
                                                                          +
                                                                          iex> Regex.match? %r(foo), "foo"
                                                                          +true
                                                                          +
                                                                          +
                                                                          + + Source + +
                                                                          +

                                                                          + __w__(arg1, modifiers) +

                                                                          +

                                                                          Handles the sigil %w. It returns a list of "words" split by whitespace.

                                                                          + +

                                                                          Modifiers

                                                                          + +
                                                                            +
                                                                          • b: binaries (default)
                                                                          • +
                                                                          • a: atoms
                                                                          • +
                                                                          • c: char lists
                                                                          • +
                                                                          + +

                                                                          Examples

                                                                          + +
                                                                          iex> %w(foo #{:bar} baz)
                                                                          +["foo", "bar", "baz"]
                                                                          +iex> %w(--source test/enum_test.exs)
                                                                          +["--source", "test/enum_test.exs"]
                                                                          +iex> %w(foo bar baz)a
                                                                          +[:foo, :bar, :baz]
                                                                           
                                                                          - Source + + Source +

                                                                          access(element, args) @@ -2276,15 +2580,10 @@

                                                                          Atoms

                                                                          In this case, "Hello" will be printed twice (one per each field).

                                                                          - -

                                                                          Examples

                                                                          - -
                                                                          a = { :a, :b, :c }
                                                                          -a[1] #=> :a
                                                                          -access a, 1 #=> :a
                                                                          -
                                                                          - Source + + Source +

                                                                          left and right @@ -2294,11 +2593,43 @@

                                                                          Examples

                                                                          Examples

                                                                          -
                                                                          true and false
                                                                          -#=> false
                                                                          +
                                                                          iex> true and false
                                                                          +false
                                                                          +
                                                                          +
                                                                          + + Source + +
                                                                          +

                                                                          + apply(fun, args) +

                                                                          +

                                                                          Invokes the given fun with the array of arguments args.

                                                                          + +

                                                                          Examples

                                                                          + +
                                                                          iex> apply fn x -> x * 2 end, [2]
                                                                          +4
                                                                           
                                                                          - Source + + Source + +
                                                                          +

                                                                          + apply(module, fun, args) +

                                                                          +

                                                                          Invokes the given fun from module with the array of arguments args.

                                                                          + +

                                                                          Examples

                                                                          + +
                                                                          iex> apply Enum, :reverse, [[1,2,3]]
                                                                          +[3,2,1]
                                                                          +
                                                                          +
                                                                          + + Source +

                                                                          atom_to_binary(some_atom) @@ -2308,10 +2639,13 @@

                                                                          Examples

                                                                          Examples

                                                                          -
                                                                          atom_to_binary :my_atom #=> "my_atom"
                                                                          +
                                                                          iex> atom_to_binary :my_atom
                                                                          +"my_atom"
                                                                           
                                                                          - Source + + Source +

                                                                          binary_to_atom(some_binary) @@ -2321,10 +2655,13 @@

                                                                          Examples

                                                                          Examples

                                                                          -
                                                                          binary_to_atom "my_atom" #=> :my_atom
                                                                          +
                                                                          iex> binary_to_atom "my_atom"
                                                                          +:my_atom
                                                                           
                                                                          - Source + + Source +

                                                                          binary_to_existing_atom(some_binary) @@ -2333,11 +2670,17 @@

                                                                          Examples

                                                                          Examples

                                                                          -
                                                                          :my_atom                          #=> :my_atom
                                                                          -binary_to_existing_atom "my_atom" #=> :my_atom
                                                                          +
                                                                          iex> :my_atom
                                                                          +...> binary_to_existing_atom "my_atom"
                                                                          +:my_atom
                                                                          +
                                                                          +iex> binary_to_existing_atom "this_atom_will_never_exist"
                                                                          +** (ArgumentError) argument error
                                                                           
                                                                          - Source + + Source +

                                                                          binary_to_float(some_binary) @@ -2346,10 +2689,13 @@

                                                                          Examples

                                                                          Examples

                                                                          -
                                                                          binary_to_float "2.2017764e+0" #=> 2.2017764
                                                                          +
                                                                          iex> binary_to_float "2.2017764e+0"
                                                                          +2.2017764
                                                                           
                                                                          - Source + + Source +

                                                                          binary_to_integer(some_binary) @@ -2358,10 +2704,13 @@

                                                                          Examples

                                                                          Examples

                                                                          -
                                                                          binary_to_integer "123" #=> 123
                                                                          +
                                                                          iex> binary_to_integer "123"
                                                                          +123
                                                                           
                                                                          - Source + + Source +

                                                                          binary_to_integer(some_binary, base) @@ -2371,10 +2720,13 @@

                                                                          Examples

                                                                          Examples

                                                                          -
                                                                          binary_to_integer("3FF", 16) #=> 1023
                                                                          +
                                                                          iex> binary_to_integer("3FF", 16)
                                                                          +1023
                                                                           
                                                                          - Source + + Source +

                                                                          case(condition, blocks) @@ -2427,7 +2779,9 @@

                                                                          Examples

                                                                          end
                                                                          - Source + + Source +

                                                                          cond(list1) @@ -2438,7 +2792,7 @@

                                                                          Examples

                                                                          Examples

                                                                          cond do
                                                                          -  1 + 1 == 2 ->
                                                                          +  1 + 1 == 1 ->
                                                                               "This will never match"
                                                                             2 * 2 != 4 ->
                                                                               "Nor this"
                                                                          @@ -2447,7 +2801,9 @@ 

                                                                          Examples

                                                                          end
                                                                          - Source + + Source +

                                                                          def(name, list2) @@ -2474,53 +2830,10 @@

                                                                          Examples

                                                                          In the example above, we defined a function sum that receives two arguments and sum them.

                                                                          - -

                                                                          Dynamic generation with atoms

                                                                          - -

                                                                          Elixir follows the same rule as Erlang when it comes to -function invocations. Calling a function is the same thing -as "invoking at atom". That said, we could invoke a function -named sum in these two equivalent ways:

                                                                          - -
                                                                          sum(1, 2)
                                                                          -:sum.(1, 2)
                                                                          -
                                                                          - -

                                                                          We can also use the atom format to define functions:

                                                                          - -
                                                                          defmodule Foo do
                                                                          -  def :sum.(a, b) do
                                                                          -    a + b
                                                                          -  end
                                                                          -end
                                                                          -
                                                                          - -

                                                                          In general, a developer never needs to use the format above -except when he wants to dynamically define functions with macros. -In such scenarios, the name needs to be given dynamically via -the unquoting mechanism.

                                                                          - -

                                                                          Imagine a macro that receives keywords and defines a function -for each entry in the keyword, using the key as function name -and the value as the value returned by the function:

                                                                          - -
                                                                          defmacro defkv(keywords) do
                                                                          -  Enum.map keywords, fn {k,v} ->
                                                                          -    quote do
                                                                          -      def unquote(k)() do
                                                                          -        unquote(v)
                                                                          -      end
                                                                          -    end
                                                                          -  end
                                                                          -end
                                                                          -
                                                                          - -

                                                                          This macro could be invoked as:

                                                                          - -
                                                                          defkv one: 1, two: 2
                                                                          -
                                                                          - Source + + Source +

                                                                          def(name, args, guards, list4) @@ -2557,7 +2870,9 @@

                                                                          Examples

                                                                          def name, args, guards, do: exprs
                                                                          - Source + + Source +

                                                                          defdelegate(funs, opts) @@ -2603,7 +2918,9 @@

                                                                          Examples

                                                                          #=> [3,2,1]
                                                                          - Source + + Source +

                                                                          defexception(name, fields, opts // [], do_block // []) @@ -2619,7 +2936,9 @@

                                                                          Examples

                                                                          2) Exceptions must implement message/1 as API that return a binary as result;

                                                                          - Source + + Source +

                                                                          defimpl(name, opts, do_block // []) @@ -2627,7 +2946,9 @@

                                                                          Examples

                                                                          Defines an implementation for the given protocol. See defprotocol/2 for examples.

                                                                          - Source + + Source +

                                                                          defmodule(name, list2) @@ -2675,7 +2996,9 @@

                                                                          Dynamic names

                                                                          Elixir will accept any module name as long as the expression returns an atom.

                                                                          - Source + + Source +

                                                                          defoverridable(tuples) @@ -2684,7 +3007,9 @@

                                                                          Dynamic names

                                                                          An overridable function is lazily defined, allowing a developer to customize it.

                                                                          - Source + + Source +

                                                                          defp(name, list2) @@ -2708,14 +3033,18 @@

                                                                          Examples

                                                                          In the example above, sum is private and accessing it through Foo.sum will raise an error.

                                                                          - Source + + Source +

                                                                          defp(name, args, guards, list4)

                                                                          The same as def/4 but generates a private function.

                                                                          - Source + + Source +

                                                                          defprotocol(name, list2) @@ -2824,7 +3153,7 @@

                                                                          Protocols + Records

                                                                          In the example above, we have implemented blank? for RedBlack.Tree that simply delegates to RedBlack.empty? passing the tree as argument. This implementation doesn't need to be defined -inside the RedBlack tree or inside the record; it can be defined +inside the RedBlack tree or inside the record; it can be defined anywhere in the code.

                                                                          Finally, since records are simply tuples, one can add a default @@ -2845,7 +3174,9 @@

                                                                          Types

                                                                          The @spec above expresses that all types allowed to implement the given protocol are valid argument types for the given function.

                                                                          - Source + + Source +

                                                                          defrecord(name, fields, opts // [], do_block // []) @@ -2930,6 +3261,33 @@

                                                                          Access syntax

                                                                          Which provides faster get and set times for record operations.

                                                                          +

                                                                          Compile-time introspection

                                                                          + +

                                                                          At the compile time, one can access following information about the record +from within the record module:

                                                                          + +
                                                                            +
                                                                          • @record_fields — a keyword list of record fields with defaults
                                                                          • +
                                                                          • @record_types — a keyword list of record fields with types

                                                                            + +

                                                                            defrecord Foo, bar: nil do + recordtype bar: nil | integer + IO.inspect @recordfields + IO.inspect @record_types + end

                                                                          • +
                                                                          + +

                                                                          prints out

                                                                          + +
                                                                           [bar: nil]
                                                                          + [bar: {:|,[line: ...],[nil,{:integer,[line: ...],nil}]}]
                                                                          +
                                                                          + +

                                                                          where the last line is a quoted representation of

                                                                          + +
                                                                           [bar: nil | integer]
                                                                          +
                                                                          +

                                                                          Documentation

                                                                          By default records are not documented and have @moduledoc set to false.

                                                                          @@ -2953,8 +3311,20 @@

                                                                          Types

                                                                          When defining a type, all the fields not mentioned in the type are assumed to have type term.

                                                                          + +

                                                                          Importing records

                                                                          + +

                                                                          It is also possible to import a public record (a record, defined using +defrecord) as a set of private macros (as if it was defined using defrecordp):

                                                                          + +
                                                                          Record.import Config, as: :config
                                                                          +
                                                                          + +

                                                                          See Record.import/2 and defrecordp/2 documentation for more information

                                                                          - Source + + Source +

                                                                          defrecordp(name, fields) @@ -3002,7 +3372,31 @@

                                                                          Examples

                                                                          name #=> "José"
                                                                          - Source + + Source + +
                                                                          +

                                                                          + delete_elem(tuple, index) +

                                                                          +

                                                                          Define delete_elem to delete element from a tuple according to +Elixir conventions (i.e. it expects the tuple as first argument, +zero-index based).

                                                                          + +

                                                                          Please note that in versions of Erlang prior to R16B there is no BIF +for this operation and it is emulated by converting the tuple to a list +and back and is, therefore, inefficient.

                                                                          + +

                                                                          Example

                                                                          + +
                                                                          iex> tuple = { :foo, :bar, :baz }
                                                                          +...> delete_elem(tuple, 0)
                                                                          +{ :bar, :baz }
                                                                          +
                                                                          +
                                                                          + + Source +

                                                                          destructure(left, right) @@ -3014,10 +3408,9 @@

                                                                          Examples

                                                                          Examples

                                                                          -
                                                                          destructure [x,y,z], [1,2,3,4,5]
                                                                          -x #=> 1
                                                                          -y #=> 2
                                                                          -z #=> 3
                                                                          +
                                                                          iex> destructure [x,y,z], [1,2,3,4,5]
                                                                          +...> {x, y, z}
                                                                          +{1, 2, 3}
                                                                           

                                                                          Notice in the example above, even though the right @@ -3025,10 +3418,9 @@

                                                                          Examples

                                                                          fine. If the right size is smaller, the remaining items are simply assigned to nil:

                                                                          -
                                                                          destructure [x,y,z], [1]
                                                                          -x #=> 1
                                                                          -y #=> nil
                                                                          -z #=> nil
                                                                          +
                                                                          iex> destructure [x,y,z], [1]
                                                                          +...> {x, y, z}
                                                                          +{1, nil, nil}
                                                                           

                                                                          The left side supports any expression you would use @@ -3042,7 +3434,9 @@

                                                                          Examples

                                                                          the first value from the right side. Otherwise, it will raise a CaseClauseError.

                                                                          - Source + + Source +

                                                                          div(left, right) @@ -3053,10 +3447,13 @@

                                                                          Examples

                                                                          Examples

                                                                          -
                                                                          div 5, 2 #=> 2
                                                                          +
                                                                          iex> div 5, 2
                                                                          +2
                                                                           
                                                                          - Source + + Source +

                                                                          elem(tuple, index) @@ -3068,11 +3465,14 @@

                                                                          Examples

                                                                          Example

                                                                          -
                                                                          tuple = { :foo, :bar, 3 }
                                                                          -elem(tuple, 1) #=> :bar
                                                                          +
                                                                          iex> tuple = { :foo, :bar, 3 }
                                                                          +...> elem(tuple, 1)
                                                                          +:bar
                                                                           
                                                                          - Source + + Source +

                                                                          float_to_binary(some_float) @@ -3082,23 +3482,50 @@

                                                                          Example

                                                                          Examples

                                                                          -
                                                                          float_to_binary 7.0 #=> "7.00000000000000000000e+00"
                                                                          +
                                                                          iex> float_to_binary 7.0
                                                                          +"7.00000000000000000000e+00"
                                                                           
                                                                          - Source + + Source +
                                                                          -

                                                                          - function(args) +

                                                                          + float_to_binary(some_float, options)

                                                                          -

                                                                          Returns an anonymous function based on the given arguments.

                                                                          +

                                                                          Returns a binary which corresponds to the text representation +of some_float.

                                                                          + +

                                                                          Options

                                                                          + +
                                                                            +
                                                                          • :decimals — number of decimal points to show
                                                                          • +
                                                                          • :scientific — number of decimal points to show, in scientific format
                                                                          • +
                                                                          • :compact — If true, use the most compact representation. Ignored with the scientific option
                                                                          • +

                                                                          Examples

                                                                          -
                                                                          sum = function do
                                                                          -  (x, y) -> x + y
                                                                          -end
                                                                          +
                                                                          float_to_binary 7.1, [decimals: 2, compact: true] #=> "7.1"
                                                                          +
                                                                          +
                                                                          + + Source + +
                                                                          +

                                                                          + function(args) +

                                                                          +

                                                                          Construct an anonymous function based on the given expression +or retrieve an existing one.

                                                                          + +

                                                                          Function composition

                                                                          -sum.(1, 2) #=> 3 +
                                                                          iex> sum = function do
                                                                          +...>   (x, y) -> x + y
                                                                          +...> end
                                                                          +...> sum.(1, 2)
                                                                          +3
                                                                           

                                                                          Notice that a function needs to be invoked using the dot between @@ -3107,14 +3534,35 @@

                                                                          Examples

                                                                          Multiple clauses can be specified as in case, receive and similar macros:

                                                                          -
                                                                          sum = function do
                                                                          -  x, y when y > 0 -> x + y
                                                                          -  x, y -> x - y
                                                                          -end
                                                                          +
                                                                          iex> sum = function do
                                                                          +...>   x, y when y > 0 -> x + y
                                                                          +...>   x, y -> x - y
                                                                          +...> end
                                                                          +...> sum.(1, 2)
                                                                          +3
                                                                          +
                                                                          + +

                                                                          All clauses must expect the same number of arguments.

                                                                          + +

                                                                          Function retrieval

                                                                          -sum.(1, 2) #=> 3 +

                                                                          The function macro can also be used to retrieve local, imported +and remote functions.

                                                                          + +
                                                                          # Retrieve local/import
                                                                          +iex> f = function(is_atom/1)
                                                                          +iex> f.(:foo)
                                                                          +true
                                                                          +
                                                                          +# Retrieve remote
                                                                          +iex> f = function(Kernel.is_atom/1)
                                                                          +iex> f.(:foo)
                                                                          +true
                                                                           
                                                                          +

                                                                          In case a function needs to be dynamically retrieved based on its +module, name or arity, use function/3 instead.

                                                                          +

                                                                          Shortcut syntax

                                                                          In order to reduce verbosity, functions in Elixir can be written @@ -3154,20 +3602,26 @@

                                                                          Shortcut syntax

                                                                          x -> x * 2 end)
                                                                          +
                                                                          + + Source + +
                                                                          +

                                                                          + function(module, function, arity) +

                                                                          +

                                                                          Retrieves a function with given name and arity from a module.

                                                                          -

                                                                          Function retrieval

                                                                          - -

                                                                          The function macro can also be used to retrieve local or remote -functions:

                                                                          - -
                                                                          f = function(:is_atom, 1)
                                                                          -f.(:foo) #=> true
                                                                          +

                                                                          Examples

                                                                          -f = function(List, :flatten, 1) -f.([1,[2],3]) #=> [1,2,3] +
                                                                          iex> f = function(Kernel, :is_atom, 1)
                                                                          +...> f.(:foo)
                                                                          +true
                                                                           
                                                                          - Source + + Source +

                                                                          if(condition, clauses) @@ -3211,7 +3665,9 @@

                                                                          Blocks examples

                                                                          If you want to compare more than two clauses, you can use the cond/1 macro.

                                                                          - Source + + Source +

                                                                          left in right @@ -3222,8 +3678,9 @@

                                                                          Blocks examples

                                                                          Examples

                                                                          -
                                                                          x = 1
                                                                          -x in [1,2,3] #=> true
                                                                          +
                                                                          iex> x = 1
                                                                          +...> x in [1,2,3]
                                                                          +true
                                                                           

                                                                          This macro simply translates the expression above to:

                                                                          @@ -3253,7 +3710,31 @@

                                                                          Clauses

                                                                          In this case, Elixir will automatically expand it and define the variable for us.

                                                                          - Source + + Source + +
                                                                          +

                                                                          + insert_elem(tuple, index, value) +

                                                                          +

                                                                          Define insert_elem to insert element into a tuple according to +Elixir conventions (i.e. it expects the tuple as first argument, +zero-index based).

                                                                          + +

                                                                          Please note that in versions of Erlang prior to R16B there is no BIF +for this operation and it is emulated by converting the tuple to a list +and back and is, therefore, inefficient.

                                                                          + +

                                                                          Example

                                                                          + +
                                                                          iex> tuple = { :bar, :baz }
                                                                          +...> insert_elem(tuple, 0, :foo)
                                                                          +{ :foo, :bar, :baz }
                                                                          +
                                                                          +
                                                                          + + Source +

                                                                          inspect(arg, opts // []) @@ -3273,8 +3754,8 @@

                                                                          Options

                                                                          Examples

                                                                          -
                                                                          inspect(:foo)
                                                                          -#=> ":foo"
                                                                          +
                                                                          iex> inspect(:foo)
                                                                          +":foo"
                                                                           

                                                                          Note that the inspect protocol does not necessarily return a valid @@ -3285,7 +3766,9 @@

                                                                          Examples

                                                                          #=> #Function<...>
                                                                          - Source + + Source +

                                                                          integer_to_binary(some_integer) @@ -3295,10 +3778,13 @@

                                                                          Examples

                                                                          Examples

                                                                          -
                                                                          integer_to_binary 123 #=> "123"
                                                                          +
                                                                          iex> integer_to_binary 123
                                                                          +"123"
                                                                           
                                                                          - Source + + Source +

                                                                          integer_to_binary(some_integer, base) @@ -3308,10 +3794,13 @@

                                                                          Examples

                                                                          Examples

                                                                          -
                                                                          integer_to_binary 77 #=> "77"
                                                                          +
                                                                          iex> integer_to_binary 77
                                                                          +"77"
                                                                           
                                                                          - Source + + Source +

                                                                          is_exception(thing) @@ -3320,25 +3809,33 @@

                                                                          Examples

                                                                          Examples

                                                                          -
                                                                          is_exception(Error.new) #=> true
                                                                          -is_exception(1)         #=> false
                                                                          +
                                                                          iex> is_exception((fn -> ArithmeticError.new end).())
                                                                          +true
                                                                          +iex> is_exception((fn -> 1 end).())
                                                                          +false
                                                                           
                                                                          - Source + + Source +

                                                                          is_range(thing)

                                                                          Checks if the given argument is a range.

                                                                          - Source + + Source +

                                                                          is_record(thing)

                                                                          Checks if the given argument is a record.

                                                                          - Source + + Source +

                                                                          is_record(thing, kind) @@ -3355,14 +3852,18 @@

                                                                          Examples

                                                                          is_record(Config.new, List) #=> false
                                                                          - Source + + Source +

                                                                          is_regex(thing)

                                                                          Checks if the given argument is a regex.

                                                                          - Source + + Source +

                                                                          match?(left, right) @@ -3372,9 +3873,12 @@

                                                                          Examples

                                                                          Examples

                                                                          -
                                                                          match?(1, 1) #=> true
                                                                          -match?(1, 2) #=> false
                                                                          -match?({1,_}, {1,2}) #=> true
                                                                          +
                                                                          iex> match?(1, 1)
                                                                          +true
                                                                          +iex> match?(1, 2)
                                                                          +false
                                                                          +iex> match?({1,_}, {1,2})
                                                                          +true
                                                                           

                                                                          Match can also be used to filter or find a value in an enumerable:

                                                                          @@ -3389,7 +3893,9 @@

                                                                          Examples

                                                                          Enum.filter list, match?({:a, x } when x < 2, &1)
                                                                          - Source + + Source +

                                                                          nil?(x) @@ -3399,11 +3905,15 @@

                                                                          Examples

                                                                          Examples

                                                                          -
                                                                          nil? 1    #=> false
                                                                          -nil? nil  #=> true
                                                                          +
                                                                          iex> nil? 1
                                                                          +false
                                                                          +iex> nil? nil
                                                                          +true
                                                                           
                                                                          - Source + + Source +

                                                                          not arg @@ -3413,11 +3923,13 @@

                                                                          Examples

                                                                          Examples

                                                                          -
                                                                          not false
                                                                          -#=> true
                                                                          +
                                                                          iex> not false
                                                                          +true
                                                                           
                                                                          - Source + + Source +

                                                                          left or right @@ -3427,11 +3939,13 @@

                                                                          Examples

                                                                          Examples

                                                                          -
                                                                          true or false
                                                                          -#=> true
                                                                          +
                                                                          iex> true or false
                                                                          +true
                                                                           
                                                                          - Source + + Source +

                                                                          receive(args) @@ -3479,7 +3993,9 @@

                                                                          Examples

                                                                          will occur immediately.

                                                                        - Source + + Source +

                                                                        rem(left, right) @@ -3490,26 +4006,30 @@

                                                                        Examples

                                                                        Examples

                                                                        -
                                                                        rem 5, 2 #=> 1
                                                                        +
                                                                        iex> rem 5, 2
                                                                        +1
                                                                         
                                                                        - Source + + Source +
                                                                        -

                                                                        - setelem(tuple, index, value) +

                                                                        + set_elem(tuple, index, value)

                                                                        -

                                                                        Define setelem to set Tuple element according to Elixir conventions +

                                                                        Define set_elem to set Tuple element according to Elixir conventions (i.e. it expects the tuple as first argument, zero-index based).

                                                                        -

                                                                        It is implemented as a macro so it can be used in guards.

                                                                        -

                                                                        Example

                                                                        -
                                                                        tuple = { :foo, :bar, 3 }
                                                                        -setelem(tuple, 0, :baz) #=> { :baz, :bar, 3 }
                                                                        +
                                                                        iex> tuple = { :foo, :bar, 3 }
                                                                        +...> set_elem(tuple, 0, :baz)
                                                                        +{ :baz, :bar, 3 }
                                                                         
                                                                        - Source + + Source +

                                                                        to_binary(arg) @@ -3519,11 +4039,13 @@

                                                                        Example

                                                                        Examples

                                                                        -
                                                                        to_binary(:foo)
                                                                        -#=> "foo"
                                                                        +
                                                                        iex> to_binary(:foo)
                                                                        +"foo"
                                                                         
                                                                        - Source + + Source +

                                                                        to_char_list(arg) @@ -3532,11 +4054,13 @@

                                                                        Examples

                                                                        Examples

                                                                        -
                                                                        to_char_list(:foo)
                                                                        -#=> 'foo'
                                                                        +
                                                                        iex> to_char_list(:foo)
                                                                        +'foo'
                                                                         
                                                                        - Source + + Source +

                                                                        try(args) @@ -3653,7 +4177,9 @@

                                                                        Variable visibility

                                                                        end
                                                                        - Source + + Source +

                                                                        unless(clause, options) @@ -3662,7 +4188,9 @@

                                                                        Variable visibility

                                                                        unless a value evalutes to true. Check if for examples and documentation.

                                                                        - Source + + Source +

                                                                        use(module, args // []) @@ -3699,7 +4227,9 @@

                                                                        Examples

                                                                        end
                                                                        - Source + + Source +

                                                                        left xor right @@ -3709,11 +4239,13 @@

                                                                        Examples

                                                                        Examples

                                                                        -
                                                                        true xor false
                                                                        -#=> true
                                                                        +
                                                                        iex> true xor false
                                                                        +true
                                                                         
                                                                        - Source + + Source +

                                                                        left |> right @@ -3725,8 +4257,8 @@

                                                                        Examples

                                                                        Examples

                                                                        -
                                                                        [1,[2],3] |> List.flatten |> Enum.map(&1 * 2)
                                                                        -#=> [2,4,6]
                                                                        +
                                                                        iex> [1,[2],3] |> List.flatten |> Enum.map(&1 * 2)
                                                                        +[2,4,6]
                                                                         

                                                                        The expression above is simply translated to:

                                                                        @@ -3752,7 +4284,9 @@

                                                                        Examples

                                                                        String.graphemes("Hello") |> Enum.reverse
                                                                         
                                                                        - Source + + Source +

                                                                        left || right @@ -3763,17 +4297,23 @@

                                                                        Examples

                                                                        Examples

                                                                        -
                                                                        false || false       #=> false
                                                                        -nil || true          #=> true
                                                                        -false || 1           #=> 1
                                                                        -true || error(:bad)  #=> true
                                                                        +
                                                                        iex> false || false
                                                                        +false
                                                                        +iex> nil || true
                                                                        +true
                                                                        +iex> false || 1
                                                                        +1
                                                                        +iex> true || throw(:bad)
                                                                        +true
                                                                         

                                                                        Notice that, differently from Erlang or operator, this operator accepts any expression as arguments, not only booleans, however it is not allowed in guards.

                                                                        - Source + + Source + diff --git a/docs/stable/KeyError.html b/docs/stable/KeyError.html index 0e401d4f9..4f6847a95 100644 --- a/docs/stable/KeyError.html +++ b/docs/stable/KeyError.html @@ -47,7 +47,7 @@

                                                                        Fields (and defaults)

                                                                        -

                                                                        Functions summary

                                                                        +

                                                                        Functions summary

                                                                        • @@ -70,7 +70,9 @@

                                                                          Functions

                                                                          message(exception)

                                                                          - Source + + Source + diff --git a/docs/stable/Keyword.html b/docs/stable/Keyword.html index 11a174d02..b1bfe9cba 100644 --- a/docs/stable/Keyword.html +++ b/docs/stable/Keyword.html @@ -49,7 +49,7 @@

                                                                          -

                                                                          Functions summary

                                                                          +

                                                                          Functions summary

                                                                          • @@ -168,11 +168,15 @@

                                                                            Functions

                                                                            Examples

                                                                            -
                                                                            Keyword.delete [a: 1, b: 2], :a   #=> [b: 2]
                                                                            -Keyword.delete [b: 2], :a         #=> [b: 2]
                                                                            +
                                                                            iex> Keyword.delete [a: 1, b: 2], :a
                                                                            +[b: 2]
                                                                            +iex> Keyword.delete [b: 2], :a
                                                                            +[b: 2]
                                                                             
                                                                            - Source + + Source +

                                                                            equal?(left, right) @@ -182,11 +186,13 @@

                                                                            Examples

                                                                            Examples

                                                                            -
                                                                            Keyword.equal? [a: 1, b: 2], [b: 2, a: 1]
                                                                            -#=> true
                                                                            +
                                                                            iex> Keyword.equal? [a: 1, b: 2], [b: 2, a: 1]
                                                                            +true
                                                                             
                                                                            - Source + + Source +

                                                                            from_enum(enum) @@ -195,7 +201,9 @@

                                                                            Examples

                                                                            which behaves as a dict, Keyword.from_enum do not remove duplicated entries.

                                                                            - Source + + Source +

                                                                            get(keywords, key, default // nil) @@ -210,12 +218,17 @@

                                                                            Examples

                                                                            Examples

                                                                            -
                                                                            Keyword.get [a: 1], :a      #=> 1
                                                                            -Keyword.get [a: 1], :b      #=> nil
                                                                            -Keyword.get [a: 1], :b, 3   #=> 3
                                                                            +
                                                                            iex> Keyword.get [a: 1], :a
                                                                            +1
                                                                            +iex> Keyword.get [a: 1], :b
                                                                            +nil
                                                                            +iex> Keyword.get [a: 1], :b, 3
                                                                            +3
                                                                             
                                                                            - Source + + Source +

                                                                            get!(keywords, key) @@ -225,11 +238,15 @@

                                                                            Examples

                                                                            Examples

                                                                            -
                                                                            Keyword.get! [a: 1], :a      #=> 1
                                                                            -Keyword.get! [a: 1], :b      #=> raises KeyError[key: :b]
                                                                            +
                                                                            iex> Keyword.get! [a: 1], :a
                                                                            +1
                                                                            +iex> Keyword.get! [a: 1], :b
                                                                            +** (KeyError) key not found: :b
                                                                             
                                                                            - Source + + Source +

                                                                            get_values(keywords, key) @@ -238,11 +255,13 @@

                                                                            Examples

                                                                            Examples

                                                                            -
                                                                            Keyword.get_values [a: 1, a: 2], :a
                                                                            -#=> [1,2]
                                                                            +
                                                                            iex> Keyword.get_values [a: 1, a: 2], :a
                                                                            +[1,2]
                                                                             
                                                                            - Source + + Source +

                                                                            has_key?(keywords, key) @@ -251,13 +270,15 @@

                                                                            Examples

                                                                            Examples

                                                                            -
                                                                            Keyword.has_key?([a: 1], :a)
                                                                            -#=> true
                                                                            -Keyword.has_key?([a: 1], :b)
                                                                            -#=> false
                                                                            +
                                                                            iex> Keyword.has_key?([a: 1], :a)
                                                                            +true
                                                                            +iex> Keyword.has_key?([a: 1], :b)
                                                                            +false
                                                                             
                                                                            - Source + + Source +

                                                                            keys(keywords) @@ -267,17 +288,22 @@

                                                                            Examples

                                                                            Examples

                                                                            -
                                                                            Keyword.keys [a: 1, b: 2] #=> [:a,:b]
                                                                            +
                                                                            iex> Keyword.keys [a: 1, b: 2]
                                                                            +[:a,:b]
                                                                             
                                                                            - Source + + Source +

                                                                            keyword?(arg1)

                                                                            Checks if the given argument is a keywords list or not

                                                                            - Source + + Source +

                                                                            merge(d1, d2) @@ -287,11 +313,13 @@

                                                                            Examples

                                                                            Examples

                                                                            -
                                                                            Keyword.merge [a: 1, b: 2], [a: 3, d: 4]
                                                                            -#=> [a:3, b:2, d: 4]
                                                                            +
                                                                            iex> Enum.sort Keyword.merge [a: 1, b: 2], [a: 3, d: 4]
                                                                            +[a: 3, b: 2, d: 4]
                                                                             
                                                                            - Source + + Source +

                                                                            merge(d1, d2, fun) @@ -301,20 +329,24 @@

                                                                            Examples

                                                                            Examples

                                                                            -
                                                                            Keyword.merge [a: 1, b: 2], [a: 3, d: 4], fn _k, v1, v2 ->
                                                                            -  v1 + v2
                                                                            -end
                                                                            -#=> [a:4, b:2, d: 4]
                                                                            +
                                                                            iex> Keyword.merge [a: 1, b: 2], [a: 3, d: 4], fn _k, v1, v2 ->
                                                                            +...>  v1 + v2
                                                                            +iex> end
                                                                            +[a: 4, b: 2, d: 4]
                                                                             
                                                                            - Source + + Source +

                                                                            new()

                                                                            Returns an empty keyword list, i.e. an empty list.

                                                                            - Source + + Source +

                                                                            new(pairs) @@ -324,11 +356,13 @@

                                                                            Examples

                                                                            Examples

                                                                            -
                                                                            Keyword.new [{:b,1},{:a,2}]
                                                                            -#=> [a: 2, b: 1]
                                                                            +
                                                                            iex> Keyword.new [{:b,1},{:a,2}]
                                                                            +[a: 2, b: 1]
                                                                             
                                                                            - Source + + Source +

                                                                            new(pairs, transform) @@ -339,11 +373,13 @@

                                                                            Examples

                                                                            Examples

                                                                            -
                                                                            Keyword.new [:a, :b], fn x -> {x,x} end
                                                                            -#=> [a: :a, b: :b]
                                                                            +
                                                                            iex> Enum.sort Keyword.new [:a, :b], fn x -> {x,x} end
                                                                            +[a: :a, b: :b]
                                                                             
                                                                            - Source + + Source +

                                                                            put(keywords, key, value) @@ -355,11 +391,13 @@

                                                                            Examples

                                                                            Examples

                                                                            -
                                                                            Keyword.put [a: 1, b: 2], :a, 3
                                                                            -#=> [a: 3, b: 2]
                                                                            +
                                                                            iex> Keyword.put [a: 1, b: 2], :a, 3
                                                                            +[a: 3, b: 2]
                                                                             
                                                                            - Source + + Source +

                                                                            put_new(keywords, key, value) @@ -369,11 +407,13 @@

                                                                            Examples

                                                                            Examples

                                                                            -
                                                                            Keyword.put_new [a: 1, b: 2], :a, 3
                                                                            -#=> [a: 1, b: 2]
                                                                            +
                                                                            iex> Keyword.put_new [a: 1, b: 2], :a, 3
                                                                            +[a: 1, b: 2]
                                                                             
                                                                            - Source + + Source +

                                                                            update(list1, key, fun) @@ -383,13 +423,15 @@

                                                                            Examples

                                                                            Examples

                                                                            -
                                                                            Keyword.update([a: 1], :a, &1 * 2)
                                                                            -#=> [a: 2]
                                                                            -Keyword.update([a: 1], :b, &1 * 2)
                                                                            -#=> KeyError
                                                                            +
                                                                            iex> Keyword.update([a: 1], :a, &1 * 2)
                                                                            +[a: 2]
                                                                            +iex> Keyword.update([a: 1], :b, &1 * 2)
                                                                            +** (KeyError) key not found: :b
                                                                             
                                                                            - Source + + Source +

                                                                            update(list1, key, initial, fun) @@ -399,13 +441,15 @@

                                                                            Examples

                                                                            Examples

                                                                            -
                                                                            Keyword.update([a: 1], :a, 13, &1 * 2)
                                                                            -#=> [a: 2]
                                                                            -Keyword.update([a: 1], :b, 11, &1 * 2)
                                                                            -#=> [a: 1, b: 11]
                                                                            +
                                                                            iex> Keyword.update([a: 1], :a, 13, &1 * 2)
                                                                            +[a: 2]
                                                                            +iex> Keyword.update([a: 1], :b, 11, &1 * 2)
                                                                            +[a: 1, b: 11]
                                                                             
                                                                            - Source + + Source +

                                                                            values(keywords) @@ -414,10 +458,13 @@

                                                                            Examples

                                                                            Examples

                                                                            -
                                                                            Keyword.values [a: 1, b: 2] #=> [1,2]
                                                                            +
                                                                            iex> Keyword.values [a: 1, b: 2]
                                                                            +[1,2]
                                                                             
                                                                            - Source + + Source + diff --git a/docs/stable/List.Chars.Atom.html b/docs/stable/List.Chars.Atom.html index b672659fb..1dfc40ead 100644 --- a/docs/stable/List.Chars.Atom.html +++ b/docs/stable/List.Chars.Atom.html @@ -36,7 +36,7 @@

                                                                            -

                                                                            Functions summary

                                                                            +

                                                                            Functions summary

                                                                            • @@ -59,7 +59,9 @@

                                                                              Functions

                                                                              to_char_list(atom)

                                                                              - Source + + Source + diff --git a/docs/stable/List.Chars.BitString.html b/docs/stable/List.Chars.BitString.html index 0e87f7dd2..cbee8f544 100644 --- a/docs/stable/List.Chars.BitString.html +++ b/docs/stable/List.Chars.BitString.html @@ -36,7 +36,7 @@

                                                                              -

                                                                              Functions summary

                                                                              +

                                                                              Functions summary

                                                                              • @@ -59,7 +59,9 @@

                                                                                Functions

                                                                                to_char_list(bitstring)

                                                                                - Source + + Source + diff --git a/docs/stable/List.Chars.List.html b/docs/stable/List.Chars.List.html index 5abba51c1..96748e2d1 100644 --- a/docs/stable/List.Chars.List.html +++ b/docs/stable/List.Chars.List.html @@ -36,7 +36,7 @@

                                                                                -

                                                                                Functions summary

                                                                                +

                                                                                Functions summary

                                                                                • @@ -59,7 +59,9 @@

                                                                                  Functions

                                                                                  to_char_list(list)

                                                                                  - Source + + Source + diff --git a/docs/stable/List.Chars.Number.html b/docs/stable/List.Chars.Number.html index 477665e1d..56e96f457 100644 --- a/docs/stable/List.Chars.Number.html +++ b/docs/stable/List.Chars.Number.html @@ -36,7 +36,7 @@

                                                                                  -

                                                                                  Functions summary

                                                                                  +

                                                                                  Functions summary

                                                                                  • @@ -59,7 +59,9 @@

                                                                                    Functions

                                                                                    to_char_list(integer)

                                                                                    - Source + + Source + diff --git a/docs/stable/List.Chars.html b/docs/stable/List.Chars.html index 0c725d8a0..fd9d2c6e9 100644 --- a/docs/stable/List.Chars.html +++ b/docs/stable/List.Chars.html @@ -43,7 +43,7 @@

                                                                                    Source -

                                                                                    Implementations

                                                                                    +

                                                                                    Implementations

                                                                                    • @@ -76,7 +76,7 @@

                                                                                      Implementations

                                                                                      -

                                                                                      Functions summary

                                                                                      +

                                                                                      Functions summary

                                                                                      • @@ -99,7 +99,9 @@

                                                                                        Functions

                                                                                        to_char_list(thing)

                                                                                        - Source + + Source + diff --git a/docs/stable/List.Dict.html b/docs/stable/List.Dict.html index 6942a809a..50e357014 100644 --- a/docs/stable/List.Dict.html +++ b/docs/stable/List.Dict.html @@ -42,7 +42,7 @@

                                                                                        -

                                                                                        Functions summary

                                                                                        +

                                                                                        Functions summary

                                                                                        • @@ -146,14 +146,18 @@

                                                                                          Functions

                                                                                          Deletes the entry under the given key from the dict.

                                                                                          - Source + + Source +

                                                                                          empty(_dict)

                                                                                          Returns an empty List.Dict.

                                                                                          - Source + + Source +

                                                                                          get(dict, key, default // nil) @@ -161,7 +165,9 @@

                                                                                          Functions

                                                                                          Returns the value under key from the given dict or default if no key is set.

                                                                                          - Source + + Source +

                                                                                          get!(dict, key) @@ -169,42 +175,54 @@

                                                                                          Functions

                                                                                          Returns the value under the given key raises KeyError if the key does not exist.

                                                                                          - Source + + Source +

                                                                                          has_key?(dict, key)

                                                                                          Returns true if the dict has the given key.

                                                                                          - Source + + Source +

                                                                                          keys(dict)

                                                                                          Returns all keys in the dict.

                                                                                          - Source + + Source +

                                                                                          merge(dict, enum, callback // fn _k, _v1, v2 -> v2 end)

                                                                                          Merges the given Enumerable into the dict.

                                                                                          - Source + + Source +

                                                                                          new()

                                                                                          Returns a new List.Dict, i.e. an empty list.

                                                                                          - Source + + Source +

                                                                                          new(pairs)

                                                                                          Creates a new List.Dict from the given pairs.

                                                                                          - Source + + Source +

                                                                                          new(list, transform) @@ -212,14 +230,18 @@

                                                                                          Functions

                                                                                          Creates a new List.Dict from the given pairs via the given transformation function.

                                                                                          - Source + + Source +

                                                                                          put(dict, key, val)

                                                                                          Puts the given key-value pair in the dict.

                                                                                          - Source + + Source +

                                                                                          put_new(dict, key, val) @@ -227,28 +249,36 @@

                                                                                          Functions

                                                                                          Puts the given key-value pair in the dict if no entry exists yet.

                                                                                          - Source + + Source +

                                                                                          size(dict)

                                                                                          Returns the dict size.

                                                                                          - Source + + Source +

                                                                                          to_list(dict)

                                                                                          Converts the dict to a list.

                                                                                          - Source + + Source +

                                                                                          update(list1, key, fun)

                                                                                          Updates the key in the dict according to the given function.

                                                                                          - Source + + Source +

                                                                                          update(list1, key, initial, fun) @@ -256,14 +286,18 @@

                                                                                          Functions

                                                                                          Updates the key in the dict according to the given function or uses the given initial value if no entry exists.

                                                                                          - Source + + Source +

                                                                                          values(dict)

                                                                                          Returns all values in the dict.

                                                                                          - Source + + Source +
                                                                                          diff --git a/docs/stable/List.html b/docs/stable/List.html index 75aca8a52..fe0b41ab6 100644 --- a/docs/stable/List.html +++ b/docs/stable/List.html @@ -46,7 +46,7 @@

                                                                                          -

                                                                                          Functions summary

                                                                                          +

                                                                                          Functions summary

                                                                                          • @@ -157,11 +157,13 @@

                                                                                            Functions

                                                                                            Examples

                                                                                            -
                                                                                            List.concat [[1,[2],3], [4], [5,6]]
                                                                                            -#=> [1,[2],3,4,5,6]
                                                                                            +
                                                                                            iex> List.concat [[1,[2],3], [4], [5,6]]
                                                                                            +[1,[2],3,4,5,6]
                                                                                             
                                                                                            - Source + + Source +

                                                                                            concat(list, elements) @@ -174,11 +176,13 @@

                                                                                            Examples

                                                                                            Examples

                                                                                            -
                                                                                            List.concat [1,2,3], [4,5,6]
                                                                                            -#=> [1,2,3,4,5,6]
                                                                                            +
                                                                                            iex> List.concat [1,2,3], [4,5,6]
                                                                                            +[1,2,3,4,5,6]
                                                                                             
                                                                                            - Source + + Source +

                                                                                            delete(list, item) @@ -189,11 +193,13 @@

                                                                                            Examples

                                                                                            Examples

                                                                                            -
                                                                                            List.delete([1,2,3], 1)
                                                                                            -#=> [2,3]
                                                                                            +
                                                                                            iex> List.delete([1,2,3], 1)
                                                                                            +[2,3]
                                                                                             
                                                                                            - Source + + Source +

                                                                                            duplicate(elem, n) @@ -202,14 +208,16 @@

                                                                                            Examples

                                                                                            Examples

                                                                                            -
                                                                                            List.duplicate "hello", 3
                                                                                            -#=> ["hello","hello","hello"]
                                                                                            +
                                                                                            iex> List.duplicate "hello", 3
                                                                                            +["hello","hello","hello"]
                                                                                             
                                                                                            -List.duplicate [1,2], 2
                                                                                            -#=> [[1,2],[1,2]]
                                                                                            +iex> List.duplicate [1,2], 2
                                                                                            +[[1,2],[1,2]]
                                                                                             
                                                                                            - Source + + Source +

                                                                                            flatten(list) @@ -220,20 +228,24 @@

                                                                                            Examples

                                                                                            Examples

                                                                                            -
                                                                                            List.flatten [1,[[2],3]]
                                                                                            -#=> [1,2,3]
                                                                                            +
                                                                                            iex> List.flatten [1,[[2],3]]
                                                                                            +[1,2,3]
                                                                                             
                                                                                            -List.flatten [1,[[2],3]], [4,5]
                                                                                            -#=> [1,2,3,4,5]
                                                                                            +iex> List.flatten [1,[[2],3]], [4,5]
                                                                                            +[1,2,3,4,5]
                                                                                             
                                                                                            - Source + + Source +

                                                                                            flatten(list, tail)

                                                                                            - Source + + Source +

                                                                                            foldl(list, acc, function) @@ -243,14 +255,16 @@

                                                                                            Examples

                                                                                            Examples

                                                                                            -
                                                                                            List.foldl [5,5], 10, fn x, acc -> x + acc end
                                                                                            -#=> 20
                                                                                            +
                                                                                            iex> List.foldl [5,5], 10, fn x, acc -> x + acc end
                                                                                            +20
                                                                                             
                                                                                            -List.foldl [1,2,3,4], 0, fn x, acc -> x - acc end
                                                                                            -#=> 2
                                                                                            +iex> List.foldl [1,2,3,4], 0, fn x, acc -> x - acc end
                                                                                            +2
                                                                                             
                                                                                            - Source + + Source +

                                                                                            foldr(list, acc, function) @@ -260,11 +274,13 @@

                                                                                            Examples

                                                                                            Examples

                                                                                            -
                                                                                            List.foldr [1,2,3,4], 0, fn x, acc -> x - acc end
                                                                                            -#=> -2
                                                                                            +
                                                                                            iex> List.foldr [1,2,3,4], 0, fn x, acc -> x - acc end
                                                                                            +-2
                                                                                             
                                                                                            - Source + + Source +

                                                                                            keydelete(list, key, position) @@ -275,17 +291,19 @@

                                                                                            Examples

                                                                                            Examples

                                                                                            -
                                                                                            List.keydelete([a: 1, b: 2], :a, 0)
                                                                                            -#=> [{ :b, 2 }]
                                                                                            +
                                                                                            iex> List.keydelete([a: 1, b: 2], :a, 0)
                                                                                            +[{ :b, 2 }]
                                                                                             
                                                                                            -List.keydelete([a: 1, b: 2], 2, 1)
                                                                                            -#=> [{ :a, 1 }]
                                                                                            +iex> List.keydelete([a: 1, b: 2], 2, 1)
                                                                                            +[{ :a, 1 }]
                                                                                             
                                                                                            -List.keydelete([a: 1, b: 2], :c, 0)
                                                                                            -#=> [{ :a, 1 }, { :b, 2 }]
                                                                                            +iex> List.keydelete([a: 1, b: 2], :c, 0)
                                                                                            +[{ :a, 1 }, { :b, 2 }]
                                                                                             
                                                                                            - Source + + Source +

                                                                                            keyfind(list, key, position, default // nil) @@ -296,17 +314,19 @@

                                                                                            Examples

                                                                                            Examples

                                                                                            -
                                                                                            List.keyfind([a: 1, b: 2], :a, 0)
                                                                                            -#=> { :a, 1 }
                                                                                            +
                                                                                            iex> List.keyfind([a: 1, b: 2], :a, 0)
                                                                                            +{ :a, 1 }
                                                                                             
                                                                                            -List.keyfind([a: 1, b: 2], 2, 1)
                                                                                            -#=> { :b, 2 }
                                                                                            +iex> List.keyfind([a: 1, b: 2], 2, 1)
                                                                                            +{ :b, 2 }
                                                                                             
                                                                                            -List.keyfind([a: 1, b: 2], :c, 0)
                                                                                            -#=> nil
                                                                                            +iex> List.keyfind([a: 1, b: 2], :c, 0)
                                                                                            +nil
                                                                                             
                                                                                            - Source + + Source +

                                                                                            keymember?(list, key, position) @@ -317,17 +337,19 @@

                                                                                            Examples

                                                                                            Examples

                                                                                            -
                                                                                            List.keymember?([a: 1, b: 2], :a, 0)
                                                                                            -#=> true
                                                                                            +
                                                                                            iex> List.keymember?([a: 1, b: 2], :a, 0)
                                                                                            +true
                                                                                             
                                                                                            -List.keymember?([a: 1, b: 2], 2, 1)
                                                                                            -#=> true
                                                                                            +iex> List.keymember?([a: 1, b: 2], 2, 1)
                                                                                            +true
                                                                                             
                                                                                            -List.keymember?([a: 1, b: 2], :c, 0)
                                                                                            -#=> false
                                                                                            +iex> List.keymember?([a: 1, b: 2], :c, 0)
                                                                                            +false
                                                                                             
                                                                                            - Source + + Source +

                                                                                            keyreplace(list, key, position, new_tuple) @@ -337,11 +359,13 @@

                                                                                            Examples

                                                                                            Examples

                                                                                            -
                                                                                            List.keyreplace([a: 1, b: 2], :a, 0, { :a, 3 })
                                                                                            -#=> [a: 3, b: 2]
                                                                                            +
                                                                                            iex> List.keyreplace([a: 1, b: 2], :a, 0, { :a, 3 })
                                                                                            +[a: 3, b: 2]
                                                                                             
                                                                                            - Source + + Source +

                                                                                            keystore(list, key, position, new_tuple) @@ -352,11 +376,13 @@

                                                                                            Examples

                                                                                            Examples

                                                                                            -
                                                                                            List.keystore([a: 1, b: 2], :a, 0, { :a, 3 })
                                                                                            -#=> [a: 3, b: 2]
                                                                                            +
                                                                                            iex> List.keystore([a: 1, b: 2], :a, 0, { :a, 3 })
                                                                                            +[a: 3, b: 2]
                                                                                             
                                                                                            - Source + + Source +

                                                                                            last(list) @@ -365,15 +391,17 @@

                                                                                            Examples

                                                                                            Examples

                                                                                            -
                                                                                            List.last []
                                                                                            -#=> nil
                                                                                            -List.last [1]
                                                                                            -#=> 1
                                                                                            -List.last [1, 2, 3]
                                                                                            -#=> 3
                                                                                            +
                                                                                            iex> List.last []
                                                                                            +nil
                                                                                            +iex> List.last [1]
                                                                                            +1
                                                                                            +iex> List.last [1, 2, 3]
                                                                                            +3
                                                                                             
                                                                                            - Source + + Source +

                                                                                            member?(list, term) @@ -384,14 +412,16 @@

                                                                                            Examples

                                                                                            Examples

                                                                                            -
                                                                                            List.member? [1,2,3], 1
                                                                                            -#=> true
                                                                                            +
                                                                                            iex> List.member? [1,2,3], 1
                                                                                            +true
                                                                                             
                                                                                            -List.member? [1,2,3], 0
                                                                                            -#=> false
                                                                                            +iex> List.member? [1,2,3], 0
                                                                                            +false
                                                                                             
                                                                                            - Source + + Source +

                                                                                            unzip(list) @@ -401,14 +431,16 @@

                                                                                            Examples

                                                                                            Examples

                                                                                            -
                                                                                            List.unzip [{1, 2}, {3, 4}]
                                                                                            -#=> [[1, 3], [2, 4]]
                                                                                            +
                                                                                            iex> List.unzip [{1, 2}, {3, 4}]
                                                                                            +[[1, 3], [2, 4]]
                                                                                             
                                                                                            -List.unzip [{1, :a, "apple"}, {2, :b, "banana"}, {3, :c}]
                                                                                            -#=> [[1, 2, 3], [:a, :b, :c]]
                                                                                            +iex> List.unzip [{1, :a, "apple"}, {2, :b, "banana"}, {3, :c}]
                                                                                            +[[1, 2, 3], [:a, :b, :c]]
                                                                                             
                                                                                            - Source + + Source +

                                                                                            wrap(list) @@ -419,10 +451,13 @@

                                                                                            Examples

                                                                                            Examples

                                                                                            -
                                                                                            List.wrap [1,2,3] #=> [1,2,3]
                                                                                            +
                                                                                            iex> List.wrap [1,2,3]
                                                                                            +[1,2,3]
                                                                                             
                                                                                            - Source + + Source +

                                                                                            zip(list_of_lists) @@ -431,14 +466,16 @@

                                                                                            Examples

                                                                                            Examples

                                                                                            -
                                                                                            List.zip [[1, 2], [3, 4], [5, 6]]
                                                                                            -#=> [{1, 3, 5}, {2, 4, 6}]
                                                                                            +
                                                                                            iex> List.zip [[1, 2], [3, 4], [5, 6]]
                                                                                            +[{1, 3, 5}, {2, 4, 6}]
                                                                                             
                                                                                            -List.zip [[1, 2], [3], [5, 6]]
                                                                                            -#=> [{1, 3, 5}]
                                                                                            +iex> List.zip [[1, 2], [3], [5, 6]]
                                                                                            +[{1, 3, 5}]
                                                                                             
                                                                                            - Source + + Source + diff --git a/docs/stable/Macro.Env.html b/docs/stable/Macro.Env.html index c44f3587f..862c4b00c 100644 --- a/docs/stable/Macro.Env.html +++ b/docs/stable/Macro.Env.html @@ -120,7 +120,7 @@

                                                                                            Fields (and defaults)

                                                                                            -

                                                                                            Functions summary

                                                                                            +

                                                                                            Functions summary

                                                                                            • @@ -160,7 +160,9 @@

                                                                                              Functions

                                                                                              Returns wether the compilation environment is currently inside a guard.

                                                                                              - Source + + Source +

                                                                                              in_match?(record) @@ -168,7 +170,9 @@

                                                                                              Functions

                                                                                              Returns wether the compilation environment is currently inside a match clause.

                                                                                              - Source + + Source +

                                                                                              location(record) @@ -176,14 +180,18 @@

                                                                                              Functions

                                                                                              Returns a keyword list containing the file and line information as keys.

                                                                                              - Source + + Source +

                                                                                              stacktrace(record)

                                                                                              Returns the environment stacktrace.

                                                                                              - Source + + Source +
                                                                                              diff --git a/docs/stable/Macro.html b/docs/stable/Macro.html index 6f5c62d51..a4861ebae 100644 --- a/docs/stable/Macro.html +++ b/docs/stable/Macro.html @@ -39,14 +39,9 @@

                                                                                              -

                                                                                              Functions summary

                                                                                              +

                                                                                              Functions summary

                                                                                              • - - do_safe_term/1 - -
                                                                                              • -
                                                                                              • escape/1 @@ -96,7 +91,7 @@

                                                                                                Functions summary

                                                                                                -

                                                                                                Macros summary

                                                                                                +

                                                                                                Macros summary

                                                                                                • @@ -118,29 +113,24 @@

                                                                                                  Macros summary

                                                                                                  Functions

                                                                                                  -

                                                                                                  - do_safe_term(terms) -

                                                                                                  -
                                                                                                  - Source -

                                                                                                  - escape(tuple) + escape(expr)

                                                                                                  -

                                                                                                  Recursively escapes the given value so it can be inserted -into a syntax tree. Structures that are valid syntax nodes -(like atoms, integers, binaries) are represented by themselves.

                                                                                                  +

                                                                                                  Recursively escapes a value so it can be inserted +into a syntax tree.

                                                                                                  Examples

                                                                                                  -
                                                                                                  Macro.escape(:foo)
                                                                                                  -#=> :foo
                                                                                                  +
                                                                                                  iex> Macro.escape(:foo)
                                                                                                  +:foo
                                                                                                   
                                                                                                  -Macro.escape({ :a, :b, :c })
                                                                                                  -#=> { :{}, [], [:a, :b, :c] }
                                                                                                  +iex> Macro.escape({ :a, :b, :c })
                                                                                                  +{ :{}, [], [:a, :b, :c] }
                                                                                                   
                                                                                                  - Source + + Source +

                                                                                                  expand(aliases, env) @@ -158,10 +148,13 @@

                                                                                                  Examples

                                                                                                  In case the expression cannot be expanded, it returns the expression itself.

                                                                                                  Notice that Macro.expand is not recursive and it does not -expand child expressions. For example, !some_macro will expand as:

                                                                                                  +expand child expressions. In this example

                                                                                                  + +

                                                                                                  Macro.expand(quote(do: !somemacro), _ENV__)

                                                                                                  -
                                                                                                  iex> IO.puts Macro.to_binary Macro.expand(quote(do: !some_macro), __ENV__)
                                                                                                  -case some_macro do
                                                                                                  +

                                                                                                  !some_macro will expand to something like:

                                                                                                  + +
                                                                                                  case some_macro do
                                                                                                     false -> true
                                                                                                     nil   -> true
                                                                                                     _     -> false
                                                                                                  @@ -237,7 +230,9 @@ 

                                                                                                  Examples

                                                                                                  end
                                                                                                  - Source + + Source +

                                                                                                  extract_args(expr) @@ -254,12 +249,13 @@

                                                                                                  Examples

                                                                                                  extract_args(quote do: foo)        == { :foo, [] }
                                                                                                   extract_args(quote do: foo())      == { :foo, [] }
                                                                                                  -extract_args(quote do: :foo.())    == { :foo, [] }
                                                                                                   extract_args(quote do: foo(1,2,3)) == { :foo, [1,2,3] }
                                                                                                   extract_args(quote do: 1.(1,2,3))  == :error
                                                                                                   
                                                                                                  - Source + + Source +

                                                                                                  safe_term(terms) @@ -269,7 +265,9 @@

                                                                                                  Examples

                                                                                                  evaluate code) and returns :ok unless a given term is unsafe, which is returned as { :unsafe, term }.

                                                                                                  - Source + + Source +

                                                                                                  to_binary(tree) @@ -278,11 +276,13 @@

                                                                                                  Examples

                                                                                                  Examples

                                                                                                  -
                                                                                                  Macro.to_binary(quote do: foo.bar(1, 2, 3))
                                                                                                  -#=> "foo.bar(1, 2, 3)"
                                                                                                  +
                                                                                                  iex> Macro.to_binary(quote do: foo.bar(1, 2, 3))
                                                                                                  +"foo.bar(1, 2, 3)"
                                                                                                   
                                                                                                  - Source + + Source +

                                                                                                  unescape_binary(chars) @@ -301,21 +301,23 @@

                                                                                                  Examples

                                                                                                  Examples

                                                                                                  -
                                                                                                  Macro.unescape_binary "example\\n"
                                                                                                  -#=> "example\n"
                                                                                                  +
                                                                                                  iex> Macro.unescape_binary "example\\n"
                                                                                                  +"example\n"
                                                                                                   

                                                                                                  In the example above, we pass a string with \n escaped and we return a version with it unescaped.

                                                                                                  - Source + + Source +

                                                                                                  unescape_binary(chars, map)

                                                                                                  Unescape the given chars according to the map given. -Check unescape/1 if you want to use the same map as -Elixir single- and double-quoted strings.

                                                                                                  +Check unescape_binary/1 if you want to use the same map +as Elixir single- and double-quoted strings.

                                                                                                  Map

                                                                                                  @@ -356,27 +358,35 @@

                                                                                                  Examples

                                                                                                  Macro.unescape_binary "example\\n", unescape_map(&1)
                                                                                                   
                                                                                                  - Source + + Source +

                                                                                                  unescape_tokens(tokens)

                                                                                                  Unescape the given tokens according to the default map. -Check unescape/1 and unescape/2 for more information -about unescaping. Only tokens that are binaries are -unescaped, all others are ignored. This function is useful -when implementing your own sigils. Check the implementation -of Kernel.__b__ for examples.

                                                                                                  +Check unescape_binary/1 and unescape_binary/2 for more +information about unescaping.

                                                                                                  + +

                                                                                                  Only tokens that are binaries are unescaped, all others are +ignored. This function is useful when implementing your own +sigils. Check the implementation of Kernel.__b__ +for examples.

                                                                                                  - Source + + Source +

                                                                                                  unescape_tokens(tokens, map)

                                                                                                  Unescape the given tokens according to the given map. -Check unescape_tokens/1 and unescaped/2 for more information.

                                                                                                  +Check unescape_tokens/1 and unescape_binary/2 for more information.

                                                                                                  - Source + + Source +
                                                                                                  @@ -391,7 +401,9 @@

                                                                                                  Macros

                                                                                                  Returns a list of binary operators. This is available as a macro so it can be used in guard clauses.

                                                                                                  - Source + + Source +

                                                                                                  unary_ops() @@ -399,7 +411,9 @@

                                                                                                  Macros

                                                                                                  Returns a list of unary operators. This is available as a macro so it can be used in guard clauses.

                                                                                                  - Source + + Source +
                                                                                                  diff --git a/docs/stable/MatchError.html b/docs/stable/MatchError.html index 47a8fc5c6..7b131b744 100644 --- a/docs/stable/MatchError.html +++ b/docs/stable/MatchError.html @@ -47,7 +47,7 @@

                                                                                                  Fields (and defaults)

                                                                                                  -

                                                                                                  Functions summary

                                                                                                  +

                                                                                                  Functions summary

                                                                                                  • @@ -70,7 +70,9 @@

                                                                                                    Functions

                                                                                                    message(exception)

                                                                                                    - Source + + Source + diff --git a/docs/stable/Mix.Deps.html b/docs/stable/Mix.Deps.html index 018965bc1..64a247905 100644 --- a/docs/stable/Mix.Deps.html +++ b/docs/stable/Mix.Deps.html @@ -39,7 +39,7 @@

                                                                                                    -

                                                                                                    Functions summary

                                                                                                    +

                                                                                                    Functions summary

                                                                                                    • @@ -113,7 +113,9 @@

                                                                                                      Exceptions

                                                                                                      This function raises an exception in case the developer provides a dependency in the wrong format.

                                                                                                      - Source + + Source +

                                                                                                      all(acc, callback) @@ -121,14 +123,18 @@

                                                                                                      Exceptions

                                                                                                      Returns all dependencies but with a custom callback and accumulator.

                                                                                                      - Source + + Source +

                                                                                                      available?(arg1)

                                                                                                      Check if a dependency is available.

                                                                                                      - Source + + Source +

                                                                                                      by_name!(given) @@ -136,35 +142,45 @@

                                                                                                      Exceptions

                                                                                                      Receives a list of deps names and returns deps records. Raises an error if the dependency does not exist.

                                                                                                      - Source + + Source +

                                                                                                      check_lock(dep, lock)

                                                                                                      Checks the lock for the given dependency and update its status accordingly.

                                                                                                      - Source + + Source +

                                                                                                      format_dep(arg1)

                                                                                                      Format the dependency for printing.

                                                                                                      - Source + + Source +

                                                                                                      format_status(arg1)

                                                                                                      Formats the status of a dependency.

                                                                                                      - Source + + Source +

                                                                                                      ok?(arg1)

                                                                                                      Check if a dependency is ok.

                                                                                                      - Source + + Source +

                                                                                                      out_of_date?(dep) @@ -173,14 +189,18 @@

                                                                                                      Exceptions

                                                                                                      lock status. Therefore, be sure to call check_lock before invoking this function.

                                                                                                      - Source + + Source +

                                                                                                      update(dep)

                                                                                                      Updates the dependency inside the given project.

                                                                                                      - Source + + Source +
                                                                                                      diff --git a/docs/stable/Mix.Generator.html b/docs/stable/Mix.Generator.html index a0e5e8b34..2298c993e 100644 --- a/docs/stable/Mix.Generator.html +++ b/docs/stable/Mix.Generator.html @@ -39,7 +39,7 @@

                                                                                                      -

                                                                                                      Functions summary

                                                                                                      +

                                                                                                      Functions summary

                                                                                                      • @@ -56,7 +56,7 @@

                                                                                                        Functions summary

                                                                                                        -

                                                                                                        Macros summary

                                                                                                        +

                                                                                                        Macros summary

                                                                                                        • @@ -88,7 +88,9 @@

                                                                                                          Functions

                                                                                                          Creates a directory if one does not exist yet.

                                                                                                          - Source + + Source +

                                                                                                          create_file(path, contents) @@ -96,7 +98,9 @@

                                                                                                          Functions

                                                                                                          Creates a file with the given contents. If the file already exists, asks for user confirmation.

                                                                                                          - Source + + Source +
                                                                                                          @@ -119,7 +123,9 @@

                                                                                                          Macros

                                                                                                          For more information, check EEx.SmartEngine.

                                                                                                          - Source + + Source +

                                                                                                          embed_text(name, contents) @@ -129,7 +135,9 @@

                                                                                                          Macros

                                                                                                          It will define a private function with the name followed by _text that expects no argument.

                                                                                                          - Source + + Source +

                                                                                                          from_file(path) @@ -141,7 +149,9 @@

                                                                                                          Macros

                                                                                                          embed_template :lib, from_file("../templates/lib.eex")
                                                                                                           
                                                                                                          - Source + + Source + diff --git a/docs/stable/Mix.InvalidTaskError.html b/docs/stable/Mix.InvalidTaskError.html index 7adf4d5ab..15e4c4e1a 100644 --- a/docs/stable/Mix.InvalidTaskError.html +++ b/docs/stable/Mix.InvalidTaskError.html @@ -53,7 +53,7 @@

                                                                                                          Fields (and defaults)

                                                                                                          -

                                                                                                          Functions summary

                                                                                                          +

                                                                                                          Functions summary

                                                                                                          • @@ -76,7 +76,9 @@

                                                                                                            Functions

                                                                                                            message(exception)

                                                                                                            - Source + + Source + diff --git a/docs/stable/Mix.Local.html b/docs/stable/Mix.Local.html index 91432f176..57d56bb0a 100644 --- a/docs/stable/Mix.Local.html +++ b/docs/stable/Mix.Local.html @@ -39,7 +39,7 @@

                                                                                                            -

                                                                                                            Functions summary

                                                                                                            +

                                                                                                            Functions summary

                                                                                                            • @@ -73,21 +73,27 @@

                                                                                                              Functions

                                                                                                              Returns all tasks modules in .mix/tasks.

                                                                                                              - Source + + Source +

                                                                                                              append_tasks()

                                                                                                              Append local tasks path into Erlang code path.

                                                                                                              - Source + + Source +

                                                                                                              tasks_path()

                                                                                                              The path for local tasks.

                                                                                                              - Source + + Source +
                                                                                                              diff --git a/docs/stable/Mix.NoTaskError.html b/docs/stable/Mix.NoTaskError.html index 87c96a1e2..bc60525c6 100644 --- a/docs/stable/Mix.NoTaskError.html +++ b/docs/stable/Mix.NoTaskError.html @@ -53,7 +53,7 @@

                                                                                                              Fields (and defaults)

                                                                                                              -

                                                                                                              Functions summary

                                                                                                              +

                                                                                                              Functions summary

                                                                                                              • @@ -76,7 +76,9 @@

                                                                                                                Functions

                                                                                                                message(exception)

                                                                                                                - Source + + Source + diff --git a/docs/stable/Mix.OutOfDateDepsError.html b/docs/stable/Mix.OutOfDateDepsError.html index a4afa25c4..4e8977731 100644 --- a/docs/stable/Mix.OutOfDateDepsError.html +++ b/docs/stable/Mix.OutOfDateDepsError.html @@ -53,7 +53,7 @@

                                                                                                                Fields (and defaults)

                                                                                                                -

                                                                                                                Functions summary

                                                                                                                +

                                                                                                                Functions summary

                                                                                                                • @@ -76,7 +76,9 @@

                                                                                                                  Functions

                                                                                                                  message(exception)

                                                                                                                  - Source + + Source + diff --git a/docs/stable/Mix.Project.html b/docs/stable/Mix.Project.html index 8ddfbadb8..9b747e353 100644 --- a/docs/stable/Mix.Project.html +++ b/docs/stable/Mix.Project.html @@ -68,7 +68,7 @@

                                                                                                                  Examples

                                                                                                                  -

                                                                                                                  Functions summary

                                                                                                                  +

                                                                                                                  Functions summary

                                                                                                                  • @@ -113,14 +113,18 @@

                                                                                                                    Functions

                                                                                                                    Returns the project configuration already considering the current environment.

                                                                                                                    - Source + + Source +

                                                                                                                    config_files()

                                                                                                                    Returns a list of project config files (mix.exs and mix.lock).

                                                                                                                    - Source + + Source +

                                                                                                                    get() @@ -135,14 +139,18 @@

                                                                                                                    Functions

                                                                                                                    Returns nil if no project.

                                                                                                                    - Source + + Source +

                                                                                                                    get!()

                                                                                                                    Same as get/0 but raises an exception if no project.

                                                                                                                    - Source + + Source +

                                                                                                                    refresh() @@ -150,7 +158,9 @@

                                                                                                                    Functions

                                                                                                                    Refresh the project configuration. Usually required when the environment changes during a task.

                                                                                                                    - Source + + Source +
                                                                                                                    diff --git a/docs/stable/Mix.SCM.html b/docs/stable/Mix.SCM.html index ead5d3aa9..cfa0ecd0f 100644 --- a/docs/stable/Mix.SCM.html +++ b/docs/stable/Mix.SCM.html @@ -42,7 +42,7 @@

                                                                                                                    -

                                                                                                                    Functions summary

                                                                                                                    +

                                                                                                                    Functions summary

                                                                                                                    • @@ -66,7 +66,7 @@

                                                                                                                      Functions summary

                                                                                                                      -

                                                                                                                      Callbacks summary

                                                                                                                      +

                                                                                                                      Callbacks summary

                                                                                                                      • @@ -126,21 +126,27 @@

                                                                                                                        Functions

                                                                                                                        Returns all available SCM.

                                                                                                                        - Source + + Source +

                                                                                                                        register(mod)

                                                                                                                        Register the scm repository with the given key and mod.

                                                                                                                        - Source + + Source +

                                                                                                                        register_builtin()

                                                                                                                        Register builtin SCMs.

                                                                                                                        - Source + + Source +
                                                                                                                        @@ -156,7 +162,9 @@

                                                                                                                        Callbacks

                                                                                                                        This behavior function should clean the given dependency.

                                                                                                                        - Source + + Source +

                                                                                                                        equals?(opts1 :: opts(), opts2 :: opts()) @@ -165,7 +173,9 @@

                                                                                                                        Callbacks

                                                                                                                        same repository. The options are guaranteed to belong to the same SCM.

                                                                                                                        - Source + + Source +

                                                                                                                        matches_lock?(opts()) @@ -175,7 +185,9 @@

                                                                                                                        Callbacks

                                                                                                                        SCMs do not require a lock, for such, this function can simply return true.

                                                                                                                        - Source + + Source +

                                                                                                                        update(opts()) @@ -189,7 +201,9 @@

                                                                                                                        Callbacks

                                                                                                                        It must return the current lock.

                                                                                                                        - Source + + Source +

                                                                                                                        checkout(opts()) @@ -201,7 +215,9 @@

                                                                                                                        Callbacks

                                                                                                                        no lock is given and the repository can be checked out to the latest version.

                                                                                                                        - Source + + Source +

                                                                                                                        checked_out?(opts()) @@ -209,7 +225,9 @@

                                                                                                                        Callbacks

                                                                                                                        This behavior function returns a boolean if the dependency is available.

                                                                                                                        - Source + + Source +

                                                                                                                        accepts_options(opts()) @@ -227,7 +245,9 @@

                                                                                                                        Callbacks

                                                                                                                        sense for the Git SCM, it will return an update list of options while other SCMs would simply return nil.

                                                                                                                        - Source + + Source +

                                                                                                                        format_lock(lock()) @@ -235,7 +255,9 @@

                                                                                                                        Callbacks

                                                                                                                        Returns an Elixir term that contains relevant SCM lock information for printing.

                                                                                                                        - Source + + Source +

                                                                                                                        format(opts()) @@ -243,7 +265,9 @@

                                                                                                                        Callbacks

                                                                                                                        Returns an Elixir term that contains relevant SCM information for printing.

                                                                                                                        - Source + + Source +
                                                                                                                        diff --git a/docs/stable/Mix.Shell.IO.html b/docs/stable/Mix.Shell.IO.html index f74380962..ece26e7a9 100644 --- a/docs/stable/Mix.Shell.IO.html +++ b/docs/stable/Mix.Shell.IO.html @@ -40,7 +40,7 @@

                                                                                                                        -

                                                                                                                        Functions summary

                                                                                                                        +

                                                                                                                        Functions summary

                                                                                                                        • @@ -80,21 +80,27 @@

                                                                                                                          Functions

                                                                                                                          Executes the given command and prints its output to stdout as it comes.

                                                                                                                          - Source + + Source +

                                                                                                                          error(message)

                                                                                                                          Writes an error message to the shell followed by new line.

                                                                                                                          - Source + + Source +

                                                                                                                          info(message)

                                                                                                                          Writes a message to the shell followed by new line.

                                                                                                                          - Source + + Source +

                                                                                                                          yes?(message) @@ -103,7 +109,9 @@

                                                                                                                          Functions

                                                                                                                          He must press enter or type anything that matches the a "yes" regex %r/^Y(es)?$/i.

                                                                                                                          - Source + + Source + diff --git a/docs/stable/Mix.Shell.Process.html b/docs/stable/Mix.Shell.Process.html index 51be639b1..65188eed2 100644 --- a/docs/stable/Mix.Shell.Process.html +++ b/docs/stable/Mix.Shell.Process.html @@ -52,7 +52,7 @@

                                                                                                                          -

                                                                                                                          Functions summary

                                                                                                                          +

                                                                                                                          Functions summary

                                                                                                                          • @@ -97,14 +97,18 @@

                                                                                                                            Functions

                                                                                                                            Executes the given command and fowards its messages to the current process.

                                                                                                                            - Source + + Source +

                                                                                                                            error(message)

                                                                                                                            Simply forwards the message to the current process.

                                                                                                                            - Source + + Source +

                                                                                                                            flush(callback // fn x -> x end) @@ -117,14 +121,18 @@

                                                                                                                            Examples

                                                                                                                            flush IO.inspect(&1)
                                                                                                                             
                                                                                                                            - Source + + Source +

                                                                                                                            info(message)

                                                                                                                            Simply forwards the message to the current process.

                                                                                                                            - Source + + Source +

                                                                                                                            yes?(message) @@ -138,7 +146,9 @@

                                                                                                                            Examples

                                                                                                                            If one does not exist, it will abort since there no shell process input given. Value must be true or false.

                                                                                                                            - Source + + Source + diff --git a/docs/stable/Mix.Shell.html b/docs/stable/Mix.Shell.html index 9f0220358..5149dc237 100644 --- a/docs/stable/Mix.Shell.html +++ b/docs/stable/Mix.Shell.html @@ -41,7 +41,7 @@

                                                                                                                            -

                                                                                                                            Functions summary

                                                                                                                            +

                                                                                                                            Functions summary

                                                                                                                            • @@ -55,7 +55,7 @@

                                                                                                                              Functions summary

                                                                                                                              -

                                                                                                                              Callbacks summary

                                                                                                                              +

                                                                                                                              Callbacks summary

                                                                                                                              • @@ -91,7 +91,9 @@

                                                                                                                                Functions

                                                                                                                                An implementation of the command callback that is shared accross different shells.

                                                                                                                                - Source + + Source + @@ -108,28 +110,36 @@

                                                                                                                                Callbacks

                                                                                                                                Executes the given command and returns its exit status.

                                                                                                                                - Source + + Source +

                                                                                                                                yes?(message :: binary())

                                                                                                                                Asks the user for confirmation.

                                                                                                                                - Source + + Source +

                                                                                                                                error(message :: binary())

                                                                                                                                Warns about the given error message.

                                                                                                                                - Source + + Source +

                                                                                                                                info(message :: binary())

                                                                                                                                Informs the given message.

                                                                                                                                - Source + + Source +
                                                                                                                                diff --git a/docs/stable/Mix.Task.html b/docs/stable/Mix.Task.html index f26ca6d3e..1d804212a 100644 --- a/docs/stable/Mix.Task.html +++ b/docs/stable/Mix.Task.html @@ -41,7 +41,7 @@

                                                                                                                                -

                                                                                                                                Functions summary

                                                                                                                                +

                                                                                                                                Functions summary

                                                                                                                                • @@ -100,7 +100,7 @@

                                                                                                                                  Functions summary

                                                                                                                                  -

                                                                                                                                  Callbacks summary

                                                                                                                                  +

                                                                                                                                  Callbacks summary

                                                                                                                                  • @@ -121,7 +121,9 @@

                                                                                                                                    Functions

                                                                                                                                    Returns all loaded modules. Modules that were not yet loaded won't show up. Check load_all/0 if you want to preload all tasks.

                                                                                                                                    - Source + + Source +

                                                                                                                                    clear() @@ -129,7 +131,9 @@

                                                                                                                                    Functions

                                                                                                                                    Clears all invoked tasks, allowing them to be reinvoked. Returns an ordset with all the tasks invoked thus far.

                                                                                                                                    - Source + + Source +

                                                                                                                                    get(task) @@ -143,21 +147,27 @@

                                                                                                                                    Exceptions

                                                                                                                                  • Mix.InvalidTaskError - raised if the task is not a valid Mix.Task
                                                                                                                                  - Source + + Source +

                                                                                                                                  hidden?(module)

                                                                                                                                  Checks if the task is hidden or not. Returns a boolean.

                                                                                                                                  - Source + + Source +

                                                                                                                                  load_all()

                                                                                                                                  Loads all tasks in all code paths.

                                                                                                                                  - Source + + Source +

                                                                                                                                  moduledoc(module) @@ -165,14 +175,18 @@

                                                                                                                                  Exceptions

                                                                                                                                  Gets the moduledoc for the given module. Returns the moduledoc or nil.

                                                                                                                                  - Source + + Source +

                                                                                                                                  reenable(task)

                                                                                                                                  Reenables a given task so it can be executed again down the stack.

                                                                                                                                  - Source + + Source +

                                                                                                                                  run(task, args // []) @@ -187,7 +201,9 @@

                                                                                                                                  Exceptions

                                                                                                                                  It may raise an exception if the task was not found or it is invalid. Check get/2 for more information.

                                                                                                                                  - Source + + Source +

                                                                                                                                  shortdoc(module) @@ -195,14 +211,18 @@

                                                                                                                                  Exceptions

                                                                                                                                  Gets the shortdoc for the given module. Returns the shortdoc or nil.

                                                                                                                                  - Source + + Source +

                                                                                                                                  task_name(module)

                                                                                                                                  Returns the task name for the given module.

                                                                                                                                  - Source + + Source +
                                                                                                                                  @@ -219,7 +239,9 @@

                                                                                                                                  Callbacks

                                                                                                                                  A task needs to implement run which receives a list of command line args.

                                                                                                                                  - Source + + Source + diff --git a/docs/stable/Mix.Tasks.App.Start.html b/docs/stable/Mix.Tasks.App.Start.html index f3ade2d1b..db8f1d39e 100644 --- a/docs/stable/Mix.Tasks.App.Start.html +++ b/docs/stable/Mix.Tasks.App.Start.html @@ -47,7 +47,7 @@

                                                                                                                                  Command line options

                                                                                                                                  -

                                                                                                                                  Functions summary

                                                                                                                                  +

                                                                                                                                  Functions summary

                                                                                                                                  • @@ -70,7 +70,9 @@

                                                                                                                                    Functions

                                                                                                                                    run(args)

                                                                                                                                    - Source + + Source + diff --git a/docs/stable/Mix.Tasks.Clean.html b/docs/stable/Mix.Tasks.Clean.html index a874715bb..3b736c4f1 100644 --- a/docs/stable/Mix.Tasks.Clean.html +++ b/docs/stable/Mix.Tasks.Clean.html @@ -45,7 +45,7 @@

                                                                                                                                    Command line options

                                                                                                                                    -

                                                                                                                                    Functions summary

                                                                                                                                    +

                                                                                                                                    Functions summary

                                                                                                                                    • @@ -68,7 +68,9 @@

                                                                                                                                      Functions

                                                                                                                                      run(args)

                                                                                                                                      - Source + + Source + diff --git a/docs/stable/Mix.Tasks.Compile.App.html b/docs/stable/Mix.Tasks.Compile.App.html index ed6f67653..3ceecb851 100644 --- a/docs/stable/Mix.Tasks.Compile.App.html +++ b/docs/stable/Mix.Tasks.Compile.App.html @@ -63,7 +63,7 @@

                                                                                                                                      Configuration

                                                                                                                                      -

                                                                                                                                      Functions summary

                                                                                                                                      +

                                                                                                                                      Functions summary

                                                                                                                                      • @@ -86,7 +86,9 @@

                                                                                                                                        Functions

                                                                                                                                        run(args)

                                                                                                                                        - Source + + Source + diff --git a/docs/stable/Mix.Tasks.Compile.Elixir.html b/docs/stable/Mix.Tasks.Compile.Elixir.html index 2c19174c2..dd474a0b5 100644 --- a/docs/stable/Mix.Tasks.Compile.Elixir.html +++ b/docs/stable/Mix.Tasks.Compile.Elixir.html @@ -89,7 +89,7 @@

                                                                                                                                        Configuration

                                                                                                                                        -

                                                                                                                                        Functions summary

                                                                                                                                        +

                                                                                                                                        Functions summary

                                                                                                                                        • @@ -112,7 +112,9 @@

                                                                                                                                          Functions

                                                                                                                                          run(args)

                                                                                                                                          - Source + + Source + diff --git a/docs/stable/Mix.Tasks.Compile.Erlang.html b/docs/stable/Mix.Tasks.Compile.Erlang.html index 47a748afd..eea51104f 100644 --- a/docs/stable/Mix.Tasks.Compile.Erlang.html +++ b/docs/stable/Mix.Tasks.Compile.Erlang.html @@ -79,7 +79,7 @@

                                                                                                                                          Configuration

                                                                                                                                          -

                                                                                                                                          Functions summary

                                                                                                                                          +

                                                                                                                                          Functions summary

                                                                                                                                          • @@ -122,20 +122,26 @@

                                                                                                                                            Functions

                                                                                                                                            try to find matching pairs in dir2 with ext2 extension.

                                                                                                                                            - Source + + Source +

                                                                                                                                            interpret_result(file, result, ext // "")

                                                                                                                                            Interprets compilation results and prints them to the console.

                                                                                                                                            - Source + + Source +

                                                                                                                                            run(args)

                                                                                                                                            - Source + + Source +

                                                                                                                                            to_erl_file(file) @@ -143,7 +149,9 @@

                                                                                                                                            Functions

                                                                                                                                            Converts the given file to a format accepted by Erlang compilation tools.

                                                                                                                                            - Source + + Source +
                                                                                                                                            diff --git a/docs/stable/Mix.Tasks.Compile.Leex.html b/docs/stable/Mix.Tasks.Compile.Leex.html index cf89b1605..2c92de341 100644 --- a/docs/stable/Mix.Tasks.Compile.Leex.html +++ b/docs/stable/Mix.Tasks.Compile.Leex.html @@ -63,7 +63,7 @@

                                                                                                                                            Configuration

                                                                                                                                            -

                                                                                                                                            Functions summary

                                                                                                                                            +

                                                                                                                                            Functions summary

                                                                                                                                            • @@ -86,7 +86,9 @@

                                                                                                                                              Functions

                                                                                                                                              run(args)

                                                                                                                                              - Source + + Source + diff --git a/docs/stable/Mix.Tasks.Compile.Yecc.html b/docs/stable/Mix.Tasks.Compile.Yecc.html index 0b9b57518..5c4cad9a0 100644 --- a/docs/stable/Mix.Tasks.Compile.Yecc.html +++ b/docs/stable/Mix.Tasks.Compile.Yecc.html @@ -63,7 +63,7 @@

                                                                                                                                              Configuration

                                                                                                                                              -

                                                                                                                                              Functions summary

                                                                                                                                              +

                                                                                                                                              Functions summary

                                                                                                                                              • @@ -86,7 +86,9 @@

                                                                                                                                                Functions

                                                                                                                                                run(args)

                                                                                                                                                - Source + + Source + diff --git a/docs/stable/Mix.Tasks.Compile.html b/docs/stable/Mix.Tasks.Compile.html index 536d16f41..f768cc94a 100644 --- a/docs/stable/Mix.Tasks.Compile.html +++ b/docs/stable/Mix.Tasks.Compile.html @@ -73,7 +73,7 @@

                                                                                                                                                Common configuration

                                                                                                                                                -

                                                                                                                                                Functions summary

                                                                                                                                                +

                                                                                                                                                Functions summary

                                                                                                                                                • @@ -96,7 +96,9 @@

                                                                                                                                                  Functions

                                                                                                                                                  run(args)

                                                                                                                                                  - Source + + Source + diff --git a/docs/stable/Mix.Tasks.Deps.Check.html b/docs/stable/Mix.Tasks.Deps.Check.html index fd6055c8d..f1ba5b0da 100644 --- a/docs/stable/Mix.Tasks.Deps.Check.html +++ b/docs/stable/Mix.Tasks.Deps.Check.html @@ -43,7 +43,7 @@

                                                                                                                                                  -

                                                                                                                                                  Functions summary

                                                                                                                                                  +

                                                                                                                                                  Functions summary

                                                                                                                                                  • @@ -66,7 +66,9 @@

                                                                                                                                                    Functions

                                                                                                                                                    run(_)

                                                                                                                                                    - Source + + Source + diff --git a/docs/stable/Mix.Tasks.Deps.Clean.html b/docs/stable/Mix.Tasks.Deps.Clean.html index f6938f846..e412ab513 100644 --- a/docs/stable/Mix.Tasks.Deps.Clean.html +++ b/docs/stable/Mix.Tasks.Deps.Clean.html @@ -43,7 +43,7 @@

                                                                                                                                                    -

                                                                                                                                                    Functions summary

                                                                                                                                                    +

                                                                                                                                                    Functions summary

                                                                                                                                                    • @@ -66,7 +66,9 @@

                                                                                                                                                      Functions

                                                                                                                                                      run(args)

                                                                                                                                                      - Source + + Source + diff --git a/docs/stable/Mix.Tasks.Deps.Compile.html b/docs/stable/Mix.Tasks.Deps.Compile.html index 820af8949..d73f9cf5c 100644 --- a/docs/stable/Mix.Tasks.Deps.Compile.html +++ b/docs/stable/Mix.Tasks.Deps.Compile.html @@ -57,7 +57,7 @@

                                                                                                                                                      -

                                                                                                                                                      Functions summary

                                                                                                                                                      +

                                                                                                                                                      Functions summary

                                                                                                                                                      • @@ -80,7 +80,9 @@

                                                                                                                                                        Functions

                                                                                                                                                        run(args)

                                                                                                                                                        - Source + + Source + diff --git a/docs/stable/Mix.Tasks.Deps.Get.html b/docs/stable/Mix.Tasks.Deps.Get.html index 917dd743b..ec3a23176 100644 --- a/docs/stable/Mix.Tasks.Deps.Get.html +++ b/docs/stable/Mix.Tasks.Deps.Get.html @@ -46,7 +46,7 @@

                                                                                                                                                        Command line options

                                                                                                                                                        -

                                                                                                                                                        Functions summary

                                                                                                                                                        +

                                                                                                                                                        Functions summary

                                                                                                                                                        • @@ -69,7 +69,9 @@

                                                                                                                                                          Functions

                                                                                                                                                          run(args)

                                                                                                                                                          - Source + + Source + diff --git a/docs/stable/Mix.Tasks.Deps.Loadpaths.html b/docs/stable/Mix.Tasks.Deps.Loadpaths.html index 7977a449c..a127bb3c8 100644 --- a/docs/stable/Mix.Tasks.Deps.Loadpaths.html +++ b/docs/stable/Mix.Tasks.Deps.Loadpaths.html @@ -40,7 +40,7 @@

                                                                                                                                                          -

                                                                                                                                                          Functions summary

                                                                                                                                                          +

                                                                                                                                                          Functions summary

                                                                                                                                                          • @@ -63,7 +63,9 @@

                                                                                                                                                            Functions

                                                                                                                                                            run(args)

                                                                                                                                                            - Source + + Source + diff --git a/docs/stable/Mix.Tasks.Deps.Unlock.html b/docs/stable/Mix.Tasks.Deps.Unlock.html index e3d24b718..c8ec9f6e9 100644 --- a/docs/stable/Mix.Tasks.Deps.Unlock.html +++ b/docs/stable/Mix.Tasks.Deps.Unlock.html @@ -40,7 +40,7 @@

                                                                                                                                                            -

                                                                                                                                                            Functions summary

                                                                                                                                                            +

                                                                                                                                                            Functions summary

                                                                                                                                                            • @@ -63,7 +63,9 @@

                                                                                                                                                              Functions

                                                                                                                                                              run(args)

                                                                                                                                                              - Source + + Source + diff --git a/docs/stable/Mix.Tasks.Deps.Update.html b/docs/stable/Mix.Tasks.Deps.Update.html index ee29f6e99..5e741da03 100644 --- a/docs/stable/Mix.Tasks.Deps.Update.html +++ b/docs/stable/Mix.Tasks.Deps.Update.html @@ -49,7 +49,7 @@

                                                                                                                                                              Command line options

                                                                                                                                                              -

                                                                                                                                                              Functions summary

                                                                                                                                                              +

                                                                                                                                                              Functions summary

                                                                                                                                                              • @@ -72,7 +72,9 @@

                                                                                                                                                                Functions

                                                                                                                                                                run(args)

                                                                                                                                                                - Source + + Source + diff --git a/docs/stable/Mix.Tasks.Deps.html b/docs/stable/Mix.Tasks.Deps.html index c0733bdea..62059709f 100644 --- a/docs/stable/Mix.Tasks.Deps.html +++ b/docs/stable/Mix.Tasks.Deps.html @@ -46,7 +46,7 @@

                                                                                                                                                                -

                                                                                                                                                                Functions summary

                                                                                                                                                                +

                                                                                                                                                                Functions summary

                                                                                                                                                                • @@ -69,7 +69,9 @@

                                                                                                                                                                  Functions

                                                                                                                                                                  run(_)

                                                                                                                                                                  - Source + + Source + diff --git a/docs/stable/Mix.Tasks.Do.html b/docs/stable/Mix.Tasks.Do.html index 2c6b906fe..78c9ca75f 100644 --- a/docs/stable/Mix.Tasks.Do.html +++ b/docs/stable/Mix.Tasks.Do.html @@ -47,7 +47,7 @@

                                                                                                                                                                  Examples

                                                                                                                                                                  -

                                                                                                                                                                  Functions summary

                                                                                                                                                                  +

                                                                                                                                                                  Functions summary

                                                                                                                                                                  • @@ -70,7 +70,9 @@

                                                                                                                                                                    Functions

                                                                                                                                                                    run(args)

                                                                                                                                                                    - Source + + Source + diff --git a/docs/stable/Mix.Tasks.Escriptize.html b/docs/stable/Mix.Tasks.Escriptize.html index 53ba699f2..bfefce2b3 100644 --- a/docs/stable/Mix.Tasks.Escriptize.html +++ b/docs/stable/Mix.Tasks.Escriptize.html @@ -70,7 +70,7 @@

                                                                                                                                                                    Configuration

                                                                                                                                                                    -

                                                                                                                                                                    Functions summary

                                                                                                                                                                    +

                                                                                                                                                                    Functions summary

                                                                                                                                                                    • @@ -93,7 +93,9 @@

                                                                                                                                                                      Functions

                                                                                                                                                                      run(args)

                                                                                                                                                                      - Source + + Source + diff --git a/docs/stable/Mix.Tasks.Help.html b/docs/stable/Mix.Tasks.Help.html index 7dc5a8610..6fa36d35c 100644 --- a/docs/stable/Mix.Tasks.Help.html +++ b/docs/stable/Mix.Tasks.Help.html @@ -47,7 +47,7 @@

                                                                                                                                                                      Arguments

                                                                                                                                                                      -

                                                                                                                                                                      Functions summary

                                                                                                                                                                      +

                                                                                                                                                                      Functions summary

                                                                                                                                                                      • @@ -70,7 +70,9 @@

                                                                                                                                                                        Functions

                                                                                                                                                                        run(list1)

                                                                                                                                                                        - Source + + Source + diff --git a/docs/stable/Mix.Tasks.Loadpaths.html b/docs/stable/Mix.Tasks.Loadpaths.html index 3b0d5ab4a..d36615647 100644 --- a/docs/stable/Mix.Tasks.Loadpaths.html +++ b/docs/stable/Mix.Tasks.Loadpaths.html @@ -49,7 +49,7 @@

                                                                                                                                                                        Configuration

                                                                                                                                                                        -

                                                                                                                                                                        Functions summary

                                                                                                                                                                        +

                                                                                                                                                                        Functions summary

                                                                                                                                                                        • @@ -72,7 +72,9 @@

                                                                                                                                                                          Functions

                                                                                                                                                                          run(args)

                                                                                                                                                                          - Source + + Source + diff --git a/docs/stable/Mix.Tasks.Local.Install.html b/docs/stable/Mix.Tasks.Local.Install.html index 627f47f26..83eec4cc6 100644 --- a/docs/stable/Mix.Tasks.Local.Install.html +++ b/docs/stable/Mix.Tasks.Local.Install.html @@ -50,7 +50,7 @@

                                                                                                                                                                          -

                                                                                                                                                                          Functions summary

                                                                                                                                                                          +

                                                                                                                                                                          Functions summary

                                                                                                                                                                          • @@ -73,7 +73,9 @@

                                                                                                                                                                            Functions

                                                                                                                                                                            run(argv)

                                                                                                                                                                            - Source + + Source + diff --git a/docs/stable/Mix.Tasks.Local.Uninstall.html b/docs/stable/Mix.Tasks.Local.Uninstall.html index 1e6ffc217..12aef7faf 100644 --- a/docs/stable/Mix.Tasks.Local.Uninstall.html +++ b/docs/stable/Mix.Tasks.Local.Uninstall.html @@ -42,7 +42,7 @@

                                                                                                                                                                            -

                                                                                                                                                                            Functions summary

                                                                                                                                                                            +

                                                                                                                                                                            Functions summary

                                                                                                                                                                            • @@ -65,7 +65,9 @@

                                                                                                                                                                              Functions

                                                                                                                                                                              run(argv)

                                                                                                                                                                              - Source + + Source + diff --git a/docs/stable/Mix.Tasks.Local.html b/docs/stable/Mix.Tasks.Local.html index f9eee6719..09396ced5 100644 --- a/docs/stable/Mix.Tasks.Local.html +++ b/docs/stable/Mix.Tasks.Local.html @@ -39,7 +39,7 @@

                                                                                                                                                                              -

                                                                                                                                                                              Functions summary

                                                                                                                                                                              +

                                                                                                                                                                              Functions summary

                                                                                                                                                                              • @@ -62,7 +62,9 @@

                                                                                                                                                                                Functions

                                                                                                                                                                                run(list1)

                                                                                                                                                                                - Source + + Source + diff --git a/docs/stable/Mix.Tasks.New.html b/docs/stable/Mix.Tasks.New.html index 82532352c..cf968fa29 100644 --- a/docs/stable/Mix.Tasks.New.html +++ b/docs/stable/Mix.Tasks.New.html @@ -67,7 +67,7 @@

                                                                                                                                                                                Examples

                                                                                                                                                                                -

                                                                                                                                                                                Functions summary

                                                                                                                                                                                +

                                                                                                                                                                                Functions summary

                                                                                                                                                                                • @@ -90,7 +90,9 @@

                                                                                                                                                                                  Functions

                                                                                                                                                                                  run(argv)

                                                                                                                                                                                  - Source + + Source + diff --git a/docs/stable/Mix.Tasks.Run.html b/docs/stable/Mix.Tasks.Run.html index b06c93466..a74524ef8 100644 --- a/docs/stable/Mix.Tasks.Run.html +++ b/docs/stable/Mix.Tasks.Run.html @@ -58,7 +58,7 @@

                                                                                                                                                                                  Examples

                                                                                                                                                                                  -

                                                                                                                                                                                  Functions summary

                                                                                                                                                                                  +

                                                                                                                                                                                  Functions summary

                                                                                                                                                                                  • @@ -81,7 +81,9 @@

                                                                                                                                                                                    Functions

                                                                                                                                                                                    run(args)

                                                                                                                                                                                    - Source + + Source + diff --git a/docs/stable/Mix.Tasks.Test.html b/docs/stable/Mix.Tasks.Test.html index 16f8a4341..a55052d07 100644 --- a/docs/stable/Mix.Tasks.Test.html +++ b/docs/stable/Mix.Tasks.Test.html @@ -42,6 +42,7 @@

                                                                                                                                                                                    Command line options

                                                                                                                                                                                      +
                                                                                                                                                                                    • --cover - the directory to include coverage results;
                                                                                                                                                                                    • --force - forces compilation regardless of module times;
                                                                                                                                                                                    • --quick, -q - only compile files that changed;
                                                                                                                                                                                    • --no-compile - do not compile even if files require compilation;
                                                                                                                                                                                    • @@ -57,6 +58,8 @@

                                                                                                                                                                                      Configuration

                                                                                                                                                                                      Defaults to *_test.exs.

                                                                                                                                                                                    • :test_helper - a file that sets up whatever is necessary for testing. Defaults to test/test_helper.exs.

                                                                                                                                                                                    • +
                                                                                                                                                                                    • :test_coverage - the directory to include test coverage results. +Defaults to nil.

                                                                                                                                                                                    @@ -69,7 +72,7 @@

                                                                                                                                                                                    Configuration

                                                                                                                                                                                    -

                                                                                                                                                                                    Functions summary

                                                                                                                                                                                    +

                                                                                                                                                                                    Functions summary

                                                                                                                                                                                    • @@ -92,7 +95,9 @@

                                                                                                                                                                                      Functions

                                                                                                                                                                                      run(args)

                                                                                                                                                                                      - Source + + Source + diff --git a/docs/stable/Mix.Utils.html b/docs/stable/Mix.Utils.html index 24f0119a7..870687313 100644 --- a/docs/stable/Mix.Utils.html +++ b/docs/stable/Mix.Utils.html @@ -50,7 +50,7 @@

                                                                                                                                                                                      Conversions

                                                                                                                                                                                      -

                                                                                                                                                                                      Functions summary

                                                                                                                                                                                      +

                                                                                                                                                                                      Functions summary

                                                                                                                                                                                      • @@ -139,7 +139,9 @@

                                                                                                                                                                                        Examples

                                                                                                                                                                                        Mix.Utils.camelize "foo_bar" #=> "FooBar"
                                                                                                                                                                                         
                                                                                                                                                                                        - Source + + Source +

                                                                                                                                                                                        command_to_module(command, at // Elixir) @@ -157,7 +159,9 @@

                                                                                                                                                                                        Examples

                                                                                                                                                                                        #=> { :module, Mix.Tasks.Compile }
                                                                                            - Source + + Source +

                                                                                            command_to_module_name(s) @@ -170,7 +174,9 @@

                                                                                            Examples

                                                                                            #=> "Compile.Elixir"
                                                                            - Source + + Source +

                                                                            config_merge(old, new) @@ -178,7 +184,9 @@

                                                                            Examples

                                                                            Merges two configs recursively, merging keyword lists and concatenating normal lists.

                                                                            - Source + + Source +

                                                                            extract_files(paths, exts_or_pattern) @@ -189,14 +197,18 @@

                                                                            Examples

                                                                            recursively searching for the given extensions or the given pattern. When looking up directories, files starting with "." are ignored.

                                                                            - Source + + Source +

                                                                            extract_stale(sources, targets)

                                                                            Extract all stale sources compared to the given targets.

                                                                            - Source + + Source +

                                                                            mix_home() @@ -204,7 +216,9 @@

                                                                            Examples

                                                                            Gets the mix home. It defaults to ~/.mix unless the MIX_HOME environment variable is set.

                                                                            - Source + + Source +

                                                                            module_name_to_command(module, nesting // 0) @@ -222,7 +236,9 @@

                                                                            Examples

                                                                            #=> "compile.elixir"
                                                                            - Source + + Source +

                                                                            preserving_mtime(path, fun) @@ -230,7 +246,9 @@

                                                                            Examples

                                                                            Executes a function but preserves the given path mtime properties.

                                                                            - Source + + Source +

                                                                            relative_to_cwd(path) @@ -238,14 +256,18 @@

                                                                            Examples

                                                                            Returns the given path string relative to the current working directory.

                                                                            - Source + + Source +

                                                                            source(module)

                                                                            Gets the source location of a module as a binary.

                                                                            - Source + + Source +

                                                                            stale?(sources, targets) @@ -253,7 +275,9 @@

                                                                            Examples

                                                                            Returns true if any of the sources are stale compared to the given target.

                                                                            - Source + + Source +

                                                                            underscore(atom) @@ -277,7 +301,9 @@

                                                                            Examples

                                                                            Mix.Utils.camelize "sap_example" #=> "SapExample"
                                                                            - Source + + Source + diff --git a/docs/stable/Mix.html b/docs/stable/Mix.html index bc1a279b6..0a33689f7 100644 --- a/docs/stable/Mix.html +++ b/docs/stable/Mix.html @@ -47,7 +47,7 @@

                                                                            -

                                                                            Functions summary

                                                                            +

                                                                            Functions summary

                                                                            • @@ -101,7 +101,9 @@

                                                                              Functions

                                                                              Returns the mix environment.

                                                                              - Source + + Source +

                                                                              env(env) @@ -109,7 +111,9 @@

                                                                              Functions

                                                                              Changes the current mix env. Project configuration loaded per environment is not going to be reloaded.

                                                                              - Source + + Source +

                                                                              loadpaths() @@ -117,7 +121,9 @@

                                                                              Functions

                                                                              Starts mix and loads the project and dependencies into one step. Useful when invoking mix from an external tool.

                                                                              - Source + + Source +

                                                                              project() @@ -127,7 +133,9 @@

                                                                              Functions

                                                                              return an empty keyword list. This allows many mix tasks to work without a need for an underlying project.

                                                                              - Source + + Source +

                                                                              shell() @@ -139,20 +147,26 @@

                                                                              Functions

                                                                              allow developers to use a test shell, that simply sends the messages to the current process.

                                                                              - Source + + Source +

                                                                              shell(shell)

                                                                              Sets the current shell.

                                                                              - Source + + Source +

                                                                              stop(_state)

                                                                              - Source + + Source +
                                                                              diff --git a/docs/stable/Module.html b/docs/stable/Module.html index b845183c1..be531269a 100644 --- a/docs/stable/Module.html +++ b/docs/stable/Module.html @@ -46,7 +46,7 @@

                                                                              -

                                                                              Functions summary

                                                                              +

                                                                              Functions summary

                                                                              • @@ -177,7 +177,9 @@

                                                                                Examples

                                                                                end - Source + + Source +

                                                                                concat(list) @@ -187,12 +189,17 @@

                                                                                Examples

                                                                                Examples

                                                                                -
                                                                                Module.concat [Foo, Bar]    #=> Foo.Bar
                                                                                -Module.concat [Foo, "Bar"]  #=> Foo.Bar
                                                                                -Module.concat [Foo, 'Bar']  #=> Foo.Bar
                                                                                +
                                                                                iex> Module.concat [Foo, Bar]
                                                                                +Foo.Bar
                                                                                +iex> Module.concat [Foo, "Bar"]
                                                                                +Foo.Bar
                                                                                +iex> Module.concat [Foo, 'Bar']
                                                                                +Foo.Bar
                                                                                 
                                                                                - Source + + Source +

                                                                                concat(left, right) @@ -202,12 +209,17 @@

                                                                                Examples

                                                                                Examples

                                                                                -
                                                                                Module.concat Foo, Bar    #=> Foo.Bar
                                                                                -Module.concat Foo, "Bar"  #=> Foo.Bar
                                                                                -Module.concat Foo, 'Bar'  #=> Foo.Bar
                                                                                +
                                                                                iex> Module.concat Foo, Bar
                                                                                +Foo.Bar
                                                                                +iex> Module.concat Foo, "Bar"
                                                                                +Foo.Bar
                                                                                +iex> Module.concat Foo, 'Bar'
                                                                                +Foo.Bar
                                                                                 
                                                                                - Source + + Source +

                                                                                create(module, quoted, opts // []) @@ -241,7 +253,9 @@

                                                                                Differences with defmodule

                                                                                when defining the module, while defmodule automatically shares the same environment.

                                                                                - Source + + Source +

                                                                                defines?(module, tuple) @@ -258,7 +272,9 @@

                                                                                Examples

                                                                                end
                                                                                - Source + + Source +

                                                                                defines?(module, tuple, kind) @@ -276,7 +292,9 @@

                                                                                Examples

                                                                                end
                                                                                - Source + + Source +

                                                                                definitions_in(module) @@ -291,7 +309,9 @@

                                                                                Examples

                                                                                end
                                                                                - Source + + Source +

                                                                                definitions_in(module, kind) @@ -308,7 +328,9 @@

                                                                                Examples

                                                                                end
                                                                                - Source + + Source +

                                                                                delete_attribute(module, key) @@ -323,7 +345,9 @@

                                                                                Examples

                                                                                end
                                                                                - Source + + Source +

                                                                                eval_quoted(module, quoted, binding // [], opts // []) @@ -356,7 +380,9 @@

                                                                                Examples

                                                                                Foo.sum(1, 2) #=> 3
                                                                                - Source + + Source +

                                                                                get_attribute(module, key) @@ -377,7 +403,9 @@

                                                                                Examples

                                                                                end
                                                                                - Source + + Source +

                                                                                make_overridable(module, tuples) @@ -386,7 +414,9 @@

                                                                                Examples

                                                                                An overridable function is lazily defined, allowing a developer to customize it.

                                                                                - Source + + Source +

                                                                                open?(module) @@ -394,14 +424,18 @@

                                                                                Examples

                                                                                Check if a module is open, i.e. it is currently being defined and its attributes and functions can be modified.

                                                                                - Source + + Source +

                                                                                overridable?(module, tuple)

                                                                                Returns true if the given tuple in module is marked as overridable.

                                                                                - Source + + Source +

                                                                                put_attribute(module, key, value) @@ -417,7 +451,9 @@

                                                                                Examples

                                                                                end
                                                                                - Source + + Source +

                                                                                register_attribute(module, new, opts // []) @@ -432,7 +468,8 @@

                                                                                Options

                                                                                • :accumulate - Several calls to the same attribute will -accumulate instead of override the previous one;

                                                                                • +accumulate instead of override the previous one. New attributes +are always added to the top of the accumulated list.

                                                                                • :persist - The attribute will be persisted in the Erlang Abstract Format. Useful when interfacing with Erlang libraries.

                                                                                @@ -454,7 +491,9 @@

                                                                                Examples

                                                                                end
                                                                                - Source + + Source +

                                                                                safe_concat(list) @@ -466,14 +505,16 @@

                                                                                Examples

                                                                                Examples

                                                                                -
                                                                                Module.safe_concat [Unknown, Module]
                                                                                -#=> ArgumentError
                                                                                +
                                                                                iex> Module.safe_concat [Unknown, Module]
                                                                                +** (ArgumentError) argument error
                                                                                 
                                                                                -Module.safe_concat [List, Chars]
                                                                                -#=> List.Chars
                                                                                +iex> Module.safe_concat [List, Chars]
                                                                                +List.Chars
                                                                                 
                                                                                - Source + + Source +

                                                                                safe_concat(left, right) @@ -485,14 +526,16 @@

                                                                                Examples

                                                                                Examples

                                                                                -
                                                                                Module.safe_concat Unknown, Module
                                                                                -#=> ArgumentError
                                                                                +
                                                                                iex> Module.safe_concat Unknown, Module
                                                                                +** (ArgumentError) argument error
                                                                                 
                                                                                -Module.safe_concat List, Chars
                                                                                -#=> List.Chars
                                                                                +iex> Module.safe_concat List, Chars
                                                                                +List.Chars
                                                                                 
                                                                                - Source + + Source +

                                                                                split(module) @@ -505,14 +548,18 @@

                                                                                Examples

                                                                                #=> ["Very", "Long", "Module", "Name", "And", "Even", "Longer"]
                                                                                - Source + + Source +

                                                                                to_binary(module)

                                                                                Convert a module name to binary without the Elixir prefix.

                                                                                - Source + + Source +
                                                                                diff --git a/docs/stable/Node.html b/docs/stable/Node.html index 6e78bc0c7..a65dc48d5 100644 --- a/docs/stable/Node.html +++ b/docs/stable/Node.html @@ -39,7 +39,7 @@

                                                                                -

                                                                                Functions summary

                                                                                +

                                                                                Functions summary

                                                                                • @@ -129,7 +129,9 @@

                                                                                  Functions

                                                                                  Returns true if the local node is alive; that is, if the node can be part of a distributed system. Otherwise, it returns false.

                                                                                  - Source + + Source +

                                                                                  connect(node) @@ -140,7 +142,9 @@

                                                                                  Functions

                                                                                  See http://erlang.org/doc/man/net_kernel.html#connect_node-1 for more info.

                                                                                  - Source + + Source +

                                                                                  disconnect(node) @@ -152,7 +156,9 @@

                                                                                  Functions

                                                                                  See http://www.erlang.org/doc/man/erlang.html#disconnect_node-1 for more info.

                                                                                  - Source + + Source +

                                                                                  list() @@ -160,7 +166,9 @@

                                                                                  Functions

                                                                                  Returns a list of all visible nodes in the system, excluding the local node. Same as list(visible).

                                                                                  - Source + + Source +

                                                                                  list(args) @@ -171,7 +179,9 @@

                                                                                  Functions

                                                                                  See http://www.erlang.org/doc/man/erlang.html#nodes-1 for more info.

                                                                                  - Source + + Source +

                                                                                  monitor(node, flag) @@ -181,7 +191,9 @@

                                                                                  Functions

                                                                                  See http://www.erlang.org/doc/man/erlang.html#monitor_node-2 for more info.

                                                                                  - Source + + Source +

                                                                                  monitor(node, flag, options) @@ -191,14 +203,18 @@

                                                                                  Functions

                                                                                  See http://www.erlang.org/doc/man/erlang.html#monitor_node-3 for more info.

                                                                                  - Source + + Source +

                                                                                  self()

                                                                                  Returns the current node. It returns the same as the built-in node().

                                                                                  - Source + + Source +

                                                                                  spawn(node, fun) @@ -209,7 +225,9 @@

                                                                                  Functions

                                                                                  Check http://www.erlang.org/doc/man/erlang.html#spawn-2 for the list of available options.

                                                                                  - Source + + Source +

                                                                                  spawn(node, fun, opts) @@ -220,7 +238,9 @@

                                                                                  Functions

                                                                                  Check http://www.erlang.org/doc/man/erlang.html#spawn_opt-3 for the list of available options.

                                                                                  - Source + + Source +

                                                                                  spawn(node, module, fun, args) @@ -232,7 +252,9 @@

                                                                                  Functions

                                                                                  Check http://www.erlang.org/doc/man/erlang.html#spawn-4 for the list of available options.

                                                                                  - Source + + Source +

                                                                                  spawn(node, module, fun, args, opts) @@ -244,7 +266,9 @@

                                                                                  Functions

                                                                                  Check http://www.erlang.org/doc/man/erlang.html#spawn_opt-5 for the list of available options.

                                                                                  - Source + + Source +

                                                                                  spawn_link(node, fun) @@ -255,7 +279,9 @@

                                                                                  Functions

                                                                                  (and due to the link, an exit signal with exit reason :noconnection will be received).

                                                                                  - Source + + Source +

                                                                                  spawn_link(node, module, fun, args) @@ -266,7 +292,9 @@

                                                                                  Functions

                                                                                  pid is returned (and due to the link, an exit signal with exit reason :noconnection will be received).

                                                                                  - Source + + Source + diff --git a/docs/stable/OptionParser.html b/docs/stable/OptionParser.html index ea1916d02..d4d34dca4 100644 --- a/docs/stable/OptionParser.html +++ b/docs/stable/OptionParser.html @@ -34,7 +34,7 @@

                                                                                  -

                                                                                  Functions summary

                                                                                  +

                                                                                  Functions summary

                                                                                  • @@ -66,22 +66,22 @@

                                                                                    Functions

                                                                                    Examples

                                                                                    -
                                                                                    OptionParser.parse(["--debug"])
                                                                                    -#=> { [debug: true], [] }
                                                                                    +
                                                                                    iex> OptionParser.parse(["--debug"])
                                                                                    +{ [debug: true], [] }
                                                                                     
                                                                                    -OptionParser.parse(["--source", "lib"])
                                                                                    -#=> { [source: "lib"], [] }
                                                                                    +iex> OptionParser.parse(["--source", "lib"])
                                                                                    +{ [source: "lib"], [] }
                                                                                     
                                                                                    -OptionParser.parse(["--source", "lib", "test/enum_test.exs", "--verbose"])
                                                                                    -#=> { [source: "lib", verbose: true], ["test/enum_test.exs"] }
                                                                                    +iex> OptionParser.parse(["--source", "lib", "test/enum_test.exs", "--verbose"])
                                                                                    +{ [source: "lib", verbose: true], ["test/enum_test.exs"] }
                                                                                     

                                                                                    Aliases

                                                                                    A set of aliases can be given as second argument:

                                                                                    -
                                                                                    OptionParser.parse(["-d"], aliases: [d: :debug])
                                                                                    -#=> { [debug: true], [] }
                                                                                    +
                                                                                    iex> OptionParser.parse(["-d"], aliases: [d: :debug])
                                                                                    +{ [debug: true], [] }
                                                                                     

                                                                                    Switches

                                                                                    @@ -106,11 +106,11 @@

                                                                                    Switches

                                                                                    Examples:

                                                                                    -
                                                                                    OptionParser.parse(["--unlock path/to/file"], switches: [unlock: :boolean])
                                                                                    -#=> { [unlock: true], ["path/to/file"] }
                                                                                    +
                                                                                    iex> OptionParser.parse(["--unlock", "path/to/file"], switches: [unlock: :boolean])
                                                                                    +{ [unlock: true], ["path/to/file"] }
                                                                                     
                                                                                    -OptionParser.parse(["--unlock false path/to/file"], switches: [unlock: :boolean])
                                                                                    -#=> { [unlock: false], ["path/to/file"] }
                                                                                    +iex> OptionParser.parse(["--unlock", "false", "path/to/file"], switches: [unlock: :boolean])
                                                                                    +{ [unlock: false], ["path/to/file"] }
                                                                                     

                                                                                    Negation switches

                                                                                    @@ -118,11 +118,13 @@

                                                                                    Negation switches

                                                                                    Any switches starting with --no- are always considered to be booleans and never parse the next value:

                                                                                    -
                                                                                    OptionParser.parse(["--no-op path/to/file"])
                                                                                    -#=> { [no_op: true], ["path/to/file"] }
                                                                                    +
                                                                                    iex> OptionParser.parse(["--no-op", "path/to/file"])
                                                                                    +{ [no_op: true], ["path/to/file"] }
                                                                                     
                                                                                    - Source + + Source +

                                                                                    parse_head(argv, opts // []) @@ -134,11 +136,13 @@

                                                                                    Negation switches

                                                                                    Example

                                                                                    -
                                                                                    OptionParser.parse_head(["--source", "lib", "test/enum_test.exs", "--verbose"])
                                                                                    -#=> { [source: "lib"], ["test/enum_test.exs", "--verbose"] }
                                                                                    +
                                                                                    iex> OptionParser.parse_head(["--source", "lib", "test/enum_test.exs", "--verbose"])
                                                                                    +{ [source: "lib"], ["test/enum_test.exs", "--verbose"] }
                                                                                     
                                                                                    - Source + + Source + diff --git a/docs/stable/Path.html b/docs/stable/Path.html index 3f279561a..30c25447e 100644 --- a/docs/stable/Path.html +++ b/docs/stable/Path.html @@ -48,7 +48,7 @@

                                                                                    -

                                                                                    Functions summary

                                                                                    +

                                                                                    Functions summary

                                                                                    • @@ -171,7 +171,9 @@

                                                                                      Windows

                                                                                      "D:/usr/local/../x"
                                                                                    - Source + + Source +

                                                                                    absname(path, relative_to) @@ -185,14 +187,16 @@

                                                                                    Windows

                                                                                    Examples

                                                                                    -
                                                                                    Path.absname("foo", "bar")
                                                                                    -#=> "bar/foo"
                                                                                    +
                                                                                    iex> Path.absname("foo", "bar")
                                                                                    +"bar/foo"
                                                                                     
                                                                                    -Path.absname("../x", "bar")
                                                                                    -#=> "bar/../x"
                                                                                    +iex> Path.absname("../x", "bar")
                                                                                    +"bar/../x"
                                                                                     
                                                                                    - Source + + Source +

                                                                                    basename(path) @@ -202,17 +206,19 @@

                                                                                    Examples

                                                                                    Examples

                                                                                    -
                                                                                    Path.basename("foo")
                                                                                    -#=> "foo"
                                                                                    +
                                                                                    iex> Path.basename("foo")
                                                                                    +"foo"
                                                                                     
                                                                                    -Path.basename("foo/bar")
                                                                                    -#=> "bar"
                                                                                    +iex> Path.basename("foo/bar")
                                                                                    +"bar"
                                                                                     
                                                                                    -Path.basename("/")
                                                                                    -#=> ""
                                                                                    +iex> Path.basename("/")
                                                                                    +""
                                                                                     
                                                                                    - Source + + Source +

                                                                                    basename(path, extension) @@ -223,15 +229,17 @@

                                                                                    Examples

                                                                                    Examples

                                                                                    -
                                                                                    Path.basename("~/foo/bar.ex", ".ex")
                                                                                    -#=> "bar"
                                                                                    -Path.basename("~/foo/bar.exs", ".ex")
                                                                                    -#=> "bar.exs"
                                                                                    -Path.basename("~/foo/bar.old.ex", ".ex")
                                                                                    -#=> "bar.old"
                                                                                    +
                                                                                    iex> Path.basename("~/foo/bar.ex", ".ex")
                                                                                    +"bar"
                                                                                    +iex> Path.basename("~/foo/bar.exs", ".ex")
                                                                                    +"bar.exs"
                                                                                    +iex> Path.basename("~/foo/bar.old.ex", ".ex")
                                                                                    +"bar.old"
                                                                                     
                                                                                    - Source + + Source +

                                                                                    dirname(path) @@ -244,7 +252,9 @@

                                                                                    Examples

                                                                                    #=> "foo"
                                                                                    - Source + + Source +

                                                                                    expand(path) @@ -254,10 +264,13 @@

                                                                                    Examples

                                                                                    Examples

                                                                                    -
                                                                                    Path.expand("/foo/bar/../bar") == "/foo/bar"
                                                                                    +
                                                                                    iex> Path.expand("/foo/bar/../bar")
                                                                                    +"/foo/bar"
                                                                                     
                                                                                    - Source + + Source +

                                                                                    expand(path, relative_to) @@ -268,11 +281,15 @@

                                                                                    Examples

                                                                                    Examples

                                                                                    -
                                                                                    Path.expand("foo/bar/../bar", "/baz") == "/baz/foo/bar"
                                                                                    -Path.expand("/foo/bar/../bar", "/baz") == "/foo/bar"
                                                                                    +
                                                                                    iex> Path.expand("foo/bar/../bar", "/baz")
                                                                                    +"/baz/foo/bar"
                                                                                    +iex> Path.expand("/foo/bar/../bar", "/baz")
                                                                                    +"/foo/bar"
                                                                                     
                                                                                    - Source + + Source +

                                                                                    extname(path) @@ -281,13 +298,15 @@

                                                                                    Examples

                                                                                    Examples

                                                                                    -
                                                                                    Path.extname("foo.erl")
                                                                                    -#=> ".erl"
                                                                                    -Path.extname("~/foo/bar")
                                                                                    -#=> ""
                                                                                    +
                                                                                    iex> Path.extname("foo.erl")
                                                                                    +".erl"
                                                                                    +iex> Path.extname("~/foo/bar")
                                                                                    +""
                                                                                     
                                                                                    - Source + + Source +

                                                                                    join(list1) @@ -297,15 +316,17 @@

                                                                                    Examples

                                                                                    Examples

                                                                                    -
                                                                                    Path.join(["~", "foo"])
                                                                                    -#=> "~/foo"
                                                                                    -Path.join(["foo"])
                                                                                    -#=> "foo"
                                                                                    -Path.join(["/", "foo", "bar"])
                                                                                    -#=> "/foo/bar"
                                                                                    +
                                                                                    iex> Path.join(["~", "foo"])
                                                                                    +"~/foo"
                                                                                    +iex> Path.join(["foo"])
                                                                                    +"foo"
                                                                                    +iex> Path.join(["/", "foo", "bar"])
                                                                                    +"/foo/bar"
                                                                                     
                                                                                    - Source + + Source +

                                                                                    join(left, right) @@ -314,11 +335,13 @@

                                                                                    Examples

                                                                                    Examples

                                                                                    -
                                                                                    Path.join("foo", "bar")
                                                                                    -#=> "foo/bar"
                                                                                    +
                                                                                    iex> Path.join("foo", "bar")
                                                                                    +"foo/bar"
                                                                                     
                                                                                    - Source + + Source +

                                                                                    relative(name) @@ -340,7 +363,9 @@

                                                                                    Windows examples

                                                                                    Path.relative("/bar/foo.ex") #=> "bar/foo.ex"
                                                                                    - Source + + Source +

                                                                                    relative_to(path, from) @@ -355,12 +380,17 @@

                                                                                    Windows examples

                                                                                    Examples

                                                                                    -
                                                                                    Path.relative_to("/usr/local/foo", "/usr/local") #=> "foo"
                                                                                    -Path.relative_to("/usr/local/foo", "/") #=> "foo"
                                                                                    -Path.relative_to("/usr/local/foo", "/etc") #=> "/usr/local/foo"
                                                                                    +
                                                                                    iex> Path.relative_to("/usr/local/foo", "/usr/local")
                                                                                    +"foo"
                                                                                    +iex> Path.relative_to("/usr/local/foo", "/")
                                                                                    +"usr/local/foo"
                                                                                    +iex> Path.relative_to("/usr/local/foo", "/etc")
                                                                                    +"/usr/local/foo"
                                                                                     
                                                                                    - Source + + Source +

                                                                                    rootname(path) @@ -369,13 +399,15 @@

                                                                                    Examples

                                                                                    Examples

                                                                                    -
                                                                                    Path.rootname("/foo/bar")
                                                                                    -#=> "/foo/bar"
                                                                                    -Path.rootname("/foo/bar.ex")
                                                                                    -#=> "/foo/bar"
                                                                                    +
                                                                                    iex> Path.rootname("/foo/bar")
                                                                                    +"/foo/bar"
                                                                                    +iex> Path.rootname("/foo/bar.ex")
                                                                                    +"/foo/bar"
                                                                                     
                                                                                    - Source + + Source +

                                                                                    rootname(path, extension) @@ -385,13 +417,15 @@

                                                                                    Examples

                                                                                    Examples

                                                                                    -
                                                                                    Path.rootname("/foo/bar.erl", ".erl")
                                                                                    -#=> "/foo/bar"
                                                                                    -Path.rootname("/foo/bar.erl", ".ex")
                                                                                    -#=> "/foo/bar.erl"
                                                                                    +
                                                                                    iex> Path.rootname("/foo/bar.erl", ".erl")
                                                                                    +"/foo/bar"
                                                                                    +iex> Path.rootname("/foo/bar.erl", ".ex")
                                                                                    +"/foo/bar.erl"
                                                                                     
                                                                                    - Source + + Source +

                                                                                    split(path) @@ -401,15 +435,17 @@

                                                                                    Examples

                                                                                    Examples

                                                                                    -
                                                                                     Path.split("")
                                                                                    - #=> ["/"]
                                                                                    - Path.split("foo")
                                                                                    - #=> ["foo"]
                                                                                    - Path.split("/foo/bar")
                                                                                    - #=> ["/", "foo", "bar"]
                                                                                    +
                                                                                     iex> Path.split("")
                                                                                    + ["/"]
                                                                                    + iex> Path.split("foo")
                                                                                    + ["foo"]
                                                                                    + iex> Path.split("/foo/bar")
                                                                                    + ["/", "foo", "bar"]
                                                                                     
                                                                                    - Source + + Source +

                                                                                    type(name) @@ -431,7 +467,9 @@

                                                                                    Windows examples

                                                                                    Path.type("/bar/foo.ex") #=> :volumerelative
                                                                                    - Source + + Source +

                                                                                    wildcard(glob) @@ -471,7 +509,9 @@

                                                                                    Examples

                                                                                    Path.wildcard("projects/*/ebin/**/*.{beam,app}")
                                                                                     
                                                                                    - Source + + Source + diff --git a/docs/stable/Port.html b/docs/stable/Port.html index 534cb3f37..66e25c2ff 100644 --- a/docs/stable/Port.html +++ b/docs/stable/Port.html @@ -39,7 +39,7 @@

                                                                                    -

                                                                                    Functions summary

                                                                                    +

                                                                                    Functions summary

                                                                                    • @@ -103,63 +103,81 @@

                                                                                      Functions

                                                                                      - Source + + Source +

                                                                                      command(port, data, options // [])

                                                                                      - Source + + Source +

                                                                                      control(port, operation, data)

                                                                                      - Source + + Source +
                                                                                      diff --git a/docs/stable/Process.html b/docs/stable/Process.html index 8706f03e4..4fc6ca715 100644 --- a/docs/stable/Process.html +++ b/docs/stable/Process.html @@ -44,7 +44,7 @@

                                                                                      -

                                                                                      Functions summary

                                                                                      +

                                                                                      Functions summary

                                                                                      • @@ -221,21 +221,27 @@

                                                                                        Functions

                                                                                        pid must refer to a process at the local node.

                                                                                        - Source + + Source +

                                                                                        delete()

                                                                                        Deletes all items in the dictionary.

                                                                                        - Source + + Source +

                                                                                        delete(key)

                                                                                        Deletes the given key from the dictionary.

                                                                                        - Source + + Source +

                                                                                        demonitor(monitor_ref, options // []) @@ -246,7 +252,9 @@

                                                                                        Functions

                                                                                        See http://www.erlang.org/doc/man/erlang.html#demonitor-2 for more info.

                                                                                        - Source + + Source +

                                                                                        exit(pid, reason) @@ -273,7 +281,9 @@

                                                                                        Examples

                                                                                        Process.exit(pid, :kill)
                                                                                         
                                                                                        - Source + + Source +

                                                                                        flag(flag, value) @@ -283,7 +293,9 @@

                                                                                        Examples

                                                                                        See http://www.erlang.org/doc/man/erlang.html#process_flag-2 for more info.

                                                                                        - Source + + Source +

                                                                                        flag(pid, flag, value) @@ -294,35 +306,45 @@

                                                                                        Examples

                                                                                        See http://www.erlang.org/doc/man/erlang.html#process_flag-3 for more info.

                                                                                        - Source + + Source +

                                                                                        get()

                                                                                        Returns all key-values in the dictionary.

                                                                                        - Source + + Source +

                                                                                        get(key, default // nil)

                                                                                        Returns the value for the given key.

                                                                                        - Source + + Source +

                                                                                        get_keys(value)

                                                                                        Returns all keys that have the given value.

                                                                                        - Source + + Source +

                                                                                        group_leader()

                                                                                        Returns the pid of the group leader for the process which evaluates the function.

                                                                                        - Source + + Source +

                                                                                        group_leader(leader, pid) @@ -330,7 +352,9 @@

                                                                                        Examples

                                                                                        Sets the group leader of Pid to GroupLeader. Typically, this is used when a processes started from a certain shell should have another group leader than :init.

                                                                                        - Source + + Source +

                                                                                        info(pid) @@ -340,7 +364,9 @@

                                                                                        Examples

                                                                                        See http://www.erlang.org/doc/man/erlang.html#process_info-1 for more info.

                                                                                        - Source + + Source +

                                                                                        info(pid, spec) @@ -350,7 +376,9 @@

                                                                                        Examples

                                                                                        See http://www.erlang.org/doc/man/erlang.html#process_info-2 for more info.

                                                                                        - Source + + Source +

                                                                                        link(pid) @@ -360,7 +388,9 @@

                                                                                        Examples

                                                                                        See http://www.erlang.org/doc/man/erlang.html#link-1 for more info.

                                                                                        - Source + + Source +

                                                                                        list() @@ -374,7 +404,9 @@

                                                                                        Examples

                                                                                        See http://www.erlang.org/doc/man/erlang.html#processes-0 for more info.

                                                                                        - Source + + Source +

                                                                                        monitor(item) @@ -384,14 +416,18 @@

                                                                                        Examples

                                                                                        See http://www.erlang.org/doc/man/erlang.html#monitor-2 for more info.

                                                                                        - Source + + Source +

                                                                                        put(key, value)

                                                                                        Stores the given key-value in the process dictionary.

                                                                                        - Source + + Source +

                                                                                        register(pid, name) @@ -402,14 +438,18 @@

                                                                                        Examples

                                                                                        See http://www.erlang.org/doc/man/erlang.html#register-2 for more info.

                                                                                        - Source + + Source +

                                                                                        registered()

                                                                                        Returns a list of names which have been registered using register/2.

                                                                                        - Source + + Source +

                                                                                        spawn(fun) @@ -417,7 +457,9 @@

                                                                                        Examples

                                                                                        Returns the pid of a new process started by the application of fun. It behaves exactly the same as Kernel.spawn/1.

                                                                                        - Source + + Source +

                                                                                        spawn(fun, opts) @@ -427,7 +469,9 @@

                                                                                        Examples

                                                                                        It also accepts extra options, for the list of available options check http://www.erlang.org/doc/man/erlang.html#spawn_opt-2

                                                                                        - Source + + Source +

                                                                                        spawn(mod, fun, args) @@ -438,7 +482,9 @@

                                                                                        Examples

                                                                                        It behaves exactly the same as the Kernel.spawn/3 function.

                                                                                        - Source + + Source +

                                                                                        spawn(mod, fun, args, opts) @@ -450,7 +496,9 @@

                                                                                        Examples

                                                                                        It also accepts extra options, for the list of available options check http://www.erlang.org/doc/man/erlang.html#spawn_opt-4

                                                                                        - Source + + Source +

                                                                                        spawn_link(fun) @@ -459,7 +507,9 @@

                                                                                        Examples

                                                                                        A link is created between the calling process and the new process, atomically.

                                                                                        - Source + + Source +

                                                                                        spawn_link(mod, fun, args) @@ -468,7 +518,9 @@

                                                                                        Examples

                                                                                        module.function(args). A link is created between the calling process and the new process, atomically. Otherwise works like spawn/3.

                                                                                        - Source + + Source +

                                                                                        spawn_monitor(fun) @@ -476,7 +528,9 @@

                                                                                        Examples

                                                                                        Returns the pid of a new process started by the application of fun and reference for a monitor created to the new process.

                                                                                        - Source + + Source +

                                                                                        spawn_monitor(mod, fun, args) @@ -485,7 +539,9 @@

                                                                                        Examples

                                                                                        and the process is monitored at the same time. Returns the pid and a reference for the monitor. Otherwise works like spawn/3.

                                                                                        - Source + + Source +

                                                                                        unlink(pid) @@ -496,7 +552,9 @@

                                                                                        Examples

                                                                                        See http://www.erlang.org/doc/man/erlang.html#unlink-1 for more info.

                                                                                        - Source + + Source +

                                                                                        unregister(name) @@ -505,7 +563,9 @@

                                                                                        Examples

                                                                                        See http://www.erlang.org/doc/man/erlang.html#unregister-1 for more info.

                                                                                        - Source + + Source +

                                                                                        whereis(name) @@ -515,7 +575,9 @@

                                                                                        Examples

                                                                                        See http://www.erlang.org/doc/man/erlang.html#whereis-1 for more info.

                                                                                        - Source + + Source + diff --git a/docs/stable/Protocol.UndefinedError.html b/docs/stable/Protocol.UndefinedError.html index d3fc53420..918c910d5 100644 --- a/docs/stable/Protocol.UndefinedError.html +++ b/docs/stable/Protocol.UndefinedError.html @@ -53,7 +53,7 @@

                                                                                        Fields (and defaults)

                                                                                        -

                                                                                        Functions summary

                                                                                        +

                                                                                        Functions summary

                                                                                        • @@ -76,7 +76,9 @@

                                                                                          Functions

                                                                                          message(exception)

                                                                                          - Source + + Source + diff --git a/docs/stable/Range.Iterator.Number.html b/docs/stable/Range.Iterator.Number.html index 8e7d0385e..a0f24e170 100644 --- a/docs/stable/Range.Iterator.Number.html +++ b/docs/stable/Range.Iterator.Number.html @@ -36,7 +36,7 @@

                                                                                          -

                                                                                          Functions summary

                                                                                          +

                                                                                          Functions summary

                                                                                          • @@ -64,13 +64,17 @@

                                                                                            Functions

                                                                                            count(first, arg2)

                                                                                            - Source + + Source +

                                                                                            iterator(first, arg2)

                                                                                            - Source + + Source +
                                                                                            diff --git a/docs/stable/Range.Iterator.html b/docs/stable/Range.Iterator.html index 5527b3806..24f96124e 100644 --- a/docs/stable/Range.Iterator.html +++ b/docs/stable/Range.Iterator.html @@ -32,7 +32,7 @@

                                                                                            Source -

                                                                                            Implementations

                                                                                            +

                                                                                            Implementations

                                                                                            • @@ -47,7 +47,7 @@

                                                                                              Implementations

                                                                                              -

                                                                                              Functions summary

                                                                                              +

                                                                                              Functions summary

                                                                                              • @@ -76,7 +76,9 @@

                                                                                                Functions

                                                                                                Count how many items are in the range.

                                                                                                - Source + + Source +

                                                                                                iterator(first, range) @@ -87,7 +89,9 @@

                                                                                                Functions

                                                                                                a tuple with two elements: the given item and the next item in the iteration.

                                                                                                - Source + + Source + diff --git a/docs/stable/Record.html b/docs/stable/Record.html index b40504198..9879d03cb 100644 --- a/docs/stable/Record.html +++ b/docs/stable/Record.html @@ -39,7 +39,7 @@

                                                                                                -

                                                                                                Functions summary

                                                                                                +

                                                                                                Functions summary

                                                                                                • @@ -48,7 +48,7 @@

                                                                                                  Functions summary

                                                                                                • - defmacros/3 + defmacros/4
                                                                                                • @@ -76,6 +76,16 @@

                                                                                                  Functions summary

                                                                                                  +

                                                                                                  Macros summary

                                                                                                  + + @@ -98,10 +108,12 @@

                                                                                                  Examples

                                                                                                  end - Source + + Source +
                                                                                                  -

                                                                                                  - defmacros(name, values, env) +

                                                                                                  + defmacros(name, values, env, tag // nil)

                                                                                                  Defines macros for manipulating records. This is called directly by defrecordp. It expects the macro name, the @@ -114,7 +126,9 @@

                                                                                                  Examples

                                                                                                  end
                                                                                                  - Source + + Source +

                                                                                                  defrecord(name, values, opts) @@ -124,7 +138,9 @@

                                                                                                  Examples

                                                                                                  This is invoked directly by Kernel.defrecord, so check it for more information and documentation.

                                                                                                  - Source + + Source +

                                                                                                  defrecordp(name, fields) @@ -134,14 +150,18 @@

                                                                                                  Examples

                                                                                                  in values. This is invoked directly by Kernel.defrecordp, so check it for more information and documentation.

                                                                                                  - Source + + Source +

                                                                                                  deftypes(values, types, env)

                                                                                                  Defines types and specs for the record.

                                                                                                  - Source + + Source +

                                                                                                  extract(name, opts) @@ -154,12 +174,42 @@

                                                                                                  Examples

                                                                                                  defrecord FileInfo, Record.extract(:file_info, from_lib: "kernel/include/file.hrl")
                                                                                                   
                                                                                                  - Source + + Source + +
                                                                                                  +

                                                                                                  Macros

                                                                                                  +
                                                                                                  +

                                                                                                  + import(module, list2) +

                                                                                                  +

                                                                                                  Import public record definition as a set of private macros (as defined by defrecordp/2)

                                                                                                  + +

                                                                                                  Usage

                                                                                                  + +

                                                                                                  Record.import Record.Module, as: macro_name

                                                                                                  + +

                                                                                                  Example

                                                                                                  + +

                                                                                                  defmodule Test do + Record.import File.Stat, as: :file_stat

                                                                                                  + +
                                                                                                   def size(file_stat(size: size)), do: size
                                                                                                  +
                                                                                                  + +

                                                                                                  end

                                                                                                  +
                                                                                                  + + Source + +
                                                                                                  +
                                                                                                  + diff --git a/docs/stable/Regex.html b/docs/stable/Regex.html index 3c31a3b3a..755416c60 100644 --- a/docs/stable/Regex.html +++ b/docs/stable/Regex.html @@ -84,7 +84,7 @@

                                                                                                  -

                                                                                                  Functions summary

                                                                                                  +

                                                                                                  Functions summary

                                                                                                  • @@ -166,14 +166,18 @@

                                                                                                    Functions

                                                                                                    captures(regex, string, options // [])

                                                                                                    -

                                                                                                    Returns the given captures as a list of tuples.

                                                                                                    +

                                                                                                    Returns the given captures as a list of tuples. +Requires the regex to be compiled with the groups option.

                                                                                                    Examples

                                                                                                    -
                                                                                                    Regex.captures %r/c(?<foo>d)/g, "abcd"  #=> [{:foo, ["d"]}]
                                                                                                    +
                                                                                                    iex> Regex.captures %r/c(?<foo>d)/g, "abcd"
                                                                                                    +[foo: "d"]
                                                                                                     
                                                                                                    - Source + + Source +

                                                                                                    compile(source, options // "") @@ -183,7 +187,9 @@

                                                                                                    Examples

                                                                                                    It returns { :ok, regex } in case of success, { :error, reason } otherwise.

                                                                                                    - Source + + Source +

                                                                                                    compile!(source, options // "") @@ -191,7 +197,9 @@

                                                                                                    Examples

                                                                                                    Compiles the regular expression according to the given options. Fails with Regex.CompileError if the regex cannot be compiled.

                                                                                                    - Source + + Source +

                                                                                                    groups(arg1) @@ -200,10 +208,13 @@

                                                                                                    Examples

                                                                                                    Examples

                                                                                                    -
                                                                                                    Regex.groups %r/(?<foo>foo)/g #=> ["foo"]
                                                                                                    +
                                                                                                    iex> Regex.groups %r/(?<foo>foo)/g
                                                                                                    +[:foo]
                                                                                                     
                                                                                                    - Source + + Source +

                                                                                                    index(arg1, string) @@ -214,11 +225,15 @@

                                                                                                    Examples

                                                                                                    Examples

                                                                                                    -
                                                                                                    Regex.index %r/c(d)/, "abcd"  #=> 3
                                                                                                    -Regex.index %r/e/, "abcd"     #=> nil
                                                                                                    +
                                                                                                    iex> Regex.index %r/c(d)/, "abcd"
                                                                                                    +2
                                                                                                    +iex> Regex.index %r/e/, "abcd"
                                                                                                    +nil
                                                                                                     
                                                                                                    - Source + + Source +

                                                                                                    match?(arg1, string) @@ -227,30 +242,39 @@

                                                                                                    Examples

                                                                                                    Examples

                                                                                                    -
                                                                                                    Regex.match? %r/foo/, "foo" #=> true
                                                                                                    -Regex.match? %r/foo/, "bar" #=> false
                                                                                                    +
                                                                                                    iex> Regex.match? %r/foo/, "foo"
                                                                                                    +true
                                                                                                    +iex> Regex.match? %r/foo/, "bar"
                                                                                                    +false
                                                                                                     
                                                                                                    - Source + + Source +

                                                                                                    opts(arg1)

                                                                                                    -

                                                                                                    Returns the regex options as a list.

                                                                                                    +

                                                                                                    Returns the regex options as a string.

                                                                                                    Examples

                                                                                                    -
                                                                                                    Regex.opts %r(foo)m #=> 'm'
                                                                                                    +
                                                                                                    iex> Regex.opts %r(foo)m
                                                                                                    +"m"
                                                                                                     
                                                                                                    - Source + + Source +

                                                                                                    re_pattern(arg1)

                                                                                                    -

                                                                                                    Returns the underlying re_pattern in the regular expression.

                                                                                                    +

                                                                                                    Returns the underlying re_pattern in the regular expression.

                                                                                                    - Source + + Source +

                                                                                                    replace(arg1, string, replacement, options // []) @@ -265,14 +289,21 @@

                                                                                                    Examples

                                                                                                    Examples

                                                                                                    -
                                                                                                    Regex.replace(%r/d/, "abc", "d")       #=> "abc"
                                                                                                    -Regex.replace(%r/b/, "abc", "d")       #=> "adc"
                                                                                                    -Regex.replace(%r/b/, "abc", "[&]")     #=> "a[b]c"
                                                                                                    -Regex.replace(%r/b/, "abc", "[\\&]")   #=> "a[&]c"
                                                                                                    -Regex.replace(%r/(b)/, "abc", "[\\1]") #=> "a[b]c"
                                                                                                    +
                                                                                                    iex> Regex.replace(%r/d/, "abc", "d")
                                                                                                    +"abc"
                                                                                                    +iex> Regex.replace(%r/b/, "abc", "d")
                                                                                                    +"adc"
                                                                                                    +iex> Regex.replace(%r/b/, "abc", "[&]")
                                                                                                    +"a[b]c"
                                                                                                    +iex> Regex.replace(%r/b/, "abc", "[\\&]")
                                                                                                    +"a[&]c"
                                                                                                    +iex> Regex.replace(%r/(b)/, "abc", "[\\1]")
                                                                                                    +"a[b]c"
                                                                                                     
                                                                                                    - Source + + Source +

                                                                                                    run(regex, string, options // []) @@ -282,11 +313,15 @@

                                                                                                    Examples

                                                                                                    Examples

                                                                                                    -
                                                                                                    Regex.run %r/c(d)/, "abcd"  #=> ["cd", "d"]
                                                                                                    -Regex.run %r/e/, "abcd"     #=> nil
                                                                                                    +
                                                                                                    iex> Regex.run %r/c(d)/, "abcd"
                                                                                                    +["cd", "d"]
                                                                                                    +iex> Regex.run %r/e/, "abcd"
                                                                                                    +nil
                                                                                                     
                                                                                                    - Source + + Source +

                                                                                                    scan(regex, string, options // []) @@ -298,12 +333,17 @@

                                                                                                    Examples

                                                                                                    Examples

                                                                                                    -
                                                                                                    Regex.scan %r/c(d|e)/, "abcd abce"   #=> [["d"], ["e"]]
                                                                                                    -Regex.scan %r/c(?:d|e)/, "abcd abce" #=> ["cd", "ce"]
                                                                                                    -Regex.scan %r/e/, "abcd"             #=> []
                                                                                                    +
                                                                                                    iex> Regex.scan %r/c(d|e)/, "abcd abce"
                                                                                                    +[["d"], ["e"]]
                                                                                                    +iex> Regex.scan %r/c(?:d|e)/, "abcd abce"
                                                                                                    +["cd", "ce"]
                                                                                                    +iex> Regex.scan %r/e/, "abcd"
                                                                                                    +[]
                                                                                                     
                                                                                                    - Source + + Source +

                                                                                                    source(arg1) @@ -312,10 +352,13 @@

                                                                                                    Examples

                                                                                                    Examples

                                                                                                    -
                                                                                                    Regex.source %r(foo) #=> "foo"
                                                                                                    +
                                                                                                    iex> Regex.source %r(foo)
                                                                                                    +"foo"
                                                                                                     
                                                                                                    - Source + + Source +

                                                                                                    split(regex, string, options // []) @@ -323,7 +366,9 @@

                                                                                                    Examples

                                                                                                    Split the given target in the number of parts specified. If no ammount of parts is given, it defaults to :infinity.

                                                                                                    - Source + + Source +
                                                                                                    diff --git a/docs/stable/String.html b/docs/stable/String.html index 696c840d7..f277b9503 100644 --- a/docs/stable/String.html +++ b/docs/stable/String.html @@ -27,18 +27,41 @@

                                                                                                    -

                                                                                                    A string in Elixir is a UTF-8 encoded binary.

                                                                                                    +

                                                                                                    A String in Elixir is a UTF-8 encoded binary.

                                                                                                    + +

                                                                                                    String and binary operations

                                                                                                    The functions in this module act according to the -Unicode Standard, version 6.2.0. A codepoint is a -Unicode Character, which may be represented by one -or more bytes. For example, the character "é" is -represented with two bytes:

                                                                                                    - -
                                                                                                    string = "é"
                                                                                                    -#=> "é"
                                                                                                    -size(string)
                                                                                                    -#=> 2
                                                                                                    +Unicode Standard, version 6.2.0. For example,
                                                                                                    +titlecase, downcase, strip are provided by this
                                                                                                    +module.

                                                                                                    + +

                                                                                                    Besides this module, Elixir provides more low-level +operations that works directly with binaries. Some +of those can be found in the Kernel module, as:

                                                                                                    + +
                                                                                                      +
                                                                                                    • binary_part/2 and binary_part/3 - retrieves part of the binary
                                                                                                    • +
                                                                                                    • bit_size/1 and byte_size/1 - size related functions
                                                                                                    • +
                                                                                                    • is_bitstring/1 and is_binary/1 - type checking function
                                                                                                    • +
                                                                                                    • Plus a bunch of conversion functions, like binary_to_atom/2, +binary_to_integer/2, binary_to_term/1 and their opposite +like integer_to_binary/2
                                                                                                    • +
                                                                                                    + +

                                                                                                    Finally, the :binary module +provides a couple other functions that works on the byte level.

                                                                                                    + +

                                                                                                    Codepoints and graphemes

                                                                                                    + +

                                                                                                    As per the Unicode Standard, a codepoint is an Unicode +Character, which may be represented by one or more bytes. +For example, the character "é" is represented with two +bytes:

                                                                                                    + +
                                                                                                    iex> string = "é"
                                                                                                    +...> byte_size(string)
                                                                                                    +2
                                                                                                     

                                                                                                    Furthermore, this module also presents the concept of @@ -47,10 +70,9 @@

                                                                                                    the same "é" character written above could be represented by the letter "e" followed by the accent ́:

                                                                                                    -
                                                                                                    string = "\x{0065}\x{0301}"
                                                                                                    -#=> "é"
                                                                                                    -size(string)
                                                                                                    -#=> 3
                                                                                                    +
                                                                                                    iex> string = "\x{0065}\x{0301}"
                                                                                                    +...> byte_size(string)
                                                                                                    +3
                                                                                                     

                                                                                                    Although the example above is made of two characters, it is @@ -69,29 +91,33 @@

                                                                                                    Integer codepoints

                                                                                                    Although codepoints could be represented as integers, this -module represents all codepoints as binaries. For example:

                                                                                                    +module represents all codepoints as strings. For example:

                                                                                                    -
                                                                                                    String.codepoints "josé" #=> ["j", "o", "s", "é"]
                                                                                                    +
                                                                                                    iex> String.codepoints "josé"
                                                                                                    +["j", "o", "s", "é"]
                                                                                                     

                                                                                                    There are a couple of ways to retrieve a character integer codepoint. One may use the ? special macro:

                                                                                                    -
                                                                                                    ?j #=> 106
                                                                                                    -?é #=> 233
                                                                                                    +
                                                                                                    iex> ?j
                                                                                                    +106
                                                                                                    +iex> ?é
                                                                                                    +233
                                                                                                     

                                                                                                    Or also via pattern matching:

                                                                                                    -
                                                                                                    << eacute :: utf8 >> = "é"
                                                                                                    -eacute #=> 233
                                                                                                    +
                                                                                                    iex> << eacute :: utf8 >> = "é"
                                                                                                    +...> eacute
                                                                                                    +233
                                                                                                     

                                                                                                    As we have seen above, codepoints can be inserted into a string by their hexadecimal code:

                                                                                                    -
                                                                                                    string = "jos\x{0065}\x{0301}"
                                                                                                    -#=> "josé"
                                                                                                    +
                                                                                                    "jos\x{0065}\x{0301}" #=>
                                                                                                    +"josé"
                                                                                                     

                                                                                                    Self-synchronization

                                                                                                    @@ -105,8 +131,10 @@

                                                                                                    Self-synchronization

                                                                                                    characters. For example, String.length is going to return a correct result even if an invalid codepoint is fed into it.

                                                                                                    -

                                                                                                    In the future, bang version of such functions may be -provided which will rather raise on such invalid data.

                                                                                                    +

                                                                                                    In other words, this module expects invalid data to be detected +when retrieving data from the external source. For example, a +driver that reads strings from a database will be the one +responsible to check the validity of the encoding.

                                                                                                    @@ -118,7 +146,7 @@

                                                                                                    Self-synchronization

                                                                                                    -

                                                                                                    Functions summary

                                                                                                    +

                                                                                                    Functions summary

                                                                                                    • @@ -210,6 +238,11 @@

                                                                                                      Functions summary

                                                                                                      slice/3
                                                                                                    • +
                                                                                                    • + + split/1 + +
                                                                                                    • split/3 @@ -255,14 +288,21 @@

                                                                                                      Functions

                                                                                                      Examples

                                                                                                      -
                                                                                                      String.at("elixir", 0) #=> "e"
                                                                                                      -String.at("elixir", 1) #=> "l"
                                                                                                      -String.at("elixir", 10) #=> nil
                                                                                                      -String.at("elixir", -1) #=> "r"
                                                                                                      -String.at("elixir", -10) #=> nil
                                                                                                      +
                                                                                                      iex> String.at("elixir", 0)
                                                                                                      +"e"
                                                                                                      +iex> String.at("elixir", 1)
                                                                                                      +"l"
                                                                                                      +iex> String.at("elixir", 10)
                                                                                                      +nil
                                                                                                      +iex> String.at("elixir", -1)
                                                                                                      +"r"
                                                                                                      +iex> String.at("elixir", -10)
                                                                                                      +nil
                                                                                                       
                                                                                                      - Source + + Source +

                                                                                                      capitalize(string) @@ -277,12 +317,17 @@

                                                                                                      Examples

                                                                                                      Examples

                                                                                                      -
                                                                                                      String.capitalize("abcd") #=> "Abcd"
                                                                                                      -String.capitalize("fin")   #=> "Fin"
                                                                                                      -String.capitalize("josé") #=> "José"
                                                                                                      +
                                                                                                      iex> String.capitalize("abcd")
                                                                                                      +"Abcd"
                                                                                                      +iex> String.capitalize("fin")
                                                                                                      +"Fin"
                                                                                                      +iex> String.capitalize("josé")
                                                                                                      +"José"
                                                                                                       
                                                                                                      - Source + + Source +

                                                                                                      codepoints(string) @@ -291,12 +336,17 @@

                                                                                                      Examples

                                                                                                      Examples

                                                                                                      -
                                                                                                      String.codepoints("josé")         #=> ["j", "o", "s", "é"]
                                                                                                      -String.codepoints("оптими зации") #=> ["о","п","т","и","м","и"," ","з","а","ц","и","и"]
                                                                                                      -String.codepoints("ἅἪῼ")          #=> ["ἅ","Ἢ","ῼ"]
                                                                                                      +
                                                                                                      iex> String.codepoints("josé")
                                                                                                      +["j", "o", "s", "é"]
                                                                                                      +iex> String.codepoints("оптими зации")
                                                                                                      +["о","п","т","и","м","и"," ","з","а","ц","и","и"]
                                                                                                      +iex> String.codepoints("ἅἪῼ")
                                                                                                      +["ἅ","Ἢ","ῼ"]
                                                                                                       
                                                                                                      - Source + + Source +

                                                                                                      downcase(binary) @@ -305,12 +355,17 @@

                                                                                                      Examples

                                                                                                      Examples

                                                                                                      -
                                                                                                      String.downcase("ABCD") #=> "abcd"
                                                                                                      -String.downcase("AB 123 XPTO") #=> "ab 123 xpto"
                                                                                                      -String.downcase("JOSÉ") #=> "josé"
                                                                                                      +
                                                                                                      iex> String.downcase("ABCD")
                                                                                                      +"abcd"
                                                                                                      +iex> String.downcase("AB 123 XPTO")
                                                                                                      +"ab 123 xpto"
                                                                                                      +iex> String.downcase("JOSÉ")
                                                                                                      +"josé"
                                                                                                       
                                                                                                      - Source + + Source +

                                                                                                      duplicate(subject, n) @@ -319,11 +374,15 @@

                                                                                                      Examples

                                                                                                      Examples

                                                                                                      -
                                                                                                      String.duplicate("abc", 1) #=> "abc"
                                                                                                      -String.duplicate("abc", 2) #=> "abcabc"
                                                                                                      +
                                                                                                      iex> String.duplicate("abc", 1)
                                                                                                      +"abc"
                                                                                                      +iex> String.duplicate("abc", 2)
                                                                                                      +"abcabc"
                                                                                                       
                                                                                                      - Source + + Source +

                                                                                                      first(string) @@ -332,11 +391,15 @@

                                                                                                      Examples

                                                                                                      Examples

                                                                                                      -
                                                                                                      String.first("elixir")  #=> "e"
                                                                                                      -String.first("եոգլի") #=> "ե"
                                                                                                      +
                                                                                                      iex> String.first("elixir")
                                                                                                      +"e"
                                                                                                      +iex> String.first("եոգլի")
                                                                                                      +"ե"
                                                                                                       
                                                                                                      - Source + + Source +

                                                                                                      graphemes(string) @@ -345,10 +408,13 @@

                                                                                                      Examples

                                                                                                      Examples

                                                                                                      -
                                                                                                      String.graphemes("Ā̀stute") # => ["Ā̀","s","t","u","t","e"]
                                                                                                      +
                                                                                                      iex> String.graphemes("Ā̀stute")
                                                                                                      +["Ā̀","s","t","u","t","e"]
                                                                                                       
                                                                                                      - Source + + Source +

                                                                                                      last(string) @@ -357,11 +423,15 @@

                                                                                                      Examples

                                                                                                      Examples

                                                                                                      -
                                                                                                      String.last("elixir")  #=> "r"
                                                                                                      -String.last("եոգլի") #=> "ի"
                                                                                                      +
                                                                                                      iex> String.last("elixir")
                                                                                                      +"r"
                                                                                                      +iex> String.last("եոգլի")
                                                                                                      +"ի"
                                                                                                       
                                                                                                      - Source + + Source +

                                                                                                      length(string) @@ -370,24 +440,31 @@

                                                                                                      Examples

                                                                                                      Examples

                                                                                                      -
                                                                                                      String.length("elixir")  #=> 6
                                                                                                      -String.length("եոգլի") #=> 5
                                                                                                      +
                                                                                                      iex> String.length("elixir")
                                                                                                      +6
                                                                                                      +iex> String.length("եոգլի")
                                                                                                      +5
                                                                                                       
                                                                                                      - Source + + Source +

                                                                                                      lstrip(binary)

                                                                                                      -

                                                                                                      Returns a string where leading whitespace characters -have been removed.

                                                                                                      +

                                                                                                      Returns a string where leading Unicode whitespace +has been removed.

                                                                                                      Examples

                                                                                                      -
                                                                                                      String.lstrip("   abc  ")       #=> "abc  "
                                                                                                      +
                                                                                                      iex> String.lstrip("   abc  ")
                                                                                                      +"abc  "
                                                                                                       
                                                                                                      - Source + + Source +

                                                                                                      lstrip(other, char) @@ -396,10 +473,13 @@

                                                                                                      Examples

                                                                                                      Examples

                                                                                                      -
                                                                                                      String.lstrip("_  abc  _", ?_)  #=> "  abc  _"
                                                                                                      +
                                                                                                      iex> String.lstrip("_  abc  _", ?_)
                                                                                                      +"  abc  _"
                                                                                                       
                                                                                                      - Source + + Source +

                                                                                                      next_codepoint(string) @@ -417,10 +497,13 @@

                                                                                                      Examples

                                                                                                      Examples

                                                                                                      -
                                                                                                      String.next_codepoint("josé") #=> { "j", "osé" }
                                                                                                      +
                                                                                                      iex> String.next_codepoint("josé")
                                                                                                      +{ "j", "osé" }
                                                                                                       
                                                                                                      - Source + + Source +

                                                                                                      next_grapheme(string) @@ -433,10 +516,13 @@

                                                                                                      Examples

                                                                                                      Examples

                                                                                                      -
                                                                                                      String.next_grapheme("josé") #=> { "j", "osé" }
                                                                                                      +
                                                                                                      iex> String.next_grapheme("josé")
                                                                                                      +{ "j", "osé" }
                                                                                                       
                                                                                                      - Source + + Source +

                                                                                                      printable?(arg1) @@ -446,10 +532,13 @@

                                                                                                      Examples

                                                                                                      Examples

                                                                                                      -
                                                                                                      String.printable?("abc") #=> true
                                                                                                      +
                                                                                                      iex> String.printable?("abc")
                                                                                                      +true
                                                                                                       
                                                                                                      - Source + + Source +

                                                                                                      replace(subject, pattern, replacement, options // []) @@ -464,27 +553,37 @@

                                                                                                      Examples

                                                                                                      Examples

                                                                                                      -
                                                                                                      String.replace("a,b,c", ",", "-") #=> "a-b-c"
                                                                                                      -String.replace("a,b,c", ",", "-", global: false) #=> "a-b,c"
                                                                                                      -String.replace("a,b,c", "b", "[]", insert_replaced: 1) #=> "a,[b],c"
                                                                                                      -String.replace("a,b,c", ",", "[]", insert_replaced: 2) #=> "a[],b[],c"
                                                                                                      -String.replace("a,b,c", ",", "[]", insert_replaced: [1,1]) #=> "a[,,]b[,,]c"
                                                                                                      +
                                                                                                      iex> String.replace("a,b,c", ",", "-")
                                                                                                      +"a-b-c"
                                                                                                      +iex> String.replace("a,b,c", ",", "-", global: false)
                                                                                                      +"a-b,c"
                                                                                                      +iex> String.replace("a,b,c", "b", "[]", insert_replaced: 1)
                                                                                                      +"a,[b],c"
                                                                                                      +iex> String.replace("a,b,c", ",", "[]", insert_replaced: 2)
                                                                                                      +"a[],b[],c"
                                                                                                      +iex> String.replace("a,b,c", ",", "[]", insert_replaced: [1,1])
                                                                                                      +"a[,,]b[,,]c"
                                                                                                       
                                                                                                      - Source + + Source +

                                                                                                      rstrip(binary)

                                                                                                      -

                                                                                                      Returns a string where trailing whitespace characters -and new line have been removed.

                                                                                                      +

                                                                                                      Returns a string where trailing Unicode whitespace +has been removed.

                                                                                                      Examples

                                                                                                      -
                                                                                                      String.rstrip("   abc  ")      #=> "   abc"
                                                                                                      +
                                                                                                      iex> String.rstrip("   abc  ")
                                                                                                      +"   abc"
                                                                                                       
                                                                                                      - Source + + Source +

                                                                                                      rstrip(string, char) @@ -493,10 +592,13 @@

                                                                                                      Examples

                                                                                                      Examples

                                                                                                      -
                                                                                                      String.rstrip("   abc _", ?_)  #=> "   abc "
                                                                                                      +
                                                                                                      iex> String.rstrip("   abc _", ?_)
                                                                                                      +"   abc "
                                                                                                       
                                                                                                      - Source + + Source +

                                                                                                      slice(string, start, len) @@ -507,17 +609,24 @@

                                                                                                      Examples

                                                                                                      Examples

                                                                                                      -
                                                                                                      String.slice("elixir", 1, 3) #=> "lix"
                                                                                                      -String.slice("elixir", 1, 10) #=> "lixir"
                                                                                                      -String.slice("elixir", 10, 3) #=> nil
                                                                                                      -String.slice("elixir", -4, 4) #=> "ixi"
                                                                                                      -String.slice("elixir", -10, 3) #=> nil
                                                                                                      +
                                                                                                      iex> String.slice("elixir", 1, 3)
                                                                                                      +"lix"
                                                                                                      +iex> String.slice("elixir", 1, 10)
                                                                                                      +"lixir"
                                                                                                      +iex> String.slice("elixir", 10, 3)
                                                                                                      +nil
                                                                                                      +iex> String.slice("elixir", -4, 4)
                                                                                                      +"ixir"
                                                                                                      +iex> String.slice("elixir", -10, 3)
                                                                                                      +nil
                                                                                                       
                                                                                                      - Source + + Source +
                                                                                                      -

                                                                                                      - split(binary, pattern // " ", options // []) +

                                                                                                      + split(binary)

                                                                                                      Divides a string into sub string based on a pattern, returning a list of these sub string. The pattern can @@ -526,38 +635,64 @@

                                                                                                      Examples

                                                                                                      The string is split into as many parts as possible by default, unless the global option is set to false. If a pattern is not specified, the string is split on -whitespace occurrences.

                                                                                                      +Unicode whitespace occurrences with leading and trailing +whitespace ignored.

                                                                                                      It returns a list with the original string if the pattern can't be matched.

                                                                                                      Examples

                                                                                                      -
                                                                                                      String.split("a,b,c", ",")  #=> ["a", "b", "c"]
                                                                                                      -String.split("a,b,c", ",", global: false)  #=> ["a", "b,c"]
                                                                                                      -
                                                                                                      -String.split("foo bar")     #=> ["foo", "bar"]
                                                                                                      -String.split("1,2 3,4", [" ", ","]) #=> ["1", "2", "3", "4"]
                                                                                                      -
                                                                                                      -String.split("a,b,c", %r{,}) #=> ["a", "b", "c"]
                                                                                                      -String.split("a,b,c", %r{,}, global: false)  #=> ["a", "b,c"]
                                                                                                      -String.split("a,b", %r{.})   #=> ["a,b"]
                                                                                                      +
                                                                                                      iex> String.split("foo bar")
                                                                                                      +["foo", "bar"]
                                                                                                      +iex> String.split("foo" <> <<194,133>> <> "bar")
                                                                                                      +["foo", "bar"]
                                                                                                      +iex> String.split(" foo bar ")
                                                                                                      +["foo", "bar"]
                                                                                                      +
                                                                                                      +iex> String.split("a,b,c", ",")
                                                                                                      +["a", "b", "c"]
                                                                                                      +iex> String.split("a,b,c", ",", global: false)
                                                                                                      +["a", "b,c"]
                                                                                                      +
                                                                                                      +iex> String.split("1,2 3,4", [" ", ","])
                                                                                                      +["1", "2", "3", "4"]
                                                                                                      +
                                                                                                      +iex> String.split("a,b,c", %r{,})
                                                                                                      +["a", "b", "c"]
                                                                                                      +iex> String.split("a,b,c", %r{,}, global: false)
                                                                                                      +["a", "b,c"]
                                                                                                      +iex> String.split("a,b", %r{\.})
                                                                                                      +["a,b"]
                                                                                                       
                                                                                                      - Source + + Source + +
                                                                                                      +

                                                                                                      + split(binary, pattern, options // []) +

                                                                                                      +
                                                                                                      + + Source +

                                                                                                      strip(string)

                                                                                                      -

                                                                                                      Returns a string where leading/trailing whitespace -and new line characters have been removed.

                                                                                                      +

                                                                                                      Returns a string where leading/trailing Unicode whitespace +has been removed.

                                                                                                      Examples

                                                                                                      -
                                                                                                      String.strip("   abc  ")       #=> "abc"
                                                                                                      +
                                                                                                      iex> String.strip("   abc  ")
                                                                                                      +"abc"
                                                                                                       
                                                                                                      - Source + + Source +

                                                                                                      strip(string, char) @@ -567,10 +702,13 @@

                                                                                                      Examples

                                                                                                      Examples

                                                                                                      -
                                                                                                      String.strip("a  abc  a", ?a)  #=> "  abc  "
                                                                                                      +
                                                                                                      iex> String.strip("a  abc  a", ?a)
                                                                                                      +"  abc  "
                                                                                                       
                                                                                                      - Source + + Source +

                                                                                                      upcase(binary) @@ -579,12 +717,17 @@

                                                                                                      Examples

                                                                                                      Examples

                                                                                                      -
                                                                                                      String.upcase("abcd") #=> "ABCD"
                                                                                                      -String.upcase("ab 123 xpto") #=> "AB 123 XPTO"
                                                                                                      -String.upcase("josé") #=> "JOSÉ"
                                                                                                      +
                                                                                                      iex> String.upcase("abcd")
                                                                                                      +"ABCD"
                                                                                                      +iex> String.upcase("ab 123 xpto")
                                                                                                      +"AB 123 XPTO"
                                                                                                      +iex> String.upcase("josé")
                                                                                                      +"JOSÉ"
                                                                                                       
                                                                                                      - Source + + Source +

                                                                                                      valid_codepoint?(arg1) @@ -596,13 +739,19 @@

                                                                                                      Examples

                                                                                                      Examples

                                                                                                      -
                                                                                                      String.valid_codepoint?("a") #=> true
                                                                                                      -String.valid_codepoint?("ø") #=> true
                                                                                                      -String.valid_codepoint?("\xffff") #=> false
                                                                                                      -String.valid_codepoint?("asdf") #=> false
                                                                                                      +
                                                                                                      iex> String.valid_codepoint?("a")
                                                                                                      +true
                                                                                                      +iex> String.valid_codepoint?("ø")
                                                                                                      +true
                                                                                                      +iex> String.valid_codepoint?("\xffff")
                                                                                                      +false
                                                                                                      +iex> String.valid_codepoint?("asdf")
                                                                                                      +false
                                                                                                       
                                                                                                      - Source + + Source + diff --git a/docs/stable/Supervisor.Behaviour.html b/docs/stable/Supervisor.Behaviour.html index 9505007a9..118b17a41 100644 --- a/docs/stable/Supervisor.Behaviour.html +++ b/docs/stable/Supervisor.Behaviour.html @@ -65,7 +65,7 @@

                                                                                                      Example

                                                                                                      -

                                                                                                      Functions summary

                                                                                                      +

                                                                                                      Functions summary

                                                                                                      • @@ -137,7 +137,9 @@

                                                                                                        Strategies

                                                                                                        when dynamically attaching children;

                                                                                                      - Source + + Source +

                                                                                                      supervisor(module, args, options // []) @@ -198,7 +200,9 @@

                                                                                                      Shutdown values

                                                                                                      terminated using exit(child, :kill);

                                                                                                    - Source + + Source +

                                                                                                    worker(module, args, options // []) @@ -259,7 +263,9 @@

                                                                                                    Shutdown values

                                                                                                    terminated using exit(child, :kill);

                                                                                                  - Source + + Source + diff --git a/docs/stable/SyntaxError.html b/docs/stable/SyntaxError.html index f55b48af5..efb4f2c2c 100644 --- a/docs/stable/SyntaxError.html +++ b/docs/stable/SyntaxError.html @@ -59,7 +59,7 @@

                                                                                                  Fields (and defaults)

                                                                                                  -

                                                                                                  Functions summary

                                                                                                  +

                                                                                                  Functions summary

                                                                                                  • @@ -82,7 +82,9 @@

                                                                                                    Functions

                                                                                                    message(exception)

                                                                                                    - Source + + Source + diff --git a/docs/stable/System.html b/docs/stable/System.html index 27a8cd615..ddceecccb 100644 --- a/docs/stable/System.html +++ b/docs/stable/System.html @@ -41,7 +41,7 @@

                                                                                                    -

                                                                                                    Functions summary

                                                                                                    +

                                                                                                    Functions summary

                                                                                                    • @@ -155,7 +155,9 @@

                                                                                                      Functions

                                                                                                      Returns the list of command-line arguments passed to the program.

                                                                                                      - Source + + Source +

                                                                                                      at_exit(fun) @@ -167,14 +169,18 @@

                                                                                                      Functions

                                                                                                      The function must expect the exit status code as argument.

                                                                                                      - Source + + Source +

                                                                                                      build_info()

                                                                                                      Returns a keywords list with version, git tag info and date.

                                                                                                      - Source + + Source +

                                                                                                      cmd(command) @@ -186,7 +192,9 @@

                                                                                                      Functions

                                                                                                      If command is a char list, a char list is returned. Returns a binary otherwise.

                                                                                                      - Source + + Source +

                                                                                                      cwd() @@ -194,14 +202,18 @@

                                                                                                      Functions

                                                                                                      Returns the current working directory or nil if one is not available.

                                                                                                      - Source + + Source +

                                                                                                      cwd!()

                                                                                                      Returns the current working directory or raises System.NoAccessCwdError.

                                                                                                      - Source + + Source +

                                                                                                      find_executable(command) @@ -213,7 +225,9 @@

                                                                                                      Functions

                                                                                                      If command is a char list, a char list is returned. Returns a binary otherwise.

                                                                                                      - Source + + Source +

                                                                                                      get_env() @@ -222,7 +236,9 @@

                                                                                                      Functions

                                                                                                      given as a single string of the format "VarName=Value", where VarName is the name of the variable and Value its value.

                                                                                                      - Source + + Source +

                                                                                                      get_env(varname) @@ -231,7 +247,9 @@

                                                                                                      Functions

                                                                                                      varname as a binary, or nil if the environment variable is undefined.

                                                                                                      - Source + + Source +

                                                                                                      get_pid() @@ -241,7 +259,9 @@

                                                                                                      Functions

                                                                                                      See http://www.erlang.org/doc/man/os.html#getpid-0 for more info.

                                                                                                      - Source + + Source +

                                                                                                      halt(status // 0, options // []) @@ -275,7 +295,9 @@

                                                                                                      Examples

                                                                                                      System.halt(:abort)
                                                                                                      - Source + + Source +

                                                                                                      put_env(dict) @@ -283,14 +305,18 @@

                                                                                                      Examples

                                                                                                      Sets a new value for each environment variable corresponding to each key in dict.

                                                                                                      - Source + + Source +

                                                                                                      put_env(varname, value)

                                                                                                      Sets a new value for the environment variable varname.

                                                                                                      - Source + + Source +

                                                                                                      stacktrace() @@ -301,7 +327,9 @@

                                                                                                      Examples

                                                                                                      return the current stacktrace but rather the stacktrace of the latest exception.

                                                                                                      - Source + + Source +

                                                                                                      tmp_dir() @@ -319,7 +347,9 @@

                                                                                                      Examples

                                                                                                      Returns nil if none of the above are writable.

                                                                                                      - Source + + Source +

                                                                                                      tmp_dir!() @@ -327,7 +357,9 @@

                                                                                                      Examples

                                                                                                      Same as tmp_dir but raises System.NoTmpDirError instead of returning nil if no temp dir is set.

                                                                                                      - Source + + Source +

                                                                                                      user_home() @@ -335,7 +367,9 @@

                                                                                                      Examples

                                                                                                      Returns the user home (platform independent). It returns nil if no user home is set.

                                                                                                      - Source + + Source +

                                                                                                      user_home!() @@ -343,14 +377,18 @@

                                                                                                      Examples

                                                                                                      Same as user_home but raises System.NoHomeError instead of returning nil if no user home is set.

                                                                                                      - Source + + Source +

                                                                                                      version()

                                                                                                      Returns Elixir's version as binary.

                                                                                                      - Source + + Source +
                                                                                                      diff --git a/docs/stable/TokenMissingError.html b/docs/stable/TokenMissingError.html index 1bd8d0775..d5bb2562a 100644 --- a/docs/stable/TokenMissingError.html +++ b/docs/stable/TokenMissingError.html @@ -59,7 +59,7 @@

                                                                                                      Fields (and defaults)

                                                                                                      -

                                                                                                      Functions summary

                                                                                                      +

                                                                                                      Functions summary

                                                                                                      • @@ -82,7 +82,9 @@

                                                                                                        Functions

                                                                                                        message(exception)

                                                                                                        - Source + + Source + diff --git a/docs/stable/URI.FTP.html b/docs/stable/URI.FTP.html index 52ed99a34..0e56ce9cf 100644 --- a/docs/stable/URI.FTP.html +++ b/docs/stable/URI.FTP.html @@ -34,7 +34,7 @@

                                                                                                        -

                                                                                                        Functions summary

                                                                                                        +

                                                                                                        Functions summary

                                                                                                        • @@ -62,13 +62,17 @@

                                                                                                          Functions

                                                                                                          default_port()

                                                                                                          - Source + + Source +

                                                                                                          parse(info)

                                                                                                          - Source + + Source +
                                                                                                          diff --git a/docs/stable/URI.HTTP.html b/docs/stable/URI.HTTP.html index 04d64bdc3..cb2402140 100644 --- a/docs/stable/URI.HTTP.html +++ b/docs/stable/URI.HTTP.html @@ -34,7 +34,7 @@

                                                                                                          -

                                                                                                          Functions summary

                                                                                                          +

                                                                                                          Functions summary

                                                                                                          • @@ -62,13 +62,17 @@

                                                                                                            Functions

                                                                                                            default_port()

                                                                                                            - Source + + Source +

                                                                                                            parse(info)

                                                                                                            - Source + + Source +
                                                                                                            diff --git a/docs/stable/URI.HTTPS.html b/docs/stable/URI.HTTPS.html index 9cc348b3f..4f9f37eb1 100644 --- a/docs/stable/URI.HTTPS.html +++ b/docs/stable/URI.HTTPS.html @@ -34,7 +34,7 @@

                                                                                                            -

                                                                                                            Functions summary

                                                                                                            +

                                                                                                            Functions summary

                                                                                                            • @@ -62,13 +62,17 @@

                                                                                                              Functions

                                                                                                              default_port()

                                                                                                              - Source + + Source +

                                                                                                              parse(info)

                                                                                                              - Source + + Source +
                                                                                                              diff --git a/docs/stable/URI.LDAP.html b/docs/stable/URI.LDAP.html index 1e79fbe19..e2f274e11 100644 --- a/docs/stable/URI.LDAP.html +++ b/docs/stable/URI.LDAP.html @@ -34,7 +34,7 @@

                                                                                                              -

                                                                                                              Functions summary

                                                                                                              +

                                                                                                              Functions summary

                                                                                                              • @@ -62,13 +62,17 @@

                                                                                                                Functions

                                                                                                                default_port()

                                                                                                                - Source + + Source +

                                                                                                                parse(info)

                                                                                                                - Source + + Source +
                                                                                                                diff --git a/docs/stable/URI.Parser.html b/docs/stable/URI.Parser.html index 6d20499fc..10fb4d5e8 100644 --- a/docs/stable/URI.Parser.html +++ b/docs/stable/URI.Parser.html @@ -46,7 +46,7 @@

                                                                                                                -

                                                                                                                Callbacks summary

                                                                                                                +

                                                                                                                Callbacks summary

                                                                                                                • @@ -75,14 +75,18 @@

                                                                                                                  Callbacks

                                                                                                                  Responsible for returning the default port.

                                                                                                                  - Source + + Source +

                                                                                                                  parse(uri_info :: URI.Info.t())

                                                                                                                  Responsible for parsing extra URL information.

                                                                                                                  - Source + + Source +
                                                                                                                  diff --git a/docs/stable/URI.SFTP.html b/docs/stable/URI.SFTP.html index 56ed7c888..fa6cd87c6 100644 --- a/docs/stable/URI.SFTP.html +++ b/docs/stable/URI.SFTP.html @@ -34,7 +34,7 @@

                                                                                                                  -

                                                                                                                  Functions summary

                                                                                                                  +

                                                                                                                  Functions summary

                                                                                                                  • @@ -62,13 +62,17 @@

                                                                                                                    Functions

                                                                                                                    default_port()

                                                                                                                    - Source + + Source +

                                                                                                                    parse(info)

                                                                                                                    - Source + + Source +
                                                                                                                    diff --git a/docs/stable/URI.TFTP.html b/docs/stable/URI.TFTP.html index bc0eabf70..b153ef4cc 100644 --- a/docs/stable/URI.TFTP.html +++ b/docs/stable/URI.TFTP.html @@ -34,7 +34,7 @@

                                                                                                                    -

                                                                                                                    Functions summary

                                                                                                                    +

                                                                                                                    Functions summary

                                                                                                                    • @@ -62,13 +62,17 @@

                                                                                                                      Functions

                                                                                                                      default_port()

                                                                                                                      - Source + + Source +

                                                                                                                      parse(info)

                                                                                                                      - Source + + Source +
                                                                                                                      diff --git a/docs/stable/URI.html b/docs/stable/URI.html index 53d8f633b..44ac768f0 100644 --- a/docs/stable/URI.html +++ b/docs/stable/URI.html @@ -39,7 +39,7 @@

                                                                                                                      -

                                                                                                                      Functions summary

                                                                                                                      +

                                                                                                                      Functions summary

                                                                                                                      • @@ -88,7 +88,9 @@

                                                                                                                        Functions

                                                                                                                        Unpercent (URL) decodes a URI.

                                                                                                                        - Source + + Source +

                                                                                                                        decode_query(q, dict // HashDict.new()) @@ -99,14 +101,18 @@

                                                                                                                        Functions

                                                                                                                        Use decoder/1 if you want to customize or iterate each value manually.

                                                                                                                        - Source + + Source +

                                                                                                                        encode(s)

                                                                                                                        Percent (URL) encodes a URI.

                                                                                                                        - Source + + Source +

                                                                                                                        encode_query(l) @@ -117,7 +123,9 @@

                                                                                                                        Functions

                                                                                                                        that implements the Binary.Chars protocol (i.e. can be converted to binary).

                                                                                                                        - Source + + Source +

                                                                                                                        parse(s) @@ -139,7 +147,9 @@

                                                                                                                        Functions

                                                                                                                        for that particular scheme. Take a look at URI.HTTPS for an example of one of these extension modules.

                                                                                                                        - Source + + Source +

                                                                                                                        query_decoder(q) @@ -147,7 +157,9 @@

                                                                                                                        Functions

                                                                                                                        Returns an iterator function over the query string that decodes the query string in steps.

                                                                                                                        - Source + + Source +
                                                                                                                        diff --git a/docs/stable/UndefinedFunctionError.html b/docs/stable/UndefinedFunctionError.html index c39e2844b..a3d1329cf 100644 --- a/docs/stable/UndefinedFunctionError.html +++ b/docs/stable/UndefinedFunctionError.html @@ -59,7 +59,7 @@

                                                                                                                        Fields (and defaults)

                                                                                                                        -

                                                                                                                        Functions summary

                                                                                                                        +

                                                                                                                        Functions summary

                                                                                                                        +
                                                                                                                      • + + + DocTest + + ExUnit.DocTest +
                                                                                                                      • +
                                                                                                                      • @@ -1202,14 +1227,14 @@

                                                                                                                      • - test_finished/4 + test_finished/2 ExUnit.Formatter
                                                                                                                      • - test_started/3 + test_started/2 ExUnit.Formatter
                                                                                                                      • @@ -1230,7 +1255,7 @@

                                                                                                                      • - suite_finished/1 + suite_finished/2 ExUnit.Formatter
                                                                                                                      • @@ -1273,13 +1298,6 @@

                                                                                                                        ExUnit

                                                                                                                      • -
                                                                                                                      • - - user_options/1 - - ExUnit -
                                                                                                                      • -
                                                                                                                    • @@ -1477,6 +1495,20 @@

                                                                                                                      File

                                                                                                                    • +
                                                                                                                    • + + ls/1 + + File +
                                                                                                                    • + +
                                                                                                                    • + + ls!/1 + + File +
                                                                                                                    • +
                                                                                                                    • mkdir/1 @@ -1652,6 +1684,17 @@

                                                                                                                      File

                                                                                                                    • +
                                                                                                                    +
                                                                                                                  • + + + GenEvent.Behaviour + + GenEvent.Behaviour +
                                                                                                                  • +
                                                                                                                      + +
                                                                                                                  • @@ -1837,6 +1880,13 @@

                                                                                                                    IEx.Helpers

                                                                                                                  • +
                                                                                                                  • + + cd/1 + + IEx.Helpers +
                                                                                                                  • +
                                                                                                                  • flush/0 @@ -1872,6 +1922,13 @@

                                                                                                                    IEx.Helpers

                                                                                                                  • +
                                                                                                                  • + + pwd/0 + + IEx.Helpers +
                                                                                                                  • +
                                                                                                                  • r/0 @@ -2564,14 +2621,14 @@

                                                                                                                  • - alias/2 + alias/0 Kernel.SpecialForms
                                                                                                                  • - alias!/1 + alias/2 Kernel.SpecialForms
                                                                                                                  • @@ -2611,20 +2668,6 @@

                                                                                                                    Kernel.SpecialForms

                                                                                                                  • -
                                                                                                                  • - - unquote/1 - - Kernel.SpecialForms -
                                                                                                                  • - -
                                                                                                                  • - - unquote_splicing/1 - - Kernel.SpecialForms -
                                                                                                                  • -
                                                                                                                  • var!/1 @@ -2940,6 +2983,13 @@

                                                                                                                    Kernel

                                                                                                                  • +
                                                                                                                  • + + __W__/2 + + Kernel +
                                                                                                                  • +
                                                                                                                  • __b__/2 @@ -2961,6 +3011,13 @@

                                                                                                                    Kernel

                                                                                                                  • +
                                                                                                                  • + + __w__/2 + + Kernel +
                                                                                                                  • +
                                                                                                                  • abs/1 @@ -3220,6 +3277,13 @@

                                                                                                                    Kernel

                                                                                                                  • +
                                                                                                                  • + + delete_elem/2 + + Kernel +
                                                                                                                  • +
                                                                                                                  • destructure/2 @@ -3262,6 +3326,13 @@

                                                                                                                    Kernel

                                                                                                                  • +
                                                                                                                  • + + float_to_binary/2 + + Kernel +
                                                                                                                  • +
                                                                                                                  • float_to_list/1 @@ -3276,6 +3347,13 @@

                                                                                                                    Kernel

                                                                                                                  • +
                                                                                                                  • + + function/3 + + Kernel +
                                                                                                                  • +
                                                                                                                  • function_exported?/3 @@ -3304,6 +3382,13 @@

                                                                                                                    Kernel

                                                                                                                  • +
                                                                                                                  • + + insert_elem/3 + + Kernel +
                                                                                                                  • +
                                                                                                                  • inspect/2 @@ -3691,7 +3776,7 @@

                                                                                                                  • - setelem/3 + set_elem/3 Kernel
                                                                                                                  • @@ -4265,13 +4350,6 @@

                                                                                                                    Macro

                                                                                                                  • -
                                                                                                                  • - - do_safe_term/1 - - Macro -
                                                                                                                  • -
                                                                                                                  • escape/1 @@ -6249,7 +6327,7 @@

                                                                                                                  • - defmacros/3 + defmacros/4 Record
                                                                                                                  • @@ -6282,6 +6360,13 @@

                                                                                                                    Record

                                                                                                                  • +
                                                                                                                  • + + import/2 + + Record +
                                                                                                                  • +
                                                                                                                • @@ -6521,6 +6606,13 @@

                                                                                                                  String

                                                                                                                • +
                                                                                                                • + + split/1 + + String +
                                                                                                                • +
                                                                                                                • split/3 diff --git a/docs/stable/protocols_list.html b/docs/stable/protocols_list.html index fb603231f..305562548 100644 --- a/docs/stable/protocols_list.html +++ b/docs/stable/protocols_list.html @@ -16,7 +16,7 @@

                                                                                                                  - Elixir v0.8.1 + Elixir v0.8.2

                                                                                                                  From 574667fb41892d96eb63296c6a1ef077283d2241 Mon Sep 17 00:00:00 2001 From: dalton Date: Tue, 30 Apr 2013 14:55:24 -0300 Subject: [PATCH 393/437] setelem is deprecated, please use set_elem instead --- getting_started/2.markdown | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/getting_started/2.markdown b/getting_started/2.markdown index ed7c8aa3a..6806a97b9 100644 --- a/getting_started/2.markdown +++ b/getting_started/2.markdown @@ -25,12 +25,12 @@ This means that accessing a tuple element is very fast (constant time) and can b iex> elem { :a, :b, :c }, 0 :a -On the other hand, updating a tuple is expensive as it needs to duplicate the tuple contents in memory. Updating a tuple can be done with the `setelem` function: +On the other hand, updating a tuple is expensive as it needs to duplicate the tuple contents in memory. Updating a tuple can be done with the `set_elem` function: - iex> setelem { :a, :b, :c }, 0, :d + iex> set_elem { :a, :b, :c }, 0, :d {:d,:b,:c} -> Note: If you are an Erlang developer, you will notice that we used the `elem` and `setelem` functions instead of Erlang's `element` and `setelement`. The reason for this choice is that Elixir attempts to normalize Erlang API's to always receive the `subject` of the function as the first argument and employ zero-based access. +> Note: If you are an Erlang developer, you will notice that we used the `elem` and `set_elem` functions instead of Erlang's `element` and `setelement`. The reason for this choice is that Elixir attempts to normalize Erlang API's to always receive the `subject` of the function as the first argument and employ zero-based access. Since updating a tuple is expensive, when we want to add or remove elements, we use lists. Since lists are linked, it means accessing the first element of the list is very cheap. Accessing the n-th element, however, will require the algorithm to pass through n-1 nodes before reaching the n-th. We can access the `head` of the list as follows: @@ -627,6 +627,6 @@ Custom exceptions can be defined using the `defexception` macro. You can check a ## 2.10 Built-in functions -Elixir ships with many built-in functions automatically available in the current scope. In addition to the control flow expressions seen above, Elixir also adds: `elem` and `setelem` to read and set values in tuples, `inspect` that returns the representation of a given data type as a binary, and many others. All of these functions imported by default are available in [`Kernel`](/docs/stable/Kernel.html) and [Elixir special forms are available in `Kernel.SpecialForms`](/docs/stable/Kernel.SpecialForms.html). +Elixir ships with many built-in functions automatically available in the current scope. In addition to the control flow expressions seen above, Elixir also adds: `elem` and `set_'elem` to read and set values in tuples, `inspect` that returns the representation of a given data type as a binary, and many others. All of these functions imported by default are available in [`Kernel`](/docs/stable/Kernel.html) and [Elixir special forms are available in `Kernel.SpecialForms`](/docs/stable/Kernel.SpecialForms.html). All of these functions and control flow expressions are essential for building Elixir programs. The next chapter will discuss how to organize our code into modules, so it can be easily reused between different applications. From 1f076db2d3674083e9b3da177eaeb106b81f0d38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Thu, 2 May 2013 10:05:36 -0700 Subject: [PATCH 394/437] Many grammar fixes and Xen improvements --- _posts/2013-05-02-elixir-on-xen.markdown | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/_posts/2013-05-02-elixir-on-xen.markdown b/_posts/2013-05-02-elixir-on-xen.markdown index 53bb5d53f..e41123b9f 100644 --- a/_posts/2013-05-02-elixir-on-xen.markdown +++ b/_posts/2013-05-02-elixir-on-xen.markdown @@ -3,20 +3,24 @@ layout: post title: Elixir on Xen author: José Valim category: Announcements -excerpt: The Erlang on Xen team has added support to Elixir and we will tell you how you can use it! +excerpt: The Erlang on Xen team has added support for Elixir and we will tell you how you can use it! --- -Elixir uses Erlang underneath, all the way down. Thus an Elixir project can run not only on a standard Erlang VM, but on its “OS-less” counterpart called LING VM. LING VM is the core technology of [Erlang on Xen](http://erlangonxen.org). +Elixir uses Erlang underneath, all the way down. Thanks to this, an Elixir project can run on the recently revealed “OS-less” Erlang VM called LING VM. LING VM is the core technology of [Erlang on Xen](http://erlangonxen.org). ## Why Xen? -Elixir on Xen runs directly on top of Xen Hypervisor, this means there is no traditional OS underneath it, taking away numerous administrative, scalability, and performance issues. The LING Virtual Machine runs on its own sand-box being a great fit for highly-secure applications and its fast boot time makes it truly elastic. You can learn more about it on the [Erlang on Xen website](http://erlangonxen.org). +[Xen](https://en.wikipedia.org/wiki/Xen) is an open-source baremetal hypervisor that allows many operating systems to run on the same hardware. Xen is frequently used for server virtualization, Infrastructure as a Service (IaaS) and security applications. + +Elixir on Xen runs on top of the Xen Hypervisor (via the LING VM) but with no traditional OS underneath it, taking away numerous administrative, scalability, and performance issues. This limits options of a malicious attacker, making it an excellent choice for high-security applications, and reduces startup latency, allowing developers to spawn new VMs in less than 100 miliseconds. + +You can learn more about Xen and the LING VM on the [Erlang on Xen website](http://erlangonxen.org). ## Getting started In order to run Elixir on the LING VM, you need to produce a Xen image of your Elixir project. This can be done with the help of the [lingex project](http://github.com/maximk/lingex), created by the LING VM team. -To produce the Elixir image using the free Erlang on Xen Build Service requires just a few steps: +Producing an Elixir image using the free Erlang on Xen Build Service requires just a few steps: 1. Add a dependency on `lingex` to your `mix.exs` file: @@ -44,7 +48,7 @@ to the mix tool (`lingex.build`, `lingex.image`, and `lingex.build_image`) 5. Run `mix lingex.build_image`. This will archive all `*.beam` files of your project and submit them to the build service. -6. The build process will complete in about 30s. An image file called 'vmling' will appear in the current directory. The file contains LING VM, your project code and is ready to boot as a Xen guest. +6. The build process will complete in about 30s. An image file called 'vmling' will appear in the current directory, ready to boot as a Xen guest. The image file will contain LING VM and your project code. And this is all. Erlang on Xen is going to boot the Erlang VM and the standard Erlang shell. You can access Elixir shell in a couple steps: @@ -64,10 +68,10 @@ And this is all. Erlang on Xen is going to boot the Erlang VM and the standard E --> s 'Elixir-IEx' --> c -This will bring you to Interactive Elixir and you can execute Elixir expressions regularly! +This will bring you to Interactive Elixir and you can execute Elixir expressions as usual! ## Summing up -Running Elixir on Xen opens up many possibilities to Elixir developers. We are very thankful for the work done by [Erlang on Xen team](http://erlangonxen.org), who added support to Elixir and the `lingex` build tool. +Running Elixir on Xen opens up many possibilities to Elixir developers. We are very thankful for the work done by [Erlang on Xen team](http://erlangonxen.org), who added support for Elixir and the `lingex` build tool. -Erlang on Xen (and consequently Elixir on Xen) is still in active development, so don't forget to read more about it, use cases and limitations on [Erlang on Xen website](http://erlangonxen.org/). +Erlang on Xen (and consequently Elixir on Xen) is still in active development, so don't forget to read more about its concepts, use cases and limitations on [Erlang on Xen website](http://erlangonxen.org/). From 22a3d8b6c90c61baffde56ef7a1f6d36a2d700c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Thu, 2 May 2013 10:09:03 -0700 Subject: [PATCH 395/437] Fix code style --- _posts/2013-05-02-elixir-on-xen.markdown | 40 ++++++++++++------------ 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/_posts/2013-05-02-elixir-on-xen.markdown b/_posts/2013-05-02-elixir-on-xen.markdown index e41123b9f..e22371e40 100644 --- a/_posts/2013-05-02-elixir-on-xen.markdown +++ b/_posts/2013-05-02-elixir-on-xen.markdown @@ -24,25 +24,25 @@ Producing an Elixir image using the free Erlang on Xen Build Service requires ju 1. Add a dependency on `lingex` to your `mix.exs` file: - {% highlight elixir %} - def deps do - [ { :lingex, github: "maximk/lingex" } ] - end - {% endhighlight %} + {% highlight elixir %} + def deps do + [ { :lingex, github: "maximk/lingex" } ] + end + {% endhighlight %} 2. Run `mix deps.get` to update your dependencies. This adds a few custom tasks to the mix tool (`lingex.build`, `lingex.image`, and `lingex.build_image`) 3. Set `lingex` options. Add the following lines to your `mix.exs` file: - {% highlight elixir %} - def project do - [ lingex_opts: [ - build_host: "build.erlangonxen.org:8080", - username: "test", - password: "test" ] ] - end - {% endhighlight %} + {% highlight elixir %} + def project do + [ lingex_opts: [ + build_host: "build.erlangonxen.org:8080", + username: "test", + password: "test" ] ] + end + {% endhighlight %} 4. Optionally, you may register with the build service [here](http://build.erlangonxen.org/register) and update the credentials accordingly. For the complete list of recognized options see the build service documentation. @@ -54,19 +54,19 @@ And this is all. Erlang on Xen is going to boot the Erlang VM and the standard E 1. In the Erlang shell, first start IEx: - {% highlight elixir %} - 1> application:start(iex). - ok - {% endhighlight %} + {% highlight elixir %} + 1> application:start(iex). + ok + {% endhighlight %} 2. Then hit `Ctrl+G`. This will open up the user switch command interface from the Erlang shell. 3. In the user switch interface, type: - User switch command - --> s 'Elixir-IEx' - --> c + User switch command + --> s 'Elixir-IEx' + --> c This will bring you to Interactive Elixir and you can execute Elixir expressions as usual! From 56579b3a8c01e5dbdc2a1fb4eb371d7a1dc30de9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Thu, 2 May 2013 10:10:38 -0700 Subject: [PATCH 396/437] Retry formatting --- _posts/2013-05-02-elixir-on-xen.markdown | 40 ++++++++++++------------ 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/_posts/2013-05-02-elixir-on-xen.markdown b/_posts/2013-05-02-elixir-on-xen.markdown index e22371e40..b0b9961cd 100644 --- a/_posts/2013-05-02-elixir-on-xen.markdown +++ b/_posts/2013-05-02-elixir-on-xen.markdown @@ -24,25 +24,25 @@ Producing an Elixir image using the free Erlang on Xen Build Service requires ju 1. Add a dependency on `lingex` to your `mix.exs` file: - {% highlight elixir %} - def deps do - [ { :lingex, github: "maximk/lingex" } ] - end - {% endhighlight %} + {% highlight elixir %} + def deps do + [ { :lingex, github: "maximk/lingex" } ] + end + {% endhighlight %} 2. Run `mix deps.get` to update your dependencies. This adds a few custom tasks to the mix tool (`lingex.build`, `lingex.image`, and `lingex.build_image`) 3. Set `lingex` options. Add the following lines to your `mix.exs` file: - {% highlight elixir %} - def project do - [ lingex_opts: [ - build_host: "build.erlangonxen.org:8080", - username: "test", - password: "test" ] ] - end - {% endhighlight %} + {% highlight elixir %} + def project do + [ lingex_opts: [ + build_host: "build.erlangonxen.org:8080", + username: "test", + password: "test" ] ] + end + {% endhighlight %} 4. Optionally, you may register with the build service [here](http://build.erlangonxen.org/register) and update the credentials accordingly. For the complete list of recognized options see the build service documentation. @@ -54,19 +54,19 @@ And this is all. Erlang on Xen is going to boot the Erlang VM and the standard E 1. In the Erlang shell, first start IEx: - {% highlight elixir %} - 1> application:start(iex). - ok - {% endhighlight %} + {% highlight elixir %} + 1> application:start(iex). + ok + {% endhighlight %} 2. Then hit `Ctrl+G`. This will open up the user switch command interface from the Erlang shell. 3. In the user switch interface, type: - User switch command - --> s 'Elixir-IEx' - --> c + User switch command + --> s 'Elixir-IEx' + --> c This will bring you to Interactive Elixir and you can execute Elixir expressions as usual! From ce3f7185c70b28041f5575e4351b71bbd6f5d7e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Thu, 2 May 2013 10:12:17 -0700 Subject: [PATCH 397/437] Last try with formatting --- _posts/2013-05-02-elixir-on-xen.markdown | 40 ++++++++++++------------ 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/_posts/2013-05-02-elixir-on-xen.markdown b/_posts/2013-05-02-elixir-on-xen.markdown index b0b9961cd..d08ef8b8d 100644 --- a/_posts/2013-05-02-elixir-on-xen.markdown +++ b/_posts/2013-05-02-elixir-on-xen.markdown @@ -24,25 +24,25 @@ Producing an Elixir image using the free Erlang on Xen Build Service requires ju 1. Add a dependency on `lingex` to your `mix.exs` file: - {% highlight elixir %} - def deps do - [ { :lingex, github: "maximk/lingex" } ] - end - {% endhighlight %} + {% highlight elixir %} + def deps do + [ { :lingex, github: "maximk/lingex" } ] + end + {% endhighlight %} 2. Run `mix deps.get` to update your dependencies. This adds a few custom tasks to the mix tool (`lingex.build`, `lingex.image`, and `lingex.build_image`) 3. Set `lingex` options. Add the following lines to your `mix.exs` file: - {% highlight elixir %} - def project do - [ lingex_opts: [ - build_host: "build.erlangonxen.org:8080", - username: "test", - password: "test" ] ] - end - {% endhighlight %} + {% highlight elixir %} + def project do + [ lingex_opts: [ + build_host: "build.erlangonxen.org:8080", + username: "test", + password: "test" ] ] + end + {% endhighlight %} 4. Optionally, you may register with the build service [here](http://build.erlangonxen.org/register) and update the credentials accordingly. For the complete list of recognized options see the build service documentation. @@ -54,19 +54,19 @@ And this is all. Erlang on Xen is going to boot the Erlang VM and the standard E 1. In the Erlang shell, first start IEx: - {% highlight elixir %} - 1> application:start(iex). - ok - {% endhighlight %} + {% highlight elixir %} + 1> application:start(iex). + ok + {% endhighlight %} 2. Then hit `Ctrl+G`. This will open up the user switch command interface from the Erlang shell. 3. In the user switch interface, type: - User switch command - --> s 'Elixir-IEx' - --> c + User switch command + --> s 'Elixir-IEx' + --> c This will bring you to Interactive Elixir and you can execute Elixir expressions as usual! From f67fcd225a989cf67c4d5d118c17ce66b7adf171 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Thu, 2 May 2013 10:13:11 -0700 Subject: [PATCH 398/437] Remove highlights --- _posts/2013-05-02-elixir-on-xen.markdown | 7 ------- 1 file changed, 7 deletions(-) diff --git a/_posts/2013-05-02-elixir-on-xen.markdown b/_posts/2013-05-02-elixir-on-xen.markdown index d08ef8b8d..0fd6d85f1 100644 --- a/_posts/2013-05-02-elixir-on-xen.markdown +++ b/_posts/2013-05-02-elixir-on-xen.markdown @@ -24,25 +24,21 @@ Producing an Elixir image using the free Erlang on Xen Build Service requires ju 1. Add a dependency on `lingex` to your `mix.exs` file: - {% highlight elixir %} def deps do [ { :lingex, github: "maximk/lingex" } ] end - {% endhighlight %} 2. Run `mix deps.get` to update your dependencies. This adds a few custom tasks to the mix tool (`lingex.build`, `lingex.image`, and `lingex.build_image`) 3. Set `lingex` options. Add the following lines to your `mix.exs` file: - {% highlight elixir %} def project do [ lingex_opts: [ build_host: "build.erlangonxen.org:8080", username: "test", password: "test" ] ] end - {% endhighlight %} 4. Optionally, you may register with the build service [here](http://build.erlangonxen.org/register) and update the credentials accordingly. For the complete list of recognized options see the build service documentation. @@ -54,11 +50,8 @@ And this is all. Erlang on Xen is going to boot the Erlang VM and the standard E 1. In the Erlang shell, first start IEx: - {% highlight elixir %} 1> application:start(iex). ok - {% endhighlight %} - 2. Then hit `Ctrl+G`. This will open up the user switch command interface from the Erlang shell. From b8c8bcc67ea6ff9e356e4ca6b5c891e502b4650a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Thu, 2 May 2013 10:15:43 -0700 Subject: [PATCH 399/437] Update news --- _includes/search.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_includes/search.html b/_includes/search.html index f6cdbb241..4138b80dd 100644 --- a/_includes/search.html +++ b/_includes/search.html @@ -1,6 +1,6 @@ From a67f61327187b9515c2266cc688a0274823432e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Fri, 3 May 2013 20:33:47 -0600 Subject: [PATCH 400/437] Update 2.markdown --- getting_started/2.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/getting_started/2.markdown b/getting_started/2.markdown index 6806a97b9..31739b37b 100644 --- a/getting_started/2.markdown +++ b/getting_started/2.markdown @@ -474,7 +474,7 @@ In Elixir, creating a function is similar to the `case` mechanism we have just s f.(1, 3) #=> 4 f.(-1, 3) #=> -3 -A function with one clause can be defined with a (preferred) shortcut syntax as follows: +However, in Elixir code, it is more common to use a shortcut synyax to define functions: f = fn x, y -> x + y end @@ -482,7 +482,7 @@ A function with one clause can be defined with a (preferred) shortcut syntax as x + y end -This is the syntax that's going to be used throughout this guide. Such is frequently used to iterate lists with the help of the [`Enum` module](/docs/stable/Enum.html) discuss previously: +Such is frequently used to iterate lists with the help of the [`Enum` module](/docs/stable/Enum.html) discuss previously: iex> Enum.map [1,2,3], fn(x) -> x * 2 end [2,4,6] From 9757484f0cc7ce78758489141192104fcd0b1516 Mon Sep 17 00:00:00 2001 From: Alexei Sholik Date: Sat, 4 May 2013 12:04:04 +0300 Subject: [PATCH 401/437] Clean up 2.8.4 Functions (grammar and wording) --- getting_started/2.markdown | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/getting_started/2.markdown b/getting_started/2.markdown index 31739b37b..3d9aff18e 100644 --- a/getting_started/2.markdown +++ b/getting_started/2.markdown @@ -464,7 +464,7 @@ In such cases, if there is an error in one of the guards, it won't affect the ne ### 2.8.4 Functions -In Elixir, creating a function is similar to the `case` mechanism we have just seen. It allows us to define a function with many clauses: +In Elixir, creating an anonymous function is similar to the `case` mechanism we have just seen. It allows us to define a function with many clauses: f = function do x, y when x > 0 -> x + y @@ -474,7 +474,7 @@ In Elixir, creating a function is similar to the `case` mechanism we have just s f.(1, 3) #=> 4 f.(-1, 3) #=> -3 -However, in Elixir code, it is more common to use a shortcut synyax to define functions: +However, in Elixir code, it is more common to use a shortcut syntax to define anonymous functions: f = fn x, y -> x + y end @@ -482,7 +482,7 @@ However, in Elixir code, it is more common to use a shortcut synyax to define fu x + y end -Such is frequently used to iterate lists with the help of the [`Enum` module](/docs/stable/Enum.html) discuss previously: +This shortcut form is frequently used with functions from the [`Enum` module](/docs/stable/Enum.html) discussed earlier: iex> Enum.map [1,2,3], fn(x) -> x * 2 end [2,4,6] From da5a6f0a16dc1b0e5cf62e29a739b832ce2ade20 Mon Sep 17 00:00:00 2001 From: dalton Date: Sat, 4 May 2013 21:39:18 -0300 Subject: [PATCH 402/437] typoes --- getting_started/2.markdown | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/getting_started/2.markdown b/getting_started/2.markdown index 3d9aff18e..83e915ca8 100644 --- a/getting_started/2.markdown +++ b/getting_started/2.markdown @@ -201,7 +201,7 @@ In general, you will find working with binaries and strings in Elixir a breeze. ## 2.5 Calling Erlang functions -One of Elixir assets is easy integration with the existing Erlang ecosystem. Erlang ships with a group of libraries called OTP (Open Telecom Platform). Besides being a standard library, OTP provides several facilities to build OTP applications with supervisors that are robust, distributed and fault-tolerant. +One of Elixir's assets is easy integration with the existing Erlang ecosystem. Erlang ships with a group of libraries called OTP (Open Telecom Platform). Besides being a standard library, OTP provides several facilities to build OTP applications with supervisors that are robust, distributed and fault-tolerant. Since an Erlang module is nothing more than an atom, invoking those libraries from Elixir is quite straight-forward. For example, we can call the [function `flatten` from the module `lists`](http://www.erlang.org/doc/man/lists.html#flatten-1) or interact with [the math module](http://www.erlang.org/doc/man/math.html) as follows: @@ -604,7 +604,7 @@ Elixir provides the concept of exceptions. An exception can be raised using the x.message end -In general, idiomatic Elixir avoids using exceptions for control flow. For example, if you write a software that does log partitioning and log rotation over the network, you may face network issues or an eventual instability when accessing the file system. These scenarios are not exceptional in this particular software and must be handled accordingly. Therefore, a developer can read some file using `File.read`: +In general, idiomatic Elixir avoids using exceptions for control flow. For example, if you write software that does log partitioning and log rotation over the network, you may face network issues or an eventual instability when accessing the file system. These scenarios are not exceptional in this particular software and must be handled accordingly. Therefore, a developer can read some file using `File.read`: case File.read(file) do { :ok, contents } -> @@ -627,6 +627,6 @@ Custom exceptions can be defined using the `defexception` macro. You can check a ## 2.10 Built-in functions -Elixir ships with many built-in functions automatically available in the current scope. In addition to the control flow expressions seen above, Elixir also adds: `elem` and `set_'elem` to read and set values in tuples, `inspect` that returns the representation of a given data type as a binary, and many others. All of these functions imported by default are available in [`Kernel`](/docs/stable/Kernel.html) and [Elixir special forms are available in `Kernel.SpecialForms`](/docs/stable/Kernel.SpecialForms.html). +Elixir ships with many built-in functions automatically available in the current scope. In addition to the control flow expressions seen above, Elixir also adds: `elem` and `set_elem` to read and set values in tuples, `inspect` that returns the representation of a given data type as a binary, and many others. All of these functions imported by default are available in [`Kernel`](/docs/stable/Kernel.html) and [Elixir special forms are available in `Kernel.SpecialForms`](/docs/stable/Kernel.SpecialForms.html). All of these functions and control flow expressions are essential for building Elixir programs. The next chapter will discuss how to organize our code into modules, so it can be easily reused between different applications. From a79eb9f6bc134014bf9510759a019001e9d297f2 Mon Sep 17 00:00:00 2001 From: Alexei Sholik Date: Sun, 12 May 2013 23:30:23 +0300 Subject: [PATCH 403/437] Fix link highlight in top nav bar for docs page --- css/style.css | 1 + docs/index.html | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/css/style.css b/css/style.css index b8bdd30fc..79d5fa591 100644 --- a/css/style.css +++ b/css/style.css @@ -471,6 +471,7 @@ a:hover img, #slider-nav li a:hover img { opacity: 0.85; } body.home div.menu li.home a, body.getting_started div.menu li.getting_started a, body.blog div.menu li.blog a, +body.docs div.menu li.docs a, body.source div.menu li.source a { color: #aaa; } diff --git a/docs/index.html b/docs/index.html index d4a54c92b..4c6afd2e5 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,5 +1,5 @@ --- -section: home +section: docs layout: default --- From aa7bbb63bff13701e9970ab532a29479cbd3a446 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sat, 18 May 2013 00:10:20 +0200 Subject: [PATCH 404/437] Clean up control flow section and move exceptions to the end of the records chapter --- getting_started/1.markdown | 56 +++--- getting_started/2.markdown | 396 +++++++++++++++++-------------------- getting_started/3.markdown | 12 +- getting_started/4.markdown | 69 ++++++- getting_started/6.markdown | 18 +- 5 files changed, 289 insertions(+), 262 deletions(-) diff --git a/getting_started/1.markdown b/getting_started/1.markdown index 38bfabb70..6fe1fc131 100644 --- a/getting_started/1.markdown +++ b/getting_started/1.markdown @@ -88,6 +88,15 @@ Some basic types are: iex> :atom # atom / symbol iex> {1,2,3} # tuple iex> [1,2,3] # list + iex> <<1,2,3>> # binary + +Elixir by default provides many functions to work on those types: + + iex> size { 1, 2, 3 } + 3 + + iex> length [ 1, 2, 3 ] + 3 Elixir also provides functions (note the dot between the variable and arguments when calling a function): @@ -97,42 +106,28 @@ Elixir also provides functions (note the dot between the variable and arguments iex> x.(1, 2) 3 -And strings: - - iex> "string" - "string" - -Strings in Elixir are UTF-8 binaries delimited by double quotes. A single-quoted string in Elixir is called a char list and is simply a list of characters: +Elixir also supports strings and they are all encoded in UTF-8: - iex> 'a char list' - 'a char list' + iex> "hellö" + "hellö" -There is also string interpolation: +Strings support interpolation too: - iex> name = "world" - iex> "hello #{name}" - "hello world" + iex> name = "world" + iex> "hello #{name}" + "hello world" -We can use the `is_binary` and `is_list` helpers to detect if a given argument is a binary (double-quoted) or a list (single-quoted): +At the end of the day, strings are nothing more than binaries. We can check it using the `is_binary` function: - iex> is_binary "string" - true - iex> is_list "string" - false - - iex> is_binary 'char list' - false - iex> is_list 'char list' + iex> is_binary("hello") true -Although they represent the same thing, double-quoted and single-quoted strings are different and best suited for different scenarios: +Note a single-quoted expression in Elixir is a char list and it is not the same as a double-quoted one: - iex> "string" == 'string' + iex> is_binary('hello') false -In most cases, developers should use double-quoted strings as their representation is more compact. We'll discuss this subject with more detail in the next chapter. - -Elixir also provides `true` and `false` as booleans: +We will go into more details about char lists in the next chapter. Finally, Elixir also provides `true` and `false` as booleans: iex> true true @@ -157,14 +152,7 @@ Elixir also provides `++` and `--` to manipulate lists: iex> [1,2,3] -- [2] [1,3] -Since single-quoted strings are lists, we can also use `++` and `--` as operators to manipulate them: - - iex> 'some' ++ ' example' - 'some example' - iex> 'some' -- 'oe' - 'sm' - -Notice that `++` and `--` cannot be used to manipulate double quoted strings, as they are binaries. That said, string concatenation is done via `<>`: +String concatenation is done via `<>`: iex> "foo" <> "bar" "foobar" diff --git a/getting_started/2.markdown b/getting_started/2.markdown index 83e915ca8..966dcd5db 100644 --- a/getting_started/2.markdown +++ b/getting_started/2.markdown @@ -7,7 +7,7 @@ total_guides: 7 # {{ page.title }} -In this chapter we'll go a bit deeper into the basic data-types, learn some control flow mechanisms and how to create and invoke anonymous functions. +In this chapter we'll go a bit deeper into the basic data-types, learn some control flow mechanisms and talk about anonymous functions. ## 2.1 Lists and tuples @@ -34,20 +34,52 @@ On the other hand, updating a tuple is expensive as it needs to duplicate the tu Since updating a tuple is expensive, when we want to add or remove elements, we use lists. Since lists are linked, it means accessing the first element of the list is very cheap. Accessing the n-th element, however, will require the algorithm to pass through n-1 nodes before reaching the n-th. We can access the `head` of the list as follows: + # Match the head and tail of the list iex> [head | tail] = [1,2,3] [1,2,3] iex> head 1 iex> tail [2,3] + + # Put the head and the tail back together iex> [head | tail] [1,2,3] iex> length [head | tail] 3 -In the example above, we have assigned the head of the list to the variable `head` and the tail of the list to the variable `tail`. The [`Enum` module](/docs/stable/Enum.html) provides several helpers to manipulate lists (and other enumerables in general) while the [`List` module](/docs/stable/List.html) provides several helpers specific to lists: +In the example above, we have matched the head of the list to the variable `head` and the tail of the list to the variable `tail`. This is called **pattern matching**. We can also pattern match tuples: + + iex> { a, b, c } = { :hello, "world", 42 } + { :hello, "world", 42 } + iex> a + :hello + iex> b + "world" + +A pattern match will error in case the sides can't match. This is, for example, the case when the tuples have different sizes: + + iex> { a, b, c } = { :hello, "world" } + ** (MatchError) no match of right hand side value: {:hello,"world"} + +And also when comparing different types: + + iex> { a, b, c } = [:hello, "world"] + ** (MatchError) no match of right hand side value: [:hello,"world"] + +More interesting, we can match on specific values. The exemplo below asserts that the left side will only match the right side in case the right side is a tuple containing the atom `:ok` as a key: - iex> Enum.at! [1,2,3], 0 + iex> { :ok, result } = { :ok, 13 } + {:ok,13} + iex> result + 13 + + iex> { :ok, result } = { :error, :oops } + ** (MatchError) no match of right hand side value: {:error,:oops} + +Pattern match allows developers to easily detructure data types like tuples, lists and more. As we will see in following chapters, it is one of the fundations for recursion in Elixir. However, in case you can't wait to iterate and manipulate your lists, the [`Enum` module](/docs/stable/Enum.html) provides several helpers to manipulate lists (and other enumerables in general) while the [`List` module](/docs/stable/List.html) provides several helpers specific to lists: + + iex> Enum.at [1,2,3], 0 1 iex> List.flatten [1,[2],3] [1,2,3] @@ -59,7 +91,7 @@ Elixir also provides a special syntax to create a list of keywords. They can be iex> [a: 1, b: 2] [a: 1, b: 2] -Keyword lists are nothing more than a list of two element tuples, where the first element of the tuple is an atom, and hold their definition order: +Keyword lists are nothing more than a list of two element tuples where the first element of the tuple is an atom: iex> [head | tail] = [a: 1, b: 2] [a: 1, b: 2] @@ -83,25 +115,25 @@ Since keyword lists are very frequently passed as arguments, they do not require iex> if 2 + 2 == 4, do: "OK" "OK" -## 2.3 Char lists and binaries +## 2.3 Strings and char lists -In the previous chapter we have discussed double- and single- representations: +In Elixir, a double-quoted string is not the same as a single-quoted one: - iex> "sample" == 'sample' + iex> "hello" == 'hello' false - iex> is_binary "string" + iex> is_binary "hello" true - iex> is_list 'char list' + iex> is_list 'hello' true -In fact, both double-quoted and single-quoted representations are just a shorter representation of binaries and lists respectively. Given that `?a` in Elixir returns the ASCII integer for the letter `a`, we could also write: +As shown above, double-quoted returns a binary while single-quoted returns a list. In fact, both double-quoted and single-quoted representations are just a shorter representation of binaries and lists respectively. Given that `?a` in Elixir returns the ASCII integer for the letter `a`, we could also write: iex> <> "abc" iex> [?a, ?b, ?c] 'abc' -In such cases, Elixir detects that all characters in the list and in the binary are printable and returns the quoted representation. However, adding a non-printable character forces them to be printed differently: +In such cases, Elixir detects that all characters in the binary and in the list are printable and returns the quoted representation. However, adding a non-printable character forces them to be printed differently: iex> <> <<97,98,99,1>> @@ -109,7 +141,7 @@ In such cases, Elixir detects that all characters in the list and in the binary iex> [?a, ?b, ?c, 1] [97,98,99,1] -Since lists are implemented as linked lists, it means a char list usually takes a lot of space in memory (in ASCII, it would be one byte for each character and another byte to point to the next character). For this reason, binaries (double-quoted) are preferred unless you want to explicitly iterate over a char list. +Since lists are implemented as linked lists, it means a char list usually takes a lot of space in memory (one word for each character and another word to point to the next character). For this reason, double-quoted is preferred unless you want to explicitly iterate over a char list (which is sometimes common when interfacing with Erlang code from Elixir). Although a bit more verbose, it is also possible to do head/tail style pattern matching with binaries. A binary is made up of a number of parts which must be tagged with their type. Most of the time, Elixir will figure out the part's type and won't require any work from you: @@ -150,7 +182,7 @@ This is equivalent to the head and tail pattern matching we saw in lists. There ## 2.4 UTF-8 Strings -In the previous section we've learnt about binaries. A string in Elixir is a binary which is encoded in UTF-8. For example, the string "é" is a UTF-8 binary containing two bytes: +A String in Elixir is a binary which is encoded in UTF-8. For example, the string "é" is a UTF-8 binary containing two bytes: iex> string = "é" "é" @@ -186,7 +218,7 @@ The Unicode standard assigns an integer value to each character. Elixir allows a iex> "h\xE9ll\xF2" "héllò" -UTF-8 also plays nicely with pattern matching. You can match against a UTF-8 codepoint, retriving its integer value as follow: +UTF-8 also plays nicely with pattern matching. In the exemple below, we are extracting the first UTF-8 codepoint of a String and assigning the rest of the string to the variable `rest`: iex> << eacute :: utf8, rest :: binary >> = "épa" "épa" @@ -199,92 +231,7 @@ UTF-8 also plays nicely with pattern matching. You can match against a UTF-8 cod In general, you will find working with binaries and strings in Elixir a breeze. Whenever you want to work with raw binaries, one can use [Erlang's binary module](http://www.erlang.org/doc/man/binary.html), and use [Elixir's String module](http://elixir-lang.org/docs/stable/String.html) when you want to work on strings, which are simply UTF-8 encoded binaries. Finally, there are a bunch of conversion functions, that allows you to convert a binary to integer, atom and vice-versa [in the Kernel module](http://elixir-lang.org/docs/stable/Kernel.html). -## 2.5 Calling Erlang functions - -One of Elixir's assets is easy integration with the existing Erlang ecosystem. Erlang ships with a group of libraries called OTP (Open Telecom Platform). Besides being a standard library, OTP provides several facilities to build OTP applications with supervisors that are robust, distributed and fault-tolerant. - -Since an Erlang module is nothing more than an atom, invoking those libraries from Elixir is quite straight-forward. For example, we can call the [function `flatten` from the module `lists`](http://www.erlang.org/doc/man/lists.html#flatten-1) or interact with [the math module](http://www.erlang.org/doc/man/math.html) as follows: - - iex> :lists.flatten [1,[2],3] - [1,2,3] - iex> :math.sin :math.pi - 1.2246467991473532e-16 - -Erlang's OTP is very well documented and we will learn more about building OTP applications in the Mix chapters: - -* [OTP docs](http://www.erlang.org/doc/) -* [Standard library docs](http://www.erlang.org/doc/man/STDLIB_app.html) - -## 2.6 Pattern matching - -When discussing lists earlier we saw the following example: - - iex> [h | t] = [1,2,3] - [1, 2, 3] - iex> h - 1 - iex> t - [2, 3] - -In Elixir, `=` is not an assignment operator as in programming languages like Java, Ruby, Python, etc. `=` is actually a match operator which will check if the expressions on both left and right side match. Consider this example: - - iex> { 1, 2, 3 } = { 1, 2, 3 } - { 1, 2, 3 } - iex> { 1, 2, 3 } = { 1, 4, 3 } - ** (MatchError) no match of right hand side value: {1,4,3} - -If the tuples given on the left and right side do not match, an error is raised. If any of the tuples contain a variable, this variable will always be assigned: - - iex> { 1, x, 3 } = { 1, 2, 3 } - { 1, 2, 3 } - iex> x - 2 - iex> { 1, x, 3 } = { 1, 4, 3 } - { 1, 4, 3 } - iex> x - 4 - -This is exactly what happened in the list example: - - iex> [h | t] = [1,2,3] - [1, 2, 3] - -We have assigned the head of the list to `h` and the tail to `t`. In fact, if we want to check if the head of the list is `1` and assign the tail, we could do: - - iex> [1 | t] = [1,2,3] - [1, 2, 3] - iex> [0 | t] = [1,2,3] - ** (MatchError) no match of right hand side value: [1,2,3] - -If you want to pattern match against the value of a variable, you can use the `^` operator: - - iex> x = 1 - 1 - iex> ^x = 1 - 1 - iex> ^x = 2 - ** (MatchError) no match of right hand side value: 2 - iex> x = 2 - 2 - -In Elixir, it is a common practice to assign a value to underscore `_` if we don't intend to use it. For example, if only the head of the list matters to us, we can assign the tail to underscore: - - iex> [h | _] = [1,2,3] - [1, 2, 3] - iex> h - 1 - -The variable `_` in Elixir is special in that it can never be read from. Trying to read from it gives an unbound variable error: - - iex> _ - ** (ErlangError) erlang error {:unbound_var, :_} - -Although pattern matching allows us to build powerful constructs, its usage is limited. For instance, you cannot make function calls on the left side of the match. The following example is invalid: - - iex> :lists.flatten([1,[2],3]) = [1,2,3] - ** (ErlangError) erlang error :illegal_pattern - -## 2.7 Blocks +## 2.5 Blocks One of the first control flow constructs we usually learn is the conditional `if`. In Elixir, we could write `if` as follow: @@ -333,42 +280,54 @@ Which is not what we want since `do` is binding to the farthest function call, i 1 + 2 end) -## 2.8 Control flow structures +## 2.6 Control flow structures In this section we'll describe Elixir's main control flow structures. -### 2.8.1 If +### 2.6.1 Revisiting pattern matching -Refreshing from the section above, all these calls behave the same: +At the beginning of this chapter we have seen some pattern matching examples: - if false, do: 1 + 2, else: 10 + 3 + iex> [h | t] = [1,2,3] + [1, 2, 3] + iex> h + 1 + iex> t + [2, 3] - if false do - 1 + 2 - else - 10 + 3 - end +In Elixir, `=` is not an assignment operator as in programming languages like Java, Ruby, Python, etc. `=` is actually a match operator which will check if the expressions on both left and right side match. -In Elixir, all values except `false` and `nil` evaluate to `true`. Therefore there is no need to explicitly convert the `if` argument to a boolean. If you want to check if one of many conditions are true, you can use the `cond` macro. +Many control-flow structures in Elixir rely extensively on pattern matching and the ability for different clauses too match. In some cases, you may want to match against the value of a variable, which can be achieved by with the `^` operator: -### 2.8.2 Cond + iex> x = 1 + 1 + iex> ^x = 1 + 1 + iex> ^x = 2 + ** (MatchError) no match of right hand side value: 2 + iex> x = 2 + 2 -`cond` allows you to check many expressions and executes the first one that evaluates to true: +In Elixir, it is a common practice to assign a value to underscore `_` if we don't intend to use it. For example, if only the head of the list matters to us, we can assign the tail to underscore: - cond do - 2 + 2 == 5 -> - "This will never match" - 2 * 2 == 3 -> - "Nor this" - 1 + 1 == 2 -> - "But this will" - end + iex> [h | _] = [1,2,3] + [1, 2, 3] + iex> h + 1 -If none of the expressions above return true, an error would be raised. +The variable `_` in Elixir is special in that it can never be read from. Trying to read from it gives an unbound variable error: -### 2.8.3 Case + iex> _ + ** (ErlangError) erlang error {:unbound_var, :_} -In section 2.5, we introduced pattern matching via the `=` operator. Sometimes, however, it is convenient to compare an expression against several expressions until we find a matching one. In this scenario, we use `case`: +Although pattern matching allows us to build powerful constructs, its usage is limited. For instance, you cannot make function calls on the left side of a match. The following example is invalid: + + iex> length([1,[2],3]) = 3 + ** (ErlangError) erlang error :illegal_pattern + +### 2.6.2 Case + +A `case` allows us to compare a value against many patterns until we find a matching one: case { 1, 2, 3 } do { 4, 5, 6 } -> @@ -376,7 +335,7 @@ In section 2.5, we introduced pattern matching via the `=` operator. Sometimes, { 1, x, 3 } -> "This will match and assign x to 2" _ -> - "This is a match any clause" + "This will match any value" end As in the `=` operator, any assigned variable will be overridden in the match clause. If you want to pattern match against a variable, you need to use the `^` operator: @@ -401,7 +360,7 @@ Each match clause also supports special conditions specified via guards: In the example above, the second clause will only match when x is positive. The Erlang VM only allows a limitted set of expressions as guards: * comparison operators (`==`, `!=`, `===`, `!==`, `>`, `<`, `<=`, `>=`); -* boolean operators (`and`, `or`) and negation operators (`not`, `!`). Note that `||` and `&&` are not allowed; +* boolean operators (`and`, `or`) and negation operators (`not`, `!`); * arithmetic operators (`+`, `-`, `*`, `/`); * `<>` and `++` as long as the left side is a literal; * the `in` operator; @@ -454,19 +413,19 @@ Many independent guard clauses can also be given at the same time. For example, However, the example above will always fail. If the argument is a list, calling `elem` on a list will raise an error. If the element is a tuple, calling `hd` on a tuple will also raise an error. To fix this, we can rewrite it to become two different clauses: - def first_is_zero?(tuple_or_list) when - elem(tuple_or_list, 1) == 0 when - hd(tuple_or_list) == 0 do + def first_is_zero?(tuple_or_list) + when elem(tuple_or_list, 1) == 0 + when hd(tuple_or_list) == 0 do true end In such cases, if there is an error in one of the guards, it won't affect the next one. -### 2.8.4 Functions +### 2.6.3 Functions -In Elixir, creating an anonymous function is similar to the `case` mechanism we have just seen. It allows us to define a function with many clauses: +In Elixir, anonymous functions can accept many clauses and guards just the `case` mechanism we have just seen: - f = function do + f = fn x, y when x > 0 -> x + y x, y -> x * y end @@ -474,30 +433,51 @@ In Elixir, creating an anonymous function is similar to the `case` mechanism we f.(1, 3) #=> 4 f.(-1, 3) #=> -3 -However, in Elixir code, it is more common to use a shortcut syntax to define anonymous functions: +As Elixir is an immutable language, the binding of the function is also immutable. This means that setting a variable inside the function does not affect its outer scope: + + x = 1 + (fn -> x = 2 end).() + x #=> 1 - f = fn x, y -> x + y end +### 2.6.4 Receive + +This next control-flow mechanism is essential to Elixir's and Erlang's actor mechanism. In Elixir, the code is run in separate processes that exchange messages between them. Those processes are not Operating System processes (they are actually quite light-weight) but are called so since they do not share state with each other. + +In order to exchange messages, each process has a mailbox where the received messages are stored. The `receive` mechanism allows us to go through this mailbox searching for a message that matches the given pattern. Here is an example that uses the arrow operator `<-` to send a message to the current process and then collects this message from its mailbox: - f = fn x, y -> - x + y + # Get the current process id + iex> current_pid = self + + # Spawn another process that will send a message to current_pid + iex> spawn fn -> + current_pid <- { :hello, self } end + <0.36.0> -This shortcut form is frequently used with functions from the [`Enum` module](/docs/stable/Enum.html) discussed earlier: - iex> Enum.map [1,2,3], fn(x) -> x * 2 end - [2,4,6] - iex> Enum.reduce [1,2,3], 0, fn(x, acc) -> x + acc end - 6 + # Collect the message + iex> receive do + ...> { :hello, pid } -> + ...> IO.puts "Hello from #{inspect(pid)}" + ...> end + Hello from <0.36.0> -As Elixir is an immutable language, the binding of the function is also immutable. This means that setting a variable inside the function does not affect its outer scope: +You may not see exactly `<0.36.0>` back, but something similar. If there are no messages in the mailbox, the current process will hang until a matching message arrives unless an after clause is given: - x = 1 - (fn -> x = 2 end).() - x #=> 1 + iex> receive do + ...> :waiting -> + ...> IO.puts "This may never come" + ...> after + ...> 1000 -> # 1 second + ...> IO.puts "Too late" + ...> end + Too late + +Notice we spawned a new process using the `spawn` function passing another function as argument. We will talk more about those processes and even how to exchange messages in between different nodes in a later chapter. -### 2.8.5 Try +### 2.6.5 Try -The next control-flow mechanism is `try/catch/after`: +`try` in Elixir is used to catch values that are thrown. Let's start with an example: iex> try do ...> throw 13 @@ -506,7 +486,7 @@ The next control-flow mechanism is `try/catch/after`: ...> end 13 -`try/catch` is the main mechanism for catching values thrown by Elixir at runtime. It also supports an `after` clause that is invoked regardless of whether or not the value was caught: +`try/catch` is a control-flow mechanism, useful in rare situations where your code has complex exit strategies and it is easier to `throw` a value back up in the stack. `try` also supports guards in `catch` and an `after` clause that is invoked regardless of whether or not the value was caught: iex> try do ...> throw 13 @@ -519,7 +499,7 @@ The next control-flow mechanism is `try/catch/after`: ** throw 13 erl_eval:expr/3 -There is one particularity that applies to `try/catch/after` when compared to other control-flow expressions. The Erlang VM considers such clauses unsafe (since they may or may not fail) and does not allow variables defined inside `try/catch/after` to be accessed from the outer scope: +Notice that a thrown value which hasn't been caught halts the software. For this reason, Elixir considers such clauses unsafe (since they may or may not fail) and does not allow variables defined inside `try/catch/after` to be accessed from the outer scope: iex> try do ...> new_var = 1 @@ -530,7 +510,7 @@ There is one particularity that applies to `try/catch/after` when compared to ot iex> new_var ** error :undef -The common strategy is to explicitly make all arguments that are required after the `try`: +The common strategy is to explicitly return all arguments from `try`: { x, y } = try do x = calculate_some_value() @@ -542,91 +522,83 @@ The common strategy is to explicitly make all arguments that are required after x #=> returns the value of x or nil for failures -### 2.8.6 Receive +### 2.6.6 If and Unless -The last control-flow mechanism we are going to discuss is essential to Elixir's and Erlang's actor mechanism. In Elixir, the code is run in separate processes that exchange messages between them. Those processes are not Operating System processes (they are actually quite light-weight) but are called so since they do not share state with each other. +Besides the four main control-flow structures above, Elixir provides some extra control-flow structures to help on our daily work. For example, `if` and `unless`: -In order to exchange messages, each process has a mailbox where the received messages are stored. The `receive` mechanism allows us to go through this mailbox searching for a message that matches the given pattern. Here is an example that uses the arrow operator `<-` to send a message to the current process and then collects this message from its mailbox: + iex> if true do + iex> "This works!" + iex> end + "This works!" - # Get the current process id - iex> current_pid = self + iex> unless true do + iex> "This will never be seen" + iex> end + nil - # Spawn another process that will send a message to current_pid - iex> spawn fn -> - current_pid <- { :hello, self } - end - <0.36.0> +Remember that `do/end` blocks in Elixir are simply a shortcut to the keyword notation. So one could also write: - # Collect the message - iex> receive do - ...> { :hello, pid } -> - ...> IO.puts "Hello from #{inspect(pid)}" - ...> end - Hello from <0.36.0> + iex> if true, do: "This works!" + "This works!" -You may not see exactly `<0.36.0>` back, but something similar. If there are no messages in the mailbox, the current process will hang until a matching message arrives unless an after clause is given: +Or even more complex examples like: - iex> receive do - ...> :waiting -> - ...> IO.puts "This may never come" - ...> after - ...> 1000 -> # 1 second - ...> IO.puts "Too late" - ...> end - Too late + # This is equivalent... + if false, do: 1 + 2, else: 10 + 3 -Notice we spawned a new process using the `spawn` function passing another function as argument. [`Process`](/docs/stable/Process.html) and [`Node`](/docs/stable/Node.html) modules contains many functions to manage processes, including spawning and get information about processes running in other nodes in the network. We will go in more detail about those on chapter 6. + # ... to this + if false do + 1 + 2 + else + 10 + 3 + end -## 2.9 Exceptions +In Elixir, all values except `false` and `nil` evaluate to `true`. Therefore there is no need to explicitly convert the `if` argument to a boolean. If you want to check if one of many conditions are true, you can use the `cond` macro. -Elixir provides the concept of exceptions. An exception can be raised using the function `raise` and rescued inside a `try` block with the `rescue` keyword: +### 2.6.7 Cond - # rescue only runtime error - try do - raise "some error" - rescue - RuntimeError -> "rescued" - end +Whenever you want to check for many conditions at the same time, Elixir allows developers to use `cond` insted of nesting many `if` expressions: - # rescue runtime and argument errors - try do - raise "some error" - rescue - [RuntimeError, ArgumentError] -> "rescued" + cond do + 2 + 2 == 5 -> + "This will never match" + 2 * 2 == 3 -> + "Nor this" + 1 + 1 == 2 -> + "But this will" end - # rescue and assign to x - try do - raise "some error" - rescue - x in [RuntimeError] -> - # all exceptions respond to message - x.message +If none of the conditions return true, an error will be raised. For this reason, it is common to see a last condition equal to `true`, which will always match: + + cond do + 2 + 2 == 5 -> + "This will never match" + 2 * 2 == 3 -> + "Nor this" + true -> + "This will always match (equivalent to else)" end -In general, idiomatic Elixir avoids using exceptions for control flow. For example, if you write software that does log partitioning and log rotation over the network, you may face network issues or an eventual instability when accessing the file system. These scenarios are not exceptional in this particular software and must be handled accordingly. Therefore, a developer can read some file using `File.read`: +## 2.7 Built-in functions - case File.read(file) do - { :ok, contents } -> - # we could access the file - # proceed as expected - { :error, reason } -> - # Oops, something went wrong - # We need to handle the error accordingly - end +Elixir ships with many built-in functions automatically available in the current scope. In addition to the control flow expressions seen above, Elixir also adds: `elem` and `set_'elem` to read and set values in tuples, `inspect` that returns the representation of a given data type as a binary, and many others. All of these functions imported by default are available in [`Kernel`](/docs/stable/Kernel.html) and [Elixir special forms are available in `Kernel.SpecialForms`](/docs/stable/Kernel.SpecialForms.html). -Notice `File.read` does not raise an exception in case something goes wrong, it returns a tuple containing `{ :ok, contents }` in case of success and `{ :error, reason }` in case of failures. This allows us to use Elixir's pattern matching construncts to control how our application should behave. +All of these functions and control flow expressions are essential for building Elixir programs. In some cases though, one may need to use functions available from Erlang, let's see how. -On the other hand, a CLI interface that needs to access or manipulate a file given by the user may necessarily expect a file to be there. If the given file does not exist, there is nothing you can do but fail. Then you may use `File.read!` which raises an exception: +## 2.8 Calling Erlang functions - contents = File.read!(file) +One of Elixir's assets is easy integration with the existing Erlang ecosystem. Erlang ships with a group of libraries called OTP (Open Telecom Platform). Besides being a standard library, OTP provides several facilities to build OTP applications with supervisors that are robust, distributed and fault-tolerant. -This pattern is common throughout Elixir standard library. Many libraries have both function definitions followed by their "bang" variation, with exclamation mark. This showcases well Elixir's philosophy of not using exceptions for control-flow. If you feel like you need to rescue an exception in order to change how the code behaves, you should probably return an atom or tuple instead, allowing your developers to rely on pattern matching. +Since an Erlang module is nothing more than an atom, invoking those libraries from Elixir is quite straight-forward. For example, we can call the [function `flatten` from the module `lists`](http://www.erlang.org/doc/man/lists.html#flatten-1) or interact with [the math module](http://www.erlang.org/doc/man/math.html) as follows: -Custom exceptions can be defined using the `defexception` macro. You can check a list of defined exceptions in [our documentation page](/docs/stable/), by clicking "Records" in the upper left corner (we will learn more about Records on chapter 4). + iex> :lists.flatten [1,[2],3] + [1,2,3] + iex> :math.sin :math.pi + 1.2246467991473532e-16 -## 2.10 Built-in functions +Erlang's OTP is very well documented and we will learn more about building OTP applications in the Mix chapters: -Elixir ships with many built-in functions automatically available in the current scope. In addition to the control flow expressions seen above, Elixir also adds: `elem` and `set_elem` to read and set values in tuples, `inspect` that returns the representation of a given data type as a binary, and many others. All of these functions imported by default are available in [`Kernel`](/docs/stable/Kernel.html) and [Elixir special forms are available in `Kernel.SpecialForms`](/docs/stable/Kernel.SpecialForms.html). +* [OTP docs](http://www.erlang.org/doc/) +* [Standard library docs](http://www.erlang.org/doc/man/STDLIB_app.html) -All of these functions and control flow expressions are essential for building Elixir programs. The next chapter will discuss how to organize our code into modules, so it can be easily reused between different applications. +That's all for now. The next chapter will discuss how to organize our code into modules so it can be easily reused between different applications. diff --git a/getting_started/3.markdown b/getting_started/3.markdown index bc03ea208..5f4504bd9 100644 --- a/getting_started/3.markdown +++ b/getting_started/3.markdown @@ -50,7 +50,7 @@ Elixir projects are usually organized into three directories: * lib - contains elixir code (usually `.ex` files) * test - contains tests (usually `.exs` files) -In many cases, since the bytecode is in `ebin`, you need to explicitly tell Elixir to look for code in the `ebin` directory: +Whenever interacting with an existing library, you may need to explicitly tell Elixir to look for bytecode in the `ebin` directory: iex -pa ebin @@ -344,7 +344,7 @@ Modules in Elixir can be nested too: end end -The example above will define two modules `Foo` and `Foo.Bar`. The second can be accessed as `Bar` inside `Foo` as long as they are in the same scope. If later the developer decides to move `Bar` to another file, it needs to be referenced by its full name (`Foo.Bar`) or an alias needs to be set using the `alias` directive discussed above. +The example above will define two modules `Foo` and `Foo.Bar`. The second can be accessed as `Bar` inside `Foo` as long as they are in the same scope. If later the developer decides to move `Bar` to another file, it will need to be referenced by its full name (`Foo.Bar`) or an alias needs to be set using the `alias` directive discussed above. ## 3.8 Aliases @@ -353,12 +353,14 @@ In Erlang (and consequently in the Erlang VM), modules and functions are represe Mod = lists, Mod:flatten([1,[2],3]). -In the example above, we store the atom `lists` in the variable `Mod` and then invoke the function `flatten` in it. In Elixir, the same idiom is allowed. In fact, we could call the same function `flatten` in `lists` as: +In the example above, we store the atom `lists` in the variable `Mod` and then invoke the function `flatten` in it. In Elixir, the same idiom is allowed: - iex> :lists.flatten([1,[2],3]) + iex> mod = :lists + :lists + iex> mod.flatten([1,[2],3]) [1,2,3] -In other words, we are simply calling the function `flatten` on the atom `:list`. This mechanism is exactly what empowers Elixir aliases. An alias in Elixir is a capitalized identifier (like `List`, `Keyword`, etc) which is converted to an atom representing a module during compilation. For instance, the `List` alias translates by defailt to the atom `Elixir-List`: +In other words, we are simply calling the function `flatten` on the atom `:lists`. This mechanism is exactly what empowers Elixir aliases. An alias in Elixir is a capitalized identifier (like `List`, `Keyword`, etc) which is converted to an atom representing a module during compilation. For instance, the `List` alias translates by default to the atom `Elixir-List`: iex> is_atom(List) true diff --git a/getting_started/4.markdown b/getting_started/4.markdown index 28ca0df1c..77a92477e 100644 --- a/getting_started/4.markdown +++ b/getting_started/4.markdown @@ -7,7 +7,7 @@ total_guides: 7 # {{ page.title }} -Elixir provides both records and protocols. This chapter will outline the main features of both and provide some examples. More specifically, we will learn how to use `defrecord`, `defprotocol` and `defimpl`. +Elixir provides both records and protocols. This chapter will outline the main features of both and provide some examples. More specifically, we will learn how to use `defprotocol`, `defprotocol` and `defimpl`. At the end, we will briefly discuss `try`, `throw` and `raise`. ## 4.1 Records @@ -229,9 +229,68 @@ Elixir ships with some built-in protocols, let's take a look at a couple of thos iex> "tuple: #{inspect tuple}" "tuple: {1,2,3}" -* `List.Chars` - specifies how to convert a data structures with characters to lists. Exposed via the `to_char_list` function: - iex> to_char_list :hello - 'hello' +Elixir defines other protocols which can be verified in Elixir's documentation. Frameworks and libraries that you use may define a couple of specific protocols as well. Use them wisely to write code that is easy to maintain and extend. -Elixir defines other protocols which can be verified in Elixir's documentation. Frameworks and libraries that you use may define a couple of specific protocols as well. Use them wisely to write code that is easy to maintain and extend! Next, let's take a look at how Elixir tackles productivity by building some macros using `defmacro` and `defmacrop`! +## 4.3 Exceptions + +The `try` mechanism in Elixir is also used to handle exceptions. In many languages, exceptions would have its own chapter in a getting started guide but here they play a much lesser role. + +An exception can be rescued inside a `try` block with the `rescue` keyword: + + # rescue only runtime error + try do + raise "some error" + rescue + RuntimeError -> "rescued" + end + + # rescue runtime and argument errors + try do + raise "some error" + rescue + [RuntimeError, ArgumentError] -> "rescued" + end + + # rescue and assign to x + try do + raise "some error" + rescue + x in [RuntimeError] -> + # all exceptions have a message + x.message + end + +Notice that `rescue` works with exception names and it doesn't allow guards nor pattern matching. This limitation is on purpose: developers should not use exception values to drive their software. In fact, **exceptions in Elixir should not be used for control-flow but only under exceptional circunstances**. + +For example, if you write a software that does log partitioning and log rotation over the network, you may face network issues or an eventual instability when accessing the file system. These scenarios are not exceptional in this particular software and must be handled accordingly. Therefore, a developer can read some file using `File.read`: + + case File.read(file) do + { :ok, contents } -> + # we could access the file + # proceed as expected + { :error, reason } -> + # Oops, something went wrong + # We need to handle the error accordingly + end + +Notice `File.read` does not raise an exception in case something goes wrong, it returns a tuple containing `{ :ok, contents }` in case of success and `{ :error, reason }` in case of failures. This allows us to use Elixir's pattern matching constructs to control how our application should behave. + +On the other hand, a CLI interface that needs to access or manipulate a file given by the user may necessarily expect a file to be there. If the given file does not exist, there is nothing you can do but fail. Then you may use `File.read!` which raises an exception: + + contents = File.read!(file) + +This pattern is common throughout Elixir standard library. Many libraries have both function definitions followed by their "bang!" variation, with exclamation mark. This showcases well Elixir's philosophy of not using exceptions for control-flow. If you feel like you need to rescue an exception in order to change how your code works, you should probably return an atom or tuple instead, allowing your developers to rely on pattern matching. + +Finally, exceptions are simply records and they can be defined with `defexception` which has a similar API to `defrecord`. But remember, in Elixir you will use those sparingly. Next, let's take a look at how Elixir tackles productivity by building some macros using `defmacro` and `defmacrop`! + +> Note: In order to ease integration with Erlang APIs, Elixir also supports "catching errors" coming from Erlang with `try/catch`, as it works in Erlang: +> +> try do +> :erlang.error(:oops) +> catch +> :error, :oops -> +> "Got Erlang error" +> end +> +> The first atom can be one of `:error`, `:throw` or `:exit`. Keep in mind catching errors is as discouraged as rescuing exceptions in Elixir. diff --git a/getting_started/6.markdown b/getting_started/6.markdown index 2b1706f77..c07a58a8a 100644 --- a/getting_started/6.markdown +++ b/getting_started/6.markdown @@ -140,14 +140,19 @@ The example above works as if `size(&1)` translates directly to `fn(x) -> size(x iex> Enum.reduce [1,2,3], 1, &1 * &2 6 -In this case, `&1 * &2` translates to `fn(x, y) -> x * y end`. The values `&1` and `&2` maps to the argument order in the generated function. +In this case, `&1 * &2` translates to `fn(x, y) -> x * y end`. The values `&1` and `&2` map to the argument order in the generated function. -Keep in mind that `&args` binds only to the closest function call. For example, the following syntax is invalid: +Keep in mind that `&N` binds only to the closest function call. For example, the following syntax is invalid: iex> foo(&1, 1 + &2) ** (SyntaxError) iex:1: partial variable &2 cannot be defined without &1 -This is because we have two functions calls in the example above, `foo` and `+`, and `&1` binds to `foo` while `&2` binds to `+`. In such cases, you need to use the usual function syntax: +This is because we have two functions calls in the example above, `foo` and `+`, and `&1` binds to `foo` while `&2` binds to `+`. Let's add some parenthesis to make it explicit: + + iex> foo(&1, (1 + &2)) + ** (SyntaxError) iex:1: partial variable &2 cannot be defined without &1 + +In such cases, you need to use the usual function syntax: iex> fn(x, y) -> foo(x, 1 + y) end #Function @@ -166,12 +171,12 @@ All functions and macros can be retrieved and partially applied, except [Elixir' defmodule AssertionTest do use ExUnit.Case, async: true - def test_always_pass do + test "always pass" do true = true end end -This allows `ExUnit.Case` to configure and inject the proper setup into the `AssertionTest` module. +This allows `ExUnit.Case` to configure and set up the module for testing, for example, by making the `test` macro used above available. The implementation of the `use` macro is actually quite trivial. When you invoke `use` with a module, it invokes a hook called `__using__` in this module. For example, the `use` call above is simply a translation to: @@ -179,7 +184,7 @@ The implementation of the `use` macro is actually quite trivial. When you invoke require ExUnit.Case ExUnit.Case.__using__(async: true) - def test_always_pass do + test "always pass" do true = true end end @@ -236,5 +241,6 @@ Elixir provides a set of pseudo-variables. These variables can only be read and * `__MODULE__` - Returns an atom representing the current module or nil; * `__FILE__` - Returns a string representing the current file; +* `__DIR__` - Returns a string representing the current directory; * `__ENV__` - Returns a [Macro.Env](/docs/stable/Macro.Env.html) record with information about the compilation environment. Here we can access the current module, function, line, file and others; * `__CALLER__` - Also returns a [Macro.Env](/docs/stable/Macro.Env.html) record but with information of the calling site. `__CALLER__` is available only inside macros; From 31896fc849cf3cf13f947aab2d0a630c4bbf1a1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sat, 18 May 2013 00:21:05 +0200 Subject: [PATCH 405/437] Add exceptions to chapter 4 title --- getting_started/4.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/getting_started/4.markdown b/getting_started/4.markdown index 77a92477e..4212a19ac 100644 --- a/getting_started/4.markdown +++ b/getting_started/4.markdown @@ -1,13 +1,13 @@ --- layout: getting_started -title: 4 Records & Protocols +title: 4 Records, Protocols & Exceptions guide: 4 total_guides: 7 --- # {{ page.title }} -Elixir provides both records and protocols. This chapter will outline the main features of both and provide some examples. More specifically, we will learn how to use `defprotocol`, `defprotocol` and `defimpl`. At the end, we will briefly discuss `try`, `throw` and `raise`. +Elixir provides both records and protocols. This chapter will outline the main features of both and provide some examples. More specifically, we will learn how to use `defprotocol`, `defprotocol` and `defimpl`. At the end, we will briefly talk about exceptions in Elixir. ## 4.1 Records From 170631ab4fbcc44162b7fefeb52b4bf237440006 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sat, 18 May 2013 00:22:57 +0200 Subject: [PATCH 406/437] Update sidebar --- _layouts/getting_started.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_layouts/getting_started.html b/_layouts/getting_started.html index 3eedc38c3..b68f75dd6 100644 --- a/_layouts/getting_started.html +++ b/_layouts/getting_started.html @@ -13,7 +13,7 @@

                                                                                                                  Index

                                                                                                                • Introduction
                                                                                                                • Diving in
                                                                                                                • Modules
                                                                                                                • -
                                                                                                                • Records & Protocols
                                                                                                                • +
                                                                                                                • Records, Protocols & Exceptions
                                                                                                                • Macros
                                                                                                                • Other topics
                                                                                                                • Where to go next
                                                                                                                • From 8c5c67e6f747b8b9caba8be3964d1ea2be0d1ada Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Tue, 21 May 2013 17:35:48 +0300 Subject: [PATCH 407/437] Update index.html File.iterator will be gone on 0.9.0, so stop talking about it. --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 2fa088435..8baa152b5 100644 --- a/index.html +++ b/index.html @@ -81,7 +81,7 @@

                                                                                                                  Polymorphism via protocols

                                                                                                                  Since the Enum module is built on top of protocols, it is not only limited to the data types that ship with Elixir. A developer can use his own collections with Enum as long as it implements the Enum.Iterator protocol. For example, a developer can use all the convenience of the Enum module to easily manipulate a file, line by line:

                                                                                                                  {% highlight elixir %} -{ :ok, file } = File.iterator("README.md") +file = File.iterator!("README.md") lines = Enum.map(file, fn(line) -> Regex.replace(%r/"/, line, "'") end) File.write("README.md", lines) {% endhighlight %} From 6b7d53a2a3e38eb66e0854940a74ef6d3e4a7ec4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Wed, 22 May 2013 14:23:03 +0200 Subject: [PATCH 408/437] Already push everyone to use R16B --- getting_started/1.markdown | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/getting_started/1.markdown b/getting_started/1.markdown index 6fe1fc131..97caf45c0 100644 --- a/getting_started/1.markdown +++ b/getting_started/1.markdown @@ -13,13 +13,13 @@ Keep in mind that Elixir is still in development so if at any point you receive ## 1.1 Installation -The only prerequisite for Elixir is Erlang, version R15B or later. You can find the source code for [Erlang here](http://www.erlang.org/download.html) or use one of the [precompiled packages](https://www.erlang-solutions.com/downloads/download-erlang-otp). +The only prerequisite for Elixir is Erlang, version R16B or later. You can find the source code for [Erlang here](http://www.erlang.org/download.html) or use one of the [precompiled packages](https://www.erlang-solutions.com/downloads/download-erlang-otp). For Windows developers, we recommend the precompiled package. Those on the UNIX platform can probably get Erlang installed via one of the many package management tools. After Erlang is installed, you should be able to open up the command line (or command prompt) and check the Erlang version by typing `erl`. You will see some information as follows: - Erlang R15B (erts-5.8.4) [source] [64-bit] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false] + Erlang R16B (erts-5.8.4) [source] [64-bit] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false] Notice that depending on how you installed Erlang, it will not add Erlang binaries to your environment. Be sure to have Erlang binaries in your [PATH](http://en.wikipedia.org/wiki/Environment_variable), otherwise Elixir won't work! @@ -29,7 +29,10 @@ After Erlang is up and running, it is time to install Elixir. You can do that vi Elixir v0.8.1 forward is required to run this tutorial and it may be available in some distributions: -* Homebrew for Mac OS X: `brew install elixir` (run `brew update` to ensure you have the latest formula) +* Homebrew for Mac OS X + * Since Elixir requires Erlang R16B, first call `brew tap homebrew/versions` and then `brew install erlang-r16` + * Update your homebrew to latest: `brew update` + * Install Elixir: `brew install elixir` * Fedora 17+ and Fedora Rawhide: `sudo yum -y install elixir` * Arch Linux : Elixir is available on AUR via `yaourt -S elixir` From 1272457032d11e0d5a086dad8318f561e26fabf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Wed, 22 May 2013 14:40:42 +0200 Subject: [PATCH 409/437] v0.8.3 was released --- docs/master/Access.HashDict.html | 4 +- docs/master/ArgumentError.html | 2 +- docs/master/ArithmeticError.html | 2 +- docs/master/BadArityError.html | 4 +- docs/master/BadFunctionError.html | 4 +- docs/master/Binary.Chars.List.html | 4 +- docs/master/Binary.Chars.Number.html | 2 +- docs/master/Binary.Inspect.Atom.html | 4 +- docs/master/Binary.Inspect.BitString.html | 4 +- docs/master/Binary.Inspect.Function.html | 4 +- docs/master/Binary.Inspect.HashDict.html | 4 +- docs/master/Binary.Inspect.List.html | 4 +- docs/master/Binary.Inspect.Number.html | 4 +- docs/master/Binary.Inspect.PID.html | 4 +- docs/master/Binary.Inspect.Port.html | 4 +- docs/master/Binary.Inspect.Range.html | 4 +- docs/master/Binary.Inspect.Reference.html | 4 +- docs/master/Binary.Inspect.Regex.html | 4 +- docs/master/Binary.Inspect.Tuple.html | 4 +- docs/master/Binary.Inspect.html | 2 +- docs/master/CaseClauseError.html | 4 +- docs/master/Code.html | 118 +-- docs/master/CompileError.html | 4 +- docs/master/Dict.html | 429 ++++++++-- docs/master/Enum.EmptyError.html | 62 ++ docs/master/Enum.Iterator.Function.html | 19 +- docs/master/Enum.Iterator.HashDict.html | 19 +- docs/master/Enum.Iterator.List.html | 19 +- docs/master/Enum.Iterator.Range.html | 15 +- docs/master/Enum.Iterator.html | 18 +- docs/master/Enum.OutOfBoundsError.html | 2 +- docs/master/Enum.html | 364 ++++++-- docs/master/ErlangError.html | 4 +- docs/master/ExUnit.Assertions.html | 36 +- docs/master/ExUnit.CLIFormatter.html | 8 +- docs/master/ExUnit.Callbacks.html | 21 +- docs/master/ExUnit.CaptureIO.html | 112 +++ docs/master/ExUnit.ExpectationError.html | 4 +- docs/master/ExUnit.Formatter.html | 22 +- docs/master/ExUnit.Test.html | 6 + docs/master/ExUnit.TestCase.html | 75 ++ docs/master/ExUnit.html | 6 +- docs/master/Exception.html | 38 +- docs/master/FunctionClauseError.html | 4 +- docs/master/HashDict.html | 139 +++- docs/master/IEx.Helpers.html | 101 ++- docs/master/IEx.html | 107 ++- docs/master/IO.ANSI.html | 100 +-- docs/master/IO.html | 32 +- docs/master/Kernel.CLI.html | 2 +- docs/master/Kernel.SpecialForms.html | 181 +++- docs/master/Kernel.Typespec.html | 8 +- docs/master/Kernel.html | 598 ++++++++------ docs/master/KeyError.html | 4 +- docs/master/Keyword.html | 155 ++-- docs/master/List.Chars.Number.html | 4 +- docs/master/List.html | 105 +-- docs/master/{List.Dict.html => ListDict.html} | 153 +++- docs/master/Macro.Env.html | 15 +- docs/master/Macro.html | 16 +- docs/master/MatchError.html | 4 +- docs/master/Mix.Dep.html | 6 + docs/master/Mix.Deps.html | 158 +++- docs/master/Mix.Local.html | 14 + docs/master/Mix.Project.html | 91 ++ docs/master/Mix.Shell.IO.html | 19 +- docs/master/Mix.Shell.Process.html | 19 +- docs/master/Mix.Shell.html | 16 +- docs/master/Mix.Task.html | 27 +- docs/master/Mix.Tasks.App.Start.html | 2 +- docs/master/Mix.Tasks.Clean.html | 2 +- docs/master/Mix.Tasks.Compile.App.html | 2 +- docs/master/Mix.Tasks.Compile.Elixir.html | 6 +- docs/master/Mix.Tasks.Compile.Erlang.html | 6 +- docs/master/Mix.Tasks.Compile.Leex.html | 2 +- docs/master/Mix.Tasks.Compile.Yecc.html | 2 +- docs/master/Mix.Tasks.Compile.html | 2 +- docs/master/Mix.Tasks.Deps.Check.html | 2 +- docs/master/Mix.Tasks.Deps.Clean.html | 2 +- docs/master/Mix.Tasks.Deps.Compile.html | 2 +- docs/master/Mix.Tasks.Deps.Get.html | 5 +- docs/master/Mix.Tasks.Deps.Loadpaths.html | 2 +- docs/master/Mix.Tasks.Deps.Unlock.html | 2 +- docs/master/Mix.Tasks.Deps.Update.html | 4 +- docs/master/Mix.Tasks.Deps.html | 2 +- docs/master/Mix.Tasks.Loadpaths.html | 5 +- docs/master/Mix.Tasks.Local.Install.html | 2 +- ....Remsh.html => Mix.Tasks.Local.Rebar.html} | 45 +- docs/master/Mix.Tasks.New.html | 14 +- docs/master/Mix.Tasks.Run.html | 13 +- docs/master/Mix.Tasks.Test.html | 2 +- docs/master/Mix.Utils.html | 69 +- docs/master/Module.html | 22 +- docs/master/Node.html | 33 + docs/master/Path.html | 101 ++- docs/master/Process.html | 60 +- docs/master/Protocol.UndefinedError.html | 4 +- docs/master/Range.Iterator.Number.html | 6 +- docs/master/Record.html | 10 +- docs/master/Regex.html | 47 +- docs/master/RuntimeError.html | 2 +- docs/master/String.html | 185 ++++- docs/master/SyntaxError.html | 4 +- docs/master/SystemLimitError.html | 2 +- docs/master/TokenMissingError.html | 4 +- docs/master/UndefinedFunctionError.html | 4 +- docs/master/index.html | 2 +- docs/master/modules_list.html | 775 +++++++++++++++--- docs/master/protocols_list.html | 37 +- docs/master/records_list.html | 24 +- docs/stable/Access.HashDict.html | 4 +- docs/stable/ArgumentError.html | 2 +- docs/stable/ArithmeticError.html | 2 +- docs/stable/BadArityError.html | 4 +- docs/stable/BadFunctionError.html | 4 +- docs/stable/Binary.Chars.List.html | 4 +- docs/stable/Binary.Chars.Number.html | 2 +- docs/stable/Binary.Inspect.Atom.html | 4 +- docs/stable/Binary.Inspect.BitString.html | 4 +- docs/stable/Binary.Inspect.Function.html | 4 +- docs/stable/Binary.Inspect.HashDict.html | 4 +- docs/stable/Binary.Inspect.List.html | 4 +- docs/stable/Binary.Inspect.Number.html | 4 +- docs/stable/Binary.Inspect.PID.html | 4 +- docs/stable/Binary.Inspect.Port.html | 4 +- docs/stable/Binary.Inspect.Range.html | 4 +- docs/stable/Binary.Inspect.Reference.html | 4 +- docs/stable/Binary.Inspect.Regex.html | 4 +- docs/stable/Binary.Inspect.Tuple.html | 4 +- docs/stable/Binary.Inspect.html | 2 +- docs/stable/CaseClauseError.html | 4 +- docs/stable/Code.html | 118 +-- docs/stable/CompileError.html | 4 +- docs/stable/Dict.html | 429 ++++++++-- docs/stable/Enum.EmptyError.html | 62 ++ docs/stable/Enum.Iterator.Function.html | 19 +- docs/stable/Enum.Iterator.HashDict.html | 19 +- docs/stable/Enum.Iterator.List.html | 19 +- docs/stable/Enum.Iterator.Range.html | 15 +- docs/stable/Enum.Iterator.html | 18 +- docs/stable/Enum.OutOfBoundsError.html | 2 +- docs/stable/Enum.html | 364 ++++++-- docs/stable/ErlangError.html | 4 +- docs/stable/ExUnit.Assertions.html | 36 +- docs/stable/ExUnit.CLIFormatter.html | 8 +- docs/stable/ExUnit.Callbacks.html | 21 +- docs/stable/ExUnit.CaptureIO.html | 112 +++ docs/stable/ExUnit.ExpectationError.html | 4 +- docs/stable/ExUnit.Formatter.html | 22 +- docs/stable/ExUnit.Test.html | 6 + docs/stable/ExUnit.TestCase.html | 75 ++ docs/stable/ExUnit.html | 6 +- docs/stable/Exception.html | 38 +- docs/stable/FunctionClauseError.html | 4 +- docs/stable/HashDict.html | 139 +++- docs/stable/IEx.Helpers.html | 101 ++- docs/stable/IEx.html | 107 ++- docs/stable/IO.ANSI.html | 100 +-- docs/stable/IO.html | 32 +- docs/stable/Kernel.CLI.html | 2 +- docs/stable/Kernel.SpecialForms.html | 181 +++- docs/stable/Kernel.Typespec.html | 8 +- docs/stable/Kernel.html | 598 ++++++++------ docs/stable/KeyError.html | 4 +- docs/stable/Keyword.html | 155 ++-- docs/stable/List.Chars.Number.html | 4 +- docs/stable/List.html | 105 +-- docs/stable/{List.Dict.html => ListDict.html} | 153 +++- docs/stable/Macro.Env.html | 15 +- docs/stable/Macro.html | 16 +- docs/stable/MatchError.html | 4 +- docs/stable/Mix.Dep.html | 6 + docs/stable/Mix.Deps.html | 158 +++- docs/stable/Mix.Local.html | 14 + docs/stable/Mix.Project.html | 91 ++ docs/stable/Mix.Shell.IO.html | 19 +- docs/stable/Mix.Shell.Process.html | 19 +- docs/stable/Mix.Shell.html | 16 +- docs/stable/Mix.Task.html | 27 +- docs/stable/Mix.Tasks.App.Start.html | 2 +- docs/stable/Mix.Tasks.Clean.html | 2 +- docs/stable/Mix.Tasks.Compile.App.html | 2 +- docs/stable/Mix.Tasks.Compile.Elixir.html | 6 +- docs/stable/Mix.Tasks.Compile.Erlang.html | 6 +- docs/stable/Mix.Tasks.Compile.Leex.html | 2 +- docs/stable/Mix.Tasks.Compile.Yecc.html | 2 +- docs/stable/Mix.Tasks.Compile.html | 2 +- docs/stable/Mix.Tasks.Deps.Check.html | 2 +- docs/stable/Mix.Tasks.Deps.Clean.html | 2 +- docs/stable/Mix.Tasks.Deps.Compile.html | 2 +- docs/stable/Mix.Tasks.Deps.Get.html | 5 +- docs/stable/Mix.Tasks.Deps.Loadpaths.html | 2 +- docs/stable/Mix.Tasks.Deps.Unlock.html | 2 +- docs/stable/Mix.Tasks.Deps.Update.html | 4 +- docs/stable/Mix.Tasks.Deps.html | 2 +- docs/stable/Mix.Tasks.Loadpaths.html | 5 +- docs/stable/Mix.Tasks.Local.Install.html | 2 +- ....Remsh.html => Mix.Tasks.Local.Rebar.html} | 45 +- docs/stable/Mix.Tasks.New.html | 14 +- docs/stable/Mix.Tasks.Run.html | 13 +- docs/stable/Mix.Tasks.Test.html | 2 +- docs/stable/Mix.Utils.html | 69 +- docs/stable/Module.html | 22 +- docs/stable/Node.html | 33 + docs/stable/Path.html | 101 ++- docs/stable/Process.html | 60 +- docs/stable/Protocol.UndefinedError.html | 4 +- docs/stable/Range.Iterator.Number.html | 6 +- docs/stable/Record.html | 10 +- docs/stable/Regex.html | 47 +- docs/stable/RuntimeError.html | 2 +- docs/stable/String.html | 185 ++++- docs/stable/SyntaxError.html | 4 +- docs/stable/SystemLimitError.html | 2 +- docs/stable/TokenMissingError.html | 4 +- docs/stable/UndefinedFunctionError.html | 4 +- docs/stable/index.html | 2 +- docs/stable/modules_list.html | 775 +++++++++++++++--- docs/stable/protocols_list.html | 37 +- docs/stable/records_list.html | 24 +- packages.html | 1 + 221 files changed, 7535 insertions(+), 2610 deletions(-) create mode 100644 docs/master/Enum.EmptyError.html create mode 100644 docs/master/ExUnit.CaptureIO.html create mode 100644 docs/master/ExUnit.TestCase.html rename docs/master/{List.Dict.html => ListDict.html} (61%) rename docs/master/{IEx.Remsh.html => Mix.Tasks.Local.Rebar.html} (52%) create mode 100644 docs/stable/Enum.EmptyError.html create mode 100644 docs/stable/ExUnit.CaptureIO.html create mode 100644 docs/stable/ExUnit.TestCase.html rename docs/stable/{List.Dict.html => ListDict.html} (61%) rename docs/stable/{IEx.Remsh.html => Mix.Tasks.Local.Rebar.html} (52%) diff --git a/docs/master/Access.HashDict.html b/docs/master/Access.HashDict.html index 1fc3e6a9b..4503fa350 100644 --- a/docs/master/Access.HashDict.html +++ b/docs/master/Access.HashDict.html @@ -29,7 +29,7 @@

                                                                                                                  - Source + Source @@ -60,7 +60,7 @@

                                                                                                                  Functions

                                                                                                                  - Source + Source diff --git a/docs/master/ArgumentError.html b/docs/master/ArgumentError.html index d0dc3d7b6..a3ec54bd4 100644 --- a/docs/master/ArgumentError.html +++ b/docs/master/ArgumentError.html @@ -29,7 +29,7 @@

                                                                                                                  - Source + Source diff --git a/docs/master/ArithmeticError.html b/docs/master/ArithmeticError.html index 57ba46960..cb2b4e534 100644 --- a/docs/master/ArithmeticError.html +++ b/docs/master/ArithmeticError.html @@ -29,7 +29,7 @@

                                                                                                                  - Source + Source diff --git a/docs/master/BadArityError.html b/docs/master/BadArityError.html index 3c67ceecf..421ce26d2 100644 --- a/docs/master/BadArityError.html +++ b/docs/master/BadArityError.html @@ -29,7 +29,7 @@

                                                                                                                  - Source + Source @@ -77,7 +77,7 @@

                                                                                                                  Functions

                                                                                                                  - Source + Source diff --git a/docs/master/BadFunctionError.html b/docs/master/BadFunctionError.html index a9e50c445..6889999ed 100644 --- a/docs/master/BadFunctionError.html +++ b/docs/master/BadFunctionError.html @@ -29,7 +29,7 @@

                                                                                                                  - Source + Source @@ -71,7 +71,7 @@

                                                                                                                  Functions

                                                                                                                  - Source + Source diff --git a/docs/master/Binary.Chars.List.html b/docs/master/Binary.Chars.List.html index b86e507aa..bb611efb2 100644 --- a/docs/master/Binary.Chars.List.html +++ b/docs/master/Binary.Chars.List.html @@ -65,9 +65,9 @@

                                                                                                                  Functions

                                                                                                                  Examples

                                                                                                                  -
                                                                                                                  iex> to_binary 'foo'
                                                                                                                  +
                                                                                                                  iex> to_binary('foo')
                                                                                                                   "foo"
                                                                                                                  -iex> to_binary ["foo", 'bar']
                                                                                                                  +iex> to_binary(["foo", 'bar'])
                                                                                                                   "foobar"
                                                                                                                   
                                                                                                                  diff --git a/docs/master/Binary.Chars.Number.html b/docs/master/Binary.Chars.Number.html index a9d1f0680..d1f7e24a4 100644 --- a/docs/master/Binary.Chars.Number.html +++ b/docs/master/Binary.Chars.Number.html @@ -61,7 +61,7 @@

                                                                                                                  Functions

                                                                                                                  Simply converts the number (integer or a float) to a binary.

                                                                                                                  - Source + Source diff --git a/docs/master/Binary.Inspect.Atom.html b/docs/master/Binary.Inspect.Atom.html index c3456d59b..1e93d94b6 100644 --- a/docs/master/Binary.Inspect.Atom.html +++ b/docs/master/Binary.Inspect.Atom.html @@ -49,7 +49,7 @@

                                                                                                                  Examples

                                                                                                                  - Source + Source @@ -80,7 +80,7 @@

                                                                                                                  Functions

                                                                                                                  - Source + Source diff --git a/docs/master/Binary.Inspect.BitString.html b/docs/master/Binary.Inspect.BitString.html index ae68fda85..306c2c45b 100644 --- a/docs/master/Binary.Inspect.BitString.html +++ b/docs/master/Binary.Inspect.BitString.html @@ -43,7 +43,7 @@

                                                                                                                  Examples

                                                                                                                  - Source + Source @@ -74,7 +74,7 @@

                                                                                                                  Functions

                                                                                                                  - Source + Source diff --git a/docs/master/Binary.Inspect.Function.html b/docs/master/Binary.Inspect.Function.html index fda8c6e1a..7d43b80aa 100644 --- a/docs/master/Binary.Inspect.Function.html +++ b/docs/master/Binary.Inspect.Function.html @@ -34,7 +34,7 @@

                                                                                                                  - Source + Source @@ -65,7 +65,7 @@

                                                                                                                  Functions

                                                                                                                  - Source + Source diff --git a/docs/master/Binary.Inspect.HashDict.html b/docs/master/Binary.Inspect.HashDict.html index 537eb06a9..e8684c6c7 100644 --- a/docs/master/Binary.Inspect.HashDict.html +++ b/docs/master/Binary.Inspect.HashDict.html @@ -29,7 +29,7 @@

                                                                                                                  - Source + Source @@ -60,7 +60,7 @@

                                                                                                                  Functions

                                                                                                                  - Source + Source diff --git a/docs/master/Binary.Inspect.List.html b/docs/master/Binary.Inspect.List.html index c33640502..b03cf1d45 100644 --- a/docs/master/Binary.Inspect.List.html +++ b/docs/master/Binary.Inspect.List.html @@ -52,7 +52,7 @@

                                                                                                                  Examples

                                                                                                                  - Source + Source @@ -83,7 +83,7 @@

                                                                                                                  Functions

                                                                                                                  - Source + Source diff --git a/docs/master/Binary.Inspect.Number.html b/docs/master/Binary.Inspect.Number.html index 5bcb50ae8..e6ef9fd20 100644 --- a/docs/master/Binary.Inspect.Number.html +++ b/docs/master/Binary.Inspect.Number.html @@ -40,7 +40,7 @@

                                                                                                                  Examples

                                                                                                                  - Source + Source @@ -71,7 +71,7 @@

                                                                                                                  Functions

                                                                                                                  - Source + Source diff --git a/docs/master/Binary.Inspect.PID.html b/docs/master/Binary.Inspect.PID.html index 6d4c3d956..43164d898 100644 --- a/docs/master/Binary.Inspect.PID.html +++ b/docs/master/Binary.Inspect.PID.html @@ -34,7 +34,7 @@

                                                                                                                  - Source + Source @@ -65,7 +65,7 @@

                                                                                                                  Functions

                                                                                                                  - Source + Source diff --git a/docs/master/Binary.Inspect.Port.html b/docs/master/Binary.Inspect.Port.html index 18cbf0c1b..f0e38da08 100644 --- a/docs/master/Binary.Inspect.Port.html +++ b/docs/master/Binary.Inspect.Port.html @@ -34,7 +34,7 @@

                                                                                                                  - Source + Source @@ -65,7 +65,7 @@

                                                                                                                  Functions

                                                                                                                  - Source + Source diff --git a/docs/master/Binary.Inspect.Range.html b/docs/master/Binary.Inspect.Range.html index f4ecd5222..4b0e56c9e 100644 --- a/docs/master/Binary.Inspect.Range.html +++ b/docs/master/Binary.Inspect.Range.html @@ -29,7 +29,7 @@

                                                                                                                  - Source + Source @@ -60,7 +60,7 @@

                                                                                                                  Functions

                                                                                                                  - Source + Source diff --git a/docs/master/Binary.Inspect.Reference.html b/docs/master/Binary.Inspect.Reference.html index 28c597f46..182272e50 100644 --- a/docs/master/Binary.Inspect.Reference.html +++ b/docs/master/Binary.Inspect.Reference.html @@ -34,7 +34,7 @@

                                                                                                                  - Source + Source @@ -65,7 +65,7 @@

                                                                                                                  Functions

                                                                                                                  - Source + Source diff --git a/docs/master/Binary.Inspect.Regex.html b/docs/master/Binary.Inspect.Regex.html index 9a7a2ad44..17afa4e46 100644 --- a/docs/master/Binary.Inspect.Regex.html +++ b/docs/master/Binary.Inspect.Regex.html @@ -40,7 +40,7 @@

                                                                                                                  Examples

                                                                                                                  - Source + Source @@ -71,7 +71,7 @@

                                                                                                                  Functions

                                                                                                                  - Source + Source diff --git a/docs/master/Binary.Inspect.Tuple.html b/docs/master/Binary.Inspect.Tuple.html index ca9699b61..8889c1747 100644 --- a/docs/master/Binary.Inspect.Tuple.html +++ b/docs/master/Binary.Inspect.Tuple.html @@ -43,7 +43,7 @@

                                                                                                                  Examples

                                                                                                                  - Source + Source @@ -74,7 +74,7 @@

                                                                                                                  Functions

                                                                                                                  - Source + Source diff --git a/docs/master/Binary.Inspect.html b/docs/master/Binary.Inspect.html index 7989caba7..d9b701791 100644 --- a/docs/master/Binary.Inspect.html +++ b/docs/master/Binary.Inspect.html @@ -148,7 +148,7 @@

                                                                                                                  Functions

                                                                                                                  - Source + Source diff --git a/docs/master/CaseClauseError.html b/docs/master/CaseClauseError.html index c55f70bcc..22814350e 100644 --- a/docs/master/CaseClauseError.html +++ b/docs/master/CaseClauseError.html @@ -29,7 +29,7 @@

                                                                                                                  - Source + Source @@ -71,7 +71,7 @@

                                                                                                                  Functions

                                                                                                                  - Source + Source diff --git a/docs/master/Code.html b/docs/master/Code.html index 350120b65..fedbf456b 100644 --- a/docs/master/Code.html +++ b/docs/master/Code.html @@ -97,12 +97,12 @@

                                                                                                                  Functions summary

                                                                                                                • - eval/3 + eval_quoted/3
                                                                                                                • - eval_quoted/3 + eval_string/3
                                                                                                                • @@ -170,7 +170,7 @@

                                                                                                                  Functions

                                                                                                                  binary.

                                                                                                                  - Source + Source

                                                                                                                  @@ -183,7 +183,7 @@

                                                                                                                  Functions

                                                                                                                  For compiling many files at once, check Kernel.ParallelCompiler.

                                                                                                                  - Source + Source

                                                                                                                  @@ -193,7 +193,7 @@

                                                                                                                  Functions

                                                                                                                  Check compiler_options/1 for more information.

                                                                                                                  - Source + Source

                                                                                                                  @@ -215,7 +215,7 @@

                                                                                                                  Functions

                                                                                                                - Source + Source

                                                                                                                @@ -244,7 +244,7 @@

                                                                                                                Functions

                                                                                                                and when to use ensure_loaded/1 or ensure_compiled/1.

                                                                                                                - Source + Source

                                                                                                                @@ -254,7 +254,7 @@

                                                                                                                Functions

                                                                                                                it could be ensured or not.

                                                                                                                - Source + Source

                                                                                                                @@ -298,7 +298,7 @@

                                                                                                                Code.ensure_compiled

                                                                                                                that needs to invoke a module for callback information.

                                                                                                                - Source + Source

                                                                                                                @@ -308,11 +308,38 @@

                                                                                                                Code.ensure_compiled

                                                                                                                it could be ensured or not.

                                                                                                                - Source + Source + +
                                                                                                                +

                                                                                                                + eval_quoted(quoted, binding // [], opts // []) +

                                                                                                                +

                                                                                                                Evalutes the quoted contents.

                                                                                                                + +

                                                                                                                This function accepts a list of environment options. +Check Code.eval_string for more information.

                                                                                                                + +

                                                                                                                Examples

                                                                                                                + +
                                                                                                                iex> contents = quote(hygiene: [vars: false], do: a + b)
                                                                                                                +...> Code.eval_quoted(contents, [a: 1, b: 2], file: __ENV__.file, line: __ENV__.line)
                                                                                                                +{ 3, [ {:a, 1}, {:b, 2} ] }
                                                                                                                +
                                                                                                                + +

                                                                                                                For convenience, you can my pass __ENV__ as argument and +all options will be automatically extracted from the environment:

                                                                                                                + +
                                                                                                                iex> contents = quote(hygiene: [vars: false], do: a + b)
                                                                                                                +...> Code.eval_quoted(contents, [a: 1, b: 2], __ENV__)
                                                                                                                +{ 3, [ {:a, 1}, {:b, 2} ] }
                                                                                                                +
                                                                                                                +
                                                                                                                + + Source
                                                                                                                -

                                                                                                                - eval(string, binding // [], opts // []) +

                                                                                                                + eval_string(string, binding // [], opts // [])

                                                                                                                Evalutes the contents given by string. The second argument is the binding (which should be a keyword) followed by a keyword list of @@ -344,7 +371,7 @@

                                                                                                                Code.ensure_compiled

                                                                                                                Examples

                                                                                                                -
                                                                                                                iex> Code.eval "a + b", [a: 1, b: 2], file: __ENV__.file, line: __ENV__.line
                                                                                                                +
                                                                                                                iex> Code.eval_string("a + b", [a: 1, b: 2], file: __ENV__.file, line: __ENV__.line)
                                                                                                                 { 3, [ {:a, 1}, {:b, 2} ] }
                                                                                                                 
                                                                                                                @@ -352,39 +379,12 @@

                                                                                                                Examples

                                                                                                                all imports, requires and aliases will be automatically carried over:

                                                                                                                -
                                                                                                                iex> Code.eval "a + b", [a: 1, b: 2], __ENV__
                                                                                                                -{ 3, [ {:a, 1}, {:b, 2} ] }
                                                                                                                -
                                                                                                                -
                                                                                                                - - Source - -
                                                                                                                -

                                                                                                                - eval_quoted(quoted, binding // [], opts // []) -

                                                                                                                -

                                                                                                                Evalutes the quoted contents.

                                                                                                                - -

                                                                                                                This function accepts a list of environment options. -Check Code.eval for more information.

                                                                                                                - -

                                                                                                                Examples

                                                                                                                - -
                                                                                                                iex> contents = quote hygiene: [vars: false], do: a + b
                                                                                                                -...> Code.eval_quoted contents, [a: 1, b: 2], file: __ENV__.file, line: __ENV__.line
                                                                                                                -{ 3, [ {:a, 1}, {:b, 2} ] }
                                                                                                                -
                                                                                                                - -

                                                                                                                For convenience, you can my pass __ENV__ as argument and -all options will be automatically extracted from the environment:

                                                                                                                - -
                                                                                                                iex> contents = quote hygiene: [vars: false], do: a + b
                                                                                                                -...> Code.eval_quoted contents, [a: 1, b: 2], __ENV__
                                                                                                                +
                                                                                                                iex> Code.eval_string("a + b", [a: 1, b: 2], __ENV__)
                                                                                                                 { 3, [ {:a, 1}, {:b, 2} ] }
                                                                                                                 
                                                                                                                - Source + Source

                                                                                                                @@ -402,7 +402,7 @@

                                                                                                                Examples

                                                                                                                require_file if you don't want a file to be loaded concurrently.

                                                                                                                - Source + Source

                                                                                                                @@ -427,20 +427,20 @@

                                                                                                                Examples

                                                                                                                require_file(file, relative_to // nil)

                                                                                                                -

                                                                                                                Requires the given file. Accepts relative_to as an argument -to tell where the file is located. If the file was already -required/loaded, loads it again. It returns all the modules -defined in the file.

                                                                                                                +

                                                                                                                Requires the given file. Accepts relative_to as an argument to tell where +the file is located. It returns all the modules defined in the file. If the +file was already required/loaded, doesn't do anything and returns nil.

                                                                                                                -

                                                                                                                Notice that if require_file is invoked by different processes -concurrently, the first process to invoke require_file acquires -a lock and the remaining ones will block until the file is -available. I.e. if require_file is called N times with a given -file, the given file will be loaded only once. Check load_file -if you want a file to be loaded concurrently.

                                                                                                                +

                                                                                                                Notice that if require_file is invoked by different processes concurrently, +the first process to invoke require_file acquires a lock and the remaining +ones will block until the file is available. I.e. if require_file is called +N times with a given file, it will be loaded only once. The first process to +call require_file will get the list of loaded modules, others will get nil.

                                                                                                                + +

                                                                                                                Check load_file if you want a file to be loaded concurrently.

                                                                                                                - Source + Source

                                                                                                                @@ -458,9 +458,15 @@

                                                                                                                Options

                                                                                                              • :existing_atoms_only - When true, raises an error when non-existing atoms are found by the tokenizer.

                                                                                                              + +

                                                                                                              Macro.to_binary/1

                                                                                                              + +

                                                                                                              The opposite of converting a string to its AST is +Macro.to_binary, which converts a AST to a binary +representation.

                                                                                                              - Source + Source

                                                                                                              @@ -474,7 +480,7 @@

                                                                                                              Options

                                                                                                              Check Code.string_to_ast/2 for options information.

                                                                                                              - Source + Source

                                                                                                              diff --git a/docs/master/CompileError.html b/docs/master/CompileError.html index 18c9dbc33..60f4bca8d 100644 --- a/docs/master/CompileError.html +++ b/docs/master/CompileError.html @@ -29,7 +29,7 @@

                                                                                                              - Source + Source @@ -83,7 +83,7 @@

                                                                                                              Functions

                                                                                                              - Source + Source
                                                                                                              diff --git a/docs/master/Dict.html b/docs/master/Dict.html index 734ed8134..b5c59aa0f 100644 --- a/docs/master/Dict.html +++ b/docs/master/Dict.html @@ -55,16 +55,16 @@

                                                                                                              Protocols

                                                                                                              protocol:

                                                                                                              iex> dict = HashDict.new
                                                                                                              -...> dict = Dict.put dict, :hello, :world
                                                                                                              +...> dict = Dict.put(dict, :hello, :world)
                                                                                                               ...> dict[:hello]
                                                                                                               :world
                                                                                                               

                                                                                                              And also the Enum.Iterator protocol, allowing one to write:

                                                                                                              -
                                                                                                              Enum.each dict, fn { k, v } ->
                                                                                                              +
                                                                                                              Enum.each(dict, fn ({ k, v }) ->
                                                                                                                 IO.puts "#{k}: #{v}"
                                                                                                              -end
                                                                                                              +end)
                                                                                                               
                                                                                                              @@ -84,6 +84,11 @@

                                                                                                              Functions summary

                                                                                                              delete/2
                                                                                                            • +
                                                                                                            • + + drop/2 + +
                                                                                                            • empty/1 @@ -91,12 +96,22 @@

                                                                                                              Functions summary

                                                                                                            • - get/3 + equal?/2
                                                                                                            • - get!/2 + fetch/2 + +
                                                                                                            • +
                                                                                                            • + + fetch!/2 + +
                                                                                                            • +
                                                                                                            • + + get/3
                                                                                                            • @@ -119,6 +134,11 @@

                                                                                                              Functions summary

                                                                                                              merge/3
                                                                                                            • +
                                                                                                            • + + pop/3 + +
                                                                                                            • put/3 @@ -134,6 +154,16 @@

                                                                                                              Functions summary

                                                                                                              size/1
                                                                                                            • +
                                                                                                            • + + split/2 + +
                                                                                                            • +
                                                                                                            • + + take/2 + +
                                                                                                            • to_list/1 @@ -183,6 +213,16 @@

                                                                                                              Callbacks summary

                                                                                                              to_list/1
                                                                                                            • +
                                                                                                            • + + take/2 + +
                                                                                                            • +
                                                                                                            • + + split/2 + +
                                                                                                            • size/1 @@ -198,6 +238,16 @@

                                                                                                              Callbacks summary

                                                                                                              put/3
                                                                                                            • +
                                                                                                            • + + pop/3 + +
                                                                                                            • +
                                                                                                            • + + pop/2 + +
                                                                                                            • merge/3 @@ -233,11 +283,21 @@

                                                                                                              Callbacks summary

                                                                                                              get/2
                                                                                                            • +
                                                                                                            • + + equal?/2 + +
                                                                                                            • empty/1
                                                                                                            • +
                                                                                                            • + + drop/2 + +
                                                                                                            • delete/2 @@ -259,18 +319,41 @@

                                                                                                              Functions

                                                                                                              Examples

                                                                                                              -
                                                                                                              iex> d = HashDict.new [a: 1, b: 2]
                                                                                                              -...> d = Dict.delete d, :a
                                                                                                              -...> Dict.get d, :a
                                                                                                              +
                                                                                                              iex> d = HashDict.new([a: 1, b: 2])
                                                                                                              +...> d = Dict.delete(d, :a)
                                                                                                              +...> Dict.get(d, :a)
                                                                                                               nil
                                                                                                               
                                                                                                              -iex> d = HashDict.new [b: 2]
                                                                                                              +iex> d = HashDict.new([b: 2])
                                                                                                               ...> Dict.delete(d, :a) == d
                                                                                                               true
                                                                                                               
                                                                                                              - Source + Source + +
                                                                                                              +

                                                                                                              + drop(dict, keys) +

                                                                                                              +

                                                                                                              Returns a new dict where the the given keys a removed from dict. +Any non-member keys are ignored.

                                                                                                              + +

                                                                                                              Examples

                                                                                                              + +
                                                                                                              iex> d = HashDict.new([a: 1, b: 2])
                                                                                                              +...> d = Dict.drop(d, [:a, :c, :d])
                                                                                                              +...> Dict.to_list(d)
                                                                                                              +[b: 2]
                                                                                                              +
                                                                                                              +iex> d = HashDict.new([a: 1, b: 2])
                                                                                                              +...> d = Dict.drop(d, [:c, :d])
                                                                                                              +...> Dict.to_list(d)
                                                                                                              +[a: 1, b: 2]
                                                                                                              +
                                                                                                              +
                                                                                                              + + Source

                                                                                                              @@ -279,52 +362,96 @@

                                                                                                              Examples

                                                                                                              Returns an empty dict of the same type as dict.

                                                                                                              - Source + Source
                                                                                                              -

                                                                                                              - get(dict, key, default // nil) +

                                                                                                              + equal?(a, b)

                                                                                                              -

                                                                                                              Returns the value associated with key in dict. If dict does not -contain key, returns default (or nil if not provided).

                                                                                                              +

                                                                                                              Check if two dicts are equal, if the dicts are of different types they're +first converted to lists.

                                                                                                              Examples

                                                                                                              -
                                                                                                              iex> d = HashDict.new [a: 1]
                                                                                                              -...> Dict.get d, :a
                                                                                                              -1
                                                                                                              +
                                                                                                              iex> a = HashDict.new(a: 2, b: 3, f: 5, c: 123)
                                                                                                              +...> b = ListDict.new(a: 2, b: 3, f: 5, c: 123)
                                                                                                              +...> Dict.equal?(a, b)
                                                                                                              +true
                                                                                                               
                                                                                                              -iex> d = HashDict.new [a: 1]
                                                                                                              -...> Dict.get d, :b
                                                                                                              -nil
                                                                                                              +iex> a = HashDict.new(a: 2, b: 3, f: 5, c: 123)
                                                                                                              +...> b = []
                                                                                                              +...> Dict.equal?(a, b)
                                                                                                              +false
                                                                                                              +
                                                                                                              +
                                                                                                              + + Source + +
                                                                                                              +

                                                                                                              + fetch(dict, key) +

                                                                                                              +

                                                                                                              Returns the { :ok, value } associated with key in dict. +If dict does not contain key, returns :error.

                                                                                                              -iex> d = HashDict.new [a: 1] -...> Dict.get d, :b, 3 -3 +

                                                                                                              Examples

                                                                                                              + +
                                                                                                              iex> d = HashDict.new([a: 1])
                                                                                                              +...> Dict.fetch(d, :a)
                                                                                                              +{ :ok, 1 }
                                                                                                              +
                                                                                                              +iex> d = HashDict.new([a: 1])
                                                                                                              +...> Dict.fetch(d, :b)
                                                                                                              +:error
                                                                                                               
                                                                                                              - Source + Source
                                                                                                              -

                                                                                                              - get!(dict, key) +

                                                                                                              + fetch!(dict, key)

                                                                                                              Returns the value associated with key in dict. If dict does not contain key, it raises KeyError.

                                                                                                              Examples

                                                                                                              -
                                                                                                              iex> d = HashDict.new [a: 1]
                                                                                                              -...> Dict.get d, :a
                                                                                                              +
                                                                                                              iex> d = HashDict.new([a: 1])
                                                                                                              +...> Dict.fetch!(d, :a)
                                                                                                               1
                                                                                                              -iex> d = HashDict.new [a: 1]
                                                                                                              -...> Dict.get! d, :b
                                                                                                              +iex> d = HashDict.new([a: 1])
                                                                                                              +...> Dict.fetch!(d, :b)
                                                                                                               ** (KeyError) key not found: :b
                                                                                                               
                                                                                                              - Source + Source + +
                                                                                                              +

                                                                                                              + get(dict, key, default // nil) +

                                                                                                              +

                                                                                                              Returns the value associated with key in dict. If dict does not +contain key, returns default (or nil if not provided).

                                                                                                              + +

                                                                                                              Examples

                                                                                                              + +
                                                                                                              iex> d = HashDict.new([a: 1])
                                                                                                              +...> Dict.get(d, :a)
                                                                                                              +1
                                                                                                              +
                                                                                                              +iex> d = HashDict.new([a: 1])
                                                                                                              +...> Dict.get(d, :b)
                                                                                                              +nil
                                                                                                              +
                                                                                                              +iex> d = HashDict.new([a: 1])
                                                                                                              +...> Dict.get(d, :b, 3)
                                                                                                              +3
                                                                                                              +
                                                                                                              +
                                                                                                              + + Source

                                                                                                              @@ -334,17 +461,17 @@

                                                                                                              Examples

                                                                                                              Examples

                                                                                                              -
                                                                                                              iex> d = HashDict.new [a: 1]
                                                                                                              +
                                                                                                              iex> d = HashDict.new([a: 1])
                                                                                                               ...> Dict.has_key?(d, :a)
                                                                                                               true
                                                                                                               
                                                                                                              -iex> d = HashDict.new [a: 1]
                                                                                                              +iex> d = HashDict.new([a: 1])
                                                                                                               ...> Dict.has_key?(d, :b)
                                                                                                               false
                                                                                                               
                                                                                                              - Source + Source

                                                                                                              @@ -356,13 +483,13 @@

                                                                                                              Examples

                                                                                                              Examples

                                                                                                              -
                                                                                                              iex> d = HashDict.new [a: 1, b: 2]
                                                                                                              -...> Enum.sort Dict.keys d
                                                                                                              +
                                                                                                              iex> d = HashDict.new([a: 1, b: 2])
                                                                                                              +...> Enum.sort(Dict.keys(d))
                                                                                                               [:a,:b]
                                                                                                               
                                                                                                              - Source + Source

                                                                                                              @@ -373,15 +500,15 @@

                                                                                                              Examples

                                                                                                              Examples

                                                                                                              -
                                                                                                              iex> d1 = HashDict.new [a: 1, b: 2]
                                                                                                              -...> d2 = HashDict.new [a: 3, d: 4]
                                                                                                              -...> d = Dict.merge d1, d2
                                                                                                              +
                                                                                                              iex> d1 = HashDict.new([a: 1, b: 2])
                                                                                                              +...> d2 = HashDict.new([a: 3, d: 4])
                                                                                                              +...> d = Dict.merge(d1, d2)
                                                                                                               ...> [a: Dict.get(d, :a), b: Dict.get(d, :b), d: Dict.get(d, :d)]
                                                                                                               [a: 3, b: 2, d: 4]
                                                                                                               
                                                                                                              - Source + Source

                                                                                                              @@ -393,17 +520,45 @@

                                                                                                              Examples

                                                                                                              Examples

                                                                                                              -
                                                                                                              iex> d1 = HashDict.new [a: 1, b: 2]
                                                                                                              -...> d2 = HashDict.new [a: 3, d: 4]
                                                                                                              -...> d = Dict.merge d1, d2, fn _k, v1, v2 ->
                                                                                                              +
                                                                                                              iex> d1 = HashDict.new([a: 1, b: 2])
                                                                                                              +...> d2 = HashDict.new([a: 3, d: 4])
                                                                                                              +...> d = Dict.merge(d1, d2, fn(_k, v1, v2) ->
                                                                                                               ...>   v1 + v2
                                                                                                              -...> end
                                                                                                              +...> end)
                                                                                                               ...> [a: Dict.get(d, :a), b: Dict.get(d, :b), d: Dict.get(d, :d)]
                                                                                                               [a: 4, b: 2, d: 4]
                                                                                                               
                                                                                                              - Source + Source + +
                                                                                                              +

                                                                                                              + pop(dict, key, default // nil) +

                                                                                                              +

                                                                                                              Returns the value associated with key in dict as +well as the dict without key.

                                                                                                              + +

                                                                                                              Examples

                                                                                                              + +
                                                                                                              iex> dict = HashDict.new [a: 1]
                                                                                                              +...> {v, d} = Dict.pop dict, :a
                                                                                                              +...> {v, Enum.sort(d)}
                                                                                                              +{1,[]}
                                                                                                              +
                                                                                                              +iex> dict = HashDict.new [a: 1]
                                                                                                              +...> {v, d} = Dict.pop dict, :b
                                                                                                              +...> {v, Enum.sort(d)}
                                                                                                              +{nil,[a: 1]}
                                                                                                              +
                                                                                                              +iex> dict = HashDict.new [a: 1]
                                                                                                              +...> {v, d} = Dict.pop dict, :b, 3
                                                                                                              +...> {v, Enum.sort(d)}
                                                                                                              +{3,[a: 1]}
                                                                                                              +
                                                                                                              +
                                                                                                              + + Source

                                                                                                              @@ -414,14 +569,14 @@

                                                                                                              Examples

                                                                                                              Examples

                                                                                                              -
                                                                                                              iex> d = HashDict.new [a: 1, b: 2]
                                                                                                              -...> d = Dict.put d, :a, 3
                                                                                                              -...> Dict.get d, :a
                                                                                                              +
                                                                                                              iex> d = HashDict.new([a: 1, b: 2])
                                                                                                              +...> d = Dict.put(d, :a, 3)
                                                                                                              +...> Dict.get(d, :a)
                                                                                                               3
                                                                                                               
                                                                                                              - Source + Source

                                                                                                              @@ -431,14 +586,14 @@

                                                                                                              Examples

                                                                                                              Examples

                                                                                                              -
                                                                                                              iex> d = HashDict.new [a: 1, b: 2]
                                                                                                              -...> d = Dict.put_new d, :a, 3
                                                                                                              -...> Dict.get d, :a
                                                                                                              +
                                                                                                              iex> d = HashDict.new([a: 1, b: 2])
                                                                                                              +...> d = Dict.put_new(d, :a, 3)
                                                                                                              +...> Dict.get(d, :a)
                                                                                                               1
                                                                                                               
                                                                                                              - Source + Source

                                                                                                              @@ -448,13 +603,67 @@

                                                                                                              Examples

                                                                                                              Examples

                                                                                                              -
                                                                                                              iex> d = HashDict.new [a: 1, b: 2]
                                                                                                              -...> Dict.size d
                                                                                                              +
                                                                                                              iex> d = HashDict.new([a: 1, b: 2])
                                                                                                              +...> Dict.size(d)
                                                                                                               2
                                                                                                               
                                                                                                              - Source + Source + +
                                                                                                              +

                                                                                                              + split(dict, keys) +

                                                                                                              +

                                                                                                              Returns a tuple of two dicts, where the first dict contains only +entries from dict with keys in keys, and the second dict +contains only entries from dict with keys not in keys

                                                                                                              + +

                                                                                                              Any non-member keys are ignored.

                                                                                                              + +

                                                                                                              Examples

                                                                                                              + +
                                                                                                              iex> d = HashDict.new([a: 1, b: 2])
                                                                                                              +...> { d1, d2 } = Dict.split(d, [:a, :c])
                                                                                                              +...> { Dict.to_list(d1), Dict.to_list(d2) }
                                                                                                              +{ [a: 1], [b: 2] }
                                                                                                              +
                                                                                                              +iex> d = HashDict.new([])
                                                                                                              +...> { d1, d2 } = Dict.split(d, [:a, :c])
                                                                                                              +...> { Dict.to_list(d1), Dict.to_list(d2) }
                                                                                                              +{ [], [] }
                                                                                                              +
                                                                                                              +iex> d = HashDict.new([a: 1, b: 2])
                                                                                                              +...> { d1, d2 } = Dict.split(d, [:a, :b, :c])
                                                                                                              +...> { Dict.to_list(d1), Dict.to_list(d2) }
                                                                                                              +{ [a: 1, b: 2], [] }
                                                                                                              +
                                                                                                              +
                                                                                                              + + Source + +
                                                                                                              +

                                                                                                              + take(dict, keys) +

                                                                                                              +

                                                                                                              Returns a new dict where only the keys in keys from dict are +included. Any non-member keys are ignored.

                                                                                                              + +

                                                                                                              Examples

                                                                                                              + +
                                                                                                              iex> d = HashDict.new([a: 1, b: 2])
                                                                                                              +...> d = Dict.take(d, [:a, :c, :d])
                                                                                                              +...> Dict.to_list(d)
                                                                                                              +[a: 1]
                                                                                                              +
                                                                                                              +iex> d = HashDict.new([a: 1, b: 2])
                                                                                                              +...> d = Dict.take(d, [:c, :d])
                                                                                                              +...> Dict.to_list(d)
                                                                                                              +[]
                                                                                                              +
                                                                                                              +
                                                                                                              + + Source

                                                                                                              @@ -464,7 +673,7 @@

                                                                                                              Examples

                                                                                                              No particular order is enforced.

                                                                                                              - Source + Source

                                                                                                              @@ -475,14 +684,14 @@

                                                                                                              Examples

                                                                                                              Examples

                                                                                                              -
                                                                                                              iex> d = HashDict.new [a: 1, b: 2]
                                                                                                              -...> d = Dict.update d, :a, fn val -> -val end
                                                                                                              -...> Dict.get d, :a
                                                                                                              +
                                                                                                              iex> d = HashDict.new([a: 1, b: 2])
                                                                                                              +...> d = Dict.update(d, :a, fn(val) -> -val end)
                                                                                                              +...> Dict.get(d, :a)
                                                                                                               -1
                                                                                                               
                                                                                                              - Source + Source

                                                                                                              @@ -494,14 +703,14 @@

                                                                                                              Examples

                                                                                                              Examples

                                                                                                              -
                                                                                                              iex> d = HashDict.new [a: 1, b: 2]
                                                                                                              -...> d = Dict.update d, :c, 3, fn val -> -val end
                                                                                                              -...> Dict.get d, :c
                                                                                                              +
                                                                                                              iex> d = HashDict.new([a: 1, b: 2])
                                                                                                              +...> d = Dict.update(d, :c, 3, fn(val) -> -val end)
                                                                                                              +...> Dict.get(d, :c)
                                                                                                               3
                                                                                                               
                                                                                                              - Source + Source

                                                                                                              @@ -511,13 +720,13 @@

                                                                                                              Examples

                                                                                                              Examples

                                                                                                              -
                                                                                                              iex> d = HashDict.new [a: 1, b: 2]
                                                                                                              -...> Enum.sort Dict.values d
                                                                                                              +
                                                                                                              iex> d = HashDict.new([a: 1, b: 2])
                                                                                                              +...> Enum.sort(Dict.values(d))
                                                                                                               [1,2]
                                                                                                               
                                                                                                              - Source + Source @@ -534,7 +743,7 @@

                                                                                                              Callbacks

                                                                                                              - Source + Source

                                                                                                              @@ -542,7 +751,7 @@

                                                                                                              Callbacks

                                                                                                              - Source + Source

                                                                                                              @@ -550,7 +759,7 @@

                                                                                                              Callbacks

                                                                                                              - Source + Source

                                                                                                              @@ -558,7 +767,23 @@

                                                                                                              Callbacks

                                                                                                              - Source + Source + +
                                                                                                              +

                                                                                                              + take(t(), keys()) +

                                                                                                              +
                                                                                                              + + Source + +
                                                                                                              +

                                                                                                              + split(t(), keys()) +

                                                                                                              +
                                                                                                              + + Source

                                                                                                              @@ -566,7 +791,7 @@

                                                                                                              Callbacks

                                                                                                              - Source + Source

                                                                                                              @@ -574,7 +799,7 @@

                                                                                                              Callbacks

                                                                                                              - Source + Source

                                                                                                              @@ -582,7 +807,23 @@

                                                                                                              Callbacks

                                                                                                              - Source + Source + +
                                                                                                              +

                                                                                                              + pop(t(), key(), value()) +

                                                                                                              +
                                                                                                              + + Source + +
                                                                                                              +

                                                                                                              + pop(t(), key()) +

                                                                                                              +
                                                                                                              + + Source

                                                                                                              @@ -590,7 +831,7 @@

                                                                                                              Callbacks

                                                                                                              - Source + Source

                                                                                                              @@ -598,7 +839,7 @@

                                                                                                              Callbacks

                                                                                                              - Source + Source

                                                                                                              @@ -606,7 +847,7 @@

                                                                                                              Callbacks

                                                                                                              - Source + Source

                                                                                                              @@ -614,7 +855,7 @@

                                                                                                              Callbacks

                                                                                                              - Source + Source

                                                                                                              @@ -622,7 +863,7 @@

                                                                                                              Callbacks

                                                                                                              - Source + Source

                                                                                                              @@ -630,7 +871,7 @@

                                                                                                              Callbacks

                                                                                                              - Source + Source

                                                                                                              @@ -638,7 +879,15 @@

                                                                                                              Callbacks

                                                                                                              - Source + Source + +
                                                                                                              +

                                                                                                              + equal?(t(), t()) +

                                                                                                              +
                                                                                                              + + Source

                                                                                                              @@ -646,7 +895,15 @@

                                                                                                              Callbacks

                                                                                                              - Source + Source + +
                                                                                                              +

                                                                                                              + drop(t(), keys()) +

                                                                                                              +
                                                                                                              + + Source

                                                                                                              @@ -654,7 +911,7 @@

                                                                                                              Callbacks

                                                                                                              - Source + Source
                                                                                                              diff --git a/docs/master/Enum.EmptyError.html b/docs/master/Enum.EmptyError.html new file mode 100644 index 000000000..44942b6ea --- /dev/null +++ b/docs/master/Enum.EmptyError.html @@ -0,0 +1,62 @@ + + + + Enum.EmptyError + + + + + + + + + + + + +
                                                                                                              +

                                                                                                              + Enum.EmptyError + + exception + +

                                                                                                              + + + + Source + + + + +

                                                                                                              Fields (and defaults)

                                                                                                              +
                                                                                                                + +
                                                                                                              • + + message: "empty error" + +
                                                                                                              • + +
                                                                                                              + + + + + + + + + + + + + +
                                                                                                              + + diff --git a/docs/master/Enum.Iterator.Function.html b/docs/master/Enum.Iterator.Function.html index a45c90549..5fba98066 100644 --- a/docs/master/Enum.Iterator.Function.html +++ b/docs/master/Enum.Iterator.Function.html @@ -29,7 +29,7 @@

                                                                                                              - Source + Source @@ -48,6 +48,11 @@

                                                                                                              Functions summary

                                                                                                              iterator/1
                                                                                                            • +
                                                                                                            • + + member?/2 + +
                                                                                                            @@ -65,7 +70,7 @@

                                                                                                            Functions

                                                                                                            - Source + Source

                                                                                                            @@ -73,7 +78,15 @@

                                                                                                            Functions

                                                                                                            - Source + Source + +
                                                                                                            +

                                                                                                            + member?(function, value) +

                                                                                                            +
                                                                                                            + + Source
                                                                                                            diff --git a/docs/master/Enum.Iterator.HashDict.html b/docs/master/Enum.Iterator.HashDict.html index 4a5089a5e..af8b090f6 100644 --- a/docs/master/Enum.Iterator.HashDict.html +++ b/docs/master/Enum.Iterator.HashDict.html @@ -29,7 +29,7 @@

                                                                                                            - Source + Source @@ -48,6 +48,11 @@

                                                                                                            Functions summary

                                                                                                            iterator/1
                                                                                                          • +
                                                                                                          • + + member?/2 + +
                                                                                                          @@ -65,7 +70,7 @@

                                                                                                          Functions

                                                                                                          - Source + Source

                                                                                                          @@ -73,7 +78,15 @@

                                                                                                          Functions

                                                                                                          - Source + Source + +
                                                                                                          +

                                                                                                          + member?(dict, arg2) +

                                                                                                          +
                                                                                                          + + Source
                                                                                                          diff --git a/docs/master/Enum.Iterator.List.html b/docs/master/Enum.Iterator.List.html index 3a93fb259..3203c9205 100644 --- a/docs/master/Enum.Iterator.List.html +++ b/docs/master/Enum.Iterator.List.html @@ -29,7 +29,7 @@

                                                                                                          - Source + Source @@ -48,6 +48,11 @@

                                                                                                          Functions summary

                                                                                                          iterator/1
                                                                                                        • +
                                                                                                        • + + member?/2 + +
                                                                                                        @@ -65,7 +70,7 @@

                                                                                                        Functions

                                                                                                        - Source + Source

                                                                                                        @@ -73,7 +78,15 @@

                                                                                                        Functions

                                                                                                        - Source + Source + +
                                                                                                        +

                                                                                                        + member?(list, value) +

                                                                                                        +
                                                                                                        + + Source
                                                                                                        diff --git a/docs/master/Enum.Iterator.Range.html b/docs/master/Enum.Iterator.Range.html index 97b766cc0..1269e34da 100644 --- a/docs/master/Enum.Iterator.Range.html +++ b/docs/master/Enum.Iterator.Range.html @@ -48,6 +48,11 @@

                                                                                                        Functions summary

                                                                                                        iterator/1
                                                                                                      • +
                                                                                                      • + + member?/2 + +
                                                                                                      @@ -65,7 +70,7 @@

                                                                                                      Functions

                                                                                                      - Source + Source

                                                                                                      @@ -75,6 +80,14 @@

                                                                                                      Functions

                                                                                                      Source +
                                                                                                      +

                                                                                                      + member?(arg1, value) +

                                                                                                      +
                                                                                                      + + Source +
                                                                                                      diff --git a/docs/master/Enum.Iterator.html b/docs/master/Enum.Iterator.html index a543dd0e2..77af0d9ab 100644 --- a/docs/master/Enum.Iterator.html +++ b/docs/master/Enum.Iterator.html @@ -37,7 +37,7 @@

                                                                                                      For example, in the expression

                                                                                                      -
                                                                                                      Enum.map [1,2,3], &1 * 2
                                                                                                      +
                                                                                                      Enum.map([1,2,3], &1 * 2)
                                                                                                       

                                                                                                      Enum.map invokes Enum.Iterator.iterator([1,2,3]) to retrieve the iterator @@ -94,6 +94,11 @@

                                                                                                      Functions summary

                                                                                                      iterator/1

                                                                                                    • +
                                                                                                    • + + member?/2 + +
                                                                                                    @@ -112,7 +117,7 @@

                                                                                                    Functions

                                                                                                    The function used to retrieve the collection's size.

                                                                                                    - Source + Source

                                                                                                    @@ -151,6 +156,15 @@

                                                                                                    Iterating lists

                                                                                                    Source +
                                                                                                    +

                                                                                                    + member?(collection, value) +

                                                                                                    +

                                                                                                    The function used to check if a value exists within the collection.

                                                                                                    +
                                                                                                    + + Source +
                                                                                                    diff --git a/docs/master/Enum.OutOfBoundsError.html b/docs/master/Enum.OutOfBoundsError.html index 2e3de19ca..56a5dfa9b 100644 --- a/docs/master/Enum.OutOfBoundsError.html +++ b/docs/master/Enum.OutOfBoundsError.html @@ -29,7 +29,7 @@

                                                                                                    - Source + Source diff --git a/docs/master/Enum.html b/docs/master/Enum.html index ef65abe4a..ccce93eff 100644 --- a/docs/master/Enum.html +++ b/docs/master/Enum.html @@ -32,7 +32,7 @@

                                                                                                    flavours. If a given collection implements the mentioned protocol (like list, for instance), you can do:

                                                                                                    -
                                                                                                    Enum.map [1,2,3], fn(x) -> x * 2 end
                                                                                                    +
                                                                                                    Enum.map([1,2,3], fn(x) -> x * 2 end)
                                                                                                     

                                                                                                    Depending on the type of the collection, the user-provided function will @@ -42,7 +42,7 @@

                                                                                                    - Source + Source @@ -63,7 +63,7 @@

                                                                                                    Functions summary

                                                                                                  • - at!/2 + at/3
                                                                                                  • @@ -96,6 +96,16 @@

                                                                                                    Functions summary

                                                                                                    empty?/1
                                                                                                  • +
                                                                                                  • + + fetch/2 + +
                                                                                                  • +
                                                                                                  • + + fetch!/2 + +
                                                                                                  • filter/2 @@ -146,6 +156,31 @@

                                                                                                    Functions summary

                                                                                                    map_reduce/3
                                                                                                  • +
                                                                                                  • + + max/1 + +
                                                                                                  • +
                                                                                                  • + + max/2 + +
                                                                                                  • +
                                                                                                  • + + member?/2 + +
                                                                                                  • +
                                                                                                  • + + min/1 + +
                                                                                                  • +
                                                                                                  • + + min/2 + +
                                                                                                  • partition/2 @@ -193,7 +228,12 @@

                                                                                                    Functions summary

                                                                                                  • - uniq/1 + to_list/1 + +
                                                                                                  • +
                                                                                                  • + + uniq/2
                                                                                                  • @@ -222,24 +262,24 @@

                                                                                                    Functions

                                                                                                    Examples

                                                                                                    -
                                                                                                    iex> Enum.all? [2,4,6], fn(x) -> rem(x, 2) == 0 end
                                                                                                    +
                                                                                                    iex> Enum.all?([2,4,6], fn(x) -> rem(x, 2) == 0 end)
                                                                                                     true
                                                                                                     
                                                                                                    -iex> Enum.all? [2,3,4], fn(x) -> rem(x, 2) == 0 end
                                                                                                    +iex> Enum.all?([2,3,4], fn(x) -> rem(x, 2) == 0 end)
                                                                                                     false
                                                                                                     

                                                                                                    If no function is given, it defaults to checking if all items in the collection evaluate to true.

                                                                                                    -
                                                                                                    iex> Enum.all? [1,2,3]
                                                                                                    +
                                                                                                    iex> Enum.all?([1,2,3])
                                                                                                     true
                                                                                                    -iex> Enum.all? [1,nil,3]
                                                                                                    +iex> Enum.all?([1,nil,3])
                                                                                                     false
                                                                                                     
                                                                                                    - Source + Source

                                                                                                    @@ -250,28 +290,28 @@

                                                                                                    Examples

                                                                                                    Examples

                                                                                                    -
                                                                                                    iex> Enum.any? [2,4,6], fn(x) -> rem(x, 2) == 1 end
                                                                                                    +
                                                                                                    iex> Enum.any?([2,4,6], fn(x) -> rem(x, 2) == 1 end)
                                                                                                     false
                                                                                                     
                                                                                                    -iex> Enum.any? [2,3,4], fn(x) -> rem(x, 2) == 1 end
                                                                                                    +iex> Enum.any?([2,3,4], fn(x) -> rem(x, 2) == 1 end)
                                                                                                     true
                                                                                                     

                                                                                                    If no function is given, it defaults to checking if at least one item in the collection evaluates to true.

                                                                                                    -
                                                                                                    iex> Enum.any? [false,false,false]
                                                                                                    +
                                                                                                    iex> Enum.any?([false,false,false])
                                                                                                     false
                                                                                                    -iex> Enum.any? [false,true,false]
                                                                                                    +iex> Enum.any?([false,true,false])
                                                                                                     true
                                                                                                     
                                                                                                    - Source + Source
                                                                                                    -

                                                                                                    - at!(collection, n) +

                                                                                                    + at(collection, n, default // nil)

                                                                                                    Finds the element at the given index (zero-based). Raises out of bounds error in case the given position @@ -281,16 +321,18 @@

                                                                                                    Examples

                                                                                                    ## Examples

                                                                                                    -
                                                                                                      iex> Enum.at! [2,4,6], 0
                                                                                                    +
                                                                                                      iex> Enum.at([2,4,6], 0)
                                                                                                       2
                                                                                                    -  iex> Enum.at! [2,4,6], 2
                                                                                                    +  iex> Enum.at([2,4,6], 2)
                                                                                                       6
                                                                                                    -  iex> Enum.at! [2,4,6], 4
                                                                                                    -  ** (Enum.OutOfBoundsError) out of bounds error
                                                                                                    +  iex> Enum.at([2,4,6], 4)
                                                                                                    +  nil
                                                                                                    +  iex> Enum.at([2,4,6], 4, :none)
                                                                                                    +  :none
                                                                                                     
                                                                                                    - Source + Source

                                                                                                    @@ -300,12 +342,12 @@

                                                                                                    Examples

                                                                                                    Examples

                                                                                                    -
                                                                                                    iex> Enum.count [1,2,3]
                                                                                                    +
                                                                                                    iex> Enum.count([1,2,3])
                                                                                                     3
                                                                                                     
                                                                                                    - Source + Source

                                                                                                    @@ -314,7 +356,7 @@

                                                                                                    Examples

                                                                                                    Counts for how many items the function returns true.

                                                                                                    - Source + Source

                                                                                                    @@ -325,16 +367,16 @@

                                                                                                    Examples

                                                                                                    Examples

                                                                                                    -
                                                                                                    iex> Enum.drop [1,2,3], 2
                                                                                                    +
                                                                                                    iex> Enum.drop([1,2,3], 2)
                                                                                                     [3]
                                                                                                    -iex> Enum.drop [1,2,3], 10
                                                                                                    +iex> Enum.drop([1,2,3], 10)
                                                                                                     []
                                                                                                    -iex> Enum.drop [1,2,3], 0
                                                                                                    +iex> Enum.drop([1,2,3], 0)
                                                                                                     [1,2,3]
                                                                                                     
                                                                                                    - Source + Source

                                                                                                    @@ -345,12 +387,12 @@

                                                                                                    Examples

                                                                                                    Examples

                                                                                                    -
                                                                                                    iex> Enum.drop_while [1,2,3,4,5], fn(x) -> x < 3 end
                                                                                                    +
                                                                                                    iex> Enum.drop_while([1,2,3,4,5], fn(x) -> x < 3 end)
                                                                                                     [3,4,5]
                                                                                                     
                                                                                                    - Source + Source

                                                                                                    @@ -362,11 +404,11 @@

                                                                                                    Examples

                                                                                                    Examples

                                                                                                    -
                                                                                                    Enum.each ['some', 'example'], fn(x) -> IO.puts x end
                                                                                                    +
                                                                                                    Enum.each(['some', 'example'], fn(x) -> IO.puts x end)
                                                                                                     
                                                                                                    - Source + Source

                                                                                                    @@ -376,14 +418,57 @@

                                                                                                    Examples

                                                                                                    Examples

                                                                                                    -
                                                                                                    iex> Enum.empty? []
                                                                                                    +
                                                                                                    iex> Enum.empty?([])
                                                                                                     true
                                                                                                    -iex> Enum.empty? [1,2,3]
                                                                                                    +iex> Enum.empty?([1,2,3])
                                                                                                     false
                                                                                                     
                                                                                                    - Source + Source + +
                                                                                                    +

                                                                                                    + fetch(collection, n) +

                                                                                                    +

                                                                                                    Finds the element at the given index (zero-based). +Returns { :ok, element } if found, otherwise :error.

                                                                                                    + +

                                                                                                    Expects an ordered collection.

                                                                                                    + +

                                                                                                    ## Examples

                                                                                                    + +
                                                                                                      iex> Enum.fetch([2,4,6], 0)
                                                                                                    +  { :ok, 2 }
                                                                                                    +  iex> Enum.fetch([2,4,6], 2)
                                                                                                    +  { :ok, 6 }
                                                                                                    +  iex> Enum.fetch([2,4,6], 4)
                                                                                                    +  :error
                                                                                                    +
                                                                                                    +
                                                                                                    + + Source + +
                                                                                                    +

                                                                                                    + fetch!(collection, n) +

                                                                                                    +

                                                                                                    Finds the element at the given index (zero-based). +Raises out of bounds error in case the given position +is outside the range of the collection.

                                                                                                    + +

                                                                                                    Examples

                                                                                                    + +
                                                                                                    iex> Enum.fetch!([2,4,6], 0)
                                                                                                    +2
                                                                                                    +iex> Enum.fetch!([2,4,6], 2)
                                                                                                    +6
                                                                                                    +iex> Enum.fetch!([2,4,6], 4)
                                                                                                    +** (Enum.OutOfBoundsError) out of bounds error
                                                                                                    +
                                                                                                    +
                                                                                                    + + Source

                                                                                                    @@ -394,12 +479,12 @@

                                                                                                    Examples

                                                                                                    Examples

                                                                                                    -
                                                                                                    iex> Enum.filter [1, 2, 3], fn(x) -> rem(x, 2) == 0 end
                                                                                                    +
                                                                                                    iex> Enum.filter([1, 2, 3], fn(x) -> rem(x, 2) == 0 end)
                                                                                                     [2]
                                                                                                     
                                                                                                    - Source + Source

                                                                                                    @@ -409,12 +494,12 @@

                                                                                                    Examples

                                                                                                    Examples

                                                                                                    -
                                                                                                    iex> Enum.filter_map [1, 2, 3], fn(x) -> rem(x, 2) == 0 end, &1 * 2
                                                                                                    +
                                                                                                    iex> Enum.filter_map([1, 2, 3], fn(x) -> rem(x, 2) == 0 end, &1 * 2)
                                                                                                     [4]
                                                                                                     
                                                                                                    - Source + Source

                                                                                                    @@ -425,18 +510,18 @@

                                                                                                    Examples

                                                                                                    Examples

                                                                                                    -
                                                                                                    iex> Enum.find [2,4,6], fn(x) -> rem(x, 2) == 1 end
                                                                                                    +
                                                                                                    iex> Enum.find([2,4,6], fn(x) -> rem(x, 2) == 1 end)
                                                                                                     nil
                                                                                                     
                                                                                                    -iex> Enum.find [2,4,6], 0, fn(x) -> rem(x, 2) == 1 end
                                                                                                    +iex> Enum.find([2,4,6], 0, fn(x) -> rem(x, 2) == 1 end)
                                                                                                     0
                                                                                                     
                                                                                                    -iex> Enum.find [2,3,4], fn(x) -> rem(x, 2) == 1 end
                                                                                                    +iex> Enum.find([2,3,4], fn(x) -> rem(x, 2) == 1 end)
                                                                                                     3
                                                                                                     
                                                                                                    - Source + Source

                                                                                                    @@ -449,15 +534,15 @@

                                                                                                    Examples

                                                                                                    Examples

                                                                                                    -
                                                                                                    iex> Enum.find_index [2,4,6], fn(x) -> rem(x, 2) == 1 end
                                                                                                    +
                                                                                                    iex> Enum.find_index([2,4,6], fn(x) -> rem(x, 2) == 1 end)
                                                                                                     nil
                                                                                                     
                                                                                                    -iex> Enum.find_index [2,3,4], fn(x) -> rem(x, 2) == 1 end
                                                                                                    +iex> Enum.find_index([2,3,4], fn(x) -> rem(x, 2) == 1 end)
                                                                                                     1
                                                                                                     
                                                                                                    - Source + Source

                                                                                                    @@ -468,15 +553,15 @@

                                                                                                    Examples

                                                                                                    Examples

                                                                                                    -
                                                                                                    iex> Enum.find_value [2,4,6], fn(x) -> rem(x, 2) == 1 end
                                                                                                    +
                                                                                                    iex> Enum.find_value([2,4,6], fn(x) -> rem(x, 2) == 1 end)
                                                                                                     nil
                                                                                                     
                                                                                                    -iex> Enum.find_value [2,3,4], fn(x) -> rem(x, 2) == 1 end
                                                                                                    +iex> Enum.find_value([2,3,4], fn(x) -> rem(x, 2) == 1 end)
                                                                                                     true
                                                                                                     
                                                                                                    - Source + Source

                                                                                                    @@ -486,14 +571,14 @@

                                                                                                    Examples

                                                                                                    Examples

                                                                                                    -
                                                                                                    iex> Enum.first []
                                                                                                    +
                                                                                                    iex> Enum.first([])
                                                                                                     nil
                                                                                                    -iex> Enum.first [1,2,3]
                                                                                                    +iex> Enum.first([1,2,3])
                                                                                                     1
                                                                                                     
                                                                                                    - Source + Source

                                                                                                    @@ -519,7 +604,7 @@

                                                                                                    Examples

                                                                                                    - Source + Source

                                                                                                    @@ -534,15 +619,15 @@

                                                                                                    Examples

                                                                                                    Examples

                                                                                                    -
                                                                                                    iex> Enum.map [1, 2, 3], fn(x) -> x * 2 end
                                                                                                    +
                                                                                                    iex> Enum.map([1, 2, 3], fn(x) -> x * 2 end)
                                                                                                     [2, 4, 6]
                                                                                                     
                                                                                                    -iex> Enum.map [a: 1, b: 2], fn({k, v}) -> { k, -v } end
                                                                                                    +iex> Enum.map([a: 1, b: 2], fn({k, v}) -> { k, -v } end)
                                                                                                     [a: -1, b: -2]
                                                                                                     
                                                                                                    - Source + Source

                                                                                                    @@ -568,7 +653,7 @@

                                                                                                    Examples

                                                                                                    - Source + Source

                                                                                                    @@ -584,12 +669,93 @@

                                                                                                    Examples

                                                                                                    Examples

                                                                                                    -
                                                                                                    iex> Enum.map_reduce [1, 2, 3], 0, fn(x, acc) -> { x * 2, x + acc } end
                                                                                                    +
                                                                                                    iex> Enum.map_reduce([1, 2, 3], 0, fn(x, acc) -> { x * 2, x + acc } end)
                                                                                                     { [2, 4, 6], 6 }
                                                                                                     
                                                                                                    - Source + Source + +
                                                                                                    +

                                                                                                    + max(collection) +

                                                                                                    +

                                                                                                    Returns the maximum value. +Raises empty error in case the collection is empty.

                                                                                                    + +

                                                                                                    Examples

                                                                                                    + +
                                                                                                    iex> Enum.max([1,2,3])
                                                                                                    +3
                                                                                                    +
                                                                                                    +
                                                                                                    + + Source + +
                                                                                                    +

                                                                                                    + max(collection, fun) +

                                                                                                    +

                                                                                                    Returns the maximum value. +Raises empty error in case the collection is empty.

                                                                                                    + +

                                                                                                    Examples

                                                                                                    + +
                                                                                                    iex> Enum.max(["a", "aa", "aaa"], fn(x) -> String.length(x) end)
                                                                                                    +"aaa"
                                                                                                    +
                                                                                                    +
                                                                                                    + + Source + +
                                                                                                    +

                                                                                                    + member?(collection, value) +

                                                                                                    +

                                                                                                    Checks if the value exists within the collection.

                                                                                                    + +

                                                                                                    Examples

                                                                                                    + +
                                                                                                    iex> Enum.member?(1..10, 5)
                                                                                                    +true
                                                                                                    +iex> Enum.member?([:a, :b, :c], :d)
                                                                                                    +false
                                                                                                    +
                                                                                                    +
                                                                                                    + + Source + +
                                                                                                    +

                                                                                                    + min(collection) +

                                                                                                    +

                                                                                                    Returns the manimum value. +Raises empty error in case the collection is empty.

                                                                                                    + +

                                                                                                    Examples

                                                                                                    + +
                                                                                                    iex> Enum.min([1,2,3])
                                                                                                    +1
                                                                                                    +
                                                                                                    +
                                                                                                    + + Source + +
                                                                                                    +

                                                                                                    + min(collection, fun) +

                                                                                                    +

                                                                                                    Returns the manimum value. +Raises empty error in case the collection is empty.

                                                                                                    + +

                                                                                                    Examples

                                                                                                    + +
                                                                                                    iex> Enum.min(["a", "aa", "aaa"], fn(x) -> String.length(x) end)
                                                                                                    +"a"
                                                                                                    +
                                                                                                    +
                                                                                                    + + Source

                                                                                                    @@ -601,12 +767,12 @@

                                                                                                    Examples

                                                                                                    Examples

                                                                                                    -
                                                                                                    iex> Enum.partition [1, 2, 3], fn(x) -> rem(x, 2) == 0 end
                                                                                                    +
                                                                                                    iex> Enum.partition([1, 2, 3], fn(x) -> rem(x, 2) == 0 end)
                                                                                                     { [2], [1,3] }
                                                                                                     
                                                                                                    - Source + Source

                                                                                                    @@ -618,12 +784,12 @@

                                                                                                    Examples

                                                                                                    Examples

                                                                                                    -
                                                                                                    iex> Enum.reduce [1, 2, 3], 0, fn(x, acc) -> x + acc end
                                                                                                    +
                                                                                                    iex> Enum.reduce([1, 2, 3], 0, fn(x, acc) -> x + acc end)
                                                                                                     6
                                                                                                     
                                                                                                    - Source + Source

                                                                                                    @@ -633,42 +799,42 @@

                                                                                                    Examples

                                                                                                    Examples

                                                                                                    -
                                                                                                    iex> Enum.reverse [1, 2, 3]
                                                                                                    +
                                                                                                    iex> Enum.reverse([1, 2, 3])
                                                                                                     [3, 2, 1]
                                                                                                     
                                                                                                    - Source + Source

                                                                                                    sort(collection)

                                                                                                    -

                                                                                                    Sorts the collection using the merge sort algorithm.

                                                                                                    +

                                                                                                    Returns a sorted list of collection elements. Uses the merge sort algorithm.

                                                                                                    Examples

                                                                                                    -
                                                                                                    iex> Enum.sort [3,2,1]
                                                                                                    +
                                                                                                    iex> Enum.sort([3,2,1])
                                                                                                     [1,2,3]
                                                                                                     
                                                                                                    - Source + Source

                                                                                                    sort(collection, fun)

                                                                                                    -

                                                                                                    Sorts the collection using the merge sort algorithm.

                                                                                                    +

                                                                                                    Returns a sorted list of collection elements. Uses the merge sort algorithm.

                                                                                                    Examples

                                                                                                    -
                                                                                                    iex> Enum.sort [1,2,3], &1 > &2
                                                                                                    +
                                                                                                    iex> Enum.sort([1,2,3], &1 > &2)
                                                                                                     [3,2,1]
                                                                                                     
                                                                                                    - Source + Source

                                                                                                    @@ -685,20 +851,20 @@

                                                                                                    Examples

                                                                                                    Examples

                                                                                                    -
                                                                                                    iex> Enum.split [1,2,3], 2
                                                                                                    +
                                                                                                    iex> Enum.split([1,2,3], 2)
                                                                                                     { [1,2], [3] }
                                                                                                    -iex> Enum.split [1,2,3], 10
                                                                                                    +iex> Enum.split([1,2,3], 10)
                                                                                                     { [1,2,3], [] }
                                                                                                    -iex> Enum.split [1,2,3], 0
                                                                                                    +iex> Enum.split([1,2,3], 0)
                                                                                                     { [], [1,2,3] }
                                                                                                    -iex> Enum.split [1,2,3], -1
                                                                                                    +iex> Enum.split([1,2,3], -1)
                                                                                                     { [1,2], [3] }
                                                                                                    -iex> Enum.split [1,2,3], -5
                                                                                                    +iex> Enum.split([1,2,3], -5)
                                                                                                     { [], [1,2,3] }
                                                                                                     
                                                                                                    - Source + Source

                                                                                                    @@ -708,12 +874,12 @@

                                                                                                    Examples

                                                                                                    Examples

                                                                                                    -
                                                                                                    iex> Enum.split_while [1,2,3,4], fn(x) -> x < 3 end
                                                                                                    +
                                                                                                    iex> Enum.split_while([1,2,3,4], fn(x) -> x < 3 end)
                                                                                                     { [1, 2], [3, 4] }
                                                                                                     
                                                                                                    - Source + Source

                                                                                                    @@ -724,16 +890,16 @@

                                                                                                    Examples

                                                                                                    Examples

                                                                                                    -
                                                                                                    iex> Enum.take [1,2,3], 2
                                                                                                    +
                                                                                                    iex> Enum.take([1,2,3], 2)
                                                                                                     [1,2]
                                                                                                    -iex> Enum.take [1,2,3], 10
                                                                                                    +iex> Enum.take([1,2,3], 10)
                                                                                                     [1,2,3]
                                                                                                    -iex> Enum.take [1,2,3], 0
                                                                                                    +iex> Enum.take([1,2,3], 0)
                                                                                                     []
                                                                                                     
                                                                                                    - Source + Source

                                                                                                    @@ -744,27 +910,45 @@

                                                                                                    Examples

                                                                                                    Examples

                                                                                                    -
                                                                                                    iex> Enum.take_while [1,2,3], fn(x) -> x < 3 end
                                                                                                    +
                                                                                                    iex> Enum.take_while([1,2,3], fn(x) -> x < 3 end)
                                                                                                     [1, 2]
                                                                                                     
                                                                                                    - Source + Source + +
                                                                                                    +

                                                                                                    + to_list(collection) +

                                                                                                    +

                                                                                                    Convert collection to a list.

                                                                                                    + +

                                                                                                    Examples

                                                                                                    + +
                                                                                                    iex> Enum.to_list(1 .. 3)
                                                                                                    +[1, 2, 3]
                                                                                                    +
                                                                                                    +
                                                                                                    + + Source
                                                                                                    -

                                                                                                    - uniq(collection) +

                                                                                                    + uniq(collection, fun // fn x -> x end)

                                                                                                    Iterates the enumerable removing all duplicated items.

                                                                                                    Examples

                                                                                                    -
                                                                                                    iex> Enum.uniq [1,2,3,2,1]
                                                                                                    +
                                                                                                    iex> Enum.uniq([1,2,3,2,1])
                                                                                                     [1, 2, 3]
                                                                                                    +
                                                                                                    +iex> Enum.uniq([{1,:x}, {2,:y}, {1,:z}], fn {x,_} -> x end)
                                                                                                    +[{1,:x}, {2,:y}]
                                                                                                     
                                                                                                    - Source + Source

                                                                                                    @@ -776,7 +960,7 @@

                                                                                                    Examples

                                                                                                    values are filled with nil.

                                                                                                    - Source + Source diff --git a/docs/master/ErlangError.html b/docs/master/ErlangError.html index 5ac451a9d..db73413ca 100644 --- a/docs/master/ErlangError.html +++ b/docs/master/ErlangError.html @@ -29,7 +29,7 @@

                                                                                                    - Source + Source @@ -71,7 +71,7 @@

                                                                                                    Functions

                                                                                                    - Source + Source diff --git a/docs/master/ExUnit.Assertions.html b/docs/master/ExUnit.Assertions.html index d29879a3c..25700b23d 100644 --- a/docs/master/ExUnit.Assertions.html +++ b/docs/master/ExUnit.Assertions.html @@ -46,7 +46,7 @@

                                                                                                    - Source + Source @@ -169,7 +169,7 @@

                                                                                                    Examples

                                                                                                    - Source + Source

                                                                                                    @@ -185,7 +185,7 @@

                                                                                                    Examples

                                                                                                    - Source + Source

                                                                                                    @@ -200,7 +200,7 @@

                                                                                                    Examples

                                                                                                    - Source + Source

                                                                                                    @@ -217,7 +217,7 @@

                                                                                                    Examples

                                                                                                    - Source + Source

                                                                                                    @@ -234,7 +234,7 @@

                                                                                                    Examples

                                                                                                    - Source + Source

                                                                                                    @@ -248,7 +248,7 @@

                                                                                                    Examples

                                                                                                    - Source + Source

                                                                                                    @@ -263,7 +263,7 @@

                                                                                                    Examples

                                                                                                    - Source + Source

                                                                                                    @@ -278,7 +278,7 @@

                                                                                                    Examples

                                                                                                    - Source + Source @@ -306,7 +306,7 @@

                                                                                                    Examples

                                                                                                    - Source + Source

                                                                                                    @@ -333,7 +333,7 @@

                                                                                                    Examples

                                                                                                    - Source + Source

                                                                                                    @@ -357,7 +357,7 @@

                                                                                                    Examples

                                                                                                    - Source + Source

                                                                                                    @@ -372,7 +372,7 @@

                                                                                                    Examples

                                                                                                    - Source + Source

                                                                                                    @@ -387,7 +387,7 @@

                                                                                                    Examples

                                                                                                    - Source + Source

                                                                                                    @@ -402,7 +402,7 @@

                                                                                                    Examples

                                                                                                    - Source + Source

                                                                                                    @@ -419,7 +419,7 @@

                                                                                                    Examples

                                                                                                    - Source + Source

                                                                                                    @@ -441,7 +441,7 @@

                                                                                                    Examples

                                                                                                    - Source + Source

                                                                                                    @@ -459,7 +459,7 @@

                                                                                                    Examples

                                                                                                    - Source + Source diff --git a/docs/master/ExUnit.CLIFormatter.html b/docs/master/ExUnit.CLIFormatter.html index 73bfc9d70..8c8705987 100644 --- a/docs/master/ExUnit.CLIFormatter.html +++ b/docs/master/ExUnit.CLIFormatter.html @@ -79,7 +79,7 @@

                                                                                                    Functions summary

                                                                                                  • - suite_finished/2 + suite_finished/3
                                                                                                  • @@ -115,7 +115,7 @@

                                                                                                    Functions summary

                                                                                                    Functions

                                                                                                    - case_finished(_id, _test_case) + case_finished(id, test_case)

                                                                                                    @@ -170,8 +170,8 @@

                                                                                                    Functions

                                                                                                    Source
                                                                                                    -

                                                                                                    - suite_finished(id, ms) +

                                                                                                    + suite_finished(id, run_us, load_us)

                                                                                                    diff --git a/docs/master/ExUnit.Callbacks.html b/docs/master/ExUnit.Callbacks.html index 42ef085ee..2005171f1 100644 --- a/docs/master/ExUnit.Callbacks.html +++ b/docs/master/ExUnit.Callbacks.html @@ -113,9 +113,10 @@

                                                                                                    Macros

                                                                                                    _ end, block)

                                                                                                    -
                                                                                                    +

                                                                                                    Called before the start of each test.

                                                                                                    +
                                                                                                    - Source + Source

                                                                                                    @@ -123,9 +124,10 @@

                                                                                                    Macros

                                                                                                    _ end, block)

                                                                                                    -
                                                                                                    +

                                                                                                    Called before the start of a case.

                                                                                                    +
                                                                                                    - Source + Source

                                                                                                    @@ -133,9 +135,11 @@

                                                                                                    Macros

                                                                                                    _ end, block)

                                                                                                    -
                                                                                                    +

                                                                                                    Called after the finish of each test. Note that, if the test crasches with an exit +message teardown will not be run.

                                                                                                    +
                                                                                                    - Source + Source

                                                                                                    @@ -143,9 +147,10 @@

                                                                                                    Macros

                                                                                                    _ end, block)

                                                                                                    -
                                                                                                    +

                                                                                                    Called after the finish of each case.

                                                                                                    +
                                                                                                    - Source + Source
                                                                                                    diff --git a/docs/master/ExUnit.CaptureIO.html b/docs/master/ExUnit.CaptureIO.html new file mode 100644 index 000000000..81940c26e --- /dev/null +++ b/docs/master/ExUnit.CaptureIO.html @@ -0,0 +1,112 @@ + + + + ExUnit.CaptureIO + + + + + + + + + + + + +
                                                                                                    +

                                                                                                    + ExUnit.CaptureIO + +

                                                                                                    + + +
                                                                                                    +

                                                                                                    This module provides functionality to capture IO to test it. +The way to use this module is to import them into your module.

                                                                                                    + +

                                                                                                    Examples

                                                                                                    + +
                                                                                                    defmodule AssertionTest do
                                                                                                    +  use ExUnit.Case
                                                                                                    +
                                                                                                    +  import ExUnit.CaptureIO
                                                                                                    +
                                                                                                    +  test :example do
                                                                                                    +    assert capture_io(fn ->
                                                                                                    +      IO.puts "a"
                                                                                                    +    end) == "a\n"
                                                                                                    +  end
                                                                                                    +end
                                                                                                    +
                                                                                                    + +
                                                                                                    + + + Source + + + + + + +

                                                                                                    Functions summary

                                                                                                    + + + + + + + + +
                                                                                                    +

                                                                                                    Functions

                                                                                                    +
                                                                                                    +

                                                                                                    + capture_io(device // :stdio, fun) +

                                                                                                    +

                                                                                                    Captures IO. Returns nil in case of no output, +otherwise returns the binary which is captured outputs.

                                                                                                    + +

                                                                                                    By default, captureio replaces the groupleader (:stdio) +for the current process. However, the capturing of any other +named device like :stderr is also possible globally by +giving the registered device name explicitly as argument.

                                                                                                    + +

                                                                                                    The input is mocked to return :eof.

                                                                                                    + +

                                                                                                    Examples

                                                                                                    + +
                                                                                                    iex> capture_io(fn -> IO.write "josé" end) == "josé"
                                                                                                    +true
                                                                                                    +iex> capture_io(fn -> :ok end) == nil
                                                                                                    +true
                                                                                                    +iex> capture_io(:stderr, fn -> IO.write(:stderr, "josé") end) == "josé"
                                                                                                    +true
                                                                                                    +
                                                                                                    +
                                                                                                    + + Source + +
                                                                                                    +
                                                                                                    + + + + + +
                                                                                                    + + diff --git a/docs/master/ExUnit.ExpectationError.html b/docs/master/ExUnit.ExpectationError.html index 5a0996039..19c5d3c05 100644 --- a/docs/master/ExUnit.ExpectationError.html +++ b/docs/master/ExUnit.ExpectationError.html @@ -106,7 +106,7 @@

                                                                                                    Functions

                                                                                                    - Source + Source

                                                                                                    @@ -114,7 +114,7 @@

                                                                                                    Functions

                                                                                                    - Source + Source
                                                                                                    diff --git a/docs/master/ExUnit.Formatter.html b/docs/master/ExUnit.Formatter.html index 41fabf247..074c8119d 100644 --- a/docs/master/ExUnit.Formatter.html +++ b/docs/master/ExUnit.Formatter.html @@ -70,7 +70,7 @@

                                                                                                    Callbacks summary

                                                                                                  • - suite_finished/2 + suite_finished/3
                                                                                                  • @@ -91,19 +91,19 @@

                                                                                                    Callbacks summary

                                                                                                    Callbacks

                                                                                                    - test_finished(id(), test :: ExUnit.Test.t()) + test_finished(id(), test())

                                                                                                    - Source + Source

                                                                                                    - test_started(id(), test :: ExUnit.Test.t()) + test_started(id(), test())

                                                                                                    - Source + Source

                                                                                                    @@ -111,7 +111,7 @@

                                                                                                    Callbacks

                                                                                                    - Source + Source

                                                                                                    @@ -119,15 +119,15 @@

                                                                                                    Callbacks

                                                                                                    - Source + Source
                                                                                                    -

                                                                                                    - suite_finished(id(), miliseconds :: pos_integer()) +

                                                                                                    + suite_finished(id(), run_us(), load_us())

                                                                                                    - Source + Source

                                                                                                    @@ -135,7 +135,7 @@

                                                                                                    Callbacks

                                                                                                    - Source + Source
                                                                                                    diff --git a/docs/master/ExUnit.Test.html b/docs/master/ExUnit.Test.html index 534bebb47..513e7cf0f 100644 --- a/docs/master/ExUnit.Test.html +++ b/docs/master/ExUnit.Test.html @@ -62,6 +62,12 @@

                                                                                                    Fields (and defaults)

                                                                                                  • +
                                                                                                  • + + invalid: nil + +
                                                                                                  • +
                                                                                                  diff --git a/docs/master/ExUnit.TestCase.html b/docs/master/ExUnit.TestCase.html new file mode 100644 index 000000000..eb6c9923f --- /dev/null +++ b/docs/master/ExUnit.TestCase.html @@ -0,0 +1,75 @@ + + + + ExUnit.TestCase + + + + + + + + + + + + +
                                                                                                  +

                                                                                                  + ExUnit.TestCase + + record + +

                                                                                                  + + +
                                                                                                  +

                                                                                                  A record that keeps information about the test case. +It is received by formatters and also accessible +in the metadata under the key :case.

                                                                                                  + +
                                                                                                  + + + Source + + + + +

                                                                                                  Fields (and defaults)

                                                                                                  +
                                                                                                    + +
                                                                                                  • + + name: nil + +
                                                                                                  • + +
                                                                                                  • + + failure: nil + +
                                                                                                  • + +
                                                                                                  + + + + + + + + + + + + + +
                                                                                                  + + diff --git a/docs/master/ExUnit.html b/docs/master/ExUnit.html index c294b6abb..0a6116ea7 100644 --- a/docs/master/ExUnit.html +++ b/docs/master/ExUnit.html @@ -133,7 +133,7 @@

                                                                                                  Options

                                                                                                - Source + Source

                                                                                                @@ -145,7 +145,7 @@

                                                                                                Options

                                                                                                Returns the number of failures.

                                                                                                - Source + Source

                                                                                                @@ -159,7 +159,7 @@

                                                                                                Options

                                                                                                function and rely on configure/1 and run/0 instead.

                                                                                                - Source + Source

                                                                                                diff --git a/docs/master/Exception.html b/docs/master/Exception.html index b51468ef4..d5190bb8e 100644 --- a/docs/master/Exception.html +++ b/docs/master/Exception.html @@ -33,7 +33,7 @@

                                                                                                - Source + Source @@ -44,17 +44,17 @@

                                                                                                Functions summary

                                                                                                • - format_entry/2 + format_file_line/3
                                                                                                • - format_file_line/3 + format_stacktrace/1
                                                                                                • - format_stacktrace/1 + format_stacktrace_entry/2
                                                                                                • @@ -79,23 +79,12 @@

                                                                                                  Functions summary

                                                                                                  Functions

                                                                                                  -

                                                                                                  - format_entry(entry, cwd // nil) -

                                                                                                  -

                                                                                                  Receives a tuple representing a stacktrace entry and formats it. -The current working directory may be given as argument, which -is used to prettify the stacktrace.

                                                                                                  -
                                                                                                  - - Source - -

                                                                                                  format_file_line(file, line, cwd)

                                                                                                  - Source + Source

                                                                                                  @@ -108,7 +97,18 @@

                                                                                                  Functions

                                                                                                  the value of System.stacktrace is changed.

                                                                                                  - Source + Source + +
                                                                                                  +

                                                                                                  + format_stacktrace_entry(entry, cwd // nil) +

                                                                                                  +

                                                                                                  Receives a tuple representing a stacktrace entry and formats it. +The current working directory may be given as argument, which +is used to prettify the stacktrace.

                                                                                                  +
                                                                                                  + + Source

                                                                                                  @@ -119,7 +119,7 @@

                                                                                                  Functions

                                                                                                  code with Elixir code.

                                                                                                  - Source + Source

                                                                                                  Functions

                                                                                                  the value of System.stacktrace is changed.

                                                                                                  - Source + Source diff --git a/docs/master/FunctionClauseError.html b/docs/master/FunctionClauseError.html index 7151988e6..fb9235a50 100644 --- a/docs/master/FunctionClauseError.html +++ b/docs/master/FunctionClauseError.html @@ -29,7 +29,7 @@

                                                                                                  - Source + Source @@ -83,7 +83,7 @@

                                                                                                  Functions

                                                                                                  - Source + Source diff --git a/docs/master/HashDict.html b/docs/master/HashDict.html index 098522ace..57cb51f4d 100644 --- a/docs/master/HashDict.html +++ b/docs/master/HashDict.html @@ -51,6 +51,11 @@

                                                                                                  Functions summary

                                                                                                  delete/2
                                                                                                • +
                                                                                                • + + drop/2 + +
                                                                                                • empty/1 @@ -58,12 +63,22 @@

                                                                                                  Functions summary

                                                                                                • - get/3 + equal?/2
                                                                                                • - get!/2 + fetch/2 + +
                                                                                                • +
                                                                                                • + + fetch!/2 + +
                                                                                                • +
                                                                                                • + + get/3
                                                                                                • @@ -96,6 +111,11 @@

                                                                                                  Functions summary

                                                                                                  new/2
                                                                                                • +
                                                                                                • + + pop/3 + +
                                                                                                • put/3 @@ -111,6 +131,16 @@

                                                                                                  Functions summary

                                                                                                  size/1
                                                                                                • +
                                                                                                • + + split/2 + +
                                                                                                • +
                                                                                                • + + take/2 + +
                                                                                                • to_list/1 @@ -149,7 +179,17 @@

                                                                                                  Functions

                                                                                                  Deletes a value from the dict.

                                                                                                  - Source + Source + +
                                                                                                  +

                                                                                                  + drop(dict, list2) +

                                                                                                  +

                                                                                                  Returns a new dict with only the entries +which key is not in keys

                                                                                                  +
                                                                                                  + + Source

                                                                                                  @@ -158,26 +198,42 @@

                                                                                                  Functions

                                                                                                  Returns an empty dict.

                                                                                                  - Source + Source
                                                                                                  -

                                                                                                  - get(dict, key, default // nil) +

                                                                                                  + equal?(a, b)

                                                                                                  -

                                                                                                  Gets the value under key from the dict.

                                                                                                  +
                                                                                                  + + Source + +
                                                                                                  +

                                                                                                  + fetch(dict, key) +

                                                                                                  +

                                                                                                  Fetches the value under key from the dict +and return it in a tagged tuple.

                                                                                                  - Source + Source
                                                                                                  -

                                                                                                  - get!(dict, key) +

                                                                                                  + fetch!(dict, key)

                                                                                                  -

                                                                                                  Gets the value under key from the dict, -raises KeyError if such key does not exist.

                                                                                                  +
                                                                                                  + + Source + +
                                                                                                  +

                                                                                                  + get(dict, key, default // nil) +

                                                                                                  +

                                                                                                  Gets the value under key from the dict.

                                                                                                  - Source + Source

                                                                                                  @@ -186,7 +242,7 @@

                                                                                                  Functions

                                                                                                  Checks if the dict has the given key.

                                                                                                  - Source + Source

                                                                                                  @@ -195,7 +251,7 @@

                                                                                                  Functions

                                                                                                  Get all keys in the dict.

                                                                                                  - Source + Source

                                                                                                  @@ -204,7 +260,7 @@

                                                                                                  Functions

                                                                                                  Merges two dictionaries.

                                                                                                  - Source + Source

                                                                                                  @@ -213,7 +269,7 @@

                                                                                                  Functions

                                                                                                  Creates a new empty dict.

                                                                                                  - Source + Source

                                                                                                  @@ -228,7 +284,7 @@

                                                                                                  Examples

                                                                                                  - Source + Source

                                                                                                  @@ -244,7 +300,16 @@

                                                                                                  Examples

                                                                                                  - Source + Source + +
                                                                                                  +

                                                                                                  + pop(dict, key, default // nil) +

                                                                                                  +

                                                                                                  Returns the value under key from the dict as well as the dict without key.

                                                                                                  +
                                                                                                  + + Source

                                                                                                  @@ -253,7 +318,7 @@

                                                                                                  Examples

                                                                                                  Puts the given key and value in the dict.

                                                                                                  - Source + Source

                                                                                                  @@ -263,7 +328,7 @@

                                                                                                  Examples

                                                                                                  only if one does not exist yet.

                                                                                                  - Source + Source

                                                                                                  @@ -272,7 +337,29 @@

                                                                                                  Examples

                                                                                                  Returns the dict size.

                                                                                                  - Source + Source + +
                                                                                                  +

                                                                                                  + split(dict, keys) +

                                                                                                  +

                                                                                                  Splits a dict into two dicts, +one containing entries with key in the keys list, +and another containing entries with key not in keys. +Returns a 2-tuple of the new dicts.

                                                                                                  +
                                                                                                  + + Source + +
                                                                                                  +

                                                                                                  + take(dict, keys) +

                                                                                                  +

                                                                                                  Returns a new dict with only the entries +which key is in keys.

                                                                                                  +
                                                                                                  + + Source

                                                                                                  @@ -281,7 +368,7 @@

                                                                                                  Examples

                                                                                                  Converts the dict to a list.

                                                                                                  - Source + Source

                                                                                                  @@ -292,7 +379,7 @@

                                                                                                  Examples

                                                                                                  not exist in the dictionary.

                                                                                                  - Source + Source

                                                                                                  @@ -303,7 +390,7 @@

                                                                                                  Examples

                                                                                                  the key does not exist in the dicionary.

                                                                                                  - Source + Source

                                                                                                  @@ -312,7 +399,7 @@

                                                                                                  Examples

                                                                                                  Get all values in the dict.

                                                                                                  - Source + Source
                                                                                                  diff --git a/docs/master/IEx.Helpers.html b/docs/master/IEx.Helpers.html index d9432d54c..9e81cb8fd 100644 --- a/docs/master/IEx.Helpers.html +++ b/docs/master/IEx.Helpers.html @@ -33,13 +33,15 @@

                                                                                                  more joyful to work with.

                                                                                                  This message was triggered by invoking the helper -h(), usually referred as h/0 (since it expects 0 +h(), usually referred to as h/0 (since it expects 0 arguments).

                                                                                                  There are many other helpers available:

                                                                                                  • c/2 - compiles a file in the given path
                                                                                                  • +
                                                                                                  • ls/0 - list the contents of the current directory
                                                                                                  • +
                                                                                                  • ls/1 - list the contents of the specified directory
                                                                                                  • cd/1 - changes the current directory
                                                                                                  • flush/0 — flush all messages sent to the shell
                                                                                                  • h/0, h/1 - prints help/documentation
                                                                                                  • @@ -66,6 +68,8 @@

                                                                                                    h(Enum.reverse/1) +

                                                                                                    To learn more about IEx as a whole, just type h(IEx).

                                                                                                    + @@ -103,6 +107,11 @@

                                                                                                    Functions summary

                                                                                                    l/1 +
                                                                                                  • + + ls/1 + +
                                                                                                  • m/0 @@ -172,59 +181,75 @@

                                                                                                    Functions

                                                                                                    to write their object code to. It returns the name of the compiled modules.

                                                                                                    +

                                                                                                    When compiling one file, there is no need to wrap it in a list.

                                                                                                    +

                                                                                                    Examples

                                                                                                    -
                                                                                                    c ["foo.ex"], "ebin"
                                                                                                    -#=> [Foo]
                                                                                                    +
                                                                                                    c ["foo.ex", "bar.ex"], "ebin"
                                                                                                    +#=> [Foo,Bar]
                                                                                                    +
                                                                                                    +c "baz.ex"
                                                                                                    +#=> [Baz]
                                                                                                     
                                                                                                    - Source + Source

                                                                                                    cd(directory)

                                                                                                    -

                                                                                                    Changes the shell directory to the given path.

                                                                                                    +

                                                                                                    Changes the current working directory to the given path.

                                                                                                    - Source + Source

                                                                                                    flush()

                                                                                                    -

                                                                                                    Flushes all messages sent to the shell and prints them out

                                                                                                    +

                                                                                                    Flushes all messages sent to the shell and prints them out.

                                                                                                    - Source + Source

                                                                                                    h()

                                                                                                    -

                                                                                                    Shows the documentation for IEx.Helpers.

                                                                                                    +

                                                                                                    Prints the documentation for IEx.Helpers.

                                                                                                    - Source + Source

                                                                                                    l(module)

                                                                                                    -

                                                                                                    Purges and reloads specified module

                                                                                                    +

                                                                                                    Purges and reloads specified module.

                                                                                                    +
                                                                                                    + + Source + +
                                                                                                    +

                                                                                                    + ls(path // ".") +

                                                                                                    +

                                                                                                    Produces a simple list of a directory's contents. +If path points to a file, prints its full path.

                                                                                                    - Source + Source

                                                                                                    m()

                                                                                                    -

                                                                                                    Returns the name and module of all modules loaded.

                                                                                                    +

                                                                                                    Prints the list of all loaded modules with paths to their corresponding .beam +files.

                                                                                                    - Source + Source

                                                                                                    @@ -233,17 +258,17 @@

                                                                                                    Examples

                                                                                                    Prints the current working directory.

                                                                                                    - Source + Source

                                                                                                    r()

                                                                                                    -

                                                                                                    Reloads all modules that were already reloaded -at some point with r/1.

                                                                                                    +

                                                                                                    Reloads all modules that have already been reloaded with r/1 at any point +in the current IEx session.

                                                                                                    - Source + Source

                                                                                                    @@ -251,31 +276,33 @@

                                                                                                    Examples

                                                                                                    Recompiles and reloads the specified module's source file.

                                                                                                    -

                                                                                                    Please note that all the modules defined in the specified -files are recompiled and reloaded.

                                                                                                    +

                                                                                                    Please note that all the modules defined in the same file as module +are recompiled and reloaded.

                                                                                                    - Source + Source

                                                                                                    v()

                                                                                                    -

                                                                                                    Prints commands history and their result.

                                                                                                    +

                                                                                                    Prints the history of expressions evaluated during the session along with +their results.

                                                                                                    - Source + Source

                                                                                                    v(n)

                                                                                                    -

                                                                                                    Retrieves nth query's value from the history. Use negative -values to lookup query's value from latest to earliest. -For instance, v(-1) returns the latest result.

                                                                                                    +

                                                                                                    Retrieves nth expression's value from the history.

                                                                                                    + +

                                                                                                    Use negative values to lookup expression values relative to the current one. +For instance, v(-1) returns the result of the last evaluated expression.

                                                                                                    - Source + Source
                                                                                                    @@ -288,7 +315,7 @@

                                                                                                    Macros

                                                                                                    h(other)

                                                                                                    -

                                                                                                    Shows the documentation for the given module +

                                                                                                    Prints the documentation for the given module or for the given function/arity pair.

                                                                                                    Examples

                                                                                                    @@ -306,13 +333,17 @@

                                                                                                    Examples

                                                                                                    - Source + Source

                                                                                                    s(module)

                                                                                                    -

                                                                                                    Prints all specs from a given module.

                                                                                                    +

                                                                                                    Similar to t/1, only for specs.

                                                                                                    + +

                                                                                                    When given a module, prints the list of all specs defined in the module.

                                                                                                    + +

                                                                                                    When given a particular spec name (with optional arity), prints its spec.

                                                                                                    Examples

                                                                                                    @@ -324,14 +355,16 @@

                                                                                                    Examples

                                                                                                    - Source + Source

                                                                                                    t(module)

                                                                                                    -

                                                                                                    Prints all types for the given module or prints out a specified type's -specification

                                                                                                    +

                                                                                                    When given a module, prints specifications (or simply specs) for all the +types defined in it.

                                                                                                    + +

                                                                                                    When given a particular type name, prints its spec.

                                                                                                    Examples

                                                                                                    @@ -341,7 +374,7 @@

                                                                                                    Examples

                                                                                                    - Source + Source
                                                                                                    diff --git a/docs/master/IEx.html b/docs/master/IEx.html index e912bcfe5..567007ec8 100644 --- a/docs/master/IEx.html +++ b/docs/master/IEx.html @@ -27,18 +27,97 @@

                                                                                                    -

                                                                                                    This module implements Interactive Elixir.

                                                                                                    +

                                                                                                    Welcome to IEx.

                                                                                                    -

                                                                                                    The interactive elixir needs to be set as the -proper -user when starting the Erlang VM and -so can be done with the help of IEx.CLI.

                                                                                                    +

                                                                                                    This module is the main entry point Interactive Elixir and +in this documentation we will talk a bit about how IEx works.

                                                                                                    -

                                                                                                    If possible, Elixir will start a tty (smart terminal) -which makes all control commands available in tty -available to the developer.

                                                                                                    +

                                                                                                    Notice some of the functionality described here will be available +depending on your terminal. In particular, if you get a message +saying that the smart terminal could not be run, some of the +features described here won't work.

                                                                                                    -

                                                                                                    In case tty is not available (for example, Windows), -a dumb terminal version is started instead.

                                                                                                    +

                                                                                                    The Break command

                                                                                                    + +

                                                                                                    Inside IEx, hitting Ctrl+C will open up the BREAK menu. In this +menu you can quit the shell, see process and ets tables information +and much more.

                                                                                                    + +

                                                                                                    The User Switch command

                                                                                                    + +

                                                                                                    Besides the break command, one can type Ctrl+G to get the to +the user switch command. When reached, you can type h to +get more information.

                                                                                                    + +

                                                                                                    In this switch, developers are able to create new shell and +alternate in between them. Let's give it a try:

                                                                                                    + +
                                                                                                    User switch command
                                                                                                    + --> s 'Elixir-IEx'
                                                                                                    + --> c
                                                                                                    +
                                                                                                    + +

                                                                                                    The command above will start a new shell and connect to it. +Create a new variable called hello and assign some value to it:

                                                                                                    + +
                                                                                                    hello = :world
                                                                                                    +
                                                                                                    + +

                                                                                                    Now, let's rollback to the first shell:

                                                                                                    + +
                                                                                                    User switch command
                                                                                                    + --> c 1
                                                                                                    +
                                                                                                    + +

                                                                                                    Now, try to access the hello variable again:

                                                                                                    + +
                                                                                                    hello
                                                                                                    +** (UndefinedFunctionError) undefined function: IEx.Helpers.hello/0
                                                                                                    +
                                                                                                    + +

                                                                                                    The command above fails because we have changed the shells +and they are isolated from each other, you can access the +variables defined in one in the other.

                                                                                                    + +

                                                                                                    The User Switch also allow developers to connect to remote +shells using r. Keep in mind that you can't connect to a +remote node if you haven't given a name to the current node +(i.e. Process.is_alive? must return true).

                                                                                                    + +

                                                                                                    Expressions in IEx

                                                                                                    + +

                                                                                                    As an interactive shell, IEx evalutes expressions. This has some +interesting consequences worthy discussing.

                                                                                                    + +

                                                                                                    The first one is that the code is truly evaluated and not compiled. +This means that, any benchmarking done in the shell is going to have +skewed results. So never run any profiling nor benchmark in the shell.

                                                                                                    + +

                                                                                                    Second of all, IEx alows you to break an expression into many lines, +since this is common in Elixir. For example:

                                                                                                    + +
                                                                                                    iex(1)> "ab
                                                                                                    +...(1)> c"
                                                                                                    +"ab\nc"
                                                                                                    +
                                                                                                    + +

                                                                                                    In the example above, the shell will be expecting more input until it +finds the closing quote. Sometimes it is not obvious which character +the shell is expecting, and the user may find themselves trapped in +the state of incomplete expression with no ability to terminate it other +than by exiting the shell.

                                                                                                    + +

                                                                                                    For such cases, there is a special break-trigger ("#iex:break") that when +encountered on a line by itself will force the shell to break out of any +pending expression and return to its normal state:

                                                                                                    + +
                                                                                                    iex(1)> ["ab
                                                                                                    +...(1)> c"
                                                                                                    +...(1)> "
                                                                                                    +...(1)> ]
                                                                                                    +...(1)> #iex:break
                                                                                                    +** (TokenMissingError) iex:1: incomplete expression
                                                                                                    +
                                                                                                    @@ -95,7 +174,7 @@

                                                                                                    Functions

                                                                                                    Returns registered after spawn callbacks.

                                                                                                    - Source + Source

                                                                                                    @@ -104,7 +183,7 @@

                                                                                                    Functions

                                                                                                    Registers a function to be invoked after IEx process is spawned.

                                                                                                    - Source + Source

                                                                                                    @@ -113,7 +192,7 @@

                                                                                                    Functions

                                                                                                    Returns currently registered inspect options.

                                                                                                    - Source + Source

                                                                                                    @@ -122,7 +201,7 @@

                                                                                                    Functions

                                                                                                    Registers options used on inspect.

                                                                                                    - Source + Source

                                                                                                    @@ -131,7 +210,7 @@

                                                                                                    Functions

                                                                                                    Returns true if IEx was properly started.

                                                                                                    - Source + Source
                                                                                                    diff --git a/docs/master/IO.ANSI.html b/docs/master/IO.ANSI.html index a9dc2aae3..5fcbf9624 100644 --- a/docs/master/IO.ANSI.html +++ b/docs/master/IO.ANSI.html @@ -38,7 +38,7 @@

                                                                                                    - Source + Source @@ -320,7 +320,7 @@

                                                                                                    Functions

                                                                                                    Sets foreground color to black

                                                                                                    - Source + Source

                                                                                                    @@ -329,7 +329,7 @@

                                                                                                    Functions

                                                                                                    Sets background color to black

                                                                                                    - Source + Source

                                                                                                    Functions

                                                                                                    Blink: Rapid. MS-DOS ANSI.SYS; 150 per minute or more; not widely supported

                                                                                                    - Source + Source

                                                                                                    Functions

                                                                                                    Blink: Slow. Less than 150 per minute

                                                                                                    - Source + Source

                                                                                                    @@ -365,7 +365,7 @@

                                                                                                    Functions

                                                                                                    Sets foreground color to blue

                                                                                                    - Source + Source

                                                                                                    @@ -374,7 +374,7 @@

                                                                                                    Functions

                                                                                                    Sets background color to blue

                                                                                                    - Source + Source

                                                                                                    @@ -383,7 +383,7 @@

                                                                                                    Functions

                                                                                                    Bright (increased intensity) or Bold

                                                                                                    - Source + Source

                                                                                                    @@ -392,7 +392,7 @@

                                                                                                    Functions

                                                                                                    Conceal. Not widely supported

                                                                                                    - Source + Source

                                                                                                    @@ -401,7 +401,7 @@

                                                                                                    Functions

                                                                                                    Crossed-out. Characters legible, but marked for deletion. Not widely supported.

                                                                                                    - Source + Source

                                                                                                    @@ -410,7 +410,7 @@

                                                                                                    Functions

                                                                                                    Sets foreground color to cyan

                                                                                                    - Source + Source

                                                                                                    @@ -419,7 +419,7 @@

                                                                                                    Functions

                                                                                                    Sets background color to cyan

                                                                                                    - Source + Source

                                                                                                    @@ -428,7 +428,7 @@

                                                                                                    Functions

                                                                                                    Default background color

                                                                                                    - Source + Source

                                                                                                    @@ -437,7 +437,7 @@

                                                                                                    Functions

                                                                                                    Default text color

                                                                                                    - Source + Source

                                                                                                    @@ -446,7 +446,7 @@

                                                                                                    Functions

                                                                                                    Encircled

                                                                                                    - Source + Source

                                                                                                    @@ -467,11 +467,11 @@

                                                                                                    Functions

                                                                                                    Example

                                                                                                    -

                                                                                                    iex> IO.ANSI.escape "Hello %{red,bright,green}yes" +

                                                                                                    iex> IO.ANSI.escape("Hello %{red,bright,green}yes") "Hello \e[31m\e[1m\e[32myes\e[0m"

                                                                                                    - Source + Source

                                                                                                    @@ -489,11 +489,11 @@

                                                                                                    Example

                                                                                                    Example

                                                                                                    -

                                                                                                    iex> IO.ANSI.escape "Hello %{red,bright,green}yes" +

                                                                                                    iex> IO.ANSI.escape("Hello %{red,bright,green}yes") "Hello \e[31m\e[1m\e[32myes\e[0m"

                                                                                                    - Source + Source

                                                                                                    @@ -502,7 +502,7 @@

                                                                                                    Example

                                                                                                    Faint (decreased intensity), not widely supported

                                                                                                    - Source + Source

                                                                                                    @@ -511,7 +511,7 @@

                                                                                                    Example

                                                                                                    Sets alternative font 1

                                                                                                    - Source + Source

                                                                                                    @@ -520,7 +520,7 @@

                                                                                                    Example

                                                                                                    Sets alternative font 2

                                                                                                    - Source + Source

                                                                                                    @@ -529,7 +529,7 @@

                                                                                                    Example

                                                                                                    Sets alternative font 3

                                                                                                    - Source + Source

                                                                                                    @@ -538,7 +538,7 @@

                                                                                                    Example

                                                                                                    Sets alternative font 4

                                                                                                    - Source + Source

                                                                                                    @@ -547,7 +547,7 @@

                                                                                                    Example

                                                                                                    Sets alternative font 5

                                                                                                    - Source + Source

                                                                                                    @@ -556,7 +556,7 @@

                                                                                                    Example

                                                                                                    Sets alternative font 6

                                                                                                    - Source + Source

                                                                                                    @@ -565,7 +565,7 @@

                                                                                                    Example

                                                                                                    Sets alternative font 7

                                                                                                    - Source + Source

                                                                                                    @@ -574,7 +574,7 @@

                                                                                                    Example

                                                                                                    Sets alternative font 8

                                                                                                    - Source + Source

                                                                                                    @@ -583,7 +583,7 @@

                                                                                                    Example

                                                                                                    Sets alternative font 9

                                                                                                    - Source + Source

                                                                                                    @@ -592,7 +592,7 @@

                                                                                                    Example

                                                                                                    Framed

                                                                                                    - Source + Source

                                                                                                    @@ -601,7 +601,7 @@

                                                                                                    Example

                                                                                                    Sets foreground color to green

                                                                                                    - Source + Source

                                                                                                    @@ -610,7 +610,7 @@

                                                                                                    Example

                                                                                                    Sets background color to green

                                                                                                    - Source + Source

                                                                                                    @@ -619,7 +619,7 @@

                                                                                                    Example

                                                                                                    Image: Negative. Swap foreground and background

                                                                                                    - Source + Source

                                                                                                    @@ -628,7 +628,7 @@

                                                                                                    Example

                                                                                                    Italic: on. Not widely supported. Sometimes treated as inverse.

                                                                                                    - Source + Source

                                                                                                    @@ -637,7 +637,7 @@

                                                                                                    Example

                                                                                                    Sets foreground color to magenta

                                                                                                    - Source + Source

                                                                                                    @@ -646,7 +646,7 @@

                                                                                                    Example

                                                                                                    Sets background color to magenta

                                                                                                    - Source + Source

                                                                                                    @@ -673,7 +673,7 @@

                                                                                                    Example

                                                                                                    Not framed or encircled

                                                                                                    - Source + Source

                                                                                                    @@ -691,7 +691,7 @@

                                                                                                    Example

                                                                                                    Not overlined

                                                                                                    - Source + Source

                                                                                                    @@ -700,7 +700,7 @@

                                                                                                    Example

                                                                                                    Overlined

                                                                                                    - Source + Source

                                                                                                    @@ -709,7 +709,7 @@

                                                                                                    Example

                                                                                                    Sets primary (default) font

                                                                                                    - Source + Source

                                                                                                    @@ -718,7 +718,7 @@

                                                                                                    Example

                                                                                                    Sets foreground color to red

                                                                                                    - Source + Source

                                                                                                    @@ -727,7 +727,7 @@

                                                                                                    Example

                                                                                                    Sets background color to red

                                                                                                    - Source + Source

                                                                                                    @@ -736,7 +736,7 @@

                                                                                                    Example

                                                                                                    Resets all attributes

                                                                                                    - Source + Source

                                                                                                    @@ -745,7 +745,7 @@

                                                                                                    Example

                                                                                                    Image: Negative. Swap foreground and background

                                                                                                    - Source + Source

                                                                                                    @@ -762,7 +762,7 @@

                                                                                                    Example

                                                                                                    R16.

                                                                                                    - Source + Source

                                                                                                    @@ -771,7 +771,7 @@

                                                                                                    Example

                                                                                                    Underline: Single

                                                                                                    - Source + Source

                                                                                                    @@ -780,7 +780,7 @@

                                                                                                    Example

                                                                                                    Sets foreground color to white

                                                                                                    - Source + Source

                                                                                                    @@ -789,7 +789,7 @@

                                                                                                    Example

                                                                                                    Sets background color to white

                                                                                                    - Source + Source

                                                                                                    @@ -798,7 +798,7 @@

                                                                                                    Example

                                                                                                    Sets foreground color to yellow

                                                                                                    - Source + Source

                                                                                                    @@ -807,7 +807,7 @@

                                                                                                    Example

                                                                                                    Sets background color to yellow

                                                                                                    - Source + Source
                                                                                                    diff --git a/docs/master/IO.html b/docs/master/IO.html index 7d022a6b2..7798c6293 100644 --- a/docs/master/IO.html +++ b/docs/master/IO.html @@ -76,7 +76,12 @@

                                                                                                    Functions summary

                                                                                                  • - getb/3 + getn/2 + +
                                                                                                  • +
                                                                                                  • + + getn/3
                                                                                                  • @@ -162,10 +167,13 @@

                                                                                                    Functions

                                                                                                    Source
                                                                                                    -

                                                                                                    - getb(device // group_leader(), prompt, count // 1) +

                                                                                                    + getn(prompt, count // 1)

                                                                                                    -

                                                                                                    Gets count bytes from the IO device. It returns:

                                                                                                    +

                                                                                                    Gets a number of bytes from the io device. If the +io device is a unicode device, count implies +the number of unicode codepoints to be retrieved. +Otherwise, the number of raw bytes. It returns:

                                                                                                    • data - The input characters.

                                                                                                    • @@ -176,7 +184,19 @@

                                                                                                      Functions

                                                                                                    - Source + Source + +
                                                                                                    +

                                                                                                    + getn(device, prompt, count) +

                                                                                                    +

                                                                                                    Gets a number of bytes from the io device. If the +io device is a unicode device, count implies +the number of unicode codepoints to be retrieved. +Otherwise, the number of raw bytes.

                                                                                                    +
                                                                                                    + + Source

                                                                                                    @@ -194,7 +214,7 @@

                                                                                                    Functions

                                                                                                  - Source + Source

                                                                                                  diff --git a/docs/master/Kernel.CLI.html b/docs/master/Kernel.CLI.html index 8a5977726..1c1b50cc3 100644 --- a/docs/master/Kernel.CLI.html +++ b/docs/master/Kernel.CLI.html @@ -69,7 +69,7 @@

                                                                                                  Functions

                                                                                                  by escripts generated by Elixir.

                                                                                                  - Source + Source diff --git a/docs/master/Kernel.SpecialForms.html b/docs/master/Kernel.SpecialForms.html index a640ea5a6..3ae0feb9d 100644 --- a/docs/master/Kernel.SpecialForms.html +++ b/docs/master/Kernel.SpecialForms.html @@ -69,6 +69,11 @@

                                                                                                  Macros summary

                                                                                                  []/1
                                                                                                • +
                                                                                                • + + __DIR__/0 + +
                                                                                                • __ENV__/0 @@ -101,12 +106,12 @@

                                                                                                  Macros summary

                                                                                                • - alias/0 + alias/2
                                                                                                • - alias/2 + alias!/1
                                                                                                • @@ -134,6 +139,16 @@

                                                                                                  Macros summary

                                                                                                  require/2
                                                                                                • +
                                                                                                • + + unquote/1 + +
                                                                                                • +
                                                                                                • + + unquote_splicing/1 + +
                                                                                                • var!/1 @@ -318,6 +333,15 @@

                                                                                                  Examples

                                                                                                  Source +
                                                                                                  +

                                                                                                  + __DIR__() +

                                                                                                  +

                                                                                                  Returns the current directory as a binary.

                                                                                                  +
                                                                                                  + + Source +

                                                                                                  __ENV__() @@ -327,7 +351,7 @@

                                                                                                  Examples

                                                                                                  line numbers, set up aliases, the current function and others.

                                                                                                  - Source + Source

                                                                                                  @@ -338,7 +362,7 @@

                                                                                                  Examples

                                                                                                  is a convenient shortcut.

                                                                                                  - Source + Source

                                                                                                  @@ -349,7 +373,7 @@

                                                                                                  Examples

                                                                                                  is a convenient shortcut.

                                                                                                  - Source + Source

                                                                                                  @@ -394,7 +418,7 @@

                                                                                                  Examples

                                                                                                  - Source + Source

                                                                                                  @@ -409,7 +433,7 @@

                                                                                                  Examples

                                                                                                  - Source + Source

                                                                                                  @@ -421,24 +445,13 @@

                                                                                                  Examples

                                                                                                  it belonged to another file.

                                                                                                  quote location: :keep, do: 1
                                                                                                  -#=> { :__scope__, 1,[[file: "iex"],[do: 1]] }
                                                                                                  +#=> { :__scope__, [line: 1], [[file: "iex"],[do: 1]] }
                                                                                                   

                                                                                                  Check quote/1 for more information.

                                                                                                  - Source - -
                                                                                                  -

                                                                                                  - alias() -

                                                                                                  -

                                                                                                  When used inside quoting, marks that the alias should not -be hygienezed. This means the alias will be expanded when -the macro is expanded.

                                                                                                  -
                                                                                                  - - Source + Source

                                                                                                  @@ -486,6 +499,17 @@

                                                                                                  Lexical scope

                                                                                                  Source +
                                                                                                  +

                                                                                                  + alias!(alias) +

                                                                                                  +

                                                                                                  When used inside quoting, marks that the alias should not +be hygienezed. This means the alias will be expanded when +the macro is expanded.

                                                                                                  +
                                                                                                  + + Source +

                                                                                                  bc(args) @@ -500,7 +524,7 @@

                                                                                                  Lexical scope

                                                                                                  - Source + Source

                                                                                                  @@ -580,6 +604,19 @@

                                                                                                  Alias/Require shortcut

                                                                                                  also accepts as: as an option so it automatically sets up an alias. Please check alias for more information.

                                                                                                  +

                                                                                                  Warnings

                                                                                                  + +

                                                                                                  If you import a module and you don't use any of the imported +functions or macros from this module, Elixir is going to issue +a warning implying the import is not being used.

                                                                                                  + +

                                                                                                  In case the import is generated automatically by a macro, +Elixir won't emit any warnings though, since the import +was not explicitly defined.

                                                                                                  + +

                                                                                                  Both warning behaviors could be changed by explicitily +setting the :warn option to true or false.

                                                                                                  +

                                                                                                  Ambiguous function/macro names

                                                                                                  If two modules A and B are imported and they both contain @@ -588,7 +625,7 @@

                                                                                                  Ambiguous function/macro names

                                                                                                  errors are emitted lazily, not eagerly.

                                                                                                  - Source + Source

                                                                                                  @@ -638,7 +675,7 @@

                                                                                                  Ambiguous function/macro names

                                                                                                  - Source + Source

                                                                                                  @@ -655,10 +692,10 @@

                                                                                                  Examples

                                                                                                  Explanation

                                                                                                  Any Elixir code can be represented using Elixir data structures. -The building block of Elixir homoiconicity is a tuple with three -elements, for example:

                                                                                                  +The building block of Elixir macros is a tuple with three elements, +for example:

                                                                                                  -
                                                                                                  { :sum, 1, [1, 2, 3] }
                                                                                                  +
                                                                                                  { :sum, [], [1, 2, 3] }
                                                                                                   

                                                                                                  The tuple above represents a function call to sum passing 1, 2 and @@ -667,8 +704,7 @@

                                                                                                  Explanation

                                                                                                  • The first element of the tuple is always an atom or another tuple in the same representation;
                                                                                                  • -
                                                                                                  • The second element of the tuple is always an integer -representing the line number;
                                                                                                  • +
                                                                                                  • The second element of the tuple represents metadata;
                                                                                                  • The third element of the tuple are the arguments for the function call. The third argument may be an atom, which is usually a variable (or a local call);
                                                                                                  • @@ -683,6 +719,7 @@

                                                                                                    Options

                                                                                                  • :location - When set to :keep, keeps the current line and file on quotes. Read the Stacktrace information section below for more information;
                                                                                                  • :hygiene - Allows a developer to disable hygiene selectively;
                                                                                                  • +
                                                                                                  • :context - Sets the context resolution happens at;

                                                                                                  Macro literals

                                                                                                  @@ -698,17 +735,35 @@

                                                                                                  Macro literals

                                                                                                  {key, value} #=> Tuple with two elements
                                                                                                  -

                                                                                                  Hygiene

                                                                                                  +

                                                                                                  Hygiene and context

                                                                                                  -

                                                                                                  Elixir macros are hygienic via means of deferred resolution.

                                                                                                  +

                                                                                                  Elixir macros are hygienic via means of deferred resolution. +This means variables, aliases and imports defined inside the +quoted refer to the context that defined the macro and not +the context where the macro is expanded.

                                                                                                  -

                                                                                                  This means aliases and imports defined inside the quoted refer -to the context that defined the macro and not the context -where the macro is expanded.

                                                                                                  +

                                                                                                  For this mechanism to work, every quoted code is attached +to a context. Consider the following example:

                                                                                                  -

                                                                                                  Furthermore, variables inside quote are also hygienic: a -variable defined in a macro cannot affect the variables where -the macro is expanded.

                                                                                                  +
                                                                                                  defmodule ContextSample do
                                                                                                  +  def hello do
                                                                                                  +    quote do: world
                                                                                                  +  end
                                                                                                  +end
                                                                                                  +
                                                                                                  +ContextSample.hello
                                                                                                  +#=> {:world,[],ContextSample}
                                                                                                  +
                                                                                                  + +

                                                                                                  Notice how the third element of the returned tuple is the +module name. This means that the variable is associated to the +ContextSample module and only code generated by this module +will be able to access that particular world variable.

                                                                                                  + +

                                                                                                  The context can be disabled or changed by explicitly setting +the context option. All hygiene mechanisms are based on such +context and we are going to explore each of them in the following +subsections.

                                                                                                  Hygiene in variables

                                                                                                  @@ -918,7 +973,7 @@

                                                                                                  Stacktrace information

                                                                                                  the quote will always point to GenServer.Behaviour file.

                                                                                                  - Source + Source

                                                                                                  @@ -953,6 +1008,54 @@

                                                                                                  Alias shortcut

                                                                                                  Source +
                                                                                                  +

                                                                                                  + unquote(expr) +

                                                                                                  +

                                                                                                  Unquotes the given expression from inside a macro.

                                                                                                  + +

                                                                                                  Examples

                                                                                                  + +

                                                                                                  Imagine the situation you have a variable name and +you want to inject it inside some quote. The first attempt +would be:

                                                                                                  + +
                                                                                                  value = 13
                                                                                                  +quote do: sum(1, value, 3)
                                                                                                  +
                                                                                                  + +

                                                                                                  Which would then return:

                                                                                                  + +
                                                                                                  { :sum, [], [1, { :value, [], quoted }, 3] }
                                                                                                  +
                                                                                                  + +

                                                                                                  Which is not the expected result. For this, we use unquote:

                                                                                                  + +
                                                                                                  value = 13
                                                                                                  +quote do: sum(1, unquote(value), 3)
                                                                                                  +#=> { :sum, [], [1, 13, 3] }
                                                                                                  +
                                                                                                  +
                                                                                                  + + Source + +
                                                                                                  +

                                                                                                  + unquote_splicing(expr) +

                                                                                                  +

                                                                                                  Unquotes the given list expanding its arguments. Similar +to unquote.

                                                                                                  + +

                                                                                                  Examples

                                                                                                  + +
                                                                                                  values = [2,3,4]
                                                                                                  +quote do: sum(1, unquote_splicing(values), 5)
                                                                                                  +#=> { :sum, [], [1, 2, 3, 4, 5] }
                                                                                                  +
                                                                                                  +
                                                                                                  + + Source +

                                                                                                  var!(var) @@ -964,7 +1067,7 @@

                                                                                                  Alias shortcut

                                                                                                  Check quote/2 for more information.

                                                                                                  - Source + Source

                                                                                                  @@ -974,7 +1077,7 @@

                                                                                                  Alias shortcut

                                                                                                  Check quote/2 for more information.

                                                                                                  - Source + Source

                                                                                                  diff --git a/docs/master/Kernel.Typespec.html b/docs/master/Kernel.Typespec.html index 044d3dc6e..e26e8cc94 100644 --- a/docs/master/Kernel.Typespec.html +++ b/docs/master/Kernel.Typespec.html @@ -75,9 +75,9 @@

                                                                                                  Bit Strings

                                                                                                  <<_ :: _ * 8>>
                                                                                                   
                                                                                                  -

                                                                                                  Functions

                                                                                                  +

                                                                                                  Anonymous functions

                                                                                                  -

                                                                                                  Any function:

                                                                                                  +

                                                                                                  Any anonymous function:

                                                                                                  (fun(...) -> any)
                                                                                                   or
                                                                                                  @@ -86,14 +86,14 @@ 

                                                                                                  Functions

                                                                                                  (... -> any)
                                                                                                  -

                                                                                                  Function with arity of zero:

                                                                                                  +

                                                                                                  Anonymous function with arity of zero:

                                                                                                  (fun() -> type)
                                                                                                   or
                                                                                                   (() -> type)
                                                                                                   
                                                                                                  -

                                                                                                  Function with some arity:

                                                                                                  +

                                                                                                  Anonymous function with some arity:

                                                                                                  (fun(type, type) -> type)
                                                                                                   or
                                                                                                  diff --git a/docs/master/Kernel.html b/docs/master/Kernel.html
                                                                                                  index 239331a7f..66f495886 100644
                                                                                                  --- a/docs/master/Kernel.html
                                                                                                  +++ b/docs/master/Kernel.html
                                                                                                  @@ -131,11 +131,21 @@ 

                                                                                                  Functions summary

                                                                                                  float/1
                                                                                                • +
                                                                                                • + + float_to_binary/2 + +
                                                                                                • float_to_list/1
                                                                                                • +
                                                                                                • + + float_to_list/2 + +
                                                                                                • function_exported?/3 @@ -648,6 +658,26 @@

                                                                                                  Macros summary

                                                                                                  defimpl/3
                                                                                                • +
                                                                                                • + + defmacro/2 + +
                                                                                                • +
                                                                                                • + + defmacro/4 + +
                                                                                                • +
                                                                                                • + + defmacrop/2 + +
                                                                                                • +
                                                                                                • + + defmacrop/4 + +
                                                                                                • defmodule/2 @@ -675,7 +705,7 @@

                                                                                                  Macros summary

                                                                                                • - defrecord/4 + defrecord/3
                                                                                                • @@ -708,11 +738,6 @@

                                                                                                  Macros summary

                                                                                                  float_to_binary/1
                                                                                                • -
                                                                                                • - - float_to_binary/2 - -
                                                                                                • function/1 @@ -879,7 +904,7 @@

                                                                                                  Examples

                                                                                                  - Source + Source

                                                                                                  @@ -898,7 +923,7 @@

                                                                                                  Examples

                                                                                                  - Source + Source

                                                                                                  @@ -913,7 +938,7 @@

                                                                                                  Examples

                                                                                                  - Source + Source

                                                                                                  @@ -929,18 +954,18 @@

                                                                                                  Examples

                                                                                                  Examples

                                                                                                  -
                                                                                                  iex> binary_part "foo", 1, 2
                                                                                                  +
                                                                                                  iex> binary_part("foo", 1, 2)
                                                                                                   "oo"
                                                                                                   

                                                                                                  A negative length can be used to extract bytes at the end of a binary:

                                                                                                  -
                                                                                                  iex> binary_part "foo", 3, -1
                                                                                                  +
                                                                                                  iex> binary_part("foo", 3, -1)
                                                                                                   "o"
                                                                                                   
                                                                                                  - Source + Source

                                                                                                  @@ -958,7 +983,7 @@

                                                                                                  Examples

                                                                                                  - Source + Source

                                                                                                  @@ -967,7 +992,7 @@

                                                                                                  Examples

                                                                                                  Works like binary_to_atom/2, but the atom must already exist.

                                                                                                  - Source + Source

                                                                                                  @@ -976,7 +1001,7 @@

                                                                                                  Examples

                                                                                                  Returns a list of integers which correspond to the bytes of binary.

                                                                                                  - Source + Source

                                                                                                  @@ -987,7 +1012,7 @@

                                                                                                  Examples

                                                                                                  are numbered starting from 1.

                                                                                                  - Source + Source

                                                                                                  @@ -1004,7 +1029,7 @@

                                                                                                  Examples

                                                                                                  - Source + Source

                                                                                                  @@ -1030,7 +1055,7 @@

                                                                                                  Examples

                                                                                                  - Source + Source

                                                                                                  @@ -1049,7 +1074,7 @@

                                                                                                  Examples

                                                                                                  - Source + Source

                                                                                                  @@ -1060,7 +1085,7 @@

                                                                                                  Examples

                                                                                                  be a bitstring containing the remaining bits (1 up to 7 bits).

                                                                                                  - Source + Source

                                                                                                  @@ -1081,7 +1106,7 @@

                                                                                                  Examples

                                                                                                  - Source + Source

                                                                                                  @@ -1098,7 +1123,7 @@

                                                                                                  Examples

                                                                                                  - Source + Source

                                                                                                  @@ -1107,7 +1132,30 @@

                                                                                                  Examples

                                                                                                  Converts the given number to a float. Allowed in guard clauses.

                                                                                                  - Source + Source + +
                                                                                                  +

                                                                                                  + float_to_binary(float, options) +

                                                                                                  +

                                                                                                  Returns a binary which corresponds to the text representation +of float.

                                                                                                  + +

                                                                                                  Options

                                                                                                  + +
                                                                                                    +
                                                                                                  • :decimals — number of decimal points to show
                                                                                                  • +
                                                                                                  • :scientific — number of decimal points to show, in scientific format
                                                                                                  • +
                                                                                                  • :compact — If true, use the most compact representation (ignored with the scientific option)
                                                                                                  • +
                                                                                                  + +

                                                                                                  Examples

                                                                                                  + +
                                                                                                  float_to_binary 7.1, [decimals: 2, compact: true] #=> "7.1"
                                                                                                  +
                                                                                                  +
                                                                                                  + + Source

                                                                                                  @@ -1122,7 +1170,30 @@

                                                                                                  Examples

                                                                                                  - Source + Source + +
                                                                                                  +

                                                                                                  + float_to_list(float, options) +

                                                                                                  +

                                                                                                  Returns a list which corresponds to the text representation +of float.

                                                                                                  + +

                                                                                                  Options

                                                                                                  + +
                                                                                                    +
                                                                                                  • :decimals — number of decimal points to show
                                                                                                  • +
                                                                                                  • :scientific — number of decimal points to show, in scientific format
                                                                                                  • +
                                                                                                  • :compact — If true, use the most compact representation (ignored with the scientific option)
                                                                                                  • +
                                                                                                  + +

                                                                                                  Examples

                                                                                                  + +
                                                                                                  float_to_list 7.1, [decimals: 2, compact: true] #=> '7.1'
                                                                                                  +
                                                                                                  +
                                                                                                  + + Source

                                                                                                  @@ -1139,7 +1210,7 @@

                                                                                                  Examples

                                                                                                  information.

                                                                                                  - Source + Source

                                                                                                  @@ -1148,7 +1219,7 @@

                                                                                                  Examples

                                                                                                  Returns the head of a list, raises badarg if the list is empty.

                                                                                                  - Source + Source

                                                                                                  @@ -1163,7 +1234,7 @@

                                                                                                  Examples

                                                                                                  - Source + Source

                                                                                                  @@ -1179,7 +1250,7 @@

                                                                                                  Examples

                                                                                                  - Source + Source

                                                                                                  @@ -1194,7 +1265,7 @@

                                                                                                  Examples

                                                                                                  - Source + Source

                                                                                                  @@ -1212,7 +1283,7 @@

                                                                                                  Examples

                                                                                                  - Source + Source

                                                                                                  @@ -1222,7 +1293,7 @@

                                                                                                  Examples

                                                                                                  if the node can be part of a distributed system.

                                                                                                  - Source + Source

                                                                                                  @@ -1233,7 +1304,7 @@

                                                                                                  Examples

                                                                                                  Allowed in guard tests.

                                                                                                  - Source + Source

                                                                                                  @@ -1246,7 +1317,7 @@

                                                                                                  Examples

                                                                                                  Allowed in guard tests.

                                                                                                  - Source + Source

                                                                                                  @@ -1257,7 +1328,7 @@

                                                                                                  Examples

                                                                                                  Allowed in guard tests.

                                                                                                  - Source + Source

                                                                                                  @@ -1269,7 +1340,7 @@

                                                                                                  Examples

                                                                                                  Allowed in guard tests.

                                                                                                  - Source + Source

                                                                                                  @@ -1280,7 +1351,7 @@

                                                                                                  Examples

                                                                                                  Allowed in guard tests.

                                                                                                  - Source + Source

                                                                                                  @@ -1291,7 +1362,7 @@

                                                                                                  Examples

                                                                                                  Allowed in guard tests.

                                                                                                  - Source + Source

                                                                                                  @@ -1303,7 +1374,7 @@

                                                                                                  Examples

                                                                                                  Allowed in guard tests.

                                                                                                  - Source + Source

                                                                                                  @@ -1314,7 +1385,7 @@

                                                                                                  Examples

                                                                                                  Allowed in guard tests.

                                                                                                  - Source + Source

                                                                                                  @@ -1325,7 +1396,7 @@

                                                                                                  Examples

                                                                                                  Allowed in guard tests.

                                                                                                  - Source + Source

                                                                                                  @@ -1337,7 +1408,7 @@

                                                                                                  Examples

                                                                                                  Allowed in guard tests.

                                                                                                  - Source + Source

                                                                                                  @@ -1348,7 +1419,7 @@

                                                                                                  Examples

                                                                                                  Allowed in guard tests.

                                                                                                  - Source + Source

                                                                                                  @@ -1359,7 +1430,7 @@

                                                                                                  Examples

                                                                                                  Allowed in guard tests.

                                                                                                  - Source + Source

                                                                                                  @@ -1370,7 +1441,7 @@

                                                                                                  Examples

                                                                                                  Allowed in guard tests.

                                                                                                  - Source + Source

                                                                                                  @@ -1381,7 +1452,7 @@

                                                                                                  Examples

                                                                                                  Allowed in guard tests.

                                                                                                  - Source + Source

                                                                                                  @@ -1398,7 +1469,7 @@

                                                                                                  Examples

                                                                                                  - Source + Source

                                                                                                  @@ -1413,7 +1484,7 @@

                                                                                                  Examples

                                                                                                  - Source + Source

                                                                                                  @@ -1428,7 +1499,7 @@

                                                                                                  Examples

                                                                                                  - Source + Source

                                                                                                  @@ -1447,7 +1518,7 @@

                                                                                                  Examples

                                                                                                  - Source + Source

                                                                                                  @@ -1457,7 +1528,7 @@

                                                                                                  Examples

                                                                                                  exists such atom.

                                                                                                  - Source + Source

                                                                                                  @@ -1472,7 +1543,7 @@

                                                                                                  Examples

                                                                                                  - Source + Source

                                                                                                  @@ -1487,7 +1558,7 @@

                                                                                                  Examples

                                                                                                  - Source + Source

                                                                                                  @@ -1502,7 +1573,7 @@

                                                                                                  Examples

                                                                                                  - Source + Source

                                                                                                  @@ -1523,7 +1594,7 @@

                                                                                                  Examples

                                                                                                  - Source + Source

                                                                                                  @@ -1538,7 +1609,7 @@

                                                                                                  Examples

                                                                                                  - Source + Source

                                                                                                  @@ -1552,7 +1623,7 @@

                                                                                                  Examples

                                                                                                  information.

                                                                                                  - Source + Source

                                                                                                  @@ -1569,7 +1640,7 @@

                                                                                                  Examples

                                                                                                  - Source + Source

                                                                                                  @@ -1586,7 +1657,7 @@

                                                                                                  Examples

                                                                                                  - Source + Source

                                                                                                  @@ -1603,7 +1674,7 @@

                                                                                                  Examples

                                                                                                  - Source + Source

                                                                                                  @@ -1615,7 +1686,7 @@

                                                                                                  Examples

                                                                                                  Allowed in guard tests.

                                                                                                  - Source + Source

                                                                                                  @@ -1628,7 +1699,7 @@

                                                                                                  Examples

                                                                                                  Allowed in guard tests.

                                                                                                  - Source + Source

                                                                                                  @@ -1646,7 +1717,7 @@

                                                                                                  Warning:

                                                                                                  It should not be used in application programs.

                                                                                                  - Source + Source

                                                                                                  @@ -1673,7 +1744,7 @@

                                                                                                  Examples

                                                                                                  - Source + Source

                                                                                                  @@ -1691,12 +1762,12 @@

                                                                                                  Examples

                                                                                                  Examples

                                                                                                  -
                                                                                                  iex> raise ArgumentError, message: "Sample"
                                                                                                  +
                                                                                                  iex> raise(ArgumentError, message: "Sample")
                                                                                                   ** (ArgumentError) Sample
                                                                                                   
                                                                                                  - Source + Source

                                                                                                  @@ -1725,7 +1796,7 @@

                                                                                                  Examples

                                                                                                  may change the System.stacktrace value.

                                                                                                  - Source + Source

                                                                                                  @@ -1741,7 +1812,7 @@

                                                                                                  Examples

                                                                                                  - Source + Source

                                                                                                  @@ -1751,7 +1822,7 @@

                                                                                                  Examples

                                                                                                  Allowed in guard clauses.

                                                                                                  - Source + Source

                                                                                                  @@ -1761,7 +1832,7 @@

                                                                                                  Examples

                                                                                                  or a binary. If possible, please use tuple_size or binary_size.

                                                                                                  - Source + Source

                                                                                                  @@ -1783,7 +1854,7 @@

                                                                                                  Examples

                                                                                                  - Source + Source

                                                                                                  @@ -1801,7 +1872,7 @@

                                                                                                  Examples

                                                                                                  - Source + Source

                                                                                                  @@ -1823,7 +1894,7 @@

                                                                                                  Examples

                                                                                                  - Source + Source

                                                                                                  @@ -1841,7 +1912,7 @@

                                                                                                  Examples

                                                                                                  - Source + Source

                                                                                                  @@ -1855,7 +1926,7 @@

                                                                                                  Examples

                                                                                                  of communications channel not supported by distributed :

                                                                                                  - Source + Source

                                                                                                  @@ -1871,7 +1942,7 @@

                                                                                                  Examples

                                                                                                - Source + Source

                                                                                                @@ -1880,7 +1951,7 @@

                                                                                                Examples

                                                                                                A non-local return from a function. Check try/2 for more information.

                                                                                                - Source + Source

                                                                                                @@ -1889,7 +1960,7 @@

                                                                                                Examples

                                                                                                Returns the tail of a list. Raises ArgumentError if the list is empty.

                                                                                                - Source + Source

                                                                                                @@ -1905,7 +1976,7 @@

                                                                                                Examples

                                                                                                - Source + Source

                                                                                                @@ -1914,7 +1985,7 @@

                                                                                                Examples

                                                                                                Returns the size of a tuple.

                                                                                                - Source + Source

                                                                                                @@ -1923,7 +1994,7 @@

                                                                                                Examples

                                                                                                Converts a tuple to a list.

                                                                                                - Source + Source
                                                                                                @@ -1953,7 +2024,7 @@

                                                                                                Examples

                                                                                                - Source + Source

                                                                                                @@ -1975,7 +2046,7 @@

                                                                                                Examples

                                                                                                - Source + Source

                                                                                                @@ -1994,15 +2065,16 @@

                                                                                                Examples

                                                                                                - Source + Source

                                                                                                left && right

                                                                                                -

                                                                                                Provides a short-circuit operator that executes the second -expression only if the first one evalutes to true (i.e. it is -not nil nor false). Returns the first expression otherwise.

                                                                                                +

                                                                                                Provides a short-circuit operator that evaluates and returns +the second expression only if the first one evaluates to true +(i.e. it is not nil nor false). Returns the first expression +otherwise.

                                                                                                Examples

                                                                                                @@ -2021,7 +2093,7 @@

                                                                                                Examples

                                                                                                not only booleans, however it is not allowed in guards.

                                                                                                - Source + Source

                                                                                                @@ -2125,7 +2197,7 @@

                                                                                                Examples

                                                                                                - Source + Source

                                                                                                @@ -2160,7 +2232,7 @@

                                                                                                Examples

                                                                                                - Source + Source

                                                                                                @@ -2193,7 +2265,7 @@

                                                                                                Examples

                                                                                                - Source + Source

                                                                                                @@ -2216,7 +2288,7 @@

                                                                                                Examples

                                                                                                - Source + Source

                                                                                                @@ -2239,7 +2311,7 @@

                                                                                                Examples

                                                                                                - Source + Source

                                                                                                @@ -2258,7 +2330,7 @@

                                                                                                Examples

                                                                                                - Source + Source

                                                                                                @@ -2277,7 +2349,7 @@

                                                                                                Examples

                                                                                                - Source + Source

                                                                                                @@ -2293,7 +2365,7 @@

                                                                                                Examples

                                                                                                - Source + Source

                                                                                                @@ -2309,7 +2381,7 @@

                                                                                                Examples

                                                                                                - Source + Source

                                                                                                @@ -2359,7 +2431,7 @@

                                                                                                Examples

                                                                                                to manipulate module attributes.

                                                                                                - Source + Source

                                                                                                @@ -2377,7 +2449,7 @@

                                                                                                Examples

                                                                                                - Source + Source

                                                                                                @@ -2395,7 +2467,7 @@

                                                                                                Examples

                                                                                                - Source + Source

                                                                                                @@ -2406,12 +2478,12 @@

                                                                                                Examples

                                                                                                Examples

                                                                                                -
                                                                                                iex> Regex.match? %R(f#{1,3}o), "f#o"
                                                                                                +
                                                                                                iex> Regex.match?(%R(f#{1,3}o), "f#o")
                                                                                                 true
                                                                                                 
                                                                                                - Source + Source

                                                                                                @@ -2435,7 +2507,7 @@

                                                                                                Examples

                                                                                                - Source + Source

                                                                                                @@ -2453,7 +2525,7 @@

                                                                                                Examples

                                                                                                - Source + Source

                                                                                                @@ -2471,7 +2543,7 @@

                                                                                                Examples

                                                                                                - Source + Source

                                                                                                @@ -2481,12 +2553,12 @@

                                                                                                Examples

                                                                                                Examples

                                                                                                -
                                                                                                iex> Regex.match? %r(foo), "foo"
                                                                                                +
                                                                                                iex> Regex.match?(%r(foo), "foo")
                                                                                                 true
                                                                                                 
                                                                                                - Source + Source

                                                                                                @@ -2513,7 +2585,7 @@

                                                                                                Examples

                                                                                                - Source + Source

                                                                                                @@ -2582,7 +2654,7 @@

                                                                                                Atoms

                                                                                                In this case, "Hello" will be printed twice (one per each field).

                                                                                                - Source + Source

                                                                                                @@ -2608,12 +2680,12 @@

                                                                                                Examples

                                                                                                Examples

                                                                                                -
                                                                                                iex> apply fn x -> x * 2 end, [2]
                                                                                                +
                                                                                                iex> apply(fn x -> x * 2 end, [2])
                                                                                                 4
                                                                                                 
                                                                                                - Source + Source

                                                                                                @@ -2623,12 +2695,12 @@

                                                                                                Examples

                                                                                                Examples

                                                                                                -
                                                                                                iex> apply Enum, :reverse, [[1,2,3]]
                                                                                                +
                                                                                                iex> apply(Enum, :reverse, [[1,2,3]])
                                                                                                 [3,2,1]
                                                                                                 
                                                                                                - Source + Source

                                                                                                @@ -2639,12 +2711,12 @@

                                                                                                Examples

                                                                                                Examples

                                                                                                -
                                                                                                iex> atom_to_binary :my_atom
                                                                                                +
                                                                                                iex> atom_to_binary(:my_atom)
                                                                                                 "my_atom"
                                                                                                 
                                                                                                - Source + Source

                                                                                                @@ -2655,12 +2727,12 @@

                                                                                                Examples

                                                                                                Examples

                                                                                                -
                                                                                                iex> binary_to_atom "my_atom"
                                                                                                +
                                                                                                iex> binary_to_atom("my_atom")
                                                                                                 :my_atom
                                                                                                 
                                                                                                - Source + Source

                                                                                                @@ -2671,15 +2743,15 @@

                                                                                                Examples

                                                                                                Examples

                                                                                                iex> :my_atom
                                                                                                -...> binary_to_existing_atom "my_atom"
                                                                                                +...> binary_to_existing_atom("my_atom")
                                                                                                 :my_atom
                                                                                                 
                                                                                                -iex> binary_to_existing_atom "this_atom_will_never_exist"
                                                                                                +iex> binary_to_existing_atom("this_atom_will_never_exist")
                                                                                                 ** (ArgumentError) argument error
                                                                                                 
                                                                                                - Source + Source

                                                                                                @@ -2689,12 +2761,12 @@

                                                                                                Examples

                                                                                                Examples

                                                                                                -
                                                                                                iex> binary_to_float "2.2017764e+0"
                                                                                                +
                                                                                                iex> binary_to_float("2.2017764e+0")
                                                                                                 2.2017764
                                                                                                 
                                                                                                - Source + Source

                                                                                                @@ -2704,12 +2776,12 @@

                                                                                                Examples

                                                                                                Examples

                                                                                                -
                                                                                                iex> binary_to_integer "123"
                                                                                                +
                                                                                                iex> binary_to_integer("123")
                                                                                                 123
                                                                                                 
                                                                                                - Source + Source

                                                                                                @@ -2725,13 +2797,13 @@

                                                                                                Examples

                                                                                                - Source + Source

                                                                                                case(condition, blocks)

                                                                                                -

                                                                                                Matches the given condition against the match clauses.

                                                                                                +

                                                                                                Matches the given expression against the match clauses.

                                                                                                Examples

                                                                                                @@ -2742,9 +2814,9 @@

                                                                                                Examples

                                                                                                end
                                                                                                -

                                                                                                In the example above, we compare thing with each given -match clause and execute the first one that matches. If no -clause matches, an error is raised.

                                                                                                +

                                                                                                In the example above, we compare thing with each given match +clause and evaluate the expression corresponding to the first clause +that matches. If no clause matches, an error is raised.

                                                                                                Since Elixir variables can be assigned more than once, variables in a match clause will always be assigned instead of matching with @@ -2767,27 +2839,17 @@

                                                                                                Examples

                                                                                                The example above will actually fail because 10 does not match 1.

                                                                                                - -

                                                                                                Finally, case accepts an else: branch as a fallback if none -of the clauses match:

                                                                                                - -
                                                                                                case thing do
                                                                                                -  { :selector, i, value } when is_integer(i) ->
                                                                                                -    value
                                                                                                -  _ ->
                                                                                                -    thing
                                                                                                -end
                                                                                                -
                                                                                                - Source + Source

                                                                                                cond(list1)

                                                                                                -

                                                                                                Execute the first clause where the condition returns true, -raises an error otherwise.

                                                                                                +

                                                                                                Evaluates the expression corresponding to the first clause that +evaluates to true. Raises an error if all conditions evaluate to +to falsy values (nil or false).

                                                                                                Examples

                                                                                                @@ -2802,7 +2864,7 @@

                                                                                                Examples

                                                                                                - Source + Source

                                                                                                @@ -2832,7 +2894,7 @@

                                                                                                Examples

                                                                                                two arguments and sum them.

                                                                                                - Source + Source

                                                                                                @@ -2871,7 +2933,7 @@

                                                                                                Examples

                                                                                                - Source + Source

                                                                                                @@ -2919,7 +2981,7 @@

                                                                                                Examples

                                                                                                - Source + Source

                                                                                                @@ -2937,7 +2999,7 @@

                                                                                                Examples

                                                                                                binary as result;

                                                                                                - Source + Source

                                                                                                @@ -2947,7 +3009,62 @@

                                                                                                Examples

                                                                                                defprotocol/2 for examples.

                                                                                                - Source + Source + +
                                                                                                +

                                                                                                + defmacro(name, list2) +

                                                                                                +

                                                                                                Defines a macro with the given name and contents.

                                                                                                + +

                                                                                                Examples

                                                                                                + +
                                                                                                defmodule MyLogic do
                                                                                                +  defmacro unless(expr, opts) do
                                                                                                +    quote do
                                                                                                +      if !unquote(expr), unquote(opts)
                                                                                                +    end
                                                                                                +  end
                                                                                                +end
                                                                                                +
                                                                                                +require MyLogic
                                                                                                +MyLogic.unless false do
                                                                                                +  IO.puts "It works"
                                                                                                +end
                                                                                                +
                                                                                                +
                                                                                                + + Source + +
                                                                                                +

                                                                                                + defmacro(name, args, guards, list4) +

                                                                                                +

                                                                                                The same as def/4 but generates a macro.

                                                                                                +
                                                                                                + + Source + +
                                                                                                +

                                                                                                + defmacrop(name, list2) +

                                                                                                +

                                                                                                Defines a macro that is private. Private macros +can only be accessible from the same module it is defined.

                                                                                                + +

                                                                                                Check defmacro/2 for more information

                                                                                                +
                                                                                                + + Source + +
                                                                                                +

                                                                                                + defmacrop(name, args, guards, list4) +

                                                                                                +

                                                                                                The same as def/4 but generates a private macro.

                                                                                                +
                                                                                                + + Source

                                                                                                @@ -2997,7 +3114,7 @@

                                                                                                Dynamic names

                                                                                                returns an atom.

                                                                                                - Source + Source

                                                                                                @@ -3008,7 +3125,7 @@

                                                                                                Dynamic names

                                                                                                developer to customize it.

                                                                                                - Source + Source

                                                                                                @@ -3034,7 +3151,7 @@

                                                                                                Examples

                                                                                                through Foo.sum will raise an error.

                                                                                                - Source + Source

                                                                                                @@ -3043,7 +3160,7 @@

                                                                                                Examples

                                                                                                The same as def/4 but generates a private function.

                                                                                                - Source + Source

                                                                                                @@ -3175,11 +3292,11 @@

                                                                                                Types

                                                                                                given protocol are valid argument types for the given function.

                                                                                                - Source + Source
                                                                                                -

                                                                                                - defrecord(name, fields, opts // [], do_block // []) +

                                                                                                + defrecord(name, fields, do_block // [])

                                                                                                Defines a record.

                                                                                                @@ -3261,6 +3378,28 @@

                                                                                                Access syntax

                                                                                                Which provides faster get and set times for record operations.

                                                                                                +

                                                                                                Runtime introspection

                                                                                                + +

                                                                                                At runtime, developers can use __record__ to get information +about the given record:

                                                                                                + +
                                                                                                FileInfo.__record__(:name)
                                                                                                +#=> FileInfo
                                                                                                +
                                                                                                +FileInfo.__record__(:fields)
                                                                                                +#=> [atime: nil, accesses: 0]
                                                                                                +
                                                                                                + +

                                                                                                In order to quickly access the index of a field, one can use +the __index__ function:

                                                                                                + +
                                                                                                FileInfo.__index__(:atime)
                                                                                                +#=> 0
                                                                                                +
                                                                                                +FileInfo.__index__(:unknown)
                                                                                                +#=> nil
                                                                                                +
                                                                                                +

                                                                                                Compile-time introspection

                                                                                                At the compile time, one can access following information about the record @@ -3323,7 +3462,7 @@

                                                                                                Importing records

                                                                                                See Record.import/2 and defrecordp/2 documentation for more information

                                                                                                - Source + Source

                                                                                                @@ -3373,7 +3512,7 @@

                                                                                                Examples

                                                                                                - Source + Source

                                                                                                @@ -3395,7 +3534,7 @@

                                                                                                Example

                                                                                                - Source + Source

                                                                                                @@ -3408,7 +3547,7 @@

                                                                                                Example

                                                                                                Examples

                                                                                                -
                                                                                                iex> destructure [x,y,z], [1,2,3,4,5]
                                                                                                +
                                                                                                iex> destructure([x,y,z], [1,2,3,4,5])
                                                                                                 ...> {x, y, z}
                                                                                                 {1, 2, 3}
                                                                                                 
                                                                                                @@ -3418,7 +3557,7 @@

                                                                                                Examples

                                                                                                fine. If the right size is smaller, the remaining items are simply assigned to nil:

                                                                                                -
                                                                                                iex> destructure [x,y,z], [1]
                                                                                                +
                                                                                                iex> destructure([x,y,z], [1])
                                                                                                 ...> {x, y, z}
                                                                                                 {1, nil, nil}
                                                                                                 
                                                                                                @@ -3427,7 +3566,7 @@

                                                                                                Examples

                                                                                                on the left side of a match:

                                                                                                x = 1
                                                                                                -destructure [^x,y,z], [1,2,3]
                                                                                                +destructure([^x,y,z], [1,2,3])
                                                                                                 

                                                                                                The example above will only work if x matches @@ -3435,7 +3574,7 @@

                                                                                                Examples

                                                                                                it will raise a CaseClauseError.

                                                                                                - Source + Source

                                                                                                @@ -3447,12 +3586,12 @@

                                                                                                Examples

                                                                                                Examples

                                                                                                -
                                                                                                iex> div 5, 2
                                                                                                +
                                                                                                iex> div(5, 2)
                                                                                                 2
                                                                                                 
                                                                                                - Source + Source

                                                                                                @@ -3471,7 +3610,7 @@

                                                                                                Example

                                                                                                - Source + Source

                                                                                                @@ -3482,35 +3621,12 @@

                                                                                                Example

                                                                                                Examples

                                                                                                -
                                                                                                iex> float_to_binary 7.0
                                                                                                +
                                                                                                iex> float_to_binary(7.0)
                                                                                                 "7.00000000000000000000e+00"
                                                                                                 
                                                                                                - Source - -
                                                                                                -

                                                                                                - float_to_binary(some_float, options) -

                                                                                                -

                                                                                                Returns a binary which corresponds to the text representation -of some_float.

                                                                                                - -

                                                                                                Options

                                                                                                - -
                                                                                                  -
                                                                                                • :decimals — number of decimal points to show
                                                                                                • -
                                                                                                • :scientific — number of decimal points to show, in scientific format
                                                                                                • -
                                                                                                • :compact — If true, use the most compact representation. Ignored with the scientific option
                                                                                                • -
                                                                                                - -

                                                                                                Examples

                                                                                                - -
                                                                                                float_to_binary 7.1, [decimals: 2, compact: true] #=> "7.1"
                                                                                                -
                                                                                                -
                                                                                                - - Source + Source

                                                                                                @@ -3604,7 +3720,7 @@

                                                                                                Shortcut syntax

                                                                                                - Source + Source

                                                                                                @@ -3620,7 +3736,7 @@

                                                                                                Examples

                                                                                                - Source + Source

                                                                                                @@ -3634,7 +3750,7 @@

                                                                                                One-liner examples

                                                                                                if(foo, do: bar)
                                                                                                 
                                                                                                -

                                                                                                In the example above, bar will be returned if foo evalutes to +

                                                                                                In the example above, bar will be returned if foo evaluates to true (i.e. it is not false nor nil). Otherwise, nil will be returned.

                                                                                                An else option can be given to specify the opposite:

                                                                                                @@ -3666,15 +3782,14 @@

                                                                                                Blocks examples

                                                                                                macro.

                                                                                                - Source + Source

                                                                                                left in right

                                                                                                Returns true if the element on the left is equal (==) to -any of the items in the right. For now, it only accepts -a list as the right argument.

                                                                                                +any of the items in the right.

                                                                                                Examples

                                                                                                @@ -3688,6 +3803,9 @@

                                                                                                Examples

                                                                                                x == 1 or x == 2 or x == 3
                                                                                                 
                                                                                                +

                                                                                                with the exception that the expression on the left of in +is evaluated only once.

                                                                                                +

                                                                                                Clauses

                                                                                                Whenever used inside a function or a case clause, you can @@ -3711,7 +3829,7 @@

                                                                                                Clauses

                                                                                                the variable for us.

                                                                                                - Source + Source

                                                                                                @@ -3733,7 +3851,7 @@

                                                                                                Example

                                                                                                - Source + Source

                                                                                                @@ -3767,7 +3885,7 @@

                                                                                                Examples

                                                                                                - Source + Source

                                                                                                @@ -3778,12 +3896,12 @@

                                                                                                Examples

                                                                                                Examples

                                                                                                -
                                                                                                iex> integer_to_binary 123
                                                                                                +
                                                                                                iex> integer_to_binary(123)
                                                                                                 "123"
                                                                                                 
                                                                                                - Source + Source

                                                                                                @@ -3794,12 +3912,12 @@

                                                                                                Examples

                                                                                                Examples

                                                                                                -
                                                                                                iex> integer_to_binary 77
                                                                                                +
                                                                                                iex> integer_to_binary(77)
                                                                                                 "77"
                                                                                                 
                                                                                                - Source + Source

                                                                                                @@ -3816,7 +3934,7 @@

                                                                                                Examples

                                                                                                - Source + Source

                                                                                                @@ -3825,7 +3943,7 @@

                                                                                                Examples

                                                                                                Checks if the given argument is a range.

                                                                                                - Source + Source

                                                                                                @@ -3834,7 +3952,7 @@

                                                                                                Examples

                                                                                                Checks if the given argument is a record.

                                                                                                - Source + Source

                                                                                                @@ -3853,7 +3971,7 @@

                                                                                                Examples

                                                                                                - Source + Source

                                                                                                @@ -3862,7 +3980,7 @@

                                                                                                Examples

                                                                                                Checks if the given argument is a regex.

                                                                                                - Source + Source

                                                                                                @@ -3894,7 +4012,7 @@

                                                                                                Examples

                                                                                                - Source + Source

                                                                                                @@ -3905,14 +4023,14 @@

                                                                                                Examples

                                                                                                Examples

                                                                                                -
                                                                                                iex> nil? 1
                                                                                                +
                                                                                                iex> nil?(1)
                                                                                                 false
                                                                                                -iex> nil? nil
                                                                                                +iex> nil?(nil)
                                                                                                 true
                                                                                                 
                                                                                                - Source + Source

                                                                                                @@ -3928,7 +4046,7 @@

                                                                                                Examples

                                                                                                - Source + Source

                                                                                                @@ -3994,7 +4112,7 @@

                                                                                                Examples

                                                                                              - Source + Source

                                                                                              @@ -4006,12 +4124,12 @@

                                                                                              Examples

                                                                                              Examples

                                                                                              -
                                                                                              iex> rem 5, 2
                                                                                              +
                                                                                              iex> rem(5, 2)
                                                                                               1
                                                                                               
                                                                                              - Source + Source

                                                                                              @@ -4028,7 +4146,7 @@

                                                                                              Example

                                                                                              - Source + Source

                                                                                              @@ -4044,7 +4162,7 @@

                                                                                              Examples

                                                                                              - Source + Source

                                                                                              @@ -4059,13 +4177,13 @@

                                                                                              Examples

                                                                                              - Source + Source

                                                                                              try(args)

                                                                                              -

                                                                                              Execute the given expressions and catch any error, exit +

                                                                                              Evaluate the given expressions and catch any error, exit or throw that may have happened.

                                                                                              Examples

                                                                                              @@ -4148,7 +4266,7 @@

                                                                                              Catching exits and Erlang errors

                                                                                              Variable visibility

                                                                                              -

                                                                                              Since an expression inside try may not have been evaluted +

                                                                                              Since an expression inside try may not have been evaluated due to an exception, any variable created inside try cannot be accessed externaly. For instance:

                                                                                              @@ -4178,18 +4296,27 @@

                                                                                              Variable visibility

                                                                                              - Source + Source

                                                                                              unless(clause, options)

                                                                                              -

                                                                                              Provides a unless macro that executes the expression -unless a value evalutes to true. Check if for examples -and documentation.

                                                                                              +

                                                                                              Evaluates and returns the do-block passed in as a second argument +unless clause evaluates to true. +Returns nil otherwise. +See also if.

                                                                                              + +

                                                                                              Examples

                                                                                              + +
                                                                                              iex> unless(1, do: "Hello")
                                                                                              +nil
                                                                                              +iex> unless(false, do: "Hello")
                                                                                              +"Hello"
                                                                                              +
                                                                                              - Source + Source

                                                                                              @@ -4228,23 +4355,26 @@

                                                                                              Examples

                                                                                              - Source + Source

                                                                                              left xor right

                                                                                              -

                                                                                              Boolean xor. Arguments must be booleans. +

                                                                                              Boolean exclusive-or. Arguments must be booleans. Returns true if and only if +both arguments are different. Allowed in guard clauses.

                                                                                              Examples

                                                                                              iex> true xor false
                                                                                               true
                                                                                              +iex> true xor true
                                                                                              +false
                                                                                               
                                                                                              - Source + Source

                                                                                              @@ -4285,15 +4415,15 @@

                                                                                              Examples

                                                                                              - Source + Source

                                                                                              left || right

                                                                                              -

                                                                                              Provides a short-circuit operator that executes the second -expression only if the first one does not evalute to true (i.e. it -is not nil nor false). Returns the first expression otherwise.

                                                                                              +

                                                                                              Provides a short-circuit operator that evaluates and returns the second +expression only if the first one does not evaluate to true (i.e. it +is either nil or false). Returns the first expression otherwise.

                                                                                              Examples

                                                                                              @@ -4312,7 +4442,7 @@

                                                                                              Examples

                                                                                              not only booleans, however it is not allowed in guards.

                                                                                              - Source + Source
                                                                                              diff --git a/docs/master/KeyError.html b/docs/master/KeyError.html index 4f6847a95..9170b8661 100644 --- a/docs/master/KeyError.html +++ b/docs/master/KeyError.html @@ -29,7 +29,7 @@

                                                                                              - Source + Source @@ -71,7 +71,7 @@

                                                                                              Functions

                                                                                              - Source + Source
                                                                                              diff --git a/docs/master/Keyword.html b/docs/master/Keyword.html index b1bfe9cba..91c7d95aa 100644 --- a/docs/master/Keyword.html +++ b/docs/master/Keyword.html @@ -29,7 +29,7 @@

                                                                                              A keyword is a list of tuples where the first element of the tuple is an atom and the second element can be -any value.

                                                                                              +any value.

                                                                                              A keyword may have duplicated keys, so it is not strictly a dictionary. However most of the functions in this module @@ -56,6 +56,11 @@

                                                                                              Functions summary

                                                                                              delete/2

                                                                                            • +
                                                                                            • + + delete_first/2 + +
                                                                                            • equal?/2 @@ -63,17 +68,22 @@

                                                                                              Functions summary

                                                                                            • - from_enum/1 + fetch/2
                                                                                            • - get/3 + fetch!/2 + +
                                                                                            • +
                                                                                            • + + from_enum/1
                                                                                            • - get!/2 + get/3
                                                                                            • @@ -168,14 +178,32 @@

                                                                                              Functions

                                                                                              Examples

                                                                                              -
                                                                                              iex> Keyword.delete [a: 1, b: 2], :a
                                                                                              +
                                                                                              iex> Keyword.delete([a: 1, b: 2], :a)
                                                                                              +[b: 2]
                                                                                              +iex> Keyword.delete([b: 2], :a)
                                                                                               [b: 2]
                                                                                              -iex> Keyword.delete [b: 2], :a
                                                                                              +
                                                                                              + + + Source + +
                                                                                              +

                                                                                              + delete_first(keywords, key) +

                                                                                              +

                                                                                              Deletes the first entry in the keyword list for a specific key. +If the key does not exist, returns the keyword list unchanged.

                                                                                              + +

                                                                                              Examples

                                                                                              + +
                                                                                              iex> Keyword.delete_first([a: 1, b: 2, a: 3], :a)
                                                                                              +[b: 2, a: 3]
                                                                                              +iex> Keyword.delete_first([b: 2], :a)
                                                                                               [b: 2]
                                                                                               
                                                                                              - Source + Source

                                                                                              @@ -186,12 +214,49 @@

                                                                                              Examples

                                                                                              Examples

                                                                                              -
                                                                                              iex> Keyword.equal? [a: 1, b: 2], [b: 2, a: 1]
                                                                                              +
                                                                                              iex> Keyword.equal?([a: 1, b: 2], [b: 2, a: 1])
                                                                                               true
                                                                                               
                                                                                              - Source + Source + +
                                                                                              +

                                                                                              + fetch(keywords, key) +

                                                                                              +

                                                                                              Fetchs the value for specific key and return it in a tuple. +If the key does not exist, returns :error.

                                                                                              + +

                                                                                              Examples

                                                                                              + +
                                                                                              iex> Keyword.fetch([a: 1], :a)
                                                                                              +{ :ok, 1 }
                                                                                              +
                                                                                              +iex> Keyword.fetch([a: 1], :b)
                                                                                              +:error
                                                                                              +
                                                                                              +
                                                                                              + + Source + +
                                                                                              +

                                                                                              + fetch!(keywords, key) +

                                                                                              +

                                                                                              Fetches the value for specific key. If key does not exist, +an error is raised.

                                                                                              + +

                                                                                              Examples

                                                                                              + +
                                                                                              iex> Keyword.fetch!([a: 1], :a)
                                                                                              +1
                                                                                              +iex> Keyword.fetch!([a: 1], :b)
                                                                                              +** (KeyError) key not found: :b
                                                                                              +
                                                                                              +
                                                                                              + + Source

                                                                                              @@ -218,34 +283,16 @@

                                                                                              Examples

                                                                                              Examples

                                                                                              -
                                                                                              iex> Keyword.get [a: 1], :a
                                                                                              +
                                                                                              iex> Keyword.get([a: 1], :a)
                                                                                               1
                                                                                              -iex> Keyword.get [a: 1], :b
                                                                                              +iex> Keyword.get([a: 1], :b)
                                                                                               nil
                                                                                              -iex> Keyword.get [a: 1], :b, 3
                                                                                              +iex> Keyword.get([a: 1], :b, 3)
                                                                                               3
                                                                                               
                                                                                              - Source - -
                                                                                              -

                                                                                              - get!(keywords, key) -

                                                                                              -

                                                                                              Gets the value for specific key. If key does not exist, -an error is raised.

                                                                                              - -

                                                                                              Examples

                                                                                              - -
                                                                                              iex> Keyword.get! [a: 1], :a
                                                                                              -1
                                                                                              -iex> Keyword.get! [a: 1], :b
                                                                                              -** (KeyError) key not found: :b
                                                                                              -
                                                                                              -
                                                                                              - - Source + Source

                                                                                              @@ -255,12 +302,12 @@

                                                                                              Examples

                                                                                              Examples

                                                                                              -
                                                                                              iex> Keyword.get_values [a: 1, a: 2], :a
                                                                                              +
                                                                                              iex> Keyword.get_values([a: 1, a: 2], :a)
                                                                                               [1,2]
                                                                                               
                                                                                              - Source + Source

                                                                                              @@ -277,7 +324,7 @@

                                                                                              Examples

                                                                                              - Source + Source

                                                                                              @@ -288,12 +335,12 @@

                                                                                              Examples

                                                                                              Examples

                                                                                              -
                                                                                              iex> Keyword.keys [a: 1, b: 2]
                                                                                              +
                                                                                              iex> Keyword.keys([a: 1, b: 2])
                                                                                               [:a,:b]
                                                                                               
                                                                                              - Source + Source

                                                                                              @@ -313,12 +360,12 @@

                                                                                              Examples

                                                                                              Examples

                                                                                              -
                                                                                              iex> Enum.sort Keyword.merge [a: 1, b: 2], [a: 3, d: 4]
                                                                                              +
                                                                                              iex> Keyword.merge([a: 1, b: 2], [a: 3, d: 4]) |> Enum.sort
                                                                                               [a: 3, b: 2, d: 4]
                                                                                               
                                                                                              - Source + Source

                                                                                              @@ -329,14 +376,14 @@

                                                                                              Examples

                                                                                              Examples

                                                                                              -
                                                                                              iex> Keyword.merge [a: 1, b: 2], [a: 3, d: 4], fn _k, v1, v2 ->
                                                                                              +
                                                                                              iex> Keyword.merge([a: 1, b: 2], [a: 3, d: 4], fn (_k, v1, v2) ->
                                                                                               ...>  v1 + v2
                                                                                              -iex> end
                                                                                              +iex> end)
                                                                                               [a: 4, b: 2, d: 4]
                                                                                               
                                                                                              - Source + Source

                                                                                              @@ -345,7 +392,7 @@

                                                                                              Examples

                                                                                              Returns an empty keyword list, i.e. an empty list.

                                                                                              - Source + Source

                                                                                              @@ -356,12 +403,12 @@

                                                                                              Examples

                                                                                              Examples

                                                                                              -
                                                                                              iex> Keyword.new [{:b,1},{:a,2}]
                                                                                              +
                                                                                              iex> Keyword.new([{:b,1},{:a,2}])
                                                                                               [a: 2, b: 1]
                                                                                               
                                                                                              - Source + Source

                                                                                              @@ -373,12 +420,12 @@

                                                                                              Examples

                                                                                              Examples

                                                                                              -
                                                                                              iex> Enum.sort Keyword.new [:a, :b], fn x -> {x,x} end
                                                                                              +
                                                                                              iex> Keyword.new([:a, :b], fn (x) -> {x,x} end) |> Enum.sort
                                                                                               [a: :a, b: :b]
                                                                                               
                                                                                              - Source + Source

                                                                                              @@ -391,12 +438,12 @@

                                                                                              Examples

                                                                                              Examples

                                                                                              -
                                                                                              iex> Keyword.put [a: 1, b: 2], :a, 3
                                                                                              +
                                                                                              iex> Keyword.put([a: 1, b: 2], :a, 3)
                                                                                               [a: 3, b: 2]
                                                                                               
                                                                                              - Source + Source

                                                                                              @@ -407,12 +454,12 @@

                                                                                              Examples

                                                                                              Examples

                                                                                              -
                                                                                              iex> Keyword.put_new [a: 1, b: 2], :a, 3
                                                                                              +
                                                                                              iex> Keyword.put_new([a: 1, b: 2], :a, 3)
                                                                                               [a: 1, b: 2]
                                                                                               
                                                                                              - Source + Source

                                                                                              @@ -430,7 +477,7 @@

                                                                                              Examples

                                                                                              - Source + Source

                                                                                              @@ -448,7 +495,7 @@

                                                                                              Examples

                                                                                              - Source + Source

                                                                                              @@ -458,12 +505,12 @@

                                                                                              Examples

                                                                                              Examples

                                                                                              -
                                                                                              iex> Keyword.values [a: 1, b: 2]
                                                                                              +
                                                                                              iex> Keyword.values([a: 1, b: 2])
                                                                                               [1,2]
                                                                                               
                                                                                              - Source + Source diff --git a/docs/master/List.Chars.Number.html b/docs/master/List.Chars.Number.html index 56e96f457..51fef0449 100644 --- a/docs/master/List.Chars.Number.html +++ b/docs/master/List.Chars.Number.html @@ -56,11 +56,11 @@

                                                                                              Functions summary

                                                                                              Functions

                                                                                              - to_char_list(integer) + to_char_list(thing)

                                                                                              - Source + Source
                                                                                              diff --git a/docs/master/List.html b/docs/master/List.html index fe0b41ab6..3420ff583 100644 --- a/docs/master/List.html +++ b/docs/master/List.html @@ -88,6 +88,11 @@

                                                                                              Functions summary

                                                                                              foldr/3
                                                                                            • +
                                                                                            • + + insert_at/3 + +
                                                                                            • keydelete/3 @@ -118,11 +123,6 @@

                                                                                              Functions summary

                                                                                              last/1
                                                                                            • -
                                                                                            • - - member?/2 - -
                                                                                            • unzip/1 @@ -157,7 +157,7 @@

                                                                                              Functions

                                                                                              Examples

                                                                                              -
                                                                                              iex> List.concat [[1,[2],3], [4], [5,6]]
                                                                                              +
                                                                                              iex> List.concat([[1,[2],3], [4], [5,6]])
                                                                                               [1,[2],3,4,5,6]
                                                                                               
                                                                                              @@ -176,7 +176,7 @@

                                                                                              Examples

                                                                                              Examples

                                                                                              -
                                                                                              iex> List.concat [1,2,3], [4,5,6]
                                                                                              +
                                                                                              iex> List.concat([1,2,3], [4,5,6])
                                                                                               [1,2,3,4,5,6]
                                                                                               
                                                                                              @@ -208,10 +208,10 @@

                                                                                              Examples

                                                                                              Examples

                                                                                              -
                                                                                              iex> List.duplicate "hello", 3
                                                                                              +
                                                                                              iex> List.duplicate("hello", 3)
                                                                                               ["hello","hello","hello"]
                                                                                               
                                                                                              -iex> List.duplicate [1,2], 2
                                                                                              +iex> List.duplicate([1,2], 2)
                                                                                               [[1,2],[1,2]]
                                                                                               
                                                                                              @@ -228,10 +228,10 @@

                                                                                              Examples

                                                                                              Examples

                                                                                              -
                                                                                              iex> List.flatten [1,[[2],3]]
                                                                                              +
                                                                                              iex> List.flatten([1,[[2],3]])
                                                                                               [1,2,3]
                                                                                               
                                                                                              -iex> List.flatten [1,[[2],3]], [4,5]
                                                                                              +iex> List.flatten([1,[[2],3]], [4,5])
                                                                                               [1,2,3,4,5]
                                                                                               
                                                                                              @@ -255,10 +255,10 @@

                                                                                              Examples

                                                                                              Examples

                                                                                              -
                                                                                              iex> List.foldl [5,5], 10, fn x, acc -> x + acc end
                                                                                              +
                                                                                              iex> List.foldl([5,5], 10, fn (x, acc) -> x + acc end)
                                                                                               20
                                                                                               
                                                                                              -iex> List.foldl [1,2,3,4], 0, fn x, acc -> x - acc end
                                                                                              +iex> List.foldl([1,2,3,4], 0, fn (x, acc) -> x - acc end)
                                                                                               2
                                                                                               
                                                                                              @@ -274,13 +274,36 @@

                                                                                              Examples

                                                                                              Examples

                                                                                              -
                                                                                              iex> List.foldr [1,2,3,4], 0, fn x, acc -> x - acc end
                                                                                              +
                                                                                              iex> List.foldr([1,2,3,4], 0, fn (x, acc) -> x - acc end)
                                                                                               -2
                                                                                               
                                                                                              Source +
                                                                                              +

                                                                                              + insert_at(list, index, value) +

                                                                                              +

                                                                                              Returns a list with an inserted value at specified index. Note that the index +is capped at the list length and that negative indicies wraps around at the +end of the list.

                                                                                              + +

                                                                                              Examples

                                                                                              + +
                                                                                              iex> List.insert_at([1, 2, 3, 4], 2, 0)
                                                                                              +[1, 2, 0, 3, 4]
                                                                                              +
                                                                                              +iex> List.insert_at([1, 2, 3], 10, 0)
                                                                                              +[1, 2, 3, 0]
                                                                                              +
                                                                                              +iex> List.insert_at([1, 2, 3], -1, 0)
                                                                                              +[1, 2, 0, 3]
                                                                                              +
                                                                                              +
                                                                                              + + Source +

                                                                                              keydelete(list, key, position) @@ -302,14 +325,14 @@

                                                                                              Examples

                                                                                              - Source + Source

                                                                                              keyfind(list, key, position, default // nil)

                                                                                              Receives a list of tuples and returns the first tuple -where the item at position posistion matches with the +where the item at position position matches with the given item.

                                                                                              Examples

                                                                                              @@ -325,7 +348,7 @@

                                                                                              Examples

                                                                                              - Source + Source

                                                                                              @@ -348,7 +371,7 @@

                                                                                              Examples

                                                                                              - Source + Source

                                                                                              @@ -364,7 +387,7 @@

                                                                                              Examples

                                                                                              - Source + Source

                                                                                              @@ -381,7 +404,7 @@

                                                                                              Examples

                                                                                              - Source + Source

                                                                                              @@ -391,37 +414,17 @@

                                                                                              Examples

                                                                                              Examples

                                                                                              -
                                                                                              iex> List.last []
                                                                                              +
                                                                                              iex> List.last([])
                                                                                               nil
                                                                                              -iex> List.last [1]
                                                                                              +iex> List.last([1])
                                                                                               1
                                                                                              -iex> List.last [1, 2, 3]
                                                                                              +iex> List.last([1, 2, 3])
                                                                                               3
                                                                                               
                                                                                              Source -
                                                                                              -

                                                                                              - member?(list, term) -

                                                                                              -

                                                                                              Checks if the given term is included in the list. -This function simply delegates to lists:member -which is implemented in C for performance.

                                                                                              - -

                                                                                              Examples

                                                                                              - -
                                                                                              iex> List.member? [1,2,3], 1
                                                                                              -true
                                                                                              -
                                                                                              -iex> List.member? [1,2,3], 0
                                                                                              -false
                                                                                              -
                                                                                              -
                                                                                              - - Source -

                                                                                              unzip(list) @@ -431,15 +434,15 @@

                                                                                              Examples

                                                                                              Examples

                                                                                              -
                                                                                              iex> List.unzip [{1, 2}, {3, 4}]
                                                                                              +
                                                                                              iex> List.unzip([{1, 2}, {3, 4}])
                                                                                               [[1, 3], [2, 4]]
                                                                                               
                                                                                              -iex> List.unzip [{1, :a, "apple"}, {2, :b, "banana"}, {3, :c}]
                                                                                              +iex> List.unzip([{1, :a, "apple"}, {2, :b, "banana"}, {3, :c}])
                                                                                               [[1, 2, 3], [:a, :b, :c]]
                                                                                               
                                                                                              - Source + Source

                                                                                              @@ -451,12 +454,12 @@

                                                                                              Examples

                                                                                              Examples

                                                                                              -
                                                                                              iex> List.wrap [1,2,3]
                                                                                              +
                                                                                              iex> List.wrap([1,2,3])
                                                                                               [1,2,3]
                                                                                               
                                                                                              - Source + Source

                                                                                              @@ -466,15 +469,15 @@

                                                                                              Examples

                                                                                              Examples

                                                                                              -
                                                                                              iex> List.zip [[1, 2], [3, 4], [5, 6]]
                                                                                              +
                                                                                              iex> List.zip([[1, 2], [3, 4], [5, 6]])
                                                                                               [{1, 3, 5}, {2, 4, 6}]
                                                                                               
                                                                                              -iex> List.zip [[1, 2], [3], [5, 6]]
                                                                                              +iex> List.zip([[1, 2], [3], [5, 6]])
                                                                                               [{1, 3, 5}]
                                                                                               
                                                                                              - Source + Source diff --git a/docs/master/List.Dict.html b/docs/master/ListDict.html similarity index 61% rename from docs/master/List.Dict.html rename to docs/master/ListDict.html index 50e357014..8850700a9 100644 --- a/docs/master/List.Dict.html +++ b/docs/master/ListDict.html @@ -1,7 +1,7 @@ - List.Dict + ListDict @@ -21,7 +21,7 @@

                                                                                              - List.Dict + ListDict

                                                                                              @@ -35,7 +35,7 @@

                                                                                              - Source + Source @@ -49,6 +49,11 @@

                                                                                              Functions summary

                                                                                              delete/2
                                                                                            • +
                                                                                            • + + drop/2 + +
                                                                                            • empty/1 @@ -56,12 +61,22 @@

                                                                                              Functions summary

                                                                                            • - get/3 + equal?/2 + +
                                                                                            • +
                                                                                            • + + fetch/2 + +
                                                                                            • +
                                                                                            • + + fetch!/2
                                                                                            • - get!/2 + get/3
                                                                                            • @@ -94,6 +109,11 @@

                                                                                              Functions summary

                                                                                              new/2
                                                                                            • +
                                                                                            • + + pop/3 + +
                                                                                            • put/3 @@ -109,6 +129,16 @@

                                                                                              Functions summary

                                                                                              size/1
                                                                                            • +
                                                                                            • + + split/2 + +
                                                                                            • +
                                                                                            • + + take/2 + +
                                                                                            • to_list/1 @@ -147,36 +177,65 @@

                                                                                              Functions

                                                                                              Deletes the entry under the given key from the dict.

                                                                                              - Source + Source + +
                                                                                              +

                                                                                              + drop(dict, keys) +

                                                                                              +

                                                                                              Returns a new dict with only the entries +which key is not in keys

                                                                                              +
                                                                                              + + Source

                                                                                              empty(_dict)

                                                                                              -

                                                                                              Returns an empty List.Dict.

                                                                                              +

                                                                                              Returns an empty ListDict.

                                                                                              - Source + Source
                                                                                              -

                                                                                              - get(dict, key, default // nil) +

                                                                                              + equal?(dict, other) +

                                                                                              +

                                                                                              Check if the ListDict is equal to another ListDict.

                                                                                              +
                                                                                              + + Source + +
                                                                                              +

                                                                                              + fetch(dict, key)

                                                                                              Returns the value under key from the given -dict or default if no key is set.

                                                                                              +dict in a tagged tuple, otherwise :error.

                                                                                              - Source + Source
                                                                                              -

                                                                                              - get!(dict, key) +

                                                                                              + fetch!(dict, key)

                                                                                              Returns the value under the given key raises KeyError if the key does not exist.

                                                                                              - Source + Source + +
                                                                                              +

                                                                                              + get(dict, key, default // nil) +

                                                                                              +

                                                                                              Returns the value under key from the given +dict or default if no key is set.

                                                                                              +
                                                                                              + + Source

                                                                                              @@ -185,7 +244,7 @@

                                                                                              Functions

                                                                                              Returns true if the dict has the given key.

                                                                                              - Source + Source

                                                                                              @@ -194,7 +253,7 @@

                                                                                              Functions

                                                                                              Returns all keys in the dict.

                                                                                              - Source + Source

                                                                                              @@ -203,35 +262,45 @@

                                                                                              Functions

                                                                                              Merges the given Enumerable into the dict.

                                                                                              - Source + Source

                                                                                              new()

                                                                                              -

                                                                                              Returns a new List.Dict, i.e. an empty list.

                                                                                              +

                                                                                              Returns a new ListDict, i.e. an empty list.

                                                                                              - Source + Source

                                                                                              new(pairs)

                                                                                              -

                                                                                              Creates a new List.Dict from the given pairs.

                                                                                              +

                                                                                              Creates a new ListDict from the given pairs.

                                                                                              - Source + Source

                                                                                              new(list, transform)

                                                                                              -

                                                                                              Creates a new List.Dict from the given pairs +

                                                                                              Creates a new ListDict from the given pairs via the given transformation function.

                                                                                              - Source + Source + +
                                                                                              +

                                                                                              + pop(dict, key, default // nil) +

                                                                                              +

                                                                                              Returns the value under the given key +from the dict as well as the dict without that key.

                                                                                              +
                                                                                              + + Source

                                                                                              @@ -240,7 +309,7 @@

                                                                                              Functions

                                                                                              Puts the given key-value pair in the dict.

                                                                                              - Source + Source

                                                                                              @@ -250,7 +319,7 @@

                                                                                              Functions

                                                                                              if no entry exists yet.

                                                                                              - Source + Source

                                                                                              @@ -259,7 +328,29 @@

                                                                                              Functions

                                                                                              Returns the dict size.

                                                                                              - Source + Source + +
                                                                                              +

                                                                                              + split(dict, keys) +

                                                                                              +

                                                                                              Splits a dict into two dicts, +one containing entries with key in the keys list, +and another containing entries with key not in keys. +Returns a 2-tuple of the new dicts.

                                                                                              +
                                                                                              + + Source + +
                                                                                              +

                                                                                              + take(dict, keys) +

                                                                                              +

                                                                                              Returns a new dict with only the entries +which key is in keys

                                                                                              +
                                                                                              + + Source

                                                                                              @@ -268,7 +359,7 @@

                                                                                              Functions

                                                                                              Converts the dict to a list.

                                                                                              - Source + Source

                                                                                              @@ -277,7 +368,7 @@

                                                                                              Functions

                                                                                              Updates the key in the dict according to the given function.

                                                                                              - Source + Source

                                                                                              @@ -287,7 +378,7 @@

                                                                                              Functions

                                                                                              or uses the given initial value if no entry exists.

                                                                                              - Source + Source

                                                                                              @@ -296,7 +387,7 @@

                                                                                              Functions

                                                                                              Returns all values in the dict.

                                                                                              - Source + Source
                                                                                              diff --git a/docs/master/Macro.Env.html b/docs/master/Macro.Env.html index 862c4b00c..27170e074 100644 --- a/docs/master/Macro.Env.html +++ b/docs/master/Macro.Env.html @@ -49,6 +49,7 @@

                                                                                            • requires - the list of required modules
                                                                                            • functions - a list of functions imported from each module
                                                                                            • macros - a list of macros imported from each module
                                                                                            • +
                                                                                            • context_modules - a list of modules defined in the current context
                                                                                            @@ -116,6 +117,12 @@

                                                                                            Fields (and defaults)

                                                                                          • +
                                                                                          • + + context_modules: nil + +
                                                                                          • +
                                                                                          @@ -161,7 +168,7 @@

                                                                                          Functions

                                                                                          inside a guard.

                                                                                          - Source + Source

                                                                                          @@ -171,7 +178,7 @@

                                                                                          Functions

                                                                                          inside a match clause.

                                                                                          - Source + Source

                                                                                          @@ -181,7 +188,7 @@

                                                                                          Functions

                                                                                          information as keys.

                                                                                          - Source + Source

                                                                                          @@ -190,7 +197,7 @@

                                                                                          Functions

                                                                                          Returns the environment stacktrace.

                                                                                          - Source + Source
                                                                                          diff --git a/docs/master/Macro.html b/docs/master/Macro.html index a4861ebae..4827735ee 100644 --- a/docs/master/Macro.html +++ b/docs/master/Macro.html @@ -231,7 +231,7 @@

                                                                                          Examples

                                                                                          - Source + Source

                                                                                          @@ -266,7 +266,7 @@

                                                                                          Examples

                                                                                          which is returned as { :unsafe, term }.

                                                                                          - Source + Source

                                                                                          @@ -281,7 +281,7 @@

                                                                                          Examples

                                                                                          - Source + Source

                                                                                          @@ -301,7 +301,7 @@

                                                                                          Examples

                                                                                          Examples

                                                                                          -
                                                                                          iex> Macro.unescape_binary "example\\n"
                                                                                          +
                                                                                          iex> Macro.unescape_binary("example\\n")
                                                                                           "example\n"
                                                                                           
                                                                                          @@ -309,7 +309,7 @@

                                                                                          Examples

                                                                                          and we return a version with it unescaped.

                                                                                          - Source + Source

                                                                                          @@ -359,7 +359,7 @@

                                                                                          Examples

                                                                                          - Source + Source

                                                                                          @@ -375,7 +375,7 @@

                                                                                          Examples

                                                                                          for examples.

                                                                                          - Source + Source

                                                                                          @@ -385,7 +385,7 @@

                                                                                          Examples

                                                                                          Check unescape_tokens/1 and unescape_binary/2 for more information.

                                                                                          - Source + Source diff --git a/docs/master/MatchError.html b/docs/master/MatchError.html index 7b131b744..d13c9ad64 100644 --- a/docs/master/MatchError.html +++ b/docs/master/MatchError.html @@ -29,7 +29,7 @@

                                                                                          - Source + Source @@ -71,7 +71,7 @@

                                                                                          Functions

                                                                                          - Source + Source diff --git a/docs/master/Mix.Dep.html b/docs/master/Mix.Dep.html index 7560e4255..03f1ba108 100644 --- a/docs/master/Mix.Dep.html +++ b/docs/master/Mix.Dep.html @@ -88,6 +88,12 @@

                                                                                          Fields (and defaults)

                                                                                        • +
                                                                                        • + + deps: [] + +
                                                                                        • +
                                                                                        diff --git a/docs/master/Mix.Deps.html b/docs/master/Mix.Deps.html index 64a247905..2e4ba7d5b 100644 --- a/docs/master/Mix.Deps.html +++ b/docs/master/Mix.Deps.html @@ -32,7 +32,7 @@

                                                                                        - Source + Source @@ -58,7 +58,7 @@

                                                                                        Functions summary

                                                                                      • - by_name!/1 + by_name/2
                                                                                      • @@ -66,6 +66,21 @@

                                                                                        Functions summary

                                                                                        check_lock/2
                                                                                      • +
                                                                                      • + + children/0 + +
                                                                                      • +
                                                                                      • + + compile_paths/1 + +
                                                                                      • +
                                                                                      • + + depending/2 + +
                                                                                      • format_dep/1 @@ -76,6 +91,31 @@

                                                                                        Functions summary

                                                                                        format_status/1
                                                                                      • +
                                                                                      • + + in_dependency/3 + +
                                                                                      • +
                                                                                      • + + in_umbrella?/2 + +
                                                                                      • +
                                                                                      • + + load_paths/1 + +
                                                                                      • +
                                                                                      • + + make?/1 + +
                                                                                      • +
                                                                                      • + + mix?/1 + +
                                                                                      • ok?/1 @@ -86,6 +126,11 @@

                                                                                        Functions summary

                                                                                        out_of_date?/1
                                                                                      • +
                                                                                      • + + rebar?/1 + +
                                                                                      • update/1 @@ -114,7 +159,7 @@

                                                                                        Exceptions

                                                                                        provides a dependency in the wrong format.

                                                                                        - Source + Source

                                                                                        @@ -124,7 +169,7 @@

                                                                                        Exceptions

                                                                                        accumulator.

                                                                                        - Source + Source

                                                                                        @@ -133,17 +178,17 @@

                                                                                        Exceptions

                                                                                        Check if a dependency is available.

                                                                                        - Source + Source
                                                                                        -

                                                                                        - by_name!(given) +

                                                                                        + by_name(given, all_deps // all)

                                                                                        Receives a list of deps names and returns deps records. -Raises an error if the dependency does not exist.

                                                                                        +Logs a message if the dependency could not be found.

                                                                                        - Source + Source

                                                                                        @@ -152,7 +197,34 @@

                                                                                        Exceptions

                                                                                        Checks the lock for the given dependency and update its status accordingly.

                                                                                        - Source + Source + +
                                                                                        +

                                                                                        + children() +

                                                                                        +

                                                                                        Returns all direct child dependencies.

                                                                                        +
                                                                                        + + Source + +
                                                                                        +

                                                                                        + compile_paths(dep) +

                                                                                        +

                                                                                        Returns all compile paths for the dependency.

                                                                                        +
                                                                                        + + Source + +
                                                                                        +

                                                                                        + depending(deps, all_deps // all) +

                                                                                        +

                                                                                        Returns all dependencies depending on given dependencies.

                                                                                        +
                                                                                        + + Source

                                                                                        @@ -161,7 +233,7 @@

                                                                                        Exceptions

                                                                                        Format the dependency for printing.

                                                                                        - Source + Source

                                                                                        @@ -170,7 +242,54 @@

                                                                                        Exceptions

                                                                                        Formats the status of a dependency.

                                                                                        - Source + Source + +
                                                                                        +

                                                                                        + in_dependency(arg1, post_config // [], fun) +

                                                                                        +

                                                                                        Runs the given fun inside the given dependency project by +changing the current working directory and loading the given +project into the project stack.

                                                                                        +
                                                                                        + + Source + +
                                                                                        +

                                                                                        + in_umbrella?(arg1, apps_path) +

                                                                                        +

                                                                                        Check if a dependency is part of an umbrella project as a top level project.

                                                                                        +
                                                                                        + + Source + +
                                                                                        +

                                                                                        + load_paths(dep) +

                                                                                        +

                                                                                        Returns all load paths for the dependency.

                                                                                        +
                                                                                        + + Source + +
                                                                                        +

                                                                                        + make?(dep) +

                                                                                        +

                                                                                        Returns true if dependency is a make project.

                                                                                        +
                                                                                        + + Source + +
                                                                                        +

                                                                                        + mix?(dep) +

                                                                                        +

                                                                                        Returns true if dependency is a mix project.

                                                                                        +
                                                                                        + + Source

                                                                                        @@ -179,7 +298,7 @@

                                                                                        Exceptions

                                                                                        Check if a dependency is ok.

                                                                                        - Source + Source

                                                                                        @@ -190,7 +309,16 @@

                                                                                        Exceptions

                                                                                        invoking this function.

                                                                                        - Source + Source + +
                                                                                        +

                                                                                        + rebar?(dep) +

                                                                                        +

                                                                                        Returns true if dependency is a rebar project.

                                                                                        +
                                                                                        + + Source

                                                                                        @@ -199,7 +327,7 @@

                                                                                        Exceptions

                                                                                        Updates the dependency inside the given project.

                                                                                        - Source + Source
                                                                                        diff --git a/docs/master/Mix.Local.html b/docs/master/Mix.Local.html index 57d56bb0a..db5a09937 100644 --- a/docs/master/Mix.Local.html +++ b/docs/master/Mix.Local.html @@ -46,6 +46,11 @@

                                                                                        Functions summary

                                                                                        all_tasks/0
                                                                                      • +
                                                                                      • + + append_paths/0 + +
                                                                                      • append_tasks/0 @@ -74,6 +79,15 @@

                                                                                        Functions

                                                                                        Returns all tasks modules in .mix/tasks.

                                                                                        + Source + +
                                                                                        +

                                                                                        + append_paths() +

                                                                                        +

                                                                                        Append mix paths into Erlang code path.

                                                                                        +
                                                                                        + Source
                                                                                        diff --git a/docs/master/Mix.Project.html b/docs/master/Mix.Project.html index 9b747e353..c11a11286 100644 --- a/docs/master/Mix.Project.html +++ b/docs/master/Mix.Project.html @@ -71,6 +71,16 @@

                                                                                        Examples

                                                                                        Functions summary

                                                                                        @@ -107,6 +137,24 @@

                                                                                        Functions summary

                                                                                        Functions

                                                                                        +

                                                                                        + apps_path() +

                                                                                        +

                                                                                        Returns the path to the apps directory.

                                                                                        +
                                                                                        + + Source + +
                                                                                        +

                                                                                        + compile_paths() +

                                                                                        +

                                                                                        Returns the paths this project compiles to.

                                                                                        +
                                                                                        + + Source + +

                                                                                        config()

                                                                                        @@ -151,6 +199,40 @@

                                                                                        Functions

                                                                                        Source +
                                                                                        +

                                                                                        + in_project(app, app_path, post_config // [], fun) +

                                                                                        +

                                                                                        Runs the given fun inside the given project by changing +the current working directory and loading the given project +into the project stack.

                                                                                        +
                                                                                        + + Source + +
                                                                                        +

                                                                                        + load_paths() +

                                                                                        +

                                                                                        Returns all load paths for this project.

                                                                                        +
                                                                                        + + Source + +
                                                                                        +

                                                                                        + recur(fun) +

                                                                                        +

                                                                                        Runs fun in the current project.

                                                                                        + +

                                                                                        The goal of this function is to transparently abstract umbrella projects. +So if you want to gather data from a project, like beam files, you can +use this function to transparently go through the project, regardless +if it is an umbrella project or not.

                                                                                        +
                                                                                        + + Source +

                                                                                        refresh() @@ -161,6 +243,15 @@

                                                                                        Functions

                                                                                        Source +
                                                                                        +

                                                                                        + umbrella?() +

                                                                                        +

                                                                                        Returns true if project is an umbrella project.

                                                                                        +
                                                                                        + + Source +
                                                                                        diff --git a/docs/master/Mix.Shell.IO.html b/docs/master/Mix.Shell.IO.html index ece26e7a9..000fdca99 100644 --- a/docs/master/Mix.Shell.IO.html +++ b/docs/master/Mix.Shell.IO.html @@ -57,6 +57,11 @@

                                                                                        Functions summary

                                                                                        info/1
                                                                                      • +
                                                                                      • + + put_app/0 + +
                                                                                      • yes?/1 @@ -90,7 +95,7 @@

                                                                                        Functions

                                                                                        Writes an error message to the shell followed by new line.

                                                                                        - Source + Source

                                                                                        @@ -99,7 +104,15 @@

                                                                                        Functions

                                                                                        Writes a message to the shell followed by new line.

                                                                                        - Source + Source + +
                                                                                        +

                                                                                        + put_app() +

                                                                                        +
                                                                                        + + Source

                                                                                        @@ -110,7 +123,7 @@

                                                                                        Functions

                                                                                        regex %r/^Y(es)?$/i.

                                                                                        - Source + Source diff --git a/docs/master/Mix.Shell.Process.html b/docs/master/Mix.Shell.Process.html index 65188eed2..d1ee79352 100644 --- a/docs/master/Mix.Shell.Process.html +++ b/docs/master/Mix.Shell.Process.html @@ -74,6 +74,11 @@

                                                                                        Functions summary

                                                                                        info/1
                                                                                      • +
                                                                                      • + + put_app/0 + +
                                                                                      • yes?/1 @@ -107,7 +112,7 @@

                                                                                        Functions

                                                                                        Simply forwards the message to the current process.

                                                                                        - Source + Source

                                                                                        @@ -131,7 +136,15 @@

                                                                                        Examples

                                                                                        Simply forwards the message to the current process.

                                                                                        - Source + Source + +
                                                                                        +

                                                                                        + put_app() +

                                                                                        +
                                                                                        + + Source

                                                                                        @@ -147,7 +160,7 @@

                                                                                        Examples

                                                                                        process input given. Value must be true or false.

                                                                                        - Source + Source diff --git a/docs/master/Mix.Shell.html b/docs/master/Mix.Shell.html index 5149dc237..79783e409 100644 --- a/docs/master/Mix.Shell.html +++ b/docs/master/Mix.Shell.html @@ -48,6 +48,11 @@

                                                                                        Functions summary

                                                                                        cmd/2
                                                                                      • +
                                                                                      • + + output_app?/0 + +
                                                                                      @@ -92,7 +97,16 @@

                                                                                      Functions

                                                                                      is shared accross different shells.

                                                                                      - Source + Source + +
                                                                                      +

                                                                                      + output_app?() +

                                                                                      +

                                                                                      Returns if we should output application name to shell.

                                                                                      +
                                                                                      + + Source
                                                                                      diff --git a/docs/master/Mix.Task.html b/docs/master/Mix.Task.html index 1d804212a..c56cd9c7f 100644 --- a/docs/master/Mix.Task.html +++ b/docs/master/Mix.Task.html @@ -73,6 +73,11 @@

                                                                                      Functions summary

                                                                                      moduledoc/1
                                                                                    • +
                                                                                    • + + recursive?/1 + +
                                                                                    • reenable/1 @@ -132,7 +137,7 @@

                                                                                      Functions

                                                                                      Returns an ordset with all the tasks invoked thus far.

                                                                                      - Source + Source

                                                                                      @@ -148,7 +153,7 @@

                                                                                      Exceptions

                                                                                    - Source + Source

                                                                                    @@ -178,14 +183,24 @@

                                                                                    Exceptions

                                                                                    Source +
                                                                                    +

                                                                                    + recursive?(module) +

                                                                                    +

                                                                                    Checks if the task is defined for umbrella projects.

                                                                                    +
                                                                                    + + Source +

                                                                                    reenable(task)

                                                                                    -

                                                                                    Reenables a given task so it can be executed again down the stack.

                                                                                    +

                                                                                    Reenables a given task so it can be executed again down the stack. If +an umbrella project reenables a task it is reenabled for all sub projects.

                                                                                    - Source + Source

                                                                                    @@ -202,7 +217,7 @@

                                                                                    Exceptions

                                                                                    or it is invalid. Check get/2 for more information.

                                                                                    - Source + Source

                                                                                    @@ -221,7 +236,7 @@

                                                                                    Exceptions

                                                                                    Returns the task name for the given module.

                                                                                    - Source + Source
                                                                                    diff --git a/docs/master/Mix.Tasks.App.Start.html b/docs/master/Mix.Tasks.App.Start.html index db8f1d39e..159725882 100644 --- a/docs/master/Mix.Tasks.App.Start.html +++ b/docs/master/Mix.Tasks.App.Start.html @@ -71,7 +71,7 @@

                                                                                    Functions

                                                                                    - Source + Source diff --git a/docs/master/Mix.Tasks.Clean.html b/docs/master/Mix.Tasks.Clean.html index 3b736c4f1..740571f0f 100644 --- a/docs/master/Mix.Tasks.Clean.html +++ b/docs/master/Mix.Tasks.Clean.html @@ -69,7 +69,7 @@

                                                                                    Functions

                                                                                    - Source + Source diff --git a/docs/master/Mix.Tasks.Compile.App.html b/docs/master/Mix.Tasks.Compile.App.html index 3ceecb851..926eb51b7 100644 --- a/docs/master/Mix.Tasks.Compile.App.html +++ b/docs/master/Mix.Tasks.Compile.App.html @@ -87,7 +87,7 @@

                                                                                    Functions

                                                                                    - Source + Source diff --git a/docs/master/Mix.Tasks.Compile.Elixir.html b/docs/master/Mix.Tasks.Compile.Elixir.html index dd474a0b5..6f99f721e 100644 --- a/docs/master/Mix.Tasks.Compile.Elixir.html +++ b/docs/master/Mix.Tasks.Compile.Elixir.html @@ -68,7 +68,7 @@

                                                                                    Configuration

                                                                                    behaviour as Elixir

                                                                                      -
                                                                                    • :compile_exts - extensions to compile whenever there +
                                                                                    • :elixirc_exts - extensions to compile whenever there is a change:
                                                                                    @@ -76,7 +76,7 @@

                                                                                    Configuration

                                                                                    * :watch_exts - extensions to watch in order to trigger a compilation:

                                                                                    -

                                                                                    [watch_exts: [:ex, :eex]]

                                                                                  • +

                                                                                    [elixircwatchexts: [:ex, :eex]]

                                                                                  @@ -113,7 +113,7 @@

                                                                                  Functions

                                                                                  - Source + Source diff --git a/docs/master/Mix.Tasks.Compile.Erlang.html b/docs/master/Mix.Tasks.Compile.Erlang.html index eea51104f..d0e567aa0 100644 --- a/docs/master/Mix.Tasks.Compile.Erlang.html +++ b/docs/master/Mix.Tasks.Compile.Erlang.html @@ -123,7 +123,7 @@

                                                                                  Functions

                                                                                  extension.

                                                                                  - Source + Source

                                                                                  @@ -132,7 +132,7 @@

                                                                                  Functions

                                                                                  Interprets compilation results and prints them to the console.

                                                                                  - Source + Source

                                                                                  @@ -150,7 +150,7 @@

                                                                                  Functions

                                                                                  Erlang compilation tools.

                                                                                  - Source + Source diff --git a/docs/master/Mix.Tasks.Compile.Leex.html b/docs/master/Mix.Tasks.Compile.Leex.html index 2c92de341..f10cb3b35 100644 --- a/docs/master/Mix.Tasks.Compile.Leex.html +++ b/docs/master/Mix.Tasks.Compile.Leex.html @@ -87,7 +87,7 @@

                                                                                  Functions

                                                                                  - Source + Source diff --git a/docs/master/Mix.Tasks.Compile.Yecc.html b/docs/master/Mix.Tasks.Compile.Yecc.html index 5c4cad9a0..81a7d285e 100644 --- a/docs/master/Mix.Tasks.Compile.Yecc.html +++ b/docs/master/Mix.Tasks.Compile.Yecc.html @@ -87,7 +87,7 @@

                                                                                  Functions

                                                                                  - Source + Source diff --git a/docs/master/Mix.Tasks.Compile.html b/docs/master/Mix.Tasks.Compile.html index f768cc94a..2c374684e 100644 --- a/docs/master/Mix.Tasks.Compile.html +++ b/docs/master/Mix.Tasks.Compile.html @@ -97,7 +97,7 @@

                                                                                  Functions

                                                                                  - Source + Source diff --git a/docs/master/Mix.Tasks.Deps.Check.html b/docs/master/Mix.Tasks.Deps.Check.html index f1ba5b0da..4b74d4f5c 100644 --- a/docs/master/Mix.Tasks.Deps.Check.html +++ b/docs/master/Mix.Tasks.Deps.Check.html @@ -67,7 +67,7 @@

                                                                                  Functions

                                                                                  - Source + Source diff --git a/docs/master/Mix.Tasks.Deps.Clean.html b/docs/master/Mix.Tasks.Deps.Clean.html index e412ab513..98c8a14d8 100644 --- a/docs/master/Mix.Tasks.Deps.Clean.html +++ b/docs/master/Mix.Tasks.Deps.Clean.html @@ -67,7 +67,7 @@

                                                                                  Functions

                                                                                  - Source + Source diff --git a/docs/master/Mix.Tasks.Deps.Compile.html b/docs/master/Mix.Tasks.Deps.Compile.html index d73f9cf5c..409e067ab 100644 --- a/docs/master/Mix.Tasks.Deps.Compile.html +++ b/docs/master/Mix.Tasks.Deps.Compile.html @@ -81,7 +81,7 @@

                                                                                  Functions

                                                                                  - Source + Source diff --git a/docs/master/Mix.Tasks.Deps.Get.html b/docs/master/Mix.Tasks.Deps.Get.html index ec3a23176..9eede311b 100644 --- a/docs/master/Mix.Tasks.Deps.Get.html +++ b/docs/master/Mix.Tasks.Deps.Get.html @@ -33,7 +33,8 @@

                                                                                  Command line options

                                                                                    -
                                                                                  • --no-compile skip compilation of dependencies
                                                                                  • +
                                                                                  • --no-compile - skip compilation of dependencies
                                                                                  • +
                                                                                  • --quiet - do not output success message
                                                                                  @@ -70,7 +71,7 @@

                                                                                  Functions

                                                                                  - Source + Source diff --git a/docs/master/Mix.Tasks.Deps.Loadpaths.html b/docs/master/Mix.Tasks.Deps.Loadpaths.html index a127bb3c8..cf1c12e35 100644 --- a/docs/master/Mix.Tasks.Deps.Loadpaths.html +++ b/docs/master/Mix.Tasks.Deps.Loadpaths.html @@ -64,7 +64,7 @@

                                                                                  Functions

                                                                                  - Source + Source diff --git a/docs/master/Mix.Tasks.Deps.Unlock.html b/docs/master/Mix.Tasks.Deps.Unlock.html index c8ec9f6e9..29556f4e2 100644 --- a/docs/master/Mix.Tasks.Deps.Unlock.html +++ b/docs/master/Mix.Tasks.Deps.Unlock.html @@ -64,7 +64,7 @@

                                                                                  Functions

                                                                                  - Source + Source diff --git a/docs/master/Mix.Tasks.Deps.Update.html b/docs/master/Mix.Tasks.Deps.Update.html index 5e741da03..4a15bb461 100644 --- a/docs/master/Mix.Tasks.Deps.Update.html +++ b/docs/master/Mix.Tasks.Deps.Update.html @@ -36,7 +36,7 @@

                                                                                  Command line options

                                                                                    -
                                                                                  • --no-compile skip compilation of dependencies
                                                                                  • +
                                                                                  • --no-compile - skip compilation of dependencies
                                                                                  @@ -73,7 +73,7 @@

                                                                                  Functions

                                                                                  - Source + Source diff --git a/docs/master/Mix.Tasks.Deps.html b/docs/master/Mix.Tasks.Deps.html index 62059709f..628eaca8f 100644 --- a/docs/master/Mix.Tasks.Deps.html +++ b/docs/master/Mix.Tasks.Deps.html @@ -70,7 +70,7 @@

                                                                                  Functions

                                                                                  - Source + Source diff --git a/docs/master/Mix.Tasks.Loadpaths.html b/docs/master/Mix.Tasks.Loadpaths.html index d36615647..bc7b95827 100644 --- a/docs/master/Mix.Tasks.Loadpaths.html +++ b/docs/master/Mix.Tasks.Loadpaths.html @@ -29,9 +29,6 @@

                                                                                  Load the application and its dependencies paths.

                                                                                  -

                                                                                  This task is not shown in mix help but it is part -of mix public API and can be depended on.

                                                                                  -

                                                                                  Configuration

                                                                                  diff --git a/docs/master/Mix.Tasks.Local.Install.html b/docs/master/Mix.Tasks.Local.Install.html index 83eec4cc6..6e0346f2a 100644 --- a/docs/master/Mix.Tasks.Local.Install.html +++ b/docs/master/Mix.Tasks.Local.Install.html @@ -74,7 +74,7 @@

                                                                                  Functions

                                                                                  - Source + Source diff --git a/docs/master/IEx.Remsh.html b/docs/master/Mix.Tasks.Local.Rebar.html similarity index 52% rename from docs/master/IEx.Remsh.html rename to docs/master/Mix.Tasks.Local.Rebar.html index 65dd784a1..d331b0d3e 100644 --- a/docs/master/IEx.Remsh.html +++ b/docs/master/Mix.Tasks.Local.Rebar.html @@ -1,7 +1,7 @@ - IEx.Remsh + Mix.Tasks.Local.Rebar @@ -21,31 +21,22 @@

                                                                                  - IEx.Remsh + Mix.Tasks.Local.Rebar

                                                                                  -

                                                                                  Helper function injected into connecting remote nodes -to properly handle autocompletion. Elixir supports:

                                                                                  +

                                                                                  Fetch a copy of rebar from the given path or url, defaulting to +https://github.com/downloads/basho/rebar/rebar if no parameter +given. The local copy is stored in your MIX_HOME (defaults to ~/.mix).

                                                                                  -
                                                                                    -
                                                                                  • remsh from an elixir node to an elixir node
                                                                                  • -
                                                                                  • remsh from a plain erlang node to an elixir node (through the ^G menu)
                                                                                  • -
                                                                                  • remsh from an elixir node to a plain erlang node (and get an erl shell there)
                                                                                  • -
                                                                                  - -

                                                                                  In order to get an Elixir shell from the ^G menu, -you need to use 'Elixir-IEx' as the shell name.

                                                                                  - -

                                                                                  Connecting an Elixir shell to a remote node without -Elixir is not supported.

                                                                                  +

                                                                                  This version of rebar will be used as required by mix deps.compile

                                                                                  - Source + Source @@ -56,7 +47,12 @@

                                                                                  Functions summary

                                                                                  • - expand/1 + local_rebar_path/0 + +
                                                                                  • +
                                                                                  • + + run/1
                                                                                  • @@ -71,12 +67,21 @@

                                                                                    Functions summary

                                                                                    Functions

                                                                                    -

                                                                                    - expand(node) +

                                                                                    + local_rebar_path() +

                                                                                    +

                                                                                    Return the path to the local copy of rebar. Used when building deps

                                                                                    +
                                                                                    + + Source + +
                                                                                    +

                                                                                    + run(argv)

                                                                                    - Source + Source
                                                                                    diff --git a/docs/master/Mix.Tasks.New.html b/docs/master/Mix.Tasks.New.html index cf968fa29..ccbe544c5 100644 --- a/docs/master/Mix.Tasks.New.html +++ b/docs/master/Mix.Tasks.New.html @@ -30,18 +30,20 @@

                                                                                    Creates a new Elixir project. It expects the path of the project as argument.

                                                                                    -
                                                                                    mix new PATH [--sup] [--app APP] [--module MODULE]
                                                                                    +
                                                                                    mix new PATH [--sup] [--module MODULE] [--umbrella]
                                                                                     

                                                                                    A project at the given PATH will be created. The application name and module name will be retrieved -from the path, unless one of -app or --module -is given.

                                                                                    +from the path, unless --module is given.

                                                                                    -

                                                                                    An --sup option can be given to generate an +

                                                                                    A --sup option can be given to generate an app with a supervisor and an application module that starts the supervisor.

                                                                                    +

                                                                                    An --umbrella option can be given to generate an +umbrella project.

                                                                                    +

                                                                                    Examples

                                                                                    mix new hello_world
                                                                                    @@ -49,7 +51,7 @@ 

                                                                                    Examples

                                                                                    Is equivalent to:

                                                                                    -
                                                                                    mix new hello_world --app hello_world --module HelloWorld
                                                                                    +
                                                                                    mix new hello_world --module HelloWorld
                                                                                     

                                                                                    To generate an app with supervisor and application behaviours:

                                                                                    @@ -91,7 +93,7 @@

                                                                                    Functions

                                                                                    - Source + Source

                                                                                  diff --git a/docs/master/Mix.Tasks.Run.html b/docs/master/Mix.Tasks.Run.html index a74524ef8..14977ee0c 100644 --- a/docs/master/Mix.Tasks.Run.html +++ b/docs/master/Mix.Tasks.Run.html @@ -29,14 +29,14 @@

                                                                                  Run the given expression in the application context.

                                                                                  -

                                                                                  Before running the code, it invokes the prepare task +

                                                                                  Before running the code, it invokes the app.start task which defaults to compile and load your project.

                                                                                  Command line options

                                                                                    -
                                                                                  • --require, -r - Requires a file before running the command
                                                                                  • -
                                                                                  • --parallel-require, -pr - Requires a file in parallel
                                                                                  • +
                                                                                  • --require, -r - Requires pattern before running the command
                                                                                  • +
                                                                                  • --parallel-require, -pr - Requires pattern in parallel
                                                                                  • --no-halt - Does not halt the system after running the command
                                                                                  • --no-compile - Do not compile even if files require compilation;
                                                                                  • --no-start - Do not start applications after compilation;
                                                                                  • @@ -46,6 +46,11 @@

                                                                                    Examples

                                                                                    mix run Hello.world
                                                                                     mix run "Some.function with_args"
                                                                                    +
                                                                                    + +

                                                                                    Command line options given to the elixir executable can be passed as:

                                                                                    + +
                                                                                    elixir --sname hello -S mix run "My.code"
                                                                                     
                                                                                  @@ -82,7 +87,7 @@

                                                                                  Functions

                                                                                  - Source + Source diff --git a/docs/master/Mix.Tasks.Test.html b/docs/master/Mix.Tasks.Test.html index a55052d07..7b3931837 100644 --- a/docs/master/Mix.Tasks.Test.html +++ b/docs/master/Mix.Tasks.Test.html @@ -96,7 +96,7 @@

                                                                                  Functions

                                                                                  - Source + Source diff --git a/docs/master/Mix.Utils.html b/docs/master/Mix.Utils.html index 870687313..681608363 100644 --- a/docs/master/Mix.Utils.html +++ b/docs/master/Mix.Utils.html @@ -82,11 +82,21 @@

                                                                                  Functions summary

                                                                                  extract_stale/2
                                                                                • +
                                                                                • + + manifest/2 + +
                                                                                • mix_home/0
                                                                                • +
                                                                                • + + mix_path/0 + +
                                                                                • module_name_to_command/2 @@ -94,7 +104,7 @@

                                                                                  Functions summary

                                                                                • - preserving_mtime/2 + read_path/1
                                                                                • @@ -140,7 +150,7 @@

                                                                                  Examples

                                                                                  - Source + Source

                                                                                  @@ -160,7 +170,7 @@

                                                                                  Examples

                                                                                  - Source + Source

                                                                                  @@ -175,7 +185,7 @@

                                                                                  Examples

                                                                                  - Source + Source

                                                                                  @@ -185,7 +195,7 @@

                                                                                  Examples

                                                                                  and concatenating normal lists.

                                                                                  - Source + Source

                                                                                  @@ -198,7 +208,7 @@

                                                                                  Examples

                                                                                  When looking up directories, files starting with "." are ignored.

                                                                                  - Source + Source

                                                                                  @@ -207,7 +217,20 @@

                                                                                  Examples

                                                                                  Extract all stale sources compared to the given targets.

                                                                                  - Source + Source + +
                                                                                  +

                                                                                  + manifest(file, fun) +

                                                                                  +

                                                                                  Generates a manifest containing all files generated +during a given compilation step. It receives the manifest +file name and a function to execute. The result of the +function is compared to the manifest in order do detect +the files removed from the manifest file.

                                                                                  +
                                                                                  + + Source

                                                                                  @@ -219,6 +242,18 @@

                                                                                  Examples

                                                                                  Source +
                                                                                  +

                                                                                  + mix_path() +

                                                                                  +

                                                                                  Gets all extra paths defined in the environment variable +MIXPATH. MIXPATH may contain multiple paths. If on windows, +those paths should be separated by ;, if on unix systems, +use :.

                                                                                  +
                                                                                  + + Source +

                                                                                  module_name_to_command(module, nesting // 0) @@ -237,17 +272,17 @@

                                                                                  Examples

                                                                                  - Source + Source
                                                                                  -

                                                                                  - preserving_mtime(path, fun) +

                                                                                  + read_path(path)

                                                                                  -

                                                                                  Executes a function but preserves the given path mtime -properties.

                                                                                  +

                                                                                  Opens and reads content from either a URL or a local filesystem path. +Used by local.install and local.rebar.

                                                                                  - Source + Source

                                                                                  @@ -257,7 +292,7 @@

                                                                                  Examples

                                                                                  working directory.

                                                                                  - Source + Source

                                                                                  @@ -266,7 +301,7 @@

                                                                                  Examples

                                                                                  Gets the source location of a module as a binary.

                                                                                  - Source + Source

                                                                                  @@ -276,7 +311,7 @@

                                                                                  Examples

                                                                                  compared to the given target.

                                                                                  - Source + Source

                                                                                  @@ -302,7 +337,7 @@

                                                                                  Examples

                                                                                  - Source + Source diff --git a/docs/master/Module.html b/docs/master/Module.html index be531269a..63dc2152d 100644 --- a/docs/master/Module.html +++ b/docs/master/Module.html @@ -189,11 +189,11 @@

                                                                                  Examples

                                                                                  Examples

                                                                                  -
                                                                                  iex> Module.concat [Foo, Bar]
                                                                                  +
                                                                                  iex> Module.concat([Foo, Bar])
                                                                                   Foo.Bar
                                                                                  -iex> Module.concat [Foo, "Bar"]
                                                                                  +iex> Module.concat([Foo, "Bar"])
                                                                                   Foo.Bar
                                                                                  -iex> Module.concat [Foo, 'Bar']
                                                                                  +iex> Module.concat([Foo, 'Bar'])
                                                                                   Foo.Bar
                                                                                   
                                                                                  @@ -209,11 +209,11 @@

                                                                                  Examples

                                                                                  Examples

                                                                                  -
                                                                                  iex> Module.concat Foo, Bar
                                                                                  +
                                                                                  iex> Module.concat(Foo, Bar)
                                                                                   Foo.Bar
                                                                                  -iex> Module.concat Foo, "Bar"
                                                                                  +iex> Module.concat(Foo, "Bar")
                                                                                   Foo.Bar
                                                                                  -iex> Module.concat Foo, 'Bar'
                                                                                  +iex> Module.concat(Foo, 'Bar')
                                                                                   Foo.Bar
                                                                                   
                                                                                  @@ -355,7 +355,7 @@

                                                                                  Examples

                                                                                  Evalutes the quotes contents in the given module context.

                                                                                  A list of environment options can also be given as argument. -Check Code.eval for more information.

                                                                                  +Check Code.eval_string for more information.

                                                                                  Raises an error if the module was already compiled.

                                                                                  @@ -505,10 +505,10 @@

                                                                                  Examples

                                                                                  Examples

                                                                                  -
                                                                                  iex> Module.safe_concat [Unknown, Module]
                                                                                  +
                                                                                  iex> Module.safe_concat([Unknown, Module])
                                                                                   ** (ArgumentError) argument error
                                                                                   
                                                                                  -iex> Module.safe_concat [List, Chars]
                                                                                  +iex> Module.safe_concat([List, Chars])
                                                                                   List.Chars
                                                                                   
                                                                                  @@ -526,10 +526,10 @@

                                                                                  Examples

                                                                                  Examples

                                                                                  -
                                                                                  iex> Module.safe_concat Unknown, Module
                                                                                  +
                                                                                  iex> Module.safe_concat(Unknown, Module)
                                                                                   ** (ArgumentError) argument error
                                                                                   
                                                                                  -iex> Module.safe_concat List, Chars
                                                                                  +iex> Module.safe_concat(List, Chars)
                                                                                   List.Chars
                                                                                   
                                                                                  diff --git a/docs/master/Node.html b/docs/master/Node.html index a65dc48d5..83b717590 100644 --- a/docs/master/Node.html +++ b/docs/master/Node.html @@ -56,6 +56,11 @@

                                                                                  Functions summary

                                                                                  disconnect/1
                                                                                • +
                                                                                • + + get_cookie/0 + +
                                                                                • list/0 @@ -81,6 +86,11 @@

                                                                                  Functions summary

                                                                                  self/0
                                                                                • +
                                                                                • + + set_cookie/2 + +
                                                                                • spawn/2 @@ -159,6 +169,16 @@

                                                                                  Functions

                                                                                  Source +
                                                                                  +

                                                                                  + get_cookie() +

                                                                                  +

                                                                                  Returns the magic cookie of the local node, if the node is alive; +otherwise :nocookie.

                                                                                  +
                                                                                  + + Source +

                                                                                  list() @@ -215,6 +235,19 @@

                                                                                  Functions

                                                                                  Source +
                                                                                  +

                                                                                  + set_cookie(node // Node.self(), cookie) +

                                                                                  +

                                                                                  Sets the magic cookie of node to the atom cookie. The default node +is Node.self, the local node. If node is the local node, the function also +sets the cookie of all other unknown nodes to cookie.

                                                                                  + +

                                                                                  This function will raise FunctionClauseError if the given node is not alive.

                                                                                  +
                                                                                  + + Source +

                                                                                  spawn(node, fun) diff --git a/docs/master/Path.html b/docs/master/Path.html index fd64eb9b0..34cf657f1 100644 --- a/docs/master/Path.html +++ b/docs/master/Path.html @@ -28,15 +28,15 @@

                                                                                  This module provides conveniences for manipulating or -retrieving filesystem paths.

                                                                                  +retrieving file system paths.

                                                                                  -

                                                                                  The functions on this module may receive a char list or -a binary as argument and will return the given type.

                                                                                  +

                                                                                  The functions in this module may receive a char list or +a binary as argument and will return a value of the same +type.

                                                                                  The majority of the functions in this module do not -interact with the file system, unless some few functions -that needs to query the filesystem to retrieve paths -(like Path.wildcard and Path.expand).

                                                                                  +interact with the file system, except for a few functions +that require it (like Path.wildcard and Path.expand).

                                                                                  @@ -150,9 +150,8 @@

                                                                                  Functions

                                                                                  absname(path)

                                                                                  -

                                                                                  Converts the given filename and returns an absolute name. -Differently from Path.expand/1, no attempt is made to -resolve .., . or ~.

                                                                                  +

                                                                                  Converts the given path to an absolute one. Differently from +Path.expand/1, no attempt is made to resolve .., . or ~.

                                                                                  Unix examples

                                                                                  @@ -172,15 +171,14 @@

                                                                                  Windows

                                                                                  - Source + Source

                                                                                  absname(path, relative_to)

                                                                                  -

                                                                                  Converts the given filename and returns an absolute name -relative to the given location. If the path is already -an absolute path, the relative path is ignored.

                                                                                  +

                                                                                  Builds a path from relative_to to path. If path is already +an absolute path, relative_to is ignored. See also Path.relative/2.

                                                                                  Differently from Path.expand/2, no attempt is made to resolve .., . or ~.

                                                                                  @@ -195,7 +193,7 @@

                                                                                  Examples

                                                                                  - Source + Source

                                                                                  @@ -217,7 +215,7 @@

                                                                                  Examples

                                                                                  - Source + Source

                                                                                  @@ -238,29 +236,31 @@

                                                                                  Examples

                                                                                  - Source + Source

                                                                                  dirname(path)

                                                                                  -

                                                                                  Return the directory component of path.

                                                                                  +

                                                                                  Returns the directory component of path.

                                                                                  Examples

                                                                                  Path.dirname("/foo/bar.ex")
                                                                                  -#=> "foo"
                                                                                  +#=> "/foo"
                                                                                  +Path.dirname("/foo/bar/baz.ex")
                                                                                  +#=> "/foo/bar"
                                                                                   
                                                                                  - Source + Source

                                                                                  expand(path)

                                                                                  -

                                                                                  Expands the path by returning its absolute name and expanding -any . and .. characters.

                                                                                  +

                                                                                  Converts the path to an absolute one and expands +any . and .. characters and a leading ~.

                                                                                  Examples

                                                                                  @@ -269,32 +269,41 @@

                                                                                  Examples

                                                                                  - Source + Source

                                                                                  expand(path, relative_to)

                                                                                  -

                                                                                  Expands the path to the relative location and expanding -any . and .. characters. If the path is already an -absolute path, the relative location is ignored.

                                                                                  +

                                                                                  Expands the path relative to the path given as the second argument +expanding any . and .. characters. If the path is already an +absolute path, relative_to is ignored.

                                                                                  + +

                                                                                  Note, that this function treats path with leading ~ as +an absolute one.

                                                                                  + +

                                                                                  The second argument is first expanded to an absolute path.

                                                                                  Examples

                                                                                  -
                                                                                  iex> Path.expand("foo/bar/../bar", "/baz")
                                                                                  +
                                                                                  # Assuming that the absolute path to baz is /quux/baz
                                                                                  +Path.expand("foo/bar/../bar", "baz")
                                                                                  +#=> "/quux/baz/foo/bar"
                                                                                  +
                                                                                  +iex> Path.expand("foo/bar/../bar", "/baz")
                                                                                   "/baz/foo/bar"
                                                                                   iex> Path.expand("/foo/bar/../bar", "/baz")
                                                                                   "/foo/bar"
                                                                                   
                                                                                  - Source + Source

                                                                                  extname(path)

                                                                                  -

                                                                                  Return the extension of the last component of path.

                                                                                  +

                                                                                  Returns the extension of the last component of path.

                                                                                  Examples

                                                                                  @@ -305,14 +314,14 @@

                                                                                  Examples

                                                                                  - Source + Source

                                                                                  join(list1)

                                                                                  -

                                                                                  Returns a string with one or more paths components joint by the path separator. -This function should be used to convert a list of strings in a path.

                                                                                  +

                                                                                  Returns a string with one or more path components joined by the path separator. +This function should be used to convert a list of strings to a path.

                                                                                  Examples

                                                                                  @@ -325,7 +334,7 @@

                                                                                  Examples

                                                                                  - Source + Source

                                                                                  @@ -340,7 +349,7 @@

                                                                                  Examples

                                                                                  - Source + Source

                                                                                  @@ -364,15 +373,16 @@

                                                                                  Windows examples

                                                                                  - Source + Source

                                                                                  relative_to(path, from)

                                                                                  -

                                                                                  Returns the given path relative to the given from path.

                                                                                  +

                                                                                  Returns the given path relative to the given from path. +In other words, it tries to strip the from prefix from path.

                                                                                  -

                                                                                  This function does not query the filesystem, so it assumes +

                                                                                  This function does not query the file system, so it assumes no symlinks in between the paths.

                                                                                  In case a direct relative path cannot be found, it returns @@ -389,7 +399,7 @@

                                                                                  Examples

                                                                                  - Source + Source

                                                                                  @@ -406,7 +416,7 @@

                                                                                  Examples

                                                                                  - Source + Source

                                                                                  @@ -424,14 +434,14 @@

                                                                                  Examples

                                                                                  - Source + Source

                                                                                  split(path)

                                                                                  -

                                                                                  Returns a list with the path splitted by the path separator. -If an empty string is given, then it returns the root path.

                                                                                  +

                                                                                  Returns a list with the path split by the path separator. +If an empty string is given, returns the root path.

                                                                                  Examples

                                                                                  @@ -444,7 +454,7 @@

                                                                                  Examples

                                                                                  - Source + Source

                                                                                  @@ -457,6 +467,7 @@

                                                                                  Unix examples

                                                                                  Path.type("/usr/local/bin")   #=> :absolute
                                                                                   Path.type("usr/local/bin")    #=> :relative
                                                                                   Path.type("../usr/local/bin") #=> :relative
                                                                                  +Path.type("~/file")           #=> :relative
                                                                                   

                                                                                  Windows examples

                                                                                  @@ -468,7 +479,7 @@

                                                                                  Windows examples

                                                                                  - Source + Source

                                                                                  @@ -499,7 +510,7 @@

                                                                                  Examples

                                                                                  Imagine you have a directory called projects with three Elixir projects inside of it: elixir, ex_doc and dynamo. You can find all .beam files -inside their ebin directories all projects as follows:

                                                                                  +inside the ebin directory of each project as follows:

                                                                                  Path.wildcard("projects/*/ebin/**/*.beam")
                                                                                   
                                                                                  @@ -510,7 +521,7 @@

                                                                                  Examples

                                                                                  - Source + Source
                                                                                  diff --git a/docs/master/Process.html b/docs/master/Process.html index 4fc6ca715..880c3a5ea 100644 --- a/docs/master/Process.html +++ b/docs/master/Process.html @@ -231,7 +231,7 @@

                                                                                  Functions

                                                                                  Deletes all items in the dictionary.

                                                                                  - Source + Source

                                                                                  @@ -240,7 +240,7 @@

                                                                                  Functions

                                                                                  Deletes the given key from the dictionary.

                                                                                  - Source + Source

                                                                                  @@ -253,7 +253,7 @@

                                                                                  Functions

                                                                                  See http://www.erlang.org/doc/man/erlang.html#demonitor-2 for more info.

                                                                                  - Source + Source

                                                                                  @@ -282,7 +282,7 @@

                                                                                  Examples

                                                                                  - Source + Source

                                                                                  @@ -294,7 +294,7 @@

                                                                                  Examples

                                                                                  See http://www.erlang.org/doc/man/erlang.html#process_flag-2 for more info.

                                                                                  - Source + Source

                                                                                  @@ -307,7 +307,7 @@

                                                                                  Examples

                                                                                  See http://www.erlang.org/doc/man/erlang.html#process_flag-3 for more info.

                                                                                  - Source + Source

                                                                                  @@ -316,7 +316,7 @@

                                                                                  Examples

                                                                                  Returns all key-values in the dictionary.

                                                                                  - Source + Source

                                                                                  @@ -325,7 +325,7 @@

                                                                                  Examples

                                                                                  Returns the value for the given key.

                                                                                  - Source + Source

                                                                                  @@ -334,7 +334,7 @@

                                                                                  Examples

                                                                                  Returns all keys that have the given value.

                                                                                  - Source + Source

                                                                                  @@ -343,7 +343,7 @@

                                                                                  Examples

                                                                                  Returns the pid of the group leader for the process which evaluates the function.

                                                                                  - Source + Source

                                                                                  @@ -353,7 +353,7 @@

                                                                                  Examples

                                                                                  started from a certain shell should have another group leader than :init.

                                                                                  - Source + Source

                                                                                  @@ -365,7 +365,7 @@

                                                                                  Examples

                                                                                  See http://www.erlang.org/doc/man/erlang.html#process_info-1 for more info.

                                                                                  - Source + Source

                                                                                  @@ -377,7 +377,7 @@

                                                                                  Examples

                                                                                  See http://www.erlang.org/doc/man/erlang.html#process_info-2 for more info.

                                                                                  - Source + Source

                                                                                  @@ -389,7 +389,7 @@

                                                                                  Examples

                                                                                  See http://www.erlang.org/doc/man/erlang.html#link-1 for more info.

                                                                                  - Source + Source

                                                                                  @@ -405,7 +405,7 @@

                                                                                  Examples

                                                                                  See http://www.erlang.org/doc/man/erlang.html#processes-0 for more info.

                                                                                  - Source + Source

                                                                                  @@ -417,7 +417,7 @@

                                                                                  Examples

                                                                                  See http://www.erlang.org/doc/man/erlang.html#monitor-2 for more info.

                                                                                  - Source + Source

                                                                                  @@ -426,7 +426,7 @@

                                                                                  Examples

                                                                                  Stores the given key-value in the process dictionary.

                                                                                  - Source + Source

                                                                                  @@ -439,7 +439,7 @@

                                                                                  Examples

                                                                                  See http://www.erlang.org/doc/man/erlang.html#register-2 for more info.

                                                                                  - Source + Source

                                                                                  @@ -448,7 +448,7 @@

                                                                                  Examples

                                                                                  Returns a list of names which have been registered using register/2.

                                                                                  - Source + Source

                                                                                  @@ -458,7 +458,7 @@

                                                                                  Examples

                                                                                  It behaves exactly the same as Kernel.spawn/1.

                                                                                  - Source + Source

                                                                                  @@ -470,7 +470,7 @@

                                                                                  Examples

                                                                                  check http://www.erlang.org/doc/man/erlang.html#spawn_opt-2

                                                                                  - Source + Source

                                                                                  @@ -483,7 +483,7 @@

                                                                                  Examples

                                                                                  It behaves exactly the same as the Kernel.spawn/3 function.

                                                                                  - Source + Source

                                                                                  @@ -497,7 +497,7 @@

                                                                                  Examples

                                                                                  check http://www.erlang.org/doc/man/erlang.html#spawn_opt-4

                                                                                  - Source + Source

                                                                                  @@ -508,7 +508,7 @@

                                                                                  Examples

                                                                                  process, atomically.

                                                                                  - Source + Source

                                                                                  @@ -519,7 +519,7 @@

                                                                                  Examples

                                                                                  and the new process, atomically. Otherwise works like spawn/3.

                                                                                  - Source + Source

                                                                                  @@ -529,7 +529,7 @@

                                                                                  Examples

                                                                                  and reference for a monitor created to the new process.

                                                                                  - Source + Source

                                                                                  @@ -540,7 +540,7 @@

                                                                                  Examples

                                                                                  reference for the monitor. Otherwise works like spawn/3.

                                                                                  - Source + Source

                                                                                  @@ -553,7 +553,7 @@

                                                                                  Examples

                                                                                  See http://www.erlang.org/doc/man/erlang.html#unlink-1 for more info.

                                                                                  - Source + Source

                                                                                  @@ -564,7 +564,7 @@

                                                                                  Examples

                                                                                  See http://www.erlang.org/doc/man/erlang.html#unregister-1 for more info.

                                                                                  - Source + Source

                                                                                  @@ -576,7 +576,7 @@

                                                                                  Examples

                                                                                  See http://www.erlang.org/doc/man/erlang.html#whereis-1 for more info.

                                                                                  - Source + Source diff --git a/docs/master/Protocol.UndefinedError.html b/docs/master/Protocol.UndefinedError.html index 918c910d5..0c7a6f389 100644 --- a/docs/master/Protocol.UndefinedError.html +++ b/docs/master/Protocol.UndefinedError.html @@ -29,7 +29,7 @@

                                                                                  - Source + Source @@ -77,7 +77,7 @@

                                                                                  Functions

                                                                                  - Source + Source diff --git a/docs/master/Range.Iterator.Number.html b/docs/master/Range.Iterator.Number.html index a0f24e170..f2dd17804 100644 --- a/docs/master/Range.Iterator.Number.html +++ b/docs/master/Range.Iterator.Number.html @@ -29,7 +29,7 @@

                                                                                  - Source + Source @@ -65,7 +65,7 @@

                                                                                  Functions

                                                                                  - Source + Source

                                                                                  @@ -73,7 +73,7 @@

                                                                                  Functions

                                                                                  - Source + Source
                                                                                  diff --git a/docs/master/Record.html b/docs/master/Record.html index 9879d03cb..74065ec48 100644 --- a/docs/master/Record.html +++ b/docs/master/Record.html @@ -109,7 +109,7 @@

                                                                                  Examples

                                                                                  - Source + Source

                                                                                  @@ -127,7 +127,7 @@

                                                                                  Examples

                                                                                  - Source + Source

                                                                                  @@ -151,7 +151,7 @@

                                                                                  Examples

                                                                                  so check it for more information and documentation.

                                                                                  - Source + Source

                                                                                  @@ -160,7 +160,7 @@

                                                                                  Examples

                                                                                  Defines types and specs for the record.

                                                                                  - Source + Source

                                                                                  @@ -205,7 +205,7 @@

                                                                                  Example

                                                                                  end

                                                                                  - Source + Source diff --git a/docs/master/Regex.html b/docs/master/Regex.html index 755416c60..16f020d52 100644 --- a/docs/master/Regex.html +++ b/docs/master/Regex.html @@ -171,12 +171,12 @@

                                                                                  Functions

                                                                                  Examples

                                                                                  -
                                                                                  iex> Regex.captures %r/c(?<foo>d)/g, "abcd"
                                                                                  +
                                                                                  iex> Regex.captures(%r/c(?<foo>d)/g, "abcd")
                                                                                   [foo: "d"]
                                                                                   
                                                                                  - Source + Source

                                                                                  @@ -208,12 +208,12 @@

                                                                                  Examples

                                                                                  Examples

                                                                                  -
                                                                                  iex> Regex.groups %r/(?<foo>foo)/g
                                                                                  +
                                                                                  iex> Regex.groups(%r/(?<foo>foo)/g)
                                                                                   [:foo]
                                                                                   
                                                                                  - Source + Source

                                                                                  @@ -225,9 +225,9 @@

                                                                                  Examples

                                                                                  Examples

                                                                                  -
                                                                                  iex> Regex.index %r/c(d)/, "abcd"
                                                                                  +
                                                                                  iex> Regex.index(%r/c(d)/, "abcd")
                                                                                   2
                                                                                  -iex> Regex.index %r/e/, "abcd"
                                                                                  +iex> Regex.index(%r/e/, "abcd")
                                                                                   nil
                                                                                   
                                                                                  @@ -242,9 +242,9 @@

                                                                                  Examples

                                                                                  Examples

                                                                                  -
                                                                                  iex> Regex.match? %r/foo/, "foo"
                                                                                  +
                                                                                  iex> Regex.match?(%r/foo/, "foo")
                                                                                   true
                                                                                  -iex> Regex.match? %r/foo/, "bar"
                                                                                  +iex> Regex.match?(%r/foo/, "bar")
                                                                                   false
                                                                                   
                                                                                  @@ -259,12 +259,12 @@

                                                                                  Examples

                                                                                  Examples

                                                                                  -
                                                                                  iex> Regex.opts %r(foo)m
                                                                                  +
                                                                                  iex> Regex.opts(%r(foo)m)
                                                                                   "m"
                                                                                   
                                                                                  - Source + Source

                                                                                  @@ -273,7 +273,7 @@

                                                                                  Examples

                                                                                  Returns the underlying re_pattern in the regular expression.

                                                                                  - Source + Source

                                                                                  @@ -302,25 +302,26 @@

                                                                                  Examples

                                                                                  - Source + Source

                                                                                  run(regex, string, options // [])

                                                                                  Runs the regular expression against the given string. -It returns a list with all matches or nil if no match ocurred.

                                                                                  +It returns a list with all matches, nil if no match ocurred, or [] +if it matched, /g was specified, but nothing was captured.

                                                                                  Examples

                                                                                  -
                                                                                  iex> Regex.run %r/c(d)/, "abcd"
                                                                                  +
                                                                                  iex> Regex.run(%r/c(d)/, "abcd")
                                                                                   ["cd", "d"]
                                                                                  -iex> Regex.run %r/e/, "abcd"
                                                                                  +iex> Regex.run(%r/e/, "abcd")
                                                                                   nil
                                                                                   
                                                                                  - Source + Source

                                                                                  @@ -333,16 +334,16 @@

                                                                                  Examples

                                                                                  Examples

                                                                                  -
                                                                                  iex> Regex.scan %r/c(d|e)/, "abcd abce"
                                                                                  +
                                                                                  iex> Regex.scan(%r/c(d|e)/, "abcd abce")
                                                                                   [["d"], ["e"]]
                                                                                  -iex> Regex.scan %r/c(?:d|e)/, "abcd abce"
                                                                                  +iex> Regex.scan(%r/c(?:d|e)/, "abcd abce")
                                                                                   ["cd", "ce"]
                                                                                  -iex> Regex.scan %r/e/, "abcd"
                                                                                  +iex> Regex.scan(%r/e/, "abcd")
                                                                                   []
                                                                                   
                                                                                  - Source + Source

                                                                                  @@ -352,12 +353,12 @@

                                                                                  Examples

                                                                                  Examples

                                                                                  -
                                                                                  iex> Regex.source %r(foo)
                                                                                  +
                                                                                  iex> Regex.source(%r(foo))
                                                                                   "foo"
                                                                                   
                                                                                  - Source + Source

                                                                                  @@ -367,7 +368,7 @@

                                                                                  Examples

                                                                                  If no ammount of parts is given, it defaults to :infinity.

                                                                                  - Source + Source diff --git a/docs/master/RuntimeError.html b/docs/master/RuntimeError.html index e577fdb95..d2f858b30 100644 --- a/docs/master/RuntimeError.html +++ b/docs/master/RuntimeError.html @@ -29,7 +29,7 @@

                                                                                  - Source + Source diff --git a/docs/master/String.html b/docs/master/String.html index f277b9503..73051ca2d 100644 --- a/docs/master/String.html +++ b/docs/master/String.html @@ -93,7 +93,7 @@

                                                                                  Integer codepoints

                                                                                  Although codepoints could be represented as integers, this module represents all codepoints as strings. For example:

                                                                                  -
                                                                                  iex> String.codepoints "josé"
                                                                                  +
                                                                                  iex> String.codepoints("josé")
                                                                                   ["j", "o", "s", "é"]
                                                                                   
                                                                                  @@ -258,11 +258,31 @@

                                                                                  Functions summary

                                                                                  strip/2
                                                                                • +
                                                                                • + + to_float/1 + +
                                                                                • +
                                                                                • + + to_integer/1 + +
                                                                                • upcase/1
                                                                                • +
                                                                                • + + valid?/1 + +
                                                                                • +
                                                                                • + + valid_character?/1 + +
                                                                                • valid_codepoint?/1 @@ -301,7 +321,7 @@

                                                                                  Examples

                                                                                  - Source + Source

                                                                                  @@ -387,7 +407,8 @@

                                                                                  Examples

                                                                                  first(string)

                                                                                  -

                                                                                  Returns the first grapheme from an utf8 string.

                                                                                  +

                                                                                  Returns the first grapheme from an utf8 string, +nil if the string is empty.

                                                                                  Examples

                                                                                  @@ -398,7 +419,7 @@

                                                                                  Examples

                                                                                  - Source + Source

                                                                                  @@ -413,13 +434,14 @@

                                                                                  Examples

                                                                                  - Source + Source

                                                                                  last(string)

                                                                                  -

                                                                                  Returns the last grapheme from an utf8 string.

                                                                                  +

                                                                                  Returns the last grapheme from an utf8 string, +nil if the string is empty.

                                                                                  Examples

                                                                                  @@ -430,7 +452,7 @@

                                                                                  Examples

                                                                                  - Source + Source

                                                                                  @@ -447,7 +469,7 @@

                                                                                  Examples

                                                                                  - Source + Source

                                                                                  @@ -521,7 +543,7 @@

                                                                                  Examples

                                                                                  - Source + Source

                                                                                  @@ -619,27 +641,23 @@

                                                                                  Examples

                                                                                  "ixir" iex> String.slice("elixir", -10, 3) nil +iex> String.slice("a", 0, 1500) +"a" +iex> String.slice("a", 1, 1500) +"" +iex> String.slice("a", 2, 1500) +nil
                                                                                  - Source + Source

                                                                                  split(binary)

                                                                                  -

                                                                                  Divides a string into sub string based on a pattern, -returning a list of these sub string. The pattern can -be a string, a list of strings or a regular expression.

                                                                                  - -

                                                                                  The string is split into as many parts as possible by -default, unless the global option is set to false. -If a pattern is not specified, the string is split on -Unicode whitespace occurrences with leading and trailing -whitespace ignored.

                                                                                  - -

                                                                                  It returns a list with the original string if the pattern -can't be matched.

                                                                                  +

                                                                                  Splits a string on sub strings at each Unicode whitespace +occurrence with leading and trailing whitespace ignored.

                                                                                  Examples

                                                                                  @@ -649,8 +667,25 @@

                                                                                  Examples

                                                                                  ["foo", "bar"] iex> String.split(" foo bar ") ["foo", "bar"] + +
                                                                                  + + Source + +
                                                                                  +

                                                                                  + split(binary, pattern, options // []) +

                                                                                  +

                                                                                  Divides a string into sub strings based on a pattern, +returning a list of these sub string. The pattern can +be a string, a list of strings or a regular expression.

                                                                                  -iex> String.split("a,b,c", ",") +

                                                                                  The string is split into as many parts as possible by +default, unless the global option is set to false.

                                                                                  + +

                                                                                  Examples

                                                                                  + +
                                                                                  iex> String.split("a,b,c", ",")
                                                                                   ["a", "b", "c"]
                                                                                   iex> String.split("a,b,c", ",", global: false)
                                                                                   ["a", "b,c"]
                                                                                  @@ -667,14 +702,6 @@ 

                                                                                  Examples

                                                                                  - Source - -
                                                                                  -

                                                                                  - split(binary, pattern, options // []) -

                                                                                  -
                                                                                  - Source
                                                                                  @@ -709,6 +736,52 @@

                                                                                  Examples

                                                                                  Source +
                                                                                  +

                                                                                  + to_float(string) +

                                                                                  +

                                                                                  Converts a string to a float. If successful, returns a +tuple of form {float, remainder of string}. If unsuccessful, +returns :error. If given an integer value, will return +same as to_integer/1.

                                                                                  + +

                                                                                  Examples

                                                                                  + +
                                                                                  iex> String.to_float("34")
                                                                                  +{34.0,""}
                                                                                  +iex> String.to_float("34.25")
                                                                                  +{34.25,""}
                                                                                  +
                                                                                  + +

                                                                                  iex> String.tofloat("56.5xyz") + {56.5,"xyz"} + iex> String.tofloat("pi") + :error

                                                                                  +
                                                                                  + + Source + +
                                                                                  +

                                                                                  + to_integer(string) +

                                                                                  +

                                                                                  Converts a string to an integer. If successful, returns a +tuple of form {integer, remainder of string}. If unsuccessful, +returns :error.

                                                                                  + +

                                                                                  Examples

                                                                                  + +
                                                                                  iex> String.to_integer("34")
                                                                                  +{34,""}
                                                                                  +iex> String.to_integer("34.5")
                                                                                  +{34,".5"}
                                                                                  +iex> String.to_integer("three")
                                                                                  +:error
                                                                                  +
                                                                                  +
                                                                                  + + Source +

                                                                                  upcase(binary) @@ -728,6 +801,52 @@

                                                                                  Examples

                                                                                  Source +
                                                                                  +

                                                                                  + valid?(arg1) +

                                                                                  +

                                                                                  Checks whether str contains only valid characters.

                                                                                  + +

                                                                                  Examples

                                                                                  + +
                                                                                  iex> String.valid?("a")
                                                                                  +true
                                                                                  +iex> String.valid?("ø")
                                                                                  +true
                                                                                  +iex> String.valid?(<<0xffff :: 16>>)
                                                                                  +false
                                                                                  +iex> String.valid?("asd" <> <<0xffff :: 16>>)
                                                                                  +false
                                                                                  +
                                                                                  +
                                                                                  + + Source + +
                                                                                  +

                                                                                  + valid_character?(codepoint) +

                                                                                  +

                                                                                  Checks whether str is a valid character.

                                                                                  + +

                                                                                  All characters are codepoints, but some codepoints +are not valid characters. They may be reserved, private, +or other.

                                                                                  + +

                                                                                  More info at: http://en.wikipedia.org/wiki/Mapping_of_Unicode_characters#Noncharacters

                                                                                  + +

                                                                                  Examples

                                                                                  + +
                                                                                  iex> String.valid_character?("a")
                                                                                  +true
                                                                                  +iex> String.valid_character?("ø")
                                                                                  +true
                                                                                  +iex> String.valid_character?("\x{ffff}")
                                                                                  +false
                                                                                  +
                                                                                  +
                                                                                  + + Source +

                                                                                  valid_codepoint?(arg1) @@ -743,14 +862,14 @@

                                                                                  Examples

                                                                                  true iex> String.valid_codepoint?("ø") true -iex> String.valid_codepoint?("\xffff") +iex> String.valid_codepoint?(<<0xffff :: 16>>) false iex> String.valid_codepoint?("asdf") false
                                                                                  - Source + Source
                                                                                  diff --git a/docs/master/SyntaxError.html b/docs/master/SyntaxError.html index efb4f2c2c..cbf341f50 100644 --- a/docs/master/SyntaxError.html +++ b/docs/master/SyntaxError.html @@ -29,7 +29,7 @@

                                                                                  - Source + Source @@ -83,7 +83,7 @@

                                                                                  Functions

                                                                                  - Source + Source diff --git a/docs/master/SystemLimitError.html b/docs/master/SystemLimitError.html index e7c034a60..106ae4003 100644 --- a/docs/master/SystemLimitError.html +++ b/docs/master/SystemLimitError.html @@ -29,7 +29,7 @@

                                                                                  - Source + Source diff --git a/docs/master/TokenMissingError.html b/docs/master/TokenMissingError.html index d5bb2562a..1e1b00815 100644 --- a/docs/master/TokenMissingError.html +++ b/docs/master/TokenMissingError.html @@ -29,7 +29,7 @@

                                                                                  - Source + Source @@ -83,7 +83,7 @@

                                                                                  Functions

                                                                                  - Source + Source diff --git a/docs/master/UndefinedFunctionError.html b/docs/master/UndefinedFunctionError.html index a3d1329cf..cd334faa2 100644 --- a/docs/master/UndefinedFunctionError.html +++ b/docs/master/UndefinedFunctionError.html @@ -29,7 +29,7 @@

                                                                                  - Source + Source @@ -83,7 +83,7 @@

                                                                                  Functions

                                                                                  - Source + Source diff --git a/docs/master/index.html b/docs/master/index.html index dcfbc64c0..93ae16fed 100644 --- a/docs/master/index.html +++ b/docs/master/index.html @@ -3,7 +3,7 @@ - Elixir v0.8.2 Documentation + Elixir v0.8.3 Documentation diff --git a/docs/master/modules_list.html b/docs/master/modules_list.html index 9c0517820..367ed32d2 100644 --- a/docs/master/modules_list.html +++ b/docs/master/modules_list.html @@ -16,7 +16,7 @@
                                                                                • +
                                                                                • + + take/2 + + Dict +
                                                                                • + +
                                                                                • + + split/2 + + Dict +
                                                                                • +
                                                                                • size/1 @@ -367,6 +381,20 @@

                                                                                  Dict

                                                                                • +
                                                                                • + + pop/3 + + Dict +
                                                                                • + +
                                                                                • + + pop/2 + + Dict +
                                                                                • +
                                                                                • merge/3 @@ -416,6 +444,13 @@

                                                                                  Dict

                                                                                • +
                                                                                • + + equal?/2 + + Dict +
                                                                                • +
                                                                                • empty/1 @@ -423,6 +458,13 @@

                                                                                  Dict

                                                                                • +
                                                                                • + + drop/2 + + Dict +
                                                                                • +
                                                                                • delete/2 @@ -437,6 +479,13 @@

                                                                                  Dict

                                                                                • +
                                                                                • + + drop/2 + + Dict +
                                                                                • +
                                                                                • empty/1 @@ -446,14 +495,28 @@

                                                                                • - get/3 + equal?/2 Dict
                                                                                • - get!/2 + fetch/2 + + Dict +
                                                                                • + +
                                                                                • + + fetch!/2 + + Dict +
                                                                                • + +
                                                                                • + + get/3 Dict
                                                                                • @@ -486,6 +549,13 @@

                                                                                  Dict

                                                                                • +
                                                                                • + + pop/3 + + Dict +
                                                                                • +
                                                                                • put/3 @@ -507,6 +577,20 @@

                                                                                  Dict

                                                                                • +
                                                                                • + + split/2 + + Dict +
                                                                                • + +
                                                                                • + + take/2 + + Dict +
                                                                                • +
                                                                                • to_list/1 @@ -694,7 +778,7 @@

                                                                                • - at!/2 + at/3 Enum
                                                                                • @@ -741,6 +825,20 @@

                                                                                  Enum

                                                                                • +
                                                                                • + + fetch/2 + + Enum +
                                                                                • + +
                                                                                • + + fetch!/2 + + Enum +
                                                                                • +
                                                                                • filter/2 @@ -811,6 +909,41 @@

                                                                                  Enum

                                                                                • +
                                                                                • + + max/1 + + Enum +
                                                                                • + +
                                                                                • + + max/2 + + Enum +
                                                                                • + +
                                                                                • + + member?/2 + + Enum +
                                                                                • + +
                                                                                • + + min/1 + + Enum +
                                                                                • + +
                                                                                • + + min/2 + + Enum +
                                                                                • +
                                                                                • partition/2 @@ -876,7 +1009,14 @@

                                                                                • - uniq/1 + to_list/1 + + Enum +
                                                                                • + +
                                                                                • + + uniq/2 Enum
                                                                                • @@ -1088,7 +1228,7 @@

                                                                                • - suite_finished/2 + suite_finished/3 ExUnit.CLIFormatter
                                                                                • @@ -1160,6 +1300,24 @@

                                                                                  ExUnit.Callbacks

                                                                                • +
                                                                                +
                                                                              • + + + CaptureIO + + ExUnit.CaptureIO +
                                                                              • +
                                                                              • @@ -1255,7 +1413,7 @@

                                                                              • - suite_finished/2 + suite_finished/3 ExUnit.Formatter
                                                                              • @@ -1311,21 +1469,21 @@

                                                                              • - format_entry/2 + format_file_line/3 Exception
                                                                              • - format_file_line/3 + format_stacktrace/1 Exception
                                                                              • - format_stacktrace/1 + format_stacktrace_entry/2 Exception
                                                                              • @@ -1724,6 +1882,13 @@

                                                                                HashDict

                                                                              • +
                                                                              • + + drop/2 + + HashDict +
                                                                              • +
                                                                              • empty/1 @@ -1733,14 +1898,28 @@

                                                                              • - get/3 + equal?/2 + + HashDict +
                                                                              • + +
                                                                              • + + fetch/2 + + HashDict +
                                                                              • + +
                                                                              • + + fetch!/2 HashDict
                                                                              • - get!/2 + get/3 HashDict
                                                                              • @@ -1787,6 +1966,13 @@

                                                                                HashDict

                                                                              • +
                                                                              • + + pop/3 + + HashDict +
                                                                              • +
                                                                              • put/3 @@ -1808,6 +1994,20 @@

                                                                                HashDict

                                                                              • +
                                                                              • + + split/2 + + HashDict +
                                                                              • + +
                                                                              • + + take/2 + + HashDict +
                                                                              • +
                                                                              • to_list/1 @@ -1915,6 +2115,13 @@

                                                                                IEx.Helpers

                                                                              • +
                                                                              • + + ls/1 + + IEx.Helpers +
                                                                              • +
                                                                              • m/0 @@ -1971,24 +2178,6 @@

                                                                                IEx.Helpers

                                                                              • -
                                                                              -
                                                                            • - - - Remsh - - IEx.Remsh -
                                                                            • - @@ -2429,7 +2618,14 @@

                                                                            • - getb/3 + getn/2 + + IO +
                                                                            • + +
                                                                            • + + getn/3 IO
                                                                            • @@ -2577,6 +2773,13 @@

                                                                              Kernel.SpecialForms +
                                                                            • + + __DIR__/0 + + Kernel.SpecialForms +
                                                                            • +
                                                                            • __ENV__/0 @@ -2621,14 +2824,14 @@

                                                                            • - alias/0 + alias/2 Kernel.SpecialForms
                                                                            • - alias/2 + alias!/1 Kernel.SpecialForms
                                                                            • @@ -2668,6 +2871,20 @@

                                                                              Kernel.SpecialForms

                                                                            • +
                                                                            • + + unquote/1 + + Kernel.SpecialForms +
                                                                            • + +
                                                                            • + + unquote_splicing/1 + + Kernel.SpecialForms +
                                                                            • +
                                                                            • var!/1 @@ -3228,6 +3445,34 @@

                                                                              Kernel

                                                                            • +
                                                                            • + + defmacro/2 + + Kernel +
                                                                            • + +
                                                                            • + + defmacro/4 + + Kernel +
                                                                            • + +
                                                                            • + + defmacrop/2 + + Kernel +
                                                                            • + +
                                                                            • + + defmacrop/4 + + Kernel +
                                                                            • +
                                                                            • defmodule/2 @@ -3265,7 +3510,7 @@

                                                                            • - defrecord/4 + defrecord/3 Kernel
                                                                            • @@ -3342,21 +3587,28 @@

                                                                            • - function/1 + float_to_list/2 Kernel
                                                                            • - function/3 + function/1 Kernel
                                                                            • - function_exported?/3 + function/3 + + Kernel +
                                                                            • + +
                                                                            • + + function_exported?/3 Kernel
                                                                            • @@ -3939,6 +4191,13 @@

                                                                              Keyword

                                                                            • +
                                                                            • + + delete_first/2 + + Keyword +
                                                                            • +
                                                                            • equal?/2 @@ -3948,21 +4207,28 @@

                                                                            • - from_enum/1 + fetch/2 Keyword
                                                                            • - get/3 + fetch!/2 Keyword
                                                                            • - get!/2 + from_enum/1 + + Keyword +
                                                                            • + +
                                                                            • + + get/3 Keyword
                                                                            • @@ -4073,263 +4339,305 @@

                                                                              List

                                                                            • -
                                                                            • @@ -4806,6 +5233,13 @@

                                                                              Mix.Shell.IO

                                                                            • +
                                                                            • + + put_app/0 + + Mix.Shell.IO +
                                                                            • +
                                                                            • yes?/1 @@ -4852,6 +5286,13 @@

                                                                              Mix.Shell.Process

                                                                            • +
                                                                            • + + put_app/0 + + Mix.Shell.Process +
                                                                            • +
                                                                            • yes?/1 @@ -4919,6 +5360,13 @@

                                                                              Mix.Task

                                                                            • +
                                                                            • + + recursive?/1 + + Mix.Task +
                                                                            • +
                                                                            • reenable/1 @@ -5364,6 +5812,31 @@

                                                                              Mix.Tasks.Local.Install

                                                                            • +

                                                                            +
                                                                          • + + + Tasks.Local.Rebar + + Mix.Tasks.Local.Rebar +
                                                                          • +
                                                                          • @@ -5489,6 +5962,13 @@

                                                                            Mix.Utils

                                                                          • +
                                                                          • + + manifest/2 + + Mix.Utils +
                                                                          • +
                                                                          • mix_home/0 @@ -5496,6 +5976,13 @@

                                                                            Mix.Utils

                                                                          • +
                                                                          • + + mix_path/0 + + Mix.Utils +
                                                                          • +
                                                                          • module_name_to_command/2 @@ -5505,7 +5992,7 @@

                                                                          • - preserving_mtime/2 + read_path/1 Mix.Utils
                                                                          • @@ -5773,6 +6260,13 @@

                                                                            Node

                                                                          • +
                                                                          • + + get_cookie/0 + + Node +
                                                                          • +
                                                                          • list/0 @@ -5808,6 +6302,13 @@

                                                                            Node

                                                                          • +
                                                                          • + + set_cookie/2 + + Node +
                                                                          • +
                                                                          • spawn/2 @@ -6634,6 +7135,20 @@

                                                                            String

                                                                          • +
                                                                          • + + to_float/1 + + String +
                                                                          • + +
                                                                          • + + to_integer/1 + + String +
                                                                          • +
                                                                          • upcase/1 @@ -6641,6 +7156,20 @@

                                                                            String

                                                                          • +
                                                                          • + + valid?/1 + + String +
                                                                          • + +
                                                                          • + + valid_character?/1 + + String +
                                                                          • +
                                                                          • valid_codepoint?/1 diff --git a/docs/master/protocols_list.html b/docs/master/protocols_list.html index 305562548..a38caffe6 100644 --- a/docs/master/protocols_list.html +++ b/docs/master/protocols_list.html @@ -16,7 +16,7 @@
                                                                          • +
                                                                          • + + member?/2 + + Enum.Iterator.Function +
                                                                          • +
                                                                        • @@ -504,6 +511,13 @@

                                                                          Enum.Iterator.HashDict

                                                                        • +
                                                                        • + + member?/2 + + Enum.Iterator.HashDict +
                                                                        • +
                                                                      • @@ -529,6 +543,13 @@

                                                                        Enum.Iterator.List

                                                                      • +
                                                                      • + + member?/2 + + Enum.Iterator.List +
                                                                      • +
                                                                    • @@ -554,6 +575,13 @@

                                                                      Enum.Iterator.Range

                                                                    • +
                                                                    • + + member?/2 + + Enum.Iterator.Range +
                                                                    • +
                                                                    @@ -571,6 +599,13 @@

                                                                    Enum.Iterator

                                                                  • +
                                                                  • + + member?/2 + + Enum.Iterator +
                                                                  • +
                                                                • diff --git a/docs/master/records_list.html b/docs/master/records_list.html index d5a5bf7be..2ed698170 100644 --- a/docs/master/records_list.html +++ b/docs/master/records_list.html @@ -16,7 +16,7 @@

                                                                  - Elixir v0.8.2 + Elixir v0.8.3

                                                                  diff --git a/docs/stable/ArgumentError.html b/docs/stable/ArgumentError.html index d0dc3d7b6..a3ec54bd4 100644 --- a/docs/stable/ArgumentError.html +++ b/docs/stable/ArgumentError.html @@ -29,7 +29,7 @@

                                                                  - Source + Source diff --git a/docs/stable/ArithmeticError.html b/docs/stable/ArithmeticError.html index 57ba46960..cb2b4e534 100644 --- a/docs/stable/ArithmeticError.html +++ b/docs/stable/ArithmeticError.html @@ -29,7 +29,7 @@

                                                                  - Source + Source diff --git a/docs/stable/BadArityError.html b/docs/stable/BadArityError.html index 3c67ceecf..421ce26d2 100644 --- a/docs/stable/BadArityError.html +++ b/docs/stable/BadArityError.html @@ -29,7 +29,7 @@

                                                                  - Source + Source @@ -77,7 +77,7 @@

                                                                  Functions

                                                                  - Source + Source diff --git a/docs/stable/BadFunctionError.html b/docs/stable/BadFunctionError.html index a9e50c445..6889999ed 100644 --- a/docs/stable/BadFunctionError.html +++ b/docs/stable/BadFunctionError.html @@ -29,7 +29,7 @@

                                                                  - Source + Source @@ -71,7 +71,7 @@

                                                                  Functions

                                                                  - Source + Source diff --git a/docs/stable/Binary.Chars.List.html b/docs/stable/Binary.Chars.List.html index b86e507aa..bb611efb2 100644 --- a/docs/stable/Binary.Chars.List.html +++ b/docs/stable/Binary.Chars.List.html @@ -65,9 +65,9 @@

                                                                  Functions

                                                                  Examples

                                                                  -
                                                                  iex> to_binary 'foo'
                                                                  +
                                                                  iex> to_binary('foo')
                                                                   "foo"
                                                                  -iex> to_binary ["foo", 'bar']
                                                                  +iex> to_binary(["foo", 'bar'])
                                                                   "foobar"
                                                                   
                                                                  diff --git a/docs/stable/Binary.Chars.Number.html b/docs/stable/Binary.Chars.Number.html index a9d1f0680..d1f7e24a4 100644 --- a/docs/stable/Binary.Chars.Number.html +++ b/docs/stable/Binary.Chars.Number.html @@ -61,7 +61,7 @@

                                                                  Functions

                                                                  Simply converts the number (integer or a float) to a binary.

                                                                  - Source + Source diff --git a/docs/stable/Binary.Inspect.Atom.html b/docs/stable/Binary.Inspect.Atom.html index c3456d59b..1e93d94b6 100644 --- a/docs/stable/Binary.Inspect.Atom.html +++ b/docs/stable/Binary.Inspect.Atom.html @@ -49,7 +49,7 @@

                                                                  Examples

                                                                  - Source + Source @@ -80,7 +80,7 @@

                                                                  Functions

                                                                  - Source + Source diff --git a/docs/stable/Binary.Inspect.BitString.html b/docs/stable/Binary.Inspect.BitString.html index ae68fda85..306c2c45b 100644 --- a/docs/stable/Binary.Inspect.BitString.html +++ b/docs/stable/Binary.Inspect.BitString.html @@ -43,7 +43,7 @@

                                                                  Examples

                                                                  - Source + Source @@ -74,7 +74,7 @@

                                                                  Functions

                                                                  - Source + Source diff --git a/docs/stable/Binary.Inspect.Function.html b/docs/stable/Binary.Inspect.Function.html index fda8c6e1a..7d43b80aa 100644 --- a/docs/stable/Binary.Inspect.Function.html +++ b/docs/stable/Binary.Inspect.Function.html @@ -34,7 +34,7 @@

                                                                  - Source + Source @@ -65,7 +65,7 @@

                                                                  Functions

                                                                  - Source + Source diff --git a/docs/stable/Binary.Inspect.HashDict.html b/docs/stable/Binary.Inspect.HashDict.html index 537eb06a9..e8684c6c7 100644 --- a/docs/stable/Binary.Inspect.HashDict.html +++ b/docs/stable/Binary.Inspect.HashDict.html @@ -29,7 +29,7 @@

                                                                  - Source + Source @@ -60,7 +60,7 @@

                                                                  Functions

                                                                  - Source + Source diff --git a/docs/stable/Binary.Inspect.List.html b/docs/stable/Binary.Inspect.List.html index c33640502..b03cf1d45 100644 --- a/docs/stable/Binary.Inspect.List.html +++ b/docs/stable/Binary.Inspect.List.html @@ -52,7 +52,7 @@

                                                                  Examples

                                                                  - Source + Source @@ -83,7 +83,7 @@

                                                                  Functions

                                                                  - Source + Source diff --git a/docs/stable/Binary.Inspect.Number.html b/docs/stable/Binary.Inspect.Number.html index 5bcb50ae8..e6ef9fd20 100644 --- a/docs/stable/Binary.Inspect.Number.html +++ b/docs/stable/Binary.Inspect.Number.html @@ -40,7 +40,7 @@

                                                                  Examples

                                                                  - Source + Source @@ -71,7 +71,7 @@

                                                                  Functions

                                                                  - Source + Source diff --git a/docs/stable/Binary.Inspect.PID.html b/docs/stable/Binary.Inspect.PID.html index 6d4c3d956..43164d898 100644 --- a/docs/stable/Binary.Inspect.PID.html +++ b/docs/stable/Binary.Inspect.PID.html @@ -34,7 +34,7 @@

                                                                  - Source + Source @@ -65,7 +65,7 @@

                                                                  Functions

                                                                  - Source + Source diff --git a/docs/stable/Binary.Inspect.Port.html b/docs/stable/Binary.Inspect.Port.html index 18cbf0c1b..f0e38da08 100644 --- a/docs/stable/Binary.Inspect.Port.html +++ b/docs/stable/Binary.Inspect.Port.html @@ -34,7 +34,7 @@

                                                                  - Source + Source @@ -65,7 +65,7 @@

                                                                  Functions

                                                                  - Source + Source diff --git a/docs/stable/Binary.Inspect.Range.html b/docs/stable/Binary.Inspect.Range.html index f4ecd5222..4b0e56c9e 100644 --- a/docs/stable/Binary.Inspect.Range.html +++ b/docs/stable/Binary.Inspect.Range.html @@ -29,7 +29,7 @@

                                                                  - Source + Source @@ -60,7 +60,7 @@

                                                                  Functions

                                                                  - Source + Source diff --git a/docs/stable/Binary.Inspect.Reference.html b/docs/stable/Binary.Inspect.Reference.html index 28c597f46..182272e50 100644 --- a/docs/stable/Binary.Inspect.Reference.html +++ b/docs/stable/Binary.Inspect.Reference.html @@ -34,7 +34,7 @@

                                                                  - Source + Source @@ -65,7 +65,7 @@

                                                                  Functions

                                                                  - Source + Source diff --git a/docs/stable/Binary.Inspect.Regex.html b/docs/stable/Binary.Inspect.Regex.html index 9a7a2ad44..17afa4e46 100644 --- a/docs/stable/Binary.Inspect.Regex.html +++ b/docs/stable/Binary.Inspect.Regex.html @@ -40,7 +40,7 @@

                                                                  Examples

                                                                  - Source + Source @@ -71,7 +71,7 @@

                                                                  Functions

                                                                  - Source + Source diff --git a/docs/stable/Binary.Inspect.Tuple.html b/docs/stable/Binary.Inspect.Tuple.html index ca9699b61..8889c1747 100644 --- a/docs/stable/Binary.Inspect.Tuple.html +++ b/docs/stable/Binary.Inspect.Tuple.html @@ -43,7 +43,7 @@

                                                                  Examples

                                                                  - Source + Source @@ -74,7 +74,7 @@

                                                                  Functions

                                                                  - Source + Source diff --git a/docs/stable/Binary.Inspect.html b/docs/stable/Binary.Inspect.html index 7989caba7..d9b701791 100644 --- a/docs/stable/Binary.Inspect.html +++ b/docs/stable/Binary.Inspect.html @@ -148,7 +148,7 @@

                                                                  Functions

                                                                  - Source + Source diff --git a/docs/stable/CaseClauseError.html b/docs/stable/CaseClauseError.html index c55f70bcc..22814350e 100644 --- a/docs/stable/CaseClauseError.html +++ b/docs/stable/CaseClauseError.html @@ -29,7 +29,7 @@

                                                                  - Source + Source @@ -71,7 +71,7 @@

                                                                  Functions

                                                                  - Source + Source diff --git a/docs/stable/Code.html b/docs/stable/Code.html index 350120b65..fedbf456b 100644 --- a/docs/stable/Code.html +++ b/docs/stable/Code.html @@ -97,12 +97,12 @@

                                                                  Functions summary

                                                                • - eval/3 + eval_quoted/3
                                                                • - eval_quoted/3 + eval_string/3
                                                                • @@ -170,7 +170,7 @@

                                                                  Functions

                                                                  binary.

                                                                  - Source + Source

                                                                  @@ -183,7 +183,7 @@

                                                                  Functions

                                                                  For compiling many files at once, check Kernel.ParallelCompiler.

                                                                  - Source + Source

                                                                  @@ -193,7 +193,7 @@

                                                                  Functions

                                                                  Check compiler_options/1 for more information.

                                                                  - Source + Source

                                                                  @@ -215,7 +215,7 @@

                                                                  Functions

                                                                - Source + Source

                                                                @@ -244,7 +244,7 @@

                                                                Functions

                                                                and when to use ensure_loaded/1 or ensure_compiled/1.

                                                                - Source + Source

                                                                @@ -254,7 +254,7 @@

                                                                Functions

                                                                it could be ensured or not.

                                                                - Source + Source

                                                                @@ -298,7 +298,7 @@

                                                                Code.ensure_compiled

                                                                that needs to invoke a module for callback information.

                                                                - Source + Source

                                                                @@ -308,11 +308,38 @@

                                                                Code.ensure_compiled

                                                                it could be ensured or not.

                                                                - Source + Source + +
                                                                +

                                                                + eval_quoted(quoted, binding // [], opts // []) +

                                                                +

                                                                Evalutes the quoted contents.

                                                                + +

                                                                This function accepts a list of environment options. +Check Code.eval_string for more information.

                                                                + +

                                                                Examples

                                                                + +
                                                                iex> contents = quote(hygiene: [vars: false], do: a + b)
                                                                +...> Code.eval_quoted(contents, [a: 1, b: 2], file: __ENV__.file, line: __ENV__.line)
                                                                +{ 3, [ {:a, 1}, {:b, 2} ] }
                                                                +
                                                                + +

                                                                For convenience, you can my pass __ENV__ as argument and +all options will be automatically extracted from the environment:

                                                                + +
                                                                iex> contents = quote(hygiene: [vars: false], do: a + b)
                                                                +...> Code.eval_quoted(contents, [a: 1, b: 2], __ENV__)
                                                                +{ 3, [ {:a, 1}, {:b, 2} ] }
                                                                +
                                                                +
                                                                + + Source
                                                                -

                                                                - eval(string, binding // [], opts // []) +

                                                                + eval_string(string, binding // [], opts // [])

                                                                Evalutes the contents given by string. The second argument is the binding (which should be a keyword) followed by a keyword list of @@ -344,7 +371,7 @@

                                                                Code.ensure_compiled

                                                                Examples

                                                                -
                                                                iex> Code.eval "a + b", [a: 1, b: 2], file: __ENV__.file, line: __ENV__.line
                                                                +
                                                                iex> Code.eval_string("a + b", [a: 1, b: 2], file: __ENV__.file, line: __ENV__.line)
                                                                 { 3, [ {:a, 1}, {:b, 2} ] }
                                                                 
                                                                @@ -352,39 +379,12 @@

                                                                Examples

                                                                all imports, requires and aliases will be automatically carried over:

                                                                -
                                                                iex> Code.eval "a + b", [a: 1, b: 2], __ENV__
                                                                -{ 3, [ {:a, 1}, {:b, 2} ] }
                                                                -
                                                                -
                                                                - - Source - -
                                                                -

                                                                - eval_quoted(quoted, binding // [], opts // []) -

                                                                -

                                                                Evalutes the quoted contents.

                                                                - -

                                                                This function accepts a list of environment options. -Check Code.eval for more information.

                                                                - -

                                                                Examples

                                                                - -
                                                                iex> contents = quote hygiene: [vars: false], do: a + b
                                                                -...> Code.eval_quoted contents, [a: 1, b: 2], file: __ENV__.file, line: __ENV__.line
                                                                -{ 3, [ {:a, 1}, {:b, 2} ] }
                                                                -
                                                                - -

                                                                For convenience, you can my pass __ENV__ as argument and -all options will be automatically extracted from the environment:

                                                                - -
                                                                iex> contents = quote hygiene: [vars: false], do: a + b
                                                                -...> Code.eval_quoted contents, [a: 1, b: 2], __ENV__
                                                                +
                                                                iex> Code.eval_string("a + b", [a: 1, b: 2], __ENV__)
                                                                 { 3, [ {:a, 1}, {:b, 2} ] }
                                                                 
                                                                - Source + Source

                                                                @@ -402,7 +402,7 @@

                                                                Examples

                                                                require_file if you don't want a file to be loaded concurrently.

                                                                - Source + Source

                                                                @@ -427,20 +427,20 @@

                                                                Examples

                                                                require_file(file, relative_to // nil)

                                                                -

                                                                Requires the given file. Accepts relative_to as an argument -to tell where the file is located. If the file was already -required/loaded, loads it again. It returns all the modules -defined in the file.

                                                                +

                                                                Requires the given file. Accepts relative_to as an argument to tell where +the file is located. It returns all the modules defined in the file. If the +file was already required/loaded, doesn't do anything and returns nil.

                                                                -

                                                                Notice that if require_file is invoked by different processes -concurrently, the first process to invoke require_file acquires -a lock and the remaining ones will block until the file is -available. I.e. if require_file is called N times with a given -file, the given file will be loaded only once. Check load_file -if you want a file to be loaded concurrently.

                                                                +

                                                                Notice that if require_file is invoked by different processes concurrently, +the first process to invoke require_file acquires a lock and the remaining +ones will block until the file is available. I.e. if require_file is called +N times with a given file, it will be loaded only once. The first process to +call require_file will get the list of loaded modules, others will get nil.

                                                                + +

                                                                Check load_file if you want a file to be loaded concurrently.

                                                                - Source + Source

                                                                @@ -458,9 +458,15 @@

                                                                Options

                                                              • :existing_atoms_only - When true, raises an error when non-existing atoms are found by the tokenizer.

                                                              + +

                                                              Macro.to_binary/1

                                                              + +

                                                              The opposite of converting a string to its AST is +Macro.to_binary, which converts a AST to a binary +representation.

                                                              - Source + Source

                                                              @@ -474,7 +480,7 @@

                                                              Options

                                                              Check Code.string_to_ast/2 for options information.

                                                              - Source + Source

                                                              diff --git a/docs/stable/CompileError.html b/docs/stable/CompileError.html index 18c9dbc33..60f4bca8d 100644 --- a/docs/stable/CompileError.html +++ b/docs/stable/CompileError.html @@ -29,7 +29,7 @@

                                                              - Source + Source @@ -83,7 +83,7 @@

                                                              Functions

                                                              - Source + Source
                                                              diff --git a/docs/stable/Dict.html b/docs/stable/Dict.html index 734ed8134..b5c59aa0f 100644 --- a/docs/stable/Dict.html +++ b/docs/stable/Dict.html @@ -55,16 +55,16 @@

                                                              Protocols

                                                              protocol:

                                                              iex> dict = HashDict.new
                                                              -...> dict = Dict.put dict, :hello, :world
                                                              +...> dict = Dict.put(dict, :hello, :world)
                                                               ...> dict[:hello]
                                                               :world
                                                               

                                                              And also the Enum.Iterator protocol, allowing one to write:

                                                              -
                                                              Enum.each dict, fn { k, v } ->
                                                              +
                                                              Enum.each(dict, fn ({ k, v }) ->
                                                                 IO.puts "#{k}: #{v}"
                                                              -end
                                                              +end)
                                                               
                                                              @@ -84,6 +84,11 @@

                                                              Functions summary

                                                              delete/2
                                                            • +
                                                            • + + drop/2 + +
                                                            • empty/1 @@ -91,12 +96,22 @@

                                                              Functions summary

                                                            • - get/3 + equal?/2
                                                            • - get!/2 + fetch/2 + +
                                                            • +
                                                            • + + fetch!/2 + +
                                                            • +
                                                            • + + get/3
                                                            • @@ -119,6 +134,11 @@

                                                              Functions summary

                                                              merge/3
                                                            • +
                                                            • + + pop/3 + +
                                                            • put/3 @@ -134,6 +154,16 @@

                                                              Functions summary

                                                              size/1
                                                            • +
                                                            • + + split/2 + +
                                                            • +
                                                            • + + take/2 + +
                                                            • to_list/1 @@ -183,6 +213,16 @@

                                                              Callbacks summary

                                                              to_list/1
                                                            • +
                                                            • + + take/2 + +
                                                            • +
                                                            • + + split/2 + +
                                                            • size/1 @@ -198,6 +238,16 @@

                                                              Callbacks summary

                                                              put/3
                                                            • +
                                                            • + + pop/3 + +
                                                            • +
                                                            • + + pop/2 + +
                                                            • merge/3 @@ -233,11 +283,21 @@

                                                              Callbacks summary

                                                              get/2
                                                            • +
                                                            • + + equal?/2 + +
                                                            • empty/1
                                                            • +
                                                            • + + drop/2 + +
                                                            • delete/2 @@ -259,18 +319,41 @@

                                                              Functions

                                                              Examples

                                                              -
                                                              iex> d = HashDict.new [a: 1, b: 2]
                                                              -...> d = Dict.delete d, :a
                                                              -...> Dict.get d, :a
                                                              +
                                                              iex> d = HashDict.new([a: 1, b: 2])
                                                              +...> d = Dict.delete(d, :a)
                                                              +...> Dict.get(d, :a)
                                                               nil
                                                               
                                                              -iex> d = HashDict.new [b: 2]
                                                              +iex> d = HashDict.new([b: 2])
                                                               ...> Dict.delete(d, :a) == d
                                                               true
                                                               
                                                              - Source + Source + +
                                                              +

                                                              + drop(dict, keys) +

                                                              +

                                                              Returns a new dict where the the given keys a removed from dict. +Any non-member keys are ignored.

                                                              + +

                                                              Examples

                                                              + +
                                                              iex> d = HashDict.new([a: 1, b: 2])
                                                              +...> d = Dict.drop(d, [:a, :c, :d])
                                                              +...> Dict.to_list(d)
                                                              +[b: 2]
                                                              +
                                                              +iex> d = HashDict.new([a: 1, b: 2])
                                                              +...> d = Dict.drop(d, [:c, :d])
                                                              +...> Dict.to_list(d)
                                                              +[a: 1, b: 2]
                                                              +
                                                              +
                                                              + + Source

                                                              @@ -279,52 +362,96 @@

                                                              Examples

                                                              Returns an empty dict of the same type as dict.

                                                              - Source + Source
                                                              -

                                                              - get(dict, key, default // nil) +

                                                              + equal?(a, b)

                                                              -

                                                              Returns the value associated with key in dict. If dict does not -contain key, returns default (or nil if not provided).

                                                              +

                                                              Check if two dicts are equal, if the dicts are of different types they're +first converted to lists.

                                                              Examples

                                                              -
                                                              iex> d = HashDict.new [a: 1]
                                                              -...> Dict.get d, :a
                                                              -1
                                                              +
                                                              iex> a = HashDict.new(a: 2, b: 3, f: 5, c: 123)
                                                              +...> b = ListDict.new(a: 2, b: 3, f: 5, c: 123)
                                                              +...> Dict.equal?(a, b)
                                                              +true
                                                               
                                                              -iex> d = HashDict.new [a: 1]
                                                              -...> Dict.get d, :b
                                                              -nil
                                                              +iex> a = HashDict.new(a: 2, b: 3, f: 5, c: 123)
                                                              +...> b = []
                                                              +...> Dict.equal?(a, b)
                                                              +false
                                                              +
                                                              +
                                                              + + Source + +
                                                              +

                                                              + fetch(dict, key) +

                                                              +

                                                              Returns the { :ok, value } associated with key in dict. +If dict does not contain key, returns :error.

                                                              -iex> d = HashDict.new [a: 1] -...> Dict.get d, :b, 3 -3 +

                                                              Examples

                                                              + +
                                                              iex> d = HashDict.new([a: 1])
                                                              +...> Dict.fetch(d, :a)
                                                              +{ :ok, 1 }
                                                              +
                                                              +iex> d = HashDict.new([a: 1])
                                                              +...> Dict.fetch(d, :b)
                                                              +:error
                                                               
                                                              - Source + Source
                                                              -

                                                              - get!(dict, key) +

                                                              + fetch!(dict, key)

                                                              Returns the value associated with key in dict. If dict does not contain key, it raises KeyError.

                                                              Examples

                                                              -
                                                              iex> d = HashDict.new [a: 1]
                                                              -...> Dict.get d, :a
                                                              +
                                                              iex> d = HashDict.new([a: 1])
                                                              +...> Dict.fetch!(d, :a)
                                                               1
                                                              -iex> d = HashDict.new [a: 1]
                                                              -...> Dict.get! d, :b
                                                              +iex> d = HashDict.new([a: 1])
                                                              +...> Dict.fetch!(d, :b)
                                                               ** (KeyError) key not found: :b
                                                               
                                                              - Source + Source + +
                                                              +

                                                              + get(dict, key, default // nil) +

                                                              +

                                                              Returns the value associated with key in dict. If dict does not +contain key, returns default (or nil if not provided).

                                                              + +

                                                              Examples

                                                              + +
                                                              iex> d = HashDict.new([a: 1])
                                                              +...> Dict.get(d, :a)
                                                              +1
                                                              +
                                                              +iex> d = HashDict.new([a: 1])
                                                              +...> Dict.get(d, :b)
                                                              +nil
                                                              +
                                                              +iex> d = HashDict.new([a: 1])
                                                              +...> Dict.get(d, :b, 3)
                                                              +3
                                                              +
                                                              +
                                                              + + Source

                                                              @@ -334,17 +461,17 @@

                                                              Examples

                                                              Examples

                                                              -
                                                              iex> d = HashDict.new [a: 1]
                                                              +
                                                              iex> d = HashDict.new([a: 1])
                                                               ...> Dict.has_key?(d, :a)
                                                               true
                                                               
                                                              -iex> d = HashDict.new [a: 1]
                                                              +iex> d = HashDict.new([a: 1])
                                                               ...> Dict.has_key?(d, :b)
                                                               false
                                                               
                                                              - Source + Source

                                                              @@ -356,13 +483,13 @@

                                                              Examples

                                                              Examples

                                                              -
                                                              iex> d = HashDict.new [a: 1, b: 2]
                                                              -...> Enum.sort Dict.keys d
                                                              +
                                                              iex> d = HashDict.new([a: 1, b: 2])
                                                              +...> Enum.sort(Dict.keys(d))
                                                               [:a,:b]
                                                               
                                                              - Source + Source

                                                              @@ -373,15 +500,15 @@

                                                              Examples

                                                              Examples

                                                              -
                                                              iex> d1 = HashDict.new [a: 1, b: 2]
                                                              -...> d2 = HashDict.new [a: 3, d: 4]
                                                              -...> d = Dict.merge d1, d2
                                                              +
                                                              iex> d1 = HashDict.new([a: 1, b: 2])
                                                              +...> d2 = HashDict.new([a: 3, d: 4])
                                                              +...> d = Dict.merge(d1, d2)
                                                               ...> [a: Dict.get(d, :a), b: Dict.get(d, :b), d: Dict.get(d, :d)]
                                                               [a: 3, b: 2, d: 4]
                                                               
                                                              - Source + Source

                                                              @@ -393,17 +520,45 @@

                                                              Examples

                                                              Examples

                                                              -
                                                              iex> d1 = HashDict.new [a: 1, b: 2]
                                                              -...> d2 = HashDict.new [a: 3, d: 4]
                                                              -...> d = Dict.merge d1, d2, fn _k, v1, v2 ->
                                                              +
                                                              iex> d1 = HashDict.new([a: 1, b: 2])
                                                              +...> d2 = HashDict.new([a: 3, d: 4])
                                                              +...> d = Dict.merge(d1, d2, fn(_k, v1, v2) ->
                                                               ...>   v1 + v2
                                                              -...> end
                                                              +...> end)
                                                               ...> [a: Dict.get(d, :a), b: Dict.get(d, :b), d: Dict.get(d, :d)]
                                                               [a: 4, b: 2, d: 4]
                                                               
                                                              - Source + Source + +
                                                              +

                                                              + pop(dict, key, default // nil) +

                                                              +

                                                              Returns the value associated with key in dict as +well as the dict without key.

                                                              + +

                                                              Examples

                                                              + +
                                                              iex> dict = HashDict.new [a: 1]
                                                              +...> {v, d} = Dict.pop dict, :a
                                                              +...> {v, Enum.sort(d)}
                                                              +{1,[]}
                                                              +
                                                              +iex> dict = HashDict.new [a: 1]
                                                              +...> {v, d} = Dict.pop dict, :b
                                                              +...> {v, Enum.sort(d)}
                                                              +{nil,[a: 1]}
                                                              +
                                                              +iex> dict = HashDict.new [a: 1]
                                                              +...> {v, d} = Dict.pop dict, :b, 3
                                                              +...> {v, Enum.sort(d)}
                                                              +{3,[a: 1]}
                                                              +
                                                              +
                                                              + + Source

                                                              @@ -414,14 +569,14 @@

                                                              Examples

                                                              Examples

                                                              -
                                                              iex> d = HashDict.new [a: 1, b: 2]
                                                              -...> d = Dict.put d, :a, 3
                                                              -...> Dict.get d, :a
                                                              +
                                                              iex> d = HashDict.new([a: 1, b: 2])
                                                              +...> d = Dict.put(d, :a, 3)
                                                              +...> Dict.get(d, :a)
                                                               3
                                                               
                                                              - Source + Source

                                                              @@ -431,14 +586,14 @@

                                                              Examples

                                                              Examples

                                                              -
                                                              iex> d = HashDict.new [a: 1, b: 2]
                                                              -...> d = Dict.put_new d, :a, 3
                                                              -...> Dict.get d, :a
                                                              +
                                                              iex> d = HashDict.new([a: 1, b: 2])
                                                              +...> d = Dict.put_new(d, :a, 3)
                                                              +...> Dict.get(d, :a)
                                                               1
                                                               
                                                              - Source + Source

                                                              @@ -448,13 +603,67 @@

                                                              Examples

                                                              Examples

                                                              -
                                                              iex> d = HashDict.new [a: 1, b: 2]
                                                              -...> Dict.size d
                                                              +
                                                              iex> d = HashDict.new([a: 1, b: 2])
                                                              +...> Dict.size(d)
                                                               2
                                                               
                                                              - Source + Source + +
                                                              +

                                                              + split(dict, keys) +

                                                              +

                                                              Returns a tuple of two dicts, where the first dict contains only +entries from dict with keys in keys, and the second dict +contains only entries from dict with keys not in keys

                                                              + +

                                                              Any non-member keys are ignored.

                                                              + +

                                                              Examples

                                                              + +
                                                              iex> d = HashDict.new([a: 1, b: 2])
                                                              +...> { d1, d2 } = Dict.split(d, [:a, :c])
                                                              +...> { Dict.to_list(d1), Dict.to_list(d2) }
                                                              +{ [a: 1], [b: 2] }
                                                              +
                                                              +iex> d = HashDict.new([])
                                                              +...> { d1, d2 } = Dict.split(d, [:a, :c])
                                                              +...> { Dict.to_list(d1), Dict.to_list(d2) }
                                                              +{ [], [] }
                                                              +
                                                              +iex> d = HashDict.new([a: 1, b: 2])
                                                              +...> { d1, d2 } = Dict.split(d, [:a, :b, :c])
                                                              +...> { Dict.to_list(d1), Dict.to_list(d2) }
                                                              +{ [a: 1, b: 2], [] }
                                                              +
                                                              +
                                                              + + Source + +
                                                              +

                                                              + take(dict, keys) +

                                                              +

                                                              Returns a new dict where only the keys in keys from dict are +included. Any non-member keys are ignored.

                                                              + +

                                                              Examples

                                                              + +
                                                              iex> d = HashDict.new([a: 1, b: 2])
                                                              +...> d = Dict.take(d, [:a, :c, :d])
                                                              +...> Dict.to_list(d)
                                                              +[a: 1]
                                                              +
                                                              +iex> d = HashDict.new([a: 1, b: 2])
                                                              +...> d = Dict.take(d, [:c, :d])
                                                              +...> Dict.to_list(d)
                                                              +[]
                                                              +
                                                              +
                                                              + + Source

                                                              @@ -464,7 +673,7 @@

                                                              Examples

                                                              No particular order is enforced.

                                                              - Source + Source

                                                              @@ -475,14 +684,14 @@

                                                              Examples

                                                              Examples

                                                              -
                                                              iex> d = HashDict.new [a: 1, b: 2]
                                                              -...> d = Dict.update d, :a, fn val -> -val end
                                                              -...> Dict.get d, :a
                                                              +
                                                              iex> d = HashDict.new([a: 1, b: 2])
                                                              +...> d = Dict.update(d, :a, fn(val) -> -val end)
                                                              +...> Dict.get(d, :a)
                                                               -1
                                                               
                                                              - Source + Source

                                                              @@ -494,14 +703,14 @@

                                                              Examples

                                                              Examples

                                                              -
                                                              iex> d = HashDict.new [a: 1, b: 2]
                                                              -...> d = Dict.update d, :c, 3, fn val -> -val end
                                                              -...> Dict.get d, :c
                                                              +
                                                              iex> d = HashDict.new([a: 1, b: 2])
                                                              +...> d = Dict.update(d, :c, 3, fn(val) -> -val end)
                                                              +...> Dict.get(d, :c)
                                                               3
                                                               
                                                              - Source + Source

                                                              @@ -511,13 +720,13 @@

                                                              Examples

                                                              Examples

                                                              -
                                                              iex> d = HashDict.new [a: 1, b: 2]
                                                              -...> Enum.sort Dict.values d
                                                              +
                                                              iex> d = HashDict.new([a: 1, b: 2])
                                                              +...> Enum.sort(Dict.values(d))
                                                               [1,2]
                                                               
                                                              - Source + Source @@ -534,7 +743,7 @@

                                                              Callbacks

                                                              - Source + Source

                                                              @@ -542,7 +751,7 @@

                                                              Callbacks

                                                              - Source + Source

                                                              @@ -550,7 +759,7 @@

                                                              Callbacks

                                                              - Source + Source

                                                              @@ -558,7 +767,23 @@

                                                              Callbacks

                                                              - Source + Source + +
                                                              +

                                                              + take(t(), keys()) +

                                                              +
                                                              + + Source + +
                                                              +

                                                              + split(t(), keys()) +

                                                              +
                                                              + + Source

                                                              @@ -566,7 +791,7 @@

                                                              Callbacks

                                                              - Source + Source

                                                              @@ -574,7 +799,7 @@

                                                              Callbacks

                                                              - Source + Source

                                                              @@ -582,7 +807,23 @@

                                                              Callbacks

                                                              - Source + Source + +
                                                              +

                                                              + pop(t(), key(), value()) +

                                                              +
                                                              + + Source + +
                                                              +

                                                              + pop(t(), key()) +

                                                              +
                                                              + + Source

                                                              @@ -590,7 +831,7 @@

                                                              Callbacks

                                                              - Source + Source

                                                              @@ -598,7 +839,7 @@

                                                              Callbacks

                                                              - Source + Source

                                                              @@ -606,7 +847,7 @@

                                                              Callbacks

                                                              - Source + Source

                                                              @@ -614,7 +855,7 @@

                                                              Callbacks

                                                              - Source + Source

                                                              @@ -622,7 +863,7 @@

                                                              Callbacks

                                                              - Source + Source

                                                              @@ -630,7 +871,7 @@

                                                              Callbacks

                                                              - Source + Source

                                                              @@ -638,7 +879,15 @@

                                                              Callbacks

                                                              - Source + Source + +
                                                              +

                                                              + equal?(t(), t()) +

                                                              +
                                                              + + Source

                                                              @@ -646,7 +895,15 @@

                                                              Callbacks

                                                              - Source + Source + +
                                                              +

                                                              + drop(t(), keys()) +

                                                              +
                                                              + + Source

                                                              @@ -654,7 +911,7 @@

                                                              Callbacks

                                                              - Source + Source
                                                              diff --git a/docs/stable/Enum.EmptyError.html b/docs/stable/Enum.EmptyError.html new file mode 100644 index 000000000..44942b6ea --- /dev/null +++ b/docs/stable/Enum.EmptyError.html @@ -0,0 +1,62 @@ + + + + Enum.EmptyError + + + + + + + + + + + + +
                                                              +

                                                              + Enum.EmptyError + + exception + +

                                                              + + + + Source + + + + +

                                                              Fields (and defaults)

                                                              +
                                                                + +
                                                              • + + message: "empty error" + +
                                                              • + +
                                                              + + + + + + + + + + + + + +
                                                              + + diff --git a/docs/stable/Enum.Iterator.Function.html b/docs/stable/Enum.Iterator.Function.html index a45c90549..5fba98066 100644 --- a/docs/stable/Enum.Iterator.Function.html +++ b/docs/stable/Enum.Iterator.Function.html @@ -29,7 +29,7 @@

                                                              - Source + Source @@ -48,6 +48,11 @@

                                                              Functions summary

                                                              iterator/1
                                                            • +
                                                            • + + member?/2 + +
                                                            @@ -65,7 +70,7 @@

                                                            Functions

                                                            - Source + Source

                                                            @@ -73,7 +78,15 @@

                                                            Functions

                                                            - Source + Source + +
                                                            +

                                                            + member?(function, value) +

                                                            +
                                                            + + Source
                                                            diff --git a/docs/stable/Enum.Iterator.HashDict.html b/docs/stable/Enum.Iterator.HashDict.html index 4a5089a5e..af8b090f6 100644 --- a/docs/stable/Enum.Iterator.HashDict.html +++ b/docs/stable/Enum.Iterator.HashDict.html @@ -29,7 +29,7 @@

                                                            - Source + Source @@ -48,6 +48,11 @@

                                                            Functions summary

                                                            iterator/1
                                                          • +
                                                          • + + member?/2 + +
                                                          @@ -65,7 +70,7 @@

                                                          Functions

                                                          - Source + Source

                                                          @@ -73,7 +78,15 @@

                                                          Functions

                                                          - Source + Source + +
                                                          +

                                                          + member?(dict, arg2) +

                                                          +
                                                          + + Source
                                                          diff --git a/docs/stable/Enum.Iterator.List.html b/docs/stable/Enum.Iterator.List.html index 3a93fb259..3203c9205 100644 --- a/docs/stable/Enum.Iterator.List.html +++ b/docs/stable/Enum.Iterator.List.html @@ -29,7 +29,7 @@

                                                          - Source + Source @@ -48,6 +48,11 @@

                                                          Functions summary

                                                          iterator/1
                                                        • +
                                                        • + + member?/2 + +
                                                        @@ -65,7 +70,7 @@

                                                        Functions

                                                        - Source + Source

                                                        @@ -73,7 +78,15 @@

                                                        Functions

                                                        - Source + Source + +
                                                        +

                                                        + member?(list, value) +

                                                        +
                                                        + + Source
                                                        diff --git a/docs/stable/Enum.Iterator.Range.html b/docs/stable/Enum.Iterator.Range.html index 97b766cc0..1269e34da 100644 --- a/docs/stable/Enum.Iterator.Range.html +++ b/docs/stable/Enum.Iterator.Range.html @@ -48,6 +48,11 @@

                                                        Functions summary

                                                        iterator/1
                                                      • +
                                                      • + + member?/2 + +
                                                      @@ -65,7 +70,7 @@

                                                      Functions

                                                      - Source + Source

                                                      @@ -75,6 +80,14 @@

                                                      Functions

                                                      Source +
                                                      +

                                                      + member?(arg1, value) +

                                                      +
                                                      + + Source +
                                                      diff --git a/docs/stable/Enum.Iterator.html b/docs/stable/Enum.Iterator.html index a543dd0e2..77af0d9ab 100644 --- a/docs/stable/Enum.Iterator.html +++ b/docs/stable/Enum.Iterator.html @@ -37,7 +37,7 @@

                                                      For example, in the expression

                                                      -
                                                      Enum.map [1,2,3], &1 * 2
                                                      +
                                                      Enum.map([1,2,3], &1 * 2)
                                                       

                                                      Enum.map invokes Enum.Iterator.iterator([1,2,3]) to retrieve the iterator @@ -94,6 +94,11 @@

                                                      Functions summary

                                                      iterator/1

                                                    • +
                                                    • + + member?/2 + +
                                                    @@ -112,7 +117,7 @@

                                                    Functions

                                                    The function used to retrieve the collection's size.

                                                    - Source + Source

                                                    @@ -151,6 +156,15 @@

                                                    Iterating lists

                                                    Source +
                                                    +

                                                    + member?(collection, value) +

                                                    +

                                                    The function used to check if a value exists within the collection.

                                                    +
                                                    + + Source +
                                                    diff --git a/docs/stable/Enum.OutOfBoundsError.html b/docs/stable/Enum.OutOfBoundsError.html index 2e3de19ca..56a5dfa9b 100644 --- a/docs/stable/Enum.OutOfBoundsError.html +++ b/docs/stable/Enum.OutOfBoundsError.html @@ -29,7 +29,7 @@

                                                    - Source + Source diff --git a/docs/stable/Enum.html b/docs/stable/Enum.html index ef65abe4a..ccce93eff 100644 --- a/docs/stable/Enum.html +++ b/docs/stable/Enum.html @@ -32,7 +32,7 @@

                                                    flavours. If a given collection implements the mentioned protocol (like list, for instance), you can do:

                                                    -
                                                    Enum.map [1,2,3], fn(x) -> x * 2 end
                                                    +
                                                    Enum.map([1,2,3], fn(x) -> x * 2 end)
                                                     

                                                    Depending on the type of the collection, the user-provided function will @@ -42,7 +42,7 @@

                                                    - Source + Source @@ -63,7 +63,7 @@

                                                    Functions summary

                                                  • - at!/2 + at/3
                                                  • @@ -96,6 +96,16 @@

                                                    Functions summary

                                                    empty?/1
                                                  • +
                                                  • + + fetch/2 + +
                                                  • +
                                                  • + + fetch!/2 + +
                                                  • filter/2 @@ -146,6 +156,31 @@

                                                    Functions summary

                                                    map_reduce/3
                                                  • +
                                                  • + + max/1 + +
                                                  • +
                                                  • + + max/2 + +
                                                  • +
                                                  • + + member?/2 + +
                                                  • +
                                                  • + + min/1 + +
                                                  • +
                                                  • + + min/2 + +
                                                  • partition/2 @@ -193,7 +228,12 @@

                                                    Functions summary

                                                  • - uniq/1 + to_list/1 + +
                                                  • +
                                                  • + + uniq/2
                                                  • @@ -222,24 +262,24 @@

                                                    Functions

                                                    Examples

                                                    -
                                                    iex> Enum.all? [2,4,6], fn(x) -> rem(x, 2) == 0 end
                                                    +
                                                    iex> Enum.all?([2,4,6], fn(x) -> rem(x, 2) == 0 end)
                                                     true
                                                     
                                                    -iex> Enum.all? [2,3,4], fn(x) -> rem(x, 2) == 0 end
                                                    +iex> Enum.all?([2,3,4], fn(x) -> rem(x, 2) == 0 end)
                                                     false
                                                     

                                                    If no function is given, it defaults to checking if all items in the collection evaluate to true.

                                                    -
                                                    iex> Enum.all? [1,2,3]
                                                    +
                                                    iex> Enum.all?([1,2,3])
                                                     true
                                                    -iex> Enum.all? [1,nil,3]
                                                    +iex> Enum.all?([1,nil,3])
                                                     false
                                                     
                                                    - Source + Source

                                                    @@ -250,28 +290,28 @@

                                                    Examples

                                                    Examples

                                                    -
                                                    iex> Enum.any? [2,4,6], fn(x) -> rem(x, 2) == 1 end
                                                    +
                                                    iex> Enum.any?([2,4,6], fn(x) -> rem(x, 2) == 1 end)
                                                     false
                                                     
                                                    -iex> Enum.any? [2,3,4], fn(x) -> rem(x, 2) == 1 end
                                                    +iex> Enum.any?([2,3,4], fn(x) -> rem(x, 2) == 1 end)
                                                     true
                                                     

                                                    If no function is given, it defaults to checking if at least one item in the collection evaluates to true.

                                                    -
                                                    iex> Enum.any? [false,false,false]
                                                    +
                                                    iex> Enum.any?([false,false,false])
                                                     false
                                                    -iex> Enum.any? [false,true,false]
                                                    +iex> Enum.any?([false,true,false])
                                                     true
                                                     
                                                    - Source + Source
                                                    -

                                                    - at!(collection, n) +

                                                    + at(collection, n, default // nil)

                                                    Finds the element at the given index (zero-based). Raises out of bounds error in case the given position @@ -281,16 +321,18 @@

                                                    Examples

                                                    ## Examples

                                                    -
                                                      iex> Enum.at! [2,4,6], 0
                                                    +
                                                      iex> Enum.at([2,4,6], 0)
                                                       2
                                                    -  iex> Enum.at! [2,4,6], 2
                                                    +  iex> Enum.at([2,4,6], 2)
                                                       6
                                                    -  iex> Enum.at! [2,4,6], 4
                                                    -  ** (Enum.OutOfBoundsError) out of bounds error
                                                    +  iex> Enum.at([2,4,6], 4)
                                                    +  nil
                                                    +  iex> Enum.at([2,4,6], 4, :none)
                                                    +  :none
                                                     
                                                    - Source + Source

                                                    @@ -300,12 +342,12 @@

                                                    Examples

                                                    Examples

                                                    -
                                                    iex> Enum.count [1,2,3]
                                                    +
                                                    iex> Enum.count([1,2,3])
                                                     3
                                                     
                                                    - Source + Source

                                                    @@ -314,7 +356,7 @@

                                                    Examples

                                                    Counts for how many items the function returns true.

                                                    - Source + Source

                                                    @@ -325,16 +367,16 @@

                                                    Examples

                                                    Examples

                                                    -
                                                    iex> Enum.drop [1,2,3], 2
                                                    +
                                                    iex> Enum.drop([1,2,3], 2)
                                                     [3]
                                                    -iex> Enum.drop [1,2,3], 10
                                                    +iex> Enum.drop([1,2,3], 10)
                                                     []
                                                    -iex> Enum.drop [1,2,3], 0
                                                    +iex> Enum.drop([1,2,3], 0)
                                                     [1,2,3]
                                                     
                                                    - Source + Source

                                                    @@ -345,12 +387,12 @@

                                                    Examples

                                                    Examples

                                                    -
                                                    iex> Enum.drop_while [1,2,3,4,5], fn(x) -> x < 3 end
                                                    +
                                                    iex> Enum.drop_while([1,2,3,4,5], fn(x) -> x < 3 end)
                                                     [3,4,5]
                                                     
                                                    - Source + Source

                                                    @@ -362,11 +404,11 @@

                                                    Examples

                                                    Examples

                                                    -
                                                    Enum.each ['some', 'example'], fn(x) -> IO.puts x end
                                                    +
                                                    Enum.each(['some', 'example'], fn(x) -> IO.puts x end)
                                                     
                                                    - Source + Source

                                                    @@ -376,14 +418,57 @@

                                                    Examples

                                                    Examples

                                                    -
                                                    iex> Enum.empty? []
                                                    +
                                                    iex> Enum.empty?([])
                                                     true
                                                    -iex> Enum.empty? [1,2,3]
                                                    +iex> Enum.empty?([1,2,3])
                                                     false
                                                     
                                                    - Source + Source + +
                                                    +

                                                    + fetch(collection, n) +

                                                    +

                                                    Finds the element at the given index (zero-based). +Returns { :ok, element } if found, otherwise :error.

                                                    + +

                                                    Expects an ordered collection.

                                                    + +

                                                    ## Examples

                                                    + +
                                                      iex> Enum.fetch([2,4,6], 0)
                                                    +  { :ok, 2 }
                                                    +  iex> Enum.fetch([2,4,6], 2)
                                                    +  { :ok, 6 }
                                                    +  iex> Enum.fetch([2,4,6], 4)
                                                    +  :error
                                                    +
                                                    +
                                                    + + Source + +
                                                    +

                                                    + fetch!(collection, n) +

                                                    +

                                                    Finds the element at the given index (zero-based). +Raises out of bounds error in case the given position +is outside the range of the collection.

                                                    + +

                                                    Examples

                                                    + +
                                                    iex> Enum.fetch!([2,4,6], 0)
                                                    +2
                                                    +iex> Enum.fetch!([2,4,6], 2)
                                                    +6
                                                    +iex> Enum.fetch!([2,4,6], 4)
                                                    +** (Enum.OutOfBoundsError) out of bounds error
                                                    +
                                                    +
                                                    + + Source

                                                    @@ -394,12 +479,12 @@

                                                    Examples

                                                    Examples

                                                    -
                                                    iex> Enum.filter [1, 2, 3], fn(x) -> rem(x, 2) == 0 end
                                                    +
                                                    iex> Enum.filter([1, 2, 3], fn(x) -> rem(x, 2) == 0 end)
                                                     [2]
                                                     
                                                    - Source + Source

                                                    @@ -409,12 +494,12 @@

                                                    Examples

                                                    Examples

                                                    -
                                                    iex> Enum.filter_map [1, 2, 3], fn(x) -> rem(x, 2) == 0 end, &1 * 2
                                                    +
                                                    iex> Enum.filter_map([1, 2, 3], fn(x) -> rem(x, 2) == 0 end, &1 * 2)
                                                     [4]
                                                     
                                                    - Source + Source

                                                    @@ -425,18 +510,18 @@

                                                    Examples

                                                    Examples

                                                    -
                                                    iex> Enum.find [2,4,6], fn(x) -> rem(x, 2) == 1 end
                                                    +
                                                    iex> Enum.find([2,4,6], fn(x) -> rem(x, 2) == 1 end)
                                                     nil
                                                     
                                                    -iex> Enum.find [2,4,6], 0, fn(x) -> rem(x, 2) == 1 end
                                                    +iex> Enum.find([2,4,6], 0, fn(x) -> rem(x, 2) == 1 end)
                                                     0
                                                     
                                                    -iex> Enum.find [2,3,4], fn(x) -> rem(x, 2) == 1 end
                                                    +iex> Enum.find([2,3,4], fn(x) -> rem(x, 2) == 1 end)
                                                     3
                                                     
                                                    - Source + Source

                                                    @@ -449,15 +534,15 @@

                                                    Examples

                                                    Examples

                                                    -
                                                    iex> Enum.find_index [2,4,6], fn(x) -> rem(x, 2) == 1 end
                                                    +
                                                    iex> Enum.find_index([2,4,6], fn(x) -> rem(x, 2) == 1 end)
                                                     nil
                                                     
                                                    -iex> Enum.find_index [2,3,4], fn(x) -> rem(x, 2) == 1 end
                                                    +iex> Enum.find_index([2,3,4], fn(x) -> rem(x, 2) == 1 end)
                                                     1
                                                     
                                                    - Source + Source

                                                    @@ -468,15 +553,15 @@

                                                    Examples

                                                    Examples

                                                    -
                                                    iex> Enum.find_value [2,4,6], fn(x) -> rem(x, 2) == 1 end
                                                    +
                                                    iex> Enum.find_value([2,4,6], fn(x) -> rem(x, 2) == 1 end)
                                                     nil
                                                     
                                                    -iex> Enum.find_value [2,3,4], fn(x) -> rem(x, 2) == 1 end
                                                    +iex> Enum.find_value([2,3,4], fn(x) -> rem(x, 2) == 1 end)
                                                     true
                                                     
                                                    - Source + Source

                                                    @@ -486,14 +571,14 @@

                                                    Examples

                                                    Examples

                                                    -
                                                    iex> Enum.first []
                                                    +
                                                    iex> Enum.first([])
                                                     nil
                                                    -iex> Enum.first [1,2,3]
                                                    +iex> Enum.first([1,2,3])
                                                     1
                                                     
                                                    - Source + Source

                                                    @@ -519,7 +604,7 @@

                                                    Examples

                                                    - Source + Source

                                                    @@ -534,15 +619,15 @@

                                                    Examples

                                                    Examples

                                                    -
                                                    iex> Enum.map [1, 2, 3], fn(x) -> x * 2 end
                                                    +
                                                    iex> Enum.map([1, 2, 3], fn(x) -> x * 2 end)
                                                     [2, 4, 6]
                                                     
                                                    -iex> Enum.map [a: 1, b: 2], fn({k, v}) -> { k, -v } end
                                                    +iex> Enum.map([a: 1, b: 2], fn({k, v}) -> { k, -v } end)
                                                     [a: -1, b: -2]
                                                     
                                                    - Source + Source

                                                    @@ -568,7 +653,7 @@

                                                    Examples

                                                    - Source + Source

                                                    @@ -584,12 +669,93 @@

                                                    Examples

                                                    Examples

                                                    -
                                                    iex> Enum.map_reduce [1, 2, 3], 0, fn(x, acc) -> { x * 2, x + acc } end
                                                    +
                                                    iex> Enum.map_reduce([1, 2, 3], 0, fn(x, acc) -> { x * 2, x + acc } end)
                                                     { [2, 4, 6], 6 }
                                                     
                                                    - Source + Source + +
                                                    +

                                                    + max(collection) +

                                                    +

                                                    Returns the maximum value. +Raises empty error in case the collection is empty.

                                                    + +

                                                    Examples

                                                    + +
                                                    iex> Enum.max([1,2,3])
                                                    +3
                                                    +
                                                    +
                                                    + + Source + +
                                                    +

                                                    + max(collection, fun) +

                                                    +

                                                    Returns the maximum value. +Raises empty error in case the collection is empty.

                                                    + +

                                                    Examples

                                                    + +
                                                    iex> Enum.max(["a", "aa", "aaa"], fn(x) -> String.length(x) end)
                                                    +"aaa"
                                                    +
                                                    +
                                                    + + Source + +
                                                    +

                                                    + member?(collection, value) +

                                                    +

                                                    Checks if the value exists within the collection.

                                                    + +

                                                    Examples

                                                    + +
                                                    iex> Enum.member?(1..10, 5)
                                                    +true
                                                    +iex> Enum.member?([:a, :b, :c], :d)
                                                    +false
                                                    +
                                                    +
                                                    + + Source + +
                                                    +

                                                    + min(collection) +

                                                    +

                                                    Returns the manimum value. +Raises empty error in case the collection is empty.

                                                    + +

                                                    Examples

                                                    + +
                                                    iex> Enum.min([1,2,3])
                                                    +1
                                                    +
                                                    +
                                                    + + Source + +
                                                    +

                                                    + min(collection, fun) +

                                                    +

                                                    Returns the manimum value. +Raises empty error in case the collection is empty.

                                                    + +

                                                    Examples

                                                    + +
                                                    iex> Enum.min(["a", "aa", "aaa"], fn(x) -> String.length(x) end)
                                                    +"a"
                                                    +
                                                    +
                                                    + + Source

                                                    @@ -601,12 +767,12 @@

                                                    Examples

                                                    Examples

                                                    -
                                                    iex> Enum.partition [1, 2, 3], fn(x) -> rem(x, 2) == 0 end
                                                    +
                                                    iex> Enum.partition([1, 2, 3], fn(x) -> rem(x, 2) == 0 end)
                                                     { [2], [1,3] }
                                                     
                                                    - Source + Source

                                                    @@ -618,12 +784,12 @@

                                                    Examples

                                                    Examples

                                                    -
                                                    iex> Enum.reduce [1, 2, 3], 0, fn(x, acc) -> x + acc end
                                                    +
                                                    iex> Enum.reduce([1, 2, 3], 0, fn(x, acc) -> x + acc end)
                                                     6
                                                     
                                                    - Source + Source

                                                    @@ -633,42 +799,42 @@

                                                    Examples

                                                    Examples

                                                    -
                                                    iex> Enum.reverse [1, 2, 3]
                                                    +
                                                    iex> Enum.reverse([1, 2, 3])
                                                     [3, 2, 1]
                                                     
                                                    - Source + Source

                                                    sort(collection)

                                                    -

                                                    Sorts the collection using the merge sort algorithm.

                                                    +

                                                    Returns a sorted list of collection elements. Uses the merge sort algorithm.

                                                    Examples

                                                    -
                                                    iex> Enum.sort [3,2,1]
                                                    +
                                                    iex> Enum.sort([3,2,1])
                                                     [1,2,3]
                                                     
                                                    - Source + Source

                                                    sort(collection, fun)

                                                    -

                                                    Sorts the collection using the merge sort algorithm.

                                                    +

                                                    Returns a sorted list of collection elements. Uses the merge sort algorithm.

                                                    Examples

                                                    -
                                                    iex> Enum.sort [1,2,3], &1 > &2
                                                    +
                                                    iex> Enum.sort([1,2,3], &1 > &2)
                                                     [3,2,1]
                                                     
                                                    - Source + Source

                                                    @@ -685,20 +851,20 @@

                                                    Examples

                                                    Examples

                                                    -
                                                    iex> Enum.split [1,2,3], 2
                                                    +
                                                    iex> Enum.split([1,2,3], 2)
                                                     { [1,2], [3] }
                                                    -iex> Enum.split [1,2,3], 10
                                                    +iex> Enum.split([1,2,3], 10)
                                                     { [1,2,3], [] }
                                                    -iex> Enum.split [1,2,3], 0
                                                    +iex> Enum.split([1,2,3], 0)
                                                     { [], [1,2,3] }
                                                    -iex> Enum.split [1,2,3], -1
                                                    +iex> Enum.split([1,2,3], -1)
                                                     { [1,2], [3] }
                                                    -iex> Enum.split [1,2,3], -5
                                                    +iex> Enum.split([1,2,3], -5)
                                                     { [], [1,2,3] }
                                                     
                                                    - Source + Source

                                                    @@ -708,12 +874,12 @@

                                                    Examples

                                                    Examples

                                                    -
                                                    iex> Enum.split_while [1,2,3,4], fn(x) -> x < 3 end
                                                    +
                                                    iex> Enum.split_while([1,2,3,4], fn(x) -> x < 3 end)
                                                     { [1, 2], [3, 4] }
                                                     
                                                    - Source + Source

                                                    @@ -724,16 +890,16 @@

                                                    Examples

                                                    Examples

                                                    -
                                                    iex> Enum.take [1,2,3], 2
                                                    +
                                                    iex> Enum.take([1,2,3], 2)
                                                     [1,2]
                                                    -iex> Enum.take [1,2,3], 10
                                                    +iex> Enum.take([1,2,3], 10)
                                                     [1,2,3]
                                                    -iex> Enum.take [1,2,3], 0
                                                    +iex> Enum.take([1,2,3], 0)
                                                     []
                                                     
                                                    - Source + Source

                                                    @@ -744,27 +910,45 @@

                                                    Examples

                                                    Examples

                                                    -
                                                    iex> Enum.take_while [1,2,3], fn(x) -> x < 3 end
                                                    +
                                                    iex> Enum.take_while([1,2,3], fn(x) -> x < 3 end)
                                                     [1, 2]
                                                     
                                                    - Source + Source + +
                                                    +

                                                    + to_list(collection) +

                                                    +

                                                    Convert collection to a list.

                                                    + +

                                                    Examples

                                                    + +
                                                    iex> Enum.to_list(1 .. 3)
                                                    +[1, 2, 3]
                                                    +
                                                    +
                                                    + + Source
                                                    -

                                                    - uniq(collection) +

                                                    + uniq(collection, fun // fn x -> x end)

                                                    Iterates the enumerable removing all duplicated items.

                                                    Examples

                                                    -
                                                    iex> Enum.uniq [1,2,3,2,1]
                                                    +
                                                    iex> Enum.uniq([1,2,3,2,1])
                                                     [1, 2, 3]
                                                    +
                                                    +iex> Enum.uniq([{1,:x}, {2,:y}, {1,:z}], fn {x,_} -> x end)
                                                    +[{1,:x}, {2,:y}]
                                                     
                                                    - Source + Source

                                                    @@ -776,7 +960,7 @@

                                                    Examples

                                                    values are filled with nil.

                                                    - Source + Source diff --git a/docs/stable/ErlangError.html b/docs/stable/ErlangError.html index 5ac451a9d..db73413ca 100644 --- a/docs/stable/ErlangError.html +++ b/docs/stable/ErlangError.html @@ -29,7 +29,7 @@

                                                    - Source + Source @@ -71,7 +71,7 @@

                                                    Functions

                                                    - Source + Source diff --git a/docs/stable/ExUnit.Assertions.html b/docs/stable/ExUnit.Assertions.html index d29879a3c..25700b23d 100644 --- a/docs/stable/ExUnit.Assertions.html +++ b/docs/stable/ExUnit.Assertions.html @@ -46,7 +46,7 @@

                                                    - Source + Source @@ -169,7 +169,7 @@

                                                    Examples

                                                    - Source + Source

                                                    @@ -185,7 +185,7 @@

                                                    Examples

                                                    - Source + Source

                                                    @@ -200,7 +200,7 @@

                                                    Examples

                                                    - Source + Source

                                                    @@ -217,7 +217,7 @@

                                                    Examples

                                                    - Source + Source

                                                    @@ -234,7 +234,7 @@

                                                    Examples

                                                    - Source + Source

                                                    @@ -248,7 +248,7 @@

                                                    Examples

                                                    - Source + Source

                                                    @@ -263,7 +263,7 @@

                                                    Examples

                                                    - Source + Source

                                                    @@ -278,7 +278,7 @@

                                                    Examples

                                                    - Source + Source @@ -306,7 +306,7 @@

                                                    Examples

                                                    - Source + Source

                                                    @@ -333,7 +333,7 @@

                                                    Examples

                                                    - Source + Source

                                                    @@ -357,7 +357,7 @@

                                                    Examples

                                                    - Source + Source

                                                    @@ -372,7 +372,7 @@

                                                    Examples

                                                    - Source + Source

                                                    @@ -387,7 +387,7 @@

                                                    Examples

                                                    - Source + Source

                                                    @@ -402,7 +402,7 @@

                                                    Examples

                                                    - Source + Source

                                                    @@ -419,7 +419,7 @@

                                                    Examples

                                                    - Source + Source

                                                    @@ -441,7 +441,7 @@

                                                    Examples

                                                    - Source + Source

                                                    @@ -459,7 +459,7 @@

                                                    Examples

                                                    - Source + Source diff --git a/docs/stable/ExUnit.CLIFormatter.html b/docs/stable/ExUnit.CLIFormatter.html index 73bfc9d70..8c8705987 100644 --- a/docs/stable/ExUnit.CLIFormatter.html +++ b/docs/stable/ExUnit.CLIFormatter.html @@ -79,7 +79,7 @@

                                                    Functions summary

                                                  • - suite_finished/2 + suite_finished/3
                                                  • @@ -115,7 +115,7 @@

                                                    Functions summary

                                                    Functions

                                                    - case_finished(_id, _test_case) + case_finished(id, test_case)

                                                    @@ -170,8 +170,8 @@

                                                    Functions

                                                    Source
                                                    -

                                                    - suite_finished(id, ms) +

                                                    + suite_finished(id, run_us, load_us)

                                                    diff --git a/docs/stable/ExUnit.Callbacks.html b/docs/stable/ExUnit.Callbacks.html index 42ef085ee..2005171f1 100644 --- a/docs/stable/ExUnit.Callbacks.html +++ b/docs/stable/ExUnit.Callbacks.html @@ -113,9 +113,10 @@

                                                    Macros

                                                    _ end, block)

                                                    -
                                                    +

                                                    Called before the start of each test.

                                                    +
                                                    - Source + Source

                                                    @@ -123,9 +124,10 @@

                                                    Macros

                                                    _ end, block)

                                                    -
                                                    +

                                                    Called before the start of a case.

                                                    +
                                                    - Source + Source

                                                    @@ -133,9 +135,11 @@

                                                    Macros

                                                    _ end, block)

                                                    -
                                                    +

                                                    Called after the finish of each test. Note that, if the test crasches with an exit +message teardown will not be run.

                                                    +
                                                    - Source + Source

                                                    @@ -143,9 +147,10 @@

                                                    Macros

                                                    _ end, block)

                                                    -
                                                    +

                                                    Called after the finish of each case.

                                                    +
                                                    - Source + Source
                                                    diff --git a/docs/stable/ExUnit.CaptureIO.html b/docs/stable/ExUnit.CaptureIO.html new file mode 100644 index 000000000..81940c26e --- /dev/null +++ b/docs/stable/ExUnit.CaptureIO.html @@ -0,0 +1,112 @@ + + + + ExUnit.CaptureIO + + + + + + + + + + + + +
                                                    +

                                                    + ExUnit.CaptureIO + +

                                                    + + +
                                                    +

                                                    This module provides functionality to capture IO to test it. +The way to use this module is to import them into your module.

                                                    + +

                                                    Examples

                                                    + +
                                                    defmodule AssertionTest do
                                                    +  use ExUnit.Case
                                                    +
                                                    +  import ExUnit.CaptureIO
                                                    +
                                                    +  test :example do
                                                    +    assert capture_io(fn ->
                                                    +      IO.puts "a"
                                                    +    end) == "a\n"
                                                    +  end
                                                    +end
                                                    +
                                                    + +
                                                    + + + Source + + + + + + +

                                                    Functions summary

                                                    + + + + + + + + +
                                                    +

                                                    Functions

                                                    +
                                                    +

                                                    + capture_io(device // :stdio, fun) +

                                                    +

                                                    Captures IO. Returns nil in case of no output, +otherwise returns the binary which is captured outputs.

                                                    + +

                                                    By default, captureio replaces the groupleader (:stdio) +for the current process. However, the capturing of any other +named device like :stderr is also possible globally by +giving the registered device name explicitly as argument.

                                                    + +

                                                    The input is mocked to return :eof.

                                                    + +

                                                    Examples

                                                    + +
                                                    iex> capture_io(fn -> IO.write "josé" end) == "josé"
                                                    +true
                                                    +iex> capture_io(fn -> :ok end) == nil
                                                    +true
                                                    +iex> capture_io(:stderr, fn -> IO.write(:stderr, "josé") end) == "josé"
                                                    +true
                                                    +
                                                    +
                                                    + + Source + +
                                                    +
                                                    + + + + + +
                                                    + + diff --git a/docs/stable/ExUnit.ExpectationError.html b/docs/stable/ExUnit.ExpectationError.html index 5a0996039..19c5d3c05 100644 --- a/docs/stable/ExUnit.ExpectationError.html +++ b/docs/stable/ExUnit.ExpectationError.html @@ -106,7 +106,7 @@

                                                    Functions

                                                    - Source + Source

                                                    @@ -114,7 +114,7 @@

                                                    Functions

                                                    - Source + Source
                                                    diff --git a/docs/stable/ExUnit.Formatter.html b/docs/stable/ExUnit.Formatter.html index 41fabf247..074c8119d 100644 --- a/docs/stable/ExUnit.Formatter.html +++ b/docs/stable/ExUnit.Formatter.html @@ -70,7 +70,7 @@

                                                    Callbacks summary

                                                  • - suite_finished/2 + suite_finished/3
                                                  • @@ -91,19 +91,19 @@

                                                    Callbacks summary

                                                    Callbacks

                                                    - test_finished(id(), test :: ExUnit.Test.t()) + test_finished(id(), test())

                                                    - Source + Source

                                                    - test_started(id(), test :: ExUnit.Test.t()) + test_started(id(), test())

                                                    - Source + Source

                                                    @@ -111,7 +111,7 @@

                                                    Callbacks

                                                    - Source + Source

                                                    @@ -119,15 +119,15 @@

                                                    Callbacks

                                                    - Source + Source
                                                    -

                                                    - suite_finished(id(), miliseconds :: pos_integer()) +

                                                    + suite_finished(id(), run_us(), load_us())

                                                    - Source + Source

                                                    @@ -135,7 +135,7 @@

                                                    Callbacks

                                                    - Source + Source
                                                    diff --git a/docs/stable/ExUnit.Test.html b/docs/stable/ExUnit.Test.html index 534bebb47..513e7cf0f 100644 --- a/docs/stable/ExUnit.Test.html +++ b/docs/stable/ExUnit.Test.html @@ -62,6 +62,12 @@

                                                    Fields (and defaults)

                                                  • +
                                                  • + + invalid: nil + +
                                                  • +
                                                  diff --git a/docs/stable/ExUnit.TestCase.html b/docs/stable/ExUnit.TestCase.html new file mode 100644 index 000000000..eb6c9923f --- /dev/null +++ b/docs/stable/ExUnit.TestCase.html @@ -0,0 +1,75 @@ + + + + ExUnit.TestCase + + + + + + + + + + + + +
                                                  +

                                                  + ExUnit.TestCase + + record + +

                                                  + + +
                                                  +

                                                  A record that keeps information about the test case. +It is received by formatters and also accessible +in the metadata under the key :case.

                                                  + +
                                                  + + + Source + + + + +

                                                  Fields (and defaults)

                                                  +
                                                    + +
                                                  • + + name: nil + +
                                                  • + +
                                                  • + + failure: nil + +
                                                  • + +
                                                  + + + + + + + + + + + + + +
                                                  + + diff --git a/docs/stable/ExUnit.html b/docs/stable/ExUnit.html index c294b6abb..0a6116ea7 100644 --- a/docs/stable/ExUnit.html +++ b/docs/stable/ExUnit.html @@ -133,7 +133,7 @@

                                                  Options

                                                - Source + Source

                                                @@ -145,7 +145,7 @@

                                                Options

                                                Returns the number of failures.

                                                - Source + Source

                                                @@ -159,7 +159,7 @@

                                                Options

                                                function and rely on configure/1 and run/0 instead.

                                                - Source + Source

                                                diff --git a/docs/stable/Exception.html b/docs/stable/Exception.html index b51468ef4..d5190bb8e 100644 --- a/docs/stable/Exception.html +++ b/docs/stable/Exception.html @@ -33,7 +33,7 @@

                                                - Source + Source @@ -44,17 +44,17 @@

                                                Functions summary

                                                • - format_entry/2 + format_file_line/3
                                                • - format_file_line/3 + format_stacktrace/1
                                                • - format_stacktrace/1 + format_stacktrace_entry/2
                                                • @@ -79,23 +79,12 @@

                                                  Functions summary

                                                  Functions

                                                  -

                                                  - format_entry(entry, cwd // nil) -

                                                  -

                                                  Receives a tuple representing a stacktrace entry and formats it. -The current working directory may be given as argument, which -is used to prettify the stacktrace.

                                                  -
                                                  - - Source - -

                                                  format_file_line(file, line, cwd)

                                                  - Source + Source

                                                  @@ -108,7 +97,18 @@

                                                  Functions

                                                  the value of System.stacktrace is changed.

                                                  - Source + Source + +
                                                  +

                                                  + format_stacktrace_entry(entry, cwd // nil) +

                                                  +

                                                  Receives a tuple representing a stacktrace entry and formats it. +The current working directory may be given as argument, which +is used to prettify the stacktrace.

                                                  +
                                                  + + Source

                                                  @@ -119,7 +119,7 @@

                                                  Functions

                                                  code with Elixir code.

                                                  - Source + Source

                                                  Functions

                                                  the value of System.stacktrace is changed.

                                                  - Source + Source diff --git a/docs/stable/FunctionClauseError.html b/docs/stable/FunctionClauseError.html index 7151988e6..fb9235a50 100644 --- a/docs/stable/FunctionClauseError.html +++ b/docs/stable/FunctionClauseError.html @@ -29,7 +29,7 @@

                                                  - Source + Source @@ -83,7 +83,7 @@

                                                  Functions

                                                  - Source + Source diff --git a/docs/stable/HashDict.html b/docs/stable/HashDict.html index 098522ace..57cb51f4d 100644 --- a/docs/stable/HashDict.html +++ b/docs/stable/HashDict.html @@ -51,6 +51,11 @@

                                                  Functions summary

                                                  delete/2
                                                • +
                                                • + + drop/2 + +
                                                • empty/1 @@ -58,12 +63,22 @@

                                                  Functions summary

                                                • - get/3 + equal?/2
                                                • - get!/2 + fetch/2 + +
                                                • +
                                                • + + fetch!/2 + +
                                                • +
                                                • + + get/3
                                                • @@ -96,6 +111,11 @@

                                                  Functions summary

                                                  new/2
                                                • +
                                                • + + pop/3 + +
                                                • put/3 @@ -111,6 +131,16 @@

                                                  Functions summary

                                                  size/1
                                                • +
                                                • + + split/2 + +
                                                • +
                                                • + + take/2 + +
                                                • to_list/1 @@ -149,7 +179,17 @@

                                                  Functions

                                                  Deletes a value from the dict.

                                                  - Source + Source + +
                                                  +

                                                  + drop(dict, list2) +

                                                  +

                                                  Returns a new dict with only the entries +which key is not in keys

                                                  +
                                                  + + Source

                                                  @@ -158,26 +198,42 @@

                                                  Functions

                                                  Returns an empty dict.

                                                  - Source + Source
                                                  -

                                                  - get(dict, key, default // nil) +

                                                  + equal?(a, b)

                                                  -

                                                  Gets the value under key from the dict.

                                                  +
                                                  + + Source + +
                                                  +

                                                  + fetch(dict, key) +

                                                  +

                                                  Fetches the value under key from the dict +and return it in a tagged tuple.

                                                  - Source + Source
                                                  -

                                                  - get!(dict, key) +

                                                  + fetch!(dict, key)

                                                  -

                                                  Gets the value under key from the dict, -raises KeyError if such key does not exist.

                                                  +
                                                  + + Source + +
                                                  +

                                                  + get(dict, key, default // nil) +

                                                  +

                                                  Gets the value under key from the dict.

                                                  - Source + Source

                                                  @@ -186,7 +242,7 @@

                                                  Functions

                                                  Checks if the dict has the given key.

                                                  - Source + Source

                                                  @@ -195,7 +251,7 @@

                                                  Functions

                                                  Get all keys in the dict.

                                                  - Source + Source

                                                  @@ -204,7 +260,7 @@

                                                  Functions

                                                  Merges two dictionaries.

                                                  - Source + Source

                                                  @@ -213,7 +269,7 @@

                                                  Functions

                                                  Creates a new empty dict.

                                                  - Source + Source

                                                  @@ -228,7 +284,7 @@

                                                  Examples

                                                  - Source + Source

                                                  @@ -244,7 +300,16 @@

                                                  Examples

                                                  - Source + Source + +
                                                  +

                                                  + pop(dict, key, default // nil) +

                                                  +

                                                  Returns the value under key from the dict as well as the dict without key.

                                                  +
                                                  + + Source

                                                  @@ -253,7 +318,7 @@

                                                  Examples

                                                  Puts the given key and value in the dict.

                                                  - Source + Source

                                                  @@ -263,7 +328,7 @@

                                                  Examples

                                                  only if one does not exist yet.

                                                  - Source + Source

                                                  @@ -272,7 +337,29 @@

                                                  Examples

                                                  Returns the dict size.

                                                  - Source + Source + +
                                                  +

                                                  + split(dict, keys) +

                                                  +

                                                  Splits a dict into two dicts, +one containing entries with key in the keys list, +and another containing entries with key not in keys. +Returns a 2-tuple of the new dicts.

                                                  +
                                                  + + Source + +
                                                  +

                                                  + take(dict, keys) +

                                                  +

                                                  Returns a new dict with only the entries +which key is in keys.

                                                  +
                                                  + + Source

                                                  @@ -281,7 +368,7 @@

                                                  Examples

                                                  Converts the dict to a list.

                                                  - Source + Source

                                                  @@ -292,7 +379,7 @@

                                                  Examples

                                                  not exist in the dictionary.

                                                  - Source + Source

                                                  @@ -303,7 +390,7 @@

                                                  Examples

                                                  the key does not exist in the dicionary.

                                                  - Source + Source

                                                  @@ -312,7 +399,7 @@

                                                  Examples

                                                  Get all values in the dict.

                                                  - Source + Source
                                                  diff --git a/docs/stable/IEx.Helpers.html b/docs/stable/IEx.Helpers.html index d9432d54c..9e81cb8fd 100644 --- a/docs/stable/IEx.Helpers.html +++ b/docs/stable/IEx.Helpers.html @@ -33,13 +33,15 @@

                                                  more joyful to work with.

                                                  This message was triggered by invoking the helper -h(), usually referred as h/0 (since it expects 0 +h(), usually referred to as h/0 (since it expects 0 arguments).

                                                  There are many other helpers available:

                                                  • c/2 - compiles a file in the given path
                                                  • +
                                                  • ls/0 - list the contents of the current directory
                                                  • +
                                                  • ls/1 - list the contents of the specified directory
                                                  • cd/1 - changes the current directory
                                                  • flush/0 — flush all messages sent to the shell
                                                  • h/0, h/1 - prints help/documentation
                                                  • @@ -66,6 +68,8 @@

                                                    h(Enum.reverse/1) +

                                                    To learn more about IEx as a whole, just type h(IEx).

                                                    + @@ -103,6 +107,11 @@

                                                    Functions summary

                                                    l/1 +
                                                  • + + ls/1 + +
                                                  • m/0 @@ -172,59 +181,75 @@

                                                    Functions

                                                    to write their object code to. It returns the name of the compiled modules.

                                                    +

                                                    When compiling one file, there is no need to wrap it in a list.

                                                    +

                                                    Examples

                                                    -
                                                    c ["foo.ex"], "ebin"
                                                    -#=> [Foo]
                                                    +
                                                    c ["foo.ex", "bar.ex"], "ebin"
                                                    +#=> [Foo,Bar]
                                                    +
                                                    +c "baz.ex"
                                                    +#=> [Baz]
                                                     
                                                    - Source + Source

                                                    cd(directory)

                                                    -

                                                    Changes the shell directory to the given path.

                                                    +

                                                    Changes the current working directory to the given path.

                                                    - Source + Source

                                                    flush()

                                                    -

                                                    Flushes all messages sent to the shell and prints them out

                                                    +

                                                    Flushes all messages sent to the shell and prints them out.

                                                    - Source + Source

                                                    h()

                                                    -

                                                    Shows the documentation for IEx.Helpers.

                                                    +

                                                    Prints the documentation for IEx.Helpers.

                                                    - Source + Source

                                                    l(module)

                                                    -

                                                    Purges and reloads specified module

                                                    +

                                                    Purges and reloads specified module.

                                                    +
                                                    + + Source + +
                                                    +

                                                    + ls(path // ".") +

                                                    +

                                                    Produces a simple list of a directory's contents. +If path points to a file, prints its full path.

                                                    - Source + Source

                                                    m()

                                                    -

                                                    Returns the name and module of all modules loaded.

                                                    +

                                                    Prints the list of all loaded modules with paths to their corresponding .beam +files.

                                                    - Source + Source

                                                    @@ -233,17 +258,17 @@

                                                    Examples

                                                    Prints the current working directory.

                                                    - Source + Source

                                                    r()

                                                    -

                                                    Reloads all modules that were already reloaded -at some point with r/1.

                                                    +

                                                    Reloads all modules that have already been reloaded with r/1 at any point +in the current IEx session.

                                                    - Source + Source

                                                    @@ -251,31 +276,33 @@

                                                    Examples

                                                    Recompiles and reloads the specified module's source file.

                                                    -

                                                    Please note that all the modules defined in the specified -files are recompiled and reloaded.

                                                    +

                                                    Please note that all the modules defined in the same file as module +are recompiled and reloaded.

                                                    - Source + Source

                                                    v()

                                                    -

                                                    Prints commands history and their result.

                                                    +

                                                    Prints the history of expressions evaluated during the session along with +their results.

                                                    - Source + Source

                                                    v(n)

                                                    -

                                                    Retrieves nth query's value from the history. Use negative -values to lookup query's value from latest to earliest. -For instance, v(-1) returns the latest result.

                                                    +

                                                    Retrieves nth expression's value from the history.

                                                    + +

                                                    Use negative values to lookup expression values relative to the current one. +For instance, v(-1) returns the result of the last evaluated expression.

                                                    - Source + Source
                                                    @@ -288,7 +315,7 @@

                                                    Macros

                                                    h(other)

                                                    -

                                                    Shows the documentation for the given module +

                                                    Prints the documentation for the given module or for the given function/arity pair.

                                                    Examples

                                                    @@ -306,13 +333,17 @@

                                                    Examples

                                                    - Source + Source

                                                    s(module)

                                                    -

                                                    Prints all specs from a given module.

                                                    +

                                                    Similar to t/1, only for specs.

                                                    + +

                                                    When given a module, prints the list of all specs defined in the module.

                                                    + +

                                                    When given a particular spec name (with optional arity), prints its spec.

                                                    Examples

                                                    @@ -324,14 +355,16 @@

                                                    Examples

                                                    - Source + Source

                                                    t(module)

                                                    -

                                                    Prints all types for the given module or prints out a specified type's -specification

                                                    +

                                                    When given a module, prints specifications (or simply specs) for all the +types defined in it.

                                                    + +

                                                    When given a particular type name, prints its spec.

                                                    Examples

                                                    @@ -341,7 +374,7 @@

                                                    Examples

                                                    - Source + Source
                                                    diff --git a/docs/stable/IEx.html b/docs/stable/IEx.html index e912bcfe5..567007ec8 100644 --- a/docs/stable/IEx.html +++ b/docs/stable/IEx.html @@ -27,18 +27,97 @@

                                                    -

                                                    This module implements Interactive Elixir.

                                                    +

                                                    Welcome to IEx.

                                                    -

                                                    The interactive elixir needs to be set as the -proper -user when starting the Erlang VM and -so can be done with the help of IEx.CLI.

                                                    +

                                                    This module is the main entry point Interactive Elixir and +in this documentation we will talk a bit about how IEx works.

                                                    -

                                                    If possible, Elixir will start a tty (smart terminal) -which makes all control commands available in tty -available to the developer.

                                                    +

                                                    Notice some of the functionality described here will be available +depending on your terminal. In particular, if you get a message +saying that the smart terminal could not be run, some of the +features described here won't work.

                                                    -

                                                    In case tty is not available (for example, Windows), -a dumb terminal version is started instead.

                                                    +

                                                    The Break command

                                                    + +

                                                    Inside IEx, hitting Ctrl+C will open up the BREAK menu. In this +menu you can quit the shell, see process and ets tables information +and much more.

                                                    + +

                                                    The User Switch command

                                                    + +

                                                    Besides the break command, one can type Ctrl+G to get the to +the user switch command. When reached, you can type h to +get more information.

                                                    + +

                                                    In this switch, developers are able to create new shell and +alternate in between them. Let's give it a try:

                                                    + +
                                                    User switch command
                                                    + --> s 'Elixir-IEx'
                                                    + --> c
                                                    +
                                                    + +

                                                    The command above will start a new shell and connect to it. +Create a new variable called hello and assign some value to it:

                                                    + +
                                                    hello = :world
                                                    +
                                                    + +

                                                    Now, let's rollback to the first shell:

                                                    + +
                                                    User switch command
                                                    + --> c 1
                                                    +
                                                    + +

                                                    Now, try to access the hello variable again:

                                                    + +
                                                    hello
                                                    +** (UndefinedFunctionError) undefined function: IEx.Helpers.hello/0
                                                    +
                                                    + +

                                                    The command above fails because we have changed the shells +and they are isolated from each other, you can access the +variables defined in one in the other.

                                                    + +

                                                    The User Switch also allow developers to connect to remote +shells using r. Keep in mind that you can't connect to a +remote node if you haven't given a name to the current node +(i.e. Process.is_alive? must return true).

                                                    + +

                                                    Expressions in IEx

                                                    + +

                                                    As an interactive shell, IEx evalutes expressions. This has some +interesting consequences worthy discussing.

                                                    + +

                                                    The first one is that the code is truly evaluated and not compiled. +This means that, any benchmarking done in the shell is going to have +skewed results. So never run any profiling nor benchmark in the shell.

                                                    + +

                                                    Second of all, IEx alows you to break an expression into many lines, +since this is common in Elixir. For example:

                                                    + +
                                                    iex(1)> "ab
                                                    +...(1)> c"
                                                    +"ab\nc"
                                                    +
                                                    + +

                                                    In the example above, the shell will be expecting more input until it +finds the closing quote. Sometimes it is not obvious which character +the shell is expecting, and the user may find themselves trapped in +the state of incomplete expression with no ability to terminate it other +than by exiting the shell.

                                                    + +

                                                    For such cases, there is a special break-trigger ("#iex:break") that when +encountered on a line by itself will force the shell to break out of any +pending expression and return to its normal state:

                                                    + +
                                                    iex(1)> ["ab
                                                    +...(1)> c"
                                                    +...(1)> "
                                                    +...(1)> ]
                                                    +...(1)> #iex:break
                                                    +** (TokenMissingError) iex:1: incomplete expression
                                                    +
                                                    @@ -95,7 +174,7 @@

                                                    Functions

                                                    Returns registered after spawn callbacks.

                                                    - Source + Source

                                                    @@ -104,7 +183,7 @@

                                                    Functions

                                                    Registers a function to be invoked after IEx process is spawned.

                                                    - Source + Source

                                                    @@ -113,7 +192,7 @@

                                                    Functions

                                                    Returns currently registered inspect options.

                                                    - Source + Source

                                                    @@ -122,7 +201,7 @@

                                                    Functions

                                                    Registers options used on inspect.

                                                    - Source + Source

                                                    @@ -131,7 +210,7 @@

                                                    Functions

                                                    Returns true if IEx was properly started.

                                                    - Source + Source
                                                    diff --git a/docs/stable/IO.ANSI.html b/docs/stable/IO.ANSI.html index a9dc2aae3..5fcbf9624 100644 --- a/docs/stable/IO.ANSI.html +++ b/docs/stable/IO.ANSI.html @@ -38,7 +38,7 @@

                                                    - Source + Source @@ -320,7 +320,7 @@

                                                    Functions

                                                    Sets foreground color to black

                                                    - Source + Source

                                                    @@ -329,7 +329,7 @@

                                                    Functions

                                                    Sets background color to black

                                                    - Source + Source

                                                    Functions

                                                    Blink: Rapid. MS-DOS ANSI.SYS; 150 per minute or more; not widely supported

                                                    - Source + Source

                                                    Functions

                                                    Blink: Slow. Less than 150 per minute

                                                    - Source + Source

                                                    @@ -365,7 +365,7 @@

                                                    Functions

                                                    Sets foreground color to blue

                                                    - Source + Source

                                                    @@ -374,7 +374,7 @@

                                                    Functions

                                                    Sets background color to blue

                                                    - Source + Source

                                                    @@ -383,7 +383,7 @@

                                                    Functions

                                                    Bright (increased intensity) or Bold

                                                    - Source + Source

                                                    @@ -392,7 +392,7 @@

                                                    Functions

                                                    Conceal. Not widely supported

                                                    - Source + Source

                                                    @@ -401,7 +401,7 @@

                                                    Functions

                                                    Crossed-out. Characters legible, but marked for deletion. Not widely supported.

                                                    - Source + Source

                                                    @@ -410,7 +410,7 @@

                                                    Functions

                                                    Sets foreground color to cyan

                                                    - Source + Source

                                                    @@ -419,7 +419,7 @@

                                                    Functions

                                                    Sets background color to cyan

                                                    - Source + Source

                                                    @@ -428,7 +428,7 @@

                                                    Functions

                                                    Default background color

                                                    - Source + Source

                                                    @@ -437,7 +437,7 @@

                                                    Functions

                                                    Default text color

                                                    - Source + Source

                                                    @@ -446,7 +446,7 @@

                                                    Functions

                                                    Encircled

                                                    - Source + Source

                                                    @@ -467,11 +467,11 @@

                                                    Functions

                                                    Example

                                                    -

                                                    iex> IO.ANSI.escape "Hello %{red,bright,green}yes" +

                                                    iex> IO.ANSI.escape("Hello %{red,bright,green}yes") "Hello \e[31m\e[1m\e[32myes\e[0m"

                                                    - Source + Source

                                                    @@ -489,11 +489,11 @@

                                                    Example

                                                    Example

                                                    -

                                                    iex> IO.ANSI.escape "Hello %{red,bright,green}yes" +

                                                    iex> IO.ANSI.escape("Hello %{red,bright,green}yes") "Hello \e[31m\e[1m\e[32myes\e[0m"

                                                    - Source + Source

                                                    @@ -502,7 +502,7 @@

                                                    Example

                                                    Faint (decreased intensity), not widely supported

                                                    - Source + Source

                                                    @@ -511,7 +511,7 @@

                                                    Example

                                                    Sets alternative font 1

                                                    - Source + Source

                                                    @@ -520,7 +520,7 @@

                                                    Example

                                                    Sets alternative font 2

                                                    - Source + Source

                                                    @@ -529,7 +529,7 @@

                                                    Example

                                                    Sets alternative font 3

                                                    - Source + Source

                                                    @@ -538,7 +538,7 @@

                                                    Example

                                                    Sets alternative font 4

                                                    - Source + Source

                                                    @@ -547,7 +547,7 @@

                                                    Example

                                                    Sets alternative font 5

                                                    - Source + Source

                                                    @@ -556,7 +556,7 @@

                                                    Example

                                                    Sets alternative font 6

                                                    - Source + Source

                                                    @@ -565,7 +565,7 @@

                                                    Example

                                                    Sets alternative font 7

                                                    - Source + Source

                                                    @@ -574,7 +574,7 @@

                                                    Example

                                                    Sets alternative font 8

                                                    - Source + Source

                                                    @@ -583,7 +583,7 @@

                                                    Example

                                                    Sets alternative font 9

                                                    - Source + Source

                                                    @@ -592,7 +592,7 @@

                                                    Example

                                                    Framed

                                                    - Source + Source

                                                    @@ -601,7 +601,7 @@

                                                    Example

                                                    Sets foreground color to green

                                                    - Source + Source

                                                    @@ -610,7 +610,7 @@

                                                    Example

                                                    Sets background color to green

                                                    - Source + Source

                                                    @@ -619,7 +619,7 @@

                                                    Example

                                                    Image: Negative. Swap foreground and background

                                                    - Source + Source

                                                    @@ -628,7 +628,7 @@

                                                    Example

                                                    Italic: on. Not widely supported. Sometimes treated as inverse.

                                                    - Source + Source

                                                    @@ -637,7 +637,7 @@

                                                    Example

                                                    Sets foreground color to magenta

                                                    - Source + Source

                                                    @@ -646,7 +646,7 @@

                                                    Example

                                                    Sets background color to magenta

                                                    - Source + Source

                                                    @@ -673,7 +673,7 @@

                                                    Example

                                                    Not framed or encircled

                                                    - Source + Source

                                                    @@ -691,7 +691,7 @@

                                                    Example

                                                    Not overlined

                                                    - Source + Source

                                                    @@ -700,7 +700,7 @@

                                                    Example

                                                    Overlined

                                                    - Source + Source

                                                    @@ -709,7 +709,7 @@

                                                    Example

                                                    Sets primary (default) font

                                                    - Source + Source

                                                    @@ -718,7 +718,7 @@

                                                    Example

                                                    Sets foreground color to red

                                                    - Source + Source

                                                    @@ -727,7 +727,7 @@

                                                    Example

                                                    Sets background color to red

                                                    - Source + Source

                                                    @@ -736,7 +736,7 @@

                                                    Example

                                                    Resets all attributes

                                                    - Source + Source

                                                    @@ -745,7 +745,7 @@

                                                    Example

                                                    Image: Negative. Swap foreground and background

                                                    - Source + Source

                                                    @@ -762,7 +762,7 @@

                                                    Example

                                                    R16.

                                                    - Source + Source

                                                    @@ -771,7 +771,7 @@

                                                    Example

                                                    Underline: Single

                                                    - Source + Source

                                                    @@ -780,7 +780,7 @@

                                                    Example

                                                    Sets foreground color to white

                                                    - Source + Source

                                                    @@ -789,7 +789,7 @@

                                                    Example

                                                    Sets background color to white

                                                    - Source + Source

                                                    @@ -798,7 +798,7 @@

                                                    Example

                                                    Sets foreground color to yellow

                                                    - Source + Source

                                                    @@ -807,7 +807,7 @@

                                                    Example

                                                    Sets background color to yellow

                                                    - Source + Source
                                                    diff --git a/docs/stable/IO.html b/docs/stable/IO.html index 7d022a6b2..7798c6293 100644 --- a/docs/stable/IO.html +++ b/docs/stable/IO.html @@ -76,7 +76,12 @@

                                                    Functions summary

                                                  • - getb/3 + getn/2 + +
                                                  • +
                                                  • + + getn/3
                                                  • @@ -162,10 +167,13 @@

                                                    Functions

                                                    Source
                                                    -

                                                    - getb(device // group_leader(), prompt, count // 1) +

                                                    + getn(prompt, count // 1)

                                                    -

                                                    Gets count bytes from the IO device. It returns:

                                                    +

                                                    Gets a number of bytes from the io device. If the +io device is a unicode device, count implies +the number of unicode codepoints to be retrieved. +Otherwise, the number of raw bytes. It returns:

                                                    • data - The input characters.

                                                    • @@ -176,7 +184,19 @@

                                                      Functions

                                                    - Source + Source + +
                                                    +

                                                    + getn(device, prompt, count) +

                                                    +

                                                    Gets a number of bytes from the io device. If the +io device is a unicode device, count implies +the number of unicode codepoints to be retrieved. +Otherwise, the number of raw bytes.

                                                    +
                                                    + + Source

                                                    @@ -194,7 +214,7 @@

                                                    Functions

                                                  - Source + Source

                                                  diff --git a/docs/stable/Kernel.CLI.html b/docs/stable/Kernel.CLI.html index 8a5977726..1c1b50cc3 100644 --- a/docs/stable/Kernel.CLI.html +++ b/docs/stable/Kernel.CLI.html @@ -69,7 +69,7 @@

                                                  Functions

                                                  by escripts generated by Elixir.

                                                  - Source + Source diff --git a/docs/stable/Kernel.SpecialForms.html b/docs/stable/Kernel.SpecialForms.html index a640ea5a6..3ae0feb9d 100644 --- a/docs/stable/Kernel.SpecialForms.html +++ b/docs/stable/Kernel.SpecialForms.html @@ -69,6 +69,11 @@

                                                  Macros summary

                                                  []/1
                                                • +
                                                • + + __DIR__/0 + +
                                                • __ENV__/0 @@ -101,12 +106,12 @@

                                                  Macros summary

                                                • - alias/0 + alias/2
                                                • - alias/2 + alias!/1
                                                • @@ -134,6 +139,16 @@

                                                  Macros summary

                                                  require/2
                                                • +
                                                • + + unquote/1 + +
                                                • +
                                                • + + unquote_splicing/1 + +
                                                • var!/1 @@ -318,6 +333,15 @@

                                                  Examples

                                                  Source +
                                                  +

                                                  + __DIR__() +

                                                  +

                                                  Returns the current directory as a binary.

                                                  +
                                                  + + Source +

                                                  __ENV__() @@ -327,7 +351,7 @@

                                                  Examples

                                                  line numbers, set up aliases, the current function and others.

                                                  - Source + Source

                                                  @@ -338,7 +362,7 @@

                                                  Examples

                                                  is a convenient shortcut.

                                                  - Source + Source

                                                  @@ -349,7 +373,7 @@

                                                  Examples

                                                  is a convenient shortcut.

                                                  - Source + Source

                                                  @@ -394,7 +418,7 @@

                                                  Examples

                                                  - Source + Source

                                                  @@ -409,7 +433,7 @@

                                                  Examples

                                                  - Source + Source

                                                  @@ -421,24 +445,13 @@

                                                  Examples

                                                  it belonged to another file.

                                                  quote location: :keep, do: 1
                                                  -#=> { :__scope__, 1,[[file: "iex"],[do: 1]] }
                                                  +#=> { :__scope__, [line: 1], [[file: "iex"],[do: 1]] }
                                                   

                                                  Check quote/1 for more information.

                                                  - Source - -
                                                  -

                                                  - alias() -

                                                  -

                                                  When used inside quoting, marks that the alias should not -be hygienezed. This means the alias will be expanded when -the macro is expanded.

                                                  -
                                                  - - Source + Source

                                                  @@ -486,6 +499,17 @@

                                                  Lexical scope

                                                  Source +
                                                  +

                                                  + alias!(alias) +

                                                  +

                                                  When used inside quoting, marks that the alias should not +be hygienezed. This means the alias will be expanded when +the macro is expanded.

                                                  +
                                                  + + Source +

                                                  bc(args) @@ -500,7 +524,7 @@

                                                  Lexical scope

                                                  - Source + Source

                                                  @@ -580,6 +604,19 @@

                                                  Alias/Require shortcut

                                                  also accepts as: as an option so it automatically sets up an alias. Please check alias for more information.

                                                  +

                                                  Warnings

                                                  + +

                                                  If you import a module and you don't use any of the imported +functions or macros from this module, Elixir is going to issue +a warning implying the import is not being used.

                                                  + +

                                                  In case the import is generated automatically by a macro, +Elixir won't emit any warnings though, since the import +was not explicitly defined.

                                                  + +

                                                  Both warning behaviors could be changed by explicitily +setting the :warn option to true or false.

                                                  +

                                                  Ambiguous function/macro names

                                                  If two modules A and B are imported and they both contain @@ -588,7 +625,7 @@

                                                  Ambiguous function/macro names

                                                  errors are emitted lazily, not eagerly.

                                                  - Source + Source

                                                  @@ -638,7 +675,7 @@

                                                  Ambiguous function/macro names

                                                  - Source + Source

                                                  @@ -655,10 +692,10 @@

                                                  Examples

                                                  Explanation

                                                  Any Elixir code can be represented using Elixir data structures. -The building block of Elixir homoiconicity is a tuple with three -elements, for example:

                                                  +The building block of Elixir macros is a tuple with three elements, +for example:

                                                  -
                                                  { :sum, 1, [1, 2, 3] }
                                                  +
                                                  { :sum, [], [1, 2, 3] }
                                                   

                                                  The tuple above represents a function call to sum passing 1, 2 and @@ -667,8 +704,7 @@

                                                  Explanation

                                                  • The first element of the tuple is always an atom or another tuple in the same representation;
                                                  • -
                                                  • The second element of the tuple is always an integer -representing the line number;
                                                  • +
                                                  • The second element of the tuple represents metadata;
                                                  • The third element of the tuple are the arguments for the function call. The third argument may be an atom, which is usually a variable (or a local call);
                                                  • @@ -683,6 +719,7 @@

                                                    Options

                                                  • :location - When set to :keep, keeps the current line and file on quotes. Read the Stacktrace information section below for more information;
                                                  • :hygiene - Allows a developer to disable hygiene selectively;
                                                  • +
                                                  • :context - Sets the context resolution happens at;

                                                  Macro literals

                                                  @@ -698,17 +735,35 @@

                                                  Macro literals

                                                  {key, value} #=> Tuple with two elements
                                                  -

                                                  Hygiene

                                                  +

                                                  Hygiene and context

                                                  -

                                                  Elixir macros are hygienic via means of deferred resolution.

                                                  +

                                                  Elixir macros are hygienic via means of deferred resolution. +This means variables, aliases and imports defined inside the +quoted refer to the context that defined the macro and not +the context where the macro is expanded.

                                                  -

                                                  This means aliases and imports defined inside the quoted refer -to the context that defined the macro and not the context -where the macro is expanded.

                                                  +

                                                  For this mechanism to work, every quoted code is attached +to a context. Consider the following example:

                                                  -

                                                  Furthermore, variables inside quote are also hygienic: a -variable defined in a macro cannot affect the variables where -the macro is expanded.

                                                  +
                                                  defmodule ContextSample do
                                                  +  def hello do
                                                  +    quote do: world
                                                  +  end
                                                  +end
                                                  +
                                                  +ContextSample.hello
                                                  +#=> {:world,[],ContextSample}
                                                  +
                                                  + +

                                                  Notice how the third element of the returned tuple is the +module name. This means that the variable is associated to the +ContextSample module and only code generated by this module +will be able to access that particular world variable.

                                                  + +

                                                  The context can be disabled or changed by explicitly setting +the context option. All hygiene mechanisms are based on such +context and we are going to explore each of them in the following +subsections.

                                                  Hygiene in variables

                                                  @@ -918,7 +973,7 @@

                                                  Stacktrace information

                                                  the quote will always point to GenServer.Behaviour file.

                                                  - Source + Source

                                                  @@ -953,6 +1008,54 @@

                                                  Alias shortcut

                                                  Source +
                                                  +

                                                  + unquote(expr) +

                                                  +

                                                  Unquotes the given expression from inside a macro.

                                                  + +

                                                  Examples

                                                  + +

                                                  Imagine the situation you have a variable name and +you want to inject it inside some quote. The first attempt +would be:

                                                  + +
                                                  value = 13
                                                  +quote do: sum(1, value, 3)
                                                  +
                                                  + +

                                                  Which would then return:

                                                  + +
                                                  { :sum, [], [1, { :value, [], quoted }, 3] }
                                                  +
                                                  + +

                                                  Which is not the expected result. For this, we use unquote:

                                                  + +
                                                  value = 13
                                                  +quote do: sum(1, unquote(value), 3)
                                                  +#=> { :sum, [], [1, 13, 3] }
                                                  +
                                                  +
                                                  + + Source + +
                                                  +

                                                  + unquote_splicing(expr) +

                                                  +

                                                  Unquotes the given list expanding its arguments. Similar +to unquote.

                                                  + +

                                                  Examples

                                                  + +
                                                  values = [2,3,4]
                                                  +quote do: sum(1, unquote_splicing(values), 5)
                                                  +#=> { :sum, [], [1, 2, 3, 4, 5] }
                                                  +
                                                  +
                                                  + + Source +

                                                  var!(var) @@ -964,7 +1067,7 @@

                                                  Alias shortcut

                                                  Check quote/2 for more information.

                                                  - Source + Source

                                                  @@ -974,7 +1077,7 @@

                                                  Alias shortcut

                                                  Check quote/2 for more information.

                                                  - Source + Source

                                                  diff --git a/docs/stable/Kernel.Typespec.html b/docs/stable/Kernel.Typespec.html index 044d3dc6e..e26e8cc94 100644 --- a/docs/stable/Kernel.Typespec.html +++ b/docs/stable/Kernel.Typespec.html @@ -75,9 +75,9 @@

                                                  Bit Strings

                                                  <<_ :: _ * 8>>
                                                   
                                                  -

                                                  Functions

                                                  +

                                                  Anonymous functions

                                                  -

                                                  Any function:

                                                  +

                                                  Any anonymous function:

                                                  (fun(...) -> any)
                                                   or
                                                  @@ -86,14 +86,14 @@ 

                                                  Functions

                                                  (... -> any)
                                                  -

                                                  Function with arity of zero:

                                                  +

                                                  Anonymous function with arity of zero:

                                                  (fun() -> type)
                                                   or
                                                   (() -> type)
                                                   
                                                  -

                                                  Function with some arity:

                                                  +

                                                  Anonymous function with some arity:

                                                  (fun(type, type) -> type)
                                                   or
                                                  diff --git a/docs/stable/Kernel.html b/docs/stable/Kernel.html
                                                  index 239331a7f..66f495886 100644
                                                  --- a/docs/stable/Kernel.html
                                                  +++ b/docs/stable/Kernel.html
                                                  @@ -131,11 +131,21 @@ 

                                                  Functions summary

                                                  float/1
                                                • +
                                                • + + float_to_binary/2 + +
                                                • float_to_list/1
                                                • +
                                                • + + float_to_list/2 + +
                                                • function_exported?/3 @@ -648,6 +658,26 @@

                                                  Macros summary

                                                  defimpl/3
                                                • +
                                                • + + defmacro/2 + +
                                                • +
                                                • + + defmacro/4 + +
                                                • +
                                                • + + defmacrop/2 + +
                                                • +
                                                • + + defmacrop/4 + +
                                                • defmodule/2 @@ -675,7 +705,7 @@

                                                  Macros summary

                                                • - defrecord/4 + defrecord/3
                                                • @@ -708,11 +738,6 @@

                                                  Macros summary

                                                  float_to_binary/1
                                                • -
                                                • - - float_to_binary/2 - -
                                                • function/1 @@ -879,7 +904,7 @@

                                                  Examples

                                                  - Source + Source

                                                  @@ -898,7 +923,7 @@

                                                  Examples

                                                  - Source + Source

                                                  @@ -913,7 +938,7 @@

                                                  Examples

                                                  - Source + Source

                                                  @@ -929,18 +954,18 @@

                                                  Examples

                                                  Examples

                                                  -
                                                  iex> binary_part "foo", 1, 2
                                                  +
                                                  iex> binary_part("foo", 1, 2)
                                                   "oo"
                                                   

                                                  A negative length can be used to extract bytes at the end of a binary:

                                                  -
                                                  iex> binary_part "foo", 3, -1
                                                  +
                                                  iex> binary_part("foo", 3, -1)
                                                   "o"
                                                   
                                                  - Source + Source

                                                  @@ -958,7 +983,7 @@

                                                  Examples

                                                  - Source + Source

                                                  @@ -967,7 +992,7 @@

                                                  Examples

                                                  Works like binary_to_atom/2, but the atom must already exist.

                                                  - Source + Source

                                                  @@ -976,7 +1001,7 @@

                                                  Examples

                                                  Returns a list of integers which correspond to the bytes of binary.

                                                  - Source + Source

                                                  @@ -987,7 +1012,7 @@

                                                  Examples

                                                  are numbered starting from 1.

                                                  - Source + Source

                                                  @@ -1004,7 +1029,7 @@

                                                  Examples

                                                  - Source + Source

                                                  @@ -1030,7 +1055,7 @@

                                                  Examples

                                                  - Source + Source

                                                  @@ -1049,7 +1074,7 @@

                                                  Examples

                                                  - Source + Source

                                                  @@ -1060,7 +1085,7 @@

                                                  Examples

                                                  be a bitstring containing the remaining bits (1 up to 7 bits).

                                                  - Source + Source

                                                  @@ -1081,7 +1106,7 @@

                                                  Examples

                                                  - Source + Source

                                                  @@ -1098,7 +1123,7 @@

                                                  Examples

                                                  - Source + Source

                                                  @@ -1107,7 +1132,30 @@

                                                  Examples

                                                  Converts the given number to a float. Allowed in guard clauses.

                                                  - Source + Source + +
                                                  +

                                                  + float_to_binary(float, options) +

                                                  +

                                                  Returns a binary which corresponds to the text representation +of float.

                                                  + +

                                                  Options

                                                  + +
                                                    +
                                                  • :decimals — number of decimal points to show
                                                  • +
                                                  • :scientific — number of decimal points to show, in scientific format
                                                  • +
                                                  • :compact — If true, use the most compact representation (ignored with the scientific option)
                                                  • +
                                                  + +

                                                  Examples

                                                  + +
                                                  float_to_binary 7.1, [decimals: 2, compact: true] #=> "7.1"
                                                  +
                                                  +
                                                  + + Source

                                                  @@ -1122,7 +1170,30 @@

                                                  Examples

                                                  - Source + Source + +
                                                  +

                                                  + float_to_list(float, options) +

                                                  +

                                                  Returns a list which corresponds to the text representation +of float.

                                                  + +

                                                  Options

                                                  + +
                                                    +
                                                  • :decimals — number of decimal points to show
                                                  • +
                                                  • :scientific — number of decimal points to show, in scientific format
                                                  • +
                                                  • :compact — If true, use the most compact representation (ignored with the scientific option)
                                                  • +
                                                  + +

                                                  Examples

                                                  + +
                                                  float_to_list 7.1, [decimals: 2, compact: true] #=> '7.1'
                                                  +
                                                  +
                                                  + + Source

                                                  @@ -1139,7 +1210,7 @@

                                                  Examples

                                                  information.

                                                  - Source + Source

                                                  @@ -1148,7 +1219,7 @@

                                                  Examples

                                                  Returns the head of a list, raises badarg if the list is empty.

                                                  - Source + Source

                                                  @@ -1163,7 +1234,7 @@

                                                  Examples

                                                  - Source + Source

                                                  @@ -1179,7 +1250,7 @@

                                                  Examples

                                                  - Source + Source

                                                  @@ -1194,7 +1265,7 @@

                                                  Examples

                                                  - Source + Source

                                                  @@ -1212,7 +1283,7 @@

                                                  Examples

                                                  - Source + Source

                                                  @@ -1222,7 +1293,7 @@

                                                  Examples

                                                  if the node can be part of a distributed system.

                                                  - Source + Source

                                                  @@ -1233,7 +1304,7 @@

                                                  Examples

                                                  Allowed in guard tests.

                                                  - Source + Source

                                                  @@ -1246,7 +1317,7 @@

                                                  Examples

                                                  Allowed in guard tests.

                                                  - Source + Source

                                                  @@ -1257,7 +1328,7 @@

                                                  Examples

                                                  Allowed in guard tests.

                                                  - Source + Source

                                                  @@ -1269,7 +1340,7 @@

                                                  Examples

                                                  Allowed in guard tests.

                                                  - Source + Source

                                                  @@ -1280,7 +1351,7 @@

                                                  Examples

                                                  Allowed in guard tests.

                                                  - Source + Source

                                                  @@ -1291,7 +1362,7 @@

                                                  Examples

                                                  Allowed in guard tests.

                                                  - Source + Source

                                                  @@ -1303,7 +1374,7 @@

                                                  Examples

                                                  Allowed in guard tests.

                                                  - Source + Source

                                                  @@ -1314,7 +1385,7 @@

                                                  Examples

                                                  Allowed in guard tests.

                                                  - Source + Source

                                                  @@ -1325,7 +1396,7 @@

                                                  Examples

                                                  Allowed in guard tests.

                                                  - Source + Source

                                                  @@ -1337,7 +1408,7 @@

                                                  Examples

                                                  Allowed in guard tests.

                                                  - Source + Source

                                                  @@ -1348,7 +1419,7 @@

                                                  Examples

                                                  Allowed in guard tests.

                                                  - Source + Source

                                                  @@ -1359,7 +1430,7 @@

                                                  Examples

                                                  Allowed in guard tests.

                                                  - Source + Source

                                                  @@ -1370,7 +1441,7 @@

                                                  Examples

                                                  Allowed in guard tests.

                                                  - Source + Source

                                                  @@ -1381,7 +1452,7 @@

                                                  Examples

                                                  Allowed in guard tests.

                                                  - Source + Source

                                                  @@ -1398,7 +1469,7 @@

                                                  Examples

                                                  - Source + Source

                                                  @@ -1413,7 +1484,7 @@

                                                  Examples

                                                  - Source + Source

                                                  @@ -1428,7 +1499,7 @@

                                                  Examples

                                                  - Source + Source

                                                  @@ -1447,7 +1518,7 @@

                                                  Examples

                                                  - Source + Source

                                                  @@ -1457,7 +1528,7 @@

                                                  Examples

                                                  exists such atom.

                                                  - Source + Source

                                                  @@ -1472,7 +1543,7 @@

                                                  Examples

                                                  - Source + Source

                                                  @@ -1487,7 +1558,7 @@

                                                  Examples

                                                  - Source + Source

                                                  @@ -1502,7 +1573,7 @@

                                                  Examples

                                                  - Source + Source

                                                  @@ -1523,7 +1594,7 @@

                                                  Examples

                                                  - Source + Source

                                                  @@ -1538,7 +1609,7 @@

                                                  Examples

                                                  - Source + Source

                                                  @@ -1552,7 +1623,7 @@

                                                  Examples

                                                  information.

                                                  - Source + Source

                                                  @@ -1569,7 +1640,7 @@

                                                  Examples

                                                  - Source + Source

                                                  @@ -1586,7 +1657,7 @@

                                                  Examples

                                                  - Source + Source

                                                  @@ -1603,7 +1674,7 @@

                                                  Examples

                                                  - Source + Source

                                                  @@ -1615,7 +1686,7 @@

                                                  Examples

                                                  Allowed in guard tests.

                                                  - Source + Source

                                                  @@ -1628,7 +1699,7 @@

                                                  Examples

                                                  Allowed in guard tests.

                                                  - Source + Source

                                                  @@ -1646,7 +1717,7 @@

                                                  Warning:

                                                  It should not be used in application programs.

                                                  - Source + Source

                                                  @@ -1673,7 +1744,7 @@

                                                  Examples

                                                  - Source + Source

                                                  @@ -1691,12 +1762,12 @@

                                                  Examples

                                                  Examples

                                                  -
                                                  iex> raise ArgumentError, message: "Sample"
                                                  +
                                                  iex> raise(ArgumentError, message: "Sample")
                                                   ** (ArgumentError) Sample
                                                   
                                                  - Source + Source

                                                  @@ -1725,7 +1796,7 @@

                                                  Examples

                                                  may change the System.stacktrace value.

                                                  - Source + Source

                                                  @@ -1741,7 +1812,7 @@

                                                  Examples

                                                  - Source + Source

                                                  @@ -1751,7 +1822,7 @@

                                                  Examples

                                                  Allowed in guard clauses.

                                                  - Source + Source

                                                  @@ -1761,7 +1832,7 @@

                                                  Examples

                                                  or a binary. If possible, please use tuple_size or binary_size.

                                                  - Source + Source

                                                  @@ -1783,7 +1854,7 @@

                                                  Examples

                                                  - Source + Source

                                                  @@ -1801,7 +1872,7 @@

                                                  Examples

                                                  - Source + Source

                                                  @@ -1823,7 +1894,7 @@

                                                  Examples

                                                  - Source + Source

                                                  @@ -1841,7 +1912,7 @@

                                                  Examples

                                                  - Source + Source

                                                  @@ -1855,7 +1926,7 @@

                                                  Examples

                                                  of communications channel not supported by distributed :

                                                  - Source + Source

                                                  @@ -1871,7 +1942,7 @@

                                                  Examples

                                                - Source + Source

                                                @@ -1880,7 +1951,7 @@

                                                Examples

                                                A non-local return from a function. Check try/2 for more information.

                                                - Source + Source

                                                @@ -1889,7 +1960,7 @@

                                                Examples

                                                Returns the tail of a list. Raises ArgumentError if the list is empty.

                                                - Source + Source

                                                @@ -1905,7 +1976,7 @@

                                                Examples

                                                - Source + Source

                                                @@ -1914,7 +1985,7 @@

                                                Examples

                                                Returns the size of a tuple.

                                                - Source + Source

                                                @@ -1923,7 +1994,7 @@

                                                Examples

                                                Converts a tuple to a list.

                                                - Source + Source
                                                @@ -1953,7 +2024,7 @@

                                                Examples

                                                - Source + Source

                                                @@ -1975,7 +2046,7 @@

                                                Examples

                                                - Source + Source

                                                @@ -1994,15 +2065,16 @@

                                                Examples

                                                - Source + Source

                                                left && right

                                                -

                                                Provides a short-circuit operator that executes the second -expression only if the first one evalutes to true (i.e. it is -not nil nor false). Returns the first expression otherwise.

                                                +

                                                Provides a short-circuit operator that evaluates and returns +the second expression only if the first one evaluates to true +(i.e. it is not nil nor false). Returns the first expression +otherwise.

                                                Examples

                                                @@ -2021,7 +2093,7 @@

                                                Examples

                                                not only booleans, however it is not allowed in guards.

                                                - Source + Source

                                                @@ -2125,7 +2197,7 @@

                                                Examples

                                                - Source + Source

                                                @@ -2160,7 +2232,7 @@

                                                Examples

                                                - Source + Source

                                                @@ -2193,7 +2265,7 @@

                                                Examples

                                                - Source + Source

                                                @@ -2216,7 +2288,7 @@

                                                Examples

                                                - Source + Source

                                                @@ -2239,7 +2311,7 @@

                                                Examples

                                                - Source + Source

                                                @@ -2258,7 +2330,7 @@

                                                Examples

                                                - Source + Source

                                                @@ -2277,7 +2349,7 @@

                                                Examples

                                                - Source + Source

                                                @@ -2293,7 +2365,7 @@

                                                Examples

                                                - Source + Source

                                                @@ -2309,7 +2381,7 @@

                                                Examples

                                                - Source + Source

                                                @@ -2359,7 +2431,7 @@

                                                Examples

                                                to manipulate module attributes.

                                                - Source + Source

                                                @@ -2377,7 +2449,7 @@

                                                Examples

                                                - Source + Source

                                                @@ -2395,7 +2467,7 @@

                                                Examples

                                                - Source + Source

                                                @@ -2406,12 +2478,12 @@

                                                Examples

                                                Examples

                                                -
                                                iex> Regex.match? %R(f#{1,3}o), "f#o"
                                                +
                                                iex> Regex.match?(%R(f#{1,3}o), "f#o")
                                                 true
                                                 
                                                - Source + Source

                                                @@ -2435,7 +2507,7 @@

                                                Examples

                                                - Source + Source

                                                @@ -2453,7 +2525,7 @@

                                                Examples

                                                - Source + Source

                                                @@ -2471,7 +2543,7 @@

                                                Examples

                                                - Source + Source

                                                @@ -2481,12 +2553,12 @@

                                                Examples

                                                Examples

                                                -
                                                iex> Regex.match? %r(foo), "foo"
                                                +
                                                iex> Regex.match?(%r(foo), "foo")
                                                 true
                                                 
                                                - Source + Source

                                                @@ -2513,7 +2585,7 @@

                                                Examples

                                                - Source + Source

                                                @@ -2582,7 +2654,7 @@

                                                Atoms

                                                In this case, "Hello" will be printed twice (one per each field).

                                                - Source + Source

                                                @@ -2608,12 +2680,12 @@

                                                Examples

                                                Examples

                                                -
                                                iex> apply fn x -> x * 2 end, [2]
                                                +
                                                iex> apply(fn x -> x * 2 end, [2])
                                                 4
                                                 
                                                - Source + Source

                                                @@ -2623,12 +2695,12 @@

                                                Examples

                                                Examples

                                                -
                                                iex> apply Enum, :reverse, [[1,2,3]]
                                                +
                                                iex> apply(Enum, :reverse, [[1,2,3]])
                                                 [3,2,1]
                                                 
                                                - Source + Source

                                                @@ -2639,12 +2711,12 @@

                                                Examples

                                                Examples

                                                -
                                                iex> atom_to_binary :my_atom
                                                +
                                                iex> atom_to_binary(:my_atom)
                                                 "my_atom"
                                                 
                                                - Source + Source

                                                @@ -2655,12 +2727,12 @@

                                                Examples

                                                Examples

                                                -
                                                iex> binary_to_atom "my_atom"
                                                +
                                                iex> binary_to_atom("my_atom")
                                                 :my_atom
                                                 
                                                - Source + Source

                                                @@ -2671,15 +2743,15 @@

                                                Examples

                                                Examples

                                                iex> :my_atom
                                                -...> binary_to_existing_atom "my_atom"
                                                +...> binary_to_existing_atom("my_atom")
                                                 :my_atom
                                                 
                                                -iex> binary_to_existing_atom "this_atom_will_never_exist"
                                                +iex> binary_to_existing_atom("this_atom_will_never_exist")
                                                 ** (ArgumentError) argument error
                                                 
                                                - Source + Source

                                                @@ -2689,12 +2761,12 @@

                                                Examples

                                                Examples

                                                -
                                                iex> binary_to_float "2.2017764e+0"
                                                +
                                                iex> binary_to_float("2.2017764e+0")
                                                 2.2017764
                                                 
                                                - Source + Source

                                                @@ -2704,12 +2776,12 @@

                                                Examples

                                                Examples

                                                -
                                                iex> binary_to_integer "123"
                                                +
                                                iex> binary_to_integer("123")
                                                 123
                                                 
                                                - Source + Source

                                                @@ -2725,13 +2797,13 @@

                                                Examples

                                                - Source + Source

                                                case(condition, blocks)

                                                -

                                                Matches the given condition against the match clauses.

                                                +

                                                Matches the given expression against the match clauses.

                                                Examples

                                                @@ -2742,9 +2814,9 @@

                                                Examples

                                                end
                                                -

                                                In the example above, we compare thing with each given -match clause and execute the first one that matches. If no -clause matches, an error is raised.

                                                +

                                                In the example above, we compare thing with each given match +clause and evaluate the expression corresponding to the first clause +that matches. If no clause matches, an error is raised.

                                                Since Elixir variables can be assigned more than once, variables in a match clause will always be assigned instead of matching with @@ -2767,27 +2839,17 @@

                                                Examples

                                                The example above will actually fail because 10 does not match 1.

                                                - -

                                                Finally, case accepts an else: branch as a fallback if none -of the clauses match:

                                                - -
                                                case thing do
                                                -  { :selector, i, value } when is_integer(i) ->
                                                -    value
                                                -  _ ->
                                                -    thing
                                                -end
                                                -
                                                - Source + Source

                                                cond(list1)

                                                -

                                                Execute the first clause where the condition returns true, -raises an error otherwise.

                                                +

                                                Evaluates the expression corresponding to the first clause that +evaluates to true. Raises an error if all conditions evaluate to +to falsy values (nil or false).

                                                Examples

                                                @@ -2802,7 +2864,7 @@

                                                Examples

                                                - Source + Source

                                                @@ -2832,7 +2894,7 @@

                                                Examples

                                                two arguments and sum them.

                                                - Source + Source

                                                @@ -2871,7 +2933,7 @@

                                                Examples

                                                - Source + Source

                                                @@ -2919,7 +2981,7 @@

                                                Examples

                                                - Source + Source

                                                @@ -2937,7 +2999,7 @@

                                                Examples

                                                binary as result;

                                                - Source + Source

                                                @@ -2947,7 +3009,62 @@

                                                Examples

                                                defprotocol/2 for examples.

                                                - Source + Source + +
                                                +

                                                + defmacro(name, list2) +

                                                +

                                                Defines a macro with the given name and contents.

                                                + +

                                                Examples

                                                + +
                                                defmodule MyLogic do
                                                +  defmacro unless(expr, opts) do
                                                +    quote do
                                                +      if !unquote(expr), unquote(opts)
                                                +    end
                                                +  end
                                                +end
                                                +
                                                +require MyLogic
                                                +MyLogic.unless false do
                                                +  IO.puts "It works"
                                                +end
                                                +
                                                +
                                                + + Source + +
                                                +

                                                + defmacro(name, args, guards, list4) +

                                                +

                                                The same as def/4 but generates a macro.

                                                +
                                                + + Source + +
                                                +

                                                + defmacrop(name, list2) +

                                                +

                                                Defines a macro that is private. Private macros +can only be accessible from the same module it is defined.

                                                + +

                                                Check defmacro/2 for more information

                                                +
                                                + + Source + +
                                                +

                                                + defmacrop(name, args, guards, list4) +

                                                +

                                                The same as def/4 but generates a private macro.

                                                +
                                                + + Source

                                                @@ -2997,7 +3114,7 @@

                                                Dynamic names

                                                returns an atom.

                                                - Source + Source

                                                @@ -3008,7 +3125,7 @@

                                                Dynamic names

                                                developer to customize it.

                                                - Source + Source

                                                @@ -3034,7 +3151,7 @@

                                                Examples

                                                through Foo.sum will raise an error.

                                                - Source + Source

                                                @@ -3043,7 +3160,7 @@

                                                Examples

                                                The same as def/4 but generates a private function.

                                                - Source + Source

                                                @@ -3175,11 +3292,11 @@

                                                Types

                                                given protocol are valid argument types for the given function.

                                                - Source + Source
                                                -

                                                - defrecord(name, fields, opts // [], do_block // []) +

                                                + defrecord(name, fields, do_block // [])

                                                Defines a record.

                                                @@ -3261,6 +3378,28 @@

                                                Access syntax

                                                Which provides faster get and set times for record operations.

                                                +

                                                Runtime introspection

                                                + +

                                                At runtime, developers can use __record__ to get information +about the given record:

                                                + +
                                                FileInfo.__record__(:name)
                                                +#=> FileInfo
                                                +
                                                +FileInfo.__record__(:fields)
                                                +#=> [atime: nil, accesses: 0]
                                                +
                                                + +

                                                In order to quickly access the index of a field, one can use +the __index__ function:

                                                + +
                                                FileInfo.__index__(:atime)
                                                +#=> 0
                                                +
                                                +FileInfo.__index__(:unknown)
                                                +#=> nil
                                                +
                                                +

                                                Compile-time introspection

                                                At the compile time, one can access following information about the record @@ -3323,7 +3462,7 @@

                                                Importing records

                                                See Record.import/2 and defrecordp/2 documentation for more information

                                                - Source + Source

                                                @@ -3373,7 +3512,7 @@

                                                Examples

                                                - Source + Source

                                                @@ -3395,7 +3534,7 @@

                                                Example

                                                - Source + Source

                                                @@ -3408,7 +3547,7 @@

                                                Example

                                                Examples

                                                -
                                                iex> destructure [x,y,z], [1,2,3,4,5]
                                                +
                                                iex> destructure([x,y,z], [1,2,3,4,5])
                                                 ...> {x, y, z}
                                                 {1, 2, 3}
                                                 
                                                @@ -3418,7 +3557,7 @@

                                                Examples

                                                fine. If the right size is smaller, the remaining items are simply assigned to nil:

                                                -
                                                iex> destructure [x,y,z], [1]
                                                +
                                                iex> destructure([x,y,z], [1])
                                                 ...> {x, y, z}
                                                 {1, nil, nil}
                                                 
                                                @@ -3427,7 +3566,7 @@

                                                Examples

                                                on the left side of a match:

                                                x = 1
                                                -destructure [^x,y,z], [1,2,3]
                                                +destructure([^x,y,z], [1,2,3])
                                                 

                                                The example above will only work if x matches @@ -3435,7 +3574,7 @@

                                                Examples

                                                it will raise a CaseClauseError.

                                                - Source + Source

                                                @@ -3447,12 +3586,12 @@

                                                Examples

                                                Examples

                                                -
                                                iex> div 5, 2
                                                +
                                                iex> div(5, 2)
                                                 2
                                                 
                                                - Source + Source

                                                @@ -3471,7 +3610,7 @@

                                                Example

                                                - Source + Source

                                                @@ -3482,35 +3621,12 @@

                                                Example

                                                Examples

                                                -
                                                iex> float_to_binary 7.0
                                                +
                                                iex> float_to_binary(7.0)
                                                 "7.00000000000000000000e+00"
                                                 
                                                - Source - -
                                                -

                                                - float_to_binary(some_float, options) -

                                                -

                                                Returns a binary which corresponds to the text representation -of some_float.

                                                - -

                                                Options

                                                - -
                                                  -
                                                • :decimals — number of decimal points to show
                                                • -
                                                • :scientific — number of decimal points to show, in scientific format
                                                • -
                                                • :compact — If true, use the most compact representation. Ignored with the scientific option
                                                • -
                                                - -

                                                Examples

                                                - -
                                                float_to_binary 7.1, [decimals: 2, compact: true] #=> "7.1"
                                                -
                                                -
                                                - - Source + Source

                                                @@ -3604,7 +3720,7 @@

                                                Shortcut syntax

                                                - Source + Source

                                                @@ -3620,7 +3736,7 @@

                                                Examples

                                                - Source + Source

                                                @@ -3634,7 +3750,7 @@

                                                One-liner examples

                                                if(foo, do: bar)
                                                 
                                                -

                                                In the example above, bar will be returned if foo evalutes to +

                                                In the example above, bar will be returned if foo evaluates to true (i.e. it is not false nor nil). Otherwise, nil will be returned.

                                                An else option can be given to specify the opposite:

                                                @@ -3666,15 +3782,14 @@

                                                Blocks examples

                                                macro.

                                                - Source + Source

                                                left in right

                                                Returns true if the element on the left is equal (==) to -any of the items in the right. For now, it only accepts -a list as the right argument.

                                                +any of the items in the right.

                                                Examples

                                                @@ -3688,6 +3803,9 @@

                                                Examples

                                                x == 1 or x == 2 or x == 3
                                                 
                                                +

                                                with the exception that the expression on the left of in +is evaluated only once.

                                                +

                                                Clauses

                                                Whenever used inside a function or a case clause, you can @@ -3711,7 +3829,7 @@

                                                Clauses

                                                the variable for us.

                                                - Source + Source

                                                @@ -3733,7 +3851,7 @@

                                                Example

                                                - Source + Source

                                                @@ -3767,7 +3885,7 @@

                                                Examples

                                                - Source + Source

                                                @@ -3778,12 +3896,12 @@

                                                Examples

                                                Examples

                                                -
                                                iex> integer_to_binary 123
                                                +
                                                iex> integer_to_binary(123)
                                                 "123"
                                                 
                                                - Source + Source

                                                @@ -3794,12 +3912,12 @@

                                                Examples

                                                Examples

                                                -
                                                iex> integer_to_binary 77
                                                +
                                                iex> integer_to_binary(77)
                                                 "77"
                                                 
                                                - Source + Source

                                                @@ -3816,7 +3934,7 @@

                                                Examples

                                                - Source + Source

                                                @@ -3825,7 +3943,7 @@

                                                Examples

                                                Checks if the given argument is a range.

                                                - Source + Source

                                                @@ -3834,7 +3952,7 @@

                                                Examples

                                                Checks if the given argument is a record.

                                                - Source + Source

                                                @@ -3853,7 +3971,7 @@

                                                Examples

                                                - Source + Source

                                                @@ -3862,7 +3980,7 @@

                                                Examples

                                                Checks if the given argument is a regex.

                                                - Source + Source

                                                @@ -3894,7 +4012,7 @@

                                                Examples

                                                - Source + Source

                                                @@ -3905,14 +4023,14 @@

                                                Examples

                                                Examples

                                                -
                                                iex> nil? 1
                                                +
                                                iex> nil?(1)
                                                 false
                                                -iex> nil? nil
                                                +iex> nil?(nil)
                                                 true
                                                 
                                                - Source + Source

                                                @@ -3928,7 +4046,7 @@

                                                Examples

                                                - Source + Source

                                                @@ -3994,7 +4112,7 @@

                                                Examples

                                              - Source + Source

                                              @@ -4006,12 +4124,12 @@

                                              Examples

                                              Examples

                                              -
                                              iex> rem 5, 2
                                              +
                                              iex> rem(5, 2)
                                               1
                                               
                                              - Source + Source

                                              @@ -4028,7 +4146,7 @@

                                              Example

                                              - Source + Source

                                              @@ -4044,7 +4162,7 @@

                                              Examples

                                              - Source + Source

                                              @@ -4059,13 +4177,13 @@

                                              Examples

                                              - Source + Source

                                              try(args)

                                              -

                                              Execute the given expressions and catch any error, exit +

                                              Evaluate the given expressions and catch any error, exit or throw that may have happened.

                                              Examples

                                              @@ -4148,7 +4266,7 @@

                                              Catching exits and Erlang errors

                                              Variable visibility

                                              -

                                              Since an expression inside try may not have been evaluted +

                                              Since an expression inside try may not have been evaluated due to an exception, any variable created inside try cannot be accessed externaly. For instance:

                                              @@ -4178,18 +4296,27 @@

                                              Variable visibility

                                              - Source + Source

                                              unless(clause, options)

                                              -

                                              Provides a unless macro that executes the expression -unless a value evalutes to true. Check if for examples -and documentation.

                                              +

                                              Evaluates and returns the do-block passed in as a second argument +unless clause evaluates to true. +Returns nil otherwise. +See also if.

                                              + +

                                              Examples

                                              + +
                                              iex> unless(1, do: "Hello")
                                              +nil
                                              +iex> unless(false, do: "Hello")
                                              +"Hello"
                                              +
                                              - Source + Source

                                              @@ -4228,23 +4355,26 @@

                                              Examples

                                              - Source + Source

                                              left xor right

                                              -

                                              Boolean xor. Arguments must be booleans. +

                                              Boolean exclusive-or. Arguments must be booleans. Returns true if and only if +both arguments are different. Allowed in guard clauses.

                                              Examples

                                              iex> true xor false
                                               true
                                              +iex> true xor true
                                              +false
                                               
                                              - Source + Source

                                              @@ -4285,15 +4415,15 @@

                                              Examples

                                              - Source + Source

                                              left || right

                                              -

                                              Provides a short-circuit operator that executes the second -expression only if the first one does not evalute to true (i.e. it -is not nil nor false). Returns the first expression otherwise.

                                              +

                                              Provides a short-circuit operator that evaluates and returns the second +expression only if the first one does not evaluate to true (i.e. it +is either nil or false). Returns the first expression otherwise.

                                              Examples

                                              @@ -4312,7 +4442,7 @@

                                              Examples

                                              not only booleans, however it is not allowed in guards.

                                              - Source + Source
                                              diff --git a/docs/stable/KeyError.html b/docs/stable/KeyError.html index 4f6847a95..9170b8661 100644 --- a/docs/stable/KeyError.html +++ b/docs/stable/KeyError.html @@ -29,7 +29,7 @@

                                              - Source + Source @@ -71,7 +71,7 @@

                                              Functions

                                              - Source + Source
                                              diff --git a/docs/stable/Keyword.html b/docs/stable/Keyword.html index b1bfe9cba..91c7d95aa 100644 --- a/docs/stable/Keyword.html +++ b/docs/stable/Keyword.html @@ -29,7 +29,7 @@

                                              A keyword is a list of tuples where the first element of the tuple is an atom and the second element can be -any value.

                                              +any value.

                                              A keyword may have duplicated keys, so it is not strictly a dictionary. However most of the functions in this module @@ -56,6 +56,11 @@

                                              Functions summary

                                              delete/2

                                            • +
                                            • + + delete_first/2 + +
                                            • equal?/2 @@ -63,17 +68,22 @@

                                              Functions summary

                                            • - from_enum/1 + fetch/2
                                            • - get/3 + fetch!/2 + +
                                            • +
                                            • + + from_enum/1
                                            • - get!/2 + get/3
                                            • @@ -168,14 +178,32 @@

                                              Functions

                                              Examples

                                              -
                                              iex> Keyword.delete [a: 1, b: 2], :a
                                              +
                                              iex> Keyword.delete([a: 1, b: 2], :a)
                                              +[b: 2]
                                              +iex> Keyword.delete([b: 2], :a)
                                               [b: 2]
                                              -iex> Keyword.delete [b: 2], :a
                                              +
                                              + + + Source + +
                                              +

                                              + delete_first(keywords, key) +

                                              +

                                              Deletes the first entry in the keyword list for a specific key. +If the key does not exist, returns the keyword list unchanged.

                                              + +

                                              Examples

                                              + +
                                              iex> Keyword.delete_first([a: 1, b: 2, a: 3], :a)
                                              +[b: 2, a: 3]
                                              +iex> Keyword.delete_first([b: 2], :a)
                                               [b: 2]
                                               
                                              - Source + Source

                                              @@ -186,12 +214,49 @@

                                              Examples

                                              Examples

                                              -
                                              iex> Keyword.equal? [a: 1, b: 2], [b: 2, a: 1]
                                              +
                                              iex> Keyword.equal?([a: 1, b: 2], [b: 2, a: 1])
                                               true
                                               
                                              - Source + Source + +
                                              +

                                              + fetch(keywords, key) +

                                              +

                                              Fetchs the value for specific key and return it in a tuple. +If the key does not exist, returns :error.

                                              + +

                                              Examples

                                              + +
                                              iex> Keyword.fetch([a: 1], :a)
                                              +{ :ok, 1 }
                                              +
                                              +iex> Keyword.fetch([a: 1], :b)
                                              +:error
                                              +
                                              +
                                              + + Source + +
                                              +

                                              + fetch!(keywords, key) +

                                              +

                                              Fetches the value for specific key. If key does not exist, +an error is raised.

                                              + +

                                              Examples

                                              + +
                                              iex> Keyword.fetch!([a: 1], :a)
                                              +1
                                              +iex> Keyword.fetch!([a: 1], :b)
                                              +** (KeyError) key not found: :b
                                              +
                                              +
                                              + + Source

                                              @@ -218,34 +283,16 @@

                                              Examples

                                              Examples

                                              -
                                              iex> Keyword.get [a: 1], :a
                                              +
                                              iex> Keyword.get([a: 1], :a)
                                               1
                                              -iex> Keyword.get [a: 1], :b
                                              +iex> Keyword.get([a: 1], :b)
                                               nil
                                              -iex> Keyword.get [a: 1], :b, 3
                                              +iex> Keyword.get([a: 1], :b, 3)
                                               3
                                               
                                              - Source - -
                                              -

                                              - get!(keywords, key) -

                                              -

                                              Gets the value for specific key. If key does not exist, -an error is raised.

                                              - -

                                              Examples

                                              - -
                                              iex> Keyword.get! [a: 1], :a
                                              -1
                                              -iex> Keyword.get! [a: 1], :b
                                              -** (KeyError) key not found: :b
                                              -
                                              -
                                              - - Source + Source

                                              @@ -255,12 +302,12 @@

                                              Examples

                                              Examples

                                              -
                                              iex> Keyword.get_values [a: 1, a: 2], :a
                                              +
                                              iex> Keyword.get_values([a: 1, a: 2], :a)
                                               [1,2]
                                               
                                              - Source + Source

                                              @@ -277,7 +324,7 @@

                                              Examples

                                              - Source + Source

                                              @@ -288,12 +335,12 @@

                                              Examples

                                              Examples

                                              -
                                              iex> Keyword.keys [a: 1, b: 2]
                                              +
                                              iex> Keyword.keys([a: 1, b: 2])
                                               [:a,:b]
                                               
                                              - Source + Source

                                              @@ -313,12 +360,12 @@

                                              Examples

                                              Examples

                                              -
                                              iex> Enum.sort Keyword.merge [a: 1, b: 2], [a: 3, d: 4]
                                              +
                                              iex> Keyword.merge([a: 1, b: 2], [a: 3, d: 4]) |> Enum.sort
                                               [a: 3, b: 2, d: 4]
                                               
                                              - Source + Source

                                              @@ -329,14 +376,14 @@

                                              Examples

                                              Examples

                                              -
                                              iex> Keyword.merge [a: 1, b: 2], [a: 3, d: 4], fn _k, v1, v2 ->
                                              +
                                              iex> Keyword.merge([a: 1, b: 2], [a: 3, d: 4], fn (_k, v1, v2) ->
                                               ...>  v1 + v2
                                              -iex> end
                                              +iex> end)
                                               [a: 4, b: 2, d: 4]
                                               
                                              - Source + Source

                                              @@ -345,7 +392,7 @@

                                              Examples

                                              Returns an empty keyword list, i.e. an empty list.

                                              - Source + Source

                                              @@ -356,12 +403,12 @@

                                              Examples

                                              Examples

                                              -
                                              iex> Keyword.new [{:b,1},{:a,2}]
                                              +
                                              iex> Keyword.new([{:b,1},{:a,2}])
                                               [a: 2, b: 1]
                                               
                                              - Source + Source

                                              @@ -373,12 +420,12 @@

                                              Examples

                                              Examples

                                              -
                                              iex> Enum.sort Keyword.new [:a, :b], fn x -> {x,x} end
                                              +
                                              iex> Keyword.new([:a, :b], fn (x) -> {x,x} end) |> Enum.sort
                                               [a: :a, b: :b]
                                               
                                              - Source + Source

                                              @@ -391,12 +438,12 @@

                                              Examples

                                              Examples

                                              -
                                              iex> Keyword.put [a: 1, b: 2], :a, 3
                                              +
                                              iex> Keyword.put([a: 1, b: 2], :a, 3)
                                               [a: 3, b: 2]
                                               
                                              - Source + Source

                                              @@ -407,12 +454,12 @@

                                              Examples

                                              Examples

                                              -
                                              iex> Keyword.put_new [a: 1, b: 2], :a, 3
                                              +
                                              iex> Keyword.put_new([a: 1, b: 2], :a, 3)
                                               [a: 1, b: 2]
                                               
                                              - Source + Source

                                              @@ -430,7 +477,7 @@

                                              Examples

                                              - Source + Source

                                              @@ -448,7 +495,7 @@

                                              Examples

                                              - Source + Source

                                              @@ -458,12 +505,12 @@

                                              Examples

                                              Examples

                                              -
                                              iex> Keyword.values [a: 1, b: 2]
                                              +
                                              iex> Keyword.values([a: 1, b: 2])
                                               [1,2]
                                               
                                              - Source + Source diff --git a/docs/stable/List.Chars.Number.html b/docs/stable/List.Chars.Number.html index 56e96f457..51fef0449 100644 --- a/docs/stable/List.Chars.Number.html +++ b/docs/stable/List.Chars.Number.html @@ -56,11 +56,11 @@

                                              Functions summary

                                              Functions

                                              - to_char_list(integer) + to_char_list(thing)

                                              - Source + Source
                                              diff --git a/docs/stable/List.html b/docs/stable/List.html index fe0b41ab6..3420ff583 100644 --- a/docs/stable/List.html +++ b/docs/stable/List.html @@ -88,6 +88,11 @@

                                              Functions summary

                                              foldr/3
                                            • +
                                            • + + insert_at/3 + +
                                            • keydelete/3 @@ -118,11 +123,6 @@

                                              Functions summary

                                              last/1
                                            • -
                                            • - - member?/2 - -
                                            • unzip/1 @@ -157,7 +157,7 @@

                                              Functions

                                              Examples

                                              -
                                              iex> List.concat [[1,[2],3], [4], [5,6]]
                                              +
                                              iex> List.concat([[1,[2],3], [4], [5,6]])
                                               [1,[2],3,4,5,6]
                                               
                                              @@ -176,7 +176,7 @@

                                              Examples

                                              Examples

                                              -
                                              iex> List.concat [1,2,3], [4,5,6]
                                              +
                                              iex> List.concat([1,2,3], [4,5,6])
                                               [1,2,3,4,5,6]
                                               
                                              @@ -208,10 +208,10 @@

                                              Examples

                                              Examples

                                              -
                                              iex> List.duplicate "hello", 3
                                              +
                                              iex> List.duplicate("hello", 3)
                                               ["hello","hello","hello"]
                                               
                                              -iex> List.duplicate [1,2], 2
                                              +iex> List.duplicate([1,2], 2)
                                               [[1,2],[1,2]]
                                               
                                              @@ -228,10 +228,10 @@

                                              Examples

                                              Examples

                                              -
                                              iex> List.flatten [1,[[2],3]]
                                              +
                                              iex> List.flatten([1,[[2],3]])
                                               [1,2,3]
                                               
                                              -iex> List.flatten [1,[[2],3]], [4,5]
                                              +iex> List.flatten([1,[[2],3]], [4,5])
                                               [1,2,3,4,5]
                                               
                                              @@ -255,10 +255,10 @@

                                              Examples

                                              Examples

                                              -
                                              iex> List.foldl [5,5], 10, fn x, acc -> x + acc end
                                              +
                                              iex> List.foldl([5,5], 10, fn (x, acc) -> x + acc end)
                                               20
                                               
                                              -iex> List.foldl [1,2,3,4], 0, fn x, acc -> x - acc end
                                              +iex> List.foldl([1,2,3,4], 0, fn (x, acc) -> x - acc end)
                                               2
                                               
                                              @@ -274,13 +274,36 @@

                                              Examples

                                              Examples

                                              -
                                              iex> List.foldr [1,2,3,4], 0, fn x, acc -> x - acc end
                                              +
                                              iex> List.foldr([1,2,3,4], 0, fn (x, acc) -> x - acc end)
                                               -2
                                               
                                              Source +
                                              +

                                              + insert_at(list, index, value) +

                                              +

                                              Returns a list with an inserted value at specified index. Note that the index +is capped at the list length and that negative indicies wraps around at the +end of the list.

                                              + +

                                              Examples

                                              + +
                                              iex> List.insert_at([1, 2, 3, 4], 2, 0)
                                              +[1, 2, 0, 3, 4]
                                              +
                                              +iex> List.insert_at([1, 2, 3], 10, 0)
                                              +[1, 2, 3, 0]
                                              +
                                              +iex> List.insert_at([1, 2, 3], -1, 0)
                                              +[1, 2, 0, 3]
                                              +
                                              +
                                              + + Source +

                                              keydelete(list, key, position) @@ -302,14 +325,14 @@

                                              Examples

                                              - Source + Source

                                              keyfind(list, key, position, default // nil)

                                              Receives a list of tuples and returns the first tuple -where the item at position posistion matches with the +where the item at position position matches with the given item.

                                              Examples

                                              @@ -325,7 +348,7 @@

                                              Examples

                                              - Source + Source

                                              @@ -348,7 +371,7 @@

                                              Examples

                                              - Source + Source

                                              @@ -364,7 +387,7 @@

                                              Examples

                                              - Source + Source

                                              @@ -381,7 +404,7 @@

                                              Examples

                                              - Source + Source

                                              @@ -391,37 +414,17 @@

                                              Examples

                                              Examples

                                              -
                                              iex> List.last []
                                              +
                                              iex> List.last([])
                                               nil
                                              -iex> List.last [1]
                                              +iex> List.last([1])
                                               1
                                              -iex> List.last [1, 2, 3]
                                              +iex> List.last([1, 2, 3])
                                               3
                                               
                                              Source -
                                              -

                                              - member?(list, term) -

                                              -

                                              Checks if the given term is included in the list. -This function simply delegates to lists:member -which is implemented in C for performance.

                                              - -

                                              Examples

                                              - -
                                              iex> List.member? [1,2,3], 1
                                              -true
                                              -
                                              -iex> List.member? [1,2,3], 0
                                              -false
                                              -
                                              -
                                              - - Source -

                                              unzip(list) @@ -431,15 +434,15 @@

                                              Examples

                                              Examples

                                              -
                                              iex> List.unzip [{1, 2}, {3, 4}]
                                              +
                                              iex> List.unzip([{1, 2}, {3, 4}])
                                               [[1, 3], [2, 4]]
                                               
                                              -iex> List.unzip [{1, :a, "apple"}, {2, :b, "banana"}, {3, :c}]
                                              +iex> List.unzip([{1, :a, "apple"}, {2, :b, "banana"}, {3, :c}])
                                               [[1, 2, 3], [:a, :b, :c]]
                                               
                                              - Source + Source

                                              @@ -451,12 +454,12 @@

                                              Examples

                                              Examples

                                              -
                                              iex> List.wrap [1,2,3]
                                              +
                                              iex> List.wrap([1,2,3])
                                               [1,2,3]
                                               
                                              - Source + Source

                                              @@ -466,15 +469,15 @@

                                              Examples

                                              Examples

                                              -
                                              iex> List.zip [[1, 2], [3, 4], [5, 6]]
                                              +
                                              iex> List.zip([[1, 2], [3, 4], [5, 6]])
                                               [{1, 3, 5}, {2, 4, 6}]
                                               
                                              -iex> List.zip [[1, 2], [3], [5, 6]]
                                              +iex> List.zip([[1, 2], [3], [5, 6]])
                                               [{1, 3, 5}]
                                               
                                              - Source + Source diff --git a/docs/stable/List.Dict.html b/docs/stable/ListDict.html similarity index 61% rename from docs/stable/List.Dict.html rename to docs/stable/ListDict.html index 50e357014..8850700a9 100644 --- a/docs/stable/List.Dict.html +++ b/docs/stable/ListDict.html @@ -1,7 +1,7 @@ - List.Dict + ListDict @@ -21,7 +21,7 @@

                                              - List.Dict + ListDict

                                              @@ -35,7 +35,7 @@

                                              - Source + Source @@ -49,6 +49,11 @@

                                              Functions summary

                                              delete/2
                                            • +
                                            • + + drop/2 + +
                                            • empty/1 @@ -56,12 +61,22 @@

                                              Functions summary

                                            • - get/3 + equal?/2 + +
                                            • +
                                            • + + fetch/2 + +
                                            • +
                                            • + + fetch!/2
                                            • - get!/2 + get/3
                                            • @@ -94,6 +109,11 @@

                                              Functions summary

                                              new/2
                                            • +
                                            • + + pop/3 + +
                                            • put/3 @@ -109,6 +129,16 @@

                                              Functions summary

                                              size/1
                                            • +
                                            • + + split/2 + +
                                            • +
                                            • + + take/2 + +
                                            • to_list/1 @@ -147,36 +177,65 @@

                                              Functions

                                              Deletes the entry under the given key from the dict.

                                              - Source + Source + +
                                              +

                                              + drop(dict, keys) +

                                              +

                                              Returns a new dict with only the entries +which key is not in keys

                                              +
                                              + + Source

                                              empty(_dict)

                                              -

                                              Returns an empty List.Dict.

                                              +

                                              Returns an empty ListDict.

                                              - Source + Source
                                              -

                                              - get(dict, key, default // nil) +

                                              + equal?(dict, other) +

                                              +

                                              Check if the ListDict is equal to another ListDict.

                                              +
                                              + + Source + +
                                              +

                                              + fetch(dict, key)

                                              Returns the value under key from the given -dict or default if no key is set.

                                              +dict in a tagged tuple, otherwise :error.

                                              - Source + Source
                                              -

                                              - get!(dict, key) +

                                              + fetch!(dict, key)

                                              Returns the value under the given key raises KeyError if the key does not exist.

                                              - Source + Source + +
                                              +

                                              + get(dict, key, default // nil) +

                                              +

                                              Returns the value under key from the given +dict or default if no key is set.

                                              +
                                              + + Source

                                              @@ -185,7 +244,7 @@

                                              Functions

                                              Returns true if the dict has the given key.

                                              - Source + Source

                                              @@ -194,7 +253,7 @@

                                              Functions

                                              Returns all keys in the dict.

                                              - Source + Source

                                              @@ -203,35 +262,45 @@

                                              Functions

                                              Merges the given Enumerable into the dict.

                                              - Source + Source

                                              new()

                                              -

                                              Returns a new List.Dict, i.e. an empty list.

                                              +

                                              Returns a new ListDict, i.e. an empty list.

                                              - Source + Source

                                              new(pairs)

                                              -

                                              Creates a new List.Dict from the given pairs.

                                              +

                                              Creates a new ListDict from the given pairs.

                                              - Source + Source

                                              new(list, transform)

                                              -

                                              Creates a new List.Dict from the given pairs +

                                              Creates a new ListDict from the given pairs via the given transformation function.

                                              - Source + Source + +
                                              +

                                              + pop(dict, key, default // nil) +

                                              +

                                              Returns the value under the given key +from the dict as well as the dict without that key.

                                              +
                                              + + Source

                                              @@ -240,7 +309,7 @@

                                              Functions

                                              Puts the given key-value pair in the dict.

                                              - Source + Source

                                              @@ -250,7 +319,7 @@

                                              Functions

                                              if no entry exists yet.

                                              - Source + Source

                                              @@ -259,7 +328,29 @@

                                              Functions

                                              Returns the dict size.

                                              - Source + Source + +
                                              +

                                              + split(dict, keys) +

                                              +

                                              Splits a dict into two dicts, +one containing entries with key in the keys list, +and another containing entries with key not in keys. +Returns a 2-tuple of the new dicts.

                                              +
                                              + + Source + +
                                              +

                                              + take(dict, keys) +

                                              +

                                              Returns a new dict with only the entries +which key is in keys

                                              +
                                              + + Source

                                              @@ -268,7 +359,7 @@

                                              Functions

                                              Converts the dict to a list.

                                              - Source + Source

                                              @@ -277,7 +368,7 @@

                                              Functions

                                              Updates the key in the dict according to the given function.

                                              - Source + Source

                                              @@ -287,7 +378,7 @@

                                              Functions

                                              or uses the given initial value if no entry exists.

                                              - Source + Source

                                              @@ -296,7 +387,7 @@

                                              Functions

                                              Returns all values in the dict.

                                              - Source + Source
                                              diff --git a/docs/stable/Macro.Env.html b/docs/stable/Macro.Env.html index 862c4b00c..27170e074 100644 --- a/docs/stable/Macro.Env.html +++ b/docs/stable/Macro.Env.html @@ -49,6 +49,7 @@

                                            • requires - the list of required modules
                                            • functions - a list of functions imported from each module
                                            • macros - a list of macros imported from each module
                                            • +
                                            • context_modules - a list of modules defined in the current context
                                            @@ -116,6 +117,12 @@

                                            Fields (and defaults)

                                          • +
                                          • + + context_modules: nil + +
                                          • +
                                          @@ -161,7 +168,7 @@

                                          Functions

                                          inside a guard.

                                          - Source + Source

                                          @@ -171,7 +178,7 @@

                                          Functions

                                          inside a match clause.

                                          - Source + Source

                                          @@ -181,7 +188,7 @@

                                          Functions

                                          information as keys.

                                          - Source + Source

                                          @@ -190,7 +197,7 @@

                                          Functions

                                          Returns the environment stacktrace.

                                          - Source + Source
                                          diff --git a/docs/stable/Macro.html b/docs/stable/Macro.html index a4861ebae..4827735ee 100644 --- a/docs/stable/Macro.html +++ b/docs/stable/Macro.html @@ -231,7 +231,7 @@

                                          Examples

                                          - Source + Source

                                          @@ -266,7 +266,7 @@

                                          Examples

                                          which is returned as { :unsafe, term }.

                                          - Source + Source

                                          @@ -281,7 +281,7 @@

                                          Examples

                                          - Source + Source

                                          @@ -301,7 +301,7 @@

                                          Examples

                                          Examples

                                          -
                                          iex> Macro.unescape_binary "example\\n"
                                          +
                                          iex> Macro.unescape_binary("example\\n")
                                           "example\n"
                                           
                                          @@ -309,7 +309,7 @@

                                          Examples

                                          and we return a version with it unescaped.

                                          - Source + Source

                                          @@ -359,7 +359,7 @@

                                          Examples

                                          - Source + Source

                                          @@ -375,7 +375,7 @@

                                          Examples

                                          for examples.

                                          - Source + Source

                                          @@ -385,7 +385,7 @@

                                          Examples

                                          Check unescape_tokens/1 and unescape_binary/2 for more information.

                                          - Source + Source diff --git a/docs/stable/MatchError.html b/docs/stable/MatchError.html index 7b131b744..d13c9ad64 100644 --- a/docs/stable/MatchError.html +++ b/docs/stable/MatchError.html @@ -29,7 +29,7 @@

                                          - Source + Source @@ -71,7 +71,7 @@

                                          Functions

                                          - Source + Source diff --git a/docs/stable/Mix.Dep.html b/docs/stable/Mix.Dep.html index 7560e4255..03f1ba108 100644 --- a/docs/stable/Mix.Dep.html +++ b/docs/stable/Mix.Dep.html @@ -88,6 +88,12 @@

                                          Fields (and defaults)

                                        • +
                                        • + + deps: [] + +
                                        • +
                                        diff --git a/docs/stable/Mix.Deps.html b/docs/stable/Mix.Deps.html index 64a247905..2e4ba7d5b 100644 --- a/docs/stable/Mix.Deps.html +++ b/docs/stable/Mix.Deps.html @@ -32,7 +32,7 @@

                                        - Source + Source @@ -58,7 +58,7 @@

                                        Functions summary

                                      • - by_name!/1 + by_name/2
                                      • @@ -66,6 +66,21 @@

                                        Functions summary

                                        check_lock/2
                                      • +
                                      • + + children/0 + +
                                      • +
                                      • + + compile_paths/1 + +
                                      • +
                                      • + + depending/2 + +
                                      • format_dep/1 @@ -76,6 +91,31 @@

                                        Functions summary

                                        format_status/1
                                      • +
                                      • + + in_dependency/3 + +
                                      • +
                                      • + + in_umbrella?/2 + +
                                      • +
                                      • + + load_paths/1 + +
                                      • +
                                      • + + make?/1 + +
                                      • +
                                      • + + mix?/1 + +
                                      • ok?/1 @@ -86,6 +126,11 @@

                                        Functions summary

                                        out_of_date?/1
                                      • +
                                      • + + rebar?/1 + +
                                      • update/1 @@ -114,7 +159,7 @@

                                        Exceptions

                                        provides a dependency in the wrong format.

                                        - Source + Source

                                        @@ -124,7 +169,7 @@

                                        Exceptions

                                        accumulator.

                                        - Source + Source

                                        @@ -133,17 +178,17 @@

                                        Exceptions

                                        Check if a dependency is available.

                                        - Source + Source
                                        -

                                        - by_name!(given) +

                                        + by_name(given, all_deps // all)

                                        Receives a list of deps names and returns deps records. -Raises an error if the dependency does not exist.

                                        +Logs a message if the dependency could not be found.

                                        - Source + Source

                                        @@ -152,7 +197,34 @@

                                        Exceptions

                                        Checks the lock for the given dependency and update its status accordingly.

                                        - Source + Source + +
                                        +

                                        + children() +

                                        +

                                        Returns all direct child dependencies.

                                        +
                                        + + Source + +
                                        +

                                        + compile_paths(dep) +

                                        +

                                        Returns all compile paths for the dependency.

                                        +
                                        + + Source + +
                                        +

                                        + depending(deps, all_deps // all) +

                                        +

                                        Returns all dependencies depending on given dependencies.

                                        +
                                        + + Source

                                        @@ -161,7 +233,7 @@

                                        Exceptions

                                        Format the dependency for printing.

                                        - Source + Source

                                        @@ -170,7 +242,54 @@

                                        Exceptions

                                        Formats the status of a dependency.

                                        - Source + Source + +
                                        +

                                        + in_dependency(arg1, post_config // [], fun) +

                                        +

                                        Runs the given fun inside the given dependency project by +changing the current working directory and loading the given +project into the project stack.

                                        +
                                        + + Source + +
                                        +

                                        + in_umbrella?(arg1, apps_path) +

                                        +

                                        Check if a dependency is part of an umbrella project as a top level project.

                                        +
                                        + + Source + +
                                        +

                                        + load_paths(dep) +

                                        +

                                        Returns all load paths for the dependency.

                                        +
                                        + + Source + +
                                        +

                                        + make?(dep) +

                                        +

                                        Returns true if dependency is a make project.

                                        +
                                        + + Source + +
                                        +

                                        + mix?(dep) +

                                        +

                                        Returns true if dependency is a mix project.

                                        +
                                        + + Source

                                        @@ -179,7 +298,7 @@

                                        Exceptions

                                        Check if a dependency is ok.

                                        - Source + Source

                                        @@ -190,7 +309,16 @@

                                        Exceptions

                                        invoking this function.

                                        - Source + Source + +
                                        +

                                        + rebar?(dep) +

                                        +

                                        Returns true if dependency is a rebar project.

                                        +
                                        + + Source

                                        @@ -199,7 +327,7 @@

                                        Exceptions

                                        Updates the dependency inside the given project.

                                        - Source + Source
                                        diff --git a/docs/stable/Mix.Local.html b/docs/stable/Mix.Local.html index 57d56bb0a..db5a09937 100644 --- a/docs/stable/Mix.Local.html +++ b/docs/stable/Mix.Local.html @@ -46,6 +46,11 @@

                                        Functions summary

                                        all_tasks/0
                                      • +
                                      • + + append_paths/0 + +
                                      • append_tasks/0 @@ -74,6 +79,15 @@

                                        Functions

                                        Returns all tasks modules in .mix/tasks.

                                        + Source + +
                                        +

                                        + append_paths() +

                                        +

                                        Append mix paths into Erlang code path.

                                        +
                                        + Source
                                        diff --git a/docs/stable/Mix.Project.html b/docs/stable/Mix.Project.html index 9b747e353..c11a11286 100644 --- a/docs/stable/Mix.Project.html +++ b/docs/stable/Mix.Project.html @@ -71,6 +71,16 @@

                                        Examples

                                        Functions summary

                                        @@ -107,6 +137,24 @@

                                        Functions summary

                                        Functions

                                        +

                                        + apps_path() +

                                        +

                                        Returns the path to the apps directory.

                                        +
                                        + + Source + +
                                        +

                                        + compile_paths() +

                                        +

                                        Returns the paths this project compiles to.

                                        +
                                        + + Source + +

                                        config()

                                        @@ -151,6 +199,40 @@

                                        Functions

                                        Source +
                                        +

                                        + in_project(app, app_path, post_config // [], fun) +

                                        +

                                        Runs the given fun inside the given project by changing +the current working directory and loading the given project +into the project stack.

                                        +
                                        + + Source + +
                                        +

                                        + load_paths() +

                                        +

                                        Returns all load paths for this project.

                                        +
                                        + + Source + +
                                        +

                                        + recur(fun) +

                                        +

                                        Runs fun in the current project.

                                        + +

                                        The goal of this function is to transparently abstract umbrella projects. +So if you want to gather data from a project, like beam files, you can +use this function to transparently go through the project, regardless +if it is an umbrella project or not.

                                        +
                                        + + Source +

                                        refresh() @@ -161,6 +243,15 @@

                                        Functions

                                        Source +
                                        +

                                        + umbrella?() +

                                        +

                                        Returns true if project is an umbrella project.

                                        +
                                        + + Source +
                                        diff --git a/docs/stable/Mix.Shell.IO.html b/docs/stable/Mix.Shell.IO.html index ece26e7a9..000fdca99 100644 --- a/docs/stable/Mix.Shell.IO.html +++ b/docs/stable/Mix.Shell.IO.html @@ -57,6 +57,11 @@

                                        Functions summary

                                        info/1
                                      • +
                                      • + + put_app/0 + +
                                      • yes?/1 @@ -90,7 +95,7 @@

                                        Functions

                                        Writes an error message to the shell followed by new line.

                                        - Source + Source

                                        @@ -99,7 +104,15 @@

                                        Functions

                                        Writes a message to the shell followed by new line.

                                        - Source + Source + +
                                        +

                                        + put_app() +

                                        +
                                        + + Source

                                        @@ -110,7 +123,7 @@

                                        Functions

                                        regex %r/^Y(es)?$/i.

                                        - Source + Source diff --git a/docs/stable/Mix.Shell.Process.html b/docs/stable/Mix.Shell.Process.html index 65188eed2..d1ee79352 100644 --- a/docs/stable/Mix.Shell.Process.html +++ b/docs/stable/Mix.Shell.Process.html @@ -74,6 +74,11 @@

                                        Functions summary

                                        info/1
                                      • +
                                      • + + put_app/0 + +
                                      • yes?/1 @@ -107,7 +112,7 @@

                                        Functions

                                        Simply forwards the message to the current process.

                                        - Source + Source

                                        @@ -131,7 +136,15 @@

                                        Examples

                                        Simply forwards the message to the current process.

                                        - Source + Source + +
                                        +

                                        + put_app() +

                                        +
                                        + + Source

                                        @@ -147,7 +160,7 @@

                                        Examples

                                        process input given. Value must be true or false.

                                        - Source + Source diff --git a/docs/stable/Mix.Shell.html b/docs/stable/Mix.Shell.html index 5149dc237..79783e409 100644 --- a/docs/stable/Mix.Shell.html +++ b/docs/stable/Mix.Shell.html @@ -48,6 +48,11 @@

                                        Functions summary

                                        cmd/2
                                      • +
                                      • + + output_app?/0 + +
                                      @@ -92,7 +97,16 @@

                                      Functions

                                      is shared accross different shells.

                                      - Source + Source + +
                                      +

                                      + output_app?() +

                                      +

                                      Returns if we should output application name to shell.

                                      +
                                      + + Source
                                      diff --git a/docs/stable/Mix.Task.html b/docs/stable/Mix.Task.html index 1d804212a..c56cd9c7f 100644 --- a/docs/stable/Mix.Task.html +++ b/docs/stable/Mix.Task.html @@ -73,6 +73,11 @@

                                      Functions summary

                                      moduledoc/1
                                    • +
                                    • + + recursive?/1 + +
                                    • reenable/1 @@ -132,7 +137,7 @@

                                      Functions

                                      Returns an ordset with all the tasks invoked thus far.

                                      - Source + Source

                                      @@ -148,7 +153,7 @@

                                      Exceptions

                                    - Source + Source

                                    @@ -178,14 +183,24 @@

                                    Exceptions

                                    Source +
                                    +

                                    + recursive?(module) +

                                    +

                                    Checks if the task is defined for umbrella projects.

                                    +
                                    + + Source +

                                    reenable(task)

                                    -

                                    Reenables a given task so it can be executed again down the stack.

                                    +

                                    Reenables a given task so it can be executed again down the stack. If +an umbrella project reenables a task it is reenabled for all sub projects.

                                    - Source + Source

                                    @@ -202,7 +217,7 @@

                                    Exceptions

                                    or it is invalid. Check get/2 for more information.

                                    - Source + Source

                                    @@ -221,7 +236,7 @@

                                    Exceptions

                                    Returns the task name for the given module.

                                    - Source + Source
                                    diff --git a/docs/stable/Mix.Tasks.App.Start.html b/docs/stable/Mix.Tasks.App.Start.html index db8f1d39e..159725882 100644 --- a/docs/stable/Mix.Tasks.App.Start.html +++ b/docs/stable/Mix.Tasks.App.Start.html @@ -71,7 +71,7 @@

                                    Functions

                                    - Source + Source diff --git a/docs/stable/Mix.Tasks.Clean.html b/docs/stable/Mix.Tasks.Clean.html index 3b736c4f1..740571f0f 100644 --- a/docs/stable/Mix.Tasks.Clean.html +++ b/docs/stable/Mix.Tasks.Clean.html @@ -69,7 +69,7 @@

                                    Functions

                                    - Source + Source diff --git a/docs/stable/Mix.Tasks.Compile.App.html b/docs/stable/Mix.Tasks.Compile.App.html index 3ceecb851..926eb51b7 100644 --- a/docs/stable/Mix.Tasks.Compile.App.html +++ b/docs/stable/Mix.Tasks.Compile.App.html @@ -87,7 +87,7 @@

                                    Functions

                                    - Source + Source diff --git a/docs/stable/Mix.Tasks.Compile.Elixir.html b/docs/stable/Mix.Tasks.Compile.Elixir.html index dd474a0b5..6f99f721e 100644 --- a/docs/stable/Mix.Tasks.Compile.Elixir.html +++ b/docs/stable/Mix.Tasks.Compile.Elixir.html @@ -68,7 +68,7 @@

                                    Configuration

                                    behaviour as Elixir

                                      -
                                    • :compile_exts - extensions to compile whenever there +
                                    • :elixirc_exts - extensions to compile whenever there is a change:
                                    @@ -76,7 +76,7 @@

                                    Configuration

                                    * :watch_exts - extensions to watch in order to trigger a compilation:

                                    -

                                    [watch_exts: [:ex, :eex]]

                                  • +

                                    [elixircwatchexts: [:ex, :eex]]

                                  @@ -113,7 +113,7 @@

                                  Functions

                                  - Source + Source diff --git a/docs/stable/Mix.Tasks.Compile.Erlang.html b/docs/stable/Mix.Tasks.Compile.Erlang.html index eea51104f..d0e567aa0 100644 --- a/docs/stable/Mix.Tasks.Compile.Erlang.html +++ b/docs/stable/Mix.Tasks.Compile.Erlang.html @@ -123,7 +123,7 @@

                                  Functions

                                  extension.

                                  - Source + Source

                                  @@ -132,7 +132,7 @@

                                  Functions

                                  Interprets compilation results and prints them to the console.

                                  - Source + Source

                                  @@ -150,7 +150,7 @@

                                  Functions

                                  Erlang compilation tools.

                                  - Source + Source diff --git a/docs/stable/Mix.Tasks.Compile.Leex.html b/docs/stable/Mix.Tasks.Compile.Leex.html index 2c92de341..f10cb3b35 100644 --- a/docs/stable/Mix.Tasks.Compile.Leex.html +++ b/docs/stable/Mix.Tasks.Compile.Leex.html @@ -87,7 +87,7 @@

                                  Functions

                                  - Source + Source diff --git a/docs/stable/Mix.Tasks.Compile.Yecc.html b/docs/stable/Mix.Tasks.Compile.Yecc.html index 5c4cad9a0..81a7d285e 100644 --- a/docs/stable/Mix.Tasks.Compile.Yecc.html +++ b/docs/stable/Mix.Tasks.Compile.Yecc.html @@ -87,7 +87,7 @@

                                  Functions

                                  - Source + Source diff --git a/docs/stable/Mix.Tasks.Compile.html b/docs/stable/Mix.Tasks.Compile.html index f768cc94a..2c374684e 100644 --- a/docs/stable/Mix.Tasks.Compile.html +++ b/docs/stable/Mix.Tasks.Compile.html @@ -97,7 +97,7 @@

                                  Functions

                                  - Source + Source diff --git a/docs/stable/Mix.Tasks.Deps.Check.html b/docs/stable/Mix.Tasks.Deps.Check.html index f1ba5b0da..4b74d4f5c 100644 --- a/docs/stable/Mix.Tasks.Deps.Check.html +++ b/docs/stable/Mix.Tasks.Deps.Check.html @@ -67,7 +67,7 @@

                                  Functions

                                  - Source + Source diff --git a/docs/stable/Mix.Tasks.Deps.Clean.html b/docs/stable/Mix.Tasks.Deps.Clean.html index e412ab513..98c8a14d8 100644 --- a/docs/stable/Mix.Tasks.Deps.Clean.html +++ b/docs/stable/Mix.Tasks.Deps.Clean.html @@ -67,7 +67,7 @@

                                  Functions

                                  - Source + Source diff --git a/docs/stable/Mix.Tasks.Deps.Compile.html b/docs/stable/Mix.Tasks.Deps.Compile.html index d73f9cf5c..409e067ab 100644 --- a/docs/stable/Mix.Tasks.Deps.Compile.html +++ b/docs/stable/Mix.Tasks.Deps.Compile.html @@ -81,7 +81,7 @@

                                  Functions

                                  - Source + Source diff --git a/docs/stable/Mix.Tasks.Deps.Get.html b/docs/stable/Mix.Tasks.Deps.Get.html index ec3a23176..9eede311b 100644 --- a/docs/stable/Mix.Tasks.Deps.Get.html +++ b/docs/stable/Mix.Tasks.Deps.Get.html @@ -33,7 +33,8 @@

                                  Command line options

                                    -
                                  • --no-compile skip compilation of dependencies
                                  • +
                                  • --no-compile - skip compilation of dependencies
                                  • +
                                  • --quiet - do not output success message
                                  @@ -70,7 +71,7 @@

                                  Functions

                                  - Source + Source diff --git a/docs/stable/Mix.Tasks.Deps.Loadpaths.html b/docs/stable/Mix.Tasks.Deps.Loadpaths.html index a127bb3c8..cf1c12e35 100644 --- a/docs/stable/Mix.Tasks.Deps.Loadpaths.html +++ b/docs/stable/Mix.Tasks.Deps.Loadpaths.html @@ -64,7 +64,7 @@

                                  Functions

                                  - Source + Source diff --git a/docs/stable/Mix.Tasks.Deps.Unlock.html b/docs/stable/Mix.Tasks.Deps.Unlock.html index c8ec9f6e9..29556f4e2 100644 --- a/docs/stable/Mix.Tasks.Deps.Unlock.html +++ b/docs/stable/Mix.Tasks.Deps.Unlock.html @@ -64,7 +64,7 @@

                                  Functions

                                  - Source + Source diff --git a/docs/stable/Mix.Tasks.Deps.Update.html b/docs/stable/Mix.Tasks.Deps.Update.html index 5e741da03..4a15bb461 100644 --- a/docs/stable/Mix.Tasks.Deps.Update.html +++ b/docs/stable/Mix.Tasks.Deps.Update.html @@ -36,7 +36,7 @@

                                  Command line options

                                    -
                                  • --no-compile skip compilation of dependencies
                                  • +
                                  • --no-compile - skip compilation of dependencies
                                  @@ -73,7 +73,7 @@

                                  Functions

                                  - Source + Source diff --git a/docs/stable/Mix.Tasks.Deps.html b/docs/stable/Mix.Tasks.Deps.html index 62059709f..628eaca8f 100644 --- a/docs/stable/Mix.Tasks.Deps.html +++ b/docs/stable/Mix.Tasks.Deps.html @@ -70,7 +70,7 @@

                                  Functions

                                  - Source + Source diff --git a/docs/stable/Mix.Tasks.Loadpaths.html b/docs/stable/Mix.Tasks.Loadpaths.html index d36615647..bc7b95827 100644 --- a/docs/stable/Mix.Tasks.Loadpaths.html +++ b/docs/stable/Mix.Tasks.Loadpaths.html @@ -29,9 +29,6 @@

                                  Load the application and its dependencies paths.

                                  -

                                  This task is not shown in mix help but it is part -of mix public API and can be depended on.

                                  -

                                  Configuration

                                  diff --git a/docs/stable/Mix.Tasks.Local.Install.html b/docs/stable/Mix.Tasks.Local.Install.html index 83eec4cc6..6e0346f2a 100644 --- a/docs/stable/Mix.Tasks.Local.Install.html +++ b/docs/stable/Mix.Tasks.Local.Install.html @@ -74,7 +74,7 @@

                                  Functions

                                  - Source + Source diff --git a/docs/stable/IEx.Remsh.html b/docs/stable/Mix.Tasks.Local.Rebar.html similarity index 52% rename from docs/stable/IEx.Remsh.html rename to docs/stable/Mix.Tasks.Local.Rebar.html index 65dd784a1..d331b0d3e 100644 --- a/docs/stable/IEx.Remsh.html +++ b/docs/stable/Mix.Tasks.Local.Rebar.html @@ -1,7 +1,7 @@ - IEx.Remsh + Mix.Tasks.Local.Rebar @@ -21,31 +21,22 @@

                                  - IEx.Remsh + Mix.Tasks.Local.Rebar

                                  -

                                  Helper function injected into connecting remote nodes -to properly handle autocompletion. Elixir supports:

                                  +

                                  Fetch a copy of rebar from the given path or url, defaulting to +https://github.com/downloads/basho/rebar/rebar if no parameter +given. The local copy is stored in your MIX_HOME (defaults to ~/.mix).

                                  -
                                    -
                                  • remsh from an elixir node to an elixir node
                                  • -
                                  • remsh from a plain erlang node to an elixir node (through the ^G menu)
                                  • -
                                  • remsh from an elixir node to a plain erlang node (and get an erl shell there)
                                  • -
                                  - -

                                  In order to get an Elixir shell from the ^G menu, -you need to use 'Elixir-IEx' as the shell name.

                                  - -

                                  Connecting an Elixir shell to a remote node without -Elixir is not supported.

                                  +

                                  This version of rebar will be used as required by mix deps.compile

                                  - Source + Source @@ -56,7 +47,12 @@

                                  Functions summary

                                  • - expand/1 + local_rebar_path/0 + +
                                  • +
                                  • + + run/1
                                  • @@ -71,12 +67,21 @@

                                    Functions summary

                                    Functions

                                    -

                                    - expand(node) +

                                    + local_rebar_path() +

                                    +

                                    Return the path to the local copy of rebar. Used when building deps

                                    +
                                    + + Source + +
                                    +

                                    + run(argv)

                                    - Source + Source
                                    diff --git a/docs/stable/Mix.Tasks.New.html b/docs/stable/Mix.Tasks.New.html index cf968fa29..ccbe544c5 100644 --- a/docs/stable/Mix.Tasks.New.html +++ b/docs/stable/Mix.Tasks.New.html @@ -30,18 +30,20 @@

                                    Creates a new Elixir project. It expects the path of the project as argument.

                                    -
                                    mix new PATH [--sup] [--app APP] [--module MODULE]
                                    +
                                    mix new PATH [--sup] [--module MODULE] [--umbrella]
                                     

                                    A project at the given PATH will be created. The application name and module name will be retrieved -from the path, unless one of -app or --module -is given.

                                    +from the path, unless --module is given.

                                    -

                                    An --sup option can be given to generate an +

                                    A --sup option can be given to generate an app with a supervisor and an application module that starts the supervisor.

                                    +

                                    An --umbrella option can be given to generate an +umbrella project.

                                    +

                                    Examples

                                    mix new hello_world
                                    @@ -49,7 +51,7 @@ 

                                    Examples

                                    Is equivalent to:

                                    -
                                    mix new hello_world --app hello_world --module HelloWorld
                                    +
                                    mix new hello_world --module HelloWorld
                                     

                                    To generate an app with supervisor and application behaviours:

                                    @@ -91,7 +93,7 @@

                                    Functions

                                    - Source + Source

                                  diff --git a/docs/stable/Mix.Tasks.Run.html b/docs/stable/Mix.Tasks.Run.html index a74524ef8..14977ee0c 100644 --- a/docs/stable/Mix.Tasks.Run.html +++ b/docs/stable/Mix.Tasks.Run.html @@ -29,14 +29,14 @@

                                  Run the given expression in the application context.

                                  -

                                  Before running the code, it invokes the prepare task +

                                  Before running the code, it invokes the app.start task which defaults to compile and load your project.

                                  Command line options

                                    -
                                  • --require, -r - Requires a file before running the command
                                  • -
                                  • --parallel-require, -pr - Requires a file in parallel
                                  • +
                                  • --require, -r - Requires pattern before running the command
                                  • +
                                  • --parallel-require, -pr - Requires pattern in parallel
                                  • --no-halt - Does not halt the system after running the command
                                  • --no-compile - Do not compile even if files require compilation;
                                  • --no-start - Do not start applications after compilation;
                                  • @@ -46,6 +46,11 @@

                                    Examples

                                    mix run Hello.world
                                     mix run "Some.function with_args"
                                    +
                                    + +

                                    Command line options given to the elixir executable can be passed as:

                                    + +
                                    elixir --sname hello -S mix run "My.code"
                                     
                                  @@ -82,7 +87,7 @@

                                  Functions

                                  - Source + Source diff --git a/docs/stable/Mix.Tasks.Test.html b/docs/stable/Mix.Tasks.Test.html index a55052d07..7b3931837 100644 --- a/docs/stable/Mix.Tasks.Test.html +++ b/docs/stable/Mix.Tasks.Test.html @@ -96,7 +96,7 @@

                                  Functions

                                  - Source + Source diff --git a/docs/stable/Mix.Utils.html b/docs/stable/Mix.Utils.html index 870687313..681608363 100644 --- a/docs/stable/Mix.Utils.html +++ b/docs/stable/Mix.Utils.html @@ -82,11 +82,21 @@

                                  Functions summary

                                  extract_stale/2
                                • +
                                • + + manifest/2 + +
                                • mix_home/0
                                • +
                                • + + mix_path/0 + +
                                • module_name_to_command/2 @@ -94,7 +104,7 @@

                                  Functions summary

                                • - preserving_mtime/2 + read_path/1
                                • @@ -140,7 +150,7 @@

                                  Examples

                                  - Source + Source

                                  @@ -160,7 +170,7 @@

                                  Examples

                                  - Source + Source

                                  @@ -175,7 +185,7 @@

                                  Examples

                                  - Source + Source

                                  @@ -185,7 +195,7 @@

                                  Examples

                                  and concatenating normal lists.

                                  - Source + Source

                                  @@ -198,7 +208,7 @@

                                  Examples

                                  When looking up directories, files starting with "." are ignored.

                                  - Source + Source

                                  @@ -207,7 +217,20 @@

                                  Examples

                                  Extract all stale sources compared to the given targets.

                                  - Source + Source + +
                                  +

                                  + manifest(file, fun) +

                                  +

                                  Generates a manifest containing all files generated +during a given compilation step. It receives the manifest +file name and a function to execute. The result of the +function is compared to the manifest in order do detect +the files removed from the manifest file.

                                  +
                                  + + Source

                                  @@ -219,6 +242,18 @@

                                  Examples

                                  Source +
                                  +

                                  + mix_path() +

                                  +

                                  Gets all extra paths defined in the environment variable +MIXPATH. MIXPATH may contain multiple paths. If on windows, +those paths should be separated by ;, if on unix systems, +use :.

                                  +
                                  + + Source +

                                  module_name_to_command(module, nesting // 0) @@ -237,17 +272,17 @@

                                  Examples

                                  - Source + Source
                                  -

                                  - preserving_mtime(path, fun) +

                                  + read_path(path)

                                  -

                                  Executes a function but preserves the given path mtime -properties.

                                  +

                                  Opens and reads content from either a URL or a local filesystem path. +Used by local.install and local.rebar.

                                  - Source + Source

                                  @@ -257,7 +292,7 @@

                                  Examples

                                  working directory.

                                  - Source + Source

                                  @@ -266,7 +301,7 @@

                                  Examples

                                  Gets the source location of a module as a binary.

                                  - Source + Source

                                  @@ -276,7 +311,7 @@

                                  Examples

                                  compared to the given target.

                                  - Source + Source

                                  @@ -302,7 +337,7 @@

                                  Examples

                                  - Source + Source diff --git a/docs/stable/Module.html b/docs/stable/Module.html index be531269a..63dc2152d 100644 --- a/docs/stable/Module.html +++ b/docs/stable/Module.html @@ -189,11 +189,11 @@

                                  Examples

                                  Examples

                                  -
                                  iex> Module.concat [Foo, Bar]
                                  +
                                  iex> Module.concat([Foo, Bar])
                                   Foo.Bar
                                  -iex> Module.concat [Foo, "Bar"]
                                  +iex> Module.concat([Foo, "Bar"])
                                   Foo.Bar
                                  -iex> Module.concat [Foo, 'Bar']
                                  +iex> Module.concat([Foo, 'Bar'])
                                   Foo.Bar
                                   
                                  @@ -209,11 +209,11 @@

                                  Examples

                                  Examples

                                  -
                                  iex> Module.concat Foo, Bar
                                  +
                                  iex> Module.concat(Foo, Bar)
                                   Foo.Bar
                                  -iex> Module.concat Foo, "Bar"
                                  +iex> Module.concat(Foo, "Bar")
                                   Foo.Bar
                                  -iex> Module.concat Foo, 'Bar'
                                  +iex> Module.concat(Foo, 'Bar')
                                   Foo.Bar
                                   
                                  @@ -355,7 +355,7 @@

                                  Examples

                                  Evalutes the quotes contents in the given module context.

                                  A list of environment options can also be given as argument. -Check Code.eval for more information.

                                  +Check Code.eval_string for more information.

                                  Raises an error if the module was already compiled.

                                  @@ -505,10 +505,10 @@

                                  Examples

                                  Examples

                                  -
                                  iex> Module.safe_concat [Unknown, Module]
                                  +
                                  iex> Module.safe_concat([Unknown, Module])
                                   ** (ArgumentError) argument error
                                   
                                  -iex> Module.safe_concat [List, Chars]
                                  +iex> Module.safe_concat([List, Chars])
                                   List.Chars
                                   
                                  @@ -526,10 +526,10 @@

                                  Examples

                                  Examples

                                  -
                                  iex> Module.safe_concat Unknown, Module
                                  +
                                  iex> Module.safe_concat(Unknown, Module)
                                   ** (ArgumentError) argument error
                                   
                                  -iex> Module.safe_concat List, Chars
                                  +iex> Module.safe_concat(List, Chars)
                                   List.Chars
                                   
                                  diff --git a/docs/stable/Node.html b/docs/stable/Node.html index a65dc48d5..83b717590 100644 --- a/docs/stable/Node.html +++ b/docs/stable/Node.html @@ -56,6 +56,11 @@

                                  Functions summary

                                  disconnect/1
                                • +
                                • + + get_cookie/0 + +
                                • list/0 @@ -81,6 +86,11 @@

                                  Functions summary

                                  self/0
                                • +
                                • + + set_cookie/2 + +
                                • spawn/2 @@ -159,6 +169,16 @@

                                  Functions

                                  Source +
                                  +

                                  + get_cookie() +

                                  +

                                  Returns the magic cookie of the local node, if the node is alive; +otherwise :nocookie.

                                  +
                                  + + Source +

                                  list() @@ -215,6 +235,19 @@

                                  Functions

                                  Source +
                                  +

                                  + set_cookie(node // Node.self(), cookie) +

                                  +

                                  Sets the magic cookie of node to the atom cookie. The default node +is Node.self, the local node. If node is the local node, the function also +sets the cookie of all other unknown nodes to cookie.

                                  + +

                                  This function will raise FunctionClauseError if the given node is not alive.

                                  +
                                  + + Source +

                                  spawn(node, fun) diff --git a/docs/stable/Path.html b/docs/stable/Path.html index fd64eb9b0..34cf657f1 100644 --- a/docs/stable/Path.html +++ b/docs/stable/Path.html @@ -28,15 +28,15 @@

                                  This module provides conveniences for manipulating or -retrieving filesystem paths.

                                  +retrieving file system paths.

                                  -

                                  The functions on this module may receive a char list or -a binary as argument and will return the given type.

                                  +

                                  The functions in this module may receive a char list or +a binary as argument and will return a value of the same +type.

                                  The majority of the functions in this module do not -interact with the file system, unless some few functions -that needs to query the filesystem to retrieve paths -(like Path.wildcard and Path.expand).

                                  +interact with the file system, except for a few functions +that require it (like Path.wildcard and Path.expand).

                                  @@ -150,9 +150,8 @@

                                  Functions

                                  absname(path)

                                  -

                                  Converts the given filename and returns an absolute name. -Differently from Path.expand/1, no attempt is made to -resolve .., . or ~.

                                  +

                                  Converts the given path to an absolute one. Differently from +Path.expand/1, no attempt is made to resolve .., . or ~.

                                  Unix examples

                                  @@ -172,15 +171,14 @@

                                  Windows

                                  - Source + Source

                                  absname(path, relative_to)

                                  -

                                  Converts the given filename and returns an absolute name -relative to the given location. If the path is already -an absolute path, the relative path is ignored.

                                  +

                                  Builds a path from relative_to to path. If path is already +an absolute path, relative_to is ignored. See also Path.relative/2.

                                  Differently from Path.expand/2, no attempt is made to resolve .., . or ~.

                                  @@ -195,7 +193,7 @@

                                  Examples

                                  - Source + Source

                                  @@ -217,7 +215,7 @@

                                  Examples

                                  - Source + Source

                                  @@ -238,29 +236,31 @@

                                  Examples

                                  - Source + Source

                                  dirname(path)

                                  -

                                  Return the directory component of path.

                                  +

                                  Returns the directory component of path.

                                  Examples

                                  Path.dirname("/foo/bar.ex")
                                  -#=> "foo"
                                  +#=> "/foo"
                                  +Path.dirname("/foo/bar/baz.ex")
                                  +#=> "/foo/bar"
                                   
                                  - Source + Source

                                  expand(path)

                                  -

                                  Expands the path by returning its absolute name and expanding -any . and .. characters.

                                  +

                                  Converts the path to an absolute one and expands +any . and .. characters and a leading ~.

                                  Examples

                                  @@ -269,32 +269,41 @@

                                  Examples

                                  - Source + Source

                                  expand(path, relative_to)

                                  -

                                  Expands the path to the relative location and expanding -any . and .. characters. If the path is already an -absolute path, the relative location is ignored.

                                  +

                                  Expands the path relative to the path given as the second argument +expanding any . and .. characters. If the path is already an +absolute path, relative_to is ignored.

                                  + +

                                  Note, that this function treats path with leading ~ as +an absolute one.

                                  + +

                                  The second argument is first expanded to an absolute path.

                                  Examples

                                  -
                                  iex> Path.expand("foo/bar/../bar", "/baz")
                                  +
                                  # Assuming that the absolute path to baz is /quux/baz
                                  +Path.expand("foo/bar/../bar", "baz")
                                  +#=> "/quux/baz/foo/bar"
                                  +
                                  +iex> Path.expand("foo/bar/../bar", "/baz")
                                   "/baz/foo/bar"
                                   iex> Path.expand("/foo/bar/../bar", "/baz")
                                   "/foo/bar"
                                   
                                  - Source + Source

                                  extname(path)

                                  -

                                  Return the extension of the last component of path.

                                  +

                                  Returns the extension of the last component of path.

                                  Examples

                                  @@ -305,14 +314,14 @@

                                  Examples

                                  - Source + Source

                                  join(list1)

                                  -

                                  Returns a string with one or more paths components joint by the path separator. -This function should be used to convert a list of strings in a path.

                                  +

                                  Returns a string with one or more path components joined by the path separator. +This function should be used to convert a list of strings to a path.

                                  Examples

                                  @@ -325,7 +334,7 @@

                                  Examples

                                  - Source + Source

                                  @@ -340,7 +349,7 @@

                                  Examples

                                  - Source + Source

                                  @@ -364,15 +373,16 @@

                                  Windows examples

                                  - Source + Source

                                  relative_to(path, from)

                                  -

                                  Returns the given path relative to the given from path.

                                  +

                                  Returns the given path relative to the given from path. +In other words, it tries to strip the from prefix from path.

                                  -

                                  This function does not query the filesystem, so it assumes +

                                  This function does not query the file system, so it assumes no symlinks in between the paths.

                                  In case a direct relative path cannot be found, it returns @@ -389,7 +399,7 @@

                                  Examples

                                  - Source + Source

                                  @@ -406,7 +416,7 @@

                                  Examples

                                  - Source + Source

                                  @@ -424,14 +434,14 @@

                                  Examples

                                  - Source + Source

                                  split(path)

                                  -

                                  Returns a list with the path splitted by the path separator. -If an empty string is given, then it returns the root path.

                                  +

                                  Returns a list with the path split by the path separator. +If an empty string is given, returns the root path.

                                  Examples

                                  @@ -444,7 +454,7 @@

                                  Examples

                                  - Source + Source

                                  @@ -457,6 +467,7 @@

                                  Unix examples

                                  Path.type("/usr/local/bin")   #=> :absolute
                                   Path.type("usr/local/bin")    #=> :relative
                                   Path.type("../usr/local/bin") #=> :relative
                                  +Path.type("~/file")           #=> :relative
                                   

                                  Windows examples

                                  @@ -468,7 +479,7 @@

                                  Windows examples

                                  - Source + Source

                                  @@ -499,7 +510,7 @@

                                  Examples

                                  Imagine you have a directory called projects with three Elixir projects inside of it: elixir, ex_doc and dynamo. You can find all .beam files -inside their ebin directories all projects as follows:

                                  +inside the ebin directory of each project as follows:

                                  Path.wildcard("projects/*/ebin/**/*.beam")
                                   
                                  @@ -510,7 +521,7 @@

                                  Examples

                                  - Source + Source
                                  diff --git a/docs/stable/Process.html b/docs/stable/Process.html index 4fc6ca715..880c3a5ea 100644 --- a/docs/stable/Process.html +++ b/docs/stable/Process.html @@ -231,7 +231,7 @@

                                  Functions

                                  Deletes all items in the dictionary.

                                  - Source + Source

                                  @@ -240,7 +240,7 @@

                                  Functions

                                  Deletes the given key from the dictionary.

                                  - Source + Source

                                  @@ -253,7 +253,7 @@

                                  Functions

                                  See http://www.erlang.org/doc/man/erlang.html#demonitor-2 for more info.

                                  - Source + Source

                                  @@ -282,7 +282,7 @@

                                  Examples

                                  - Source + Source

                                  @@ -294,7 +294,7 @@

                                  Examples

                                  See http://www.erlang.org/doc/man/erlang.html#process_flag-2 for more info.

                                  - Source + Source

                                  @@ -307,7 +307,7 @@

                                  Examples

                                  See http://www.erlang.org/doc/man/erlang.html#process_flag-3 for more info.

                                  - Source + Source

                                  @@ -316,7 +316,7 @@

                                  Examples

                                  Returns all key-values in the dictionary.

                                  - Source + Source

                                  @@ -325,7 +325,7 @@

                                  Examples

                                  Returns the value for the given key.

                                  - Source + Source

                                  @@ -334,7 +334,7 @@

                                  Examples

                                  Returns all keys that have the given value.

                                  - Source + Source

                                  @@ -343,7 +343,7 @@

                                  Examples

                                  Returns the pid of the group leader for the process which evaluates the function.

                                  - Source + Source

                                  @@ -353,7 +353,7 @@

                                  Examples

                                  started from a certain shell should have another group leader than :init.

                                  - Source + Source

                                  @@ -365,7 +365,7 @@

                                  Examples

                                  See http://www.erlang.org/doc/man/erlang.html#process_info-1 for more info.

                                  - Source + Source

                                  @@ -377,7 +377,7 @@

                                  Examples

                                  See http://www.erlang.org/doc/man/erlang.html#process_info-2 for more info.

                                  - Source + Source

                                  @@ -389,7 +389,7 @@

                                  Examples

                                  See http://www.erlang.org/doc/man/erlang.html#link-1 for more info.

                                  - Source + Source

                                  @@ -405,7 +405,7 @@

                                  Examples

                                  See http://www.erlang.org/doc/man/erlang.html#processes-0 for more info.

                                  - Source + Source

                                  @@ -417,7 +417,7 @@

                                  Examples

                                  See http://www.erlang.org/doc/man/erlang.html#monitor-2 for more info.

                                  - Source + Source

                                  @@ -426,7 +426,7 @@

                                  Examples

                                  Stores the given key-value in the process dictionary.

                                  - Source + Source

                                  @@ -439,7 +439,7 @@

                                  Examples

                                  See http://www.erlang.org/doc/man/erlang.html#register-2 for more info.

                                  - Source + Source

                                  @@ -448,7 +448,7 @@

                                  Examples

                                  Returns a list of names which have been registered using register/2.

                                  - Source + Source

                                  @@ -458,7 +458,7 @@

                                  Examples

                                  It behaves exactly the same as Kernel.spawn/1.

                                  - Source + Source

                                  @@ -470,7 +470,7 @@

                                  Examples

                                  check http://www.erlang.org/doc/man/erlang.html#spawn_opt-2

                                  - Source + Source

                                  @@ -483,7 +483,7 @@

                                  Examples

                                  It behaves exactly the same as the Kernel.spawn/3 function.

                                  - Source + Source

                                  @@ -497,7 +497,7 @@

                                  Examples

                                  check http://www.erlang.org/doc/man/erlang.html#spawn_opt-4

                                  - Source + Source

                                  @@ -508,7 +508,7 @@

                                  Examples

                                  process, atomically.

                                  - Source + Source

                                  @@ -519,7 +519,7 @@

                                  Examples

                                  and the new process, atomically. Otherwise works like spawn/3.

                                  - Source + Source

                                  @@ -529,7 +529,7 @@

                                  Examples

                                  and reference for a monitor created to the new process.

                                  - Source + Source

                                  @@ -540,7 +540,7 @@

                                  Examples

                                  reference for the monitor. Otherwise works like spawn/3.

                                  - Source + Source

                                  @@ -553,7 +553,7 @@

                                  Examples

                                  See http://www.erlang.org/doc/man/erlang.html#unlink-1 for more info.

                                  - Source + Source

                                  @@ -564,7 +564,7 @@

                                  Examples

                                  See http://www.erlang.org/doc/man/erlang.html#unregister-1 for more info.

                                  - Source + Source

                                  @@ -576,7 +576,7 @@

                                  Examples

                                  See http://www.erlang.org/doc/man/erlang.html#whereis-1 for more info.

                                  - Source + Source diff --git a/docs/stable/Protocol.UndefinedError.html b/docs/stable/Protocol.UndefinedError.html index 918c910d5..0c7a6f389 100644 --- a/docs/stable/Protocol.UndefinedError.html +++ b/docs/stable/Protocol.UndefinedError.html @@ -29,7 +29,7 @@

                                  - Source + Source @@ -77,7 +77,7 @@

                                  Functions

                                  - Source + Source diff --git a/docs/stable/Range.Iterator.Number.html b/docs/stable/Range.Iterator.Number.html index a0f24e170..f2dd17804 100644 --- a/docs/stable/Range.Iterator.Number.html +++ b/docs/stable/Range.Iterator.Number.html @@ -29,7 +29,7 @@

                                  - Source + Source @@ -65,7 +65,7 @@

                                  Functions

                                  - Source + Source

                                  @@ -73,7 +73,7 @@

                                  Functions

                                  - Source + Source
                                  diff --git a/docs/stable/Record.html b/docs/stable/Record.html index 9879d03cb..74065ec48 100644 --- a/docs/stable/Record.html +++ b/docs/stable/Record.html @@ -109,7 +109,7 @@

                                  Examples

                                  - Source + Source

                                  @@ -127,7 +127,7 @@

                                  Examples

                                  - Source + Source

                                  @@ -151,7 +151,7 @@

                                  Examples

                                  so check it for more information and documentation.

                                  - Source + Source

                                  @@ -160,7 +160,7 @@

                                  Examples

                                  Defines types and specs for the record.

                                  - Source + Source

                                  @@ -205,7 +205,7 @@

                                  Example

                                  end

                                  - Source + Source diff --git a/docs/stable/Regex.html b/docs/stable/Regex.html index 755416c60..16f020d52 100644 --- a/docs/stable/Regex.html +++ b/docs/stable/Regex.html @@ -171,12 +171,12 @@

                                  Functions

                                  Examples

                                  -
                                  iex> Regex.captures %r/c(?<foo>d)/g, "abcd"
                                  +
                                  iex> Regex.captures(%r/c(?<foo>d)/g, "abcd")
                                   [foo: "d"]
                                   
                                  - Source + Source

                                  @@ -208,12 +208,12 @@

                                  Examples

                                  Examples

                                  -
                                  iex> Regex.groups %r/(?<foo>foo)/g
                                  +
                                  iex> Regex.groups(%r/(?<foo>foo)/g)
                                   [:foo]
                                   
                                  - Source + Source

                                  @@ -225,9 +225,9 @@

                                  Examples

                                  Examples

                                  -
                                  iex> Regex.index %r/c(d)/, "abcd"
                                  +
                                  iex> Regex.index(%r/c(d)/, "abcd")
                                   2
                                  -iex> Regex.index %r/e/, "abcd"
                                  +iex> Regex.index(%r/e/, "abcd")
                                   nil
                                   
                                  @@ -242,9 +242,9 @@

                                  Examples

                                  Examples

                                  -
                                  iex> Regex.match? %r/foo/, "foo"
                                  +
                                  iex> Regex.match?(%r/foo/, "foo")
                                   true
                                  -iex> Regex.match? %r/foo/, "bar"
                                  +iex> Regex.match?(%r/foo/, "bar")
                                   false
                                   
                                  @@ -259,12 +259,12 @@

                                  Examples

                                  Examples

                                  -
                                  iex> Regex.opts %r(foo)m
                                  +
                                  iex> Regex.opts(%r(foo)m)
                                   "m"
                                   
                                  - Source + Source

                                  @@ -273,7 +273,7 @@

                                  Examples

                                  Returns the underlying re_pattern in the regular expression.

                                  - Source + Source

                                  @@ -302,25 +302,26 @@

                                  Examples

                                  - Source + Source

                                  run(regex, string, options // [])

                                  Runs the regular expression against the given string. -It returns a list with all matches or nil if no match ocurred.

                                  +It returns a list with all matches, nil if no match ocurred, or [] +if it matched, /g was specified, but nothing was captured.

                                  Examples

                                  -
                                  iex> Regex.run %r/c(d)/, "abcd"
                                  +
                                  iex> Regex.run(%r/c(d)/, "abcd")
                                   ["cd", "d"]
                                  -iex> Regex.run %r/e/, "abcd"
                                  +iex> Regex.run(%r/e/, "abcd")
                                   nil
                                   
                                  - Source + Source

                                  @@ -333,16 +334,16 @@

                                  Examples

                                  Examples

                                  -
                                  iex> Regex.scan %r/c(d|e)/, "abcd abce"
                                  +
                                  iex> Regex.scan(%r/c(d|e)/, "abcd abce")
                                   [["d"], ["e"]]
                                  -iex> Regex.scan %r/c(?:d|e)/, "abcd abce"
                                  +iex> Regex.scan(%r/c(?:d|e)/, "abcd abce")
                                   ["cd", "ce"]
                                  -iex> Regex.scan %r/e/, "abcd"
                                  +iex> Regex.scan(%r/e/, "abcd")
                                   []
                                   
                                  - Source + Source

                                  @@ -352,12 +353,12 @@

                                  Examples

                                  Examples

                                  -
                                  iex> Regex.source %r(foo)
                                  +
                                  iex> Regex.source(%r(foo))
                                   "foo"
                                   
                                  - Source + Source

                                  @@ -367,7 +368,7 @@

                                  Examples

                                  If no ammount of parts is given, it defaults to :infinity.

                                  - Source + Source diff --git a/docs/stable/RuntimeError.html b/docs/stable/RuntimeError.html index e577fdb95..d2f858b30 100644 --- a/docs/stable/RuntimeError.html +++ b/docs/stable/RuntimeError.html @@ -29,7 +29,7 @@

                                  - Source + Source diff --git a/docs/stable/String.html b/docs/stable/String.html index f277b9503..73051ca2d 100644 --- a/docs/stable/String.html +++ b/docs/stable/String.html @@ -93,7 +93,7 @@

                                  Integer codepoints

                                  Although codepoints could be represented as integers, this module represents all codepoints as strings. For example:

                                  -
                                  iex> String.codepoints "josé"
                                  +
                                  iex> String.codepoints("josé")
                                   ["j", "o", "s", "é"]
                                   
                                  @@ -258,11 +258,31 @@

                                  Functions summary

                                  strip/2
                                • +
                                • + + to_float/1 + +
                                • +
                                • + + to_integer/1 + +
                                • upcase/1
                                • +
                                • + + valid?/1 + +
                                • +
                                • + + valid_character?/1 + +
                                • valid_codepoint?/1 @@ -301,7 +321,7 @@

                                  Examples

                                  - Source + Source

                                  @@ -387,7 +407,8 @@

                                  Examples

                                  first(string)

                                  -

                                  Returns the first grapheme from an utf8 string.

                                  +

                                  Returns the first grapheme from an utf8 string, +nil if the string is empty.

                                  Examples

                                  @@ -398,7 +419,7 @@

                                  Examples

                                  - Source + Source

                                  @@ -413,13 +434,14 @@

                                  Examples

                                  - Source + Source

                                  last(string)

                                  -

                                  Returns the last grapheme from an utf8 string.

                                  +

                                  Returns the last grapheme from an utf8 string, +nil if the string is empty.

                                  Examples

                                  @@ -430,7 +452,7 @@

                                  Examples

                                  - Source + Source

                                  @@ -447,7 +469,7 @@

                                  Examples

                                  - Source + Source

                                  @@ -521,7 +543,7 @@

                                  Examples

                                  - Source + Source

                                  @@ -619,27 +641,23 @@

                                  Examples

                                  "ixir" iex> String.slice("elixir", -10, 3) nil +iex> String.slice("a", 0, 1500) +"a" +iex> String.slice("a", 1, 1500) +"" +iex> String.slice("a", 2, 1500) +nil
                                  - Source + Source

                                  split(binary)

                                  -

                                  Divides a string into sub string based on a pattern, -returning a list of these sub string. The pattern can -be a string, a list of strings or a regular expression.

                                  - -

                                  The string is split into as many parts as possible by -default, unless the global option is set to false. -If a pattern is not specified, the string is split on -Unicode whitespace occurrences with leading and trailing -whitespace ignored.

                                  - -

                                  It returns a list with the original string if the pattern -can't be matched.

                                  +

                                  Splits a string on sub strings at each Unicode whitespace +occurrence with leading and trailing whitespace ignored.

                                  Examples

                                  @@ -649,8 +667,25 @@

                                  Examples

                                  ["foo", "bar"] iex> String.split(" foo bar ") ["foo", "bar"] + +
                                  + + Source + +
                                  +

                                  + split(binary, pattern, options // []) +

                                  +

                                  Divides a string into sub strings based on a pattern, +returning a list of these sub string. The pattern can +be a string, a list of strings or a regular expression.

                                  -iex> String.split("a,b,c", ",") +

                                  The string is split into as many parts as possible by +default, unless the global option is set to false.

                                  + +

                                  Examples

                                  + +
                                  iex> String.split("a,b,c", ",")
                                   ["a", "b", "c"]
                                   iex> String.split("a,b,c", ",", global: false)
                                   ["a", "b,c"]
                                  @@ -667,14 +702,6 @@ 

                                  Examples

                                  - Source - -
                                  -

                                  - split(binary, pattern, options // []) -

                                  -
                                  - Source
                                  @@ -709,6 +736,52 @@

                                  Examples

                                  Source +
                                  +

                                  + to_float(string) +

                                  +

                                  Converts a string to a float. If successful, returns a +tuple of form {float, remainder of string}. If unsuccessful, +returns :error. If given an integer value, will return +same as to_integer/1.

                                  + +

                                  Examples

                                  + +
                                  iex> String.to_float("34")
                                  +{34.0,""}
                                  +iex> String.to_float("34.25")
                                  +{34.25,""}
                                  +
                                  + +

                                  iex> String.tofloat("56.5xyz") + {56.5,"xyz"} + iex> String.tofloat("pi") + :error

                                  +
                                  + + Source + +
                                  +

                                  + to_integer(string) +

                                  +

                                  Converts a string to an integer. If successful, returns a +tuple of form {integer, remainder of string}. If unsuccessful, +returns :error.

                                  + +

                                  Examples

                                  + +
                                  iex> String.to_integer("34")
                                  +{34,""}
                                  +iex> String.to_integer("34.5")
                                  +{34,".5"}
                                  +iex> String.to_integer("three")
                                  +:error
                                  +
                                  +
                                  + + Source +

                                  upcase(binary) @@ -728,6 +801,52 @@

                                  Examples

                                  Source +
                                  +

                                  + valid?(arg1) +

                                  +

                                  Checks whether str contains only valid characters.

                                  + +

                                  Examples

                                  + +
                                  iex> String.valid?("a")
                                  +true
                                  +iex> String.valid?("ø")
                                  +true
                                  +iex> String.valid?(<<0xffff :: 16>>)
                                  +false
                                  +iex> String.valid?("asd" <> <<0xffff :: 16>>)
                                  +false
                                  +
                                  +
                                  + + Source + +
                                  +

                                  + valid_character?(codepoint) +

                                  +

                                  Checks whether str is a valid character.

                                  + +

                                  All characters are codepoints, but some codepoints +are not valid characters. They may be reserved, private, +or other.

                                  + +

                                  More info at: http://en.wikipedia.org/wiki/Mapping_of_Unicode_characters#Noncharacters

                                  + +

                                  Examples

                                  + +
                                  iex> String.valid_character?("a")
                                  +true
                                  +iex> String.valid_character?("ø")
                                  +true
                                  +iex> String.valid_character?("\x{ffff}")
                                  +false
                                  +
                                  +
                                  + + Source +

                                  valid_codepoint?(arg1) @@ -743,14 +862,14 @@

                                  Examples

                                  true iex> String.valid_codepoint?("ø") true -iex> String.valid_codepoint?("\xffff") +iex> String.valid_codepoint?(<<0xffff :: 16>>) false iex> String.valid_codepoint?("asdf") false
                                  - Source + Source
                                  diff --git a/docs/stable/SyntaxError.html b/docs/stable/SyntaxError.html index efb4f2c2c..cbf341f50 100644 --- a/docs/stable/SyntaxError.html +++ b/docs/stable/SyntaxError.html @@ -29,7 +29,7 @@

                                  - Source + Source @@ -83,7 +83,7 @@

                                  Functions

                                  - Source + Source diff --git a/docs/stable/SystemLimitError.html b/docs/stable/SystemLimitError.html index e7c034a60..106ae4003 100644 --- a/docs/stable/SystemLimitError.html +++ b/docs/stable/SystemLimitError.html @@ -29,7 +29,7 @@

                                  - Source + Source diff --git a/docs/stable/TokenMissingError.html b/docs/stable/TokenMissingError.html index d5bb2562a..1e1b00815 100644 --- a/docs/stable/TokenMissingError.html +++ b/docs/stable/TokenMissingError.html @@ -29,7 +29,7 @@

                                  - Source + Source @@ -83,7 +83,7 @@

                                  Functions

                                  - Source + Source diff --git a/docs/stable/UndefinedFunctionError.html b/docs/stable/UndefinedFunctionError.html index a3d1329cf..cd334faa2 100644 --- a/docs/stable/UndefinedFunctionError.html +++ b/docs/stable/UndefinedFunctionError.html @@ -29,7 +29,7 @@

                                  - Source + Source @@ -83,7 +83,7 @@

                                  Functions

                                  - Source + Source diff --git a/docs/stable/index.html b/docs/stable/index.html index dcfbc64c0..93ae16fed 100644 --- a/docs/stable/index.html +++ b/docs/stable/index.html @@ -3,7 +3,7 @@ - Elixir v0.8.2 Documentation + Elixir v0.8.3 Documentation diff --git a/docs/stable/modules_list.html b/docs/stable/modules_list.html index 9c0517820..367ed32d2 100644 --- a/docs/stable/modules_list.html +++ b/docs/stable/modules_list.html @@ -16,7 +16,7 @@
                                • +
                                • + + take/2 + + Dict +
                                • + +
                                • + + split/2 + + Dict +
                                • +
                                • size/1 @@ -367,6 +381,20 @@

                                  Dict

                                • +
                                • + + pop/3 + + Dict +
                                • + +
                                • + + pop/2 + + Dict +
                                • +
                                • merge/3 @@ -416,6 +444,13 @@

                                  Dict

                                • +
                                • + + equal?/2 + + Dict +
                                • +
                                • empty/1 @@ -423,6 +458,13 @@

                                  Dict

                                • +
                                • + + drop/2 + + Dict +
                                • +
                                • delete/2 @@ -437,6 +479,13 @@

                                  Dict

                                • +
                                • + + drop/2 + + Dict +
                                • +
                                • empty/1 @@ -446,14 +495,28 @@

                                • - get/3 + equal?/2 Dict
                                • - get!/2 + fetch/2 + + Dict +
                                • + +
                                • + + fetch!/2 + + Dict +
                                • + +
                                • + + get/3 Dict
                                • @@ -486,6 +549,13 @@

                                  Dict

                                • +
                                • + + pop/3 + + Dict +
                                • +
                                • put/3 @@ -507,6 +577,20 @@

                                  Dict

                                • +
                                • + + split/2 + + Dict +
                                • + +
                                • + + take/2 + + Dict +
                                • +
                                • to_list/1 @@ -694,7 +778,7 @@

                                • - at!/2 + at/3 Enum
                                • @@ -741,6 +825,20 @@

                                  Enum

                                • +
                                • + + fetch/2 + + Enum +
                                • + +
                                • + + fetch!/2 + + Enum +
                                • +
                                • filter/2 @@ -811,6 +909,41 @@

                                  Enum

                                • +
                                • + + max/1 + + Enum +
                                • + +
                                • + + max/2 + + Enum +
                                • + +
                                • + + member?/2 + + Enum +
                                • + +
                                • + + min/1 + + Enum +
                                • + +
                                • + + min/2 + + Enum +
                                • +
                                • partition/2 @@ -876,7 +1009,14 @@

                                • - uniq/1 + to_list/1 + + Enum +
                                • + +
                                • + + uniq/2 Enum
                                • @@ -1088,7 +1228,7 @@

                                • - suite_finished/2 + suite_finished/3 ExUnit.CLIFormatter
                                • @@ -1160,6 +1300,24 @@

                                  ExUnit.Callbacks

                                • +
                                +
                              • + + + CaptureIO + + ExUnit.CaptureIO +
                              • +
                              • @@ -1255,7 +1413,7 @@

                              • - suite_finished/2 + suite_finished/3 ExUnit.Formatter
                              • @@ -1311,21 +1469,21 @@

                              • - format_entry/2 + format_file_line/3 Exception
                              • - format_file_line/3 + format_stacktrace/1 Exception
                              • - format_stacktrace/1 + format_stacktrace_entry/2 Exception
                              • @@ -1724,6 +1882,13 @@

                                HashDict

                              • +
                              • + + drop/2 + + HashDict +
                              • +
                              • empty/1 @@ -1733,14 +1898,28 @@

                              • - get/3 + equal?/2 + + HashDict +
                              • + +
                              • + + fetch/2 + + HashDict +
                              • + +
                              • + + fetch!/2 HashDict
                              • - get!/2 + get/3 HashDict
                              • @@ -1787,6 +1966,13 @@

                                HashDict

                              • +
                              • + + pop/3 + + HashDict +
                              • +
                              • put/3 @@ -1808,6 +1994,20 @@

                                HashDict

                              • +
                              • + + split/2 + + HashDict +
                              • + +
                              • + + take/2 + + HashDict +
                              • +
                              • to_list/1 @@ -1915,6 +2115,13 @@

                                IEx.Helpers

                              • +
                              • + + ls/1 + + IEx.Helpers +
                              • +
                              • m/0 @@ -1971,24 +2178,6 @@

                                IEx.Helpers

                              • -
                              -
                            • - - - Remsh - - IEx.Remsh -
                            • - @@ -2429,7 +2618,14 @@

                            • - getb/3 + getn/2 + + IO +
                            • + +
                            • + + getn/3 IO
                            • @@ -2577,6 +2773,13 @@

                              Kernel.SpecialForms +
                            • + + __DIR__/0 + + Kernel.SpecialForms +
                            • +
                            • __ENV__/0 @@ -2621,14 +2824,14 @@

                            • - alias/0 + alias/2 Kernel.SpecialForms
                            • - alias/2 + alias!/1 Kernel.SpecialForms
                            • @@ -2668,6 +2871,20 @@

                              Kernel.SpecialForms

                            • +
                            • + + unquote/1 + + Kernel.SpecialForms +
                            • + +
                            • + + unquote_splicing/1 + + Kernel.SpecialForms +
                            • +
                            • var!/1 @@ -3228,6 +3445,34 @@

                              Kernel

                            • +
                            • + + defmacro/2 + + Kernel +
                            • + +
                            • + + defmacro/4 + + Kernel +
                            • + +
                            • + + defmacrop/2 + + Kernel +
                            • + +
                            • + + defmacrop/4 + + Kernel +
                            • +
                            • defmodule/2 @@ -3265,7 +3510,7 @@

                            • - defrecord/4 + defrecord/3 Kernel
                            • @@ -3342,21 +3587,28 @@

                            • - function/1 + float_to_list/2 Kernel
                            • - function/3 + function/1 Kernel
                            • - function_exported?/3 + function/3 + + Kernel +
                            • + +
                            • + + function_exported?/3 Kernel
                            • @@ -3939,6 +4191,13 @@

                              Keyword

                            • +
                            • + + delete_first/2 + + Keyword +
                            • +
                            • equal?/2 @@ -3948,21 +4207,28 @@

                            • - from_enum/1 + fetch/2 Keyword
                            • - get/3 + fetch!/2 Keyword
                            • - get!/2 + from_enum/1 + + Keyword +
                            • + +
                            • + + get/3 Keyword
                            • @@ -4073,263 +4339,305 @@

                              List

                            • -
                            • @@ -4806,6 +5233,13 @@

                              Mix.Shell.IO

                            • +
                            • + + put_app/0 + + Mix.Shell.IO +
                            • +
                            • yes?/1 @@ -4852,6 +5286,13 @@

                              Mix.Shell.Process

                            • +
                            • + + put_app/0 + + Mix.Shell.Process +
                            • +
                            • yes?/1 @@ -4919,6 +5360,13 @@

                              Mix.Task

                            • +
                            • + + recursive?/1 + + Mix.Task +
                            • +
                            • reenable/1 @@ -5364,6 +5812,31 @@

                              Mix.Tasks.Local.Install

                            • +

                            +
                          • + + + Tasks.Local.Rebar + + Mix.Tasks.Local.Rebar +
                          • +
                          • @@ -5489,6 +5962,13 @@

                            Mix.Utils

                          • +
                          • + + manifest/2 + + Mix.Utils +
                          • +
                          • mix_home/0 @@ -5496,6 +5976,13 @@

                            Mix.Utils

                          • +
                          • + + mix_path/0 + + Mix.Utils +
                          • +
                          • module_name_to_command/2 @@ -5505,7 +5992,7 @@

                          • - preserving_mtime/2 + read_path/1 Mix.Utils
                          • @@ -5773,6 +6260,13 @@

                            Node

                          • +
                          • + + get_cookie/0 + + Node +
                          • +
                          • list/0 @@ -5808,6 +6302,13 @@

                            Node

                          • +
                          • + + set_cookie/2 + + Node +
                          • +
                          • spawn/2 @@ -6634,6 +7135,20 @@

                            String

                          • +
                          • + + to_float/1 + + String +
                          • + +
                          • + + to_integer/1 + + String +
                          • +
                          • upcase/1 @@ -6641,6 +7156,20 @@

                            String

                          • +
                          • + + valid?/1 + + String +
                          • + +
                          • + + valid_character?/1 + + String +
                          • +
                          • valid_codepoint?/1 diff --git a/docs/stable/protocols_list.html b/docs/stable/protocols_list.html index 305562548..a38caffe6 100644 --- a/docs/stable/protocols_list.html +++ b/docs/stable/protocols_list.html @@ -16,7 +16,7 @@
                          • +
                          • + + member?/2 + + Enum.Iterator.Function +
                          • +
                        • @@ -504,6 +511,13 @@

                          Enum.Iterator.HashDict

                        • +
                        • + + member?/2 + + Enum.Iterator.HashDict +
                        • +
                      • @@ -529,6 +543,13 @@

                        Enum.Iterator.List

                      • +
                      • + + member?/2 + + Enum.Iterator.List +
                      • +
                    • @@ -554,6 +575,13 @@

                      Enum.Iterator.Range

                    • +
                    • + + member?/2 + + Enum.Iterator.Range +
                    • +
                    @@ -571,6 +599,13 @@

                    Enum.Iterator

                  • +
                  • + + member?/2 + + Enum.Iterator +
                  • +
                • diff --git a/docs/stable/records_list.html b/docs/stable/records_list.html index d5a5bf7be..2ed698170 100644 --- a/docs/stable/records_list.html +++ b/docs/stable/records_list.html @@ -16,7 +16,7 @@

                  - Elixir v0.8.2 + Elixir v0.8.3

                  +{% include learning-resources.html %} +

                  Important links

                    diff --git a/_includes/learning-resources.html b/_includes/learning-resources.html new file mode 100644 index 000000000..3b23cc5e3 --- /dev/null +++ b/_includes/learning-resources.html @@ -0,0 +1,6 @@ +
                    +

                    Learning resources

                    +
                      +
                    • +
                    +
                    \ No newline at end of file diff --git a/_layouts/getting_started.html b/_layouts/getting_started.html index b68f75dd6..cde9a69c5 100644 --- a/_layouts/getting_started.html +++ b/_layouts/getting_started.html @@ -33,6 +33,8 @@

                    ExUnit - a unit test framework

                  • Introduction to ExUnit
                  + + {% include learning-resources.html %}
                  diff --git a/css/style.css b/css/style.css index 79d5fa591..dca1cf214 100644 --- a/css/style.css +++ b/css/style.css @@ -162,6 +162,9 @@ ul { margin: 0 0 1.692307em 2.8em; padding: 0; } +li.no-style { + list-style: none; +} ol { list-style-type: decimal; margin: 0 0 1.692307em 3.1em; From bed36e0936a012035a4b57ab9ccc29711aabc3df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Thu, 23 May 2013 10:47:45 +0200 Subject: [PATCH 412/437] An Elixir module now translates to Elixir.Module instead of Elixir-Module --- _posts/2013-05-02-elixir-on-xen.markdown | 2 +- crash-course.markdown | 4 ++-- docs/master/IEx.html | 2 +- docs/stable/IEx.html | 2 +- getting_started/1.markdown | 4 ++-- getting_started/3.markdown | 10 +++------- 6 files changed, 10 insertions(+), 14 deletions(-) diff --git a/_posts/2013-05-02-elixir-on-xen.markdown b/_posts/2013-05-02-elixir-on-xen.markdown index 0fd6d85f1..0bbd9829a 100644 --- a/_posts/2013-05-02-elixir-on-xen.markdown +++ b/_posts/2013-05-02-elixir-on-xen.markdown @@ -58,7 +58,7 @@ And this is all. Erlang on Xen is going to boot the Erlang VM and the standard E 3. In the user switch interface, type: User switch command - --> s 'Elixir-IEx' + --> s 'Elixir.IEx' --> c This will bring you to Interactive Elixir and you can execute Elixir expressions as usual! diff --git a/crash-course.markdown b/crash-course.markdown index b1379d455..f9b91c01a 100644 --- a/crash-course.markdown +++ b/crash-course.markdown @@ -219,7 +219,7 @@ X = 10. im_a_var x = 10 -Module # this is called an atom alias; it expands to :'Elixir-Module' +Module # this is called an atom alias; it expands to :'Elixir.Module' {% endhighlight %} It is also possible to create atoms that start with a character other than a lowercase letter. The syntax is different between the two languages: @@ -853,7 +853,7 @@ It can be called from Erlang as follow: -export([uglify/1]). uglify(Bin) -> - 'Elixir-Contrived':ugly_binary(Bin). + 'Elixir.Contrived':ugly_binary(Bin). {% endhighlight %} However this syntax is suboptimal. For this reason, Elixir ships with a parse transform that allows you to write the module names in a more convenient way: diff --git a/docs/master/IEx.html b/docs/master/IEx.html index 567007ec8..ab8ec53dd 100644 --- a/docs/master/IEx.html +++ b/docs/master/IEx.html @@ -53,7 +53,7 @@

                  The User Switch command

                  alternate in between them. Let's give it a try:

                  User switch command
                  - --> s 'Elixir-IEx'
                  + --> s 'Elixir.IEx'
                    --> c
                   
                  diff --git a/docs/stable/IEx.html b/docs/stable/IEx.html index 567007ec8..ab8ec53dd 100644 --- a/docs/stable/IEx.html +++ b/docs/stable/IEx.html @@ -53,7 +53,7 @@

                  The User Switch command

                  alternate in between them. Let's give it a try:

                  User switch command
                  - --> s 'Elixir-IEx'
                  + --> s 'Elixir.IEx'
                    --> c
                   
                  diff --git a/getting_started/1.markdown b/getting_started/1.markdown index dff2e8bb8..55a804c1a 100644 --- a/getting_started/1.markdown +++ b/getting_started/1.markdown @@ -19,7 +19,7 @@ For Windows developers, we recommend the precompiled package. Those on the UNIX After Erlang is installed, you should be able to open up the command line (or command prompt) and check the Erlang version by typing `erl`. You will see some information as follows: - Erlang R16B (erts-5.8.4) [source] [64-bit] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false] + Erlang R16B (erts-5.10.1) [source] [64-bit] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false] Notice that depending on how you installed Erlang, it will not add Erlang binaries to your environment. Be sure to have Erlang binaries in your [PATH](http://en.wikipedia.org/wiki/Environment_variable), otherwise Elixir won't work! @@ -27,7 +27,7 @@ After Erlang is up and running, it is time to install Elixir. You can do that vi ### 1.1.1 Distributions -Elixir v0.8.1 forward is required to run this tutorial and it may be available in some distributions: +This tutorial requires Elixir v0.9.0 or later and it may be available in some distributions: * Homebrew for Mac OS X * Since Elixir requires Erlang R16B, first call `brew tap homebrew/versions` and then `brew install erlang-r16` diff --git a/getting_started/3.markdown b/getting_started/3.markdown index 5f4504bd9..b6ed978e3 100644 --- a/getting_started/3.markdown +++ b/getting_started/3.markdown @@ -39,7 +39,7 @@ This file can be compiled using `elixirc` (remember, if you installed Elixir fro elixirc math.ex -This will generate a file named `Elixir-Math.beam` containing the bytecode for the defined module. Now, if we start `iex` again, our module definition will be available (considering `iex` is being started in the same directory the bytecode file is): +This will generate a file named `Elixir.Math.beam` containing the bytecode for the defined module. Now, if we start `iex` again, our module definition will be available (considering `iex` is being started in the same directory the bytecode file is): iex> Math.sum(1, 2) 3 @@ -360,13 +360,9 @@ In the example above, we store the atom `lists` in the variable `Mod` and then i iex> mod.flatten([1,[2],3]) [1,2,3] -In other words, we are simply calling the function `flatten` on the atom `:lists`. This mechanism is exactly what empowers Elixir aliases. An alias in Elixir is a capitalized identifier (like `List`, `Keyword`, etc) which is converted to an atom representing a module during compilation. For instance, the `List` alias translates by default to the atom `Elixir-List`: +In other words, we are simply calling the function `flatten` on the atom `:lists`. This mechanism is exactly what empowers Elixir aliases. An alias in Elixir is a capitalized identifier (like `List`, `Keyword`, etc) which is converted to an atom representing a module during compilation. For instance, the `List` alias translates by default to the atom `Elixir.List`: iex> is_atom(List) true iex> to_binary(List) - "Elixir-List" - -> Note: an alias does not actually ensure the aliased module really exists. For instance, `Foo.Bar.Baz` will return an atom regardless if a `Foo.Bar.Baz` module is defined or not. - -> Note: in the future, the alias `List` will be converted to the atom `Elixir.List` instead of `Elixir-List`. + "Elixir.List" From 7fb55c3c7470c866e61d81b6565bea519538a547 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Thu, 23 May 2013 13:23:42 +0200 Subject: [PATCH 413/437] Blog post for Elixir v0.9 --- _includes/search.html | 2 +- ...2013-05-23-elixir-v0-9-0-released.markdown | 129 ++++++++++++++++++ getting_started/4.markdown | 2 +- 3 files changed, 131 insertions(+), 2 deletions(-) create mode 100644 _posts/2013-05-23-elixir-v0-9-0-released.markdown diff --git a/_includes/search.html b/_includes/search.html index 4138b80dd..44e16b620 100644 --- a/_includes/search.html +++ b/_includes/search.html @@ -1,6 +1,6 @@ diff --git a/_posts/2013-05-23-elixir-v0-9-0-released.markdown b/_posts/2013-05-23-elixir-v0-9-0-released.markdown new file mode 100644 index 000000000..ea43ee1b0 --- /dev/null +++ b/_posts/2013-05-23-elixir-v0-9-0-released.markdown @@ -0,0 +1,129 @@ +--- +layout: post +title: Elixir v0.9.0 released +author: José Valim +category: Releases +excerpt: Elixir v0.9.0 is released with support for reducers, umbrella projects, faster compilation times and drops support for R15 and before. +--- + +While [Programming Elixir](http://pragprog.com/book/elixir/programming-elixir) was being announced, we have been working on Elixir v0.9.0 which is finally out. This release contains new features, important performance optimizations and bug fixes. + +Elixir v0.9.0 also removes support to Erlang R15 and before. In case you still need to run Elixir software on R15, we have also released Elixir v0.8.3, which contains many of the enhancements in v0.9.0. Check the [CHANGELOG for more details for both releases](https://github.com/elixir-lang/elixir/blob/v0.9.0/CHANGELOG.md). + +All this work was achieved by a very vibrant community! Over the last month, 17 authors have pushed more than 500 commits, where more than 60 pull requests were merged and more than 80 issues were closed. + +Let's talk about the goodies! + +## Compilation time improvements + +We have spent some time improving compilation time. The particular scenario we have worked on was the definition of records: + +{% highlight elixir %} +defrecord User, name: nil, age: nil +{% endhighlight %} + +Records are a good scenario because they are implemented in Elixir, using Elixir macros, and they also define a module underneath, which exercises the Erlang VM compilation stack. + +We have used [fprof](http://www.erlang.org/doc/man/fprof.html) to identify the bottlenecks and made the compilation stack 35% faster. We have also identified bottlenecks coming from Erlang and [pushed some patches](https://github.com/erlang/otp/commit/32b194495f353dde014b00008a630eeff2a71056) that should benefit both Elixir and Erlang code. + +A special thanks to [Yurii Rashkovskii](https://github.com/yrashk) for the data and profiling. + +## Umbrella projects + +In Elixir, an application denotes a component implementing some specific functionality, that can be started and stopped as a unit, and which can be re-used in other systems as well. + +As a project grows, it is recommended to break it apart into smaller, isolated applications and bundle them together. The issue so far was that Elixir did not provide good support for working with many applications at once, and compiling and managing those applications became rather a tedious work. + +Elixir v0.9.0 now supports umbrella projects which can work with many applications at the same time. You can create a new umbrella project with: + + $ mix new my_project --umbrella + +The generated project will have the following structure: + + apps/ + mix.exs + README.md + +Now, inside the `apps` directory, you can create as many applications as you want and by running `mix compile`, inside the umbrella project will automatically compile all applications. The [original discussion for this feature](https://github.com/elixir-lang/elixir/issues/667) contains more details about how it all works. + +A special thanks to [Eric Meadows-Jonsson](https://github.com/ericmj) for implementing this feature and to [Yurii](https://github.com/yrashk) for testing it against different edge cases. + +## Reducers + +Elixir v0.9.0 changes its main abstraction for enumeration from iterators to reducers. Before Elixir v0.9.0, when you invoked: + +{% highlight elixir %} +Enum.map([1,2,3], fn(x) -> x * x end) +#=> [1, 4, 9] +{% endhighlight %} + +It asked the `Enum.Iterator` protocol for instruction on how to iterate the list `[1,2,3]`. This iteration happened by retrieving each item in the list, one by one, until there were no items left. + +This approach posed many problems: + +* Iterators are very hard to compose; +* Iterators contain state. You need to know, at each moment, what is the next element you have to iterate next. We use functions to pass the iteration state around; +* Iterators have the "dangling open resource" problem. Consider that you want to iterate a file with `Enum.map/2` as above. If any step during the iteration fails, there is no easy way to notify the iterator (in this case, th opened file) that iteration failed, so we can't close the file automatically, leaving it to the user. + +Reducers solve all of those problems by using a more functional approach. Instead of asking a list how to iterate itself, we generate a recipe and pass this recipe to the list reduce on itself. + +Here is how we implement the `Enumerable` protocol for lists: + +{% highlight elixir %} +defimpl Enumerable, for: List do + def reduce(list, acc, fun) do + do_reduce(list, acc, fun) + end + + defp do_reduce([h|t], acc, fun) do + do_reduce(t, fun.(h, acc), fun) + end + + defp do_reduce([], acc, fun) do + acc + end +end +{% endhighlight %} + +The implementation above works as a simple `reduce` (also called `fold`, `inject` or `foldl` in other languages). Here is how it works: + +{% highlight elixir %} +Enumerable.reduce([1,2,3], 0, fn(x, acc) -> x + acc end) +#=> 6 +{% endhighlight %} + +Now the `Enum.map/2` we have seen above is implemented in terms of this reducing function: + +{% highlight elixir %} +defmodule Enum do + def map(collection, fun) do + Enumerable.reduce(collection, [], fn(x, acc) -> + [fun.(x, acc)|acc] + end) |> reverse + end +end +{% endhighlight %} + +This approach solves all the problems above: + +* Reducers are composable (notice how we have implemented map on top of reduce by composing functions); +* Reducers are self-contained: there is no need keep state around which also solves the "dangling open resource" problem. The data type now knows exactly when the iteration starts and when it finishes; +* Reducers do not dictate how a type should be enumerated. This means types like `Range` and `HashDict` can provide a much faster implementation for Reducers. + +Reducers also opens up room for lazy and parallel enumeration of functions, as [the Clojure community has already proven](http://clojure.com/blog/2012/05/08/reducers-a-library-and-model-for-collection-processing.html). + +A special thanks to [Eric Meadows-Jonsson](https://github.com/ericmj) for implementing this feature! + +## Other bits + +We have also many other smaller improvements: + +* Our CLI now supports `--hidden` and `--cookie` flags which are useful for distributed modes; +* Our test framework, ExUnit, is now able to capture all the communication that happens with a registed IO device, like `:stdio` and `:stderr`, via [`ExUnit.CaptureIO`](http://elixir-lang.org/docs/master/ExUnit.CaptureIO.html). This is very useful for testing how your software reacts on some inputs and what it prints to the terminal; +* `String`, `Enum` and `Dict` modules got more convenience functions to work with their respective types; +* `IEx` now allows files to be imported into the shell with `import_file` and also loads `~/.iex` on startup for custom configuration; +* And many, many more! + +We are very thankful for the community around us, which sent bug reports, provided bug fixes and contributed all those amazing features. And when are **you** joining us? + +Give Elixir a try! You can start with our [getting started guide](http://elixir-lang.org/getting_started/1.html), or [check this 30 minute video](http://pragprog.com/book/elixir/programming-elixir) from [PragProg](http://pragprog.com/book/elixir/programming-elixir) or buy the beta version of [Programming Elixir](http://pragprog.com/book/elixir/programming-elixir). diff --git a/getting_started/4.markdown b/getting_started/4.markdown index 4212a19ac..70f18c9b6 100644 --- a/getting_started/4.markdown +++ b/getting_started/4.markdown @@ -188,7 +188,7 @@ Elixir ships with some built-in protocols, let's take a look at a couple of thos iex> x[:b] 2 -* `Enum.Iterator` - any data structured that can be enumerated must implement this protocol. This protocol is consumed by the `Enum` module which provides functions like `map`, `reduce` and others: +* `Enumerable` - any data structured that can be enumerated must implement this protocol. This protocol is consumed by the `Enum` module which provides functions like `map`, `reduce` and others: iex> Enum.map [1,2,3], fn(x) -> x * 2 end [2,4,6] From ff8fcd2916cbbfa700cb61f568ccb90cb0bfeeac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Thu, 23 May 2013 13:35:06 +0200 Subject: [PATCH 414/437] support to -> support for --- _posts/2013-05-23-elixir-v0-9-0-released.markdown | 2 +- index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/_posts/2013-05-23-elixir-v0-9-0-released.markdown b/_posts/2013-05-23-elixir-v0-9-0-released.markdown index ea43ee1b0..4e05942cf 100644 --- a/_posts/2013-05-23-elixir-v0-9-0-released.markdown +++ b/_posts/2013-05-23-elixir-v0-9-0-released.markdown @@ -8,7 +8,7 @@ excerpt: Elixir v0.9.0 is released with support for reducers, umbrella projects, While [Programming Elixir](http://pragprog.com/book/elixir/programming-elixir) was being announced, we have been working on Elixir v0.9.0 which is finally out. This release contains new features, important performance optimizations and bug fixes. -Elixir v0.9.0 also removes support to Erlang R15 and before. In case you still need to run Elixir software on R15, we have also released Elixir v0.8.3, which contains many of the enhancements in v0.9.0. Check the [CHANGELOG for more details for both releases](https://github.com/elixir-lang/elixir/blob/v0.9.0/CHANGELOG.md). +Elixir v0.9.0 also removes support for Erlang R15 and before. In case you still need to run Elixir software on R15, we have also released Elixir v0.8.3, which contains many of the enhancements in v0.9.0. Check the [CHANGELOG for more details for both releases](https://github.com/elixir-lang/elixir/blob/v0.9.0/CHANGELOG.md). All this work was achieved by a very vibrant community! Over the last month, 17 authors have pushed more than 500 commits, where more than 60 pull requests were merged and more than 80 issues were closed. diff --git a/index.html b/index.html index 8baa152b5..ce3785846 100644 --- a/index.html +++ b/index.html @@ -9,7 +9,7 @@

                  Elixir is a functional meta-programming aware language built on top of the Erlang VM. It is a dynamic language with flexible syntax with macros support that leverages Erlang's abilities to build concurrent, distributed, fault-tolerant applications with hot code upgrades.

                  -

                  Elixir also provides first-class support to pattern matching, polymorphism via protocols (similar to Clojure's), aliases and associative data structures (usually known as dicts or hashes in other programming languages).

                  +

                  Elixir also provides first-class support for pattern matching, polymorphism via protocols (similar to Clojure's), aliases and associative data structures (usually known as dicts or hashes in other programming languages).

                  Finally, Elixir and Erlang share the same bytecode and data types. This means you can invoke Erlang code from Elixir (and vice-versa) without any conversion or performance hit. This allows a developer to mix the expressiveness of Elixir with the robustness and performance of Erlang.

                  To install Elixir or learn more about it, check our getting started guide. We also have online documentation available and a Crash Course for Erlang developers.

                  From 606525295bde0805274a99c62da8b603c0878f16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Thu, 23 May 2013 16:06:45 +0200 Subject: [PATCH 415/437] Add Elixir package --- packages.html | 1 + 1 file changed, 1 insertion(+) diff --git a/packages.html b/packages.html index 03199574d..a1ab50881 100644 --- a/packages.html +++ b/packages.html @@ -7,6 +7,7 @@

                  Precompiled packages

                    +
                  • v0.9.0
                  • v0.8.3
                  • v0.8.2
                  • v0.8.1
                  • From da4d1db8cccfa9e63685f93f7fab7a857385067d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Thu, 23 May 2013 16:50:48 +0200 Subject: [PATCH 416/437] Many blog post fixes --- ...2013-05-23-elixir-v0-9-0-released.markdown | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/_posts/2013-05-23-elixir-v0-9-0-released.markdown b/_posts/2013-05-23-elixir-v0-9-0-released.markdown index 4e05942cf..8ed7ed418 100644 --- a/_posts/2013-05-23-elixir-v0-9-0-released.markdown +++ b/_posts/2013-05-23-elixir-v0-9-0-released.markdown @@ -3,14 +3,14 @@ layout: post title: Elixir v0.9.0 released author: José Valim category: Releases -excerpt: Elixir v0.9.0 is released with support for reducers, umbrella projects, faster compilation times and drops support for R15 and before. +excerpt: Elixir v0.9.0 is released with support for reducers, umbrella projects, faster compilation times and dropped support for R15 and earlier OTP versions. --- While [Programming Elixir](http://pragprog.com/book/elixir/programming-elixir) was being announced, we have been working on Elixir v0.9.0 which is finally out. This release contains new features, important performance optimizations and bug fixes. -Elixir v0.9.0 also removes support for Erlang R15 and before. In case you still need to run Elixir software on R15, we have also released Elixir v0.8.3, which contains many of the enhancements in v0.9.0. Check the [CHANGELOG for more details for both releases](https://github.com/elixir-lang/elixir/blob/v0.9.0/CHANGELOG.md). +Elixir v0.9.0 also removes support for Erlang R15 and earlier versions. In case you still need to run Elixir software on R15, we have also released Elixir v0.8.3, which contains many of the enhancements in v0.9.0. Check the [CHANGELOG for more details for both releases](https://github.com/elixir-lang/elixir/blob/v0.9.0/CHANGELOG.md). -All this work was achieved by a very vibrant community! Over the last month, 17 authors have pushed more than 500 commits, where more than 60 pull requests were merged and more than 80 issues were closed. +All this work was achieved by our very vibrant community! Over the last month, 17 authors have pushed more than 500 commits, where more than 60 pull requests were merged and more than 80 issues were closed. Let's talk about the goodies! @@ -44,7 +44,7 @@ The generated project will have the following structure: mix.exs README.md -Now, inside the `apps` directory, you can create as many applications as you want and by running `mix compile`, inside the umbrella project will automatically compile all applications. The [original discussion for this feature](https://github.com/elixir-lang/elixir/issues/667) contains more details about how it all works. +Now, inside the `apps` directory, you can create as many applications as you want and running `mix compile` inside the umbrella project will automatically compile all applications. The [original discussion for this feature](https://github.com/elixir-lang/elixir/issues/667) contains more details about how it all works. A special thanks to [Eric Meadows-Jonsson](https://github.com/ericmj) for implementing this feature and to [Yurii](https://github.com/yrashk) for testing it against different edge cases. @@ -57,15 +57,15 @@ Enum.map([1,2,3], fn(x) -> x * x end) #=> [1, 4, 9] {% endhighlight %} -It asked the `Enum.Iterator` protocol for instruction on how to iterate the list `[1,2,3]`. This iteration happened by retrieving each item in the list, one by one, until there were no items left. +It asked the `Enum.Iterator` protocol for instructions on how to iterate the list `[1,2,3]`. This iteration happened by retrieving each item in the list, one by one, until there were no items left. This approach posed many problems: * Iterators are very hard to compose; -* Iterators contain state. You need to know, at each moment, what is the next element you have to iterate next. We use functions to pass the iteration state around; -* Iterators have the "dangling open resource" problem. Consider that you want to iterate a file with `Enum.map/2` as above. If any step during the iteration fails, there is no easy way to notify the iterator (in this case, th opened file) that iteration failed, so we can't close the file automatically, leaving it to the user. +* Iterators contain state. You need to know, at each moment, what is the next element you have to iterate next. We use functions and their bindings to pass the iteration state around; +* Iterators have the "dangling open resource" problem. Consider that you want to iterate a file with `Enum.map/2` as above. If any step during the iteration fails, there is no easy way to notify the resource being iterated (in this case, the opened file) that iteration failed, so we can't close the file automatically, leaving it to the user. -Reducers solve all of those problems by using a more functional approach. Instead of asking a list how to iterate itself, we generate a recipe and pass this recipe to the list reduce on itself. +Reducers solve all of those problems by using a more functional approach. Instead of asking a list to spill its elements out one by one and then working on each element, we now generate a recipe of computations and pass it down to the list which applies those computations on itself. Here is how we implement the `Enumerable` protocol for lists: @@ -85,14 +85,15 @@ defimpl Enumerable, for: List do end {% endhighlight %} -The implementation above works as a simple `reduce` (also called `fold`, `inject` or `foldl` in other languages). Here is how it works: +The implementation above works as a simple `reduce` function (also called `fold`, `inject` or `foldl` in other languages). Here is how it works: {% highlight elixir %} +# Sum all elements in a list Enumerable.reduce([1,2,3], 0, fn(x, acc) -> x + acc end) #=> 6 {% endhighlight %} -Now the `Enum.map/2` we have seen above is implemented in terms of this reducing function: +The `Enum.map/2` we have used above is now implmented in terms of this reducing function: {% highlight elixir %} defmodule Enum do @@ -110,7 +111,7 @@ This approach solves all the problems above: * Reducers are self-contained: there is no need keep state around which also solves the "dangling open resource" problem. The data type now knows exactly when the iteration starts and when it finishes; * Reducers do not dictate how a type should be enumerated. This means types like `Range` and `HashDict` can provide a much faster implementation for Reducers. -Reducers also opens up room for lazy and parallel enumeration of functions, as [the Clojure community has already proven](http://clojure.com/blog/2012/05/08/reducers-a-library-and-model-for-collection-processing.html). +Reducers also opens up room for lazy and parallel enumeration, as [the Clojure community has already proven](http://clojure.com/blog/2012/05/08/reducers-a-library-and-model-for-collection-processing.html). A special thanks to [Eric Meadows-Jonsson](https://github.com/ericmj) for implementing this feature! @@ -119,11 +120,11 @@ A special thanks to [Eric Meadows-Jonsson](https://github.com/ericmj) for implem We have also many other smaller improvements: * Our CLI now supports `--hidden` and `--cookie` flags which are useful for distributed modes; -* Our test framework, ExUnit, is now able to capture all the communication that happens with a registed IO device, like `:stdio` and `:stderr`, via [`ExUnit.CaptureIO`](http://elixir-lang.org/docs/master/ExUnit.CaptureIO.html). This is very useful for testing how your software reacts on some inputs and what it prints to the terminal; -* `String`, `Enum` and `Dict` modules got more convenience functions to work with their respective types; +* Our test framework, ExUnit, is now able to capture all the communication that happens with a registed IO device, like `:stdio` and `:stderr`, via [`ExUnit.CaptureIO`](http://elixir-lang.org/docs/master/ExUnit.CaptureIO.html). This is very useful for testing how your software reacts to some inputs and what it prints to the terminal; * `IEx` now allows files to be imported into the shell with `import_file` and also loads `~/.iex` on startup for custom configuration; +* The `String`, `Enum` and `Dict` modules got more convenience functions that goes from checking unicode character validity to taking values out of a dictionary; * And many, many more! -We are very thankful for the community around us, which sent bug reports, provided bug fixes and contributed all those amazing features. And when are **you** joining us? +A huge thank you to our community for sending bug reports, providing bug fixes and contributing all those amazing features. And when are **you** joining us? :) -Give Elixir a try! You can start with our [getting started guide](http://elixir-lang.org/getting_started/1.html), or [check this 30 minute video](http://pragprog.com/book/elixir/programming-elixir) from [PragProg](http://pragprog.com/book/elixir/programming-elixir) or buy the beta version of [Programming Elixir](http://pragprog.com/book/elixir/programming-elixir). +Give Elixir a try! You can start with our [getting started guide](http://elixir-lang.org/getting_started/1.html), or [check this 30 minute video from PragProg](http://www.youtube.com/watch?v=a-off4Vznjs&feature=youtu.be) or buy the beta version of [Programming Elixir](http://pragprog.com/book/elixir/programming-elixir). From 508249ce8a1afc03ea12e29da1cd9ff6762aa195 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Thu, 23 May 2013 17:09:24 +0200 Subject: [PATCH 417/437] Update docs --- docs/master/Access.Atom.html | 4 +- docs/master/Access.Function.html | 4 +- docs/master/Access.HashDict.html | 4 +- docs/master/Access.List.html | 4 +- docs/master/Access.html | 4 +- docs/master/Application.Behaviour.html | 2 +- docs/master/ArgumentError.html | 2 +- docs/master/ArithmeticError.html | 2 +- docs/master/BadArityError.html | 4 +- docs/master/BadFunctionError.html | 4 +- docs/master/Behaviour.html | 4 +- docs/master/Binary.Chars.Atom.html | 4 +- docs/master/Binary.Chars.BitString.html | 4 +- docs/master/Binary.Chars.List.html | 4 +- docs/master/Binary.Chars.Number.html | 4 +- docs/master/Binary.Chars.html | 4 +- docs/master/Binary.Inspect.Atom.html | 4 +- docs/master/Binary.Inspect.BitString.html | 4 +- docs/master/Binary.Inspect.Function.html | 4 +- docs/master/Binary.Inspect.HashDict.html | 4 +- docs/master/Binary.Inspect.List.html | 4 +- docs/master/Binary.Inspect.Number.html | 4 +- docs/master/Binary.Inspect.PID.html | 4 +- docs/master/Binary.Inspect.Port.html | 4 +- docs/master/Binary.Inspect.Range.html | 4 +- docs/master/Binary.Inspect.Reference.html | 4 +- docs/master/Binary.Inspect.Regex.html | 4 +- docs/master/Binary.Inspect.Tuple.html | 4 +- docs/master/Binary.Inspect.html | 4 +- docs/master/Bitwise.html | 28 +- docs/master/CaseClauseError.html | 4 +- docs/master/Code.LoadError.html | 4 +- docs/master/Code.html | 44 +- docs/master/CompileError.html | 4 +- docs/master/Dict.html | 90 +-- docs/master/EEx.AssignsEngine.html | 2 +- docs/master/EEx.Engine.html | 8 +- docs/master/EEx.SmartEngine.html | 6 +- docs/master/EEx.SyntaxError.html | 2 +- docs/master/EEx.TransformerEngine.html | 2 +- docs/master/EEx.html | 14 +- docs/master/Enum.EmptyError.html | 2 +- docs/master/Enum.OutOfBoundsError.html | 2 +- docs/master/Enum.html | 82 +-- ...Function.html => Enumerable.Function.html} | 24 +- .../Enumerable.HashDict.html} | 24 +- ...terator.List.html => Enumerable.List.html} | 24 +- .../Enumerable.Range.html} | 24 +- .../{Enum.Iterator.html => Enumerable.html} | 89 ++- docs/master/ErlangError.html | 4 +- docs/master/ExUnit.AssertionError.html | 2 +- docs/master/ExUnit.Assertions.html | 36 +- docs/master/ExUnit.CLIFormatter.html | 26 +- docs/master/ExUnit.Callbacks.html | 10 +- docs/master/ExUnit.CaptureIO.html | 40 +- docs/master/ExUnit.Case.html | 4 +- docs/master/ExUnit.CaseTemplate.html | 4 +- docs/master/ExUnit.DocTest.html | 4 +- docs/master/ExUnit.ExpectationError.html | 6 +- docs/master/ExUnit.Formatter.html | 14 +- docs/master/ExUnit.Test.html | 2 +- docs/master/ExUnit.TestCase.html | 2 +- docs/master/ExUnit.html | 10 +- docs/master/Exception.html | 12 +- docs/master/File.CopyError.html | 4 +- docs/master/File.Error.html | 4 +- docs/master/File.IteratorError.html | 4 +- docs/master/File.Stat.html | 2 +- docs/master/File.html | 136 ++--- docs/master/FunctionClauseError.html | 4 +- docs/master/GenEvent.Behaviour.html | 2 +- docs/master/GenServer.Behaviour.html | 2 +- docs/master/HashDict.html | 61 +- docs/master/IEx.Autocomplete.html | 4 +- docs/master/IEx.Helpers.html | 62 +- docs/master/IEx.html | 76 ++- docs/master/IO.ANSI.html | 112 ++-- docs/master/IO.html | 26 +- docs/master/Kernel.CLI.html | 4 +- docs/master/Kernel.ParallelCompiler.html | 6 +- docs/master/Kernel.ParallelRequire.html | 4 +- docs/master/Kernel.SpecialForms.html | 44 +- docs/master/Kernel.Typespec.html | 34 +- docs/master/Kernel.html | 570 +++++++++--------- docs/master/KeyError.html | 4 +- docs/master/Keyword.html | 44 +- docs/master/List.Chars.Atom.html | 4 +- docs/master/List.Chars.BitString.html | 4 +- docs/master/List.Chars.List.html | 4 +- docs/master/List.Chars.Number.html | 4 +- docs/master/List.Chars.html | 4 +- docs/master/List.html | 38 +- docs/master/ListDict.html | 48 +- docs/master/Macro.Env.html | 10 +- docs/master/Macro.html | 24 +- docs/master/MatchError.html | 4 +- docs/master/Mix.Dep.html | 2 +- docs/master/Mix.Deps.html | 40 +- docs/master/Mix.Error.html | 2 +- docs/master/Mix.Generator.html | 12 +- docs/master/Mix.InvalidTaskError.html | 4 +- docs/master/Mix.Local.html | 10 +- docs/master/Mix.NoProjectError.html | 2 +- docs/master/Mix.NoTaskError.html | 4 +- docs/master/Mix.OutOfDateDepsError.html | 4 +- docs/master/Mix.Project.html | 24 +- docs/master/Mix.SCM.html | 26 +- docs/master/Mix.Shell.IO.html | 12 +- docs/master/Mix.Shell.Process.html | 14 +- docs/master/Mix.Shell.html | 14 +- docs/master/Mix.Task.html | 26 +- docs/master/Mix.Tasks.App.Start.html | 4 +- docs/master/Mix.Tasks.Clean.html | 4 +- docs/master/Mix.Tasks.Compile.App.html | 4 +- docs/master/Mix.Tasks.Compile.Elixir.html | 4 +- docs/master/Mix.Tasks.Compile.Erlang.html | 10 +- docs/master/Mix.Tasks.Compile.Leex.html | 4 +- docs/master/Mix.Tasks.Compile.Yecc.html | 4 +- docs/master/Mix.Tasks.Compile.html | 4 +- docs/master/Mix.Tasks.Deps.Check.html | 4 +- docs/master/Mix.Tasks.Deps.Clean.html | 4 +- docs/master/Mix.Tasks.Deps.Compile.html | 4 +- docs/master/Mix.Tasks.Deps.Get.html | 4 +- docs/master/Mix.Tasks.Deps.Loadpaths.html | 4 +- docs/master/Mix.Tasks.Deps.Unlock.html | 4 +- docs/master/Mix.Tasks.Deps.Update.html | 4 +- docs/master/Mix.Tasks.Deps.html | 4 +- docs/master/Mix.Tasks.Do.html | 4 +- docs/master/Mix.Tasks.Escriptize.html | 4 +- docs/master/Mix.Tasks.Help.html | 4 +- docs/master/Mix.Tasks.Loadpaths.html | 4 +- docs/master/Mix.Tasks.Local.Install.html | 4 +- docs/master/Mix.Tasks.Local.Rebar.html | 6 +- docs/master/Mix.Tasks.Local.Uninstall.html | 4 +- docs/master/Mix.Tasks.Local.html | 4 +- docs/master/Mix.Tasks.New.html | 4 +- docs/master/Mix.Tasks.Run.html | 4 +- docs/master/Mix.Tasks.Test.html | 4 +- docs/master/Mix.Utils.html | 32 +- docs/master/Mix.html | 16 +- docs/master/Module.html | 46 +- docs/master/Node.html | 34 +- docs/master/OptionParser.html | 6 +- docs/master/Path.html | 36 +- docs/master/Port.html | 20 +- docs/master/Process.html | 64 +- docs/master/Protocol.UndefinedError.html | 4 +- docs/master/Range.Iterator.Number.html | 12 +- docs/master/Range.Iterator.html | 19 +- docs/master/Range.html | 2 +- docs/master/Record.html | 16 +- docs/master/Regex.CompileError.html | 2 +- docs/master/Regex.html | 28 +- docs/master/RuntimeError.html | 2 +- docs/master/String.html | 58 +- docs/master/Supervisor.Behaviour.html | 8 +- docs/master/SyntaxError.html | 4 +- docs/master/System.NoAccessCwdError.html | 2 +- docs/master/System.NoHomeError.html | 2 +- docs/master/System.NoTmpDirError.html | 2 +- docs/master/System.html | 40 +- docs/master/SystemLimitError.html | 2 +- docs/master/TokenMissingError.html | 4 +- docs/master/URI.FTP.html | 6 +- docs/master/URI.HTTP.html | 6 +- docs/master/URI.HTTPS.html | 6 +- docs/master/URI.LDAP.html | 6 +- docs/master/URI.Parser.html | 6 +- docs/master/URI.SFTP.html | 6 +- docs/master/URI.TFTP.html | 6 +- docs/master/URI.html | 14 +- docs/master/UndefinedFunctionError.html | 4 +- docs/master/index.html | 2 +- docs/master/modules_list.html | 44 +- docs/master/protocols_list.html | 86 +-- docs/master/records_list.html | 2 +- docs/stable/Access.Atom.html | 4 +- docs/stable/Access.Function.html | 4 +- docs/stable/Access.HashDict.html | 4 +- docs/stable/Access.List.html | 4 +- docs/stable/Access.html | 4 +- docs/stable/Application.Behaviour.html | 2 +- docs/stable/ArgumentError.html | 2 +- docs/stable/ArithmeticError.html | 2 +- docs/stable/BadArityError.html | 4 +- docs/stable/BadFunctionError.html | 4 +- docs/stable/Behaviour.html | 4 +- docs/stable/Binary.Chars.Atom.html | 4 +- docs/stable/Binary.Chars.BitString.html | 4 +- docs/stable/Binary.Chars.List.html | 4 +- docs/stable/Binary.Chars.Number.html | 4 +- docs/stable/Binary.Chars.html | 4 +- docs/stable/Binary.Inspect.Atom.html | 4 +- docs/stable/Binary.Inspect.BitString.html | 4 +- docs/stable/Binary.Inspect.Function.html | 4 +- docs/stable/Binary.Inspect.HashDict.html | 4 +- docs/stable/Binary.Inspect.List.html | 4 +- docs/stable/Binary.Inspect.Number.html | 4 +- docs/stable/Binary.Inspect.PID.html | 4 +- docs/stable/Binary.Inspect.Port.html | 4 +- docs/stable/Binary.Inspect.Range.html | 4 +- docs/stable/Binary.Inspect.Reference.html | 4 +- docs/stable/Binary.Inspect.Regex.html | 4 +- docs/stable/Binary.Inspect.Tuple.html | 4 +- docs/stable/Binary.Inspect.html | 4 +- docs/stable/Bitwise.html | 28 +- docs/stable/CaseClauseError.html | 4 +- docs/stable/Code.LoadError.html | 4 +- docs/stable/Code.html | 44 +- docs/stable/CompileError.html | 4 +- docs/stable/Dict.html | 90 +-- docs/stable/EEx.AssignsEngine.html | 2 +- docs/stable/EEx.Engine.html | 8 +- docs/stable/EEx.SmartEngine.html | 6 +- docs/stable/EEx.SyntaxError.html | 2 +- docs/stable/EEx.TransformerEngine.html | 2 +- docs/stable/EEx.html | 14 +- docs/stable/Enum.EmptyError.html | 2 +- docs/stable/Enum.OutOfBoundsError.html | 2 +- docs/stable/Enum.html | 82 +-- ...Function.html => Enumerable.Function.html} | 24 +- .../Enumerable.HashDict.html} | 24 +- ...terator.List.html => Enumerable.List.html} | 24 +- .../Enumerable.Range.html} | 24 +- .../{Enum.Iterator.html => Enumerable.html} | 89 ++- docs/stable/ErlangError.html | 4 +- docs/stable/ExUnit.AssertionError.html | 2 +- docs/stable/ExUnit.Assertions.html | 36 +- docs/stable/ExUnit.CLIFormatter.html | 26 +- docs/stable/ExUnit.Callbacks.html | 10 +- docs/stable/ExUnit.CaptureIO.html | 40 +- docs/stable/ExUnit.Case.html | 4 +- docs/stable/ExUnit.CaseTemplate.html | 4 +- docs/stable/ExUnit.DocTest.html | 4 +- docs/stable/ExUnit.ExpectationError.html | 6 +- docs/stable/ExUnit.Formatter.html | 14 +- docs/stable/ExUnit.Test.html | 2 +- docs/stable/ExUnit.TestCase.html | 2 +- docs/stable/ExUnit.html | 10 +- docs/stable/Exception.html | 12 +- docs/stable/File.CopyError.html | 4 +- docs/stable/File.Error.html | 4 +- docs/stable/File.IteratorError.html | 4 +- docs/stable/File.Stat.html | 2 +- docs/stable/File.html | 136 ++--- docs/stable/FunctionClauseError.html | 4 +- docs/stable/GenEvent.Behaviour.html | 2 +- docs/stable/GenServer.Behaviour.html | 2 +- docs/stable/HashDict.html | 61 +- docs/stable/IEx.Autocomplete.html | 4 +- docs/stable/IEx.Helpers.html | 62 +- docs/stable/IEx.html | 76 ++- docs/stable/IO.ANSI.html | 112 ++-- docs/stable/IO.html | 26 +- docs/stable/Kernel.CLI.html | 4 +- docs/stable/Kernel.ParallelCompiler.html | 6 +- docs/stable/Kernel.ParallelRequire.html | 4 +- docs/stable/Kernel.SpecialForms.html | 44 +- docs/stable/Kernel.Typespec.html | 34 +- docs/stable/Kernel.html | 570 +++++++++--------- docs/stable/KeyError.html | 4 +- docs/stable/Keyword.html | 44 +- docs/stable/List.Chars.Atom.html | 4 +- docs/stable/List.Chars.BitString.html | 4 +- docs/stable/List.Chars.List.html | 4 +- docs/stable/List.Chars.Number.html | 4 +- docs/stable/List.Chars.html | 4 +- docs/stable/List.html | 38 +- docs/stable/ListDict.html | 48 +- docs/stable/Macro.Env.html | 10 +- docs/stable/Macro.html | 24 +- docs/stable/MatchError.html | 4 +- docs/stable/Mix.Dep.html | 2 +- docs/stable/Mix.Deps.html | 40 +- docs/stable/Mix.Error.html | 2 +- docs/stable/Mix.Generator.html | 12 +- docs/stable/Mix.InvalidTaskError.html | 4 +- docs/stable/Mix.Local.html | 10 +- docs/stable/Mix.NoProjectError.html | 2 +- docs/stable/Mix.NoTaskError.html | 4 +- docs/stable/Mix.OutOfDateDepsError.html | 4 +- docs/stable/Mix.Project.html | 24 +- docs/stable/Mix.SCM.html | 26 +- docs/stable/Mix.Shell.IO.html | 12 +- docs/stable/Mix.Shell.Process.html | 14 +- docs/stable/Mix.Shell.html | 14 +- docs/stable/Mix.Task.html | 26 +- docs/stable/Mix.Tasks.App.Start.html | 4 +- docs/stable/Mix.Tasks.Clean.html | 4 +- docs/stable/Mix.Tasks.Compile.App.html | 4 +- docs/stable/Mix.Tasks.Compile.Elixir.html | 4 +- docs/stable/Mix.Tasks.Compile.Erlang.html | 10 +- docs/stable/Mix.Tasks.Compile.Leex.html | 4 +- docs/stable/Mix.Tasks.Compile.Yecc.html | 4 +- docs/stable/Mix.Tasks.Compile.html | 4 +- docs/stable/Mix.Tasks.Deps.Check.html | 4 +- docs/stable/Mix.Tasks.Deps.Clean.html | 4 +- docs/stable/Mix.Tasks.Deps.Compile.html | 4 +- docs/stable/Mix.Tasks.Deps.Get.html | 4 +- docs/stable/Mix.Tasks.Deps.Loadpaths.html | 4 +- docs/stable/Mix.Tasks.Deps.Unlock.html | 4 +- docs/stable/Mix.Tasks.Deps.Update.html | 4 +- docs/stable/Mix.Tasks.Deps.html | 4 +- docs/stable/Mix.Tasks.Do.html | 4 +- docs/stable/Mix.Tasks.Escriptize.html | 4 +- docs/stable/Mix.Tasks.Help.html | 4 +- docs/stable/Mix.Tasks.Loadpaths.html | 4 +- docs/stable/Mix.Tasks.Local.Install.html | 4 +- docs/stable/Mix.Tasks.Local.Rebar.html | 6 +- docs/stable/Mix.Tasks.Local.Uninstall.html | 4 +- docs/stable/Mix.Tasks.Local.html | 4 +- docs/stable/Mix.Tasks.New.html | 4 +- docs/stable/Mix.Tasks.Run.html | 4 +- docs/stable/Mix.Tasks.Test.html | 4 +- docs/stable/Mix.Utils.html | 32 +- docs/stable/Mix.html | 16 +- docs/stable/Module.html | 46 +- docs/stable/Node.html | 34 +- docs/stable/OptionParser.html | 6 +- docs/stable/Path.html | 36 +- docs/stable/Port.html | 20 +- docs/stable/Process.html | 64 +- docs/stable/Protocol.UndefinedError.html | 4 +- docs/stable/Range.Iterator.Number.html | 12 +- docs/stable/Range.Iterator.html | 19 +- docs/stable/Range.html | 2 +- docs/stable/Record.html | 16 +- docs/stable/Regex.CompileError.html | 2 +- docs/stable/Regex.html | 28 +- docs/stable/RuntimeError.html | 2 +- docs/stable/String.html | 58 +- docs/stable/Supervisor.Behaviour.html | 8 +- docs/stable/SyntaxError.html | 4 +- docs/stable/System.NoAccessCwdError.html | 2 +- docs/stable/System.NoHomeError.html | 2 +- docs/stable/System.NoTmpDirError.html | 2 +- docs/stable/System.html | 40 +- docs/stable/SystemLimitError.html | 2 +- docs/stable/TokenMissingError.html | 4 +- docs/stable/URI.FTP.html | 6 +- docs/stable/URI.HTTP.html | 6 +- docs/stable/URI.HTTPS.html | 6 +- docs/stable/URI.LDAP.html | 6 +- docs/stable/URI.Parser.html | 6 +- docs/stable/URI.SFTP.html | 6 +- docs/stable/URI.TFTP.html | 6 +- docs/stable/URI.html | 14 +- docs/stable/UndefinedFunctionError.html | 4 +- docs/stable/index.html | 2 +- docs/stable/modules_list.html | 44 +- docs/stable/protocols_list.html | 86 +-- docs/stable/records_list.html | 2 +- 352 files changed, 3156 insertions(+), 3014 deletions(-) rename docs/master/{Enum.Iterator.Function.html => Enumerable.Function.html} (70%) rename docs/{stable/Enum.Iterator.HashDict.html => master/Enumerable.HashDict.html} (70%) rename docs/master/{Enum.Iterator.List.html => Enumerable.List.html} (70%) rename docs/{stable/Enum.Iterator.Range.html => master/Enumerable.Range.html} (73%) rename docs/master/{Enum.Iterator.html => Enumerable.html} (54%) rename docs/stable/{Enum.Iterator.Function.html => Enumerable.Function.html} (70%) rename docs/{master/Enum.Iterator.HashDict.html => stable/Enumerable.HashDict.html} (70%) rename docs/stable/{Enum.Iterator.List.html => Enumerable.List.html} (70%) rename docs/{master/Enum.Iterator.Range.html => stable/Enumerable.Range.html} (73%) rename docs/stable/{Enum.Iterator.html => Enumerable.html} (54%) diff --git a/docs/master/Access.Atom.html b/docs/master/Access.Atom.html index 93b060e67..c99501cb9 100644 --- a/docs/master/Access.Atom.html +++ b/docs/master/Access.Atom.html @@ -29,7 +29,7 @@

                    - Source + Source @@ -63,7 +63,7 @@

                    Functions

                    an exception.

                  - Source + Source diff --git a/docs/master/Access.Function.html b/docs/master/Access.Function.html index 6c3b1811f..b4280fadc 100644 --- a/docs/master/Access.Function.html +++ b/docs/master/Access.Function.html @@ -29,7 +29,7 @@

                  - Source + Source @@ -64,7 +64,7 @@

                  Functions

                  passed as argument in places a dict would also fit.

                  - Source + Source diff --git a/docs/master/Access.HashDict.html b/docs/master/Access.HashDict.html index 4503fa350..a5bb6352b 100644 --- a/docs/master/Access.HashDict.html +++ b/docs/master/Access.HashDict.html @@ -29,7 +29,7 @@

                  - Source + Source @@ -60,7 +60,7 @@

                  Functions

                  - Source + Source diff --git a/docs/master/Access.List.html b/docs/master/Access.List.html index 039f84ecc..bd6fcaf8a 100644 --- a/docs/master/Access.List.html +++ b/docs/master/Access.List.html @@ -29,7 +29,7 @@

                  - Source + Source @@ -72,7 +72,7 @@

                  Examples

                  - Source + Source diff --git a/docs/master/Access.html b/docs/master/Access.html index f5c601309..548c65e81 100644 --- a/docs/master/Access.html +++ b/docs/master/Access.html @@ -40,7 +40,7 @@

                  - Source + Source

                  Implementations

                  @@ -101,7 +101,7 @@

                  Functions

                  Receives the element being accessed and the access item.

                  - Source + Source diff --git a/docs/master/Application.Behaviour.html b/docs/master/Application.Behaviour.html index da32d224d..3f40c6411 100644 --- a/docs/master/Application.Behaviour.html +++ b/docs/master/Application.Behaviour.html @@ -78,7 +78,7 @@

                  Example

                  - Source + Source diff --git a/docs/master/ArgumentError.html b/docs/master/ArgumentError.html index a3ec54bd4..090f3a09a 100644 --- a/docs/master/ArgumentError.html +++ b/docs/master/ArgumentError.html @@ -29,7 +29,7 @@

                  - Source + Source diff --git a/docs/master/ArithmeticError.html b/docs/master/ArithmeticError.html index cb2b4e534..78e61f141 100644 --- a/docs/master/ArithmeticError.html +++ b/docs/master/ArithmeticError.html @@ -29,7 +29,7 @@

                  - Source + Source diff --git a/docs/master/BadArityError.html b/docs/master/BadArityError.html index 421ce26d2..ab4e36d43 100644 --- a/docs/master/BadArityError.html +++ b/docs/master/BadArityError.html @@ -29,7 +29,7 @@

                  - Source + Source @@ -77,7 +77,7 @@

                  Functions

                  - Source + Source diff --git a/docs/master/BadFunctionError.html b/docs/master/BadFunctionError.html index 6889999ed..2781f8ed1 100644 --- a/docs/master/BadFunctionError.html +++ b/docs/master/BadFunctionError.html @@ -29,7 +29,7 @@

                  - Source + Source @@ -71,7 +71,7 @@

                  Functions

                  - Source + Source diff --git a/docs/master/Behaviour.html b/docs/master/Behaviour.html index 9d1511984..b36ec8f4c 100644 --- a/docs/master/Behaviour.html +++ b/docs/master/Behaviour.html @@ -73,7 +73,7 @@

                  Implementation

                  - Source + Source @@ -107,7 +107,7 @@

                  Macros

                  Defines a callback according to the given type specification.

                  - Source + Source diff --git a/docs/master/Binary.Chars.Atom.html b/docs/master/Binary.Chars.Atom.html index b8ca4a619..ff67ab87b 100644 --- a/docs/master/Binary.Chars.Atom.html +++ b/docs/master/Binary.Chars.Atom.html @@ -29,7 +29,7 @@

                  - Source + Source @@ -62,7 +62,7 @@

                  Functions

                  nil which is converted to an empty string.

                  - Source + Source diff --git a/docs/master/Binary.Chars.BitString.html b/docs/master/Binary.Chars.BitString.html index dd6c9da4b..9c7a01ddc 100644 --- a/docs/master/Binary.Chars.BitString.html +++ b/docs/master/Binary.Chars.BitString.html @@ -29,7 +29,7 @@

                  - Source + Source @@ -61,7 +61,7 @@

                  Functions

                  Simply returns the binary itself.

                  - Source + Source diff --git a/docs/master/Binary.Chars.List.html b/docs/master/Binary.Chars.List.html index bb611efb2..520e27d19 100644 --- a/docs/master/Binary.Chars.List.html +++ b/docs/master/Binary.Chars.List.html @@ -29,7 +29,7 @@

                  - Source + Source @@ -72,7 +72,7 @@

                  Examples

                  - Source + Source diff --git a/docs/master/Binary.Chars.Number.html b/docs/master/Binary.Chars.Number.html index d1f7e24a4..7742c956b 100644 --- a/docs/master/Binary.Chars.Number.html +++ b/docs/master/Binary.Chars.Number.html @@ -29,7 +29,7 @@

                  - Source + Source @@ -61,7 +61,7 @@

                  Functions

                  Simply converts the number (integer or a float) to a binary.

                  - Source + Source diff --git a/docs/master/Binary.Chars.html b/docs/master/Binary.Chars.html index e3b444ff9..2491145e2 100644 --- a/docs/master/Binary.Chars.html +++ b/docs/master/Binary.Chars.html @@ -43,7 +43,7 @@

                  - Source + Source

                  Implementations

                  @@ -103,7 +103,7 @@

                  Functions

                  - Source + Source diff --git a/docs/master/Binary.Inspect.Atom.html b/docs/master/Binary.Inspect.Atom.html index 1e93d94b6..325c917c2 100644 --- a/docs/master/Binary.Inspect.Atom.html +++ b/docs/master/Binary.Inspect.Atom.html @@ -49,7 +49,7 @@

                  Examples

                  - Source + Source @@ -80,7 +80,7 @@

                  Functions

                  - Source + Source diff --git a/docs/master/Binary.Inspect.BitString.html b/docs/master/Binary.Inspect.BitString.html index 306c2c45b..d2b44a08e 100644 --- a/docs/master/Binary.Inspect.BitString.html +++ b/docs/master/Binary.Inspect.BitString.html @@ -43,7 +43,7 @@

                  Examples

                  - Source + Source @@ -74,7 +74,7 @@

                  Functions

                  - Source + Source diff --git a/docs/master/Binary.Inspect.Function.html b/docs/master/Binary.Inspect.Function.html index 7d43b80aa..414e8a52c 100644 --- a/docs/master/Binary.Inspect.Function.html +++ b/docs/master/Binary.Inspect.Function.html @@ -34,7 +34,7 @@

                  - Source + Source @@ -65,7 +65,7 @@

                  Functions

                  - Source + Source diff --git a/docs/master/Binary.Inspect.HashDict.html b/docs/master/Binary.Inspect.HashDict.html index e8684c6c7..587e35da1 100644 --- a/docs/master/Binary.Inspect.HashDict.html +++ b/docs/master/Binary.Inspect.HashDict.html @@ -29,7 +29,7 @@

                  - Source + Source @@ -60,7 +60,7 @@

                  Functions

                  - Source + Source diff --git a/docs/master/Binary.Inspect.List.html b/docs/master/Binary.Inspect.List.html index b03cf1d45..c4093c929 100644 --- a/docs/master/Binary.Inspect.List.html +++ b/docs/master/Binary.Inspect.List.html @@ -52,7 +52,7 @@

                  Examples

                  - Source + Source @@ -83,7 +83,7 @@

                  Functions

                  - Source + Source diff --git a/docs/master/Binary.Inspect.Number.html b/docs/master/Binary.Inspect.Number.html index e6ef9fd20..8f683bb23 100644 --- a/docs/master/Binary.Inspect.Number.html +++ b/docs/master/Binary.Inspect.Number.html @@ -40,7 +40,7 @@

                  Examples

                  - Source + Source @@ -71,7 +71,7 @@

                  Functions

                  - Source + Source diff --git a/docs/master/Binary.Inspect.PID.html b/docs/master/Binary.Inspect.PID.html index 43164d898..ddbab6ab8 100644 --- a/docs/master/Binary.Inspect.PID.html +++ b/docs/master/Binary.Inspect.PID.html @@ -34,7 +34,7 @@

                  - Source + Source @@ -65,7 +65,7 @@

                  Functions

                  - Source + Source diff --git a/docs/master/Binary.Inspect.Port.html b/docs/master/Binary.Inspect.Port.html index f0e38da08..4df9fa842 100644 --- a/docs/master/Binary.Inspect.Port.html +++ b/docs/master/Binary.Inspect.Port.html @@ -34,7 +34,7 @@

                  - Source + Source @@ -65,7 +65,7 @@

                  Functions

                  - Source + Source diff --git a/docs/master/Binary.Inspect.Range.html b/docs/master/Binary.Inspect.Range.html index 4b0e56c9e..947f409f0 100644 --- a/docs/master/Binary.Inspect.Range.html +++ b/docs/master/Binary.Inspect.Range.html @@ -29,7 +29,7 @@

                  - Source + Source @@ -60,7 +60,7 @@

                  Functions

                  - Source + Source diff --git a/docs/master/Binary.Inspect.Reference.html b/docs/master/Binary.Inspect.Reference.html index 182272e50..0e95faa90 100644 --- a/docs/master/Binary.Inspect.Reference.html +++ b/docs/master/Binary.Inspect.Reference.html @@ -34,7 +34,7 @@

                  - Source + Source @@ -65,7 +65,7 @@

                  Functions

                  - Source + Source diff --git a/docs/master/Binary.Inspect.Regex.html b/docs/master/Binary.Inspect.Regex.html index 17afa4e46..8fe066302 100644 --- a/docs/master/Binary.Inspect.Regex.html +++ b/docs/master/Binary.Inspect.Regex.html @@ -40,7 +40,7 @@

                  Examples

                  - Source + Source @@ -71,7 +71,7 @@

                  Functions

                  - Source + Source diff --git a/docs/master/Binary.Inspect.Tuple.html b/docs/master/Binary.Inspect.Tuple.html index 8889c1747..8aa2becf8 100644 --- a/docs/master/Binary.Inspect.Tuple.html +++ b/docs/master/Binary.Inspect.Tuple.html @@ -43,7 +43,7 @@

                  Examples

                  - Source + Source @@ -74,7 +74,7 @@

                  Functions

                  - Source + Source diff --git a/docs/master/Binary.Inspect.html b/docs/master/Binary.Inspect.html index d9b701791..83719ceee 100644 --- a/docs/master/Binary.Inspect.html +++ b/docs/master/Binary.Inspect.html @@ -40,7 +40,7 @@

                  - Source + Source

                  Implementations

                  @@ -148,7 +148,7 @@

                  Functions

                  - Source + Source diff --git a/docs/master/Bitwise.html b/docs/master/Bitwise.html index 17e6ffdcf..de8d1fea4 100644 --- a/docs/master/Bitwise.html +++ b/docs/master/Bitwise.html @@ -52,7 +52,7 @@

                  - Source + Source @@ -146,7 +146,7 @@

                  Macros

                  Bitwise and as operator.

                  - Source + Source

                  @@ -155,7 +155,7 @@

                  Macros

                  Arithmetic bitshift left as operator.

                  - Source + Source

                  @@ -164,7 +164,7 @@

                  Macros

                  Arithmetic bitshift right as operator.

                  - Source + Source

                  @@ -173,7 +173,7 @@

                  Macros

                  Bitwise xor as operator.

                  - Source + Source

                  @@ -188,7 +188,7 @@

                  Macros

                - Source + Source

                @@ -197,7 +197,7 @@

                Macros

                Bitwise and.

                - Source + Source

                @@ -206,7 +206,7 @@

                Macros

                Bitwise not.

                - Source + Source

                @@ -215,7 +215,7 @@

                Macros

                Bitwise or.

                - Source + Source

                @@ -224,7 +224,7 @@

                Macros

                Arithmetic bitshift left.

                - Source + Source

                @@ -233,7 +233,7 @@

                Macros

                Arithmetic bitshift right.

                - Source + Source

                @@ -242,7 +242,7 @@

                Macros

                Bitwise xor.

                - Source + Source

                @@ -251,7 +251,7 @@

                Macros

                Bitwise or as operator.

                - Source + Source

                @@ -260,7 +260,7 @@

                Macros

                Bitwise not as operator.

                - Source + Source
                diff --git a/docs/master/CaseClauseError.html b/docs/master/CaseClauseError.html index 22814350e..0240f6748 100644 --- a/docs/master/CaseClauseError.html +++ b/docs/master/CaseClauseError.html @@ -29,7 +29,7 @@

                - Source + Source @@ -71,7 +71,7 @@

                Functions

                - Source + Source diff --git a/docs/master/Code.LoadError.html b/docs/master/Code.LoadError.html index 32c74822a..347c4e3f7 100644 --- a/docs/master/Code.LoadError.html +++ b/docs/master/Code.LoadError.html @@ -29,7 +29,7 @@

                - Source + Source @@ -71,7 +71,7 @@

                Functions

                - Source + Source diff --git a/docs/master/Code.html b/docs/master/Code.html index fedbf456b..042f12996 100644 --- a/docs/master/Code.html +++ b/docs/master/Code.html @@ -36,7 +36,7 @@

                - Source + Source @@ -159,7 +159,7 @@

                Functions

                The path is expanded with Path.expand before added.

                - Source + Source

                @@ -170,7 +170,7 @@

                Functions

                binary.

                - Source + Source

                @@ -183,7 +183,7 @@

                Functions

                For compiling many files at once, check Kernel.ParallelCompiler.

                - Source + Source

                @@ -193,7 +193,7 @@

                Functions

                Check compiler_options/1 for more information.

                - Source + Source

                @@ -215,7 +215,7 @@

                Functions

              - Source + Source

              @@ -225,7 +225,7 @@

              Functions

              The path is expanded with Path.expand before deleted.

              - Source + Source

              @@ -244,7 +244,7 @@

              Functions

              and when to use ensure_loaded/1 or ensure_compiled/1.

              - Source + Source

              @@ -254,7 +254,7 @@

              Functions

              it could be ensured or not.

              - Source + Source

              @@ -298,7 +298,7 @@

              Code.ensure_compiled

              that needs to invoke a module for callback information.

              - Source + Source

              @@ -308,13 +308,13 @@

              Code.ensure_compiled

              it could be ensured or not.

              - Source + Source

              eval_quoted(quoted, binding // [], opts // [])

              -

              Evalutes the quoted contents.

              +

              Evaluates the quoted contents.

              This function accepts a list of environment options. Check Code.eval_string for more information.

              @@ -335,13 +335,13 @@

              Examples

              - Source + Source

              eval_string(string, binding // [], opts // [])

              -

              Evalutes the contents given by string. The second argument is the +

              Evaluates the contents given by string. The second argument is the binding (which should be a keyword) followed by a keyword list of environment options. Those options can be:

              @@ -384,7 +384,7 @@

              Examples

              - Source + Source

              @@ -402,7 +402,7 @@

              Examples

              require_file if you don't want a file to be loaded concurrently.

              - Source + Source

              @@ -411,7 +411,7 @@

              Examples

              Returns all the loaded files.

              - Source + Source

              @@ -421,7 +421,7 @@

              Examples

              The path is expanded with Path.expand before added.

              - Source + Source

              @@ -440,7 +440,7 @@

              Examples

              Check load_file if you want a file to be loaded concurrently.

              - Source + Source

              @@ -466,7 +466,7 @@

              Macro.to_binary/1

              representation.

              - Source + Source

              @@ -480,7 +480,7 @@

              Macro.to_binary/1

              Check Code.string_to_ast/2 for options information.

              - Source + Source

              @@ -492,7 +492,7 @@

              Macro.to_binary/1

              allowing it to be required again.

              - Source + Source diff --git a/docs/master/CompileError.html b/docs/master/CompileError.html index 60f4bca8d..e6d9e5046 100644 --- a/docs/master/CompileError.html +++ b/docs/master/CompileError.html @@ -29,7 +29,7 @@

              - Source + Source @@ -83,7 +83,7 @@

              Functions

              - Source + Source diff --git a/docs/master/Dict.html b/docs/master/Dict.html index b5c59aa0f..6916718f2 100644 --- a/docs/master/Dict.html +++ b/docs/master/Dict.html @@ -60,7 +60,7 @@

              Protocols

              :world -

              And also the Enum.Iterator protocol, allowing one to write:

              +

              And also the Enumerable protocol, allowing one to write:

              Enum.each(dict, fn ({ k, v }) ->
                 IO.puts "#{k}: #{v}"
              @@ -70,7 +70,7 @@ 

              Protocols

              - Source + Source @@ -330,7 +330,7 @@

              Examples

              - Source + Source

              @@ -353,7 +353,7 @@

              Examples

              - Source + Source

              @@ -362,7 +362,7 @@

              Examples

              Returns an empty dict of the same type as dict.

              - Source + Source

              @@ -385,7 +385,7 @@

              Examples

              - Source + Source

              @@ -406,7 +406,7 @@

              Examples

              - Source + Source

              @@ -426,7 +426,7 @@

              Examples

              - Source + Source

              @@ -451,7 +451,7 @@

              Examples

              - Source + Source

              @@ -471,7 +471,7 @@

              Examples

              - Source + Source

              @@ -489,7 +489,7 @@

              Examples

              - Source + Source

              @@ -508,7 +508,7 @@

              Examples

              - Source + Source

              @@ -530,7 +530,7 @@

              Examples

              - Source + Source

              @@ -558,7 +558,7 @@

              Examples

              - Source + Source

              @@ -576,7 +576,7 @@

              Examples

              - Source + Source

              @@ -593,7 +593,7 @@

              Examples

              - Source + Source

              @@ -609,7 +609,7 @@

              Examples

              - Source + Source

              @@ -640,7 +640,7 @@

              Examples

              - Source + Source

              @@ -663,7 +663,7 @@

              Examples

              - Source + Source

              @@ -673,7 +673,7 @@

              Examples

              No particular order is enforced.

              - Source + Source

              @@ -691,7 +691,7 @@

              Examples

              - Source + Source

              @@ -710,7 +710,7 @@

              Examples

              - Source + Source

              @@ -726,7 +726,7 @@

              Examples

              - Source + Source @@ -743,7 +743,7 @@

              Callbacks

              - Source + Source

              @@ -751,7 +751,7 @@

              Callbacks

              - Source + Source

              @@ -759,7 +759,7 @@

              Callbacks

              - Source + Source

              @@ -767,7 +767,7 @@

              Callbacks

              - Source + Source

              @@ -775,7 +775,7 @@

              Callbacks

              - Source + Source

              @@ -783,7 +783,7 @@

              Callbacks

              - Source + Source

              @@ -791,7 +791,7 @@

              Callbacks

              - Source + Source

              @@ -799,7 +799,7 @@

              Callbacks

              - Source + Source

              @@ -807,7 +807,7 @@

              Callbacks

              - Source + Source

              @@ -815,7 +815,7 @@

              Callbacks

              - Source + Source

              @@ -823,7 +823,7 @@

              Callbacks

              - Source + Source

              @@ -831,7 +831,7 @@

              Callbacks

              - Source + Source

              @@ -839,7 +839,7 @@

              Callbacks

              - Source + Source

              @@ -847,7 +847,7 @@

              Callbacks

              - Source + Source

              @@ -855,7 +855,7 @@

              Callbacks

              - Source + Source

              @@ -863,7 +863,7 @@

              Callbacks

              - Source + Source

              @@ -871,7 +871,7 @@

              Callbacks

              - Source + Source

              @@ -879,7 +879,7 @@

              Callbacks

              - Source + Source

              @@ -887,7 +887,7 @@

              Callbacks

              - Source + Source

              @@ -895,7 +895,7 @@

              Callbacks

              - Source + Source

              @@ -903,7 +903,7 @@

              Callbacks

              - Source + Source

              @@ -911,7 +911,7 @@

              Callbacks

              - Source + Source
              diff --git a/docs/master/EEx.AssignsEngine.html b/docs/master/EEx.AssignsEngine.html index a204623a9..b3630b807 100644 --- a/docs/master/EEx.AssignsEngine.html +++ b/docs/master/EEx.AssignsEngine.html @@ -53,7 +53,7 @@

              Examples

              - Source + Source diff --git a/docs/master/EEx.Engine.html b/docs/master/EEx.Engine.html index 8c2f180c2..6d3b208bc 100644 --- a/docs/master/EEx.Engine.html +++ b/docs/master/EEx.Engine.html @@ -52,7 +52,7 @@

              - Source + Source @@ -93,7 +93,7 @@

              Functions

              - Source + Source

              @@ -108,7 +108,7 @@

              Functions

              All other markers are not implemented by this engine.

              - Source + Source

              @@ -117,7 +117,7 @@

              Functions

              The default implementation simply concatenates text to the buffer.

              - Source + Source
              diff --git a/docs/master/EEx.SmartEngine.html b/docs/master/EEx.SmartEngine.html index 1a87e1514..77b42521e 100644 --- a/docs/master/EEx.SmartEngine.html +++ b/docs/master/EEx.SmartEngine.html @@ -34,7 +34,7 @@

              - Source + Source @@ -70,7 +70,7 @@

              Functions

              - Source + Source

              @@ -78,7 +78,7 @@

              Functions

              - Source + Source
              diff --git a/docs/master/EEx.SyntaxError.html b/docs/master/EEx.SyntaxError.html index b51329ebb..4ae0ac5de 100644 --- a/docs/master/EEx.SyntaxError.html +++ b/docs/master/EEx.SyntaxError.html @@ -29,7 +29,7 @@

              - Source + Source diff --git a/docs/master/EEx.TransformerEngine.html b/docs/master/EEx.TransformerEngine.html index 0cac9fa92..4a3772c4b 100644 --- a/docs/master/EEx.TransformerEngine.html +++ b/docs/master/EEx.TransformerEngine.html @@ -39,7 +39,7 @@

              - Source + Source diff --git a/docs/master/EEx.html b/docs/master/EEx.html index 1ff63367f..84d061682 100644 --- a/docs/master/EEx.html +++ b/docs/master/EEx.html @@ -109,7 +109,7 @@

              Macros

              - Source + Source @@ -172,7 +172,7 @@

              Functions

              that can be evaluated by Elixir or compiled to a function.

              - Source + Source

              @@ -182,7 +182,7 @@

              Functions

              that can be evaluated by Elixir or compiled to a function.

              - Source + Source

              @@ -201,7 +201,7 @@

              Examples

              - Source + Source

              @@ -216,7 +216,7 @@

              Examples

              - Source + Source @@ -252,7 +252,7 @@

              Examples

              - Source + Source

              @@ -273,7 +273,7 @@

              Examples

              - Source + Source diff --git a/docs/master/Enum.EmptyError.html b/docs/master/Enum.EmptyError.html index 44942b6ea..b6d3d272e 100644 --- a/docs/master/Enum.EmptyError.html +++ b/docs/master/Enum.EmptyError.html @@ -29,7 +29,7 @@

              - Source + Source diff --git a/docs/master/Enum.OutOfBoundsError.html b/docs/master/Enum.OutOfBoundsError.html index 56a5dfa9b..c5363a923 100644 --- a/docs/master/Enum.OutOfBoundsError.html +++ b/docs/master/Enum.OutOfBoundsError.html @@ -29,7 +29,7 @@

              - Source + Source diff --git a/docs/master/Enum.html b/docs/master/Enum.html index ccce93eff..448d5992d 100644 --- a/docs/master/Enum.html +++ b/docs/master/Enum.html @@ -28,7 +28,7 @@

              Provides a set of algorithms that enumerate over collections according to the -Enum.Iterator protocol. Most of the functions in this module have two +Enumerable protocol. Most of the functions in this module have two flavours. If a given collection implements the mentioned protocol (like list, for instance), you can do:

              @@ -42,7 +42,7 @@

              - Source + Source @@ -279,7 +279,7 @@

              Examples

              - Source + Source

              @@ -307,7 +307,7 @@

              Examples

              - Source + Source

              @@ -332,7 +332,7 @@

              Examples

              - Source + Source

              @@ -347,7 +347,7 @@

              Examples

              - Source + Source

              @@ -356,7 +356,7 @@

              Examples

              Counts for how many items the function returns true.

              - Source + Source

              @@ -376,7 +376,7 @@

              Examples

              - Source + Source

              @@ -392,7 +392,7 @@

              Examples

              - Source + Source

              @@ -408,7 +408,7 @@

              Examples

              - Source + Source

              @@ -425,7 +425,7 @@

              Examples

              - Source + Source

              @@ -447,7 +447,7 @@

              Examples

              - Source + Source

              @@ -468,7 +468,7 @@

              Examples

              - Source + Source

              @@ -484,7 +484,7 @@

              Examples

              - Source + Source

              @@ -499,7 +499,7 @@

              Examples

              - Source + Source

              @@ -521,7 +521,7 @@

              Examples

              - Source + Source

              @@ -542,7 +542,7 @@

              Examples

              - Source + Source

              @@ -561,7 +561,7 @@

              Examples

              - Source + Source

              @@ -578,7 +578,7 @@

              Examples

              - Source + Source

              @@ -604,7 +604,7 @@

              Examples

              - Source + Source

              @@ -627,7 +627,7 @@

              Examples

              - Source + Source

              @@ -653,11 +653,11 @@

              Examples

              - Source + Source

              - map_reduce(collection, acc, f) + map_reduce(collection, acc, fun)

              Invokes the given fun for each item in the collection while also keeping an accumulator. Returns a tuple where @@ -674,7 +674,7 @@

              Examples

              - Source + Source

              @@ -690,7 +690,7 @@

              Examples

              - Source + Source

              @@ -706,7 +706,7 @@

              Examples

              - Source + Source

              @@ -723,7 +723,7 @@

              Examples

              - Source + Source

              @@ -739,7 +739,7 @@

              Examples

              - Source + Source

              @@ -755,7 +755,7 @@

              Examples

              - Source + Source

              @@ -772,7 +772,7 @@

              Examples

              - Source + Source

              @@ -789,7 +789,7 @@

              Examples

              - Source + Source

              @@ -804,7 +804,7 @@

              Examples

              - Source + Source

              @@ -819,7 +819,7 @@

              Examples

              - Source + Source

              @@ -834,7 +834,7 @@

              Examples

              - Source + Source

              @@ -864,7 +864,7 @@

              Examples

              - Source + Source

              @@ -879,7 +879,7 @@

              Examples

              - Source + Source

              @@ -899,7 +899,7 @@

              Examples

              - Source + Source

              @@ -915,7 +915,7 @@

              Examples

              - Source + Source

              @@ -930,7 +930,7 @@

              Examples

              - Source + Source

              @@ -948,7 +948,7 @@

              Examples

              - Source + Source

              @@ -960,7 +960,7 @@

              Examples

              values are filled with nil.

              - Source + Source diff --git a/docs/master/Enum.Iterator.Function.html b/docs/master/Enumerable.Function.html similarity index 70% rename from docs/master/Enum.Iterator.Function.html rename to docs/master/Enumerable.Function.html index 5fba98066..6c6cf1f33 100644 --- a/docs/master/Enum.Iterator.Function.html +++ b/docs/master/Enumerable.Function.html @@ -1,7 +1,7 @@ - Enum.Iterator.Function + Enumerable.Function @@ -21,7 +21,7 @@

              - Enum.Iterator.Function + Enumerable.Function impl @@ -29,7 +29,7 @@

              - Source + Source @@ -45,12 +45,12 @@

              Functions summary

            • - iterator/1 + member?/2
            • - member?/2 + reduce/3
            • @@ -70,23 +70,23 @@

              Functions

              - Source + Source
              -

              - iterator(function) +

              + member?(function, value)

              - Source + Source
              -

              - member?(function, value) +

              + reduce(function, acc, fun)

              - Source + Source
              diff --git a/docs/stable/Enum.Iterator.HashDict.html b/docs/master/Enumerable.HashDict.html similarity index 70% rename from docs/stable/Enum.Iterator.HashDict.html rename to docs/master/Enumerable.HashDict.html index af8b090f6..8c932ddec 100644 --- a/docs/stable/Enum.Iterator.HashDict.html +++ b/docs/master/Enumerable.HashDict.html @@ -1,7 +1,7 @@ - Enum.Iterator.HashDict + Enumerable.HashDict @@ -21,7 +21,7 @@

              - Enum.Iterator.HashDict + Enumerable.HashDict impl @@ -29,7 +29,7 @@

              - Source + Source @@ -45,12 +45,12 @@

              Functions summary

            • - iterator/1 + member?/2
            • - member?/2 + reduce/3
            • @@ -70,23 +70,23 @@

              Functions

              - Source + Source
              -

              - iterator(dict) +

              + member?(dict, arg2)

              - Source + Source
              -

              - member?(dict, arg2) +

              + reduce(dict, acc, fun)

              - Source + Source
              diff --git a/docs/master/Enum.Iterator.List.html b/docs/master/Enumerable.List.html similarity index 70% rename from docs/master/Enum.Iterator.List.html rename to docs/master/Enumerable.List.html index 3203c9205..7a8f0e528 100644 --- a/docs/master/Enum.Iterator.List.html +++ b/docs/master/Enumerable.List.html @@ -1,7 +1,7 @@ - Enum.Iterator.List + Enumerable.List @@ -21,7 +21,7 @@

              - Enum.Iterator.List + Enumerable.List impl @@ -29,7 +29,7 @@

              - Source + Source @@ -45,12 +45,12 @@

              Functions summary

            • - iterator/1 + member?/2
            • - member?/2 + reduce/3
            • @@ -70,23 +70,23 @@

              Functions

              - Source + Source
              -

              - iterator(list) +

              + member?(list, value)

              - Source + Source
              -

              - member?(list, value) +

              + reduce(list1, acc, fun)

              - Source + Source
              diff --git a/docs/stable/Enum.Iterator.Range.html b/docs/master/Enumerable.Range.html similarity index 73% rename from docs/stable/Enum.Iterator.Range.html rename to docs/master/Enumerable.Range.html index 1269e34da..fecce0db8 100644 --- a/docs/stable/Enum.Iterator.Range.html +++ b/docs/master/Enumerable.Range.html @@ -1,7 +1,7 @@ - Enum.Iterator.Range + Enumerable.Range @@ -21,7 +21,7 @@

              - Enum.Iterator.Range + Enumerable.Range impl @@ -29,7 +29,7 @@

              - Source + Source @@ -45,12 +45,12 @@

              Functions summary

            • - iterator/1 + member?/2
            • - member?/2 + reduce/3
            • @@ -70,23 +70,23 @@

              Functions

              - Source + Source
              -

              - iterator(range) +

              + member?(arg1, value)

              - Source + Source
              -

              - member?(arg1, value) +

              + reduce(range, acc, fun)

              - Source + Source
              diff --git a/docs/master/Enum.Iterator.html b/docs/master/Enumerable.html similarity index 54% rename from docs/master/Enum.Iterator.html rename to docs/master/Enumerable.html index 77af0d9ab..5ebf9a540 100644 --- a/docs/master/Enum.Iterator.html +++ b/docs/master/Enumerable.html @@ -1,7 +1,7 @@ - Enum.Iterator + Enumerable @@ -21,7 +21,7 @@

              - Enum.Iterator + Enumerable protocol @@ -33,20 +33,21 @@

              Usually, when you invoke a function in the module Enum, the first argument passed to it is a collection which is forwarded to this protocol in order to -retrieve information on how to iterate the collection.

              +perform operations on the collection.

              For example, in the expression

              Enum.map([1,2,3], &1 * 2)
               
              -

              Enum.map invokes Enum.Iterator.iterator([1,2,3]) to retrieve the iterator -function that will drive the iteration process.

              +

              Enum.map invokes Enumerable.reduce to perform the reducing operation +that builds a mapped list by calling the mapping function &1 * 2 on every +element in the collection and cons'ing the element with the accumulated list.

              - Source + Source

              Implementations

              @@ -54,25 +55,25 @@

              Implementations

            • - Function + Function
            • - HashDict + HashDict
            • - List + List
            • - Range + Range
            • @@ -91,12 +92,12 @@

              Functions summary

            • - iterator/1 + member?/2
            • - member?/2 + reduce/3
            • @@ -117,53 +118,43 @@

              Functions

              The function used to retrieve the collection's size.

              - Source + Source
              -

              - iterator(collection) +

              + member?(collection, value)

              -

              This function must return a tuple of the form { iter, step } where -iter is a function that yields successive values from the collection -each time it is invoked and step is the first step of iteration.

              - -

              Iteration in Elixir happens with the help of an iterator function (named -iter in the paragraph above). When it is invoked, it must return a tuple -with two elements. The first element is the next successive value from the -collection and the second element can be any Elixir term which iter is -going to receive as its argument the next time it is invoked.

              - -

              When there are no more items left to yield, iter must return the atom -:stop.

              - -

              As an example, here is the implementation of iterator for lists:

              - -
              def iterator(list),   do: { iterate(&1), iterate(list) }
              -defp iterate([h|t]),  do: { h, t }
              -defp iterate([]),     do: :stop
              -
              - -

              Here, iterate is the iterator function and { h, t } is a step of -iteration.

              - -

              Iterating lists

              - -

              As a special case, if a data structure needs to be converted to a list in -order to be iterated, iterator can simply return the list and the Enum -module will be able to take over the list and produce a proper iterator -function for it.

              +

              The function used to check if a value exists within the collection.

              - Source + Source
              -

              - member?(collection, value) +

              + reduce(collection, acc, fun)

              -

              The function used to check if a value exists within the collection.

              +

              This function performs the reducing operation on a given collection. It +returns the accumulated value of applying the given function fun on every +element with the accumulated value.

              + +

              As an example, here is the implementation of reduce for lists:

              + +
              def reduce([h|t], acc, fun), do: reduce(t, fun.(h, acc), fun)
              +def reduce([], acc, _fun),   do: acc
              +
              + +

              As an additional example, here is the implementation of Enum.map with +Enumerable:

              + +
              def map(collection, fun) do
              +  Enumerable.reduce(collection, [], fn(entry, acc) ->
              +    [fun.(entry)|acc]
              +  end) |> :lists.reverse
              +end
              +
              - Source + Source
              diff --git a/docs/master/ErlangError.html b/docs/master/ErlangError.html index db73413ca..15ca778d1 100644 --- a/docs/master/ErlangError.html +++ b/docs/master/ErlangError.html @@ -29,7 +29,7 @@

              - Source + Source @@ -71,7 +71,7 @@

              Functions

              - Source + Source
              diff --git a/docs/master/ExUnit.AssertionError.html b/docs/master/ExUnit.AssertionError.html index 4a496fbf6..99d310d44 100644 --- a/docs/master/ExUnit.AssertionError.html +++ b/docs/master/ExUnit.AssertionError.html @@ -29,7 +29,7 @@

              - Source + Source diff --git a/docs/master/ExUnit.Assertions.html b/docs/master/ExUnit.Assertions.html index 25700b23d..ae96a570a 100644 --- a/docs/master/ExUnit.Assertions.html +++ b/docs/master/ExUnit.Assertions.html @@ -46,7 +46,7 @@

              - Source + Source @@ -169,7 +169,7 @@

              Examples

              - Source + Source

              @@ -185,7 +185,7 @@

              Examples

              - Source + Source

              @@ -200,7 +200,7 @@

              Examples

              - Source + Source

              @@ -217,7 +217,7 @@

              Examples

              - Source + Source

              @@ -234,7 +234,7 @@

              Examples

              - Source + Source

              @@ -248,7 +248,7 @@

              Examples

              - Source + Source

              @@ -263,7 +263,7 @@

              Examples

              - Source + Source

              @@ -278,7 +278,7 @@

              Examples

              - Source + Source @@ -306,7 +306,7 @@

              Examples

              - Source + Source

              @@ -333,7 +333,7 @@

              Examples

              - Source + Source

              @@ -357,7 +357,7 @@

              Examples

              - Source + Source

              @@ -372,7 +372,7 @@

              Examples

              - Source + Source

              @@ -387,7 +387,7 @@

              Examples

              - Source + Source

              @@ -402,7 +402,7 @@

              Examples

              - Source + Source

              @@ -419,7 +419,7 @@

              Examples

              - Source + Source

              @@ -441,7 +441,7 @@

              Examples

              - Source + Source

              @@ -459,7 +459,7 @@

              Examples

              - Source + Source diff --git a/docs/master/ExUnit.CLIFormatter.html b/docs/master/ExUnit.CLIFormatter.html index 8c8705987..71fbd10c8 100644 --- a/docs/master/ExUnit.CLIFormatter.html +++ b/docs/master/ExUnit.CLIFormatter.html @@ -33,7 +33,7 @@

              - Source + Source @@ -119,7 +119,7 @@

              Functions

              - Source + Source

              @@ -127,7 +127,7 @@

              Functions

              - Source + Source

              @@ -135,7 +135,7 @@

              Functions

              - Source + Source

              @@ -143,7 +143,7 @@

              Functions

              - Source + Source

              @@ -151,7 +151,7 @@

              Functions

              - Source + Source

              @@ -159,7 +159,7 @@

              Functions

              - Source + Source

              @@ -167,7 +167,7 @@

              Functions

              - Source + Source

              @@ -175,7 +175,7 @@

              Functions

              - Source + Source

              @@ -183,7 +183,7 @@

              Functions

              - Source + Source

              @@ -191,7 +191,7 @@

              Functions

              - Source + Source

              @@ -199,7 +199,7 @@

              Functions

              - Source + Source

              @@ -207,7 +207,7 @@

              Functions

              - Source + Source
              diff --git a/docs/master/ExUnit.Callbacks.html b/docs/master/ExUnit.Callbacks.html index 2005171f1..f74f98880 100644 --- a/docs/master/ExUnit.Callbacks.html +++ b/docs/master/ExUnit.Callbacks.html @@ -65,7 +65,7 @@

              Examples

              - Source + Source @@ -116,7 +116,7 @@

              Macros

              Called before the start of each test.

              - Source + Source

              @@ -127,7 +127,7 @@

              Macros

              Called before the start of a case.

              - Source + Source

              @@ -139,7 +139,7 @@

              Macros

              message teardown will not be run.

              - Source + Source

              @@ -150,7 +150,7 @@

              Macros

              Called after the finish of each case.

              - Source + Source
              diff --git a/docs/master/ExUnit.CaptureIO.html b/docs/master/ExUnit.CaptureIO.html index 81940c26e..8ac28c024 100644 --- a/docs/master/ExUnit.CaptureIO.html +++ b/docs/master/ExUnit.CaptureIO.html @@ -48,7 +48,7 @@

              Examples

              - Source + Source @@ -58,10 +58,20 @@

              Examples

              Functions summary

              @@ -74,8 +84,24 @@

              Functions summary

              Functions

              +

              + capture_io(fun) +

              +
              + + Source + +

              - capture_io(device // :stdio, fun) + capture_io(device, fun) +

              +
              + + Source + +
              +

              + capture_io(device, input, fun)

              Captures IO. Returns nil in case of no output, otherwise returns the binary which is captured outputs.

              @@ -85,7 +111,8 @@

              Functions

              named device like :stderr is also possible globally by giving the registered device name explicitly as argument.

              -

              The input is mocked to return :eof.

              +

              A developer can set a string as an input. The default +input is :eof.

              Examples

              @@ -95,10 +122,15 @@

              Examples

              true iex> capture_io(:stderr, fn -> IO.write(:stderr, "josé") end) == "josé" true +iex> capture_io("this is input", fn-> +...> input = IO.gets "" +...> IO.write input +...> end) == "this is input" +true
              - Source + Source
              diff --git a/docs/master/ExUnit.Case.html b/docs/master/ExUnit.Case.html index 741e6c8d9..bcb475774 100644 --- a/docs/master/ExUnit.Case.html +++ b/docs/master/ExUnit.Case.html @@ -56,7 +56,7 @@

              Examples

              - Source + Source @@ -104,7 +104,7 @@

              Examples

              - Source + Source diff --git a/docs/master/ExUnit.CaseTemplate.html b/docs/master/ExUnit.CaseTemplate.html index 859468a3e..58c2fab64 100644 --- a/docs/master/ExUnit.CaseTemplate.html +++ b/docs/master/ExUnit.CaseTemplate.html @@ -57,7 +57,7 @@

              Example

              - Source + Source @@ -94,7 +94,7 @@

              Macros

              this module is used.

              - Source + Source diff --git a/docs/master/ExUnit.DocTest.html b/docs/master/ExUnit.DocTest.html index 42e0372f8..d00b35ba3 100644 --- a/docs/master/ExUnit.DocTest.html +++ b/docs/master/ExUnit.DocTest.html @@ -119,7 +119,7 @@

              When not to use doctest

              - Source + Source @@ -181,7 +181,7 @@

              Examples

              This macro is auto-imported into every ExUnit.Case.

              - Source + Source diff --git a/docs/master/ExUnit.ExpectationError.html b/docs/master/ExUnit.ExpectationError.html index 19c5d3c05..212afddb8 100644 --- a/docs/master/ExUnit.ExpectationError.html +++ b/docs/master/ExUnit.ExpectationError.html @@ -29,7 +29,7 @@

              - Source + Source @@ -106,7 +106,7 @@

              Functions

              - Source + Source

              @@ -114,7 +114,7 @@

              Functions

              - Source + Source
              diff --git a/docs/master/ExUnit.Formatter.html b/docs/master/ExUnit.Formatter.html index 074c8119d..2a94f6ddc 100644 --- a/docs/master/ExUnit.Formatter.html +++ b/docs/master/ExUnit.Formatter.html @@ -35,7 +35,7 @@

              - Source + Source @@ -95,7 +95,7 @@

              Callbacks

              - Source + Source

              @@ -103,7 +103,7 @@

              Callbacks

              - Source + Source

              @@ -111,7 +111,7 @@

              Callbacks

              - Source + Source

              @@ -119,7 +119,7 @@

              Callbacks

              - Source + Source

              @@ -127,7 +127,7 @@

              Callbacks

              - Source + Source

              @@ -135,7 +135,7 @@

              Callbacks

              - Source + Source
              diff --git a/docs/master/ExUnit.Test.html b/docs/master/ExUnit.Test.html index 513e7cf0f..b9dd5b705 100644 --- a/docs/master/ExUnit.Test.html +++ b/docs/master/ExUnit.Test.html @@ -36,7 +36,7 @@

              - Source + Source diff --git a/docs/master/ExUnit.TestCase.html b/docs/master/ExUnit.TestCase.html index eb6c9923f..92bdf257c 100644 --- a/docs/master/ExUnit.TestCase.html +++ b/docs/master/ExUnit.TestCase.html @@ -36,7 +36,7 @@

              - Source + Source diff --git a/docs/master/ExUnit.html b/docs/master/ExUnit.html index 0a6116ea7..d4a25e99f 100644 --- a/docs/master/ExUnit.html +++ b/docs/master/ExUnit.html @@ -75,7 +75,7 @@

              Case, callbacks and assertions

              - Source + Source @@ -133,7 +133,7 @@

              Options

            - Source + Source

            @@ -145,7 +145,7 @@

            Options

            Returns the number of failures.

            - Source + Source

            @@ -159,7 +159,7 @@

            Options

            function and rely on configure/1 and run/0 instead.

            - Source + Source

            @@ -167,7 +167,7 @@

            Options

            - Source + Source
            diff --git a/docs/master/Exception.html b/docs/master/Exception.html index d5190bb8e..25fbefa5a 100644 --- a/docs/master/Exception.html +++ b/docs/master/Exception.html @@ -33,7 +33,7 @@

            - Source + Source @@ -84,7 +84,7 @@

            Functions

            - Source + Source

            @@ -97,7 +97,7 @@

            Functions

            the value of System.stacktrace is changed.

            - Source + Source

            @@ -108,7 +108,7 @@

            Functions

            is used to prettify the stacktrace.

            - Source + Source

            @@ -119,7 +119,7 @@

            Functions

            code with Elixir code.

            - Source + Source

            Functions

            the value of System.stacktrace is changed.

            - Source + Source diff --git a/docs/master/File.CopyError.html b/docs/master/File.CopyError.html index 3de5ec201..1b7d907e9 100644 --- a/docs/master/File.CopyError.html +++ b/docs/master/File.CopyError.html @@ -29,7 +29,7 @@

            - Source + Source @@ -89,7 +89,7 @@

            Functions

            - Source + Source diff --git a/docs/master/File.Error.html b/docs/master/File.Error.html index cc974f40c..43374cdeb 100644 --- a/docs/master/File.Error.html +++ b/docs/master/File.Error.html @@ -29,7 +29,7 @@

            - Source + Source @@ -83,7 +83,7 @@

            Functions

            - Source + Source diff --git a/docs/master/File.IteratorError.html b/docs/master/File.IteratorError.html index 677061581..8aeee3b2e 100644 --- a/docs/master/File.IteratorError.html +++ b/docs/master/File.IteratorError.html @@ -29,7 +29,7 @@

            - Source + Source @@ -71,7 +71,7 @@

            Functions

            - Source + Source diff --git a/docs/master/File.Stat.html b/docs/master/File.Stat.html index e231e5de2..0cb4b7f62 100644 --- a/docs/master/File.Stat.html +++ b/docs/master/File.Stat.html @@ -63,7 +63,7 @@

            - Source + Source diff --git a/docs/master/File.html b/docs/master/File.html index b2d4e93dc..40ba42c75 100644 --- a/docs/master/File.html +++ b/docs/master/File.html @@ -77,7 +77,7 @@

            - Source + Source @@ -91,11 +91,6 @@

            Functions summary

            biniterator/1
          • -
          • - - biniterator/2 - -
          • biniterator!/2 @@ -176,11 +171,6 @@

            Functions summary

            iterator/1
          • -
          • - - iterator/2 - -
          • iterator!/2 @@ -341,28 +331,19 @@

            Functions

            binary. Check iterator/1 for more information.

            - Source - -
            -

            - biniterator(file, mode) -

            -

            Opens the given file with the given mode and -returns its biniterator. Fails for the same reasons -as File.open.

            -
            - - Source + Source

            biniterator!(file, mode // [])

            -

            Same as biniterator/2 but raises if the file -cannot be opened.

            +

            Opens the given file with the given mode and +returns its biniterator. The returned iterator will +fail for the same reasons as File.open!. Note +that the file is opened when the iteration begins.

            - Source + Source

            @@ -372,7 +353,7 @@

            Functions

            { :error, reason } otherwise.

            - Source + Source

            @@ -381,7 +362,7 @@

            Functions

            The same as cd/0, but raises an exception if it fails.

            - Source + Source

            @@ -395,7 +376,7 @@

            Functions

            directory fails.

            - Source + Source

            @@ -409,7 +390,7 @@

            Functions

            See open/2.

            - Source + Source

            @@ -430,7 +411,7 @@

            Functions

            read/1 and write/2.

            - Source + Source

            @@ -440,7 +421,7 @@

            Functions

            Returns the bytes_copied otherwise.

            - Source + Source

            @@ -465,7 +446,7 @@

            Functions

            { :error, reason } otherwise.

            - Source + Source

            @@ -475,7 +456,7 @@

            Functions

            Returns the list of copied files otherwise.

            - Source + Source

            @@ -527,7 +508,7 @@

            Examples

            - Source + Source

            @@ -537,7 +518,7 @@

            Examples

            Returns the list of copied files otherwise.

            - Source + Source

            @@ -549,7 +530,7 @@

            Examples

            in case of success, { :error, reason } otherwise.

            - Source + Source

            @@ -558,7 +539,7 @@

            Examples

            The same as cwd/0, but raises an exception if it fails.

            - Source + Source

            @@ -567,7 +548,7 @@

            Examples

            Returns true if the path is a directory.

            - Source + Source

            @@ -590,7 +571,7 @@

            Examples

            - Source + Source

            @@ -619,28 +600,19 @@

            Examples

            - Source - -
            -

            - iterator(file, mode) -

            -

            Opens the given file with the given mode and -returns its iterator. Fails for the same reasons -as File.open.

            -
            - - Source + Source

            iterator!(file, mode // [])

            -

            Same as iterator/2 but raises if the file -cannot be opened.

            +

            Opens the given file with the given mode and +returns its iterator. The returned iterator will +fail for the same reasons as File.open!. Note +that the file is opened when the iteration begins.

            - Source + Source

            @@ -652,7 +624,7 @@

            Examples

            { :error, reason } otherwise.

            - Source + Source

            @@ -662,7 +634,7 @@

            Examples

            in case of an error.

            - Source + Source

            @@ -683,7 +655,7 @@

            Examples

          - Source + Source

          @@ -692,7 +664,7 @@

          Examples

          Same as mkdir, but raises an exception in case of failure. Otherwise :ok.

          - Source + Source

          @@ -710,7 +682,7 @@

          Examples

        - Source + Source

        @@ -719,7 +691,7 @@

        Examples

        Same as mkdir_p, but raises an exception in case of failure. Otherwise :ok.

        - Source + Source

        @@ -782,7 +754,7 @@

        Examples

        - Source + Source

        @@ -809,7 +781,7 @@

        Examples

        - Source + Source

        @@ -819,7 +791,7 @@

        Examples

        Returns the io_device otherwise.

        - Source + Source

        @@ -829,7 +801,7 @@

        Examples

        Returns the function result otherwise.

        - Source + Source

        @@ -853,7 +825,7 @@

        Examples

        You can use :file.format_error(reason) to get a descriptive string of the error.

        - Source + Source

        @@ -863,7 +835,7 @@

        Examples

        File.Error if an error occurs.

        - Source + Source

        @@ -877,7 +849,7 @@

        Examples

        - Source + Source

        @@ -907,7 +879,7 @@

        Examples

        - Source + Source

        @@ -916,7 +888,7 @@

        Examples

        Same as rm, but raises an exception in case of failure. Otherwise :ok.

        - Source + Source

        @@ -940,7 +912,7 @@

        Examples

        - Source + Source

        @@ -950,7 +922,7 @@

        Examples

        otherwise the list of files or directories removed.

        - Source + Source

        @@ -969,7 +941,7 @@

        Examples

        - Source + Source

        @@ -978,7 +950,7 @@

        Examples

        Same as rmdir/1, but raises an exception in case of failure. Otherwise :ok.

        - Source + Source

        @@ -999,7 +971,7 @@

        Options

      - Source + Source

      @@ -1009,7 +981,7 @@

      Options

      throws File.Error if an error is returned.

      - Source + Source

      @@ -1019,7 +991,7 @@

      Options

      the given file. File is created if it doesn’t exist.

      - Source + Source

      @@ -1029,7 +1001,7 @@

      Options

      Returns :ok otherwise.

      - Source + Source

      @@ -1051,7 +1023,7 @@

      Options

      - Source + Source

      @@ -1060,7 +1032,7 @@

      Options

      Same as write/3 but raises an exception if it fails, returns :ok otherwise.

      - Source + Source

      @@ -1070,7 +1042,7 @@

      Options

      path. Returns :ok or { :error, reason }.

      - Source + Source

      @@ -1080,7 +1052,7 @@

      Options

      Returns :ok otherwise.

      - Source + Source diff --git a/docs/master/FunctionClauseError.html b/docs/master/FunctionClauseError.html index fb9235a50..7fe00281f 100644 --- a/docs/master/FunctionClauseError.html +++ b/docs/master/FunctionClauseError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -83,7 +83,7 @@

      Functions

      - Source + Source diff --git a/docs/master/GenEvent.Behaviour.html b/docs/master/GenEvent.Behaviour.html index ace9b1c6a..cfb274774 100644 --- a/docs/master/GenEvent.Behaviour.html +++ b/docs/master/GenEvent.Behaviour.html @@ -82,7 +82,7 @@

      Example

      - Source + Source diff --git a/docs/master/GenServer.Behaviour.html b/docs/master/GenServer.Behaviour.html index 155cdf677..b23389358 100644 --- a/docs/master/GenServer.Behaviour.html +++ b/docs/master/GenServer.Behaviour.html @@ -116,7 +116,7 @@

      Example

      - Source + Source diff --git a/docs/master/HashDict.html b/docs/master/HashDict.html index 57cb51f4d..1a3dfc936 100644 --- a/docs/master/HashDict.html +++ b/docs/master/HashDict.html @@ -37,7 +37,7 @@

      - Source + Source @@ -126,6 +126,11 @@

      Functions summary

      put_new/3

    3115. +
    3116. + + reduce/3 + +
    3117. size/1 @@ -179,7 +184,7 @@

      Functions

      Deletes a value from the dict.

      - Source + Source

      @@ -189,7 +194,7 @@

      Functions

      which key is not in keys

      - Source + Source

      @@ -198,7 +203,7 @@

      Functions

      Returns an empty dict.

      - Source + Source

      @@ -206,7 +211,7 @@

      Functions

      - Source + Source

      @@ -216,7 +221,7 @@

      Functions

      and return it in a tagged tuple.

      - Source + Source

      @@ -224,7 +229,7 @@

      Functions

      - Source + Source

      @@ -233,7 +238,7 @@

      Functions

      Gets the value under key from the dict.

      - Source + Source

      @@ -242,7 +247,7 @@

      Functions

      Checks if the dict has the given key.

      - Source + Source

      @@ -251,7 +256,7 @@

      Functions

      Get all keys in the dict.

      - Source + Source

      @@ -260,7 +265,7 @@

      Functions

      Merges two dictionaries.

      - Source + Source

      @@ -269,7 +274,7 @@

      Functions

      Creates a new empty dict.

      - Source + Source

      @@ -284,7 +289,7 @@

      Examples

      - Source + Source

      @@ -300,7 +305,7 @@

      Examples

      - Source + Source

      @@ -309,7 +314,7 @@

      Examples

      Returns the value under key from the dict as well as the dict without key.

      - Source + Source

      @@ -318,7 +323,7 @@

      Examples

      Puts the given key and value in the dict.

      - Source + Source

      @@ -328,7 +333,15 @@

      Examples

      only if one does not exist yet.

      - Source + Source + +
      +

      + reduce(dict, acc, fun) +

      +
      + + Source

      @@ -337,7 +350,7 @@

      Examples

      Returns the dict size.

      - Source + Source

      @@ -349,7 +362,7 @@

      Examples

      Returns a 2-tuple of the new dicts.

      - Source + Source

      @@ -359,7 +372,7 @@

      Examples

      which key is in keys.

      - Source + Source

      @@ -368,7 +381,7 @@

      Examples

      Converts the dict to a list.

      - Source + Source

      @@ -379,7 +392,7 @@

      Examples

      not exist in the dictionary.

      - Source + Source

      @@ -390,7 +403,7 @@

      Examples

      the key does not exist in the dicionary.

      - Source + Source

      @@ -399,7 +412,7 @@

      Examples

      Get all values in the dict.

      - Source + Source
      diff --git a/docs/master/IEx.Autocomplete.html b/docs/master/IEx.Autocomplete.html index fe5735391..cffdc91d8 100644 --- a/docs/master/IEx.Autocomplete.html +++ b/docs/master/IEx.Autocomplete.html @@ -32,7 +32,7 @@

      - Source + Source @@ -63,7 +63,7 @@

      Functions

      - Source + Source diff --git a/docs/master/IEx.Helpers.html b/docs/master/IEx.Helpers.html index 9e81cb8fd..d407f0532 100644 --- a/docs/master/IEx.Helpers.html +++ b/docs/master/IEx.Helpers.html @@ -53,6 +53,7 @@

    3118. t/1 — prints type information
    3119. v/0 - prints all commands and values
    3120. v/1 - retrieves nth value from console
    3121. +
    3122. import_file/1 - evaluate the given file in the shell's context
    3123. Help for functions in this module can be consulted @@ -73,7 +74,7 @@

      - Source + Source @@ -154,6 +155,11 @@

      Macros summary

      h/1
    3124. +
    3125. + + import_file/1 + +
    3126. s/1 @@ -193,7 +199,7 @@

      Examples

      - Source + Source

      @@ -202,7 +208,7 @@

      Examples

      Changes the current working directory to the given path.

      - Source + Source

      @@ -211,7 +217,7 @@

      Examples

      Flushes all messages sent to the shell and prints them out.

      - Source + Source

      @@ -220,7 +226,7 @@

      Examples

      Prints the documentation for IEx.Helpers.

      - Source + Source

      @@ -229,7 +235,7 @@

      Examples

      Purges and reloads specified module.

      - Source + Source

      @@ -239,7 +245,7 @@

      Examples

      If path points to a file, prints its full path.

      - Source + Source

      @@ -249,7 +255,7 @@

      Examples

      files.

      - Source + Source

      @@ -258,7 +264,7 @@

      Examples

      Prints the current working directory.

      - Source + Source

      @@ -268,7 +274,7 @@

      Examples

      in the current IEx session.

      - Source + Source

      @@ -280,7 +286,7 @@

      Examples

      are recompiled and reloaded.

      - Source + Source

      @@ -290,7 +296,7 @@

      Examples

      their results.

      - Source + Source

      @@ -302,7 +308,7 @@

      Examples

      For instance, v(-1) returns the result of the last evaluated expression.

      - Source + Source @@ -333,7 +339,31 @@

      Examples

      - Source + Source + +
      +

      + import_file(path) +

      +

      Evaluates the contents of file at path as if it were directly typed into +the shell. path has to be a literal binary.

      + +

      Leading ~ in path is automatically expanded.

      + +

      Examples

      + +
      # ~/file.exs
      +value = 13
      +
      +# in the shell
      +iex(1)> import_file "~/file.exs"
      +13
      +iex(2)> value
      +13
      +
      +
      + + Source

      @@ -355,7 +385,7 @@

      Examples

      - Source + Source

      @@ -374,7 +404,7 @@

      Examples

      - Source + Source diff --git a/docs/master/IEx.html b/docs/master/IEx.html index ab8ec53dd..8d7bade4f 100644 --- a/docs/master/IEx.html +++ b/docs/master/IEx.html @@ -29,7 +29,7 @@

      Welcome to IEx.

      -

      This module is the main entry point Interactive Elixir and +

      This module is the main entry point for Interactive Elixir and in this documentation we will talk a bit about how IEx works.

      Notice some of the functionality described here will be available @@ -45,11 +45,11 @@

      The Break command

      The User Switch command

      -

      Besides the break command, one can type Ctrl+G to get the to -the user switch command. When reached, you can type h to +

      Besides the break command, one can type Ctrl+G to get to the +user switch command menu. When reached, you can type h to get more information.

      -

      In this switch, developers are able to create new shell and +

      In this menu, developers are able to start new shells and alternate in between them. Let's give it a try:

      User switch command
      @@ -63,7 +63,7 @@ 

      The User Switch command

      hello = :world
       
      -

      Now, let's rollback to the first shell:

      +

      Now, let's roll back to the first shell:

      User switch command
        --> c 1
      @@ -75,23 +75,59 @@ 

      The User Switch command

      ** (UndefinedFunctionError) undefined function: IEx.Helpers.hello/0
      -

      The command above fails because we have changed the shells -and they are isolated from each other, you can access the -variables defined in one in the other.

      +

      The command above fails because we have switched the shells. +Since shells are isolated from each other, you can't access the +variables defined in one shell from the other one.

      -

      The User Switch also allow developers to connect to remote -shells using r. Keep in mind that you can't connect to a +

      The user switch command menu also allows developers to connect to remote +shells using the "r" command. Keep in mind that you can't connect to a remote node if you haven't given a name to the current node (i.e. Process.is_alive? must return true).

      +

      The .iex file

      + +

      When starting IEx, it will look for a local .iex file (located in the current +working directory), then a global one (located at ~/.iex) and will load the +first one it finds (if any). The code in the chosen .iex file will be +evaluated in the shell's context. So, for instance, any modules that are +loaded or variables that are bound in the .iex file will be available in the +shell after it has booted.

      + +

      Sample contents of a local .iex file:

      + +
      # source another .iex file
      +import_file "~/.iex"
      +
      +# print something before the shell starts
      +IO.puts "hello world"
      +
      +# bind a variable that'll be accessible in the shell
      +value = 13
      +
      + +

      Running the shell in the directory where the above .iex file is located +results in

      + +
      $ iex
      +Erlang R15B03 (erts-5.9.3.1) [...]
      +
      +hello world
      +Interactive Elixir (0.8.3.dev) - press Ctrl+C to exit (type h() ENTER for help)
      +iex(1)> value
      +13
      +
      + +

      It is possible to override the default loading sequence for .iex file by +supplying the --dot-iex option to iex. See iex --help.

      +

      Expressions in IEx

      -

      As an interactive shell, IEx evalutes expressions. This has some -interesting consequences worthy discussing.

      +

      As an interactive shell, IEx evaluates expressions. This has some +interesting consequences that are worth discussing.

      The first one is that the code is truly evaluated and not compiled. -This means that, any benchmarking done in the shell is going to have -skewed results. So never run any profiling nor benchmark in the shell.

      +This means that any benchmarking done in the shell is going to have +skewed results. So never run any profiling nor benchmarks in the shell.

      Second of all, IEx alows you to break an expression into many lines, since this is common in Elixir. For example:

      @@ -122,7 +158,7 @@

      Expressions in IEx

      - Source + Source @@ -174,7 +210,7 @@

      Functions

      Returns registered after spawn callbacks.

      - Source + Source

      @@ -183,7 +219,7 @@

      Functions

      Registers a function to be invoked after IEx process is spawned.

      - Source + Source

      @@ -192,7 +228,7 @@

      Functions

      Returns currently registered inspect options.

      - Source + Source

      @@ -201,7 +237,7 @@

      Functions

      Registers options used on inspect.

      - Source + Source

      @@ -210,7 +246,7 @@

      Functions

      Returns true if IEx was properly started.

      - Source + Source
      diff --git a/docs/master/IO.ANSI.html b/docs/master/IO.ANSI.html index 5fcbf9624..cb63ad762 100644 --- a/docs/master/IO.ANSI.html +++ b/docs/master/IO.ANSI.html @@ -32,13 +32,10 @@

      in the text used to control formatting, color, and other output options on video text terminals.

      -

      Please be aware that in Erlang/OTP versions prior to R16, you will not -be able to render ANSI escape sequences in iex or erlang shell

      - - Source + Source @@ -320,7 +317,7 @@

      Functions

      Sets foreground color to black

      - Source + Source

      @@ -329,7 +326,7 @@

      Functions

      Sets background color to black

      - Source + Source

      Functions

      Blink: off

      - Source + Source

      Functions

      Blink: Rapid. MS-DOS ANSI.SYS; 150 per minute or more; not widely supported

      - Source + Source

      Functions

      Blink: Slow. Less than 150 per minute

      - Source + Source

      @@ -365,7 +362,7 @@

      Functions

      Sets foreground color to blue

      - Source + Source

      @@ -374,7 +371,7 @@

      Functions

      Sets background color to blue

      - Source + Source

      @@ -383,7 +380,7 @@

      Functions

      Bright (increased intensity) or Bold

      - Source + Source

      @@ -392,7 +389,7 @@

      Functions

      Conceal. Not widely supported

      - Source + Source

      @@ -401,7 +398,7 @@

      Functions

      Crossed-out. Characters legible, but marked for deletion. Not widely supported.

      - Source + Source

      @@ -410,7 +407,7 @@

      Functions

      Sets foreground color to cyan

      - Source + Source

      @@ -419,7 +416,7 @@

      Functions

      Sets background color to cyan

      - Source + Source

      @@ -428,7 +425,7 @@

      Functions

      Default background color

      - Source + Source

      @@ -437,7 +434,7 @@

      Functions

      Default text color

      - Source + Source

      @@ -446,7 +443,7 @@

      Functions

      Encircled

      - Source + Source

      @@ -471,7 +468,7 @@

      Example

      "Hello \e[31m\e[1m\e[32myes\e[0m"

      - Source + Source

      @@ -493,7 +490,7 @@

      Example

      "Hello \e[31m\e[1m\e[32myes\e[0m"

      - Source + Source

      @@ -502,7 +499,7 @@

      Example

      Faint (decreased intensity), not widely supported

      - Source + Source

      @@ -511,7 +508,7 @@

      Example

      Sets alternative font 1

      - Source + Source

      @@ -520,7 +517,7 @@

      Example

      Sets alternative font 2

      - Source + Source

      @@ -529,7 +526,7 @@

      Example

      Sets alternative font 3

      - Source + Source

      @@ -538,7 +535,7 @@

      Example

      Sets alternative font 4

      - Source + Source

      @@ -547,7 +544,7 @@

      Example

      Sets alternative font 5

      - Source + Source

      @@ -556,7 +553,7 @@

      Example

      Sets alternative font 6

      - Source + Source

      @@ -565,7 +562,7 @@

      Example

      Sets alternative font 7

      - Source + Source

      @@ -574,7 +571,7 @@

      Example

      Sets alternative font 8

      - Source + Source

      @@ -583,7 +580,7 @@

      Example

      Sets alternative font 9

      - Source + Source

      @@ -592,7 +589,7 @@

      Example

      Framed

      - Source + Source

      @@ -601,7 +598,7 @@

      Example

      Sets foreground color to green

      - Source + Source

      @@ -610,7 +607,7 @@

      Example

      Sets background color to green

      - Source + Source

      @@ -619,7 +616,7 @@

      Example

      Image: Negative. Swap foreground and background

      - Source + Source

      @@ -628,7 +625,7 @@

      Example

      Italic: on. Not widely supported. Sometimes treated as inverse.

      - Source + Source

      @@ -637,7 +634,7 @@

      Example

      Sets foreground color to magenta

      - Source + Source

      @@ -646,7 +643,7 @@

      Example

      Sets background color to magenta

      - Source + Source

      @@ -655,7 +652,7 @@

      Example

      Underline: None

      - Source + Source

      @@ -664,7 +661,7 @@

      Example

      Normal color or intensity

      - Source + Source

      @@ -673,7 +670,7 @@

      Example

      Not framed or encircled

      - Source + Source

      @@ -682,7 +679,7 @@

      Example

      Not italic

      - Source + Source

      @@ -691,7 +688,7 @@

      Example

      Not overlined

      - Source + Source

      @@ -700,7 +697,7 @@

      Example

      Overlined

      - Source + Source

      @@ -709,7 +706,7 @@

      Example

      Sets primary (default) font

      - Source + Source

      @@ -718,7 +715,7 @@

      Example

      Sets foreground color to red

      - Source + Source

      @@ -727,7 +724,7 @@

      Example

      Sets background color to red

      - Source + Source

      @@ -736,7 +733,7 @@

      Example

      Resets all attributes

      - Source + Source

      @@ -745,7 +742,7 @@

      Example

      Image: Negative. Swap foreground and background

      - Source + Source

      @@ -755,14 +752,9 @@

      Example

      Used to identify whether printing ANSI escape sequences will likely be printed as intended.

      - -

      Please note that invoked while in shell (iex) in Erlang/OTP -prior to R16, terminal?/0 will always return false because -Erlang shell did not support ANSI escape sequences up until -R16.

      - Source + Source

      @@ -771,7 +763,7 @@

      Example

      Underline: Single

      - Source + Source

      @@ -780,7 +772,7 @@

      Example

      Sets foreground color to white

      - Source + Source

      @@ -789,7 +781,7 @@

      Example

      Sets background color to white

      - Source + Source

      @@ -798,7 +790,7 @@

      Example

      Sets foreground color to yellow

      - Source + Source

      @@ -807,7 +799,7 @@

      Example

      Sets background color to yellow

      - Source + Source
      diff --git a/docs/master/IO.html b/docs/master/IO.html index 7798c6293..f40555f00 100644 --- a/docs/master/IO.html +++ b/docs/master/IO.html @@ -50,7 +50,7 @@

      - Source + Source @@ -140,7 +140,7 @@

      Functions

      Check read/2 for more information.

      - Source + Source

      @@ -152,7 +152,7 @@

      Functions

      Check readline/1 for more information.

      - Source + Source

      @@ -164,7 +164,7 @@

      Functions

      Check write/2 for more information.

      - Source + Source

      @@ -184,7 +184,7 @@

      Functions

      - Source + Source

      @@ -196,7 +196,7 @@

      Functions

      Otherwise, the number of raw bytes.

      - Source + Source

      @@ -214,7 +214,7 @@

      Functions

      - Source + Source

      @@ -229,7 +229,7 @@

      Examples

      - Source + Source

      @@ -238,7 +238,7 @@

      Examples

      Inspects the item with options using the given device.

      - Source + Source

      @@ -249,7 +249,7 @@

      Examples

      to be a chardata.

      - Source + Source

      @@ -266,7 +266,7 @@

      Examples

      - Source + Source

      @@ -286,7 +286,7 @@

      Examples

      except the prompt is not required as argument.

      - Source + Source

      @@ -309,7 +309,7 @@

      Examples

      - Source + Source diff --git a/docs/master/Kernel.CLI.html b/docs/master/Kernel.CLI.html index 1c1b50cc3..a23c8ce84 100644 --- a/docs/master/Kernel.CLI.html +++ b/docs/master/Kernel.CLI.html @@ -32,7 +32,7 @@

      - Source + Source @@ -69,7 +69,7 @@

      Functions

      by escripts generated by Elixir.

      - Source + Source diff --git a/docs/master/Kernel.ParallelCompiler.html b/docs/master/Kernel.ParallelCompiler.html index 6ce506b69..6622625f6 100644 --- a/docs/master/Kernel.ParallelCompiler.html +++ b/docs/master/Kernel.ParallelCompiler.html @@ -32,7 +32,7 @@

      - Source + Source @@ -77,7 +77,7 @@

      Functions

      with its name can be optionally given as argument.

      - Source + Source

      @@ -87,7 +87,7 @@

      Functions

      Read files/2 for more information.

      - Source + Source diff --git a/docs/master/Kernel.ParallelRequire.html b/docs/master/Kernel.ParallelRequire.html index e15fce868..ff849770b 100644 --- a/docs/master/Kernel.ParallelRequire.html +++ b/docs/master/Kernel.ParallelRequire.html @@ -32,7 +32,7 @@

      - Source + Source @@ -67,7 +67,7 @@

      Functions

      can be optionally given as argument.

      - Source + Source diff --git a/docs/master/Kernel.SpecialForms.html b/docs/master/Kernel.SpecialForms.html index 3ae0feb9d..4d91c5de8 100644 --- a/docs/master/Kernel.SpecialForms.html +++ b/docs/master/Kernel.SpecialForms.html @@ -48,7 +48,7 @@

      - Source + Source @@ -316,7 +316,7 @@

      Bitstring types

      to binary32 and binary64, respectively.

      - Source + Source

      @@ -331,7 +331,7 @@

      Examples

      - Source + Source

      @@ -340,7 +340,7 @@

      Examples

      Returns the current directory as a binary.

      - Source + Source

      @@ -351,7 +351,7 @@

      Examples

      line numbers, set up aliases, the current function and others.

      - Source + Source

      @@ -362,7 +362,7 @@

      Examples

      is a convenient shortcut.

      - Source + Source

      @@ -373,7 +373,7 @@

      Examples

      is a convenient shortcut.

      - Source + Source

      @@ -418,7 +418,7 @@

      Examples

      - Source + Source

      @@ -433,7 +433,7 @@

      Examples

      - Source + Source

      @@ -451,7 +451,7 @@

      Examples

      Check quote/1 for more information.

      - Source + Source

      @@ -497,7 +497,7 @@

      Lexical scope

      specific functions and it won't affect the overall scope.

      - Source + Source

      @@ -508,7 +508,7 @@

      Lexical scope

      the macro is expanded.

      - Source + Source

      @@ -524,7 +524,7 @@

      Lexical scope

      - Source + Source

      @@ -625,7 +625,7 @@

      Ambiguous function/macro names

      errors are emitted lazily, not eagerly.

      - Source + Source

      @@ -675,7 +675,7 @@

      Ambiguous function/macro names

      - Source + Source

      @@ -973,7 +973,7 @@

      Stacktrace information

      the quote will always point to GenServer.Behaviour file.

      - Source + Source

      @@ -1006,7 +1006,7 @@

      Alias shortcut

      up an alias. Please check alias for more information.

      - Source + Source

      @@ -1037,7 +1037,7 @@

      Examples

      - Source + Source

      @@ -1054,7 +1054,7 @@

      Examples

      - Source + Source

      @@ -1067,7 +1067,7 @@

      Examples

      Check quote/2 for more information.

      - Source + Source

      @@ -1077,7 +1077,7 @@

      Examples

      Check quote/2 for more information.

      - Source + Source

      @@ -1092,7 +1092,7 @@

      Examples

      - Source + Source diff --git a/docs/master/Kernel.Typespec.html b/docs/master/Kernel.Typespec.html index e26e8cc94..4be9c6f79 100644 --- a/docs/master/Kernel.Typespec.html +++ b/docs/master/Kernel.Typespec.html @@ -119,7 +119,7 @@

      Notes

      - Source + Source @@ -237,7 +237,7 @@

      Functions

      on the file system.

      - Source + Source

      @@ -252,7 +252,7 @@

      Functions

      on the file system.

      - Source + Source

      @@ -267,7 +267,7 @@

      Functions

      on the file system.

      - Source + Source

      @@ -276,7 +276,7 @@

      Functions

      Defines a callback by receiving Erlang's typespec.

      - Source + Source

      @@ -285,7 +285,7 @@

      Functions

      Defines a spec by receiving Erlang's typespec.

      - Source + Source

      @@ -294,7 +294,7 @@

      Functions

      Defines a type, typep or opaque by receiving Erlang's typespec.

      - Source + Source

      @@ -304,7 +304,7 @@

      Functions

      This function is only available for modules being compiled.

      - Source + Source

      @@ -314,7 +314,7 @@

      Functions

      This function is only available for modules being compiled.

      - Source + Source

      @@ -325,7 +325,7 @@

      Functions

      for modules being compiled.

      - Source + Source

      @@ -334,7 +334,7 @@

      Functions

      Converts a spec clause back to Elixir AST.

      - Source + Source

      @@ -343,7 +343,7 @@

      Functions

      Converts a type clause back to Elixir AST.

      - Source + Source
      @@ -365,7 +365,7 @@

      Examples

      - Source + Source

      @@ -380,7 +380,7 @@

      Examples

      - Source + Source

      @@ -395,7 +395,7 @@

      Examples

      - Source + Source

      @@ -410,7 +410,7 @@

      Examples

      - Source + Source

      @@ -425,7 +425,7 @@

      Examples

      - Source + Source diff --git a/docs/master/Kernel.html b/docs/master/Kernel.html index 66f495886..8cbd8e0ec 100644 --- a/docs/master/Kernel.html +++ b/docs/master/Kernel.html @@ -47,7 +47,7 @@

      - Source + Source @@ -86,6 +86,21 @@

      Functions summary

      binary_to_existing_atom/2
    3127. +
    3128. + + binary_to_float/1 + +
    3129. +
    3130. + + binary_to_integer/1 + +
    3131. +
    3132. + + binary_to_integer/2 + +
    3133. binary_to_list/1 @@ -131,6 +146,11 @@

      Functions summary

      float/1
    3134. +
    3135. + + float_to_binary/1 + +
    3136. float_to_binary/2 @@ -156,6 +176,16 @@

      Functions summary

      hd/1
    3137. +
    3138. + + integer_to_binary/1 + +
    3139. +
    3140. + + integer_to_binary/2 + +
    3141. integer_to_list/1 @@ -608,21 +638,6 @@

      Macros summary

      binary_to_existing_atom/1
    3142. -
    3143. - - binary_to_float/1 - -
    3144. -
    3145. - - binary_to_integer/1 - -
    3146. -
    3147. - - binary_to_integer/2 - -
    3148. case/2 @@ -733,11 +748,6 @@

      Macros summary

      elem/2
    3149. -
    3150. - - float_to_binary/1 - -
    3151. function/1 @@ -768,16 +778,6 @@

      Macros summary

      inspect/2
    3152. -
    3153. - - integer_to_binary/1 - -
    3154. -
    3155. - - integer_to_binary/2 - -
    3156. is_exception/1 @@ -904,7 +904,7 @@

      Examples

      - Source + Source

      @@ -923,7 +923,7 @@

      Examples

      - Source + Source

      @@ -938,7 +938,7 @@

      Examples

      - Source + Source

      @@ -965,7 +965,7 @@

      Examples

      - Source + Source

      @@ -983,7 +983,7 @@

      Examples

      - Source + Source

      @@ -992,7 +992,53 @@

      Examples

      Works like binary_to_atom/2, but the atom must already exist.

      - Source + Source + +
      +

      + binary_to_float(some_binary) +

      +

      Returns a float whose text representation is some_binary.

      + +

      Examples

      + +
      iex> binary_to_float("2.2017764e+0")
      +2.2017764
      +
      +
      + + Source + +
      +

      + binary_to_integer(some_binary) +

      +

      Returns a integer whose text representation is some_binary.

      + +

      Examples

      + +
      iex> binary_to_integer("123")
      +123
      +
      +
      + + Source + +
      +

      + binary_to_integer(some_binary, base) +

      +

      Returns an integer whose text representation in base base +is some_binary.

      + +

      Examples

      + +
      iex> binary_to_integer("3FF", 16)
      +1023
      +
      +
      + + Source

      @@ -1001,7 +1047,7 @@

      Examples

      Returns a list of integers which correspond to the bytes of binary.

      - Source + Source

      @@ -1012,7 +1058,7 @@

      Examples

      are numbered starting from 1.

      - Source + Source

      @@ -1029,7 +1075,7 @@

      Examples

      - Source + Source

      @@ -1055,7 +1101,7 @@

      Examples

      - Source + Source

      @@ -1074,7 +1120,7 @@

      Examples

      - Source + Source

      @@ -1085,7 +1131,7 @@

      Examples

      be a bitstring containing the remaining bits (1 up to 7 bits).

      - Source + Source

      @@ -1106,7 +1152,7 @@

      Examples

      - Source + Source

      @@ -1123,7 +1169,7 @@

      Examples

      - Source + Source

      @@ -1132,7 +1178,23 @@

      Examples

      Converts the given number to a float. Allowed in guard clauses.

      - Source + Source + +
      +

      + float_to_binary(some_float) +

      +

      Returns a binary which corresponds to the text representation +of some_float.

      + +

      Examples

      + +
      iex> float_to_binary(7.0)
      +"7.00000000000000000000e+00"
      +
      +
      + + Source

      @@ -1155,7 +1217,7 @@

      Examples

      - Source + Source

      @@ -1170,7 +1232,7 @@

      Examples

      - Source + Source

      @@ -1193,7 +1255,7 @@

      Examples

      - Source + Source

      @@ -1210,7 +1272,7 @@

      Examples

      information.

      - Source + Source

      @@ -1219,7 +1281,39 @@

      Examples

      Returns the head of a list, raises badarg if the list is empty.

      - Source + Source + +
      +

      + integer_to_binary(some_integer) +

      +

      Returns a binary which corresponds to the text representation +of some_integer.

      + +

      Examples

      + +
      iex> integer_to_binary(123)
      +"123"
      +
      +
      + + Source + +
      +

      + integer_to_binary(some_integer, base) +

      +

      Returns a binary which corresponds to the text representation +of some_integer in base base.

      + +

      Examples

      + +
      iex> integer_to_binary(100, 16)
      +"64"
      +
      +
      + + Source

      @@ -1234,7 +1328,7 @@

      Examples

      - Source + Source

      @@ -1250,7 +1344,7 @@

      Examples

      - Source + Source

      @@ -1265,7 +1359,7 @@

      Examples

      - Source + Source

      @@ -1283,7 +1377,7 @@

      Examples

      - Source + Source

      @@ -1293,7 +1387,7 @@

      Examples

      if the node can be part of a distributed system.

      - Source + Source

      @@ -1304,7 +1398,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1317,7 +1411,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1328,7 +1422,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1340,7 +1434,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1351,7 +1445,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1362,7 +1456,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1374,7 +1468,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1385,7 +1479,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1396,7 +1490,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1408,7 +1502,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1419,7 +1513,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1430,7 +1524,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1441,7 +1535,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1452,7 +1546,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1469,7 +1563,7 @@

      Examples

      - Source + Source

      @@ -1484,7 +1578,7 @@

      Examples

      - Source + Source

      @@ -1499,7 +1593,7 @@

      Examples

      - Source + Source

      @@ -1518,7 +1612,7 @@

      Examples

      - Source + Source

      @@ -1528,7 +1622,7 @@

      Examples

      exists such atom.

      - Source + Source

      @@ -1543,7 +1637,7 @@

      Examples

      - Source + Source

      @@ -1558,7 +1652,7 @@

      Examples

      - Source + Source

      @@ -1573,7 +1667,7 @@

      Examples

      - Source + Source

      @@ -1594,7 +1688,7 @@

      Examples

      - Source + Source

      @@ -1609,7 +1703,7 @@

      Examples

      - Source + Source

      @@ -1623,7 +1717,7 @@

      Examples

      information.

      - Source + Source

      @@ -1640,7 +1734,7 @@

      Examples

      - Source + Source

      @@ -1657,7 +1751,7 @@

      Examples

      - Source + Source

      @@ -1674,7 +1768,7 @@

      Examples

      - Source + Source

      @@ -1686,7 +1780,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1699,7 +1793,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1717,7 +1811,7 @@

      Warning:

      It should not be used in application programs.

      - Source + Source

      @@ -1744,7 +1838,7 @@

      Examples

      - Source + Source

      @@ -1767,7 +1861,7 @@

      Examples

      - Source + Source

      @@ -1796,7 +1890,7 @@

      Examples

      may change the System.stacktrace value.

      - Source + Source

      @@ -1812,7 +1906,7 @@

      Examples

      - Source + Source

      @@ -1822,7 +1916,7 @@

      Examples

      Allowed in guard clauses.

      - Source + Source

      @@ -1832,7 +1926,7 @@

      Examples

      or a binary. If possible, please use tuple_size or binary_size.

      - Source + Source

      @@ -1854,7 +1948,7 @@

      Examples

      - Source + Source

      @@ -1872,7 +1966,7 @@

      Examples

      - Source + Source

      @@ -1894,7 +1988,7 @@

      Examples

      - Source + Source

      @@ -1912,7 +2006,7 @@

      Examples

      - Source + Source

      @@ -1926,7 +2020,7 @@

      Examples

      of communications channel not supported by distributed :

      - Source + Source

      @@ -1942,7 +2036,7 @@

      Examples

      - Source + Source

      @@ -1951,7 +2045,7 @@

      Examples

      A non-local return from a function. Check try/2 for more information.

      - Source + Source

      @@ -1960,7 +2054,7 @@

      Examples

      Returns the tail of a list. Raises ArgumentError if the list is empty.

      - Source + Source

      @@ -1976,7 +2070,7 @@

      Examples

      - Source + Source

      @@ -1985,7 +2079,7 @@

      Examples

      Returns the size of a tuple.

      - Source + Source

      @@ -1994,7 +2088,7 @@

      Examples

      Converts a tuple to a list.

      - Source + Source
      @@ -2024,7 +2118,7 @@

      Examples

      - Source + Source

      @@ -2046,7 +2140,7 @@

      Examples

      - Source + Source

      @@ -2065,7 +2159,7 @@

      Examples

      - Source + Source

      @@ -2093,7 +2187,7 @@

      Examples

      not only booleans, however it is not allowed in guards.

      - Source + Source

      @@ -2108,7 +2202,7 @@

      Examples

      - Source + Source

      @@ -2123,7 +2217,7 @@

      Examples

      - Source + Source

      @@ -2141,7 +2235,7 @@

      Examples

      - Source + Source

      @@ -2156,7 +2250,7 @@

      Examples

      - Source + Source

      @@ -2175,7 +2269,7 @@

      Examples

      - Source + Source

      @@ -2197,7 +2291,7 @@

      Examples

      - Source + Source

      @@ -2216,7 +2310,7 @@

      Examples

      - Source + Source

      @@ -2232,7 +2326,7 @@

      Examples

      - Source + Source

      @@ -2249,7 +2343,7 @@

      Examples

      - Source + Source

      @@ -2265,7 +2359,7 @@

      Examples

      - Source + Source

      @@ -2288,7 +2382,7 @@

      Examples

      - Source + Source

      @@ -2311,7 +2405,7 @@

      Examples

      - Source + Source

      @@ -2330,7 +2424,7 @@

      Examples

      - Source + Source

      @@ -2349,7 +2443,7 @@

      Examples

      - Source + Source

      @@ -2365,7 +2459,7 @@

      Examples

      - Source + Source

      @@ -2381,7 +2475,7 @@

      Examples

      - Source + Source

      @@ -2431,7 +2525,7 @@

      Examples

      to manipulate module attributes.

      - Source + Source

      @@ -2449,7 +2543,7 @@

      Examples

      - Source + Source

      @@ -2467,7 +2561,7 @@

      Examples

      - Source + Source

      @@ -2483,7 +2577,7 @@

      Examples

      - Source + Source

      @@ -2507,7 +2601,7 @@

      Examples

      - Source + Source

      @@ -2525,7 +2619,7 @@

      Examples

      - Source + Source

      @@ -2543,7 +2637,7 @@

      Examples

      - Source + Source

      @@ -2558,7 +2652,7 @@

      Examples

      - Source + Source

      @@ -2585,7 +2679,7 @@

      Examples

      - Source + Source

      @@ -2654,7 +2748,7 @@

      Atoms

      In this case, "Hello" will be printed twice (one per each field).

      - Source + Source

      @@ -2670,7 +2764,7 @@

      Examples

      - Source + Source

      @@ -2685,7 +2779,7 @@

      Examples

      - Source + Source

      @@ -2700,7 +2794,7 @@

      Examples

      - Source + Source

      @@ -2716,7 +2810,7 @@

      Examples

      - Source + Source

      @@ -2732,7 +2826,7 @@

      Examples

      - Source + Source

      @@ -2751,53 +2845,7 @@

      Examples

      - Source - -
      -

      - binary_to_float(some_binary) -

      -

      Returns a float whose text representation is some_binary.

      - -

      Examples

      - -
      iex> binary_to_float("2.2017764e+0")
      -2.2017764
      -
      -
      - - Source - -
      -

      - binary_to_integer(some_binary) -

      -

      Returns a integer whose text representation is some_binary.

      - -

      Examples

      - -
      iex> binary_to_integer("123")
      -123
      -
      -
      - - Source - -
      -

      - binary_to_integer(some_binary, base) -

      -

      Returns an integer whose text representation in base base -is some_binary.

      - -

      Examples

      - -
      iex> binary_to_integer("3FF", 16)
      -1023
      -
      -
      - - Source + Source

      @@ -2841,7 +2889,7 @@

      Examples

      The example above will actually fail because 10 does not match 1.

      - Source + Source

      @@ -2864,7 +2912,7 @@

      Examples

      - Source + Source

      @@ -2894,7 +2942,7 @@

      Examples

      two arguments and sum them.

      - Source + Source

      @@ -2933,7 +2981,7 @@

      Examples

      - Source + Source

      @@ -2981,7 +3029,7 @@

      Examples

      - Source + Source

      @@ -2999,7 +3047,7 @@

      Examples

      binary as result;

      - Source + Source

      @@ -3009,7 +3057,7 @@

      Examples

      defprotocol/2 for examples.

      - Source + Source

      @@ -3034,7 +3082,7 @@

      Examples

      - Source + Source

      @@ -3043,7 +3091,7 @@

      Examples

      The same as def/4 but generates a macro.

      - Source + Source

      @@ -3055,7 +3103,7 @@

      Examples

      Check defmacro/2 for more information

      - Source + Source

      @@ -3064,7 +3112,7 @@

      Examples

      The same as def/4 but generates a private macro.

      - Source + Source

      @@ -3114,7 +3162,7 @@

      Dynamic names

      returns an atom.

      - Source + Source

      @@ -3125,7 +3173,7 @@

      Dynamic names

      developer to customize it.

      - Source + Source

      @@ -3151,7 +3199,7 @@

      Examples

      through Foo.sum will raise an error.

      - Source + Source

      @@ -3160,7 +3208,7 @@

      Examples

      The same as def/4 but generates a private function.

      - Source + Source

      @@ -3292,7 +3340,7 @@

      Types

      given protocol are valid argument types for the given function.

      - Source + Source

      @@ -3462,7 +3510,7 @@

      Importing records

      See Record.import/2 and defrecordp/2 documentation for more information

      - Source + Source

      @@ -3512,7 +3560,7 @@

      Examples

      - Source + Source

      @@ -3534,7 +3582,7 @@

      Example

      - Source + Source

      @@ -3574,7 +3622,7 @@

      Examples

      it will raise a CaseClauseError.

      - Source + Source

      @@ -3591,7 +3639,7 @@

      Examples

      - Source + Source

      @@ -3610,23 +3658,7 @@

      Example

      - Source - -
      -

      - float_to_binary(some_float) -

      -

      Returns a binary which corresponds to the text representation -of some_float.

      - -

      Examples

      - -
      iex> float_to_binary(7.0)
      -"7.00000000000000000000e+00"
      -
      -
      - - Source + Source

      @@ -3720,7 +3752,7 @@

      Shortcut syntax

      - Source + Source

      @@ -3736,7 +3768,7 @@

      Examples

      - Source + Source

      @@ -3782,7 +3814,7 @@

      Blocks examples

      macro.

      - Source + Source

      @@ -3829,7 +3861,7 @@

      Clauses

      the variable for us.

      - Source + Source

      @@ -3839,10 +3871,6 @@

      Clauses

      Elixir conventions (i.e. it expects the tuple as first argument, zero-index based).

      -

      Please note that in versions of Erlang prior to R16B there is no BIF -for this operation and it is emulated by converting the tuple to a list -and back and is, therefore, inefficient.

      -

      Example

      iex> tuple = { :bar, :baz }
      @@ -3851,7 +3879,7 @@ 

      Example

      - Source + Source

      @@ -3885,39 +3913,7 @@

      Examples

      - Source - -
      -

      - integer_to_binary(some_integer) -

      -

      Returns a binary which corresponds to the text representation -of some_integer.

      - -

      Examples

      - -
      iex> integer_to_binary(123)
      -"123"
      -
      -
      - - Source - -
      -

      - integer_to_binary(some_integer, base) -

      -

      Returns a binary which corresponds to the text representation -of some_integer in base base.

      - -

      Examples

      - -
      iex> integer_to_binary(77)
      -"77"
      -
      -
      - - Source + Source

      @@ -3934,7 +3930,7 @@

      Examples

      - Source + Source

      @@ -3943,7 +3939,7 @@

      Examples

      Checks if the given argument is a range.

      - Source + Source

      @@ -3952,7 +3948,7 @@

      Examples

      Checks if the given argument is a record.

      - Source + Source

      @@ -3971,7 +3967,7 @@

      Examples

      - Source + Source

      @@ -3980,7 +3976,7 @@

      Examples

      Checks if the given argument is a regex.

      - Source + Source

      @@ -4012,7 +4008,7 @@

      Examples

      - Source + Source

      @@ -4030,7 +4026,7 @@

      Examples

      - Source + Source

      @@ -4046,7 +4042,7 @@

      Examples

      - Source + Source

      @@ -4062,7 +4058,7 @@

      Examples

      - Source + Source

      @@ -4112,7 +4108,7 @@

      Examples

      - Source + Source

      @@ -4129,7 +4125,7 @@

      Examples

      - Source + Source

      @@ -4146,7 +4142,7 @@

      Example

      - Source + Source

      @@ -4162,7 +4158,7 @@

      Examples

      - Source + Source

      @@ -4177,7 +4173,7 @@

      Examples

      - Source + Source

      @@ -4296,7 +4292,7 @@

      Variable visibility

      - Source + Source

      @@ -4316,7 +4312,7 @@

      Examples

      - Source + Source

      @@ -4355,7 +4351,7 @@

      Examples

      - Source + Source

      @@ -4374,7 +4370,7 @@

      Examples

      - Source + Source

      @@ -4407,7 +4403,7 @@

      Examples

      String.graphemes("Hello" |> Enum.reverse)
       
      -

      Which will result in an error as Enum.Iterator protocol +

      Which will result in an error as Enumerable protocol is not defined for binaries. Adding explicit parenthesis is recommended:

      @@ -4415,7 +4411,7 @@

      Examples

      - Source + Source

      @@ -4442,7 +4438,7 @@

      Examples

      not only booleans, however it is not allowed in guards.

      - Source + Source diff --git a/docs/master/KeyError.html b/docs/master/KeyError.html index 9170b8661..cdf39650d 100644 --- a/docs/master/KeyError.html +++ b/docs/master/KeyError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -71,7 +71,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Keyword.html b/docs/master/Keyword.html index 91c7d95aa..0be413c57 100644 --- a/docs/master/Keyword.html +++ b/docs/master/Keyword.html @@ -42,7 +42,7 @@

      - Source + Source @@ -185,7 +185,7 @@

      Examples

      - Source + Source

      @@ -203,7 +203,7 @@

      Examples

      - Source + Source

      @@ -219,7 +219,7 @@

      Examples

      - Source + Source

      @@ -238,7 +238,7 @@

      Examples

      - Source + Source

      @@ -256,7 +256,7 @@

      Examples

      - Source + Source

      @@ -267,7 +267,7 @@

      Examples

      duplicated entries.

      - Source + Source

      @@ -292,7 +292,7 @@

      Examples

      - Source + Source

      @@ -307,7 +307,7 @@

      Examples

      - Source + Source

      @@ -324,7 +324,7 @@

      Examples

      - Source + Source

      @@ -340,7 +340,7 @@

      Examples

      - Source + Source

      @@ -349,7 +349,7 @@

      Examples

      Checks if the given argument is a keywords list or not

      - Source + Source

      @@ -365,7 +365,7 @@

      Examples

      - Source + Source

      @@ -383,7 +383,7 @@

      Examples

      - Source + Source

      @@ -392,7 +392,7 @@

      Examples

      Returns an empty keyword list, i.e. an empty list.

      - Source + Source

      @@ -408,7 +408,7 @@

      Examples

      - Source + Source

      @@ -425,7 +425,7 @@

      Examples

      - Source + Source

      @@ -443,7 +443,7 @@

      Examples

      - Source + Source

      @@ -459,7 +459,7 @@

      Examples

      - Source + Source

      @@ -477,7 +477,7 @@

      Examples

      - Source + Source

      @@ -495,7 +495,7 @@

      Examples

      - Source + Source

      @@ -510,7 +510,7 @@

      Examples

      - Source + Source diff --git a/docs/master/List.Chars.Atom.html b/docs/master/List.Chars.Atom.html index 1dfc40ead..7d1c90a0e 100644 --- a/docs/master/List.Chars.Atom.html +++ b/docs/master/List.Chars.Atom.html @@ -29,7 +29,7 @@

      - Source + Source @@ -60,7 +60,7 @@

      Functions

      - Source + Source diff --git a/docs/master/List.Chars.BitString.html b/docs/master/List.Chars.BitString.html index cbee8f544..83fc230e3 100644 --- a/docs/master/List.Chars.BitString.html +++ b/docs/master/List.Chars.BitString.html @@ -29,7 +29,7 @@

      - Source + Source @@ -60,7 +60,7 @@

      Functions

      - Source + Source diff --git a/docs/master/List.Chars.List.html b/docs/master/List.Chars.List.html index 96748e2d1..5b01a9bfc 100644 --- a/docs/master/List.Chars.List.html +++ b/docs/master/List.Chars.List.html @@ -29,7 +29,7 @@

      - Source + Source @@ -60,7 +60,7 @@

      Functions

      - Source + Source diff --git a/docs/master/List.Chars.Number.html b/docs/master/List.Chars.Number.html index 51fef0449..fac2c0f24 100644 --- a/docs/master/List.Chars.Number.html +++ b/docs/master/List.Chars.Number.html @@ -29,7 +29,7 @@

      - Source + Source @@ -60,7 +60,7 @@

      Functions

      - Source + Source diff --git a/docs/master/List.Chars.html b/docs/master/List.Chars.html index fd9d2c6e9..31a898883 100644 --- a/docs/master/List.Chars.html +++ b/docs/master/List.Chars.html @@ -40,7 +40,7 @@

      - Source + Source

      Implementations

      @@ -100,7 +100,7 @@

      Functions

      - Source + Source diff --git a/docs/master/List.html b/docs/master/List.html index 3420ff583..1c8ba6b24 100644 --- a/docs/master/List.html +++ b/docs/master/List.html @@ -39,7 +39,7 @@

      - Source + Source @@ -162,7 +162,7 @@

      Examples

      - Source + Source

      @@ -181,7 +181,7 @@

      Examples

      - Source + Source

      @@ -198,7 +198,7 @@

      Examples

      - Source + Source

      @@ -216,7 +216,7 @@

      Examples

      - Source + Source

      @@ -236,7 +236,7 @@

      Examples

      - Source + Source

      @@ -244,7 +244,7 @@

      Examples

      - Source + Source

      @@ -263,7 +263,7 @@

      Examples

      - Source + Source

      @@ -279,7 +279,7 @@

      Examples

      - Source + Source

      @@ -302,7 +302,7 @@

      Examples

      - Source + Source

      @@ -325,7 +325,7 @@

      Examples

      - Source + Source

      @@ -348,7 +348,7 @@

      Examples

      - Source + Source

      @@ -371,7 +371,7 @@

      Examples

      - Source + Source

      @@ -387,7 +387,7 @@

      Examples

      - Source + Source

      @@ -404,7 +404,7 @@

      Examples

      - Source + Source

      @@ -423,7 +423,7 @@

      Examples

      - Source + Source

      @@ -442,7 +442,7 @@

      Examples

      - Source + Source

      @@ -459,7 +459,7 @@

      Examples

      - Source + Source

      @@ -477,7 +477,7 @@

      Examples

      - Source + Source diff --git a/docs/master/ListDict.html b/docs/master/ListDict.html index 8850700a9..8f02941d3 100644 --- a/docs/master/ListDict.html +++ b/docs/master/ListDict.html @@ -35,7 +35,7 @@

      - Source + Source @@ -177,7 +177,7 @@

      Functions

      Deletes the entry under the given key from the dict.

      - Source + Source

      @@ -187,7 +187,7 @@

      Functions

      which key is not in keys

      - Source + Source

      @@ -196,7 +196,7 @@

      Functions

      Returns an empty ListDict.

      - Source + Source

      @@ -205,7 +205,7 @@

      Functions

      Check if the ListDict is equal to another ListDict.

      - Source + Source

      @@ -215,7 +215,7 @@

      Functions

      dict in a tagged tuple, otherwise :error.

      - Source + Source

      @@ -225,7 +225,7 @@

      Functions

      raises KeyError if the key does not exist.

      - Source + Source

      @@ -235,7 +235,7 @@

      Functions

      dict or default if no key is set.

      - Source + Source

      @@ -244,7 +244,7 @@

      Functions

      Returns true if the dict has the given key.

      - Source + Source

      @@ -253,7 +253,7 @@

      Functions

      Returns all keys in the dict.

      - Source + Source

      @@ -262,7 +262,7 @@

      Functions

      Merges the given Enumerable into the dict.

      - Source + Source

      @@ -271,7 +271,7 @@

      Functions

      Returns a new ListDict, i.e. an empty list.

      - Source + Source

      @@ -280,7 +280,7 @@

      Functions

      Creates a new ListDict from the given pairs.

      - Source + Source

      @@ -290,7 +290,7 @@

      Functions

      via the given transformation function.

      - Source + Source

      @@ -300,7 +300,7 @@

      Functions

      from the dict as well as the dict without that key.

      - Source + Source

      @@ -309,7 +309,7 @@

      Functions

      Puts the given key-value pair in the dict.

      - Source + Source

      @@ -319,7 +319,7 @@

      Functions

      if no entry exists yet.

      - Source + Source

      @@ -328,7 +328,7 @@

      Functions

      Returns the dict size.

      - Source + Source

      @@ -340,7 +340,7 @@

      Functions

      Returns a 2-tuple of the new dicts.

      - Source + Source

      @@ -350,7 +350,7 @@

      Functions

      which key is in keys

      - Source + Source

      @@ -359,7 +359,7 @@

      Functions

      Converts the dict to a list.

      - Source + Source

      @@ -368,7 +368,7 @@

      Functions

      Updates the key in the dict according to the given function.

      - Source + Source

      @@ -378,7 +378,7 @@

      Functions

      or uses the given initial value if no entry exists.

      - Source + Source

      @@ -387,7 +387,7 @@

      Functions

      Returns all values in the dict.

      - Source + Source
      diff --git a/docs/master/Macro.Env.html b/docs/master/Macro.Env.html index 27170e074..c9618860d 100644 --- a/docs/master/Macro.Env.html +++ b/docs/master/Macro.Env.html @@ -55,7 +55,7 @@

      - Source + Source @@ -168,7 +168,7 @@

      Functions

      inside a guard.

      - Source + Source

      @@ -178,7 +178,7 @@

      Functions

      inside a match clause.

      - Source + Source

      @@ -188,7 +188,7 @@

      Functions

      information as keys.

      - Source + Source

      @@ -197,7 +197,7 @@

      Functions

      Returns the environment stacktrace.

      - Source + Source
      diff --git a/docs/master/Macro.html b/docs/master/Macro.html index 4827735ee..17db392d8 100644 --- a/docs/master/Macro.html +++ b/docs/master/Macro.html @@ -32,7 +32,7 @@

      - Source + Source @@ -129,7 +129,7 @@

      Examples

      - Source + Source

      @@ -231,7 +231,7 @@

      Examples

      - Source + Source

      @@ -254,7 +254,7 @@

      Examples

      - Source + Source

      @@ -266,7 +266,7 @@

      Examples

      which is returned as { :unsafe, term }.

      - Source + Source

      @@ -281,7 +281,7 @@

      Examples

      - Source + Source

      @@ -309,7 +309,7 @@

      Examples

      and we return a version with it unescaped.

      - Source + Source

      @@ -359,7 +359,7 @@

      Examples

      - Source + Source

      @@ -375,7 +375,7 @@

      Examples

      for examples.

      - Source + Source

      @@ -385,7 +385,7 @@

      Examples

      Check unescape_tokens/1 and unescape_binary/2 for more information.

      - Source + Source @@ -402,7 +402,7 @@

      Macros

      as a macro so it can be used in guard clauses.

      - Source + Source

      @@ -412,7 +412,7 @@

      Macros

      as a macro so it can be used in guard clauses.

      - Source + Source diff --git a/docs/master/MatchError.html b/docs/master/MatchError.html index d13c9ad64..00cfa4749 100644 --- a/docs/master/MatchError.html +++ b/docs/master/MatchError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -71,7 +71,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Dep.html b/docs/master/Mix.Dep.html index 03f1ba108..41e4dc410 100644 --- a/docs/master/Mix.Dep.html +++ b/docs/master/Mix.Dep.html @@ -44,7 +44,7 @@

      - Source + Source diff --git a/docs/master/Mix.Deps.html b/docs/master/Mix.Deps.html index 2e4ba7d5b..f0c04fb5a 100644 --- a/docs/master/Mix.Deps.html +++ b/docs/master/Mix.Deps.html @@ -32,7 +32,7 @@

      - Source + Source @@ -159,7 +159,7 @@

      Exceptions

      provides a dependency in the wrong format.

      - Source + Source

      @@ -169,7 +169,7 @@

      Exceptions

      accumulator.

      - Source + Source

      @@ -178,7 +178,7 @@

      Exceptions

      Check if a dependency is available.

      - Source + Source

      @@ -188,7 +188,7 @@

      Exceptions

      Logs a message if the dependency could not be found.

      - Source + Source

      @@ -197,7 +197,7 @@

      Exceptions

      Checks the lock for the given dependency and update its status accordingly.

      - Source + Source

      @@ -206,7 +206,7 @@

      Exceptions

      Returns all direct child dependencies.

      - Source + Source

      @@ -215,7 +215,7 @@

      Exceptions

      Returns all compile paths for the dependency.

      - Source + Source

      @@ -224,7 +224,7 @@

      Exceptions

      Returns all dependencies depending on given dependencies.

      - Source + Source

      @@ -233,7 +233,7 @@

      Exceptions

      Format the dependency for printing.

      - Source + Source

      @@ -242,7 +242,7 @@

      Exceptions

      Formats the status of a dependency.

      - Source + Source

      @@ -253,7 +253,7 @@

      Exceptions

      project into the project stack.

      - Source + Source

      @@ -262,7 +262,7 @@

      Exceptions

      Check if a dependency is part of an umbrella project as a top level project.

      - Source + Source

      @@ -271,7 +271,7 @@

      Exceptions

      Returns all load paths for the dependency.

      - Source + Source

      @@ -280,7 +280,7 @@

      Exceptions

      Returns true if dependency is a make project.

      - Source + Source

      @@ -289,7 +289,7 @@

      Exceptions

      Returns true if dependency is a mix project.

      - Source + Source

      @@ -298,7 +298,7 @@

      Exceptions

      Check if a dependency is ok.

      - Source + Source

      @@ -309,7 +309,7 @@

      Exceptions

      invoking this function.

      - Source + Source

      @@ -318,7 +318,7 @@

      Exceptions

      Returns true if dependency is a rebar project.

      - Source + Source

      @@ -327,7 +327,7 @@

      Exceptions

      Updates the dependency inside the given project.

      - Source + Source
      diff --git a/docs/master/Mix.Error.html b/docs/master/Mix.Error.html index 91cbab0f5..04a24e70f 100644 --- a/docs/master/Mix.Error.html +++ b/docs/master/Mix.Error.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/master/Mix.Generator.html b/docs/master/Mix.Generator.html index 2298c993e..b3b41d818 100644 --- a/docs/master/Mix.Generator.html +++ b/docs/master/Mix.Generator.html @@ -32,7 +32,7 @@

      - Source + Source @@ -89,7 +89,7 @@

      Functions

      Creates a directory if one does not exist yet.

      - Source + Source

      @@ -99,7 +99,7 @@

      Functions

      If the file already exists, asks for user confirmation.

      - Source + Source @@ -124,7 +124,7 @@

      Macros

      For more information, check EEx.SmartEngine.

      - Source + Source

      @@ -136,7 +136,7 @@

      Macros

      _text that expects no argument.

      - Source + Source

      @@ -150,7 +150,7 @@

      Macros

      - Source + Source diff --git a/docs/master/Mix.InvalidTaskError.html b/docs/master/Mix.InvalidTaskError.html index 15e4c4e1a..016477ca1 100644 --- a/docs/master/Mix.InvalidTaskError.html +++ b/docs/master/Mix.InvalidTaskError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -77,7 +77,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Local.html b/docs/master/Mix.Local.html index db5a09937..89ac247a4 100644 --- a/docs/master/Mix.Local.html +++ b/docs/master/Mix.Local.html @@ -32,7 +32,7 @@

      - Source + Source @@ -79,7 +79,7 @@

      Functions

      Returns all tasks modules in .mix/tasks.

      - Source + Source

      @@ -88,7 +88,7 @@

      Functions

      Append mix paths into Erlang code path.

      - Source + Source

      @@ -97,7 +97,7 @@

      Functions

      Append local tasks path into Erlang code path.

      - Source + Source

      @@ -106,7 +106,7 @@

      Functions

      The path for local tasks.

      - Source + Source
      diff --git a/docs/master/Mix.NoProjectError.html b/docs/master/Mix.NoProjectError.html index 90b783d18..34bf17bbe 100644 --- a/docs/master/Mix.NoProjectError.html +++ b/docs/master/Mix.NoProjectError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/master/Mix.NoTaskError.html b/docs/master/Mix.NoTaskError.html index bc60525c6..ce8ccae87 100644 --- a/docs/master/Mix.NoTaskError.html +++ b/docs/master/Mix.NoTaskError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -77,7 +77,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.OutOfDateDepsError.html b/docs/master/Mix.OutOfDateDepsError.html index 4e8977731..7cc86e8cd 100644 --- a/docs/master/Mix.OutOfDateDepsError.html +++ b/docs/master/Mix.OutOfDateDepsError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -77,7 +77,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Project.html b/docs/master/Mix.Project.html index c11a11286..940a01bab 100644 --- a/docs/master/Mix.Project.html +++ b/docs/master/Mix.Project.html @@ -61,7 +61,7 @@

      Examples

      - Source + Source @@ -143,7 +143,7 @@

      Functions

      Returns the path to the apps directory.

      - Source + Source

      @@ -152,7 +152,7 @@

      Functions

      Returns the paths this project compiles to.

      - Source + Source

      @@ -162,7 +162,7 @@

      Functions

      considering the current environment.

      - Source + Source

      @@ -171,7 +171,7 @@

      Functions

      Returns a list of project config files (mix.exs and mix.lock).

      - Source + Source

      @@ -188,7 +188,7 @@

      Functions

      Returns nil if no project.

      - Source + Source

      @@ -197,7 +197,7 @@

      Functions

      Same as get/0 but raises an exception if no project.

      - Source + Source

      @@ -208,7 +208,7 @@

      Functions

      into the project stack.

      - Source + Source

      @@ -217,7 +217,7 @@

      Functions

      Returns all load paths for this project.

      - Source + Source

      @@ -231,7 +231,7 @@

      Functions

      if it is an umbrella project or not.

      - Source + Source

      @@ -241,7 +241,7 @@

      Functions

      when the environment changes during a task.

      - Source + Source

      @@ -250,7 +250,7 @@

      Functions

      Returns true if project is an umbrella project.

      - Source + Source
      diff --git a/docs/master/Mix.SCM.html b/docs/master/Mix.SCM.html index cfa0ecd0f..0dac3796d 100644 --- a/docs/master/Mix.SCM.html +++ b/docs/master/Mix.SCM.html @@ -35,7 +35,7 @@

      - Source + Source @@ -127,7 +127,7 @@

      Functions

      Returns all available SCM.

      - Source + Source

      @@ -136,7 +136,7 @@

      Functions

      Register the scm repository with the given key and mod.

      - Source + Source

      @@ -145,7 +145,7 @@

      Functions

      Register builtin SCMs.

      - Source + Source
      @@ -163,7 +163,7 @@

      Callbacks

      This behavior function should clean the given dependency.

      - Source + Source

      @@ -174,7 +174,7 @@

      Callbacks

      same SCM.

      - Source + Source

      @@ -186,7 +186,7 @@

      Callbacks

      return true.

      - Source + Source

      @@ -202,7 +202,7 @@

      Callbacks

      It must return the current lock.

      - Source + Source

      @@ -216,7 +216,7 @@

      Callbacks

      to the latest version.

      - Source + Source

      @@ -226,7 +226,7 @@

      Callbacks

      dependency is available.

      - Source + Source

      @@ -246,7 +246,7 @@

      Callbacks

      while other SCMs would simply return nil.

      - Source + Source

      @@ -256,7 +256,7 @@

      Callbacks

      lock information for printing.

      - Source + Source

      @@ -266,7 +266,7 @@

      Callbacks

      information for printing.

      - Source + Source diff --git a/docs/master/Mix.Shell.IO.html b/docs/master/Mix.Shell.IO.html index 000fdca99..1814f48f4 100644 --- a/docs/master/Mix.Shell.IO.html +++ b/docs/master/Mix.Shell.IO.html @@ -33,7 +33,7 @@

      - Source + Source @@ -86,7 +86,7 @@

      Functions

      to stdout as it comes.

      - Source + Source

      @@ -95,7 +95,7 @@

      Functions

      Writes an error message to the shell followed by new line.

      - Source + Source

      @@ -104,7 +104,7 @@

      Functions

      Writes a message to the shell followed by new line.

      - Source + Source

      @@ -112,7 +112,7 @@

      Functions

      - Source + Source

      @@ -123,7 +123,7 @@

      Functions

      regex %r/^Y(es)?$/i.

      - Source + Source diff --git a/docs/master/Mix.Shell.Process.html b/docs/master/Mix.Shell.Process.html index d1ee79352..833f01f3c 100644 --- a/docs/master/Mix.Shell.Process.html +++ b/docs/master/Mix.Shell.Process.html @@ -45,7 +45,7 @@

      - Source + Source @@ -103,7 +103,7 @@

      Functions

      the current process.

      - Source + Source

      @@ -112,7 +112,7 @@

      Functions

      Simply forwards the message to the current process.

      - Source + Source

      @@ -127,7 +127,7 @@

      Examples

      - Source + Source

      @@ -136,7 +136,7 @@

      Examples

      Simply forwards the message to the current process.

      - Source + Source

      @@ -144,7 +144,7 @@

      Examples

      - Source + Source

      @@ -160,7 +160,7 @@

      Examples

      process input given. Value must be true or false.

      - Source + Source diff --git a/docs/master/Mix.Shell.html b/docs/master/Mix.Shell.html index 79783e409..abe8b4db8 100644 --- a/docs/master/Mix.Shell.html +++ b/docs/master/Mix.Shell.html @@ -34,7 +34,7 @@

      - Source + Source @@ -97,7 +97,7 @@

      Functions

      is shared accross different shells.

      - Source + Source

      @@ -106,7 +106,7 @@

      Functions

      Returns if we should output application name to shell.

      - Source + Source
      @@ -125,7 +125,7 @@

      Callbacks

      its exit status.

      - Source + Source

      @@ -134,7 +134,7 @@

      Callbacks

      Asks the user for confirmation.

      - Source + Source

      @@ -143,7 +143,7 @@

      Callbacks

      Warns about the given error message.

      - Source + Source

      @@ -152,7 +152,7 @@

      Callbacks

      Informs the given message.

      - Source + Source
      diff --git a/docs/master/Mix.Task.html b/docs/master/Mix.Task.html index c56cd9c7f..43bb6e93c 100644 --- a/docs/master/Mix.Task.html +++ b/docs/master/Mix.Task.html @@ -34,7 +34,7 @@

      - Source + Source @@ -127,7 +127,7 @@

      Functions

      won't show up. Check load_all/0 if you want to preload all tasks.

      - Source + Source

      @@ -137,7 +137,7 @@

      Functions

      Returns an ordset with all the tasks invoked thus far.

      - Source + Source

      @@ -153,7 +153,7 @@

      Exceptions

      - Source + Source

      @@ -162,7 +162,7 @@

      Exceptions

      Checks if the task is hidden or not. Returns a boolean.

      - Source + Source

      @@ -171,7 +171,7 @@

      Exceptions

      Loads all tasks in all code paths.

      - Source + Source

      @@ -181,7 +181,7 @@

      Exceptions

      Returns the moduledoc or nil.

      - Source + Source

      @@ -190,7 +190,7 @@

      Exceptions

      Checks if the task is defined for umbrella projects.

      - Source + Source

      @@ -200,7 +200,7 @@

      Exceptions

      an umbrella project reenables a task it is reenabled for all sub projects.

      - Source + Source

      @@ -217,7 +217,7 @@

      Exceptions

      or it is invalid. Check get/2 for more information.

      - Source + Source

      @@ -227,7 +227,7 @@

      Exceptions

      Returns the shortdoc or nil.

      - Source + Source

      @@ -236,7 +236,7 @@

      Exceptions

      Returns the task name for the given module.

      - Source + Source
      @@ -255,7 +255,7 @@

      Callbacks

      a list of command line args.

      - Source + Source diff --git a/docs/master/Mix.Tasks.App.Start.html b/docs/master/Mix.Tasks.App.Start.html index 159725882..0c29ecda9 100644 --- a/docs/master/Mix.Tasks.App.Start.html +++ b/docs/master/Mix.Tasks.App.Start.html @@ -40,7 +40,7 @@

      Command line options

      - Source + Source @@ -71,7 +71,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Tasks.Clean.html b/docs/master/Mix.Tasks.Clean.html index 740571f0f..9ec3890cd 100644 --- a/docs/master/Mix.Tasks.Clean.html +++ b/docs/master/Mix.Tasks.Clean.html @@ -38,7 +38,7 @@

      Command line options

      - Source + Source @@ -69,7 +69,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Tasks.Compile.App.html b/docs/master/Mix.Tasks.Compile.App.html index 926eb51b7..715c31577 100644 --- a/docs/master/Mix.Tasks.Compile.App.html +++ b/docs/master/Mix.Tasks.Compile.App.html @@ -56,7 +56,7 @@

      Configuration

      - Source + Source @@ -87,7 +87,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Tasks.Compile.Elixir.html b/docs/master/Mix.Tasks.Compile.Elixir.html index 6f99f721e..197840526 100644 --- a/docs/master/Mix.Tasks.Compile.Elixir.html +++ b/docs/master/Mix.Tasks.Compile.Elixir.html @@ -82,7 +82,7 @@

      Configuration

      - Source + Source @@ -113,7 +113,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Tasks.Compile.Erlang.html b/docs/master/Mix.Tasks.Compile.Erlang.html index d0e567aa0..0e2a8b450 100644 --- a/docs/master/Mix.Tasks.Compile.Erlang.html +++ b/docs/master/Mix.Tasks.Compile.Erlang.html @@ -72,7 +72,7 @@

      Configuration

      - Source + Source @@ -123,7 +123,7 @@

      Functions

      extension.

      - Source + Source

      @@ -132,7 +132,7 @@

      Functions

      Interprets compilation results and prints them to the console.

      - Source + Source

      @@ -140,7 +140,7 @@

      Functions

      - Source + Source

      @@ -150,7 +150,7 @@

      Functions

      Erlang compilation tools.

      - Source + Source diff --git a/docs/master/Mix.Tasks.Compile.Leex.html b/docs/master/Mix.Tasks.Compile.Leex.html index f10cb3b35..98fc614d2 100644 --- a/docs/master/Mix.Tasks.Compile.Leex.html +++ b/docs/master/Mix.Tasks.Compile.Leex.html @@ -56,7 +56,7 @@

      Configuration

      - Source + Source @@ -87,7 +87,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Tasks.Compile.Yecc.html b/docs/master/Mix.Tasks.Compile.Yecc.html index 81a7d285e..d1f6bde6f 100644 --- a/docs/master/Mix.Tasks.Compile.Yecc.html +++ b/docs/master/Mix.Tasks.Compile.Yecc.html @@ -56,7 +56,7 @@

      Configuration

      - Source + Source @@ -87,7 +87,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Tasks.Compile.html b/docs/master/Mix.Tasks.Compile.html index 2c374684e..ee3975dce 100644 --- a/docs/master/Mix.Tasks.Compile.html +++ b/docs/master/Mix.Tasks.Compile.html @@ -66,7 +66,7 @@

      Common configuration

      - Source + Source @@ -97,7 +97,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Tasks.Deps.Check.html b/docs/master/Mix.Tasks.Deps.Check.html index 4b74d4f5c..384f55d29 100644 --- a/docs/master/Mix.Tasks.Deps.Check.html +++ b/docs/master/Mix.Tasks.Deps.Check.html @@ -36,7 +36,7 @@

      - Source + Source @@ -67,7 +67,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Tasks.Deps.Clean.html b/docs/master/Mix.Tasks.Deps.Clean.html index 98c8a14d8..abde4363c 100644 --- a/docs/master/Mix.Tasks.Deps.Clean.html +++ b/docs/master/Mix.Tasks.Deps.Clean.html @@ -36,7 +36,7 @@

      - Source + Source @@ -67,7 +67,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Tasks.Deps.Compile.html b/docs/master/Mix.Tasks.Deps.Compile.html index 409e067ab..b843509f0 100644 --- a/docs/master/Mix.Tasks.Deps.Compile.html +++ b/docs/master/Mix.Tasks.Deps.Compile.html @@ -50,7 +50,7 @@

      - Source + Source @@ -81,7 +81,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Tasks.Deps.Get.html b/docs/master/Mix.Tasks.Deps.Get.html index 9eede311b..bbfe25d8b 100644 --- a/docs/master/Mix.Tasks.Deps.Get.html +++ b/docs/master/Mix.Tasks.Deps.Get.html @@ -40,7 +40,7 @@

      Command line options

      - Source + Source @@ -71,7 +71,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Tasks.Deps.Loadpaths.html b/docs/master/Mix.Tasks.Deps.Loadpaths.html index cf1c12e35..dd0a2e92f 100644 --- a/docs/master/Mix.Tasks.Deps.Loadpaths.html +++ b/docs/master/Mix.Tasks.Deps.Loadpaths.html @@ -33,7 +33,7 @@

      - Source + Source @@ -64,7 +64,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Tasks.Deps.Unlock.html b/docs/master/Mix.Tasks.Deps.Unlock.html index 29556f4e2..cc536ad46 100644 --- a/docs/master/Mix.Tasks.Deps.Unlock.html +++ b/docs/master/Mix.Tasks.Deps.Unlock.html @@ -33,7 +33,7 @@

      - Source + Source @@ -64,7 +64,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Tasks.Deps.Update.html b/docs/master/Mix.Tasks.Deps.Update.html index 4a15bb461..45a245eb7 100644 --- a/docs/master/Mix.Tasks.Deps.Update.html +++ b/docs/master/Mix.Tasks.Deps.Update.html @@ -42,7 +42,7 @@

      Command line options

      - Source + Source @@ -73,7 +73,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Tasks.Deps.html b/docs/master/Mix.Tasks.Deps.html index 628eaca8f..5524a94a1 100644 --- a/docs/master/Mix.Tasks.Deps.html +++ b/docs/master/Mix.Tasks.Deps.html @@ -39,7 +39,7 @@

      - Source + Source @@ -70,7 +70,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Tasks.Do.html b/docs/master/Mix.Tasks.Do.html index 78c9ca75f..0c1ac0f7b 100644 --- a/docs/master/Mix.Tasks.Do.html +++ b/docs/master/Mix.Tasks.Do.html @@ -40,7 +40,7 @@

      Examples

      - Source + Source @@ -71,7 +71,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Tasks.Escriptize.html b/docs/master/Mix.Tasks.Escriptize.html index bfefce2b3..bfb30e163 100644 --- a/docs/master/Mix.Tasks.Escriptize.html +++ b/docs/master/Mix.Tasks.Escriptize.html @@ -63,7 +63,7 @@

      Configuration

      - Source + Source @@ -94,7 +94,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Tasks.Help.html b/docs/master/Mix.Tasks.Help.html index 6fa36d35c..978e0a427 100644 --- a/docs/master/Mix.Tasks.Help.html +++ b/docs/master/Mix.Tasks.Help.html @@ -40,7 +40,7 @@

      Arguments

      - Source + Source @@ -71,7 +71,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Tasks.Loadpaths.html b/docs/master/Mix.Tasks.Loadpaths.html index bc7b95827..b5380733a 100644 --- a/docs/master/Mix.Tasks.Loadpaths.html +++ b/docs/master/Mix.Tasks.Loadpaths.html @@ -39,7 +39,7 @@

      Configuration

      - Source + Source @@ -70,7 +70,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Tasks.Local.Install.html b/docs/master/Mix.Tasks.Local.Install.html index 6e0346f2a..0896882cb 100644 --- a/docs/master/Mix.Tasks.Local.Install.html +++ b/docs/master/Mix.Tasks.Local.Install.html @@ -43,7 +43,7 @@

      - Source + Source @@ -74,7 +74,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Tasks.Local.Rebar.html b/docs/master/Mix.Tasks.Local.Rebar.html index d331b0d3e..f34b2b55e 100644 --- a/docs/master/Mix.Tasks.Local.Rebar.html +++ b/docs/master/Mix.Tasks.Local.Rebar.html @@ -36,7 +36,7 @@

      - Source + Source @@ -73,7 +73,7 @@

      Functions

      Return the path to the local copy of rebar. Used when building deps

      - Source + Source

      @@ -81,7 +81,7 @@

      Functions

      - Source + Source
      diff --git a/docs/master/Mix.Tasks.Local.Uninstall.html b/docs/master/Mix.Tasks.Local.Uninstall.html index 12aef7faf..c837a7c02 100644 --- a/docs/master/Mix.Tasks.Local.Uninstall.html +++ b/docs/master/Mix.Tasks.Local.Uninstall.html @@ -35,7 +35,7 @@

      - Source + Source @@ -66,7 +66,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Tasks.Local.html b/docs/master/Mix.Tasks.Local.html index 09396ced5..0e351a949 100644 --- a/docs/master/Mix.Tasks.Local.html +++ b/docs/master/Mix.Tasks.Local.html @@ -32,7 +32,7 @@

      - Source + Source @@ -63,7 +63,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Tasks.New.html b/docs/master/Mix.Tasks.New.html index ccbe544c5..c70450c50 100644 --- a/docs/master/Mix.Tasks.New.html +++ b/docs/master/Mix.Tasks.New.html @@ -62,7 +62,7 @@

      Examples

      - Source + Source @@ -93,7 +93,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Tasks.Run.html b/docs/master/Mix.Tasks.Run.html index 14977ee0c..f0b65552c 100644 --- a/docs/master/Mix.Tasks.Run.html +++ b/docs/master/Mix.Tasks.Run.html @@ -56,7 +56,7 @@

      Examples

      - Source + Source @@ -87,7 +87,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Tasks.Test.html b/docs/master/Mix.Tasks.Test.html index 7b3931837..69687d302 100644 --- a/docs/master/Mix.Tasks.Test.html +++ b/docs/master/Mix.Tasks.Test.html @@ -65,7 +65,7 @@

      Configuration

      - Source + Source @@ -96,7 +96,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Utils.html b/docs/master/Mix.Utils.html index 681608363..dee7a31dc 100644 --- a/docs/master/Mix.Utils.html +++ b/docs/master/Mix.Utils.html @@ -43,7 +43,7 @@

      Conversions

      - Source + Source @@ -150,7 +150,7 @@

      Examples

      - Source + Source

      @@ -170,7 +170,7 @@

      Examples

      - Source + Source

      @@ -185,7 +185,7 @@

      Examples

      - Source + Source

      @@ -195,7 +195,7 @@

      Examples

      and concatenating normal lists.

      - Source + Source

      @@ -208,7 +208,7 @@

      Examples

      When looking up directories, files starting with "." are ignored.

      - Source + Source

      @@ -217,7 +217,7 @@

      Examples

      Extract all stale sources compared to the given targets.

      - Source + Source

      @@ -230,7 +230,7 @@

      Examples

      the files removed from the manifest file.

      - Source + Source

      @@ -240,7 +240,7 @@

      Examples

      MIX_HOME environment variable is set.

      - Source + Source

      @@ -252,7 +252,7 @@

      Examples

      use :.

      - Source + Source

      @@ -272,7 +272,7 @@

      Examples

      - Source + Source

      @@ -282,7 +282,7 @@

      Examples

      Used by local.install and local.rebar.

      - Source + Source

      @@ -292,7 +292,7 @@

      Examples

      working directory.

      - Source + Source

      @@ -301,7 +301,7 @@

      Examples

      Gets the source location of a module as a binary.

      - Source + Source

      @@ -311,7 +311,7 @@

      Examples

      compared to the given target.

      - Source + Source

      @@ -337,7 +337,7 @@

      Examples

      - Source + Source diff --git a/docs/master/Mix.html b/docs/master/Mix.html index 0a33689f7..3298e02f7 100644 --- a/docs/master/Mix.html +++ b/docs/master/Mix.html @@ -40,7 +40,7 @@

      - Source + Source @@ -102,7 +102,7 @@

      Functions

      Returns the mix environment.

      - Source + Source

      @@ -112,7 +112,7 @@

      Functions

      per environment is not going to be reloaded.

      - Source + Source

      @@ -122,7 +122,7 @@

      Functions

      one step. Useful when invoking mix from an external tool.

      - Source + Source

      @@ -134,7 +134,7 @@

      Functions

      tasks to work without a need for an underlying project.

      - Source + Source

      @@ -148,7 +148,7 @@

      Functions

      messages to the current process.

      - Source + Source

      @@ -157,7 +157,7 @@

      Functions

      Sets the current shell.

      - Source + Source

      @@ -165,7 +165,7 @@

      Functions

      - Source + Source
      diff --git a/docs/master/Module.html b/docs/master/Module.html index 63dc2152d..ba65c2703 100644 --- a/docs/master/Module.html +++ b/docs/master/Module.html @@ -39,7 +39,7 @@

      - Source + Source @@ -178,7 +178,7 @@

      Examples

      - Source + Source

      @@ -198,7 +198,7 @@

      Examples

      - Source + Source

      @@ -218,7 +218,7 @@

      Examples

      - Source + Source

      @@ -254,7 +254,7 @@

      Differences with defmodule

      shares the same environment.

      - Source + Source

      @@ -273,7 +273,7 @@

      Examples

      - Source + Source

      @@ -293,7 +293,7 @@

      Examples

      - Source + Source

      @@ -310,7 +310,7 @@

      Examples

      - Source + Source

      @@ -329,7 +329,7 @@

      Examples

      - Source + Source

      @@ -346,16 +346,16 @@

      Examples

      - Source + Source

      eval_quoted(module, quoted, binding // [], opts // [])

      -

      Evalutes the quotes contents in the given module context.

      +

      Evaluates the quoted contents in the given module's context.

      A list of environment options can also be given as argument. -Check Code.eval_string for more information.

      +See Code.eval_string for more information.

      Raises an error if the module was already compiled.

      @@ -381,7 +381,7 @@

      Examples

      - Source + Source

      @@ -404,7 +404,7 @@

      Examples

      - Source + Source

      @@ -415,7 +415,7 @@

      Examples

      developer to customize it.

      - Source + Source

      @@ -425,7 +425,7 @@

      Examples

      and its attributes and functions can be modified.

      - Source + Source

      @@ -434,7 +434,7 @@

      Examples

      Returns true if the given tuple in module is marked as overridable.

      - Source + Source

      @@ -452,7 +452,7 @@

      Examples

      - Source + Source

      @@ -492,7 +492,7 @@

      Examples

      - Source + Source

      @@ -513,7 +513,7 @@

      Examples

      - Source + Source

      @@ -534,7 +534,7 @@

      Examples

      - Source + Source

      @@ -549,7 +549,7 @@

      Examples

      - Source + Source

      @@ -558,7 +558,7 @@

      Examples

      Convert a module name to binary without the Elixir prefix.

      - Source + Source
      diff --git a/docs/master/Node.html b/docs/master/Node.html index 83b717590..10ee09261 100644 --- a/docs/master/Node.html +++ b/docs/master/Node.html @@ -32,7 +32,7 @@

      - Source + Source @@ -140,7 +140,7 @@

      Functions

      part of a distributed system. Otherwise, it returns false.

      - Source + Source

      @@ -153,7 +153,7 @@

      Functions

      See http://erlang.org/doc/man/net_kernel.html#connect_node-1 for more info.

      - Source + Source

      @@ -167,7 +167,7 @@

      Functions

      See http://www.erlang.org/doc/man/erlang.html#disconnect_node-1 for more info.

      - Source + Source

      @@ -177,7 +177,7 @@

      Functions

      otherwise :nocookie.

      - Source + Source

      @@ -187,7 +187,7 @@

      Functions

      the local node. Same as list(visible).

      - Source + Source

      @@ -200,7 +200,7 @@

      Functions

      See http://www.erlang.org/doc/man/erlang.html#nodes-1 for more info.

      - Source + Source

      @@ -212,7 +212,7 @@

      Functions

      See http://www.erlang.org/doc/man/erlang.html#monitor_node-2 for more info.

      - Source + Source

      @@ -224,7 +224,7 @@

      Functions

      See http://www.erlang.org/doc/man/erlang.html#monitor_node-3 for more info.

      - Source + Source

      @@ -233,7 +233,7 @@

      Functions

      Returns the current node. It returns the same as the built-in node().

      - Source + Source

      @@ -246,7 +246,7 @@

      Functions

      This function will raise FunctionClauseError if the given node is not alive.

      - Source + Source

      @@ -259,7 +259,7 @@

      Functions

      the list of available options.

      - Source + Source

      @@ -272,7 +272,7 @@

      Functions

      the list of available options.

      - Source + Source

      @@ -286,7 +286,7 @@

      Functions

      the list of available options.

      - Source + Source

      @@ -300,7 +300,7 @@

      Functions

      the list of available options.

      - Source + Source

      @@ -313,7 +313,7 @@

      Functions

      received).

      - Source + Source

      @@ -326,7 +326,7 @@

      Functions

      :noconnection will be received).

      - Source + Source diff --git a/docs/master/OptionParser.html b/docs/master/OptionParser.html index d4d34dca4..7ca0aa047 100644 --- a/docs/master/OptionParser.html +++ b/docs/master/OptionParser.html @@ -27,7 +27,7 @@

      - Source + Source @@ -123,7 +123,7 @@

      Negation switches

      - Source + Source

      @@ -141,7 +141,7 @@

      Example

      - Source + Source diff --git a/docs/master/Path.html b/docs/master/Path.html index 34cf657f1..9c7f577e6 100644 --- a/docs/master/Path.html +++ b/docs/master/Path.html @@ -41,7 +41,7 @@

      - Source + Source @@ -171,7 +171,7 @@

      Windows

      - Source + Source

      @@ -193,7 +193,7 @@

      Examples

      - Source + Source

      @@ -215,7 +215,7 @@

      Examples

      - Source + Source

      @@ -236,7 +236,7 @@

      Examples

      - Source + Source

      @@ -253,7 +253,7 @@

      Examples

      - Source + Source

      @@ -269,7 +269,7 @@

      Examples

      - Source + Source

      @@ -297,7 +297,7 @@

      Examples

      - Source + Source

      @@ -314,7 +314,7 @@

      Examples

      - Source + Source

      @@ -334,7 +334,7 @@

      Examples

      - Source + Source

      @@ -349,7 +349,7 @@

      Examples

      - Source + Source

      @@ -373,7 +373,7 @@

      Windows examples

      - Source + Source

      @@ -399,7 +399,7 @@

      Examples

      - Source + Source

      @@ -416,7 +416,7 @@

      Examples

      - Source + Source

      @@ -434,7 +434,7 @@

      Examples

      - Source + Source

      @@ -454,7 +454,7 @@

      Examples

      - Source + Source

      @@ -479,7 +479,7 @@

      Windows examples

      - Source + Source

      @@ -521,7 +521,7 @@

      Examples

      - Source + Source diff --git a/docs/master/Port.html b/docs/master/Port.html index 66e25c2ff..bac78d1b4 100644 --- a/docs/master/Port.html +++ b/docs/master/Port.html @@ -32,7 +32,7 @@

      - Source + Source @@ -104,7 +104,7 @@

      Functions

      - Source + Source

      @@ -167,7 +167,7 @@

      Functions

      - Source + Source
      diff --git a/docs/master/Process.html b/docs/master/Process.html index 880c3a5ea..be6b74670 100644 --- a/docs/master/Process.html +++ b/docs/master/Process.html @@ -37,7 +37,7 @@

      - Source + Source @@ -222,7 +222,7 @@

      Functions

      pid must refer to a process at the local node.

      - Source + Source

      @@ -231,7 +231,7 @@

      Functions

      Deletes all items in the dictionary.

      - Source + Source

      @@ -240,7 +240,7 @@

      Functions

      Deletes the given key from the dictionary.

      - Source + Source

      @@ -253,7 +253,7 @@

      Functions

      See http://www.erlang.org/doc/man/erlang.html#demonitor-2 for more info.

      - Source + Source

      @@ -282,7 +282,7 @@

      Examples

      - Source + Source

      @@ -294,7 +294,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#process_flag-2 for more info.

      - Source + Source

      @@ -307,7 +307,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#process_flag-3 for more info.

      - Source + Source

      @@ -316,7 +316,7 @@

      Examples

      Returns all key-values in the dictionary.

      - Source + Source

      @@ -325,7 +325,7 @@

      Examples

      Returns the value for the given key.

      - Source + Source

      @@ -334,7 +334,7 @@

      Examples

      Returns all keys that have the given value.

      - Source + Source

      @@ -343,7 +343,7 @@

      Examples

      Returns the pid of the group leader for the process which evaluates the function.

      - Source + Source

      @@ -353,7 +353,7 @@

      Examples

      started from a certain shell should have another group leader than :init.

      - Source + Source

      @@ -365,7 +365,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#process_info-1 for more info.

      - Source + Source

      @@ -377,7 +377,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#process_info-2 for more info.

      - Source + Source

      @@ -389,7 +389,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#link-1 for more info.

      - Source + Source

      @@ -405,7 +405,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#processes-0 for more info.

      - Source + Source

      @@ -417,7 +417,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#monitor-2 for more info.

      - Source + Source

      @@ -426,7 +426,7 @@

      Examples

      Stores the given key-value in the process dictionary.

      - Source + Source

      @@ -439,7 +439,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#register-2 for more info.

      - Source + Source

      @@ -448,7 +448,7 @@

      Examples

      Returns a list of names which have been registered using register/2.

      - Source + Source

      @@ -458,7 +458,7 @@

      Examples

      It behaves exactly the same as Kernel.spawn/1.

      - Source + Source

      @@ -470,7 +470,7 @@

      Examples

      check http://www.erlang.org/doc/man/erlang.html#spawn_opt-2

      - Source + Source

      @@ -483,7 +483,7 @@

      Examples

      It behaves exactly the same as the Kernel.spawn/3 function.

      - Source + Source

      @@ -497,7 +497,7 @@

      Examples

      check http://www.erlang.org/doc/man/erlang.html#spawn_opt-4

      - Source + Source

      @@ -508,7 +508,7 @@

      Examples

      process, atomically.

      - Source + Source

      @@ -519,7 +519,7 @@

      Examples

      and the new process, atomically. Otherwise works like spawn/3.

      - Source + Source

      @@ -529,7 +529,7 @@

      Examples

      and reference for a monitor created to the new process.

      - Source + Source

      @@ -540,7 +540,7 @@

      Examples

      reference for the monitor. Otherwise works like spawn/3.

      - Source + Source

      @@ -553,7 +553,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#unlink-1 for more info.

      - Source + Source

      @@ -564,7 +564,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#unregister-1 for more info.

      - Source + Source

      @@ -576,7 +576,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#whereis-1 for more info.

      - Source + Source diff --git a/docs/master/Protocol.UndefinedError.html b/docs/master/Protocol.UndefinedError.html index 0c7a6f389..2d22d7716 100644 --- a/docs/master/Protocol.UndefinedError.html +++ b/docs/master/Protocol.UndefinedError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -77,7 +77,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Range.Iterator.Number.html b/docs/master/Range.Iterator.Number.html index f2dd17804..56f1ea908 100644 --- a/docs/master/Range.Iterator.Number.html +++ b/docs/master/Range.Iterator.Number.html @@ -29,7 +29,7 @@

      - Source + Source @@ -45,7 +45,7 @@

      Functions summary

    3157. - iterator/2 + reduce/4
    3158. @@ -65,15 +65,15 @@

      Functions

      - Source + Source
      -

      - iterator(first, arg2) +

      + reduce(first, arg2, acc, fun)

      - Source + Source
      diff --git a/docs/master/Range.Iterator.html b/docs/master/Range.Iterator.html index 24f96124e..43625f76d 100644 --- a/docs/master/Range.Iterator.html +++ b/docs/master/Range.Iterator.html @@ -29,7 +29,7 @@

      - Source + Source

      Implementations

      @@ -56,7 +56,7 @@

      Functions summary

    3159. - iterator/2 + reduce/4
    3160. @@ -77,20 +77,15 @@

      Functions

      Count how many items are in the range.

      - Source + Source
      -

      - iterator(first, range) +

      + reduce(first, range, acc, fun)

      -

      How to iterate the range, receives the first -and range as arguments. It needs to return a -function that receives an item and returns -a tuple with two elements: the given item -and the next item in the iteration.

      -
      +
      - Source + Source
      diff --git a/docs/master/Range.html b/docs/master/Range.html index 28c55082a..f2f533e1e 100644 --- a/docs/master/Range.html +++ b/docs/master/Range.html @@ -34,7 +34,7 @@

      - Source + Source diff --git a/docs/master/Record.html b/docs/master/Record.html index 74065ec48..3e0a70623 100644 --- a/docs/master/Record.html +++ b/docs/master/Record.html @@ -32,7 +32,7 @@

      - Source + Source @@ -109,7 +109,7 @@

      Examples

      - Source + Source

      @@ -127,7 +127,7 @@

      Examples

      - Source + Source

      @@ -139,7 +139,7 @@

      Examples

      for more information and documentation.

      - Source + Source

      @@ -151,7 +151,7 @@

      Examples

      so check it for more information and documentation.

      - Source + Source

      @@ -160,7 +160,7 @@

      Examples

      Defines types and specs for the record.

      - Source + Source

      @@ -175,7 +175,7 @@

      Examples

      - Source + Source @@ -205,7 +205,7 @@

      Example

      end

      - Source + Source diff --git a/docs/master/Regex.CompileError.html b/docs/master/Regex.CompileError.html index f4a673958..16b0810fa 100644 --- a/docs/master/Regex.CompileError.html +++ b/docs/master/Regex.CompileError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/master/Regex.html b/docs/master/Regex.html index 16f020d52..3d93a3181 100644 --- a/docs/master/Regex.html +++ b/docs/master/Regex.html @@ -77,7 +77,7 @@

      - Source + Source @@ -176,7 +176,7 @@

      Examples

      - Source + Source

      @@ -188,7 +188,7 @@

      Examples

      { :error, reason } otherwise.

      - Source + Source

      @@ -198,7 +198,7 @@

      Examples

      Fails with Regex.CompileError if the regex cannot be compiled.

      - Source + Source

      @@ -213,7 +213,7 @@

      Examples

      - Source + Source

      @@ -232,7 +232,7 @@

      Examples

      - Source + Source

      @@ -249,7 +249,7 @@

      Examples

      - Source + Source

      @@ -264,7 +264,7 @@

      Examples

      - Source + Source

      @@ -273,7 +273,7 @@

      Examples

      Returns the underlying re_pattern in the regular expression.

      - Source + Source

      @@ -302,7 +302,7 @@

      Examples

      - Source + Source

      @@ -321,7 +321,7 @@

      Examples

      - Source + Source

      @@ -343,7 +343,7 @@

      Examples

      - Source + Source

      @@ -358,7 +358,7 @@

      Examples

      - Source + Source

      @@ -368,7 +368,7 @@

      Examples

      If no ammount of parts is given, it defaults to :infinity.

      - Source + Source diff --git a/docs/master/RuntimeError.html b/docs/master/RuntimeError.html index d2f858b30..4b4b46e60 100644 --- a/docs/master/RuntimeError.html +++ b/docs/master/RuntimeError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/master/String.html b/docs/master/String.html index 73051ca2d..bef1750a0 100644 --- a/docs/master/String.html +++ b/docs/master/String.html @@ -139,7 +139,7 @@

      Self-synchronization

      - Source + Source @@ -321,7 +321,7 @@

      Examples

      - Source + Source

      @@ -346,7 +346,7 @@

      Examples

      - Source + Source

      @@ -365,7 +365,7 @@

      Examples

      - Source + Source

      @@ -384,7 +384,7 @@

      Examples

      - Source + Source

      @@ -401,7 +401,7 @@

      Examples

      - Source + Source

      @@ -419,7 +419,7 @@

      Examples

      - Source + Source

      @@ -434,7 +434,7 @@

      Examples

      - Source + Source

      @@ -452,7 +452,7 @@

      Examples

      - Source + Source

      @@ -469,7 +469,7 @@

      Examples

      - Source + Source

      @@ -485,7 +485,7 @@

      Examples

      - Source + Source

      @@ -500,7 +500,7 @@

      Examples

      - Source + Source

      @@ -524,7 +524,7 @@

      Examples

      - Source + Source

      @@ -543,7 +543,7 @@

      Examples

      - Source + Source

      @@ -559,7 +559,7 @@

      Examples

      - Source + Source

      @@ -588,7 +588,7 @@

      Examples

      - Source + Source

      @@ -604,7 +604,7 @@

      Examples

      - Source + Source

      @@ -619,7 +619,7 @@

      Examples

      - Source + Source

      @@ -650,7 +650,7 @@

      Examples

      - Source + Source

      @@ -670,7 +670,7 @@

      Examples

      - Source + Source

      @@ -702,7 +702,7 @@

      Examples

      - Source + Source

      @@ -718,7 +718,7 @@

      Examples

      - Source + Source

      @@ -734,7 +734,7 @@

      Examples

      - Source + Source

      @@ -759,7 +759,7 @@

      Examples

      :error

      - Source + Source

      @@ -780,7 +780,7 @@

      Examples

      - Source + Source

      @@ -799,7 +799,7 @@

      Examples

      - Source + Source

      @@ -820,7 +820,7 @@

      Examples

      - Source + Source

      @@ -845,7 +845,7 @@

      Examples

      - Source + Source

      @@ -869,7 +869,7 @@

      Examples

      - Source + Source diff --git a/docs/master/Supervisor.Behaviour.html b/docs/master/Supervisor.Behaviour.html index 118b17a41..e7a9b6796 100644 --- a/docs/master/Supervisor.Behaviour.html +++ b/docs/master/Supervisor.Behaviour.html @@ -58,7 +58,7 @@

      Example

      - Source + Source @@ -138,7 +138,7 @@

      Strategies

      - Source + Source

      @@ -201,7 +201,7 @@

      Shutdown values

      - Source + Source

      @@ -264,7 +264,7 @@

      Shutdown values

      - Source + Source diff --git a/docs/master/SyntaxError.html b/docs/master/SyntaxError.html index cbf341f50..beb2e20a3 100644 --- a/docs/master/SyntaxError.html +++ b/docs/master/SyntaxError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -83,7 +83,7 @@

      Functions

      - Source + Source diff --git a/docs/master/System.NoAccessCwdError.html b/docs/master/System.NoAccessCwdError.html index ab34d3aeb..75f526dc7 100644 --- a/docs/master/System.NoAccessCwdError.html +++ b/docs/master/System.NoAccessCwdError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/master/System.NoHomeError.html b/docs/master/System.NoHomeError.html index aa0db634d..b033ac23b 100644 --- a/docs/master/System.NoHomeError.html +++ b/docs/master/System.NoHomeError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/master/System.NoTmpDirError.html b/docs/master/System.NoTmpDirError.html index 8acb2f144..3d278256f 100644 --- a/docs/master/System.NoTmpDirError.html +++ b/docs/master/System.NoTmpDirError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/master/System.html b/docs/master/System.html index ddceecccb..e1ea49c2f 100644 --- a/docs/master/System.html +++ b/docs/master/System.html @@ -34,7 +34,7 @@

      - Source + Source @@ -156,7 +156,7 @@

      Functions

      Returns the list of command-line arguments passed to the program.

      - Source + Source

      @@ -170,7 +170,7 @@

      Functions

      as argument.

      - Source + Source

      @@ -179,7 +179,7 @@

      Functions

      Returns a keywords list with version, git tag info and date.

      - Source + Source

      @@ -193,7 +193,7 @@

      Functions

      Returns a binary otherwise.

      - Source + Source

      @@ -203,7 +203,7 @@

      Functions

      is not available.

      - Source + Source

      @@ -212,7 +212,7 @@

      Functions

      Returns the current working directory or raises System.NoAccessCwdError.

      - Source + Source

      @@ -226,7 +226,7 @@

      Functions

      Returns a binary otherwise.

      - Source + Source

      @@ -237,7 +237,7 @@

      Functions

      name of the variable and Value its value.

      - Source + Source

      @@ -248,7 +248,7 @@

      Functions

      variable is undefined.

      - Source + Source

      @@ -260,7 +260,7 @@

      Functions

      See http://www.erlang.org/doc/man/os.html#getpid-0 for more info.

      - Source + Source

      @@ -296,7 +296,7 @@

      Examples

      - Source + Source

      @@ -306,7 +306,7 @@

      Examples

      to each key in dict.

      - Source + Source

      @@ -315,7 +315,7 @@

      Examples

      Sets a new value for the environment variable varname.

      - Source + Source

      @@ -328,7 +328,7 @@

      Examples

      latest exception.

      - Source + Source

      @@ -348,7 +348,7 @@

      Examples

      Returns nil if none of the above are writable.

      - Source + Source

      @@ -358,7 +358,7 @@

      Examples

      instead of returning nil if no temp dir is set.

      - Source + Source

      @@ -368,7 +368,7 @@

      Examples

      It returns nil if no user home is set.

      - Source + Source

      @@ -378,7 +378,7 @@

      Examples

      instead of returning nil if no user home is set.

      - Source + Source

      @@ -387,7 +387,7 @@

      Examples

      Returns Elixir's version as binary.

      - Source + Source
      diff --git a/docs/master/SystemLimitError.html b/docs/master/SystemLimitError.html index 106ae4003..d17ce8dae 100644 --- a/docs/master/SystemLimitError.html +++ b/docs/master/SystemLimitError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/master/TokenMissingError.html b/docs/master/TokenMissingError.html index 1e1b00815..2f3f2efc6 100644 --- a/docs/master/TokenMissingError.html +++ b/docs/master/TokenMissingError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -83,7 +83,7 @@

      Functions

      - Source + Source diff --git a/docs/master/URI.FTP.html b/docs/master/URI.FTP.html index 0e56ce9cf..8e12288b1 100644 --- a/docs/master/URI.FTP.html +++ b/docs/master/URI.FTP.html @@ -27,7 +27,7 @@

      - Source + Source @@ -63,7 +63,7 @@

      Functions

      - Source + Source

      @@ -71,7 +71,7 @@

      Functions

      - Source + Source
      diff --git a/docs/master/URI.HTTP.html b/docs/master/URI.HTTP.html index cb2402140..0c5bce2bd 100644 --- a/docs/master/URI.HTTP.html +++ b/docs/master/URI.HTTP.html @@ -27,7 +27,7 @@

      - Source + Source @@ -63,7 +63,7 @@

      Functions

      - Source + Source

      @@ -71,7 +71,7 @@

      Functions

      - Source + Source
      diff --git a/docs/master/URI.HTTPS.html b/docs/master/URI.HTTPS.html index 4f9f37eb1..a20e475c1 100644 --- a/docs/master/URI.HTTPS.html +++ b/docs/master/URI.HTTPS.html @@ -27,7 +27,7 @@

      - Source + Source @@ -63,7 +63,7 @@

      Functions

      - Source + Source

      @@ -71,7 +71,7 @@

      Functions

      - Source + Source
      diff --git a/docs/master/URI.LDAP.html b/docs/master/URI.LDAP.html index e2f274e11..c5e3606c2 100644 --- a/docs/master/URI.LDAP.html +++ b/docs/master/URI.LDAP.html @@ -27,7 +27,7 @@

      - Source + Source @@ -63,7 +63,7 @@

      Functions

      - Source + Source

      @@ -71,7 +71,7 @@

      Functions

      - Source + Source
      diff --git a/docs/master/URI.Parser.html b/docs/master/URI.Parser.html index 10fb4d5e8..b852a0500 100644 --- a/docs/master/URI.Parser.html +++ b/docs/master/URI.Parser.html @@ -35,7 +35,7 @@

      - Source + Source @@ -76,7 +76,7 @@

      Callbacks

      Responsible for returning the default port.

      - Source + Source

      @@ -85,7 +85,7 @@

      Callbacks

      Responsible for parsing extra URL information.

      - Source + Source
      diff --git a/docs/master/URI.SFTP.html b/docs/master/URI.SFTP.html index fa6cd87c6..d05ec23b4 100644 --- a/docs/master/URI.SFTP.html +++ b/docs/master/URI.SFTP.html @@ -27,7 +27,7 @@

      - Source + Source @@ -63,7 +63,7 @@

      Functions

      - Source + Source

      @@ -71,7 +71,7 @@

      Functions

      - Source + Source
      diff --git a/docs/master/URI.TFTP.html b/docs/master/URI.TFTP.html index b153ef4cc..05ddcb765 100644 --- a/docs/master/URI.TFTP.html +++ b/docs/master/URI.TFTP.html @@ -27,7 +27,7 @@

      - Source + Source @@ -63,7 +63,7 @@

      Functions

      - Source + Source

      @@ -71,7 +71,7 @@

      Functions

      - Source + Source
      diff --git a/docs/master/URI.html b/docs/master/URI.html index 44ac768f0..5dcd87ae5 100644 --- a/docs/master/URI.html +++ b/docs/master/URI.html @@ -32,7 +32,7 @@

      - Source + Source @@ -89,7 +89,7 @@

      Functions

      Unpercent (URL) decodes a URI.

      - Source + Source

      @@ -102,7 +102,7 @@

      Functions

      Use decoder/1 if you want to customize or iterate each value manually.

      - Source + Source

      @@ -111,7 +111,7 @@

      Functions

      Percent (URL) encodes a URI.

      - Source + Source

      @@ -124,7 +124,7 @@

      Functions

      to binary).

      - Source + Source

      @@ -148,7 +148,7 @@

      Functions

      example of one of these extension modules.

      - Source + Source

      @@ -158,7 +158,7 @@

      Functions

      the query string in steps.

      - Source + Source diff --git a/docs/master/UndefinedFunctionError.html b/docs/master/UndefinedFunctionError.html index cd334faa2..4591d3464 100644 --- a/docs/master/UndefinedFunctionError.html +++ b/docs/master/UndefinedFunctionError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -83,7 +83,7 @@

      Functions

      - Source + Source diff --git a/docs/master/index.html b/docs/master/index.html index 93ae16fed..bdab5fcb0 100644 --- a/docs/master/index.html +++ b/docs/master/index.html @@ -3,7 +3,7 @@ - Elixir v0.8.3 Documentation + Elixir v0.9.0 Documentation diff --git a/docs/master/modules_list.html b/docs/master/modules_list.html index 367ed32d2..1fca36e27 100644 --- a/docs/master/modules_list.html +++ b/docs/master/modules_list.html @@ -16,7 +16,7 @@

      - Elixir v0.8.3 + Elixir v0.9.0

      diff --git a/docs/stable/Access.HashDict.html b/docs/stable/Access.HashDict.html index 4503fa350..a5bb6352b 100644 --- a/docs/stable/Access.HashDict.html +++ b/docs/stable/Access.HashDict.html @@ -29,7 +29,7 @@

      - Source + Source @@ -60,7 +60,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Access.List.html b/docs/stable/Access.List.html index 039f84ecc..bd6fcaf8a 100644 --- a/docs/stable/Access.List.html +++ b/docs/stable/Access.List.html @@ -29,7 +29,7 @@

      - Source + Source @@ -72,7 +72,7 @@

      Examples

      - Source + Source diff --git a/docs/stable/Access.html b/docs/stable/Access.html index f5c601309..548c65e81 100644 --- a/docs/stable/Access.html +++ b/docs/stable/Access.html @@ -40,7 +40,7 @@

      - Source + Source

      Implementations

      @@ -101,7 +101,7 @@

      Functions

      Receives the element being accessed and the access item.

      - Source + Source diff --git a/docs/stable/Application.Behaviour.html b/docs/stable/Application.Behaviour.html index da32d224d..3f40c6411 100644 --- a/docs/stable/Application.Behaviour.html +++ b/docs/stable/Application.Behaviour.html @@ -78,7 +78,7 @@

      Example

      - Source + Source diff --git a/docs/stable/ArgumentError.html b/docs/stable/ArgumentError.html index a3ec54bd4..090f3a09a 100644 --- a/docs/stable/ArgumentError.html +++ b/docs/stable/ArgumentError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/stable/ArithmeticError.html b/docs/stable/ArithmeticError.html index cb2b4e534..78e61f141 100644 --- a/docs/stable/ArithmeticError.html +++ b/docs/stable/ArithmeticError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/stable/BadArityError.html b/docs/stable/BadArityError.html index 421ce26d2..ab4e36d43 100644 --- a/docs/stable/BadArityError.html +++ b/docs/stable/BadArityError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -77,7 +77,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/BadFunctionError.html b/docs/stable/BadFunctionError.html index 6889999ed..2781f8ed1 100644 --- a/docs/stable/BadFunctionError.html +++ b/docs/stable/BadFunctionError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -71,7 +71,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Behaviour.html b/docs/stable/Behaviour.html index 9d1511984..b36ec8f4c 100644 --- a/docs/stable/Behaviour.html +++ b/docs/stable/Behaviour.html @@ -73,7 +73,7 @@

      Implementation

      - Source + Source @@ -107,7 +107,7 @@

      Macros

      Defines a callback according to the given type specification.

      - Source + Source diff --git a/docs/stable/Binary.Chars.Atom.html b/docs/stable/Binary.Chars.Atom.html index b8ca4a619..ff67ab87b 100644 --- a/docs/stable/Binary.Chars.Atom.html +++ b/docs/stable/Binary.Chars.Atom.html @@ -29,7 +29,7 @@

      - Source + Source @@ -62,7 +62,7 @@

      Functions

      nil which is converted to an empty string.

      - Source + Source diff --git a/docs/stable/Binary.Chars.BitString.html b/docs/stable/Binary.Chars.BitString.html index dd6c9da4b..9c7a01ddc 100644 --- a/docs/stable/Binary.Chars.BitString.html +++ b/docs/stable/Binary.Chars.BitString.html @@ -29,7 +29,7 @@

      - Source + Source @@ -61,7 +61,7 @@

      Functions

      Simply returns the binary itself.

      - Source + Source diff --git a/docs/stable/Binary.Chars.List.html b/docs/stable/Binary.Chars.List.html index bb611efb2..520e27d19 100644 --- a/docs/stable/Binary.Chars.List.html +++ b/docs/stable/Binary.Chars.List.html @@ -29,7 +29,7 @@

      - Source + Source @@ -72,7 +72,7 @@

      Examples

      - Source + Source diff --git a/docs/stable/Binary.Chars.Number.html b/docs/stable/Binary.Chars.Number.html index d1f7e24a4..7742c956b 100644 --- a/docs/stable/Binary.Chars.Number.html +++ b/docs/stable/Binary.Chars.Number.html @@ -29,7 +29,7 @@

      - Source + Source @@ -61,7 +61,7 @@

      Functions

      Simply converts the number (integer or a float) to a binary.

      - Source + Source diff --git a/docs/stable/Binary.Chars.html b/docs/stable/Binary.Chars.html index e3b444ff9..2491145e2 100644 --- a/docs/stable/Binary.Chars.html +++ b/docs/stable/Binary.Chars.html @@ -43,7 +43,7 @@

      - Source + Source

      Implementations

      @@ -103,7 +103,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Binary.Inspect.Atom.html b/docs/stable/Binary.Inspect.Atom.html index 1e93d94b6..325c917c2 100644 --- a/docs/stable/Binary.Inspect.Atom.html +++ b/docs/stable/Binary.Inspect.Atom.html @@ -49,7 +49,7 @@

      Examples

      - Source + Source @@ -80,7 +80,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Binary.Inspect.BitString.html b/docs/stable/Binary.Inspect.BitString.html index 306c2c45b..d2b44a08e 100644 --- a/docs/stable/Binary.Inspect.BitString.html +++ b/docs/stable/Binary.Inspect.BitString.html @@ -43,7 +43,7 @@

      Examples

      - Source + Source @@ -74,7 +74,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Binary.Inspect.Function.html b/docs/stable/Binary.Inspect.Function.html index 7d43b80aa..414e8a52c 100644 --- a/docs/stable/Binary.Inspect.Function.html +++ b/docs/stable/Binary.Inspect.Function.html @@ -34,7 +34,7 @@

      - Source + Source @@ -65,7 +65,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Binary.Inspect.HashDict.html b/docs/stable/Binary.Inspect.HashDict.html index e8684c6c7..587e35da1 100644 --- a/docs/stable/Binary.Inspect.HashDict.html +++ b/docs/stable/Binary.Inspect.HashDict.html @@ -29,7 +29,7 @@

      - Source + Source @@ -60,7 +60,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Binary.Inspect.List.html b/docs/stable/Binary.Inspect.List.html index b03cf1d45..c4093c929 100644 --- a/docs/stable/Binary.Inspect.List.html +++ b/docs/stable/Binary.Inspect.List.html @@ -52,7 +52,7 @@

      Examples

      - Source + Source @@ -83,7 +83,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Binary.Inspect.Number.html b/docs/stable/Binary.Inspect.Number.html index e6ef9fd20..8f683bb23 100644 --- a/docs/stable/Binary.Inspect.Number.html +++ b/docs/stable/Binary.Inspect.Number.html @@ -40,7 +40,7 @@

      Examples

      - Source + Source @@ -71,7 +71,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Binary.Inspect.PID.html b/docs/stable/Binary.Inspect.PID.html index 43164d898..ddbab6ab8 100644 --- a/docs/stable/Binary.Inspect.PID.html +++ b/docs/stable/Binary.Inspect.PID.html @@ -34,7 +34,7 @@

      - Source + Source @@ -65,7 +65,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Binary.Inspect.Port.html b/docs/stable/Binary.Inspect.Port.html index f0e38da08..4df9fa842 100644 --- a/docs/stable/Binary.Inspect.Port.html +++ b/docs/stable/Binary.Inspect.Port.html @@ -34,7 +34,7 @@

      - Source + Source @@ -65,7 +65,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Binary.Inspect.Range.html b/docs/stable/Binary.Inspect.Range.html index 4b0e56c9e..947f409f0 100644 --- a/docs/stable/Binary.Inspect.Range.html +++ b/docs/stable/Binary.Inspect.Range.html @@ -29,7 +29,7 @@

      - Source + Source @@ -60,7 +60,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Binary.Inspect.Reference.html b/docs/stable/Binary.Inspect.Reference.html index 182272e50..0e95faa90 100644 --- a/docs/stable/Binary.Inspect.Reference.html +++ b/docs/stable/Binary.Inspect.Reference.html @@ -34,7 +34,7 @@

      - Source + Source @@ -65,7 +65,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Binary.Inspect.Regex.html b/docs/stable/Binary.Inspect.Regex.html index 17afa4e46..8fe066302 100644 --- a/docs/stable/Binary.Inspect.Regex.html +++ b/docs/stable/Binary.Inspect.Regex.html @@ -40,7 +40,7 @@

      Examples

      - Source + Source @@ -71,7 +71,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Binary.Inspect.Tuple.html b/docs/stable/Binary.Inspect.Tuple.html index 8889c1747..8aa2becf8 100644 --- a/docs/stable/Binary.Inspect.Tuple.html +++ b/docs/stable/Binary.Inspect.Tuple.html @@ -43,7 +43,7 @@

      Examples

      - Source + Source @@ -74,7 +74,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Binary.Inspect.html b/docs/stable/Binary.Inspect.html index d9b701791..83719ceee 100644 --- a/docs/stable/Binary.Inspect.html +++ b/docs/stable/Binary.Inspect.html @@ -40,7 +40,7 @@

      - Source + Source

      Implementations

      @@ -148,7 +148,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Bitwise.html b/docs/stable/Bitwise.html index 17e6ffdcf..de8d1fea4 100644 --- a/docs/stable/Bitwise.html +++ b/docs/stable/Bitwise.html @@ -52,7 +52,7 @@

      - Source + Source @@ -146,7 +146,7 @@

      Macros

      Bitwise and as operator.

      - Source + Source

      @@ -155,7 +155,7 @@

      Macros

      Arithmetic bitshift left as operator.

      - Source + Source

      @@ -164,7 +164,7 @@

      Macros

      Arithmetic bitshift right as operator.

      - Source + Source

      @@ -173,7 +173,7 @@

      Macros

      Bitwise xor as operator.

      - Source + Source

      @@ -188,7 +188,7 @@

      Macros

      - Source + Source

      @@ -197,7 +197,7 @@

      Macros

      Bitwise and.

      - Source + Source

      @@ -206,7 +206,7 @@

      Macros

      Bitwise not.

      - Source + Source

      @@ -215,7 +215,7 @@

      Macros

      Bitwise or.

      - Source + Source

      @@ -224,7 +224,7 @@

      Macros

      Arithmetic bitshift left.

      - Source + Source

      @@ -233,7 +233,7 @@

      Macros

      Arithmetic bitshift right.

      - Source + Source

      @@ -242,7 +242,7 @@

      Macros

      Bitwise xor.

      - Source + Source

      @@ -251,7 +251,7 @@

      Macros

      Bitwise or as operator.

      - Source + Source

      @@ -260,7 +260,7 @@

      Macros

      Bitwise not as operator.

      - Source + Source
      diff --git a/docs/stable/CaseClauseError.html b/docs/stable/CaseClauseError.html index 22814350e..0240f6748 100644 --- a/docs/stable/CaseClauseError.html +++ b/docs/stable/CaseClauseError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -71,7 +71,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Code.LoadError.html b/docs/stable/Code.LoadError.html index 32c74822a..347c4e3f7 100644 --- a/docs/stable/Code.LoadError.html +++ b/docs/stable/Code.LoadError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -71,7 +71,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Code.html b/docs/stable/Code.html index fedbf456b..042f12996 100644 --- a/docs/stable/Code.html +++ b/docs/stable/Code.html @@ -36,7 +36,7 @@

      - Source + Source @@ -159,7 +159,7 @@

      Functions

      The path is expanded with Path.expand before added.

      - Source + Source

      @@ -170,7 +170,7 @@

      Functions

      binary.

      - Source + Source

      @@ -183,7 +183,7 @@

      Functions

      For compiling many files at once, check Kernel.ParallelCompiler.

      - Source + Source

      @@ -193,7 +193,7 @@

      Functions

      Check compiler_options/1 for more information.

      - Source + Source

      @@ -215,7 +215,7 @@

      Functions

      - Source + Source

      @@ -225,7 +225,7 @@

      Functions

      The path is expanded with Path.expand before deleted.

      - Source + Source

      @@ -244,7 +244,7 @@

      Functions

      and when to use ensure_loaded/1 or ensure_compiled/1.

      - Source + Source

      @@ -254,7 +254,7 @@

      Functions

      it could be ensured or not.

      - Source + Source

      @@ -298,7 +298,7 @@

      Code.ensure_compiled

      that needs to invoke a module for callback information.

      - Source + Source

      @@ -308,13 +308,13 @@

      Code.ensure_compiled

      it could be ensured or not.

      - Source + Source

      eval_quoted(quoted, binding // [], opts // [])

      -

      Evalutes the quoted contents.

      +

      Evaluates the quoted contents.

      This function accepts a list of environment options. Check Code.eval_string for more information.

      @@ -335,13 +335,13 @@

      Examples

      - Source + Source

      eval_string(string, binding // [], opts // [])

      -

      Evalutes the contents given by string. The second argument is the +

      Evaluates the contents given by string. The second argument is the binding (which should be a keyword) followed by a keyword list of environment options. Those options can be:

      @@ -384,7 +384,7 @@

      Examples

      - Source + Source

      @@ -402,7 +402,7 @@

      Examples

      require_file if you don't want a file to be loaded concurrently.

      - Source + Source

      @@ -411,7 +411,7 @@

      Examples

      Returns all the loaded files.

      - Source + Source

      @@ -421,7 +421,7 @@

      Examples

      The path is expanded with Path.expand before added.

      - Source + Source

      @@ -440,7 +440,7 @@

      Examples

      Check load_file if you want a file to be loaded concurrently.

      - Source + Source

      @@ -466,7 +466,7 @@

      Macro.to_binary/1

      representation.

      - Source + Source

      @@ -480,7 +480,7 @@

      Macro.to_binary/1

      Check Code.string_to_ast/2 for options information.

      - Source + Source

      @@ -492,7 +492,7 @@

      Macro.to_binary/1

      allowing it to be required again.

      - Source + Source diff --git a/docs/stable/CompileError.html b/docs/stable/CompileError.html index 60f4bca8d..e6d9e5046 100644 --- a/docs/stable/CompileError.html +++ b/docs/stable/CompileError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -83,7 +83,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Dict.html b/docs/stable/Dict.html index b5c59aa0f..6916718f2 100644 --- a/docs/stable/Dict.html +++ b/docs/stable/Dict.html @@ -60,7 +60,7 @@

      Protocols

      :world -

      And also the Enum.Iterator protocol, allowing one to write:

      +

      And also the Enumerable protocol, allowing one to write:

      Enum.each(dict, fn ({ k, v }) ->
         IO.puts "#{k}: #{v}"
      @@ -70,7 +70,7 @@ 

      Protocols

      - Source + Source @@ -330,7 +330,7 @@

      Examples

      - Source + Source

      @@ -353,7 +353,7 @@

      Examples

      - Source + Source

      @@ -362,7 +362,7 @@

      Examples

      Returns an empty dict of the same type as dict.

      - Source + Source

      @@ -385,7 +385,7 @@

      Examples

      - Source + Source

      @@ -406,7 +406,7 @@

      Examples

      - Source + Source

      @@ -426,7 +426,7 @@

      Examples

      - Source + Source

      @@ -451,7 +451,7 @@

      Examples

      - Source + Source

      @@ -471,7 +471,7 @@

      Examples

      - Source + Source

      @@ -489,7 +489,7 @@

      Examples

      - Source + Source

      @@ -508,7 +508,7 @@

      Examples

      - Source + Source

      @@ -530,7 +530,7 @@

      Examples

      - Source + Source

      @@ -558,7 +558,7 @@

      Examples

      - Source + Source

      @@ -576,7 +576,7 @@

      Examples

      - Source + Source

      @@ -593,7 +593,7 @@

      Examples

      - Source + Source

      @@ -609,7 +609,7 @@

      Examples

      - Source + Source

      @@ -640,7 +640,7 @@

      Examples

      - Source + Source

      @@ -663,7 +663,7 @@

      Examples

      - Source + Source

      @@ -673,7 +673,7 @@

      Examples

      No particular order is enforced.

      - Source + Source

      @@ -691,7 +691,7 @@

      Examples

      - Source + Source

      @@ -710,7 +710,7 @@

      Examples

      - Source + Source

      @@ -726,7 +726,7 @@

      Examples

      - Source + Source @@ -743,7 +743,7 @@

      Callbacks

      - Source + Source

      @@ -751,7 +751,7 @@

      Callbacks

      - Source + Source

      @@ -759,7 +759,7 @@

      Callbacks

      - Source + Source

      @@ -767,7 +767,7 @@

      Callbacks

      - Source + Source

      @@ -775,7 +775,7 @@

      Callbacks

      - Source + Source

      @@ -783,7 +783,7 @@

      Callbacks

      - Source + Source

      @@ -791,7 +791,7 @@

      Callbacks

      - Source + Source

      @@ -799,7 +799,7 @@

      Callbacks

      - Source + Source

      @@ -807,7 +807,7 @@

      Callbacks

      - Source + Source

      @@ -815,7 +815,7 @@

      Callbacks

      - Source + Source

      @@ -823,7 +823,7 @@

      Callbacks

      - Source + Source

      @@ -831,7 +831,7 @@

      Callbacks

      - Source + Source

      @@ -839,7 +839,7 @@

      Callbacks

      - Source + Source

      @@ -847,7 +847,7 @@

      Callbacks

      - Source + Source

      @@ -855,7 +855,7 @@

      Callbacks

      - Source + Source

      @@ -863,7 +863,7 @@

      Callbacks

      - Source + Source

      @@ -871,7 +871,7 @@

      Callbacks

      - Source + Source

      @@ -879,7 +879,7 @@

      Callbacks

      - Source + Source

      @@ -887,7 +887,7 @@

      Callbacks

      - Source + Source

      @@ -895,7 +895,7 @@

      Callbacks

      - Source + Source

      @@ -903,7 +903,7 @@

      Callbacks

      - Source + Source

      @@ -911,7 +911,7 @@

      Callbacks

      - Source + Source
      diff --git a/docs/stable/EEx.AssignsEngine.html b/docs/stable/EEx.AssignsEngine.html index a204623a9..b3630b807 100644 --- a/docs/stable/EEx.AssignsEngine.html +++ b/docs/stable/EEx.AssignsEngine.html @@ -53,7 +53,7 @@

      Examples

      - Source + Source diff --git a/docs/stable/EEx.Engine.html b/docs/stable/EEx.Engine.html index 8c2f180c2..6d3b208bc 100644 --- a/docs/stable/EEx.Engine.html +++ b/docs/stable/EEx.Engine.html @@ -52,7 +52,7 @@

      - Source + Source @@ -93,7 +93,7 @@

      Functions

      - Source + Source

      @@ -108,7 +108,7 @@

      Functions

      All other markers are not implemented by this engine.

      - Source + Source

      @@ -117,7 +117,7 @@

      Functions

      The default implementation simply concatenates text to the buffer.

      - Source + Source
      diff --git a/docs/stable/EEx.SmartEngine.html b/docs/stable/EEx.SmartEngine.html index 1a87e1514..77b42521e 100644 --- a/docs/stable/EEx.SmartEngine.html +++ b/docs/stable/EEx.SmartEngine.html @@ -34,7 +34,7 @@

      - Source + Source @@ -70,7 +70,7 @@

      Functions

      - Source + Source

      @@ -78,7 +78,7 @@

      Functions

      - Source + Source
      diff --git a/docs/stable/EEx.SyntaxError.html b/docs/stable/EEx.SyntaxError.html index b51329ebb..4ae0ac5de 100644 --- a/docs/stable/EEx.SyntaxError.html +++ b/docs/stable/EEx.SyntaxError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/stable/EEx.TransformerEngine.html b/docs/stable/EEx.TransformerEngine.html index 0cac9fa92..4a3772c4b 100644 --- a/docs/stable/EEx.TransformerEngine.html +++ b/docs/stable/EEx.TransformerEngine.html @@ -39,7 +39,7 @@

      - Source + Source diff --git a/docs/stable/EEx.html b/docs/stable/EEx.html index 1ff63367f..84d061682 100644 --- a/docs/stable/EEx.html +++ b/docs/stable/EEx.html @@ -109,7 +109,7 @@

      Macros

      - Source + Source @@ -172,7 +172,7 @@

      Functions

      that can be evaluated by Elixir or compiled to a function.

      - Source + Source

      @@ -182,7 +182,7 @@

      Functions

      that can be evaluated by Elixir or compiled to a function.

      - Source + Source

      @@ -201,7 +201,7 @@

      Examples

      - Source + Source

      @@ -216,7 +216,7 @@

      Examples

      - Source + Source @@ -252,7 +252,7 @@

      Examples

      - Source + Source

      @@ -273,7 +273,7 @@

      Examples

      - Source + Source diff --git a/docs/stable/Enum.EmptyError.html b/docs/stable/Enum.EmptyError.html index 44942b6ea..b6d3d272e 100644 --- a/docs/stable/Enum.EmptyError.html +++ b/docs/stable/Enum.EmptyError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/stable/Enum.OutOfBoundsError.html b/docs/stable/Enum.OutOfBoundsError.html index 56a5dfa9b..c5363a923 100644 --- a/docs/stable/Enum.OutOfBoundsError.html +++ b/docs/stable/Enum.OutOfBoundsError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/stable/Enum.html b/docs/stable/Enum.html index ccce93eff..448d5992d 100644 --- a/docs/stable/Enum.html +++ b/docs/stable/Enum.html @@ -28,7 +28,7 @@

      Provides a set of algorithms that enumerate over collections according to the -Enum.Iterator protocol. Most of the functions in this module have two +Enumerable protocol. Most of the functions in this module have two flavours. If a given collection implements the mentioned protocol (like list, for instance), you can do:

      @@ -42,7 +42,7 @@

      - Source + Source @@ -279,7 +279,7 @@

      Examples

      - Source + Source

      @@ -307,7 +307,7 @@

      Examples

      - Source + Source

      @@ -332,7 +332,7 @@

      Examples

      - Source + Source

      @@ -347,7 +347,7 @@

      Examples

      - Source + Source

      @@ -356,7 +356,7 @@

      Examples

      Counts for how many items the function returns true.

      - Source + Source

      @@ -376,7 +376,7 @@

      Examples

      - Source + Source

      @@ -392,7 +392,7 @@

      Examples

      - Source + Source

      @@ -408,7 +408,7 @@

      Examples

      - Source + Source

      @@ -425,7 +425,7 @@

      Examples

      - Source + Source

      @@ -447,7 +447,7 @@

      Examples

      - Source + Source

      @@ -468,7 +468,7 @@

      Examples

      - Source + Source

      @@ -484,7 +484,7 @@

      Examples

      - Source + Source

      @@ -499,7 +499,7 @@

      Examples

      - Source + Source

      @@ -521,7 +521,7 @@

      Examples

      - Source + Source

      @@ -542,7 +542,7 @@

      Examples

      - Source + Source

      @@ -561,7 +561,7 @@

      Examples

      - Source + Source

      @@ -578,7 +578,7 @@

      Examples

      - Source + Source

      @@ -604,7 +604,7 @@

      Examples

      - Source + Source

      @@ -627,7 +627,7 @@

      Examples

      - Source + Source

      @@ -653,11 +653,11 @@

      Examples

      - Source + Source

      - map_reduce(collection, acc, f) + map_reduce(collection, acc, fun)

      Invokes the given fun for each item in the collection while also keeping an accumulator. Returns a tuple where @@ -674,7 +674,7 @@

      Examples

      - Source + Source

      @@ -690,7 +690,7 @@

      Examples

      - Source + Source

      @@ -706,7 +706,7 @@

      Examples

      - Source + Source

      @@ -723,7 +723,7 @@

      Examples

      - Source + Source

      @@ -739,7 +739,7 @@

      Examples

      - Source + Source

      @@ -755,7 +755,7 @@

      Examples

      - Source + Source

      @@ -772,7 +772,7 @@

      Examples

      - Source + Source

      @@ -789,7 +789,7 @@

      Examples

      - Source + Source

      @@ -804,7 +804,7 @@

      Examples

      - Source + Source

      @@ -819,7 +819,7 @@

      Examples

      - Source + Source

      @@ -834,7 +834,7 @@

      Examples

      - Source + Source

      @@ -864,7 +864,7 @@

      Examples

      - Source + Source

      @@ -879,7 +879,7 @@

      Examples

      - Source + Source

      @@ -899,7 +899,7 @@

      Examples

      - Source + Source

      @@ -915,7 +915,7 @@

      Examples

      - Source + Source

      @@ -930,7 +930,7 @@

      Examples

      - Source + Source

      @@ -948,7 +948,7 @@

      Examples

      - Source + Source

      @@ -960,7 +960,7 @@

      Examples

      values are filled with nil.

      - Source + Source diff --git a/docs/stable/Enum.Iterator.Function.html b/docs/stable/Enumerable.Function.html similarity index 70% rename from docs/stable/Enum.Iterator.Function.html rename to docs/stable/Enumerable.Function.html index 5fba98066..6c6cf1f33 100644 --- a/docs/stable/Enum.Iterator.Function.html +++ b/docs/stable/Enumerable.Function.html @@ -1,7 +1,7 @@ - Enum.Iterator.Function + Enumerable.Function @@ -21,7 +21,7 @@

      - Enum.Iterator.Function + Enumerable.Function impl @@ -29,7 +29,7 @@

      - Source + Source @@ -45,12 +45,12 @@

      Functions summary

    3161. - iterator/1 + member?/2
    3162. - member?/2 + reduce/3
    3163. @@ -70,23 +70,23 @@

      Functions

      - Source + Source
      -

      - iterator(function) +

      + member?(function, value)

      - Source + Source
      -

      - member?(function, value) +

      + reduce(function, acc, fun)

      - Source + Source
      diff --git a/docs/master/Enum.Iterator.HashDict.html b/docs/stable/Enumerable.HashDict.html similarity index 70% rename from docs/master/Enum.Iterator.HashDict.html rename to docs/stable/Enumerable.HashDict.html index af8b090f6..8c932ddec 100644 --- a/docs/master/Enum.Iterator.HashDict.html +++ b/docs/stable/Enumerable.HashDict.html @@ -1,7 +1,7 @@ - Enum.Iterator.HashDict + Enumerable.HashDict @@ -21,7 +21,7 @@

      - Enum.Iterator.HashDict + Enumerable.HashDict impl @@ -29,7 +29,7 @@

      - Source + Source @@ -45,12 +45,12 @@

      Functions summary

    3164. - iterator/1 + member?/2
    3165. - member?/2 + reduce/3
    3166. @@ -70,23 +70,23 @@

      Functions

      - Source + Source
      -

      - iterator(dict) +

      + member?(dict, arg2)

      - Source + Source
      -

      - member?(dict, arg2) +

      + reduce(dict, acc, fun)

      - Source + Source
      diff --git a/docs/stable/Enum.Iterator.List.html b/docs/stable/Enumerable.List.html similarity index 70% rename from docs/stable/Enum.Iterator.List.html rename to docs/stable/Enumerable.List.html index 3203c9205..7a8f0e528 100644 --- a/docs/stable/Enum.Iterator.List.html +++ b/docs/stable/Enumerable.List.html @@ -1,7 +1,7 @@ - Enum.Iterator.List + Enumerable.List @@ -21,7 +21,7 @@

      - Enum.Iterator.List + Enumerable.List impl @@ -29,7 +29,7 @@

      - Source + Source @@ -45,12 +45,12 @@

      Functions summary

    3167. - iterator/1 + member?/2
    3168. - member?/2 + reduce/3
    3169. @@ -70,23 +70,23 @@

      Functions

      - Source + Source
      -

      - iterator(list) +

      + member?(list, value)

      - Source + Source
      -

      - member?(list, value) +

      + reduce(list1, acc, fun)

      - Source + Source
      diff --git a/docs/master/Enum.Iterator.Range.html b/docs/stable/Enumerable.Range.html similarity index 73% rename from docs/master/Enum.Iterator.Range.html rename to docs/stable/Enumerable.Range.html index 1269e34da..fecce0db8 100644 --- a/docs/master/Enum.Iterator.Range.html +++ b/docs/stable/Enumerable.Range.html @@ -1,7 +1,7 @@ - Enum.Iterator.Range + Enumerable.Range @@ -21,7 +21,7 @@

      - Enum.Iterator.Range + Enumerable.Range impl @@ -29,7 +29,7 @@

      - Source + Source @@ -45,12 +45,12 @@

      Functions summary

    3170. - iterator/1 + member?/2
    3171. - member?/2 + reduce/3
    3172. @@ -70,23 +70,23 @@

      Functions

      - Source + Source
      -

      - iterator(range) +

      + member?(arg1, value)

      - Source + Source
      -

      - member?(arg1, value) +

      + reduce(range, acc, fun)

      - Source + Source
      diff --git a/docs/stable/Enum.Iterator.html b/docs/stable/Enumerable.html similarity index 54% rename from docs/stable/Enum.Iterator.html rename to docs/stable/Enumerable.html index 77af0d9ab..5ebf9a540 100644 --- a/docs/stable/Enum.Iterator.html +++ b/docs/stable/Enumerable.html @@ -1,7 +1,7 @@ - Enum.Iterator + Enumerable @@ -21,7 +21,7 @@

      - Enum.Iterator + Enumerable protocol @@ -33,20 +33,21 @@

      Usually, when you invoke a function in the module Enum, the first argument passed to it is a collection which is forwarded to this protocol in order to -retrieve information on how to iterate the collection.

      +perform operations on the collection.

      For example, in the expression

      Enum.map([1,2,3], &1 * 2)
       
      -

      Enum.map invokes Enum.Iterator.iterator([1,2,3]) to retrieve the iterator -function that will drive the iteration process.

      +

      Enum.map invokes Enumerable.reduce to perform the reducing operation +that builds a mapped list by calling the mapping function &1 * 2 on every +element in the collection and cons'ing the element with the accumulated list.

      - Source + Source

      Implementations

      @@ -54,25 +55,25 @@

      Implementations

    3173. - Function + Function
    3174. - HashDict + HashDict
    3175. - List + List
    3176. - Range + Range
    3177. @@ -91,12 +92,12 @@

      Functions summary

    3178. - iterator/1 + member?/2
    3179. - member?/2 + reduce/3
    3180. @@ -117,53 +118,43 @@

      Functions

      The function used to retrieve the collection's size.

      - Source + Source
      -

      - iterator(collection) +

      + member?(collection, value)

      -

      This function must return a tuple of the form { iter, step } where -iter is a function that yields successive values from the collection -each time it is invoked and step is the first step of iteration.

      - -

      Iteration in Elixir happens with the help of an iterator function (named -iter in the paragraph above). When it is invoked, it must return a tuple -with two elements. The first element is the next successive value from the -collection and the second element can be any Elixir term which iter is -going to receive as its argument the next time it is invoked.

      - -

      When there are no more items left to yield, iter must return the atom -:stop.

      - -

      As an example, here is the implementation of iterator for lists:

      - -
      def iterator(list),   do: { iterate(&1), iterate(list) }
      -defp iterate([h|t]),  do: { h, t }
      -defp iterate([]),     do: :stop
      -
      - -

      Here, iterate is the iterator function and { h, t } is a step of -iteration.

      - -

      Iterating lists

      - -

      As a special case, if a data structure needs to be converted to a list in -order to be iterated, iterator can simply return the list and the Enum -module will be able to take over the list and produce a proper iterator -function for it.

      +

      The function used to check if a value exists within the collection.

      - Source + Source
      -

      - member?(collection, value) +

      + reduce(collection, acc, fun)

      -

      The function used to check if a value exists within the collection.

      +

      This function performs the reducing operation on a given collection. It +returns the accumulated value of applying the given function fun on every +element with the accumulated value.

      + +

      As an example, here is the implementation of reduce for lists:

      + +
      def reduce([h|t], acc, fun), do: reduce(t, fun.(h, acc), fun)
      +def reduce([], acc, _fun),   do: acc
      +
      + +

      As an additional example, here is the implementation of Enum.map with +Enumerable:

      + +
      def map(collection, fun) do
      +  Enumerable.reduce(collection, [], fn(entry, acc) ->
      +    [fun.(entry)|acc]
      +  end) |> :lists.reverse
      +end
      +
      - Source + Source
      diff --git a/docs/stable/ErlangError.html b/docs/stable/ErlangError.html index db73413ca..15ca778d1 100644 --- a/docs/stable/ErlangError.html +++ b/docs/stable/ErlangError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -71,7 +71,7 @@

      Functions

      - Source + Source
      diff --git a/docs/stable/ExUnit.AssertionError.html b/docs/stable/ExUnit.AssertionError.html index 4a496fbf6..99d310d44 100644 --- a/docs/stable/ExUnit.AssertionError.html +++ b/docs/stable/ExUnit.AssertionError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/stable/ExUnit.Assertions.html b/docs/stable/ExUnit.Assertions.html index 25700b23d..ae96a570a 100644 --- a/docs/stable/ExUnit.Assertions.html +++ b/docs/stable/ExUnit.Assertions.html @@ -46,7 +46,7 @@

      - Source + Source @@ -169,7 +169,7 @@

      Examples

      - Source + Source

      @@ -185,7 +185,7 @@

      Examples

      - Source + Source

      @@ -200,7 +200,7 @@

      Examples

      - Source + Source

      @@ -217,7 +217,7 @@

      Examples

      - Source + Source

      @@ -234,7 +234,7 @@

      Examples

      - Source + Source

      @@ -248,7 +248,7 @@

      Examples

      - Source + Source

      @@ -263,7 +263,7 @@

      Examples

      - Source + Source

      @@ -278,7 +278,7 @@

      Examples

      - Source + Source @@ -306,7 +306,7 @@

      Examples

      - Source + Source

      @@ -333,7 +333,7 @@

      Examples

      - Source + Source

      @@ -357,7 +357,7 @@

      Examples

      - Source + Source

      @@ -372,7 +372,7 @@

      Examples

      - Source + Source

      @@ -387,7 +387,7 @@

      Examples

      - Source + Source

      @@ -402,7 +402,7 @@

      Examples

      - Source + Source

      @@ -419,7 +419,7 @@

      Examples

      - Source + Source

      @@ -441,7 +441,7 @@

      Examples

      - Source + Source

      @@ -459,7 +459,7 @@

      Examples

      - Source + Source diff --git a/docs/stable/ExUnit.CLIFormatter.html b/docs/stable/ExUnit.CLIFormatter.html index 8c8705987..71fbd10c8 100644 --- a/docs/stable/ExUnit.CLIFormatter.html +++ b/docs/stable/ExUnit.CLIFormatter.html @@ -33,7 +33,7 @@

      - Source + Source @@ -119,7 +119,7 @@

      Functions

      - Source + Source

      @@ -127,7 +127,7 @@

      Functions

      - Source + Source

      @@ -135,7 +135,7 @@

      Functions

      - Source + Source

      @@ -143,7 +143,7 @@

      Functions

      - Source + Source

      @@ -151,7 +151,7 @@

      Functions

      - Source + Source

      @@ -159,7 +159,7 @@

      Functions

      - Source + Source

      @@ -167,7 +167,7 @@

      Functions

      - Source + Source

      @@ -175,7 +175,7 @@

      Functions

      - Source + Source

      @@ -183,7 +183,7 @@

      Functions

      - Source + Source

      @@ -191,7 +191,7 @@

      Functions

      - Source + Source

      @@ -199,7 +199,7 @@

      Functions

      - Source + Source

      @@ -207,7 +207,7 @@

      Functions

      - Source + Source
      diff --git a/docs/stable/ExUnit.Callbacks.html b/docs/stable/ExUnit.Callbacks.html index 2005171f1..f74f98880 100644 --- a/docs/stable/ExUnit.Callbacks.html +++ b/docs/stable/ExUnit.Callbacks.html @@ -65,7 +65,7 @@

      Examples

      - Source + Source @@ -116,7 +116,7 @@

      Macros

      Called before the start of each test.

      - Source + Source

      @@ -127,7 +127,7 @@

      Macros

      Called before the start of a case.

      - Source + Source

      @@ -139,7 +139,7 @@

      Macros

      message teardown will not be run.

      - Source + Source

      @@ -150,7 +150,7 @@

      Macros

      Called after the finish of each case.

      - Source + Source
      diff --git a/docs/stable/ExUnit.CaptureIO.html b/docs/stable/ExUnit.CaptureIO.html index 81940c26e..8ac28c024 100644 --- a/docs/stable/ExUnit.CaptureIO.html +++ b/docs/stable/ExUnit.CaptureIO.html @@ -48,7 +48,7 @@

      Examples

      - Source + Source @@ -58,10 +58,20 @@

      Examples

      Functions summary

      @@ -74,8 +84,24 @@

      Functions summary

      Functions

      +

      + capture_io(fun) +

      +
      + + Source + +

      - capture_io(device // :stdio, fun) + capture_io(device, fun) +

      +
      + + Source + +
      +

      + capture_io(device, input, fun)

      Captures IO. Returns nil in case of no output, otherwise returns the binary which is captured outputs.

      @@ -85,7 +111,8 @@

      Functions

      named device like :stderr is also possible globally by giving the registered device name explicitly as argument.

      -

      The input is mocked to return :eof.

      +

      A developer can set a string as an input. The default +input is :eof.

      Examples

      @@ -95,10 +122,15 @@

      Examples

      true iex> capture_io(:stderr, fn -> IO.write(:stderr, "josé") end) == "josé" true +iex> capture_io("this is input", fn-> +...> input = IO.gets "" +...> IO.write input +...> end) == "this is input" +true
      - Source + Source
      diff --git a/docs/stable/ExUnit.Case.html b/docs/stable/ExUnit.Case.html index 741e6c8d9..bcb475774 100644 --- a/docs/stable/ExUnit.Case.html +++ b/docs/stable/ExUnit.Case.html @@ -56,7 +56,7 @@

      Examples

      - Source + Source @@ -104,7 +104,7 @@

      Examples

      - Source + Source diff --git a/docs/stable/ExUnit.CaseTemplate.html b/docs/stable/ExUnit.CaseTemplate.html index 859468a3e..58c2fab64 100644 --- a/docs/stable/ExUnit.CaseTemplate.html +++ b/docs/stable/ExUnit.CaseTemplate.html @@ -57,7 +57,7 @@

      Example

      - Source + Source @@ -94,7 +94,7 @@

      Macros

      this module is used.

      - Source + Source diff --git a/docs/stable/ExUnit.DocTest.html b/docs/stable/ExUnit.DocTest.html index 42e0372f8..d00b35ba3 100644 --- a/docs/stable/ExUnit.DocTest.html +++ b/docs/stable/ExUnit.DocTest.html @@ -119,7 +119,7 @@

      When not to use doctest

      - Source + Source @@ -181,7 +181,7 @@

      Examples

      This macro is auto-imported into every ExUnit.Case.

      - Source + Source diff --git a/docs/stable/ExUnit.ExpectationError.html b/docs/stable/ExUnit.ExpectationError.html index 19c5d3c05..212afddb8 100644 --- a/docs/stable/ExUnit.ExpectationError.html +++ b/docs/stable/ExUnit.ExpectationError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -106,7 +106,7 @@

      Functions

      - Source + Source

      @@ -114,7 +114,7 @@

      Functions

      - Source + Source
      diff --git a/docs/stable/ExUnit.Formatter.html b/docs/stable/ExUnit.Formatter.html index 074c8119d..2a94f6ddc 100644 --- a/docs/stable/ExUnit.Formatter.html +++ b/docs/stable/ExUnit.Formatter.html @@ -35,7 +35,7 @@

      - Source + Source @@ -95,7 +95,7 @@

      Callbacks

      - Source + Source

      @@ -103,7 +103,7 @@

      Callbacks

      - Source + Source

      @@ -111,7 +111,7 @@

      Callbacks

      - Source + Source

      @@ -119,7 +119,7 @@

      Callbacks

      - Source + Source

      @@ -127,7 +127,7 @@

      Callbacks

      - Source + Source

      @@ -135,7 +135,7 @@

      Callbacks

      - Source + Source
      diff --git a/docs/stable/ExUnit.Test.html b/docs/stable/ExUnit.Test.html index 513e7cf0f..b9dd5b705 100644 --- a/docs/stable/ExUnit.Test.html +++ b/docs/stable/ExUnit.Test.html @@ -36,7 +36,7 @@

      - Source + Source diff --git a/docs/stable/ExUnit.TestCase.html b/docs/stable/ExUnit.TestCase.html index eb6c9923f..92bdf257c 100644 --- a/docs/stable/ExUnit.TestCase.html +++ b/docs/stable/ExUnit.TestCase.html @@ -36,7 +36,7 @@

      - Source + Source diff --git a/docs/stable/ExUnit.html b/docs/stable/ExUnit.html index 0a6116ea7..d4a25e99f 100644 --- a/docs/stable/ExUnit.html +++ b/docs/stable/ExUnit.html @@ -75,7 +75,7 @@

      Case, callbacks and assertions

      - Source + Source @@ -133,7 +133,7 @@

      Options

      - Source + Source

      @@ -145,7 +145,7 @@

      Options

      Returns the number of failures.

      - Source + Source

      @@ -159,7 +159,7 @@

      Options

      function and rely on configure/1 and run/0 instead.

      - Source + Source

      @@ -167,7 +167,7 @@

      Options

      - Source + Source
      diff --git a/docs/stable/Exception.html b/docs/stable/Exception.html index d5190bb8e..25fbefa5a 100644 --- a/docs/stable/Exception.html +++ b/docs/stable/Exception.html @@ -33,7 +33,7 @@

      - Source + Source @@ -84,7 +84,7 @@

      Functions

      - Source + Source

      @@ -97,7 +97,7 @@

      Functions

      the value of System.stacktrace is changed.

      - Source + Source

      @@ -108,7 +108,7 @@

      Functions

      is used to prettify the stacktrace.

      - Source + Source

      @@ -119,7 +119,7 @@

      Functions

      code with Elixir code.

      - Source + Source

      Functions

      the value of System.stacktrace is changed.

      - Source + Source diff --git a/docs/stable/File.CopyError.html b/docs/stable/File.CopyError.html index 3de5ec201..1b7d907e9 100644 --- a/docs/stable/File.CopyError.html +++ b/docs/stable/File.CopyError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -89,7 +89,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/File.Error.html b/docs/stable/File.Error.html index cc974f40c..43374cdeb 100644 --- a/docs/stable/File.Error.html +++ b/docs/stable/File.Error.html @@ -29,7 +29,7 @@

      - Source + Source @@ -83,7 +83,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/File.IteratorError.html b/docs/stable/File.IteratorError.html index 677061581..8aeee3b2e 100644 --- a/docs/stable/File.IteratorError.html +++ b/docs/stable/File.IteratorError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -71,7 +71,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/File.Stat.html b/docs/stable/File.Stat.html index e231e5de2..0cb4b7f62 100644 --- a/docs/stable/File.Stat.html +++ b/docs/stable/File.Stat.html @@ -63,7 +63,7 @@

      - Source + Source diff --git a/docs/stable/File.html b/docs/stable/File.html index b2d4e93dc..40ba42c75 100644 --- a/docs/stable/File.html +++ b/docs/stable/File.html @@ -77,7 +77,7 @@

      - Source + Source @@ -91,11 +91,6 @@

      Functions summary

      biniterator/1 -
    3181. - - biniterator/2 - -
    3182. biniterator!/2 @@ -176,11 +171,6 @@

      Functions summary

      iterator/1
    3183. -
    3184. - - iterator/2 - -
    3185. iterator!/2 @@ -341,28 +331,19 @@

      Functions

      binary. Check iterator/1 for more information.

      - Source - -
      -

      - biniterator(file, mode) -

      -

      Opens the given file with the given mode and -returns its biniterator. Fails for the same reasons -as File.open.

      -
      - - Source + Source

      biniterator!(file, mode // [])

      -

      Same as biniterator/2 but raises if the file -cannot be opened.

      +

      Opens the given file with the given mode and +returns its biniterator. The returned iterator will +fail for the same reasons as File.open!. Note +that the file is opened when the iteration begins.

      - Source + Source

      @@ -372,7 +353,7 @@

      Functions

      { :error, reason } otherwise.

      - Source + Source

      @@ -381,7 +362,7 @@

      Functions

      The same as cd/0, but raises an exception if it fails.

      - Source + Source

      @@ -395,7 +376,7 @@

      Functions

      directory fails.

      - Source + Source

      @@ -409,7 +390,7 @@

      Functions

      See open/2.

      - Source + Source

      @@ -430,7 +411,7 @@

      Functions

      read/1 and write/2.

      - Source + Source

      @@ -440,7 +421,7 @@

      Functions

      Returns the bytes_copied otherwise.

      - Source + Source

      @@ -465,7 +446,7 @@

      Functions

      { :error, reason } otherwise.

      - Source + Source

      @@ -475,7 +456,7 @@

      Functions

      Returns the list of copied files otherwise.

      - Source + Source

      @@ -527,7 +508,7 @@

      Examples

      - Source + Source

      @@ -537,7 +518,7 @@

      Examples

      Returns the list of copied files otherwise.

      - Source + Source

      @@ -549,7 +530,7 @@

      Examples

      in case of success, { :error, reason } otherwise.

      - Source + Source

      @@ -558,7 +539,7 @@

      Examples

      The same as cwd/0, but raises an exception if it fails.

      - Source + Source

      @@ -567,7 +548,7 @@

      Examples

      Returns true if the path is a directory.

      - Source + Source

      @@ -590,7 +571,7 @@

      Examples

      - Source + Source

      @@ -619,28 +600,19 @@

      Examples

      - Source - -
      -

      - iterator(file, mode) -

      -

      Opens the given file with the given mode and -returns its iterator. Fails for the same reasons -as File.open.

      -
      - - Source + Source

      iterator!(file, mode // [])

      -

      Same as iterator/2 but raises if the file -cannot be opened.

      +

      Opens the given file with the given mode and +returns its iterator. The returned iterator will +fail for the same reasons as File.open!. Note +that the file is opened when the iteration begins.

      - Source + Source

      @@ -652,7 +624,7 @@

      Examples

      { :error, reason } otherwise.

      - Source + Source

      @@ -662,7 +634,7 @@

      Examples

      in case of an error.

      - Source + Source

      @@ -683,7 +655,7 @@

      Examples

      - Source + Source

      @@ -692,7 +664,7 @@

      Examples

      Same as mkdir, but raises an exception in case of failure. Otherwise :ok.

      - Source + Source

      @@ -710,7 +682,7 @@

      Examples

      - Source + Source

      @@ -719,7 +691,7 @@

      Examples

      Same as mkdir_p, but raises an exception in case of failure. Otherwise :ok.

      - Source + Source

      @@ -782,7 +754,7 @@

      Examples

      - Source + Source

      @@ -809,7 +781,7 @@

      Examples

      - Source + Source

      @@ -819,7 +791,7 @@

      Examples

      Returns the io_device otherwise.

      - Source + Source

      @@ -829,7 +801,7 @@

      Examples

      Returns the function result otherwise.

      - Source + Source

      @@ -853,7 +825,7 @@

      Examples

      You can use :file.format_error(reason) to get a descriptive string of the error.

      - Source + Source

      @@ -863,7 +835,7 @@

      Examples

      File.Error if an error occurs.

      - Source + Source

      @@ -877,7 +849,7 @@

      Examples

      - Source + Source

      @@ -907,7 +879,7 @@

      Examples

      - Source + Source

      @@ -916,7 +888,7 @@

      Examples

      Same as rm, but raises an exception in case of failure. Otherwise :ok.

      - Source + Source

      @@ -940,7 +912,7 @@

      Examples

      - Source + Source

      @@ -950,7 +922,7 @@

      Examples

      otherwise the list of files or directories removed.

      - Source + Source

      @@ -969,7 +941,7 @@

      Examples

      - Source + Source

      @@ -978,7 +950,7 @@

      Examples

      Same as rmdir/1, but raises an exception in case of failure. Otherwise :ok.

      - Source + Source

      @@ -999,7 +971,7 @@

      Options

      - Source + Source

      @@ -1009,7 +981,7 @@

      Options

      throws File.Error if an error is returned.

      - Source + Source

      @@ -1019,7 +991,7 @@

      Options

      the given file. File is created if it doesn’t exist.

      - Source + Source

      @@ -1029,7 +1001,7 @@

      Options

      Returns :ok otherwise.

      - Source + Source

      @@ -1051,7 +1023,7 @@

      Options

      - Source + Source

      @@ -1060,7 +1032,7 @@

      Options

      Same as write/3 but raises an exception if it fails, returns :ok otherwise.

      - Source + Source

      @@ -1070,7 +1042,7 @@

      Options

      path. Returns :ok or { :error, reason }.

      - Source + Source

      @@ -1080,7 +1052,7 @@

      Options

      Returns :ok otherwise.

      - Source + Source diff --git a/docs/stable/FunctionClauseError.html b/docs/stable/FunctionClauseError.html index fb9235a50..7fe00281f 100644 --- a/docs/stable/FunctionClauseError.html +++ b/docs/stable/FunctionClauseError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -83,7 +83,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/GenEvent.Behaviour.html b/docs/stable/GenEvent.Behaviour.html index ace9b1c6a..cfb274774 100644 --- a/docs/stable/GenEvent.Behaviour.html +++ b/docs/stable/GenEvent.Behaviour.html @@ -82,7 +82,7 @@

      Example

      - Source + Source diff --git a/docs/stable/GenServer.Behaviour.html b/docs/stable/GenServer.Behaviour.html index 155cdf677..b23389358 100644 --- a/docs/stable/GenServer.Behaviour.html +++ b/docs/stable/GenServer.Behaviour.html @@ -116,7 +116,7 @@

      Example

      - Source + Source diff --git a/docs/stable/HashDict.html b/docs/stable/HashDict.html index 57cb51f4d..1a3dfc936 100644 --- a/docs/stable/HashDict.html +++ b/docs/stable/HashDict.html @@ -37,7 +37,7 @@

      - Source + Source @@ -126,6 +126,11 @@

      Functions summary

      put_new/3
    3186. +
    3187. + + reduce/3 + +
    3188. size/1 @@ -179,7 +184,7 @@

      Functions

      Deletes a value from the dict.

      - Source + Source

      @@ -189,7 +194,7 @@

      Functions

      which key is not in keys

      - Source + Source

      @@ -198,7 +203,7 @@

      Functions

      Returns an empty dict.

      - Source + Source

      @@ -206,7 +211,7 @@

      Functions

      - Source + Source

      @@ -216,7 +221,7 @@

      Functions

      and return it in a tagged tuple.

      - Source + Source

      @@ -224,7 +229,7 @@

      Functions

      - Source + Source

      @@ -233,7 +238,7 @@

      Functions

      Gets the value under key from the dict.

      - Source + Source

      @@ -242,7 +247,7 @@

      Functions

      Checks if the dict has the given key.

      - Source + Source

      @@ -251,7 +256,7 @@

      Functions

      Get all keys in the dict.

      - Source + Source

      @@ -260,7 +265,7 @@

      Functions

      Merges two dictionaries.

      - Source + Source

      @@ -269,7 +274,7 @@

      Functions

      Creates a new empty dict.

      - Source + Source

      @@ -284,7 +289,7 @@

      Examples

      - Source + Source

      @@ -300,7 +305,7 @@

      Examples

      - Source + Source

      @@ -309,7 +314,7 @@

      Examples

      Returns the value under key from the dict as well as the dict without key.

      - Source + Source

      @@ -318,7 +323,7 @@

      Examples

      Puts the given key and value in the dict.

      - Source + Source

      @@ -328,7 +333,15 @@

      Examples

      only if one does not exist yet.

      - Source + Source + +
      +

      + reduce(dict, acc, fun) +

      +
      + + Source

      @@ -337,7 +350,7 @@

      Examples

      Returns the dict size.

      - Source + Source

      @@ -349,7 +362,7 @@

      Examples

      Returns a 2-tuple of the new dicts.

      - Source + Source

      @@ -359,7 +372,7 @@

      Examples

      which key is in keys.

      - Source + Source

      @@ -368,7 +381,7 @@

      Examples

      Converts the dict to a list.

      - Source + Source

      @@ -379,7 +392,7 @@

      Examples

      not exist in the dictionary.

      - Source + Source

      @@ -390,7 +403,7 @@

      Examples

      the key does not exist in the dicionary.

      - Source + Source

      @@ -399,7 +412,7 @@

      Examples

      Get all values in the dict.

      - Source + Source
      diff --git a/docs/stable/IEx.Autocomplete.html b/docs/stable/IEx.Autocomplete.html index fe5735391..cffdc91d8 100644 --- a/docs/stable/IEx.Autocomplete.html +++ b/docs/stable/IEx.Autocomplete.html @@ -32,7 +32,7 @@

      - Source + Source @@ -63,7 +63,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/IEx.Helpers.html b/docs/stable/IEx.Helpers.html index 9e81cb8fd..d407f0532 100644 --- a/docs/stable/IEx.Helpers.html +++ b/docs/stable/IEx.Helpers.html @@ -53,6 +53,7 @@

    3189. t/1 — prints type information
    3190. v/0 - prints all commands and values
    3191. v/1 - retrieves nth value from console
    3192. +
    3193. import_file/1 - evaluate the given file in the shell's context
    3194. Help for functions in this module can be consulted @@ -73,7 +74,7 @@

      - Source + Source @@ -154,6 +155,11 @@

      Macros summary

      h/1
    3195. +
    3196. + + import_file/1 + +
    3197. s/1 @@ -193,7 +199,7 @@

      Examples

      - Source + Source

      @@ -202,7 +208,7 @@

      Examples

      Changes the current working directory to the given path.

      - Source + Source

      @@ -211,7 +217,7 @@

      Examples

      Flushes all messages sent to the shell and prints them out.

      - Source + Source

      @@ -220,7 +226,7 @@

      Examples

      Prints the documentation for IEx.Helpers.

      - Source + Source

      @@ -229,7 +235,7 @@

      Examples

      Purges and reloads specified module.

      - Source + Source

      @@ -239,7 +245,7 @@

      Examples

      If path points to a file, prints its full path.

      - Source + Source

      @@ -249,7 +255,7 @@

      Examples

      files.

      - Source + Source

      @@ -258,7 +264,7 @@

      Examples

      Prints the current working directory.

      - Source + Source

      @@ -268,7 +274,7 @@

      Examples

      in the current IEx session.

      - Source + Source

      @@ -280,7 +286,7 @@

      Examples

      are recompiled and reloaded.

      - Source + Source

      @@ -290,7 +296,7 @@

      Examples

      their results.

      - Source + Source

      @@ -302,7 +308,7 @@

      Examples

      For instance, v(-1) returns the result of the last evaluated expression.

      - Source + Source @@ -333,7 +339,31 @@

      Examples

      - Source + Source + +
      +

      + import_file(path) +

      +

      Evaluates the contents of file at path as if it were directly typed into +the shell. path has to be a literal binary.

      + +

      Leading ~ in path is automatically expanded.

      + +

      Examples

      + +
      # ~/file.exs
      +value = 13
      +
      +# in the shell
      +iex(1)> import_file "~/file.exs"
      +13
      +iex(2)> value
      +13
      +
      +
      + + Source

      @@ -355,7 +385,7 @@

      Examples

      - Source + Source

      @@ -374,7 +404,7 @@

      Examples

      - Source + Source diff --git a/docs/stable/IEx.html b/docs/stable/IEx.html index ab8ec53dd..8d7bade4f 100644 --- a/docs/stable/IEx.html +++ b/docs/stable/IEx.html @@ -29,7 +29,7 @@

      Welcome to IEx.

      -

      This module is the main entry point Interactive Elixir and +

      This module is the main entry point for Interactive Elixir and in this documentation we will talk a bit about how IEx works.

      Notice some of the functionality described here will be available @@ -45,11 +45,11 @@

      The Break command

      The User Switch command

      -

      Besides the break command, one can type Ctrl+G to get the to -the user switch command. When reached, you can type h to +

      Besides the break command, one can type Ctrl+G to get to the +user switch command menu. When reached, you can type h to get more information.

      -

      In this switch, developers are able to create new shell and +

      In this menu, developers are able to start new shells and alternate in between them. Let's give it a try:

      User switch command
      @@ -63,7 +63,7 @@ 

      The User Switch command

      hello = :world
       
      -

      Now, let's rollback to the first shell:

      +

      Now, let's roll back to the first shell:

      User switch command
        --> c 1
      @@ -75,23 +75,59 @@ 

      The User Switch command

      ** (UndefinedFunctionError) undefined function: IEx.Helpers.hello/0
      -

      The command above fails because we have changed the shells -and they are isolated from each other, you can access the -variables defined in one in the other.

      +

      The command above fails because we have switched the shells. +Since shells are isolated from each other, you can't access the +variables defined in one shell from the other one.

      -

      The User Switch also allow developers to connect to remote -shells using r. Keep in mind that you can't connect to a +

      The user switch command menu also allows developers to connect to remote +shells using the "r" command. Keep in mind that you can't connect to a remote node if you haven't given a name to the current node (i.e. Process.is_alive? must return true).

      +

      The .iex file

      + +

      When starting IEx, it will look for a local .iex file (located in the current +working directory), then a global one (located at ~/.iex) and will load the +first one it finds (if any). The code in the chosen .iex file will be +evaluated in the shell's context. So, for instance, any modules that are +loaded or variables that are bound in the .iex file will be available in the +shell after it has booted.

      + +

      Sample contents of a local .iex file:

      + +
      # source another .iex file
      +import_file "~/.iex"
      +
      +# print something before the shell starts
      +IO.puts "hello world"
      +
      +# bind a variable that'll be accessible in the shell
      +value = 13
      +
      + +

      Running the shell in the directory where the above .iex file is located +results in

      + +
      $ iex
      +Erlang R15B03 (erts-5.9.3.1) [...]
      +
      +hello world
      +Interactive Elixir (0.8.3.dev) - press Ctrl+C to exit (type h() ENTER for help)
      +iex(1)> value
      +13
      +
      + +

      It is possible to override the default loading sequence for .iex file by +supplying the --dot-iex option to iex. See iex --help.

      +

      Expressions in IEx

      -

      As an interactive shell, IEx evalutes expressions. This has some -interesting consequences worthy discussing.

      +

      As an interactive shell, IEx evaluates expressions. This has some +interesting consequences that are worth discussing.

      The first one is that the code is truly evaluated and not compiled. -This means that, any benchmarking done in the shell is going to have -skewed results. So never run any profiling nor benchmark in the shell.

      +This means that any benchmarking done in the shell is going to have +skewed results. So never run any profiling nor benchmarks in the shell.

      Second of all, IEx alows you to break an expression into many lines, since this is common in Elixir. For example:

      @@ -122,7 +158,7 @@

      Expressions in IEx

      - Source + Source @@ -174,7 +210,7 @@

      Functions

      Returns registered after spawn callbacks.

      - Source + Source

      @@ -183,7 +219,7 @@

      Functions

      Registers a function to be invoked after IEx process is spawned.

      - Source + Source

      @@ -192,7 +228,7 @@

      Functions

      Returns currently registered inspect options.

      - Source + Source

      @@ -201,7 +237,7 @@

      Functions

      Registers options used on inspect.

      - Source + Source

      @@ -210,7 +246,7 @@

      Functions

      Returns true if IEx was properly started.

      - Source + Source
      diff --git a/docs/stable/IO.ANSI.html b/docs/stable/IO.ANSI.html index 5fcbf9624..cb63ad762 100644 --- a/docs/stable/IO.ANSI.html +++ b/docs/stable/IO.ANSI.html @@ -32,13 +32,10 @@

      in the text used to control formatting, color, and other output options on video text terminals.

      -

      Please be aware that in Erlang/OTP versions prior to R16, you will not -be able to render ANSI escape sequences in iex or erlang shell

      - - Source + Source @@ -320,7 +317,7 @@

      Functions

      Sets foreground color to black

      - Source + Source

      @@ -329,7 +326,7 @@

      Functions

      Sets background color to black

      - Source + Source

      Functions

      Blink: off

      - Source + Source

      Functions

      Blink: Rapid. MS-DOS ANSI.SYS; 150 per minute or more; not widely supported

      - Source + Source

      Functions

      Blink: Slow. Less than 150 per minute

      - Source + Source

      @@ -365,7 +362,7 @@

      Functions

      Sets foreground color to blue

      - Source + Source

      @@ -374,7 +371,7 @@

      Functions

      Sets background color to blue

      - Source + Source

      @@ -383,7 +380,7 @@

      Functions

      Bright (increased intensity) or Bold

      - Source + Source

      @@ -392,7 +389,7 @@

      Functions

      Conceal. Not widely supported

      - Source + Source

      @@ -401,7 +398,7 @@

      Functions

      Crossed-out. Characters legible, but marked for deletion. Not widely supported.

      - Source + Source

      @@ -410,7 +407,7 @@

      Functions

      Sets foreground color to cyan

      - Source + Source

      @@ -419,7 +416,7 @@

      Functions

      Sets background color to cyan

      - Source + Source

      @@ -428,7 +425,7 @@

      Functions

      Default background color

      - Source + Source

      @@ -437,7 +434,7 @@

      Functions

      Default text color

      - Source + Source

      @@ -446,7 +443,7 @@

      Functions

      Encircled

      - Source + Source

      @@ -471,7 +468,7 @@

      Example

      "Hello \e[31m\e[1m\e[32myes\e[0m"

      - Source + Source

      @@ -493,7 +490,7 @@

      Example

      "Hello \e[31m\e[1m\e[32myes\e[0m"

      - Source + Source

      @@ -502,7 +499,7 @@

      Example

      Faint (decreased intensity), not widely supported

      - Source + Source

      @@ -511,7 +508,7 @@

      Example

      Sets alternative font 1

      - Source + Source

      @@ -520,7 +517,7 @@

      Example

      Sets alternative font 2

      - Source + Source

      @@ -529,7 +526,7 @@

      Example

      Sets alternative font 3

      - Source + Source

      @@ -538,7 +535,7 @@

      Example

      Sets alternative font 4

      - Source + Source

      @@ -547,7 +544,7 @@

      Example

      Sets alternative font 5

      - Source + Source

      @@ -556,7 +553,7 @@

      Example

      Sets alternative font 6

      - Source + Source

      @@ -565,7 +562,7 @@

      Example

      Sets alternative font 7

      - Source + Source

      @@ -574,7 +571,7 @@

      Example

      Sets alternative font 8

      - Source + Source

      @@ -583,7 +580,7 @@

      Example

      Sets alternative font 9

      - Source + Source

      @@ -592,7 +589,7 @@

      Example

      Framed

      - Source + Source

      @@ -601,7 +598,7 @@

      Example

      Sets foreground color to green

      - Source + Source

      @@ -610,7 +607,7 @@

      Example

      Sets background color to green

      - Source + Source

      @@ -619,7 +616,7 @@

      Example

      Image: Negative. Swap foreground and background

      - Source + Source

      @@ -628,7 +625,7 @@

      Example

      Italic: on. Not widely supported. Sometimes treated as inverse.

      - Source + Source

      @@ -637,7 +634,7 @@

      Example

      Sets foreground color to magenta

      - Source + Source

      @@ -646,7 +643,7 @@

      Example

      Sets background color to magenta

      - Source + Source

      @@ -655,7 +652,7 @@

      Example

      Underline: None

      - Source + Source

      @@ -664,7 +661,7 @@

      Example

      Normal color or intensity

      - Source + Source

      @@ -673,7 +670,7 @@

      Example

      Not framed or encircled

      - Source + Source

      @@ -682,7 +679,7 @@

      Example

      Not italic

      - Source + Source

      @@ -691,7 +688,7 @@

      Example

      Not overlined

      - Source + Source

      @@ -700,7 +697,7 @@

      Example

      Overlined

      - Source + Source

      @@ -709,7 +706,7 @@

      Example

      Sets primary (default) font

      - Source + Source

      @@ -718,7 +715,7 @@

      Example

      Sets foreground color to red

      - Source + Source

      @@ -727,7 +724,7 @@

      Example

      Sets background color to red

      - Source + Source

      @@ -736,7 +733,7 @@

      Example

      Resets all attributes

      - Source + Source

      @@ -745,7 +742,7 @@

      Example

      Image: Negative. Swap foreground and background

      - Source + Source

      @@ -755,14 +752,9 @@

      Example

      Used to identify whether printing ANSI escape sequences will likely be printed as intended.

      - -

      Please note that invoked while in shell (iex) in Erlang/OTP -prior to R16, terminal?/0 will always return false because -Erlang shell did not support ANSI escape sequences up until -R16.

      - Source + Source

      @@ -771,7 +763,7 @@

      Example

      Underline: Single

      - Source + Source

      @@ -780,7 +772,7 @@

      Example

      Sets foreground color to white

      - Source + Source

      @@ -789,7 +781,7 @@

      Example

      Sets background color to white

      - Source + Source

      @@ -798,7 +790,7 @@

      Example

      Sets foreground color to yellow

      - Source + Source

      @@ -807,7 +799,7 @@

      Example

      Sets background color to yellow

      - Source + Source
      diff --git a/docs/stable/IO.html b/docs/stable/IO.html index 7798c6293..f40555f00 100644 --- a/docs/stable/IO.html +++ b/docs/stable/IO.html @@ -50,7 +50,7 @@

      - Source + Source @@ -140,7 +140,7 @@

      Functions

      Check read/2 for more information.

      - Source + Source

      @@ -152,7 +152,7 @@

      Functions

      Check readline/1 for more information.

      - Source + Source

      @@ -164,7 +164,7 @@

      Functions

      Check write/2 for more information.

      - Source + Source

      @@ -184,7 +184,7 @@

      Functions

      - Source + Source

      @@ -196,7 +196,7 @@

      Functions

      Otherwise, the number of raw bytes.

      - Source + Source

      @@ -214,7 +214,7 @@

      Functions

      - Source + Source

      @@ -229,7 +229,7 @@

      Examples

      - Source + Source

      @@ -238,7 +238,7 @@

      Examples

      Inspects the item with options using the given device.

      - Source + Source

      @@ -249,7 +249,7 @@

      Examples

      to be a chardata.

      - Source + Source

      @@ -266,7 +266,7 @@

      Examples

      - Source + Source

      @@ -286,7 +286,7 @@

      Examples

      except the prompt is not required as argument.

      - Source + Source

      @@ -309,7 +309,7 @@

      Examples

      - Source + Source diff --git a/docs/stable/Kernel.CLI.html b/docs/stable/Kernel.CLI.html index 1c1b50cc3..a23c8ce84 100644 --- a/docs/stable/Kernel.CLI.html +++ b/docs/stable/Kernel.CLI.html @@ -32,7 +32,7 @@

      - Source + Source @@ -69,7 +69,7 @@

      Functions

      by escripts generated by Elixir.

      - Source + Source diff --git a/docs/stable/Kernel.ParallelCompiler.html b/docs/stable/Kernel.ParallelCompiler.html index 6ce506b69..6622625f6 100644 --- a/docs/stable/Kernel.ParallelCompiler.html +++ b/docs/stable/Kernel.ParallelCompiler.html @@ -32,7 +32,7 @@

      - Source + Source @@ -77,7 +77,7 @@

      Functions

      with its name can be optionally given as argument.

      - Source + Source

      @@ -87,7 +87,7 @@

      Functions

      Read files/2 for more information.

      - Source + Source diff --git a/docs/stable/Kernel.ParallelRequire.html b/docs/stable/Kernel.ParallelRequire.html index e15fce868..ff849770b 100644 --- a/docs/stable/Kernel.ParallelRequire.html +++ b/docs/stable/Kernel.ParallelRequire.html @@ -32,7 +32,7 @@

      - Source + Source @@ -67,7 +67,7 @@

      Functions

      can be optionally given as argument.

      - Source + Source diff --git a/docs/stable/Kernel.SpecialForms.html b/docs/stable/Kernel.SpecialForms.html index 3ae0feb9d..4d91c5de8 100644 --- a/docs/stable/Kernel.SpecialForms.html +++ b/docs/stable/Kernel.SpecialForms.html @@ -48,7 +48,7 @@

      - Source + Source @@ -316,7 +316,7 @@

      Bitstring types

      to binary32 and binary64, respectively.

      - Source + Source

      @@ -331,7 +331,7 @@

      Examples

      - Source + Source

      @@ -340,7 +340,7 @@

      Examples

      Returns the current directory as a binary.

      - Source + Source

      @@ -351,7 +351,7 @@

      Examples

      line numbers, set up aliases, the current function and others.

      - Source + Source

      @@ -362,7 +362,7 @@

      Examples

      is a convenient shortcut.

      - Source + Source

      @@ -373,7 +373,7 @@

      Examples

      is a convenient shortcut.

      - Source + Source

      @@ -418,7 +418,7 @@

      Examples

      - Source + Source

      @@ -433,7 +433,7 @@

      Examples

      - Source + Source

      @@ -451,7 +451,7 @@

      Examples

      Check quote/1 for more information.

      - Source + Source

      @@ -497,7 +497,7 @@

      Lexical scope

      specific functions and it won't affect the overall scope.

      - Source + Source

      @@ -508,7 +508,7 @@

      Lexical scope

      the macro is expanded.

      - Source + Source

      @@ -524,7 +524,7 @@

      Lexical scope

      - Source + Source

      @@ -625,7 +625,7 @@

      Ambiguous function/macro names

      errors are emitted lazily, not eagerly.

      - Source + Source

      @@ -675,7 +675,7 @@

      Ambiguous function/macro names

      - Source + Source

      @@ -973,7 +973,7 @@

      Stacktrace information

      the quote will always point to GenServer.Behaviour file.

      - Source + Source

      @@ -1006,7 +1006,7 @@

      Alias shortcut

      up an alias. Please check alias for more information.

      - Source + Source

      @@ -1037,7 +1037,7 @@

      Examples

      - Source + Source

      @@ -1054,7 +1054,7 @@

      Examples

      - Source + Source

      @@ -1067,7 +1067,7 @@

      Examples

      Check quote/2 for more information.

      - Source + Source

      @@ -1077,7 +1077,7 @@

      Examples

      Check quote/2 for more information.

      - Source + Source

      @@ -1092,7 +1092,7 @@

      Examples

      - Source + Source diff --git a/docs/stable/Kernel.Typespec.html b/docs/stable/Kernel.Typespec.html index e26e8cc94..4be9c6f79 100644 --- a/docs/stable/Kernel.Typespec.html +++ b/docs/stable/Kernel.Typespec.html @@ -119,7 +119,7 @@

      Notes

      - Source + Source @@ -237,7 +237,7 @@

      Functions

      on the file system.

      - Source + Source

      @@ -252,7 +252,7 @@

      Functions

      on the file system.

      - Source + Source

      @@ -267,7 +267,7 @@

      Functions

      on the file system.

      - Source + Source

      @@ -276,7 +276,7 @@

      Functions

      Defines a callback by receiving Erlang's typespec.

      - Source + Source

      @@ -285,7 +285,7 @@

      Functions

      Defines a spec by receiving Erlang's typespec.

      - Source + Source

      @@ -294,7 +294,7 @@

      Functions

      Defines a type, typep or opaque by receiving Erlang's typespec.

      - Source + Source

      @@ -304,7 +304,7 @@

      Functions

      This function is only available for modules being compiled.

      - Source + Source

      @@ -314,7 +314,7 @@

      Functions

      This function is only available for modules being compiled.

      - Source + Source

      @@ -325,7 +325,7 @@

      Functions

      for modules being compiled.

      - Source + Source

      @@ -334,7 +334,7 @@

      Functions

      Converts a spec clause back to Elixir AST.

      - Source + Source

      @@ -343,7 +343,7 @@

      Functions

      Converts a type clause back to Elixir AST.

      - Source + Source
      @@ -365,7 +365,7 @@

      Examples

      - Source + Source

      @@ -380,7 +380,7 @@

      Examples

      - Source + Source

      @@ -395,7 +395,7 @@

      Examples

      - Source + Source

      @@ -410,7 +410,7 @@

      Examples

      - Source + Source

      @@ -425,7 +425,7 @@

      Examples

      - Source + Source diff --git a/docs/stable/Kernel.html b/docs/stable/Kernel.html index 66f495886..8cbd8e0ec 100644 --- a/docs/stable/Kernel.html +++ b/docs/stable/Kernel.html @@ -47,7 +47,7 @@

      - Source + Source @@ -86,6 +86,21 @@

      Functions summary

      binary_to_existing_atom/2
    3198. +
    3199. + + binary_to_float/1 + +
    3200. +
    3201. + + binary_to_integer/1 + +
    3202. +
    3203. + + binary_to_integer/2 + +
    3204. binary_to_list/1 @@ -131,6 +146,11 @@

      Functions summary

      float/1
    3205. +
    3206. + + float_to_binary/1 + +
    3207. float_to_binary/2 @@ -156,6 +176,16 @@

      Functions summary

      hd/1
    3208. +
    3209. + + integer_to_binary/1 + +
    3210. +
    3211. + + integer_to_binary/2 + +
    3212. integer_to_list/1 @@ -608,21 +638,6 @@

      Macros summary

      binary_to_existing_atom/1
    3213. -
    3214. - - binary_to_float/1 - -
    3215. -
    3216. - - binary_to_integer/1 - -
    3217. -
    3218. - - binary_to_integer/2 - -
    3219. case/2 @@ -733,11 +748,6 @@

      Macros summary

      elem/2
    3220. -
    3221. - - float_to_binary/1 - -
    3222. function/1 @@ -768,16 +778,6 @@

      Macros summary

      inspect/2
    3223. -
    3224. - - integer_to_binary/1 - -
    3225. -
    3226. - - integer_to_binary/2 - -
    3227. is_exception/1 @@ -904,7 +904,7 @@

      Examples

      - Source + Source

      @@ -923,7 +923,7 @@

      Examples

      - Source + Source

      @@ -938,7 +938,7 @@

      Examples

      - Source + Source

      @@ -965,7 +965,7 @@

      Examples

      - Source + Source

      @@ -983,7 +983,7 @@

      Examples

      - Source + Source

      @@ -992,7 +992,53 @@

      Examples

      Works like binary_to_atom/2, but the atom must already exist.

      - Source + Source + +
      +

      + binary_to_float(some_binary) +

      +

      Returns a float whose text representation is some_binary.

      + +

      Examples

      + +
      iex> binary_to_float("2.2017764e+0")
      +2.2017764
      +
      +
      + + Source + +
      +

      + binary_to_integer(some_binary) +

      +

      Returns a integer whose text representation is some_binary.

      + +

      Examples

      + +
      iex> binary_to_integer("123")
      +123
      +
      +
      + + Source + +
      +

      + binary_to_integer(some_binary, base) +

      +

      Returns an integer whose text representation in base base +is some_binary.

      + +

      Examples

      + +
      iex> binary_to_integer("3FF", 16)
      +1023
      +
      +
      + + Source

      @@ -1001,7 +1047,7 @@

      Examples

      Returns a list of integers which correspond to the bytes of binary.

      - Source + Source

      @@ -1012,7 +1058,7 @@

      Examples

      are numbered starting from 1.

      - Source + Source

      @@ -1029,7 +1075,7 @@

      Examples

      - Source + Source

      @@ -1055,7 +1101,7 @@

      Examples

      - Source + Source

      @@ -1074,7 +1120,7 @@

      Examples

      - Source + Source

      @@ -1085,7 +1131,7 @@

      Examples

      be a bitstring containing the remaining bits (1 up to 7 bits).

      - Source + Source

      @@ -1106,7 +1152,7 @@

      Examples

      - Source + Source

      @@ -1123,7 +1169,7 @@

      Examples

      - Source + Source

      @@ -1132,7 +1178,23 @@

      Examples

      Converts the given number to a float. Allowed in guard clauses.

      - Source + Source + +
      +

      + float_to_binary(some_float) +

      +

      Returns a binary which corresponds to the text representation +of some_float.

      + +

      Examples

      + +
      iex> float_to_binary(7.0)
      +"7.00000000000000000000e+00"
      +
      +
      + + Source

      @@ -1155,7 +1217,7 @@

      Examples

      - Source + Source

      @@ -1170,7 +1232,7 @@

      Examples

      - Source + Source

      @@ -1193,7 +1255,7 @@

      Examples

      - Source + Source

      @@ -1210,7 +1272,7 @@

      Examples

      information.

      - Source + Source

      @@ -1219,7 +1281,39 @@

      Examples

      Returns the head of a list, raises badarg if the list is empty.

      - Source + Source + +
      +

      + integer_to_binary(some_integer) +

      +

      Returns a binary which corresponds to the text representation +of some_integer.

      + +

      Examples

      + +
      iex> integer_to_binary(123)
      +"123"
      +
      +
      + + Source + +
      +

      + integer_to_binary(some_integer, base) +

      +

      Returns a binary which corresponds to the text representation +of some_integer in base base.

      + +

      Examples

      + +
      iex> integer_to_binary(100, 16)
      +"64"
      +
      +
      + + Source

      @@ -1234,7 +1328,7 @@

      Examples

      - Source + Source

      @@ -1250,7 +1344,7 @@

      Examples

      - Source + Source

      @@ -1265,7 +1359,7 @@

      Examples

      - Source + Source

      @@ -1283,7 +1377,7 @@

      Examples

      - Source + Source

      @@ -1293,7 +1387,7 @@

      Examples

      if the node can be part of a distributed system.

      - Source + Source

      @@ -1304,7 +1398,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1317,7 +1411,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1328,7 +1422,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1340,7 +1434,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1351,7 +1445,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1362,7 +1456,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1374,7 +1468,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1385,7 +1479,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1396,7 +1490,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1408,7 +1502,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1419,7 +1513,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1430,7 +1524,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1441,7 +1535,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1452,7 +1546,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1469,7 +1563,7 @@

      Examples

      - Source + Source

      @@ -1484,7 +1578,7 @@

      Examples

      - Source + Source

      @@ -1499,7 +1593,7 @@

      Examples

      - Source + Source

      @@ -1518,7 +1612,7 @@

      Examples

      - Source + Source

      @@ -1528,7 +1622,7 @@

      Examples

      exists such atom.

      - Source + Source

      @@ -1543,7 +1637,7 @@

      Examples

      - Source + Source

      @@ -1558,7 +1652,7 @@

      Examples

      - Source + Source

      @@ -1573,7 +1667,7 @@

      Examples

      - Source + Source

      @@ -1594,7 +1688,7 @@

      Examples

      - Source + Source

      @@ -1609,7 +1703,7 @@

      Examples

      - Source + Source

      @@ -1623,7 +1717,7 @@

      Examples

      information.

      - Source + Source

      @@ -1640,7 +1734,7 @@

      Examples

      - Source + Source

      @@ -1657,7 +1751,7 @@

      Examples

      - Source + Source

      @@ -1674,7 +1768,7 @@

      Examples

      - Source + Source

      @@ -1686,7 +1780,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1699,7 +1793,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1717,7 +1811,7 @@

      Warning:

      It should not be used in application programs.

      - Source + Source

      @@ -1744,7 +1838,7 @@

      Examples

      - Source + Source

      @@ -1767,7 +1861,7 @@

      Examples

      - Source + Source

      @@ -1796,7 +1890,7 @@

      Examples

      may change the System.stacktrace value.

      - Source + Source

      @@ -1812,7 +1906,7 @@

      Examples

      - Source + Source

      @@ -1822,7 +1916,7 @@

      Examples

      Allowed in guard clauses.

      - Source + Source

      @@ -1832,7 +1926,7 @@

      Examples

      or a binary. If possible, please use tuple_size or binary_size.

      - Source + Source

      @@ -1854,7 +1948,7 @@

      Examples

      - Source + Source

      @@ -1872,7 +1966,7 @@

      Examples

      - Source + Source

      @@ -1894,7 +1988,7 @@

      Examples

      - Source + Source

      @@ -1912,7 +2006,7 @@

      Examples

      - Source + Source

      @@ -1926,7 +2020,7 @@

      Examples

      of communications channel not supported by distributed :

      - Source + Source

      @@ -1942,7 +2036,7 @@

      Examples

      - Source + Source

      @@ -1951,7 +2045,7 @@

      Examples

      A non-local return from a function. Check try/2 for more information.

      - Source + Source

      @@ -1960,7 +2054,7 @@

      Examples

      Returns the tail of a list. Raises ArgumentError if the list is empty.

      - Source + Source

      @@ -1976,7 +2070,7 @@

      Examples

      - Source + Source

      @@ -1985,7 +2079,7 @@

      Examples

      Returns the size of a tuple.

      - Source + Source

      @@ -1994,7 +2088,7 @@

      Examples

      Converts a tuple to a list.

      - Source + Source
      @@ -2024,7 +2118,7 @@

      Examples

      - Source + Source

      @@ -2046,7 +2140,7 @@

      Examples

      - Source + Source

      @@ -2065,7 +2159,7 @@

      Examples

      - Source + Source

      @@ -2093,7 +2187,7 @@

      Examples

      not only booleans, however it is not allowed in guards.

      - Source + Source

      @@ -2108,7 +2202,7 @@

      Examples

      - Source + Source

      @@ -2123,7 +2217,7 @@

      Examples

      - Source + Source

      @@ -2141,7 +2235,7 @@

      Examples

      - Source + Source

      @@ -2156,7 +2250,7 @@

      Examples

      - Source + Source

      @@ -2175,7 +2269,7 @@

      Examples

      - Source + Source

      @@ -2197,7 +2291,7 @@

      Examples

      - Source + Source

      @@ -2216,7 +2310,7 @@

      Examples

      - Source + Source

      @@ -2232,7 +2326,7 @@

      Examples

      - Source + Source

      @@ -2249,7 +2343,7 @@

      Examples

      - Source + Source

      @@ -2265,7 +2359,7 @@

      Examples

      - Source + Source

      @@ -2288,7 +2382,7 @@

      Examples

      - Source + Source

      @@ -2311,7 +2405,7 @@

      Examples

      - Source + Source

      @@ -2330,7 +2424,7 @@

      Examples

      - Source + Source

      @@ -2349,7 +2443,7 @@

      Examples

      - Source + Source

      @@ -2365,7 +2459,7 @@

      Examples

      - Source + Source

      @@ -2381,7 +2475,7 @@

      Examples

      - Source + Source

      @@ -2431,7 +2525,7 @@

      Examples

      to manipulate module attributes.

      - Source + Source

      @@ -2449,7 +2543,7 @@

      Examples

      - Source + Source

      @@ -2467,7 +2561,7 @@

      Examples

      - Source + Source

      @@ -2483,7 +2577,7 @@

      Examples

      - Source + Source

      @@ -2507,7 +2601,7 @@

      Examples

      - Source + Source

      @@ -2525,7 +2619,7 @@

      Examples

      - Source + Source

      @@ -2543,7 +2637,7 @@

      Examples

      - Source + Source

      @@ -2558,7 +2652,7 @@

      Examples

      - Source + Source

      @@ -2585,7 +2679,7 @@

      Examples

      - Source + Source

      @@ -2654,7 +2748,7 @@

      Atoms

      In this case, "Hello" will be printed twice (one per each field).

      - Source + Source

      @@ -2670,7 +2764,7 @@

      Examples

      - Source + Source

      @@ -2685,7 +2779,7 @@

      Examples

      - Source + Source

      @@ -2700,7 +2794,7 @@

      Examples

      - Source + Source

      @@ -2716,7 +2810,7 @@

      Examples

      - Source + Source

      @@ -2732,7 +2826,7 @@

      Examples

      - Source + Source

      @@ -2751,53 +2845,7 @@

      Examples

      - Source - -
      -

      - binary_to_float(some_binary) -

      -

      Returns a float whose text representation is some_binary.

      - -

      Examples

      - -
      iex> binary_to_float("2.2017764e+0")
      -2.2017764
      -
      -
      - - Source - -
      -

      - binary_to_integer(some_binary) -

      -

      Returns a integer whose text representation is some_binary.

      - -

      Examples

      - -
      iex> binary_to_integer("123")
      -123
      -
      -
      - - Source - -
      -

      - binary_to_integer(some_binary, base) -

      -

      Returns an integer whose text representation in base base -is some_binary.

      - -

      Examples

      - -
      iex> binary_to_integer("3FF", 16)
      -1023
      -
      -
      - - Source + Source

      @@ -2841,7 +2889,7 @@

      Examples

      The example above will actually fail because 10 does not match 1.

      - Source + Source

      @@ -2864,7 +2912,7 @@

      Examples

      - Source + Source

      @@ -2894,7 +2942,7 @@

      Examples

      two arguments and sum them.

      - Source + Source

      @@ -2933,7 +2981,7 @@

      Examples

      - Source + Source

      @@ -2981,7 +3029,7 @@

      Examples

      - Source + Source

      @@ -2999,7 +3047,7 @@

      Examples

      binary as result;

      - Source + Source

      @@ -3009,7 +3057,7 @@

      Examples

      defprotocol/2 for examples.

      - Source + Source

      @@ -3034,7 +3082,7 @@

      Examples

      - Source + Source

      @@ -3043,7 +3091,7 @@

      Examples

      The same as def/4 but generates a macro.

      - Source + Source

      @@ -3055,7 +3103,7 @@

      Examples

      Check defmacro/2 for more information

      - Source + Source

      @@ -3064,7 +3112,7 @@

      Examples

      The same as def/4 but generates a private macro.

      - Source + Source

      @@ -3114,7 +3162,7 @@

      Dynamic names

      returns an atom.

      - Source + Source

      @@ -3125,7 +3173,7 @@

      Dynamic names

      developer to customize it.

      - Source + Source

      @@ -3151,7 +3199,7 @@

      Examples

      through Foo.sum will raise an error.

      - Source + Source

      @@ -3160,7 +3208,7 @@

      Examples

      The same as def/4 but generates a private function.

      - Source + Source

      @@ -3292,7 +3340,7 @@

      Types

      given protocol are valid argument types for the given function.

      - Source + Source

      @@ -3462,7 +3510,7 @@

      Importing records

      See Record.import/2 and defrecordp/2 documentation for more information

      - Source + Source

      @@ -3512,7 +3560,7 @@

      Examples

      - Source + Source

      @@ -3534,7 +3582,7 @@

      Example

      - Source + Source

      @@ -3574,7 +3622,7 @@

      Examples

      it will raise a CaseClauseError.

      - Source + Source

      @@ -3591,7 +3639,7 @@

      Examples

      - Source + Source

      @@ -3610,23 +3658,7 @@

      Example

      - Source - -
      -

      - float_to_binary(some_float) -

      -

      Returns a binary which corresponds to the text representation -of some_float.

      - -

      Examples

      - -
      iex> float_to_binary(7.0)
      -"7.00000000000000000000e+00"
      -
      -
      - - Source + Source

      @@ -3720,7 +3752,7 @@

      Shortcut syntax

      - Source + Source

      @@ -3736,7 +3768,7 @@

      Examples

      - Source + Source

      @@ -3782,7 +3814,7 @@

      Blocks examples

      macro.

      - Source + Source

      @@ -3829,7 +3861,7 @@

      Clauses

      the variable for us.

      - Source + Source

      @@ -3839,10 +3871,6 @@

      Clauses

      Elixir conventions (i.e. it expects the tuple as first argument, zero-index based).

      -

      Please note that in versions of Erlang prior to R16B there is no BIF -for this operation and it is emulated by converting the tuple to a list -and back and is, therefore, inefficient.

      -

      Example

      iex> tuple = { :bar, :baz }
      @@ -3851,7 +3879,7 @@ 

      Example

      - Source + Source

      @@ -3885,39 +3913,7 @@

      Examples

      - Source - -
      -

      - integer_to_binary(some_integer) -

      -

      Returns a binary which corresponds to the text representation -of some_integer.

      - -

      Examples

      - -
      iex> integer_to_binary(123)
      -"123"
      -
      -
      - - Source - -
      -

      - integer_to_binary(some_integer, base) -

      -

      Returns a binary which corresponds to the text representation -of some_integer in base base.

      - -

      Examples

      - -
      iex> integer_to_binary(77)
      -"77"
      -
      -
      - - Source + Source

      @@ -3934,7 +3930,7 @@

      Examples

      - Source + Source

      @@ -3943,7 +3939,7 @@

      Examples

      Checks if the given argument is a range.

      - Source + Source

      @@ -3952,7 +3948,7 @@

      Examples

      Checks if the given argument is a record.

      - Source + Source

      @@ -3971,7 +3967,7 @@

      Examples

      - Source + Source

      @@ -3980,7 +3976,7 @@

      Examples

      Checks if the given argument is a regex.

      - Source + Source

      @@ -4012,7 +4008,7 @@

      Examples

      - Source + Source

      @@ -4030,7 +4026,7 @@

      Examples

      - Source + Source

      @@ -4046,7 +4042,7 @@

      Examples

      - Source + Source

      @@ -4062,7 +4058,7 @@

      Examples

      - Source + Source

      @@ -4112,7 +4108,7 @@

      Examples

      - Source + Source

      @@ -4129,7 +4125,7 @@

      Examples

      - Source + Source

      @@ -4146,7 +4142,7 @@

      Example

      - Source + Source

      @@ -4162,7 +4158,7 @@

      Examples

      - Source + Source

      @@ -4177,7 +4173,7 @@

      Examples

      - Source + Source

      @@ -4296,7 +4292,7 @@

      Variable visibility

      - Source + Source

      @@ -4316,7 +4312,7 @@

      Examples

      - Source + Source

      @@ -4355,7 +4351,7 @@

      Examples

      - Source + Source

      @@ -4374,7 +4370,7 @@

      Examples

      - Source + Source

      @@ -4407,7 +4403,7 @@

      Examples

      String.graphemes("Hello" |> Enum.reverse)
       
      -

      Which will result in an error as Enum.Iterator protocol +

      Which will result in an error as Enumerable protocol is not defined for binaries. Adding explicit parenthesis is recommended:

      @@ -4415,7 +4411,7 @@

      Examples

      - Source + Source

      @@ -4442,7 +4438,7 @@

      Examples

      not only booleans, however it is not allowed in guards.

      - Source + Source diff --git a/docs/stable/KeyError.html b/docs/stable/KeyError.html index 9170b8661..cdf39650d 100644 --- a/docs/stable/KeyError.html +++ b/docs/stable/KeyError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -71,7 +71,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Keyword.html b/docs/stable/Keyword.html index 91c7d95aa..0be413c57 100644 --- a/docs/stable/Keyword.html +++ b/docs/stable/Keyword.html @@ -42,7 +42,7 @@

      - Source + Source @@ -185,7 +185,7 @@

      Examples

      - Source + Source

      @@ -203,7 +203,7 @@

      Examples

      - Source + Source

      @@ -219,7 +219,7 @@

      Examples

      - Source + Source

      @@ -238,7 +238,7 @@

      Examples

      - Source + Source

      @@ -256,7 +256,7 @@

      Examples

      - Source + Source

      @@ -267,7 +267,7 @@

      Examples

      duplicated entries.

      - Source + Source

      @@ -292,7 +292,7 @@

      Examples

      - Source + Source

      @@ -307,7 +307,7 @@

      Examples

      - Source + Source

      @@ -324,7 +324,7 @@

      Examples

      - Source + Source

      @@ -340,7 +340,7 @@

      Examples

      - Source + Source

      @@ -349,7 +349,7 @@

      Examples

      Checks if the given argument is a keywords list or not

      - Source + Source

      @@ -365,7 +365,7 @@

      Examples

      - Source + Source

      @@ -383,7 +383,7 @@

      Examples

      - Source + Source

      @@ -392,7 +392,7 @@

      Examples

      Returns an empty keyword list, i.e. an empty list.

      - Source + Source

      @@ -408,7 +408,7 @@

      Examples

      - Source + Source

      @@ -425,7 +425,7 @@

      Examples

      - Source + Source

      @@ -443,7 +443,7 @@

      Examples

      - Source + Source

      @@ -459,7 +459,7 @@

      Examples

      - Source + Source

      @@ -477,7 +477,7 @@

      Examples

      - Source + Source

      @@ -495,7 +495,7 @@

      Examples

      - Source + Source

      @@ -510,7 +510,7 @@

      Examples

      - Source + Source diff --git a/docs/stable/List.Chars.Atom.html b/docs/stable/List.Chars.Atom.html index 1dfc40ead..7d1c90a0e 100644 --- a/docs/stable/List.Chars.Atom.html +++ b/docs/stable/List.Chars.Atom.html @@ -29,7 +29,7 @@

      - Source + Source @@ -60,7 +60,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/List.Chars.BitString.html b/docs/stable/List.Chars.BitString.html index cbee8f544..83fc230e3 100644 --- a/docs/stable/List.Chars.BitString.html +++ b/docs/stable/List.Chars.BitString.html @@ -29,7 +29,7 @@

      - Source + Source @@ -60,7 +60,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/List.Chars.List.html b/docs/stable/List.Chars.List.html index 96748e2d1..5b01a9bfc 100644 --- a/docs/stable/List.Chars.List.html +++ b/docs/stable/List.Chars.List.html @@ -29,7 +29,7 @@

      - Source + Source @@ -60,7 +60,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/List.Chars.Number.html b/docs/stable/List.Chars.Number.html index 51fef0449..fac2c0f24 100644 --- a/docs/stable/List.Chars.Number.html +++ b/docs/stable/List.Chars.Number.html @@ -29,7 +29,7 @@

      - Source + Source @@ -60,7 +60,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/List.Chars.html b/docs/stable/List.Chars.html index fd9d2c6e9..31a898883 100644 --- a/docs/stable/List.Chars.html +++ b/docs/stable/List.Chars.html @@ -40,7 +40,7 @@

      - Source + Source

      Implementations

      @@ -100,7 +100,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/List.html b/docs/stable/List.html index 3420ff583..1c8ba6b24 100644 --- a/docs/stable/List.html +++ b/docs/stable/List.html @@ -39,7 +39,7 @@

      - Source + Source @@ -162,7 +162,7 @@

      Examples

      - Source + Source

      @@ -181,7 +181,7 @@

      Examples

      - Source + Source

      @@ -198,7 +198,7 @@

      Examples

      - Source + Source

      @@ -216,7 +216,7 @@

      Examples

      - Source + Source

      @@ -236,7 +236,7 @@

      Examples

      - Source + Source

      @@ -244,7 +244,7 @@

      Examples

      - Source + Source

      @@ -263,7 +263,7 @@

      Examples

      - Source + Source

      @@ -279,7 +279,7 @@

      Examples

      - Source + Source

      @@ -302,7 +302,7 @@

      Examples

      - Source + Source

      @@ -325,7 +325,7 @@

      Examples

      - Source + Source

      @@ -348,7 +348,7 @@

      Examples

      - Source + Source

      @@ -371,7 +371,7 @@

      Examples

      - Source + Source

      @@ -387,7 +387,7 @@

      Examples

      - Source + Source

      @@ -404,7 +404,7 @@

      Examples

      - Source + Source

      @@ -423,7 +423,7 @@

      Examples

      - Source + Source

      @@ -442,7 +442,7 @@

      Examples

      - Source + Source

      @@ -459,7 +459,7 @@

      Examples

      - Source + Source

      @@ -477,7 +477,7 @@

      Examples

      - Source + Source diff --git a/docs/stable/ListDict.html b/docs/stable/ListDict.html index 8850700a9..8f02941d3 100644 --- a/docs/stable/ListDict.html +++ b/docs/stable/ListDict.html @@ -35,7 +35,7 @@

      - Source + Source @@ -177,7 +177,7 @@

      Functions

      Deletes the entry under the given key from the dict.

      - Source + Source

      @@ -187,7 +187,7 @@

      Functions

      which key is not in keys

      - Source + Source

      @@ -196,7 +196,7 @@

      Functions

      Returns an empty ListDict.

      - Source + Source

      @@ -205,7 +205,7 @@

      Functions

      Check if the ListDict is equal to another ListDict.

      - Source + Source

      @@ -215,7 +215,7 @@

      Functions

      dict in a tagged tuple, otherwise :error.

      - Source + Source

      @@ -225,7 +225,7 @@

      Functions

      raises KeyError if the key does not exist.

      - Source + Source

      @@ -235,7 +235,7 @@

      Functions

      dict or default if no key is set.

      - Source + Source

      @@ -244,7 +244,7 @@

      Functions

      Returns true if the dict has the given key.

      - Source + Source

      @@ -253,7 +253,7 @@

      Functions

      Returns all keys in the dict.

      - Source + Source

      @@ -262,7 +262,7 @@

      Functions

      Merges the given Enumerable into the dict.

      - Source + Source

      @@ -271,7 +271,7 @@

      Functions

      Returns a new ListDict, i.e. an empty list.

      - Source + Source

      @@ -280,7 +280,7 @@

      Functions

      Creates a new ListDict from the given pairs.

      - Source + Source

      @@ -290,7 +290,7 @@

      Functions

      via the given transformation function.

      - Source + Source

      @@ -300,7 +300,7 @@

      Functions

      from the dict as well as the dict without that key.

      - Source + Source

      @@ -309,7 +309,7 @@

      Functions

      Puts the given key-value pair in the dict.

      - Source + Source

      @@ -319,7 +319,7 @@

      Functions

      if no entry exists yet.

      - Source + Source

      @@ -328,7 +328,7 @@

      Functions

      Returns the dict size.

      - Source + Source

      @@ -340,7 +340,7 @@

      Functions

      Returns a 2-tuple of the new dicts.

      - Source + Source

      @@ -350,7 +350,7 @@

      Functions

      which key is in keys

      - Source + Source

      @@ -359,7 +359,7 @@

      Functions

      Converts the dict to a list.

      - Source + Source

      @@ -368,7 +368,7 @@

      Functions

      Updates the key in the dict according to the given function.

      - Source + Source

      @@ -378,7 +378,7 @@

      Functions

      or uses the given initial value if no entry exists.

      - Source + Source

      @@ -387,7 +387,7 @@

      Functions

      Returns all values in the dict.

      - Source + Source
      diff --git a/docs/stable/Macro.Env.html b/docs/stable/Macro.Env.html index 27170e074..c9618860d 100644 --- a/docs/stable/Macro.Env.html +++ b/docs/stable/Macro.Env.html @@ -55,7 +55,7 @@

      - Source + Source @@ -168,7 +168,7 @@

      Functions

      inside a guard.

      - Source + Source

      @@ -178,7 +178,7 @@

      Functions

      inside a match clause.

      - Source + Source

      @@ -188,7 +188,7 @@

      Functions

      information as keys.

      - Source + Source

      @@ -197,7 +197,7 @@

      Functions

      Returns the environment stacktrace.

      - Source + Source
      diff --git a/docs/stable/Macro.html b/docs/stable/Macro.html index 4827735ee..17db392d8 100644 --- a/docs/stable/Macro.html +++ b/docs/stable/Macro.html @@ -32,7 +32,7 @@

      - Source + Source @@ -129,7 +129,7 @@

      Examples

      - Source + Source

      @@ -231,7 +231,7 @@

      Examples

      - Source + Source

      @@ -254,7 +254,7 @@

      Examples

      - Source + Source

      @@ -266,7 +266,7 @@

      Examples

      which is returned as { :unsafe, term }.

      - Source + Source

      @@ -281,7 +281,7 @@

      Examples

      - Source + Source

      @@ -309,7 +309,7 @@

      Examples

      and we return a version with it unescaped.

      - Source + Source

      @@ -359,7 +359,7 @@

      Examples

      - Source + Source

      @@ -375,7 +375,7 @@

      Examples

      for examples.

      - Source + Source

      @@ -385,7 +385,7 @@

      Examples

      Check unescape_tokens/1 and unescape_binary/2 for more information.

      - Source + Source @@ -402,7 +402,7 @@

      Macros

      as a macro so it can be used in guard clauses.

      - Source + Source

      @@ -412,7 +412,7 @@

      Macros

      as a macro so it can be used in guard clauses.

      - Source + Source diff --git a/docs/stable/MatchError.html b/docs/stable/MatchError.html index d13c9ad64..00cfa4749 100644 --- a/docs/stable/MatchError.html +++ b/docs/stable/MatchError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -71,7 +71,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Dep.html b/docs/stable/Mix.Dep.html index 03f1ba108..41e4dc410 100644 --- a/docs/stable/Mix.Dep.html +++ b/docs/stable/Mix.Dep.html @@ -44,7 +44,7 @@

      - Source + Source diff --git a/docs/stable/Mix.Deps.html b/docs/stable/Mix.Deps.html index 2e4ba7d5b..f0c04fb5a 100644 --- a/docs/stable/Mix.Deps.html +++ b/docs/stable/Mix.Deps.html @@ -32,7 +32,7 @@

      - Source + Source @@ -159,7 +159,7 @@

      Exceptions

      provides a dependency in the wrong format.

      - Source + Source

      @@ -169,7 +169,7 @@

      Exceptions

      accumulator.

      - Source + Source

      @@ -178,7 +178,7 @@

      Exceptions

      Check if a dependency is available.

      - Source + Source

      @@ -188,7 +188,7 @@

      Exceptions

      Logs a message if the dependency could not be found.

      - Source + Source

      @@ -197,7 +197,7 @@

      Exceptions

      Checks the lock for the given dependency and update its status accordingly.

      - Source + Source

      @@ -206,7 +206,7 @@

      Exceptions

      Returns all direct child dependencies.

      - Source + Source

      @@ -215,7 +215,7 @@

      Exceptions

      Returns all compile paths for the dependency.

      - Source + Source

      @@ -224,7 +224,7 @@

      Exceptions

      Returns all dependencies depending on given dependencies.

      - Source + Source

      @@ -233,7 +233,7 @@

      Exceptions

      Format the dependency for printing.

      - Source + Source

      @@ -242,7 +242,7 @@

      Exceptions

      Formats the status of a dependency.

      - Source + Source

      @@ -253,7 +253,7 @@

      Exceptions

      project into the project stack.

      - Source + Source

      @@ -262,7 +262,7 @@

      Exceptions

      Check if a dependency is part of an umbrella project as a top level project.

      - Source + Source

      @@ -271,7 +271,7 @@

      Exceptions

      Returns all load paths for the dependency.

      - Source + Source

      @@ -280,7 +280,7 @@

      Exceptions

      Returns true if dependency is a make project.

      - Source + Source

      @@ -289,7 +289,7 @@

      Exceptions

      Returns true if dependency is a mix project.

      - Source + Source

      @@ -298,7 +298,7 @@

      Exceptions

      Check if a dependency is ok.

      - Source + Source

      @@ -309,7 +309,7 @@

      Exceptions

      invoking this function.

      - Source + Source

      @@ -318,7 +318,7 @@

      Exceptions

      Returns true if dependency is a rebar project.

      - Source + Source

      @@ -327,7 +327,7 @@

      Exceptions

      Updates the dependency inside the given project.

      - Source + Source
      diff --git a/docs/stable/Mix.Error.html b/docs/stable/Mix.Error.html index 91cbab0f5..04a24e70f 100644 --- a/docs/stable/Mix.Error.html +++ b/docs/stable/Mix.Error.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/stable/Mix.Generator.html b/docs/stable/Mix.Generator.html index 2298c993e..b3b41d818 100644 --- a/docs/stable/Mix.Generator.html +++ b/docs/stable/Mix.Generator.html @@ -32,7 +32,7 @@

      - Source + Source @@ -89,7 +89,7 @@

      Functions

      Creates a directory if one does not exist yet.

      - Source + Source

      @@ -99,7 +99,7 @@

      Functions

      If the file already exists, asks for user confirmation.

      - Source + Source @@ -124,7 +124,7 @@

      Macros

      For more information, check EEx.SmartEngine.

      - Source + Source

      @@ -136,7 +136,7 @@

      Macros

      _text that expects no argument.

      - Source + Source

      @@ -150,7 +150,7 @@

      Macros

      - Source + Source diff --git a/docs/stable/Mix.InvalidTaskError.html b/docs/stable/Mix.InvalidTaskError.html index 15e4c4e1a..016477ca1 100644 --- a/docs/stable/Mix.InvalidTaskError.html +++ b/docs/stable/Mix.InvalidTaskError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -77,7 +77,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Local.html b/docs/stable/Mix.Local.html index db5a09937..89ac247a4 100644 --- a/docs/stable/Mix.Local.html +++ b/docs/stable/Mix.Local.html @@ -32,7 +32,7 @@

      - Source + Source @@ -79,7 +79,7 @@

      Functions

      Returns all tasks modules in .mix/tasks.

      - Source + Source

      @@ -88,7 +88,7 @@

      Functions

      Append mix paths into Erlang code path.

      - Source + Source

      @@ -97,7 +97,7 @@

      Functions

      Append local tasks path into Erlang code path.

      - Source + Source

      @@ -106,7 +106,7 @@

      Functions

      The path for local tasks.

      - Source + Source
      diff --git a/docs/stable/Mix.NoProjectError.html b/docs/stable/Mix.NoProjectError.html index 90b783d18..34bf17bbe 100644 --- a/docs/stable/Mix.NoProjectError.html +++ b/docs/stable/Mix.NoProjectError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/stable/Mix.NoTaskError.html b/docs/stable/Mix.NoTaskError.html index bc60525c6..ce8ccae87 100644 --- a/docs/stable/Mix.NoTaskError.html +++ b/docs/stable/Mix.NoTaskError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -77,7 +77,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.OutOfDateDepsError.html b/docs/stable/Mix.OutOfDateDepsError.html index 4e8977731..7cc86e8cd 100644 --- a/docs/stable/Mix.OutOfDateDepsError.html +++ b/docs/stable/Mix.OutOfDateDepsError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -77,7 +77,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Project.html b/docs/stable/Mix.Project.html index c11a11286..940a01bab 100644 --- a/docs/stable/Mix.Project.html +++ b/docs/stable/Mix.Project.html @@ -61,7 +61,7 @@

      Examples

      - Source + Source @@ -143,7 +143,7 @@

      Functions

      Returns the path to the apps directory.

      - Source + Source

      @@ -152,7 +152,7 @@

      Functions

      Returns the paths this project compiles to.

      - Source + Source

      @@ -162,7 +162,7 @@

      Functions

      considering the current environment.

      - Source + Source

      @@ -171,7 +171,7 @@

      Functions

      Returns a list of project config files (mix.exs and mix.lock).

      - Source + Source

      @@ -188,7 +188,7 @@

      Functions

      Returns nil if no project.

      - Source + Source

      @@ -197,7 +197,7 @@

      Functions

      Same as get/0 but raises an exception if no project.

      - Source + Source

      @@ -208,7 +208,7 @@

      Functions

      into the project stack.

      - Source + Source

      @@ -217,7 +217,7 @@

      Functions

      Returns all load paths for this project.

      - Source + Source

      @@ -231,7 +231,7 @@

      Functions

      if it is an umbrella project or not.

      - Source + Source

      @@ -241,7 +241,7 @@

      Functions

      when the environment changes during a task.

      - Source + Source

      @@ -250,7 +250,7 @@

      Functions

      Returns true if project is an umbrella project.

      - Source + Source
      diff --git a/docs/stable/Mix.SCM.html b/docs/stable/Mix.SCM.html index cfa0ecd0f..0dac3796d 100644 --- a/docs/stable/Mix.SCM.html +++ b/docs/stable/Mix.SCM.html @@ -35,7 +35,7 @@

      - Source + Source @@ -127,7 +127,7 @@

      Functions

      Returns all available SCM.

      - Source + Source

      @@ -136,7 +136,7 @@

      Functions

      Register the scm repository with the given key and mod.

      - Source + Source

      @@ -145,7 +145,7 @@

      Functions

      Register builtin SCMs.

      - Source + Source
      @@ -163,7 +163,7 @@

      Callbacks

      This behavior function should clean the given dependency.

      - Source + Source

      @@ -174,7 +174,7 @@

      Callbacks

      same SCM.

      - Source + Source

      @@ -186,7 +186,7 @@

      Callbacks

      return true.

      - Source + Source

      @@ -202,7 +202,7 @@

      Callbacks

      It must return the current lock.

      - Source + Source

      @@ -216,7 +216,7 @@

      Callbacks

      to the latest version.

      - Source + Source

      @@ -226,7 +226,7 @@

      Callbacks

      dependency is available.

      - Source + Source

      @@ -246,7 +246,7 @@

      Callbacks

      while other SCMs would simply return nil.

      - Source + Source

      @@ -256,7 +256,7 @@

      Callbacks

      lock information for printing.

      - Source + Source

      @@ -266,7 +266,7 @@

      Callbacks

      information for printing.

      - Source + Source diff --git a/docs/stable/Mix.Shell.IO.html b/docs/stable/Mix.Shell.IO.html index 000fdca99..1814f48f4 100644 --- a/docs/stable/Mix.Shell.IO.html +++ b/docs/stable/Mix.Shell.IO.html @@ -33,7 +33,7 @@

      - Source + Source @@ -86,7 +86,7 @@

      Functions

      to stdout as it comes.

      - Source + Source

      @@ -95,7 +95,7 @@

      Functions

      Writes an error message to the shell followed by new line.

      - Source + Source

      @@ -104,7 +104,7 @@

      Functions

      Writes a message to the shell followed by new line.

      - Source + Source

      @@ -112,7 +112,7 @@

      Functions

      - Source + Source

      @@ -123,7 +123,7 @@

      Functions

      regex %r/^Y(es)?$/i.

      - Source + Source diff --git a/docs/stable/Mix.Shell.Process.html b/docs/stable/Mix.Shell.Process.html index d1ee79352..833f01f3c 100644 --- a/docs/stable/Mix.Shell.Process.html +++ b/docs/stable/Mix.Shell.Process.html @@ -45,7 +45,7 @@

      - Source + Source @@ -103,7 +103,7 @@

      Functions

      the current process.

      - Source + Source

      @@ -112,7 +112,7 @@

      Functions

      Simply forwards the message to the current process.

      - Source + Source

      @@ -127,7 +127,7 @@

      Examples

      - Source + Source

      @@ -136,7 +136,7 @@

      Examples

      Simply forwards the message to the current process.

      - Source + Source

      @@ -144,7 +144,7 @@

      Examples

      - Source + Source

      @@ -160,7 +160,7 @@

      Examples

      process input given. Value must be true or false.

      - Source + Source diff --git a/docs/stable/Mix.Shell.html b/docs/stable/Mix.Shell.html index 79783e409..abe8b4db8 100644 --- a/docs/stable/Mix.Shell.html +++ b/docs/stable/Mix.Shell.html @@ -34,7 +34,7 @@

      - Source + Source @@ -97,7 +97,7 @@

      Functions

      is shared accross different shells.

      - Source + Source

      @@ -106,7 +106,7 @@

      Functions

      Returns if we should output application name to shell.

      - Source + Source
      @@ -125,7 +125,7 @@

      Callbacks

      its exit status.

      - Source + Source

      @@ -134,7 +134,7 @@

      Callbacks

      Asks the user for confirmation.

      - Source + Source

      @@ -143,7 +143,7 @@

      Callbacks

      Warns about the given error message.

      - Source + Source

      @@ -152,7 +152,7 @@

      Callbacks

      Informs the given message.

      - Source + Source
      diff --git a/docs/stable/Mix.Task.html b/docs/stable/Mix.Task.html index c56cd9c7f..43bb6e93c 100644 --- a/docs/stable/Mix.Task.html +++ b/docs/stable/Mix.Task.html @@ -34,7 +34,7 @@

      - Source + Source @@ -127,7 +127,7 @@

      Functions

      won't show up. Check load_all/0 if you want to preload all tasks.

      - Source + Source

      @@ -137,7 +137,7 @@

      Functions

      Returns an ordset with all the tasks invoked thus far.

      - Source + Source

      @@ -153,7 +153,7 @@

      Exceptions

      - Source + Source

      @@ -162,7 +162,7 @@

      Exceptions

      Checks if the task is hidden or not. Returns a boolean.

      - Source + Source

      @@ -171,7 +171,7 @@

      Exceptions

      Loads all tasks in all code paths.

      - Source + Source

      @@ -181,7 +181,7 @@

      Exceptions

      Returns the moduledoc or nil.

      - Source + Source

      @@ -190,7 +190,7 @@

      Exceptions

      Checks if the task is defined for umbrella projects.

      - Source + Source

      @@ -200,7 +200,7 @@

      Exceptions

      an umbrella project reenables a task it is reenabled for all sub projects.

      - Source + Source

      @@ -217,7 +217,7 @@

      Exceptions

      or it is invalid. Check get/2 for more information.

      - Source + Source

      @@ -227,7 +227,7 @@

      Exceptions

      Returns the shortdoc or nil.

      - Source + Source

      @@ -236,7 +236,7 @@

      Exceptions

      Returns the task name for the given module.

      - Source + Source
      @@ -255,7 +255,7 @@

      Callbacks

      a list of command line args.

      - Source + Source diff --git a/docs/stable/Mix.Tasks.App.Start.html b/docs/stable/Mix.Tasks.App.Start.html index 159725882..0c29ecda9 100644 --- a/docs/stable/Mix.Tasks.App.Start.html +++ b/docs/stable/Mix.Tasks.App.Start.html @@ -40,7 +40,7 @@

      Command line options

      - Source + Source @@ -71,7 +71,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Tasks.Clean.html b/docs/stable/Mix.Tasks.Clean.html index 740571f0f..9ec3890cd 100644 --- a/docs/stable/Mix.Tasks.Clean.html +++ b/docs/stable/Mix.Tasks.Clean.html @@ -38,7 +38,7 @@

      Command line options

      - Source + Source @@ -69,7 +69,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Tasks.Compile.App.html b/docs/stable/Mix.Tasks.Compile.App.html index 926eb51b7..715c31577 100644 --- a/docs/stable/Mix.Tasks.Compile.App.html +++ b/docs/stable/Mix.Tasks.Compile.App.html @@ -56,7 +56,7 @@

      Configuration

      - Source + Source @@ -87,7 +87,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Tasks.Compile.Elixir.html b/docs/stable/Mix.Tasks.Compile.Elixir.html index 6f99f721e..197840526 100644 --- a/docs/stable/Mix.Tasks.Compile.Elixir.html +++ b/docs/stable/Mix.Tasks.Compile.Elixir.html @@ -82,7 +82,7 @@

      Configuration

      - Source + Source @@ -113,7 +113,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Tasks.Compile.Erlang.html b/docs/stable/Mix.Tasks.Compile.Erlang.html index d0e567aa0..0e2a8b450 100644 --- a/docs/stable/Mix.Tasks.Compile.Erlang.html +++ b/docs/stable/Mix.Tasks.Compile.Erlang.html @@ -72,7 +72,7 @@

      Configuration

      - Source + Source @@ -123,7 +123,7 @@

      Functions

      extension.

      - Source + Source

      @@ -132,7 +132,7 @@

      Functions

      Interprets compilation results and prints them to the console.

      - Source + Source

      @@ -140,7 +140,7 @@

      Functions

      - Source + Source

      @@ -150,7 +150,7 @@

      Functions

      Erlang compilation tools.

      - Source + Source diff --git a/docs/stable/Mix.Tasks.Compile.Leex.html b/docs/stable/Mix.Tasks.Compile.Leex.html index f10cb3b35..98fc614d2 100644 --- a/docs/stable/Mix.Tasks.Compile.Leex.html +++ b/docs/stable/Mix.Tasks.Compile.Leex.html @@ -56,7 +56,7 @@

      Configuration

      - Source + Source @@ -87,7 +87,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Tasks.Compile.Yecc.html b/docs/stable/Mix.Tasks.Compile.Yecc.html index 81a7d285e..d1f6bde6f 100644 --- a/docs/stable/Mix.Tasks.Compile.Yecc.html +++ b/docs/stable/Mix.Tasks.Compile.Yecc.html @@ -56,7 +56,7 @@

      Configuration

      - Source + Source @@ -87,7 +87,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Tasks.Compile.html b/docs/stable/Mix.Tasks.Compile.html index 2c374684e..ee3975dce 100644 --- a/docs/stable/Mix.Tasks.Compile.html +++ b/docs/stable/Mix.Tasks.Compile.html @@ -66,7 +66,7 @@

      Common configuration

      - Source + Source @@ -97,7 +97,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Tasks.Deps.Check.html b/docs/stable/Mix.Tasks.Deps.Check.html index 4b74d4f5c..384f55d29 100644 --- a/docs/stable/Mix.Tasks.Deps.Check.html +++ b/docs/stable/Mix.Tasks.Deps.Check.html @@ -36,7 +36,7 @@

      - Source + Source @@ -67,7 +67,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Tasks.Deps.Clean.html b/docs/stable/Mix.Tasks.Deps.Clean.html index 98c8a14d8..abde4363c 100644 --- a/docs/stable/Mix.Tasks.Deps.Clean.html +++ b/docs/stable/Mix.Tasks.Deps.Clean.html @@ -36,7 +36,7 @@

      - Source + Source @@ -67,7 +67,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Tasks.Deps.Compile.html b/docs/stable/Mix.Tasks.Deps.Compile.html index 409e067ab..b843509f0 100644 --- a/docs/stable/Mix.Tasks.Deps.Compile.html +++ b/docs/stable/Mix.Tasks.Deps.Compile.html @@ -50,7 +50,7 @@

      - Source + Source @@ -81,7 +81,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Tasks.Deps.Get.html b/docs/stable/Mix.Tasks.Deps.Get.html index 9eede311b..bbfe25d8b 100644 --- a/docs/stable/Mix.Tasks.Deps.Get.html +++ b/docs/stable/Mix.Tasks.Deps.Get.html @@ -40,7 +40,7 @@

      Command line options

      - Source + Source @@ -71,7 +71,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Tasks.Deps.Loadpaths.html b/docs/stable/Mix.Tasks.Deps.Loadpaths.html index cf1c12e35..dd0a2e92f 100644 --- a/docs/stable/Mix.Tasks.Deps.Loadpaths.html +++ b/docs/stable/Mix.Tasks.Deps.Loadpaths.html @@ -33,7 +33,7 @@

      - Source + Source @@ -64,7 +64,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Tasks.Deps.Unlock.html b/docs/stable/Mix.Tasks.Deps.Unlock.html index 29556f4e2..cc536ad46 100644 --- a/docs/stable/Mix.Tasks.Deps.Unlock.html +++ b/docs/stable/Mix.Tasks.Deps.Unlock.html @@ -33,7 +33,7 @@

      - Source + Source @@ -64,7 +64,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Tasks.Deps.Update.html b/docs/stable/Mix.Tasks.Deps.Update.html index 4a15bb461..45a245eb7 100644 --- a/docs/stable/Mix.Tasks.Deps.Update.html +++ b/docs/stable/Mix.Tasks.Deps.Update.html @@ -42,7 +42,7 @@

      Command line options

      - Source + Source @@ -73,7 +73,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Tasks.Deps.html b/docs/stable/Mix.Tasks.Deps.html index 628eaca8f..5524a94a1 100644 --- a/docs/stable/Mix.Tasks.Deps.html +++ b/docs/stable/Mix.Tasks.Deps.html @@ -39,7 +39,7 @@

      - Source + Source @@ -70,7 +70,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Tasks.Do.html b/docs/stable/Mix.Tasks.Do.html index 78c9ca75f..0c1ac0f7b 100644 --- a/docs/stable/Mix.Tasks.Do.html +++ b/docs/stable/Mix.Tasks.Do.html @@ -40,7 +40,7 @@

      Examples

      - Source + Source @@ -71,7 +71,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Tasks.Escriptize.html b/docs/stable/Mix.Tasks.Escriptize.html index bfefce2b3..bfb30e163 100644 --- a/docs/stable/Mix.Tasks.Escriptize.html +++ b/docs/stable/Mix.Tasks.Escriptize.html @@ -63,7 +63,7 @@

      Configuration

      - Source + Source @@ -94,7 +94,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Tasks.Help.html b/docs/stable/Mix.Tasks.Help.html index 6fa36d35c..978e0a427 100644 --- a/docs/stable/Mix.Tasks.Help.html +++ b/docs/stable/Mix.Tasks.Help.html @@ -40,7 +40,7 @@

      Arguments

      - Source + Source @@ -71,7 +71,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Tasks.Loadpaths.html b/docs/stable/Mix.Tasks.Loadpaths.html index bc7b95827..b5380733a 100644 --- a/docs/stable/Mix.Tasks.Loadpaths.html +++ b/docs/stable/Mix.Tasks.Loadpaths.html @@ -39,7 +39,7 @@

      Configuration

      - Source + Source @@ -70,7 +70,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Tasks.Local.Install.html b/docs/stable/Mix.Tasks.Local.Install.html index 6e0346f2a..0896882cb 100644 --- a/docs/stable/Mix.Tasks.Local.Install.html +++ b/docs/stable/Mix.Tasks.Local.Install.html @@ -43,7 +43,7 @@

      - Source + Source @@ -74,7 +74,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Tasks.Local.Rebar.html b/docs/stable/Mix.Tasks.Local.Rebar.html index d331b0d3e..f34b2b55e 100644 --- a/docs/stable/Mix.Tasks.Local.Rebar.html +++ b/docs/stable/Mix.Tasks.Local.Rebar.html @@ -36,7 +36,7 @@

      - Source + Source @@ -73,7 +73,7 @@

      Functions

      Return the path to the local copy of rebar. Used when building deps

      - Source + Source

      @@ -81,7 +81,7 @@

      Functions

      - Source + Source
      diff --git a/docs/stable/Mix.Tasks.Local.Uninstall.html b/docs/stable/Mix.Tasks.Local.Uninstall.html index 12aef7faf..c837a7c02 100644 --- a/docs/stable/Mix.Tasks.Local.Uninstall.html +++ b/docs/stable/Mix.Tasks.Local.Uninstall.html @@ -35,7 +35,7 @@

      - Source + Source @@ -66,7 +66,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Tasks.Local.html b/docs/stable/Mix.Tasks.Local.html index 09396ced5..0e351a949 100644 --- a/docs/stable/Mix.Tasks.Local.html +++ b/docs/stable/Mix.Tasks.Local.html @@ -32,7 +32,7 @@

      - Source + Source @@ -63,7 +63,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Tasks.New.html b/docs/stable/Mix.Tasks.New.html index ccbe544c5..c70450c50 100644 --- a/docs/stable/Mix.Tasks.New.html +++ b/docs/stable/Mix.Tasks.New.html @@ -62,7 +62,7 @@

      Examples

      - Source + Source @@ -93,7 +93,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Tasks.Run.html b/docs/stable/Mix.Tasks.Run.html index 14977ee0c..f0b65552c 100644 --- a/docs/stable/Mix.Tasks.Run.html +++ b/docs/stable/Mix.Tasks.Run.html @@ -56,7 +56,7 @@

      Examples

      - Source + Source @@ -87,7 +87,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Tasks.Test.html b/docs/stable/Mix.Tasks.Test.html index 7b3931837..69687d302 100644 --- a/docs/stable/Mix.Tasks.Test.html +++ b/docs/stable/Mix.Tasks.Test.html @@ -65,7 +65,7 @@

      Configuration

      - Source + Source @@ -96,7 +96,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Utils.html b/docs/stable/Mix.Utils.html index 681608363..dee7a31dc 100644 --- a/docs/stable/Mix.Utils.html +++ b/docs/stable/Mix.Utils.html @@ -43,7 +43,7 @@

      Conversions

      - Source + Source @@ -150,7 +150,7 @@

      Examples

      - Source + Source

      @@ -170,7 +170,7 @@

      Examples

      - Source + Source

      @@ -185,7 +185,7 @@

      Examples

      - Source + Source

      @@ -195,7 +195,7 @@

      Examples

      and concatenating normal lists.

      - Source + Source

      @@ -208,7 +208,7 @@

      Examples

      When looking up directories, files starting with "." are ignored.

      - Source + Source

      @@ -217,7 +217,7 @@

      Examples

      Extract all stale sources compared to the given targets.

      - Source + Source

      @@ -230,7 +230,7 @@

      Examples

      the files removed from the manifest file.

      - Source + Source

      @@ -240,7 +240,7 @@

      Examples

      MIX_HOME environment variable is set.

      - Source + Source

      @@ -252,7 +252,7 @@

      Examples

      use :.

      - Source + Source

      @@ -272,7 +272,7 @@

      Examples

      - Source + Source

      @@ -282,7 +282,7 @@

      Examples

      Used by local.install and local.rebar.

      - Source + Source

      @@ -292,7 +292,7 @@

      Examples

      working directory.

      - Source + Source

      @@ -301,7 +301,7 @@

      Examples

      Gets the source location of a module as a binary.

      - Source + Source

      @@ -311,7 +311,7 @@

      Examples

      compared to the given target.

      - Source + Source

      @@ -337,7 +337,7 @@

      Examples

      - Source + Source diff --git a/docs/stable/Mix.html b/docs/stable/Mix.html index 0a33689f7..3298e02f7 100644 --- a/docs/stable/Mix.html +++ b/docs/stable/Mix.html @@ -40,7 +40,7 @@

      - Source + Source @@ -102,7 +102,7 @@

      Functions

      Returns the mix environment.

      - Source + Source

      @@ -112,7 +112,7 @@

      Functions

      per environment is not going to be reloaded.

      - Source + Source

      @@ -122,7 +122,7 @@

      Functions

      one step. Useful when invoking mix from an external tool.

      - Source + Source

      @@ -134,7 +134,7 @@

      Functions

      tasks to work without a need for an underlying project.

      - Source + Source

      @@ -148,7 +148,7 @@

      Functions

      messages to the current process.

      - Source + Source

      @@ -157,7 +157,7 @@

      Functions

      Sets the current shell.

      - Source + Source

      @@ -165,7 +165,7 @@

      Functions

      - Source + Source
      diff --git a/docs/stable/Module.html b/docs/stable/Module.html index 63dc2152d..ba65c2703 100644 --- a/docs/stable/Module.html +++ b/docs/stable/Module.html @@ -39,7 +39,7 @@

      - Source + Source @@ -178,7 +178,7 @@

      Examples

      - Source + Source

      @@ -198,7 +198,7 @@

      Examples

      - Source + Source

      @@ -218,7 +218,7 @@

      Examples

      - Source + Source

      @@ -254,7 +254,7 @@

      Differences with defmodule

      shares the same environment.

      - Source + Source

      @@ -273,7 +273,7 @@

      Examples

      - Source + Source

      @@ -293,7 +293,7 @@

      Examples

      - Source + Source

      @@ -310,7 +310,7 @@

      Examples

      - Source + Source

      @@ -329,7 +329,7 @@

      Examples

      - Source + Source

      @@ -346,16 +346,16 @@

      Examples

      - Source + Source

      eval_quoted(module, quoted, binding // [], opts // [])

      -

      Evalutes the quotes contents in the given module context.

      +

      Evaluates the quoted contents in the given module's context.

      A list of environment options can also be given as argument. -Check Code.eval_string for more information.

      +See Code.eval_string for more information.

      Raises an error if the module was already compiled.

      @@ -381,7 +381,7 @@

      Examples

      - Source + Source

      @@ -404,7 +404,7 @@

      Examples

      - Source + Source

      @@ -415,7 +415,7 @@

      Examples

      developer to customize it.

      - Source + Source

      @@ -425,7 +425,7 @@

      Examples

      and its attributes and functions can be modified.

      - Source + Source

      @@ -434,7 +434,7 @@

      Examples

      Returns true if the given tuple in module is marked as overridable.

      - Source + Source

      @@ -452,7 +452,7 @@

      Examples

      - Source + Source

      @@ -492,7 +492,7 @@

      Examples

      - Source + Source

      @@ -513,7 +513,7 @@

      Examples

      - Source + Source

      @@ -534,7 +534,7 @@

      Examples

      - Source + Source

      @@ -549,7 +549,7 @@

      Examples

      - Source + Source

      @@ -558,7 +558,7 @@

      Examples

      Convert a module name to binary without the Elixir prefix.

      - Source + Source
      diff --git a/docs/stable/Node.html b/docs/stable/Node.html index 83b717590..10ee09261 100644 --- a/docs/stable/Node.html +++ b/docs/stable/Node.html @@ -32,7 +32,7 @@

      - Source + Source @@ -140,7 +140,7 @@

      Functions

      part of a distributed system. Otherwise, it returns false.

      - Source + Source

      @@ -153,7 +153,7 @@

      Functions

      See http://erlang.org/doc/man/net_kernel.html#connect_node-1 for more info.

      - Source + Source

      @@ -167,7 +167,7 @@

      Functions

      See http://www.erlang.org/doc/man/erlang.html#disconnect_node-1 for more info.

      - Source + Source

      @@ -177,7 +177,7 @@

      Functions

      otherwise :nocookie.

      - Source + Source

      @@ -187,7 +187,7 @@

      Functions

      the local node. Same as list(visible).

      - Source + Source

      @@ -200,7 +200,7 @@

      Functions

      See http://www.erlang.org/doc/man/erlang.html#nodes-1 for more info.

      - Source + Source

      @@ -212,7 +212,7 @@

      Functions

      See http://www.erlang.org/doc/man/erlang.html#monitor_node-2 for more info.

      - Source + Source

      @@ -224,7 +224,7 @@

      Functions

      See http://www.erlang.org/doc/man/erlang.html#monitor_node-3 for more info.

      - Source + Source

      @@ -233,7 +233,7 @@

      Functions

      Returns the current node. It returns the same as the built-in node().

      - Source + Source

      @@ -246,7 +246,7 @@

      Functions

      This function will raise FunctionClauseError if the given node is not alive.

      - Source + Source

      @@ -259,7 +259,7 @@

      Functions

      the list of available options.

      - Source + Source

      @@ -272,7 +272,7 @@

      Functions

      the list of available options.

      - Source + Source

      @@ -286,7 +286,7 @@

      Functions

      the list of available options.

      - Source + Source

      @@ -300,7 +300,7 @@

      Functions

      the list of available options.

      - Source + Source

      @@ -313,7 +313,7 @@

      Functions

      received).

      - Source + Source

      @@ -326,7 +326,7 @@

      Functions

      :noconnection will be received).

      - Source + Source diff --git a/docs/stable/OptionParser.html b/docs/stable/OptionParser.html index d4d34dca4..7ca0aa047 100644 --- a/docs/stable/OptionParser.html +++ b/docs/stable/OptionParser.html @@ -27,7 +27,7 @@

      - Source + Source @@ -123,7 +123,7 @@

      Negation switches

      - Source + Source

      @@ -141,7 +141,7 @@

      Example

      - Source + Source diff --git a/docs/stable/Path.html b/docs/stable/Path.html index 34cf657f1..9c7f577e6 100644 --- a/docs/stable/Path.html +++ b/docs/stable/Path.html @@ -41,7 +41,7 @@

      - Source + Source @@ -171,7 +171,7 @@

      Windows

      - Source + Source

      @@ -193,7 +193,7 @@

      Examples

      - Source + Source

      @@ -215,7 +215,7 @@

      Examples

      - Source + Source

      @@ -236,7 +236,7 @@

      Examples

      - Source + Source

      @@ -253,7 +253,7 @@

      Examples

      - Source + Source

      @@ -269,7 +269,7 @@

      Examples

      - Source + Source

      @@ -297,7 +297,7 @@

      Examples

      - Source + Source

      @@ -314,7 +314,7 @@

      Examples

      - Source + Source

      @@ -334,7 +334,7 @@

      Examples

      - Source + Source

      @@ -349,7 +349,7 @@

      Examples

      - Source + Source

      @@ -373,7 +373,7 @@

      Windows examples

      - Source + Source

      @@ -399,7 +399,7 @@

      Examples

      - Source + Source

      @@ -416,7 +416,7 @@

      Examples

      - Source + Source

      @@ -434,7 +434,7 @@

      Examples

      - Source + Source

      @@ -454,7 +454,7 @@

      Examples

      - Source + Source

      @@ -479,7 +479,7 @@

      Windows examples

      - Source + Source

      @@ -521,7 +521,7 @@

      Examples

      - Source + Source diff --git a/docs/stable/Port.html b/docs/stable/Port.html index 66e25c2ff..bac78d1b4 100644 --- a/docs/stable/Port.html +++ b/docs/stable/Port.html @@ -32,7 +32,7 @@

      - Source + Source @@ -104,7 +104,7 @@

      Functions

      - Source + Source

      @@ -167,7 +167,7 @@

      Functions

      - Source + Source
      diff --git a/docs/stable/Process.html b/docs/stable/Process.html index 880c3a5ea..be6b74670 100644 --- a/docs/stable/Process.html +++ b/docs/stable/Process.html @@ -37,7 +37,7 @@

      - Source + Source @@ -222,7 +222,7 @@

      Functions

      pid must refer to a process at the local node.

      - Source + Source

      @@ -231,7 +231,7 @@

      Functions

      Deletes all items in the dictionary.

      - Source + Source

      @@ -240,7 +240,7 @@

      Functions

      Deletes the given key from the dictionary.

      - Source + Source

      @@ -253,7 +253,7 @@

      Functions

      See http://www.erlang.org/doc/man/erlang.html#demonitor-2 for more info.

      - Source + Source

      @@ -282,7 +282,7 @@

      Examples

      - Source + Source

      @@ -294,7 +294,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#process_flag-2 for more info.

      - Source + Source

      @@ -307,7 +307,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#process_flag-3 for more info.

      - Source + Source

      @@ -316,7 +316,7 @@

      Examples

      Returns all key-values in the dictionary.

      - Source + Source

      @@ -325,7 +325,7 @@

      Examples

      Returns the value for the given key.

      - Source + Source

      @@ -334,7 +334,7 @@

      Examples

      Returns all keys that have the given value.

      - Source + Source

      @@ -343,7 +343,7 @@

      Examples

      Returns the pid of the group leader for the process which evaluates the function.

      - Source + Source

      @@ -353,7 +353,7 @@

      Examples

      started from a certain shell should have another group leader than :init.

      - Source + Source

      @@ -365,7 +365,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#process_info-1 for more info.

      - Source + Source

      @@ -377,7 +377,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#process_info-2 for more info.

      - Source + Source

      @@ -389,7 +389,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#link-1 for more info.

      - Source + Source

      @@ -405,7 +405,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#processes-0 for more info.

      - Source + Source

      @@ -417,7 +417,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#monitor-2 for more info.

      - Source + Source

      @@ -426,7 +426,7 @@

      Examples

      Stores the given key-value in the process dictionary.

      - Source + Source

      @@ -439,7 +439,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#register-2 for more info.

      - Source + Source

      @@ -448,7 +448,7 @@

      Examples

      Returns a list of names which have been registered using register/2.

      - Source + Source

      @@ -458,7 +458,7 @@

      Examples

      It behaves exactly the same as Kernel.spawn/1.

      - Source + Source

      @@ -470,7 +470,7 @@

      Examples

      check http://www.erlang.org/doc/man/erlang.html#spawn_opt-2

      - Source + Source

      @@ -483,7 +483,7 @@

      Examples

      It behaves exactly the same as the Kernel.spawn/3 function.

      - Source + Source

      @@ -497,7 +497,7 @@

      Examples

      check http://www.erlang.org/doc/man/erlang.html#spawn_opt-4

      - Source + Source

      @@ -508,7 +508,7 @@

      Examples

      process, atomically.

      - Source + Source

      @@ -519,7 +519,7 @@

      Examples

      and the new process, atomically. Otherwise works like spawn/3.

      - Source + Source

      @@ -529,7 +529,7 @@

      Examples

      and reference for a monitor created to the new process.

      - Source + Source

      @@ -540,7 +540,7 @@

      Examples

      reference for the monitor. Otherwise works like spawn/3.

      - Source + Source

      @@ -553,7 +553,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#unlink-1 for more info.

      - Source + Source

      @@ -564,7 +564,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#unregister-1 for more info.

      - Source + Source

      @@ -576,7 +576,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#whereis-1 for more info.

      - Source + Source diff --git a/docs/stable/Protocol.UndefinedError.html b/docs/stable/Protocol.UndefinedError.html index 0c7a6f389..2d22d7716 100644 --- a/docs/stable/Protocol.UndefinedError.html +++ b/docs/stable/Protocol.UndefinedError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -77,7 +77,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Range.Iterator.Number.html b/docs/stable/Range.Iterator.Number.html index f2dd17804..56f1ea908 100644 --- a/docs/stable/Range.Iterator.Number.html +++ b/docs/stable/Range.Iterator.Number.html @@ -29,7 +29,7 @@

      - Source + Source @@ -45,7 +45,7 @@

      Functions summary

    3228. - iterator/2 + reduce/4
    3229. @@ -65,15 +65,15 @@

      Functions

      - Source + Source
      -

      - iterator(first, arg2) +

      + reduce(first, arg2, acc, fun)

      - Source + Source
      diff --git a/docs/stable/Range.Iterator.html b/docs/stable/Range.Iterator.html index 24f96124e..43625f76d 100644 --- a/docs/stable/Range.Iterator.html +++ b/docs/stable/Range.Iterator.html @@ -29,7 +29,7 @@

      - Source + Source

      Implementations

      @@ -56,7 +56,7 @@

      Functions summary

    3230. - iterator/2 + reduce/4
    3231. @@ -77,20 +77,15 @@

      Functions

      Count how many items are in the range.

      - Source + Source
      -

      - iterator(first, range) +

      + reduce(first, range, acc, fun)

      -

      How to iterate the range, receives the first -and range as arguments. It needs to return a -function that receives an item and returns -a tuple with two elements: the given item -and the next item in the iteration.

      -
      +
      - Source + Source
      diff --git a/docs/stable/Range.html b/docs/stable/Range.html index 28c55082a..f2f533e1e 100644 --- a/docs/stable/Range.html +++ b/docs/stable/Range.html @@ -34,7 +34,7 @@

      - Source + Source diff --git a/docs/stable/Record.html b/docs/stable/Record.html index 74065ec48..3e0a70623 100644 --- a/docs/stable/Record.html +++ b/docs/stable/Record.html @@ -32,7 +32,7 @@

      - Source + Source @@ -109,7 +109,7 @@

      Examples

      - Source + Source

      @@ -127,7 +127,7 @@

      Examples

      - Source + Source

      @@ -139,7 +139,7 @@

      Examples

      for more information and documentation.

      - Source + Source

      @@ -151,7 +151,7 @@

      Examples

      so check it for more information and documentation.

      - Source + Source

      @@ -160,7 +160,7 @@

      Examples

      Defines types and specs for the record.

      - Source + Source

      @@ -175,7 +175,7 @@

      Examples

      - Source + Source @@ -205,7 +205,7 @@

      Example

      end

      - Source + Source diff --git a/docs/stable/Regex.CompileError.html b/docs/stable/Regex.CompileError.html index f4a673958..16b0810fa 100644 --- a/docs/stable/Regex.CompileError.html +++ b/docs/stable/Regex.CompileError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/stable/Regex.html b/docs/stable/Regex.html index 16f020d52..3d93a3181 100644 --- a/docs/stable/Regex.html +++ b/docs/stable/Regex.html @@ -77,7 +77,7 @@

      - Source + Source @@ -176,7 +176,7 @@

      Examples

      - Source + Source

      @@ -188,7 +188,7 @@

      Examples

      { :error, reason } otherwise.

      - Source + Source

      @@ -198,7 +198,7 @@

      Examples

      Fails with Regex.CompileError if the regex cannot be compiled.

      - Source + Source

      @@ -213,7 +213,7 @@

      Examples

      - Source + Source

      @@ -232,7 +232,7 @@

      Examples

      - Source + Source

      @@ -249,7 +249,7 @@

      Examples

      - Source + Source

      @@ -264,7 +264,7 @@

      Examples

      - Source + Source

      @@ -273,7 +273,7 @@

      Examples

      Returns the underlying re_pattern in the regular expression.

      - Source + Source

      @@ -302,7 +302,7 @@

      Examples

      - Source + Source

      @@ -321,7 +321,7 @@

      Examples

      - Source + Source

      @@ -343,7 +343,7 @@

      Examples

      - Source + Source

      @@ -358,7 +358,7 @@

      Examples

      - Source + Source

      @@ -368,7 +368,7 @@

      Examples

      If no ammount of parts is given, it defaults to :infinity.

      - Source + Source diff --git a/docs/stable/RuntimeError.html b/docs/stable/RuntimeError.html index d2f858b30..4b4b46e60 100644 --- a/docs/stable/RuntimeError.html +++ b/docs/stable/RuntimeError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/stable/String.html b/docs/stable/String.html index 73051ca2d..bef1750a0 100644 --- a/docs/stable/String.html +++ b/docs/stable/String.html @@ -139,7 +139,7 @@

      Self-synchronization

      - Source + Source @@ -321,7 +321,7 @@

      Examples

      - Source + Source

      @@ -346,7 +346,7 @@

      Examples

      - Source + Source

      @@ -365,7 +365,7 @@

      Examples

      - Source + Source

      @@ -384,7 +384,7 @@

      Examples

      - Source + Source

      @@ -401,7 +401,7 @@

      Examples

      - Source + Source

      @@ -419,7 +419,7 @@

      Examples

      - Source + Source

      @@ -434,7 +434,7 @@

      Examples

      - Source + Source

      @@ -452,7 +452,7 @@

      Examples

      - Source + Source

      @@ -469,7 +469,7 @@

      Examples

      - Source + Source

      @@ -485,7 +485,7 @@

      Examples

      - Source + Source

      @@ -500,7 +500,7 @@

      Examples

      - Source + Source

      @@ -524,7 +524,7 @@

      Examples

      - Source + Source

      @@ -543,7 +543,7 @@

      Examples

      - Source + Source

      @@ -559,7 +559,7 @@

      Examples

      - Source + Source

      @@ -588,7 +588,7 @@

      Examples

      - Source + Source

      @@ -604,7 +604,7 @@

      Examples

      - Source + Source

      @@ -619,7 +619,7 @@

      Examples

      - Source + Source

      @@ -650,7 +650,7 @@

      Examples

      - Source + Source

      @@ -670,7 +670,7 @@

      Examples

      - Source + Source

      @@ -702,7 +702,7 @@

      Examples

      - Source + Source

      @@ -718,7 +718,7 @@

      Examples

      - Source + Source

      @@ -734,7 +734,7 @@

      Examples

      - Source + Source

      @@ -759,7 +759,7 @@

      Examples

      :error

      - Source + Source

      @@ -780,7 +780,7 @@

      Examples

      - Source + Source

      @@ -799,7 +799,7 @@

      Examples

      - Source + Source

      @@ -820,7 +820,7 @@

      Examples

      - Source + Source

      @@ -845,7 +845,7 @@

      Examples

      - Source + Source

      @@ -869,7 +869,7 @@

      Examples

      - Source + Source diff --git a/docs/stable/Supervisor.Behaviour.html b/docs/stable/Supervisor.Behaviour.html index 118b17a41..e7a9b6796 100644 --- a/docs/stable/Supervisor.Behaviour.html +++ b/docs/stable/Supervisor.Behaviour.html @@ -58,7 +58,7 @@

      Example

      - Source + Source @@ -138,7 +138,7 @@

      Strategies

      - Source + Source

      @@ -201,7 +201,7 @@

      Shutdown values

      - Source + Source

      @@ -264,7 +264,7 @@

      Shutdown values

      - Source + Source diff --git a/docs/stable/SyntaxError.html b/docs/stable/SyntaxError.html index cbf341f50..beb2e20a3 100644 --- a/docs/stable/SyntaxError.html +++ b/docs/stable/SyntaxError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -83,7 +83,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/System.NoAccessCwdError.html b/docs/stable/System.NoAccessCwdError.html index ab34d3aeb..75f526dc7 100644 --- a/docs/stable/System.NoAccessCwdError.html +++ b/docs/stable/System.NoAccessCwdError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/stable/System.NoHomeError.html b/docs/stable/System.NoHomeError.html index aa0db634d..b033ac23b 100644 --- a/docs/stable/System.NoHomeError.html +++ b/docs/stable/System.NoHomeError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/stable/System.NoTmpDirError.html b/docs/stable/System.NoTmpDirError.html index 8acb2f144..3d278256f 100644 --- a/docs/stable/System.NoTmpDirError.html +++ b/docs/stable/System.NoTmpDirError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/stable/System.html b/docs/stable/System.html index ddceecccb..e1ea49c2f 100644 --- a/docs/stable/System.html +++ b/docs/stable/System.html @@ -34,7 +34,7 @@

      - Source + Source @@ -156,7 +156,7 @@

      Functions

      Returns the list of command-line arguments passed to the program.

      - Source + Source

      @@ -170,7 +170,7 @@

      Functions

      as argument.

      - Source + Source

      @@ -179,7 +179,7 @@

      Functions

      Returns a keywords list with version, git tag info and date.

      - Source + Source

      @@ -193,7 +193,7 @@

      Functions

      Returns a binary otherwise.

      - Source + Source

      @@ -203,7 +203,7 @@

      Functions

      is not available.

      - Source + Source

      @@ -212,7 +212,7 @@

      Functions

      Returns the current working directory or raises System.NoAccessCwdError.

      - Source + Source

      @@ -226,7 +226,7 @@

      Functions

      Returns a binary otherwise.

      - Source + Source

      @@ -237,7 +237,7 @@

      Functions

      name of the variable and Value its value.

      - Source + Source

      @@ -248,7 +248,7 @@

      Functions

      variable is undefined.

      - Source + Source

      @@ -260,7 +260,7 @@

      Functions

      See http://www.erlang.org/doc/man/os.html#getpid-0 for more info.

      - Source + Source

      @@ -296,7 +296,7 @@

      Examples

      - Source + Source

      @@ -306,7 +306,7 @@

      Examples

      to each key in dict.

      - Source + Source

      @@ -315,7 +315,7 @@

      Examples

      Sets a new value for the environment variable varname.

      - Source + Source

      @@ -328,7 +328,7 @@

      Examples

      latest exception.

      - Source + Source

      @@ -348,7 +348,7 @@

      Examples

      Returns nil if none of the above are writable.

      - Source + Source

      @@ -358,7 +358,7 @@

      Examples

      instead of returning nil if no temp dir is set.

      - Source + Source

      @@ -368,7 +368,7 @@

      Examples

      It returns nil if no user home is set.

      - Source + Source

      @@ -378,7 +378,7 @@

      Examples

      instead of returning nil if no user home is set.

      - Source + Source

      @@ -387,7 +387,7 @@

      Examples

      Returns Elixir's version as binary.

      - Source + Source
      diff --git a/docs/stable/SystemLimitError.html b/docs/stable/SystemLimitError.html index 106ae4003..d17ce8dae 100644 --- a/docs/stable/SystemLimitError.html +++ b/docs/stable/SystemLimitError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/stable/TokenMissingError.html b/docs/stable/TokenMissingError.html index 1e1b00815..2f3f2efc6 100644 --- a/docs/stable/TokenMissingError.html +++ b/docs/stable/TokenMissingError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -83,7 +83,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/URI.FTP.html b/docs/stable/URI.FTP.html index 0e56ce9cf..8e12288b1 100644 --- a/docs/stable/URI.FTP.html +++ b/docs/stable/URI.FTP.html @@ -27,7 +27,7 @@

      - Source + Source @@ -63,7 +63,7 @@

      Functions

      - Source + Source

      @@ -71,7 +71,7 @@

      Functions

      - Source + Source
      diff --git a/docs/stable/URI.HTTP.html b/docs/stable/URI.HTTP.html index cb2402140..0c5bce2bd 100644 --- a/docs/stable/URI.HTTP.html +++ b/docs/stable/URI.HTTP.html @@ -27,7 +27,7 @@

      - Source + Source @@ -63,7 +63,7 @@

      Functions

      - Source + Source

      @@ -71,7 +71,7 @@

      Functions

      - Source + Source
      diff --git a/docs/stable/URI.HTTPS.html b/docs/stable/URI.HTTPS.html index 4f9f37eb1..a20e475c1 100644 --- a/docs/stable/URI.HTTPS.html +++ b/docs/stable/URI.HTTPS.html @@ -27,7 +27,7 @@

      - Source + Source @@ -63,7 +63,7 @@

      Functions

      - Source + Source

      @@ -71,7 +71,7 @@

      Functions

      - Source + Source
      diff --git a/docs/stable/URI.LDAP.html b/docs/stable/URI.LDAP.html index e2f274e11..c5e3606c2 100644 --- a/docs/stable/URI.LDAP.html +++ b/docs/stable/URI.LDAP.html @@ -27,7 +27,7 @@

      - Source + Source @@ -63,7 +63,7 @@

      Functions

      - Source + Source

      @@ -71,7 +71,7 @@

      Functions

      - Source + Source
      diff --git a/docs/stable/URI.Parser.html b/docs/stable/URI.Parser.html index 10fb4d5e8..b852a0500 100644 --- a/docs/stable/URI.Parser.html +++ b/docs/stable/URI.Parser.html @@ -35,7 +35,7 @@

      - Source + Source @@ -76,7 +76,7 @@

      Callbacks

      Responsible for returning the default port.

      - Source + Source

      @@ -85,7 +85,7 @@

      Callbacks

      Responsible for parsing extra URL information.

      - Source + Source
      diff --git a/docs/stable/URI.SFTP.html b/docs/stable/URI.SFTP.html index fa6cd87c6..d05ec23b4 100644 --- a/docs/stable/URI.SFTP.html +++ b/docs/stable/URI.SFTP.html @@ -27,7 +27,7 @@

      - Source + Source @@ -63,7 +63,7 @@

      Functions

      - Source + Source

      @@ -71,7 +71,7 @@

      Functions

      - Source + Source
      diff --git a/docs/stable/URI.TFTP.html b/docs/stable/URI.TFTP.html index b153ef4cc..05ddcb765 100644 --- a/docs/stable/URI.TFTP.html +++ b/docs/stable/URI.TFTP.html @@ -27,7 +27,7 @@

      - Source + Source @@ -63,7 +63,7 @@

      Functions

      - Source + Source

      @@ -71,7 +71,7 @@

      Functions

      - Source + Source
      diff --git a/docs/stable/URI.html b/docs/stable/URI.html index 44ac768f0..5dcd87ae5 100644 --- a/docs/stable/URI.html +++ b/docs/stable/URI.html @@ -32,7 +32,7 @@

      - Source + Source @@ -89,7 +89,7 @@

      Functions

      Unpercent (URL) decodes a URI.

      - Source + Source

      @@ -102,7 +102,7 @@

      Functions

      Use decoder/1 if you want to customize or iterate each value manually.

      - Source + Source

      @@ -111,7 +111,7 @@

      Functions

      Percent (URL) encodes a URI.

      - Source + Source

      @@ -124,7 +124,7 @@

      Functions

      to binary).

      - Source + Source

      @@ -148,7 +148,7 @@

      Functions

      example of one of these extension modules.

      - Source + Source

      @@ -158,7 +158,7 @@

      Functions

      the query string in steps.

      - Source + Source diff --git a/docs/stable/UndefinedFunctionError.html b/docs/stable/UndefinedFunctionError.html index cd334faa2..4591d3464 100644 --- a/docs/stable/UndefinedFunctionError.html +++ b/docs/stable/UndefinedFunctionError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -83,7 +83,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/index.html b/docs/stable/index.html index 93ae16fed..bdab5fcb0 100644 --- a/docs/stable/index.html +++ b/docs/stable/index.html @@ -3,7 +3,7 @@ - Elixir v0.8.3 Documentation + Elixir v0.9.0 Documentation diff --git a/docs/stable/modules_list.html b/docs/stable/modules_list.html index 367ed32d2..1fca36e27 100644 --- a/docs/stable/modules_list.html +++ b/docs/stable/modules_list.html @@ -16,7 +16,7 @@

      - Elixir v0.8.3 + Elixir v0.9.0

      diff --git a/docs/master/Access.List.html b/docs/master/Access.List.html index bd6fcaf8a..76db701f9 100644 --- a/docs/master/Access.List.html +++ b/docs/master/Access.List.html @@ -29,7 +29,7 @@

      - Source + Source @@ -72,7 +72,7 @@

      Examples

      - Source + Source diff --git a/docs/master/Access.html b/docs/master/Access.html index 548c65e81..fd7d3a250 100644 --- a/docs/master/Access.html +++ b/docs/master/Access.html @@ -40,7 +40,7 @@

      - Source + Source

      Implementations

      @@ -52,12 +52,6 @@

      Implementations

      -
    3232. - - Function - -
    3233. -
    3234. HashDict @@ -101,7 +95,7 @@

      Functions

      Receives the element being accessed and the access item.

      - Source + Source diff --git a/docs/master/Application.Behaviour.html b/docs/master/Application.Behaviour.html index 3f40c6411..4ab9367a7 100644 --- a/docs/master/Application.Behaviour.html +++ b/docs/master/Application.Behaviour.html @@ -78,7 +78,7 @@

      Example

      - Source + Source diff --git a/docs/master/ArgumentError.html b/docs/master/ArgumentError.html index 090f3a09a..49a78495c 100644 --- a/docs/master/ArgumentError.html +++ b/docs/master/ArgumentError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/master/ArithmeticError.html b/docs/master/ArithmeticError.html index 78e61f141..663386e98 100644 --- a/docs/master/ArithmeticError.html +++ b/docs/master/ArithmeticError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/master/BadArityError.html b/docs/master/BadArityError.html index ab4e36d43..4c320720b 100644 --- a/docs/master/BadArityError.html +++ b/docs/master/BadArityError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -77,7 +77,7 @@

      Functions

      - Source + Source diff --git a/docs/master/BadFunctionError.html b/docs/master/BadFunctionError.html index 2781f8ed1..f8127301b 100644 --- a/docs/master/BadFunctionError.html +++ b/docs/master/BadFunctionError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -71,7 +71,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Behaviour.html b/docs/master/Behaviour.html index b36ec8f4c..9e6e839c2 100644 --- a/docs/master/Behaviour.html +++ b/docs/master/Behaviour.html @@ -73,7 +73,7 @@

      Implementation

      - Source + Source @@ -107,7 +107,7 @@

      Macros

      Defines a callback according to the given type specification.

      - Source + Source diff --git a/docs/master/Binary.Chars.Atom.html b/docs/master/Binary.Chars.Atom.html index ff67ab87b..c710f0eba 100644 --- a/docs/master/Binary.Chars.Atom.html +++ b/docs/master/Binary.Chars.Atom.html @@ -29,7 +29,7 @@

      - Source + Source @@ -62,7 +62,7 @@

      Functions

      nil which is converted to an empty string.

      - Source + Source diff --git a/docs/master/Binary.Chars.BitString.html b/docs/master/Binary.Chars.BitString.html index 9c7a01ddc..cfb1e897a 100644 --- a/docs/master/Binary.Chars.BitString.html +++ b/docs/master/Binary.Chars.BitString.html @@ -29,7 +29,7 @@

      - Source + Source @@ -61,7 +61,7 @@

      Functions

      Simply returns the binary itself.

      - Source + Source diff --git a/docs/master/Binary.Chars.List.html b/docs/master/Binary.Chars.List.html index 520e27d19..a80caa891 100644 --- a/docs/master/Binary.Chars.List.html +++ b/docs/master/Binary.Chars.List.html @@ -29,7 +29,7 @@

      - Source + Source @@ -72,7 +72,7 @@

      Examples

      - Source + Source diff --git a/docs/master/Binary.Chars.Number.html b/docs/master/Binary.Chars.Number.html index 7742c956b..dc7b5f3ee 100644 --- a/docs/master/Binary.Chars.Number.html +++ b/docs/master/Binary.Chars.Number.html @@ -29,7 +29,7 @@

      - Source + Source @@ -61,7 +61,7 @@

      Functions

      Simply converts the number (integer or a float) to a binary.

      - Source + Source diff --git a/docs/master/Binary.Chars.html b/docs/master/Binary.Chars.html index 2491145e2..5f69b91e7 100644 --- a/docs/master/Binary.Chars.html +++ b/docs/master/Binary.Chars.html @@ -43,7 +43,7 @@

      - Source + Source

      Implementations

      @@ -103,7 +103,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Binary.Inspect.Atom.html b/docs/master/Binary.Inspect.Atom.html index 325c917c2..9382c5d8f 100644 --- a/docs/master/Binary.Inspect.Atom.html +++ b/docs/master/Binary.Inspect.Atom.html @@ -49,7 +49,7 @@

      Examples

      - Source + Source @@ -80,7 +80,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Binary.Inspect.BitString.html b/docs/master/Binary.Inspect.BitString.html index d2b44a08e..55c6bc44f 100644 --- a/docs/master/Binary.Inspect.BitString.html +++ b/docs/master/Binary.Inspect.BitString.html @@ -43,7 +43,7 @@

      Examples

      - Source + Source @@ -74,7 +74,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Binary.Inspect.Function.html b/docs/master/Binary.Inspect.Function.html index 414e8a52c..f7fecb2e8 100644 --- a/docs/master/Binary.Inspect.Function.html +++ b/docs/master/Binary.Inspect.Function.html @@ -34,7 +34,7 @@

      - Source + Source @@ -65,7 +65,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Binary.Inspect.HashDict.html b/docs/master/Binary.Inspect.HashDict.html index 587e35da1..45714c212 100644 --- a/docs/master/Binary.Inspect.HashDict.html +++ b/docs/master/Binary.Inspect.HashDict.html @@ -29,7 +29,7 @@

      - Source + Source @@ -60,7 +60,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Binary.Inspect.List.html b/docs/master/Binary.Inspect.List.html index c4093c929..2dbfd7f22 100644 --- a/docs/master/Binary.Inspect.List.html +++ b/docs/master/Binary.Inspect.List.html @@ -52,7 +52,7 @@

      Examples

      - Source + Source @@ -83,7 +83,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Binary.Inspect.Number.html b/docs/master/Binary.Inspect.Number.html index 8f683bb23..92bda1c0e 100644 --- a/docs/master/Binary.Inspect.Number.html +++ b/docs/master/Binary.Inspect.Number.html @@ -40,7 +40,7 @@

      Examples

      - Source + Source @@ -71,7 +71,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Binary.Inspect.PID.html b/docs/master/Binary.Inspect.PID.html index ddbab6ab8..5c62677c5 100644 --- a/docs/master/Binary.Inspect.PID.html +++ b/docs/master/Binary.Inspect.PID.html @@ -34,7 +34,7 @@

      - Source + Source @@ -65,7 +65,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Binary.Inspect.Port.html b/docs/master/Binary.Inspect.Port.html index 4df9fa842..8bf1a9e73 100644 --- a/docs/master/Binary.Inspect.Port.html +++ b/docs/master/Binary.Inspect.Port.html @@ -34,7 +34,7 @@

      - Source + Source @@ -65,7 +65,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Binary.Inspect.Range.html b/docs/master/Binary.Inspect.Range.html index 947f409f0..59c3c5764 100644 --- a/docs/master/Binary.Inspect.Range.html +++ b/docs/master/Binary.Inspect.Range.html @@ -29,7 +29,7 @@

      - Source + Source @@ -60,7 +60,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Binary.Inspect.Reference.html b/docs/master/Binary.Inspect.Reference.html index 0e95faa90..6f8d8f9f8 100644 --- a/docs/master/Binary.Inspect.Reference.html +++ b/docs/master/Binary.Inspect.Reference.html @@ -34,7 +34,7 @@

      - Source + Source @@ -65,7 +65,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Binary.Inspect.Regex.html b/docs/master/Binary.Inspect.Regex.html index 8fe066302..5c895099b 100644 --- a/docs/master/Binary.Inspect.Regex.html +++ b/docs/master/Binary.Inspect.Regex.html @@ -40,7 +40,7 @@

      Examples

      - Source + Source @@ -71,7 +71,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Binary.Inspect.Tuple.html b/docs/master/Binary.Inspect.Tuple.html index 8aa2becf8..0636b21a0 100644 --- a/docs/master/Binary.Inspect.Tuple.html +++ b/docs/master/Binary.Inspect.Tuple.html @@ -43,7 +43,7 @@

      Examples

      - Source + Source @@ -74,7 +74,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Binary.Inspect.html b/docs/master/Binary.Inspect.html index 83719ceee..4ad33b504 100644 --- a/docs/master/Binary.Inspect.html +++ b/docs/master/Binary.Inspect.html @@ -40,7 +40,7 @@

      - Source + Source

      Implementations

      @@ -148,7 +148,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Bitwise.html b/docs/master/Bitwise.html index de8d1fea4..5b34f2b9f 100644 --- a/docs/master/Bitwise.html +++ b/docs/master/Bitwise.html @@ -34,11 +34,9 @@

      your module:

      iex> use Bitwise
      -...> bnot 1
      +iex> bnot 1
       -2
      -
      -iex> use Bitwise
      -...> 1 &&& 1
      +iex> 1 &&& 1
       1
       
      @@ -52,7 +50,7 @@

      - Source + Source @@ -146,7 +144,7 @@

      Macros

      Bitwise and as operator.

      - Source + Source

      @@ -155,7 +153,7 @@

      Macros

      Arithmetic bitshift left as operator.

      - Source + Source

      @@ -164,7 +162,7 @@

      Macros

      Arithmetic bitshift right as operator.

      - Source + Source

      @@ -173,7 +171,7 @@

      Macros

      Bitwise xor as operator.

      - Source + Source

      @@ -188,7 +186,7 @@

      Macros

      - Source + Source

      @@ -197,7 +195,7 @@

      Macros

      Bitwise and.

      - Source + Source

      @@ -206,7 +204,7 @@

      Macros

      Bitwise not.

      - Source + Source

      @@ -215,7 +213,7 @@

      Macros

      Bitwise or.

      - Source + Source

      @@ -224,7 +222,7 @@

      Macros

      Arithmetic bitshift left.

      - Source + Source

      @@ -233,7 +231,7 @@

      Macros

      Arithmetic bitshift right.

      - Source + Source

      @@ -242,7 +240,7 @@

      Macros

      Bitwise xor.

      - Source + Source

      @@ -251,7 +249,7 @@

      Macros

      Bitwise or as operator.

      - Source + Source

      @@ -260,7 +258,7 @@

      Macros

      Bitwise not as operator.

      - Source + Source
      diff --git a/docs/master/CaseClauseError.html b/docs/master/CaseClauseError.html index 0240f6748..107b112ee 100644 --- a/docs/master/CaseClauseError.html +++ b/docs/master/CaseClauseError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -71,7 +71,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Code.LoadError.html b/docs/master/Code.LoadError.html index 347c4e3f7..4c1e3a436 100644 --- a/docs/master/Code.LoadError.html +++ b/docs/master/Code.LoadError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -71,7 +71,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Code.html b/docs/master/Code.html index 042f12996..dabb01cbd 100644 --- a/docs/master/Code.html +++ b/docs/master/Code.html @@ -36,7 +36,7 @@

      - Source + Source @@ -159,7 +159,7 @@

      Functions

      The path is expanded with Path.expand before added.

      - Source + Source

      @@ -170,7 +170,7 @@

      Functions

      binary.

      - Source + Source

      @@ -183,7 +183,7 @@

      Functions

      For compiling many files at once, check Kernel.ParallelCompiler.

      - Source + Source

      @@ -193,7 +193,7 @@

      Functions

      Check compiler_options/1 for more information.

      - Source + Source

      @@ -215,7 +215,7 @@

      Functions

      - Source + Source

      @@ -225,7 +225,7 @@

      Functions

      The path is expanded with Path.expand before deleted.

      - Source + Source

      @@ -244,7 +244,7 @@

      Functions

      and when to use ensure_loaded/1 or ensure_compiled/1.

      - Source + Source

      @@ -254,7 +254,7 @@

      Functions

      it could be ensured or not.

      - Source + Source

      @@ -298,7 +298,7 @@

      Code.ensure_compiled

      that needs to invoke a module for callback information.

      - Source + Source

      @@ -308,7 +308,7 @@

      Code.ensure_compiled

      it could be ensured or not.

      - Source + Source

      @@ -335,7 +335,7 @@

      Examples

      - Source + Source

      @@ -384,7 +384,7 @@

      Examples

      - Source + Source

      @@ -402,7 +402,7 @@

      Examples

      require_file if you don't want a file to be loaded concurrently.

      - Source + Source

      @@ -411,7 +411,7 @@

      Examples

      Returns all the loaded files.

      - Source + Source

      @@ -421,7 +421,7 @@

      Examples

      The path is expanded with Path.expand before added.

      - Source + Source

      @@ -440,7 +440,7 @@

      Examples

      Check load_file if you want a file to be loaded concurrently.

      - Source + Source

      @@ -466,7 +466,7 @@

      Macro.to_binary/1

      representation.

      - Source + Source

      @@ -480,7 +480,7 @@

      Macro.to_binary/1

      Check Code.string_to_ast/2 for options information.

      - Source + Source

      @@ -492,7 +492,7 @@

      Macro.to_binary/1

      allowing it to be required again.

      - Source + Source diff --git a/docs/master/CompileError.html b/docs/master/CompileError.html index e6d9e5046..d65ff2d4f 100644 --- a/docs/master/CompileError.html +++ b/docs/master/CompileError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -83,7 +83,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Dict.html b/docs/master/Dict.html index 6916718f2..6e3b63a6b 100644 --- a/docs/master/Dict.html +++ b/docs/master/Dict.html @@ -70,7 +70,7 @@

      Protocols

      - Source + Source @@ -268,11 +268,6 @@

      Callbacks summary

      has_key?/2
    3235. -
    3236. - - get!/2 - -
    3237. get/3 @@ -330,7 +325,7 @@

      Examples

      - Source + Source

      @@ -353,7 +348,7 @@

      Examples

      - Source + Source

      @@ -362,7 +357,7 @@

      Examples

      Returns an empty dict of the same type as dict.

      - Source + Source

      @@ -385,7 +380,7 @@

      Examples

      - Source + Source

      @@ -397,16 +392,14 @@

      Examples

      Examples

      iex> d = HashDict.new([a: 1])
      -...> Dict.fetch(d, :a)
      +iex> Dict.fetch(d, :a)
       { :ok, 1 }
      -
      -iex> d = HashDict.new([a: 1])
      -...> Dict.fetch(d, :b)
      +iex> Dict.fetch(d, :b)
       :error
       
      - Source + Source

      @@ -418,15 +411,14 @@

      Examples

      Examples

      iex> d = HashDict.new([a: 1])
      -...> Dict.fetch!(d, :a)
      +iex> Dict.fetch!(d, :a)
       1
      -iex> d = HashDict.new([a: 1])
      -...> Dict.fetch!(d, :b)
      +iex> Dict.fetch!(d, :b)
       ** (KeyError) key not found: :b
       
      - Source + Source

      @@ -438,20 +430,16 @@

      Examples

      Examples

      iex> d = HashDict.new([a: 1])
      -...> Dict.get(d, :a)
      +iex> Dict.get(d, :a)
       1
      -
      -iex> d = HashDict.new([a: 1])
      -...> Dict.get(d, :b)
      +iex> Dict.get(d, :b)
       nil
      -
      -iex> d = HashDict.new([a: 1])
      -...> Dict.get(d, :b, 3)
      +iex> Dict.get(d, :b, 3)
       3
       
      - Source + Source

      @@ -462,16 +450,14 @@

      Examples

      Examples

      iex> d = HashDict.new([a: 1])
      -...> Dict.has_key?(d, :a)
      +iex> Dict.has_key?(d, :a)
       true
      -
      -iex> d = HashDict.new([a: 1])
      -...> Dict.has_key?(d, :b)
      +iex> Dict.has_key?(d, :b)
       false
       
      - Source + Source

      @@ -489,7 +475,7 @@

      Examples

      - Source + Source

      @@ -508,7 +494,7 @@

      Examples

      - Source + Source

      @@ -530,7 +516,7 @@

      Examples

      - Source + Source

      @@ -558,7 +544,7 @@

      Examples

      - Source + Source

      @@ -576,7 +562,7 @@

      Examples

      - Source + Source

      @@ -593,7 +579,7 @@

      Examples

      - Source + Source

      @@ -609,7 +595,7 @@

      Examples

      - Source + Source

      @@ -640,7 +626,7 @@

      Examples

      - Source + Source

      @@ -652,18 +638,18 @@

      Examples

      Examples

      iex> d = HashDict.new([a: 1, b: 2])
      +...>
       ...> d = Dict.take(d, [:a, :c, :d])
       ...> Dict.to_list(d)
       [a: 1]
      -
      -iex> d = HashDict.new([a: 1, b: 2])
      +...>
       ...> d = Dict.take(d, [:c, :d])
       ...> Dict.to_list(d)
       []
       
      - Source + Source

      @@ -673,7 +659,7 @@

      Examples

      No particular order is enforced.

      - Source + Source

      @@ -691,7 +677,7 @@

      Examples

      - Source + Source

      @@ -710,7 +696,7 @@

      Examples

      - Source + Source

      @@ -726,7 +712,7 @@

      Examples

      - Source + Source @@ -743,7 +729,7 @@

      Callbacks

      - Source + Source

      @@ -751,7 +737,7 @@

      Callbacks

      - Source + Source

      @@ -759,7 +745,7 @@

      Callbacks

      - Source + Source

      @@ -767,7 +753,7 @@

      Callbacks

      - Source + Source

      @@ -775,7 +761,7 @@

      Callbacks

      - Source + Source

      @@ -783,7 +769,7 @@

      Callbacks

      - Source + Source

      @@ -791,7 +777,7 @@

      Callbacks

      - Source + Source

      @@ -799,7 +785,7 @@

      Callbacks

      - Source + Source

      @@ -807,7 +793,7 @@

      Callbacks

      - Source + Source

      @@ -815,7 +801,7 @@

      Callbacks

      - Source + Source

      @@ -823,7 +809,7 @@

      Callbacks

      - Source + Source

      @@ -831,7 +817,7 @@

      Callbacks

      - Source + Source

      @@ -839,7 +825,7 @@

      Callbacks

      - Source + Source

      @@ -847,7 +833,7 @@

      Callbacks

      - Source + Source

      @@ -855,15 +841,7 @@

      Callbacks

      - Source - -
      -

      - get!(t(), key()) -

      -
      - - Source + Source

      @@ -871,7 +849,7 @@

      Callbacks

      - Source + Source

      @@ -879,7 +857,7 @@

      Callbacks

      - Source + Source

      @@ -887,7 +865,7 @@

      Callbacks

      - Source + Source

      @@ -895,7 +873,7 @@

      Callbacks

      - Source + Source

      @@ -903,7 +881,7 @@

      Callbacks

      - Source + Source

      @@ -911,7 +889,7 @@

      Callbacks

      - Source + Source
      diff --git a/docs/master/EEx.AssignsEngine.html b/docs/master/EEx.AssignsEngine.html index b3630b807..285dfcb43 100644 --- a/docs/master/EEx.AssignsEngine.html +++ b/docs/master/EEx.AssignsEngine.html @@ -53,7 +53,7 @@

      Examples

      - Source + Source diff --git a/docs/master/EEx.Engine.html b/docs/master/EEx.Engine.html index 6d3b208bc..547eab5b7 100644 --- a/docs/master/EEx.Engine.html +++ b/docs/master/EEx.Engine.html @@ -52,7 +52,7 @@

      - Source + Source @@ -93,7 +93,7 @@

      Functions

      - Source + Source

      @@ -108,7 +108,7 @@

      Functions

      All other markers are not implemented by this engine.

      - Source + Source

      @@ -117,7 +117,7 @@

      Functions

      The default implementation simply concatenates text to the buffer.

      - Source + Source
      diff --git a/docs/master/EEx.SmartEngine.html b/docs/master/EEx.SmartEngine.html index 77b42521e..e3ac71e79 100644 --- a/docs/master/EEx.SmartEngine.html +++ b/docs/master/EEx.SmartEngine.html @@ -34,7 +34,7 @@

      - Source + Source @@ -70,7 +70,7 @@

      Functions

      - Source + Source

      @@ -78,7 +78,7 @@

      Functions

      - Source + Source
      diff --git a/docs/master/EEx.SyntaxError.html b/docs/master/EEx.SyntaxError.html index 4ae0ac5de..c67a3b90d 100644 --- a/docs/master/EEx.SyntaxError.html +++ b/docs/master/EEx.SyntaxError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/master/EEx.TransformerEngine.html b/docs/master/EEx.TransformerEngine.html index 4a3772c4b..f740a5ccd 100644 --- a/docs/master/EEx.TransformerEngine.html +++ b/docs/master/EEx.TransformerEngine.html @@ -39,7 +39,7 @@

      - Source + Source diff --git a/docs/master/EEx.html b/docs/master/EEx.html index 84d061682..435679b69 100644 --- a/docs/master/EEx.html +++ b/docs/master/EEx.html @@ -109,7 +109,7 @@

      Macros

      - Source + Source @@ -172,7 +172,7 @@

      Functions

      that can be evaluated by Elixir or compiled to a function.

      - Source + Source

      @@ -182,7 +182,7 @@

      Functions

      that can be evaluated by Elixir or compiled to a function.

      - Source + Source

      @@ -201,7 +201,7 @@

      Examples

      - Source + Source

      @@ -216,7 +216,7 @@

      Examples

      - Source + Source @@ -252,7 +252,7 @@

      Examples

      - Source + Source

      @@ -273,7 +273,7 @@

      Examples

      - Source + Source diff --git a/docs/master/Enum.EmptyError.html b/docs/master/Enum.EmptyError.html index b6d3d272e..457d0a609 100644 --- a/docs/master/Enum.EmptyError.html +++ b/docs/master/Enum.EmptyError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/master/Enum.OutOfBoundsError.html b/docs/master/Enum.OutOfBoundsError.html index c5363a923..ab207a18b 100644 --- a/docs/master/Enum.OutOfBoundsError.html +++ b/docs/master/Enum.OutOfBoundsError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/master/Enum.html b/docs/master/Enum.html index 448d5992d..8eb4586d3 100644 --- a/docs/master/Enum.html +++ b/docs/master/Enum.html @@ -42,7 +42,7 @@

      - Source + Source @@ -279,7 +279,7 @@

      Examples

      - Source + Source

      @@ -307,7 +307,7 @@

      Examples

      - Source + Source

      @@ -332,7 +332,7 @@

      Examples

      - Source + Source

      @@ -347,7 +347,7 @@

      Examples

      - Source + Source

      @@ -356,7 +356,7 @@

      Examples

      Counts for how many items the function returns true.

      - Source + Source

      @@ -376,7 +376,7 @@

      Examples

      - Source + Source

      @@ -392,7 +392,7 @@

      Examples

      - Source + Source

      @@ -408,7 +408,7 @@

      Examples

      - Source + Source

      @@ -425,7 +425,7 @@

      Examples

      - Source + Source

      @@ -447,7 +447,7 @@

      Examples

      - Source + Source

      @@ -461,14 +461,16 @@

      Examples

      iex> Enum.fetch!([2,4,6], 0)
       2
      +
       iex> Enum.fetch!([2,4,6], 2)
       6
      +
       iex> Enum.fetch!([2,4,6], 4)
       ** (Enum.OutOfBoundsError) out of bounds error
       
      - Source + Source

      @@ -484,7 +486,7 @@

      Examples

      - Source + Source

      @@ -499,7 +501,7 @@

      Examples

      - Source + Source

      @@ -521,7 +523,7 @@

      Examples

      - Source + Source

      @@ -542,7 +544,7 @@

      Examples

      - Source + Source

      @@ -561,7 +563,7 @@

      Examples

      - Source + Source

      @@ -578,7 +580,7 @@

      Examples

      - Source + Source

      @@ -604,7 +606,7 @@

      Examples

      - Source + Source

      @@ -627,7 +629,7 @@

      Examples

      - Source + Source

      @@ -653,7 +655,7 @@

      Examples

      - Source + Source

      @@ -674,7 +676,7 @@

      Examples

      - Source + Source

      @@ -690,7 +692,7 @@

      Examples

      - Source + Source

      @@ -706,7 +708,7 @@

      Examples

      - Source + Source

      @@ -723,7 +725,7 @@

      Examples

      - Source + Source

      @@ -739,7 +741,7 @@

      Examples

      - Source + Source

      @@ -755,7 +757,7 @@

      Examples

      - Source + Source

      @@ -772,7 +774,7 @@

      Examples

      - Source + Source

      @@ -789,7 +791,7 @@

      Examples

      - Source + Source

      @@ -804,7 +806,7 @@

      Examples

      - Source + Source

      @@ -819,7 +821,7 @@

      Examples

      - Source + Source

      @@ -834,7 +836,7 @@

      Examples

      - Source + Source

      @@ -864,7 +866,7 @@

      Examples

      - Source + Source

      @@ -879,7 +881,7 @@

      Examples

      - Source + Source

      @@ -899,7 +901,7 @@

      Examples

      - Source + Source

      @@ -915,7 +917,7 @@

      Examples

      - Source + Source

      @@ -930,7 +932,7 @@

      Examples

      - Source + Source

      @@ -948,7 +950,7 @@

      Examples

      - Source + Source

      @@ -960,7 +962,7 @@

      Examples

      values are filled with nil.

      - Source + Source diff --git a/docs/master/Enumerable.Function.html b/docs/master/Enumerable.Function.html index 6c6cf1f33..a8a30fe33 100644 --- a/docs/master/Enumerable.Function.html +++ b/docs/master/Enumerable.Function.html @@ -29,7 +29,7 @@

      - Source + Source @@ -70,7 +70,7 @@

      Functions

      - Source + Source

      @@ -78,7 +78,7 @@

      Functions

      - Source + Source

      @@ -86,7 +86,7 @@

      Functions

      - Source + Source
      diff --git a/docs/master/Enumerable.HashDict.html b/docs/master/Enumerable.HashDict.html index 8c932ddec..0698de990 100644 --- a/docs/master/Enumerable.HashDict.html +++ b/docs/master/Enumerable.HashDict.html @@ -29,7 +29,7 @@

      - Source + Source @@ -70,7 +70,7 @@

      Functions

      - Source + Source

      @@ -78,7 +78,7 @@

      Functions

      - Source + Source

      @@ -86,7 +86,7 @@

      Functions

      - Source + Source
      diff --git a/docs/master/Enumerable.List.html b/docs/master/Enumerable.List.html index 7a8f0e528..0ae27785b 100644 --- a/docs/master/Enumerable.List.html +++ b/docs/master/Enumerable.List.html @@ -29,7 +29,7 @@

      - Source + Source @@ -70,7 +70,7 @@

      Functions

      - Source + Source

      @@ -78,7 +78,7 @@

      Functions

      - Source + Source

      @@ -86,7 +86,7 @@

      Functions

      - Source + Source
      diff --git a/docs/master/Enumerable.Range.html b/docs/master/Enumerable.Range.html index fecce0db8..d9622d3cc 100644 --- a/docs/master/Enumerable.Range.html +++ b/docs/master/Enumerable.Range.html @@ -29,7 +29,7 @@

      - Source + Source @@ -70,7 +70,7 @@

      Functions

      - Source + Source

      @@ -78,7 +78,7 @@

      Functions

      - Source + Source

      @@ -86,7 +86,7 @@

      Functions

      - Source + Source
      diff --git a/docs/master/Enumerable.html b/docs/master/Enumerable.html index 5ebf9a540..82f4736ba 100644 --- a/docs/master/Enumerable.html +++ b/docs/master/Enumerable.html @@ -47,7 +47,7 @@

      - Source + Source

      Implementations

      @@ -118,7 +118,7 @@

      Functions

      The function used to retrieve the collection's size.

      - Source + Source

      @@ -127,7 +127,7 @@

      Functions

      The function used to check if a value exists within the collection.

      - Source + Source

      @@ -154,7 +154,7 @@

      Functions

      - Source + Source diff --git a/docs/master/ErlangError.html b/docs/master/ErlangError.html index 15ca778d1..1bb5b250b 100644 --- a/docs/master/ErlangError.html +++ b/docs/master/ErlangError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -71,7 +71,7 @@

      Functions

      - Source + Source diff --git a/docs/master/ExUnit.AssertionError.html b/docs/master/ExUnit.AssertionError.html index 99d310d44..69fe5cbd2 100644 --- a/docs/master/ExUnit.AssertionError.html +++ b/docs/master/ExUnit.AssertionError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/master/ExUnit.Assertions.html b/docs/master/ExUnit.Assertions.html index ae96a570a..a139d5be1 100644 --- a/docs/master/ExUnit.Assertions.html +++ b/docs/master/ExUnit.Assertions.html @@ -46,7 +46,7 @@

      - Source + Source @@ -169,7 +169,7 @@

      Examples

      - Source + Source

      @@ -185,7 +185,7 @@

      Examples

      - Source + Source

      @@ -200,7 +200,7 @@

      Examples

      - Source + Source

      @@ -217,7 +217,7 @@

      Examples

      - Source + Source

      @@ -234,7 +234,7 @@

      Examples

      - Source + Source

      @@ -248,7 +248,7 @@

      Examples

      - Source + Source

      @@ -263,7 +263,7 @@

      Examples

      - Source + Source

      @@ -278,7 +278,7 @@

      Examples

      - Source + Source @@ -306,7 +306,7 @@

      Examples

      - Source + Source

      @@ -333,7 +333,7 @@

      Examples

      - Source + Source

      @@ -357,7 +357,7 @@

      Examples

      - Source + Source

      @@ -372,7 +372,7 @@

      Examples

      - Source + Source

      @@ -387,7 +387,7 @@

      Examples

      - Source + Source

      @@ -402,7 +402,7 @@

      Examples

      - Source + Source

      @@ -419,7 +419,7 @@

      Examples

      - Source + Source

      @@ -441,7 +441,7 @@

      Examples

      - Source + Source

      @@ -459,7 +459,7 @@

      Examples

      - Source + Source diff --git a/docs/master/ExUnit.CLIFormatter.html b/docs/master/ExUnit.CLIFormatter.html index 71fbd10c8..76c5bcc8a 100644 --- a/docs/master/ExUnit.CLIFormatter.html +++ b/docs/master/ExUnit.CLIFormatter.html @@ -33,7 +33,7 @@

      - Source + Source @@ -52,31 +52,6 @@

      Functions summary

      case_started/2
    3238. -
    3239. - - code_change/3 - -
    3240. -
    3241. - - handle_call/3 - -
    3242. -
    3243. - - handle_cast/2 - -
    3244. -
    3245. - - handle_info/2 - -
    3246. -
    3247. - - init/1 - -
    3248. suite_finished/3 @@ -87,11 +62,6 @@

      Functions summary

      suite_started/1
    3249. -
    3250. - - terminate/2 - -
    3251. test_finished/2 @@ -119,7 +89,7 @@

      Functions

      - Source + Source

      @@ -127,47 +97,7 @@

      Functions

      - Source - -
      -

      - code_change(_old, state, _extra) -

      -
      - - Source - -
      -

      - handle_call(arg1, arg2, state) -

      -
      - - Source - -
      -

      - handle_cast(arg1, state) -

      -
      - - Source - -
      -

      - handle_info(_msg, state) -

      -
      - - Source - -
      -

      - init(args) -

      -
      - - Source + Source

      @@ -175,7 +105,7 @@

      Functions

      - Source + Source

      @@ -183,15 +113,7 @@

      Functions

      - Source - -
      -

      - terminate(reason, state) -

      -
      - - Source + Source

      @@ -199,7 +121,7 @@

      Functions

      - Source + Source

      @@ -207,7 +129,7 @@

      Functions

      - Source + Source
      diff --git a/docs/master/ExUnit.Callbacks.html b/docs/master/ExUnit.Callbacks.html index f74f98880..293a34e16 100644 --- a/docs/master/ExUnit.Callbacks.html +++ b/docs/master/ExUnit.Callbacks.html @@ -65,7 +65,7 @@

      Examples

      - Source + Source @@ -116,7 +116,7 @@

      Macros

      Called before the start of each test.

      - Source + Source

      @@ -127,7 +127,7 @@

      Macros

      Called before the start of a case.

      - Source + Source

      @@ -139,7 +139,7 @@

      Macros

      message teardown will not be run.

      - Source + Source

      @@ -150,7 +150,7 @@

      Macros

      Called after the finish of each case.

      - Source + Source
      diff --git a/docs/master/ExUnit.CaptureIO.html b/docs/master/ExUnit.CaptureIO.html index 8ac28c024..ff90b72b5 100644 --- a/docs/master/ExUnit.CaptureIO.html +++ b/docs/master/ExUnit.CaptureIO.html @@ -48,7 +48,7 @@

      Examples

      - Source + Source @@ -89,7 +89,7 @@

      Functions

      - Source + Source

      @@ -97,7 +97,7 @@

      Functions

      - Source + Source

      @@ -130,7 +130,7 @@

      Examples

      - Source + Source diff --git a/docs/master/ExUnit.Case.html b/docs/master/ExUnit.Case.html index bcb475774..bd666abb5 100644 --- a/docs/master/ExUnit.Case.html +++ b/docs/master/ExUnit.Case.html @@ -56,7 +56,7 @@

      Examples

      - Source + Source @@ -104,7 +104,7 @@

      Examples

      - Source + Source diff --git a/docs/master/ExUnit.CaseTemplate.html b/docs/master/ExUnit.CaseTemplate.html index 58c2fab64..03e7211ed 100644 --- a/docs/master/ExUnit.CaseTemplate.html +++ b/docs/master/ExUnit.CaseTemplate.html @@ -57,7 +57,7 @@

      Example

      - Source + Source @@ -94,7 +94,7 @@

      Macros

      this module is used.

      - Source + Source diff --git a/docs/master/ExUnit.DocTest.Error.html b/docs/master/ExUnit.DocTest.Error.html new file mode 100644 index 000000000..cbed12b10 --- /dev/null +++ b/docs/master/ExUnit.DocTest.Error.html @@ -0,0 +1,62 @@ + + + + ExUnit.DocTest.Error + + + + + + + + + + + + +
      +

      + ExUnit.DocTest.Error + + exception + +

      + + + + Source + + + + +

      Fields (and defaults)

      +
        + +
      • + + message: nil + +
      • + +
      + + + + + + + + + + + + + +
      + + diff --git a/docs/master/ExUnit.DocTest.html b/docs/master/ExUnit.DocTest.html index d00b35ba3..6aae6c934 100644 --- a/docs/master/ExUnit.DocTest.html +++ b/docs/master/ExUnit.DocTest.html @@ -56,9 +56,9 @@

      Examples

      end -

      The doctest macro is going to loop all functions and macros -defined in MyModule, parsing their documentation in search for -code examples.

      +

      The doctest macro is going to loop through all functions and +macros defined in MyModule, parsing their documentation in +search for code examples.

      A very basic example is:

      @@ -66,7 +66,7 @@

      Examples

      2 -

      Multiline is also supported:

      +

      Expressions on multiple lines are also supported:

      iex> Enum.map [1,2,3], fn(x) ->
       ...>   x * 2
      @@ -74,6 +74,24 @@ 

      Examples

      [2,4,6]
      +

      Multiple results can be checked within the same test:

      + +
      iex> a = 1
      +1
      +iex> a + 1
      +2
      +
      + +

      If you want to keep any two tests separate from each other, +add an empty line between them:

      + +
      iex> a = 1
      +1
      +
      +iex> a + 1  # will fail with a "function a/0 undefined" error
      +2
      +
      +

      Similarly to iex you can use numbers in your "prompts":

      iex(1)> [1+2,
      @@ -89,7 +107,7 @@ 

      Examples

      We also allow you to select or skip some functions when calling -doctest. See its documentation documentation for more info.

      +doctest. See its documentation for more info.

      Exceptions

      @@ -112,14 +130,14 @@

      When not to use doctest

      side effects. For example, if a doctest prints to standard output, doctest will not try to capture the output.

      -

      Similarly, doctest does not run in any kind of side box. So any module +

      Similarly, doctest does not run in any kind of sandbox. So any module defined in a code example is going to linger throughout the whole test suite run.

      - Source + Source @@ -152,20 +170,16 @@

      Macros

      This macro is used to generate ExUnit test cases for doctests.

      -

      There are three ways this macro can be used:

      - -
        -
      • doctest(Module) — will generate tests for all doctests found -in the module Module
      • -
      +

      Calling doctest(Module) will generate tests for all doctests found +in the module Module

      Options can also be supplied:

      • :except — generate tests for all functions except those listed (list of {function, arity} tuples)

      • -
      • :only — generate tests only forfunctions listed - (list of {function, arity} tuples)

      • +
      • :only — generate tests only forfunctions listed + (list of {function, arity} tuples)

      • :import — when true, one can test a function defined in the module without referring to the module name. However, this is not feasible when there is a clash with a number module like @@ -178,10 +192,10 @@

        Examples

        doctest MyModule, except: [trick_fun: 1]
         
        -

        This macro is auto-imported into every ExUnit.Case.

        +

        This macro is auto-imported with every ExUnit.Case.

      - Source + Source diff --git a/docs/master/ExUnit.ExpectationError.html b/docs/master/ExUnit.ExpectationError.html index 212afddb8..840b43356 100644 --- a/docs/master/ExUnit.ExpectationError.html +++ b/docs/master/ExUnit.ExpectationError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -106,7 +106,7 @@

      Functions

      - Source + Source

      @@ -114,7 +114,7 @@

      Functions

      - Source + Source
      diff --git a/docs/master/ExUnit.Formatter.html b/docs/master/ExUnit.Formatter.html index 2a94f6ddc..ae02679a5 100644 --- a/docs/master/ExUnit.Formatter.html +++ b/docs/master/ExUnit.Formatter.html @@ -35,7 +35,7 @@

      - Source + Source @@ -95,7 +95,7 @@

      Callbacks

      - Source + Source

      @@ -103,7 +103,7 @@

      Callbacks

      - Source + Source

      @@ -111,7 +111,7 @@

      Callbacks

      - Source + Source

      @@ -119,7 +119,7 @@

      Callbacks

      - Source + Source

      @@ -127,15 +127,15 @@

      Callbacks

      - Source + Source

      - suite_started(opts :: list()) + suite_started(opts :: [])

      - Source + Source
      diff --git a/docs/master/ExUnit.Test.html b/docs/master/ExUnit.Test.html index b9dd5b705..880c03415 100644 --- a/docs/master/ExUnit.Test.html +++ b/docs/master/ExUnit.Test.html @@ -36,7 +36,7 @@

      - Source + Source diff --git a/docs/master/ExUnit.TestCase.html b/docs/master/ExUnit.TestCase.html index 92bdf257c..7b2214eee 100644 --- a/docs/master/ExUnit.TestCase.html +++ b/docs/master/ExUnit.TestCase.html @@ -36,7 +36,7 @@

      - Source + Source diff --git a/docs/master/ExUnit.html b/docs/master/ExUnit.html index d4a25e99f..17f1bc95a 100644 --- a/docs/master/ExUnit.html +++ b/docs/master/ExUnit.html @@ -75,7 +75,7 @@

      Case, callbacks and assertions

      - Source + Source @@ -99,11 +99,6 @@

      Functions summary

      start/1
    3252. -
    3253. - - stop/1 - -
    3254. @@ -133,7 +128,7 @@

      Options

      - Source + Source

      @@ -145,7 +140,7 @@

      Options

      Returns the number of failures.

      - Source + Source

      @@ -159,15 +154,7 @@

      Options

      function and rely on configure/1 and run/0 instead.

      - Source - -
      -

      - stop(_state) -

      -
      - - Source + Source
      diff --git a/docs/master/Exception.html b/docs/master/Exception.html index 25fbefa5a..e6c0189d1 100644 --- a/docs/master/Exception.html +++ b/docs/master/Exception.html @@ -33,7 +33,7 @@

      - Source + Source @@ -84,7 +84,7 @@

      Functions

      - Source + Source

      @@ -97,7 +97,7 @@

      Functions

      the value of System.stacktrace is changed.

      - Source + Source

      @@ -108,7 +108,7 @@

      Functions

      is used to prettify the stacktrace.

      - Source + Source

      @@ -119,7 +119,7 @@

      Functions

      code with Elixir code.

      - Source + Source

      Functions

      the value of System.stacktrace is changed.

      - Source + Source diff --git a/docs/master/File.CopyError.html b/docs/master/File.CopyError.html index 1b7d907e9..f21e56bd8 100644 --- a/docs/master/File.CopyError.html +++ b/docs/master/File.CopyError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -89,7 +89,7 @@

      Functions

      - Source + Source diff --git a/docs/master/File.Error.html b/docs/master/File.Error.html index 43374cdeb..e6c6eb7e8 100644 --- a/docs/master/File.Error.html +++ b/docs/master/File.Error.html @@ -29,7 +29,7 @@

      - Source + Source @@ -83,7 +83,7 @@

      Functions

      - Source + Source diff --git a/docs/master/File.IteratorError.html b/docs/master/File.IteratorError.html index 8aeee3b2e..b7e952cd6 100644 --- a/docs/master/File.IteratorError.html +++ b/docs/master/File.IteratorError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -71,7 +71,7 @@

      Functions

      - Source + Source diff --git a/docs/master/File.Stat.html b/docs/master/File.Stat.html index 0cb4b7f62..375a0e9f4 100644 --- a/docs/master/File.Stat.html +++ b/docs/master/File.Stat.html @@ -63,7 +63,7 @@

      - Source + Source diff --git a/docs/master/File.html b/docs/master/File.html index 40ba42c75..1b0f654b5 100644 --- a/docs/master/File.html +++ b/docs/master/File.html @@ -77,7 +77,7 @@

      - Source + Source @@ -331,7 +331,7 @@

      Functions

      binary. Check iterator/1 for more information.

      - Source + Source

      @@ -343,7 +343,7 @@

      Functions

      that the file is opened when the iteration begins.

      - Source + Source

      @@ -353,7 +353,7 @@

      Functions

      { :error, reason } otherwise.

      - Source + Source

      @@ -362,7 +362,7 @@

      Functions

      The same as cd/0, but raises an exception if it fails.

      - Source + Source

      @@ -376,7 +376,7 @@

      Functions

      directory fails.

      - Source + Source

      @@ -390,7 +390,7 @@

      Functions

      See open/2.

      - Source + Source

      @@ -411,7 +411,7 @@

      Functions

      read/1 and write/2.

      - Source + Source

      @@ -421,7 +421,7 @@

      Functions

      Returns the bytes_copied otherwise.

      - Source + Source

      @@ -446,7 +446,7 @@

      Functions

      { :error, reason } otherwise.

      - Source + Source

      @@ -456,7 +456,7 @@

      Functions

      Returns the list of copied files otherwise.

      - Source + Source

      @@ -508,7 +508,7 @@

      Examples

      - Source + Source

      @@ -518,7 +518,7 @@

      Examples

      Returns the list of copied files otherwise.

      - Source + Source

      @@ -530,7 +530,7 @@

      Examples

      in case of success, { :error, reason } otherwise.

      - Source + Source

      @@ -539,7 +539,7 @@

      Examples

      The same as cwd/0, but raises an exception if it fails.

      - Source + Source

      @@ -548,7 +548,7 @@

      Examples

      Returns true if the path is a directory.

      - Source + Source

      @@ -571,7 +571,7 @@

      Examples

      - Source + Source

      @@ -600,7 +600,7 @@

      Examples

      - Source + Source

      @@ -612,7 +612,7 @@

      Examples

      that the file is opened when the iteration begins.

      - Source + Source

      @@ -624,7 +624,7 @@

      Examples

      { :error, reason } otherwise.

      - Source + Source

      @@ -634,7 +634,7 @@

      Examples

      in case of an error.

      - Source + Source

      @@ -655,7 +655,7 @@

      Examples

      - Source + Source

      @@ -664,7 +664,7 @@

      Examples

      Same as mkdir, but raises an exception in case of failure. Otherwise :ok.

      - Source + Source

      @@ -682,7 +682,7 @@

      Examples

      - Source + Source

      @@ -691,7 +691,7 @@

      Examples

      Same as mkdir_p, but raises an exception in case of failure. Otherwise :ok.

      - Source + Source

      @@ -754,7 +754,7 @@

      Examples

      - Source + Source

      @@ -781,7 +781,7 @@

      Examples

      - Source + Source

      @@ -791,7 +791,7 @@

      Examples

      Returns the io_device otherwise.

      - Source + Source

      @@ -801,7 +801,7 @@

      Examples

      Returns the function result otherwise.

      - Source + Source

      @@ -825,7 +825,7 @@

      Examples

      You can use :file.format_error(reason) to get a descriptive string of the error.

      - Source + Source

      @@ -835,7 +835,7 @@

      Examples

      File.Error if an error occurs.

      - Source + Source

      @@ -849,7 +849,7 @@

      Examples

      - Source + Source

      @@ -879,7 +879,7 @@

      Examples

      - Source + Source

      @@ -888,7 +888,7 @@

      Examples

      Same as rm, but raises an exception in case of failure. Otherwise :ok.

      - Source + Source

      @@ -912,7 +912,7 @@

      Examples

      - Source + Source

      @@ -922,7 +922,7 @@

      Examples

      otherwise the list of files or directories removed.

      - Source + Source

      @@ -941,7 +941,7 @@

      Examples

      - Source + Source

      @@ -950,7 +950,7 @@

      Examples

      Same as rmdir/1, but raises an exception in case of failure. Otherwise :ok.

      - Source + Source

      @@ -971,7 +971,7 @@

      Options

      - Source + Source

      @@ -981,7 +981,7 @@

      Options

      throws File.Error if an error is returned.

      - Source + Source

      @@ -991,7 +991,7 @@

      Options

      the given file. File is created if it doesn’t exist.

      - Source + Source

      @@ -1001,7 +1001,7 @@

      Options

      Returns :ok otherwise.

      - Source + Source

      @@ -1023,7 +1023,7 @@

      Options

      - Source + Source

      @@ -1032,7 +1032,7 @@

      Options

      Same as write/3 but raises an exception if it fails, returns :ok otherwise.

      - Source + Source

      @@ -1042,7 +1042,7 @@

      Options

      path. Returns :ok or { :error, reason }.

      - Source + Source

      @@ -1052,7 +1052,7 @@

      Options

      Returns :ok otherwise.

      - Source + Source diff --git a/docs/master/FunctionClauseError.html b/docs/master/FunctionClauseError.html index 7fe00281f..95d9c1ebe 100644 --- a/docs/master/FunctionClauseError.html +++ b/docs/master/FunctionClauseError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -83,7 +83,7 @@

      Functions

      - Source + Source diff --git a/docs/master/GenEvent.Behaviour.html b/docs/master/GenEvent.Behaviour.html index cfb274774..80b9988c0 100644 --- a/docs/master/GenEvent.Behaviour.html +++ b/docs/master/GenEvent.Behaviour.html @@ -82,7 +82,7 @@

      Example

      - Source + Source diff --git a/docs/master/GenServer.Behaviour.html b/docs/master/GenServer.Behaviour.html index b23389358..750e4c643 100644 --- a/docs/master/GenServer.Behaviour.html +++ b/docs/master/GenServer.Behaviour.html @@ -116,7 +116,7 @@

      Example

      - Source + Source diff --git a/docs/master/HashDict.html b/docs/master/HashDict.html index 1a3dfc936..1d7b45950 100644 --- a/docs/master/HashDict.html +++ b/docs/master/HashDict.html @@ -37,7 +37,7 @@

      - Source + Source @@ -184,7 +184,7 @@

      Functions

      Deletes a value from the dict.

      - Source + Source

      @@ -194,7 +194,7 @@

      Functions

      which key is not in keys

      - Source + Source

      @@ -203,7 +203,7 @@

      Functions

      Returns an empty dict.

      - Source + Source

      @@ -211,7 +211,7 @@

      Functions

      - Source + Source

      @@ -221,7 +221,7 @@

      Functions

      and return it in a tagged tuple.

      - Source + Source

      @@ -229,7 +229,7 @@

      Functions

      - Source + Source

      @@ -238,7 +238,7 @@

      Functions

      Gets the value under key from the dict.

      - Source + Source

      @@ -247,7 +247,7 @@

      Functions

      Checks if the dict has the given key.

      - Source + Source

      @@ -256,7 +256,7 @@

      Functions

      Get all keys in the dict.

      - Source + Source

      @@ -265,7 +265,7 @@

      Functions

      Merges two dictionaries.

      - Source + Source

      @@ -274,7 +274,7 @@

      Functions

      Creates a new empty dict.

      - Source + Source

      @@ -289,7 +289,7 @@

      Examples

      - Source + Source

      @@ -305,7 +305,7 @@

      Examples

      - Source + Source

      @@ -314,7 +314,7 @@

      Examples

      Returns the value under key from the dict as well as the dict without key.

      - Source + Source

      @@ -323,7 +323,7 @@

      Examples

      Puts the given key and value in the dict.

      - Source + Source

      @@ -333,7 +333,7 @@

      Examples

      only if one does not exist yet.

      - Source + Source

      @@ -341,7 +341,7 @@

      Examples

      - Source + Source

      @@ -350,7 +350,7 @@

      Examples

      Returns the dict size.

      - Source + Source

      @@ -362,7 +362,7 @@

      Examples

      Returns a 2-tuple of the new dicts.

      - Source + Source

      @@ -372,7 +372,7 @@

      Examples

      which key is in keys.

      - Source + Source

      @@ -381,7 +381,7 @@

      Examples

      Converts the dict to a list.

      - Source + Source

      @@ -392,7 +392,7 @@

      Examples

      not exist in the dictionary.

      - Source + Source

      @@ -403,7 +403,7 @@

      Examples

      the key does not exist in the dicionary.

      - Source + Source

      @@ -412,7 +412,7 @@

      Examples

      Get all values in the dict.

      - Source + Source
      diff --git a/docs/master/IEx.Autocomplete.html b/docs/master/IEx.Autocomplete.html index cffdc91d8..a0c9dea64 100644 --- a/docs/master/IEx.Autocomplete.html +++ b/docs/master/IEx.Autocomplete.html @@ -32,7 +32,7 @@

      - Source + Source @@ -63,7 +63,7 @@

      Functions

      - Source + Source diff --git a/docs/master/IEx.Helpers.html b/docs/master/IEx.Helpers.html index d407f0532..78afd46f4 100644 --- a/docs/master/IEx.Helpers.html +++ b/docs/master/IEx.Helpers.html @@ -74,7 +74,7 @@

      - Source + Source @@ -199,7 +199,7 @@

      Examples

      - Source + Source

      @@ -208,7 +208,7 @@

      Examples

      Changes the current working directory to the given path.

      - Source + Source

      @@ -217,7 +217,7 @@

      Examples

      Flushes all messages sent to the shell and prints them out.

      - Source + Source

      @@ -226,7 +226,7 @@

      Examples

      Prints the documentation for IEx.Helpers.

      - Source + Source

      @@ -235,7 +235,7 @@

      Examples

      Purges and reloads specified module.

      - Source + Source

      @@ -245,7 +245,7 @@

      Examples

      If path points to a file, prints its full path.

      - Source + Source

      @@ -255,7 +255,7 @@

      Examples

      files.

      - Source + Source

      @@ -264,7 +264,7 @@

      Examples

      Prints the current working directory.

      - Source + Source

      @@ -274,7 +274,7 @@

      Examples

      in the current IEx session.

      - Source + Source

      @@ -286,7 +286,7 @@

      Examples

      are recompiled and reloaded.

      - Source + Source

      @@ -296,7 +296,7 @@

      Examples

      their results.

      - Source + Source

      @@ -308,7 +308,7 @@

      Examples

      For instance, v(-1) returns the result of the last evaluated expression.

      - Source + Source @@ -339,7 +339,7 @@

      Examples

      - Source + Source

      @@ -363,7 +363,7 @@

      Examples

      - Source + Source

      @@ -385,7 +385,7 @@

      Examples

      - Source + Source

      @@ -404,7 +404,7 @@

      Examples

      - Source + Source diff --git a/docs/master/IEx.Options.html b/docs/master/IEx.Options.html new file mode 100644 index 000000000..8374748dd --- /dev/null +++ b/docs/master/IEx.Options.html @@ -0,0 +1,277 @@ + + + + IEx.Options + + + + + + + + + + + + +
      +

      + IEx.Options + +

      + + +
      +

      Provides an interface for adjusting options of the running IEx session.

      + +

      Changing options is usually done inside an IEx session or in your .iex file. +See h(IEx) for more info on the latter.

      + +

      If the value of an option is a keyword list, only those keys that are +mentioned will be changed. The rest of the sub-options will keep their +current values. Any extraneous keys are filtered out, i.e. not used.

      + +

      To get the list of all supported options, use list/0. You can also get an +option's description using print_help/1.

      + +

      Examples

      + +
      iex(1)> ArgumentError[]
      +ArgumentError[message: "argument error"]
      +
      +iex(2)> IEx.Options.set :inspect, raw: true
      +[limit: 50, raw: false]
      +
      +iex(3)> ArgumentError[]
      +{ArgumentError,:__exception__,"argument error"}
      +
      +iex(4)> IEx.Options.list
      +[:colors,:inspect]
      +
      +iex(5)> IEx.Options.print_help :colors
      +This is an aggregate option that encapsulates all color settings used
      +by the shell.
      +... # omitted content
      +
      + +
      + + + Source + + + + + + +

      Functions summary

      + + + + + + + + +
      +

      Functions

      +
      +

      + colors() +

      +

      NOTE: This is just a stub for documentation purposes. Use +IEx.Options.get and IEx.Options.set to query and change the option's +value.

      + +

      This is an aggregate option that encapsulates all color settings used by the +shell. See documentation for the IO.ANSI module for the list of supported +colors and attributes.

      + +

      The value is a keyword list. List of supported keys:

      + +
        +
      • enabled -- boolean value that allows for switching the coloring + on and off

      • +
      • eval_result -- color for an expression's resulting value

      • +
      • error -- color for error messages

      • +
      • info -- color for various informational messages

      • +
      • directory -- color for directory entries (ls helper)

      • +
      • device -- color for device entries (ls helper)

      • +
      +
      + + Source + +
      +

      + get() +

      +

      Returns all supported IEx options with their respective values as a keyword +list.

      +
      + + Source + +
      +

      + get(name) +

      +

      Get current value of the option name. Raises ArgumentError if name is not a +known option.

      +
      + + Source + +
      +

      + help(name) +

      +

      Returns a string with the option's description. Raises if name is not a +known option.

      +
      + + Source + +
      +

      + history_size() +

      +

      NOTE: This is just a stub for documentation purposes. Use +IEx.Options.get and IEx.Options.set to query and change the option's +value.

      + +

      Number of expressions and their results to keep in the history.

      + +

      The value is an integer. When it is negative, the history is unlimited.

      +
      + + Source + +
      +

      + inspect() +

      +

      NOTE: This is just a stub for documentation purposes. Use +IEx.Options.get and IEx.Options.set to query and change the option's +value.

      + +

      Inspect options used by the shell when printing results of expression +evaluation.

      + +

      The value is a keyword list.

      + +

      See Kernel.inspect/2 for the full list of options.

      +
      + + Source + +
      +

      + list() +

      +

      Returns all supported options as a list of names.

      +
      + + Source + +
      + +

      Same as help/1 but instead of returning a string, prints it.

      +
      + + Source + +
      +

      + set(opts) +

      +

      Set all options at once by providing a keyword list with option names and +their corresponding values. This is generally obtained from get/0.

      + +

      Returns a keyword list of old option values.

      +
      + + Source + +
      +

      + set(name, value) +

      +

      Sets the value for the option name to value.

      + +

      Returns option's previous value in the case of success.

      + +

      Raises if name is not a known option or if the value is invalid.

      +
      + + Source + +
      +
      + + + + + +
      + + diff --git a/docs/master/IEx.html b/docs/master/IEx.html index 8d7bade4f..e9bf16e27 100644 --- a/docs/master/IEx.html +++ b/docs/master/IEx.html @@ -120,6 +120,31 @@

      The .iex file

      It is possible to override the default loading sequence for .iex file by supplying the --dot-iex option to iex. See iex --help.

      +

      Configuring the shell

      + +

      There is a number of customization options provided by the shell. Take a look +at the docs for the IEx.Options module.

      + +

      The main functions there are IEx.Options.get/1 and IEx.Options.set/2. One +can also use IEx.Options.list/0 to get the list of all supported options. +IEx.Options.print_help/1 will print documentation for the given option.

      + +

      In particular, it might be convenient to customize those options inside your +.iex file like this:

      + +
      # .iex
      +IEx.Options.set :inspect, limit: 3
      +
      +### now run the shell ###
      +
      +$ iex
      +Erlang R16B (erts-5.10.1) [...]
      +
      +Interactive Elixir (0.9.1.dev) - press Ctrl+C to exit (type h() ENTER for help)
      +iex(1)> [1,2,3,4,5]
      +[1,2,3,...]
      +
      +

      Expressions in IEx

      As an interactive shell, IEx evaluates expressions. This has some @@ -158,7 +183,7 @@

      Expressions in IEx

      - Source + Source @@ -179,12 +204,17 @@

      Functions summary

    3255. - inspect_opts/0 + color/2
    3256. - inspect_opts/1 + color_fragment/1 + +
    3257. +
    3258. + + color_reset/0
    3259. @@ -210,7 +240,7 @@

      Functions

      Returns registered after spawn callbacks.

      - Source + Source

      @@ -219,25 +249,34 @@

      Functions

      Registers a function to be invoked after IEx process is spawned.

      - Source + Source + +
      +

      + color(color_name, string) +

      +

      Returns string escaped using the specified color.

      +
      + + Source
      -

      - inspect_opts() +

      + color_fragment(color_name)

      -

      Returns currently registered inspect options.

      +

      Returns an escaped fragment using the specified color.

      - Source + Source
      -

      - inspect_opts(opts) +

      + color_reset()

      -

      Registers options used on inspect.

      +

      Returns an escaped fragment that resets colors and attributes.

      - Source + Source

      @@ -246,7 +285,7 @@

      Functions

      Returns true if IEx was properly started.

      - Source + Source
      diff --git a/docs/master/IO.ANSI.html b/docs/master/IO.ANSI.html index cb63ad762..0861730f5 100644 --- a/docs/master/IO.ANSI.html +++ b/docs/master/IO.ANSI.html @@ -35,7 +35,7 @@

      - Source + Source @@ -317,7 +317,7 @@

      Functions

      Sets foreground color to black

      - Source + Source

      @@ -326,7 +326,7 @@

      Functions

      Sets background color to black

      - Source + Source

      Functions

      Blink: off

      - Source + Source

      Functions

      Blink: Rapid. MS-DOS ANSI.SYS; 150 per minute or more; not widely supported

      - Source + Source

      Functions

      Blink: Slow. Less than 150 per minute

      - Source + Source

      @@ -362,7 +362,7 @@

      Functions

      Sets foreground color to blue

      - Source + Source

      @@ -371,7 +371,7 @@

      Functions

      Sets background color to blue

      - Source + Source

      @@ -380,7 +380,7 @@

      Functions

      Bright (increased intensity) or Bold

      - Source + Source

      @@ -389,7 +389,7 @@

      Functions

      Conceal. Not widely supported

      - Source + Source

      @@ -398,7 +398,7 @@

      Functions

      Crossed-out. Characters legible, but marked for deletion. Not widely supported.

      - Source + Source

      @@ -407,7 +407,7 @@

      Functions

      Sets foreground color to cyan

      - Source + Source

      @@ -416,7 +416,7 @@

      Functions

      Sets background color to cyan

      - Source + Source

      @@ -425,7 +425,7 @@

      Functions

      Default background color

      - Source + Source

      @@ -434,7 +434,7 @@

      Functions

      Default text color

      - Source + Source

      @@ -443,19 +443,19 @@

      Functions

      Encircled

      - Source + Source

      escape(string, emit // terminal?())

      -

      Escapes a string coverting named ANSI sequences into actual ANSI codes.

      +

      Escapes a string by converting named ANSI sequences into actual ANSI codes.

      -

      The format for referring sequences is %{red} and %{red,bright} (for -multiple sequences)

      +

      The format for referring to sequences is %{red} and %{red,bright} (for +multiple sequences).

      -

      It will also force a %{reset} to get appended to every string. If you don't -want this behaviour, use escape_fragment/1 and escape_fragment/2.

      +

      It will also append a %{reset} to the string. If you don't want this +behaviour, use escape_fragment/1 and escape_fragment/2.

      An optional boolean parameter can be passed to enable or disable emitting actual ANSI codes. When false, no ANSI codes will emitted. @@ -468,16 +468,16 @@

      Example

      "Hello \e[31m\e[1m\e[32myes\e[0m"

      - Source + Source

      escape_fragment(string, emit // terminal?())

      -

      Escapes a string coverting named ANSI sequences into actual ANSI codes.

      +

      Escapes a string by converting named ANSI sequences into actual ANSI codes.

      -

      The format for referring sequences is %{red} and %{red,bright} (for -multiple sequences)

      +

      The format for referring to sequences is %{red} and %{red,bright} (for +multiple sequences).

      An optional boolean parameter can be passed to enable or disable emitting actual ANSI codes. When false, no ANSI codes will emitted. @@ -486,11 +486,13 @@

      Example

      Example

      -

      iex> IO.ANSI.escape("Hello %{red,bright,green}yes") - "Hello \e[31m\e[1m\e[32myes\e[0m"

      +

      iex> IO.ANSI.escapefragment("Hello %{red,bright,green}yes") + "Hello \e[31m\e[1m\e[32myes" + iex> IO.ANSI.escapefragment("%{reset}bye") + "\e[0mbye"

      - Source + Source

      @@ -499,7 +501,7 @@

      Example

      Faint (decreased intensity), not widely supported

      - Source + Source

      @@ -508,7 +510,7 @@

      Example

      Sets alternative font 1

      - Source + Source

      @@ -517,7 +519,7 @@

      Example

      Sets alternative font 2

      - Source + Source

      @@ -526,7 +528,7 @@

      Example

      Sets alternative font 3

      - Source + Source

      @@ -535,7 +537,7 @@

      Example

      Sets alternative font 4

      - Source + Source

      @@ -544,7 +546,7 @@

      Example

      Sets alternative font 5

      - Source + Source

      @@ -553,7 +555,7 @@

      Example

      Sets alternative font 6

      - Source + Source

      @@ -562,7 +564,7 @@

      Example

      Sets alternative font 7

      - Source + Source

      @@ -571,7 +573,7 @@

      Example

      Sets alternative font 8

      - Source + Source

      @@ -580,7 +582,7 @@

      Example

      Sets alternative font 9

      - Source + Source

      @@ -589,7 +591,7 @@

      Example

      Framed

      - Source + Source

      @@ -598,7 +600,7 @@

      Example

      Sets foreground color to green

      - Source + Source

      @@ -607,7 +609,7 @@

      Example

      Sets background color to green

      - Source + Source

      @@ -616,7 +618,7 @@

      Example

      Image: Negative. Swap foreground and background

      - Source + Source

      @@ -625,7 +627,7 @@

      Example

      Italic: on. Not widely supported. Sometimes treated as inverse.

      - Source + Source

      @@ -634,7 +636,7 @@

      Example

      Sets foreground color to magenta

      - Source + Source

      @@ -643,7 +645,7 @@

      Example

      Sets background color to magenta

      - Source + Source

      @@ -652,7 +654,7 @@

      Example

      Underline: None

      - Source + Source

      @@ -661,7 +663,7 @@

      Example

      Normal color or intensity

      - Source + Source

      @@ -670,7 +672,7 @@

      Example

      Not framed or encircled

      - Source + Source

      @@ -679,7 +681,7 @@

      Example

      Not italic

      - Source + Source

      @@ -688,7 +690,7 @@

      Example

      Not overlined

      - Source + Source

      @@ -697,7 +699,7 @@

      Example

      Overlined

      - Source + Source

      @@ -706,7 +708,7 @@

      Example

      Sets primary (default) font

      - Source + Source

      @@ -715,7 +717,7 @@

      Example

      Sets foreground color to red

      - Source + Source

      @@ -724,7 +726,7 @@

      Example

      Sets background color to red

      - Source + Source

      @@ -733,7 +735,7 @@

      Example

      Resets all attributes

      - Source + Source

      @@ -742,7 +744,7 @@

      Example

      Image: Negative. Swap foreground and background

      - Source + Source

      @@ -754,7 +756,7 @@

      Example

      be printed as intended.

      - Source + Source

      @@ -763,7 +765,7 @@

      Example

      Underline: Single

      - Source + Source

      @@ -772,7 +774,7 @@

      Example

      Sets foreground color to white

      - Source + Source

      @@ -781,7 +783,7 @@

      Example

      Sets background color to white

      - Source + Source

      @@ -790,7 +792,7 @@

      Example

      Sets foreground color to yellow

      - Source + Source

      @@ -799,7 +801,7 @@

      Example

      Sets background color to yellow

      - Source + Source
      diff --git a/docs/master/IO.html b/docs/master/IO.html index f40555f00..23dc12d35 100644 --- a/docs/master/IO.html +++ b/docs/master/IO.html @@ -50,7 +50,7 @@

      - Source + Source @@ -140,7 +140,7 @@

      Functions

      Check read/2 for more information.

      - Source + Source

      @@ -152,7 +152,7 @@

      Functions

      Check readline/1 for more information.

      - Source + Source

      @@ -164,7 +164,7 @@

      Functions

      Check write/2 for more information.

      - Source + Source

      @@ -184,7 +184,7 @@

      Functions

      - Source + Source

      @@ -196,7 +196,7 @@

      Functions

      Otherwise, the number of raw bytes.

      - Source + Source

      @@ -214,7 +214,7 @@

      Functions

      - Source + Source

      @@ -229,7 +229,7 @@

      Examples

      - Source + Source

      @@ -238,7 +238,7 @@

      Examples

      Inspects the item with options using the given device.

      - Source + Source

      @@ -249,7 +249,7 @@

      Examples

      to be a chardata.

      - Source + Source

      @@ -266,7 +266,7 @@

      Examples

      - Source + Source

      @@ -286,7 +286,7 @@

      Examples

      except the prompt is not required as argument.

      - Source + Source

      @@ -309,7 +309,7 @@

      Examples

      - Source + Source diff --git a/docs/master/Kernel.CLI.html b/docs/master/Kernel.CLI.html index a23c8ce84..fb26b8f9d 100644 --- a/docs/master/Kernel.CLI.html +++ b/docs/master/Kernel.CLI.html @@ -32,7 +32,7 @@

      - Source + Source @@ -69,7 +69,7 @@

      Functions

      by escripts generated by Elixir.

      - Source + Source diff --git a/docs/master/Kernel.ParallelCompiler.html b/docs/master/Kernel.ParallelCompiler.html index 6622625f6..c2ecc43d0 100644 --- a/docs/master/Kernel.ParallelCompiler.html +++ b/docs/master/Kernel.ParallelCompiler.html @@ -32,7 +32,7 @@

      - Source + Source @@ -77,7 +77,7 @@

      Functions

      with its name can be optionally given as argument.

      - Source + Source

      @@ -87,7 +87,7 @@

      Functions

      Read files/2 for more information.

      - Source + Source diff --git a/docs/master/Kernel.ParallelRequire.html b/docs/master/Kernel.ParallelRequire.html index ff849770b..4ddaca4a0 100644 --- a/docs/master/Kernel.ParallelRequire.html +++ b/docs/master/Kernel.ParallelRequire.html @@ -32,7 +32,7 @@

      - Source + Source @@ -67,7 +67,7 @@

      Functions

      can be optionally given as argument.

      - Source + Source diff --git a/docs/master/Kernel.SpecialForms.html b/docs/master/Kernel.SpecialForms.html index 4d91c5de8..c2670322b 100644 --- a/docs/master/Kernel.SpecialForms.html +++ b/docs/master/Kernel.SpecialForms.html @@ -48,7 +48,7 @@

      - Source + Source @@ -316,7 +316,7 @@

      Bitstring types

      to binary32 and binary64, respectively.

      - Source + Source

      @@ -331,7 +331,7 @@

      Examples

      - Source + Source

      @@ -340,7 +340,7 @@

      Examples

      Returns the current directory as a binary.

      - Source + Source

      @@ -351,7 +351,7 @@

      Examples

      line numbers, set up aliases, the current function and others.

      - Source + Source

      @@ -362,7 +362,7 @@

      Examples

      is a convenient shortcut.

      - Source + Source

      @@ -373,7 +373,7 @@

      Examples

      is a convenient shortcut.

      - Source + Source

      @@ -418,7 +418,7 @@

      Examples

      - Source + Source

      @@ -433,7 +433,7 @@

      Examples

      - Source + Source

      @@ -451,7 +451,7 @@

      Examples

      Check quote/1 for more information.

      - Source + Source

      @@ -497,7 +497,7 @@

      Lexical scope

      specific functions and it won't affect the overall scope.

      - Source + Source

      @@ -508,7 +508,7 @@

      Lexical scope

      the macro is expanded.

      - Source + Source

      @@ -524,7 +524,7 @@

      Lexical scope

      - Source + Source

      @@ -625,7 +625,7 @@

      Ambiguous function/macro names

      errors are emitted lazily, not eagerly.

      - Source + Source

      @@ -675,7 +675,7 @@

      Ambiguous function/macro names

      - Source + Source

      @@ -758,7 +758,10 @@

      Hygiene and context

      Notice how the third element of the returned tuple is the module name. This means that the variable is associated to the ContextSample module and only code generated by this module -will be able to access that particular world variable.

      +will be able to access that particular world variable. +While this means macros from the same module could have +conflicting variables, it also allows different quotes from +the same module to access them.

      The context can be disabled or changed by explicitly setting the context option. All hygiene mechanisms are based on such @@ -973,7 +976,7 @@

      Stacktrace information

      the quote will always point to GenServer.Behaviour file.

      - Source + Source

      @@ -1006,7 +1009,7 @@

      Alias shortcut

      up an alias. Please check alias for more information.

      - Source + Source

      @@ -1037,7 +1040,7 @@

      Examples

      - Source + Source

      @@ -1054,7 +1057,7 @@

      Examples

      - Source + Source

      @@ -1067,7 +1070,7 @@

      Examples

      Check quote/2 for more information.

      - Source + Source

      @@ -1077,7 +1080,7 @@

      Examples

      Check quote/2 for more information.

      - Source + Source

      @@ -1092,7 +1095,7 @@

      Examples

      - Source + Source diff --git a/docs/master/Kernel.Typespec.html b/docs/master/Kernel.Typespec.html index 4be9c6f79..6b3fec7e7 100644 --- a/docs/master/Kernel.Typespec.html +++ b/docs/master/Kernel.Typespec.html @@ -119,7 +119,7 @@

      Notes

      - Source + Source @@ -237,7 +237,7 @@

      Functions

      on the file system.

      - Source + Source

      @@ -252,7 +252,7 @@

      Functions

      on the file system.

      - Source + Source

      @@ -267,7 +267,7 @@

      Functions

      on the file system.

      - Source + Source

      @@ -276,7 +276,7 @@

      Functions

      Defines a callback by receiving Erlang's typespec.

      - Source + Source

      @@ -285,7 +285,7 @@

      Functions

      Defines a spec by receiving Erlang's typespec.

      - Source + Source

      @@ -294,7 +294,7 @@

      Functions

      Defines a type, typep or opaque by receiving Erlang's typespec.

      - Source + Source

      @@ -304,7 +304,7 @@

      Functions

      This function is only available for modules being compiled.

      - Source + Source

      @@ -314,7 +314,7 @@

      Functions

      This function is only available for modules being compiled.

      - Source + Source

      @@ -325,7 +325,7 @@

      Functions

      for modules being compiled.

      - Source + Source

      @@ -334,7 +334,7 @@

      Functions

      Converts a spec clause back to Elixir AST.

      - Source + Source

      @@ -343,7 +343,7 @@

      Functions

      Converts a type clause back to Elixir AST.

      - Source + Source
      @@ -365,7 +365,7 @@

      Examples

      - Source + Source

      @@ -380,7 +380,7 @@

      Examples

      - Source + Source

      @@ -395,7 +395,7 @@

      Examples

      - Source + Source

      @@ -410,7 +410,7 @@

      Examples

      - Source + Source

      @@ -425,7 +425,7 @@

      Examples

      - Source + Source diff --git a/docs/master/Kernel.html b/docs/master/Kernel.html index 8cbd8e0ec..0be9e10b6 100644 --- a/docs/master/Kernel.html +++ b/docs/master/Kernel.html @@ -47,7 +47,7 @@

      - Source + Source @@ -904,7 +904,7 @@

      Examples

      - Source + Source

      @@ -923,7 +923,7 @@

      Examples

      - Source + Source

      @@ -938,7 +938,7 @@

      Examples

      - Source + Source

      @@ -965,7 +965,7 @@

      Examples

      - Source + Source

      @@ -983,7 +983,7 @@

      Examples

      - Source + Source

      @@ -992,7 +992,7 @@

      Examples

      Works like binary_to_atom/2, but the atom must already exist.

      - Source + Source

      @@ -1007,7 +1007,7 @@

      Examples

      - Source + Source

      @@ -1022,7 +1022,7 @@

      Examples

      - Source + Source

      @@ -1038,7 +1038,7 @@

      Examples

      - Source + Source

      @@ -1047,7 +1047,7 @@

      Examples

      Returns a list of integers which correspond to the bytes of binary.

      - Source + Source

      @@ -1058,7 +1058,7 @@

      Examples

      are numbered starting from 1.

      - Source + Source

      @@ -1075,7 +1075,7 @@

      Examples

      - Source + Source

      @@ -1101,7 +1101,7 @@

      Examples

      - Source + Source

      @@ -1120,7 +1120,7 @@

      Examples

      - Source + Source

      @@ -1131,7 +1131,7 @@

      Examples

      be a bitstring containing the remaining bits (1 up to 7 bits).

      - Source + Source

      @@ -1152,7 +1152,7 @@

      Examples

      - Source + Source

      @@ -1169,7 +1169,7 @@

      Examples

      - Source + Source

      @@ -1178,7 +1178,7 @@

      Examples

      Converts the given number to a float. Allowed in guard clauses.

      - Source + Source

      @@ -1194,7 +1194,7 @@

      Examples

      - Source + Source

      @@ -1217,7 +1217,7 @@

      Examples

      - Source + Source

      @@ -1232,7 +1232,7 @@

      Examples

      - Source + Source

      @@ -1255,7 +1255,7 @@

      Examples

      - Source + Source

      @@ -1272,7 +1272,7 @@

      Examples

      information.

      - Source + Source

      @@ -1281,7 +1281,7 @@

      Examples

      Returns the head of a list, raises badarg if the list is empty.

      - Source + Source

      @@ -1297,7 +1297,7 @@

      Examples

      - Source + Source

      @@ -1313,7 +1313,7 @@

      Examples

      - Source + Source

      @@ -1328,7 +1328,7 @@

      Examples

      - Source + Source

      @@ -1344,7 +1344,7 @@

      Examples

      - Source + Source

      @@ -1359,7 +1359,7 @@

      Examples

      - Source + Source

      @@ -1377,7 +1377,7 @@

      Examples

      - Source + Source

      @@ -1387,7 +1387,7 @@

      Examples

      if the node can be part of a distributed system.

      - Source + Source

      @@ -1398,7 +1398,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1411,7 +1411,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1422,7 +1422,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1434,7 +1434,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1445,7 +1445,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1456,7 +1456,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1468,7 +1468,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1479,7 +1479,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1490,7 +1490,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1502,7 +1502,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1513,7 +1513,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1524,7 +1524,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1535,7 +1535,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1546,7 +1546,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1563,7 +1563,7 @@

      Examples

      - Source + Source

      @@ -1578,7 +1578,7 @@

      Examples

      - Source + Source

      @@ -1593,7 +1593,7 @@

      Examples

      - Source + Source

      @@ -1612,7 +1612,7 @@

      Examples

      - Source + Source

      @@ -1622,7 +1622,7 @@

      Examples

      exists such atom.

      - Source + Source

      @@ -1637,7 +1637,7 @@

      Examples

      - Source + Source

      @@ -1652,7 +1652,7 @@

      Examples

      - Source + Source

      @@ -1667,7 +1667,7 @@

      Examples

      - Source + Source

      @@ -1688,7 +1688,7 @@

      Examples

      - Source + Source

      @@ -1703,7 +1703,7 @@

      Examples

      - Source + Source

      @@ -1717,7 +1717,7 @@

      Examples

      information.

      - Source + Source

      @@ -1734,7 +1734,7 @@

      Examples

      - Source + Source

      @@ -1751,7 +1751,7 @@

      Examples

      - Source + Source

      @@ -1768,7 +1768,7 @@

      Examples

      - Source + Source

      @@ -1780,7 +1780,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1793,7 +1793,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1811,7 +1811,7 @@

      Warning:

      It should not be used in application programs.

      - Source + Source

      @@ -1838,7 +1838,7 @@

      Examples

      - Source + Source

      @@ -1861,7 +1861,7 @@

      Examples

      - Source + Source

      @@ -1890,7 +1890,7 @@

      Examples

      may change the System.stacktrace value.

      - Source + Source

      @@ -1906,7 +1906,7 @@

      Examples

      - Source + Source

      @@ -1916,7 +1916,7 @@

      Examples

      Allowed in guard clauses.

      - Source + Source

      @@ -1926,7 +1926,7 @@

      Examples

      or a binary. If possible, please use tuple_size or binary_size.

      - Source + Source

      @@ -1948,7 +1948,7 @@

      Examples

      - Source + Source

      @@ -1966,7 +1966,7 @@

      Examples

      - Source + Source

      @@ -1988,7 +1988,7 @@

      Examples

      - Source + Source

      @@ -2006,7 +2006,7 @@

      Examples

      - Source + Source

      @@ -2020,7 +2020,7 @@

      Examples

      of communications channel not supported by distributed :

      - Source + Source

      @@ -2036,7 +2036,7 @@

      Examples

      - Source + Source

      @@ -2045,7 +2045,7 @@

      Examples

      A non-local return from a function. Check try/2 for more information.

      - Source + Source

      @@ -2054,7 +2054,7 @@

      Examples

      Returns the tail of a list. Raises ArgumentError if the list is empty.

      - Source + Source

      @@ -2070,7 +2070,7 @@

      Examples

      - Source + Source

      @@ -2079,7 +2079,7 @@

      Examples

      Returns the size of a tuple.

      - Source + Source

      @@ -2088,7 +2088,7 @@

      Examples

      Converts a tuple to a list.

      - Source + Source
      @@ -2118,7 +2118,7 @@

      Examples

      - Source + Source

      @@ -2140,7 +2140,7 @@

      Examples

      - Source + Source

      @@ -2159,7 +2159,7 @@

      Examples

      - Source + Source

      @@ -2187,7 +2187,7 @@

      Examples

      not only booleans, however it is not allowed in guards.

      - Source + Source

      @@ -2202,7 +2202,7 @@

      Examples

      - Source + Source

      @@ -2217,7 +2217,7 @@

      Examples

      - Source + Source

      @@ -2235,7 +2235,7 @@

      Examples

      - Source + Source

      @@ -2250,7 +2250,7 @@

      Examples

      - Source + Source

      @@ -2269,7 +2269,7 @@

      Examples

      - Source + Source

      @@ -2291,7 +2291,7 @@

      Examples

      - Source + Source

      @@ -2310,7 +2310,7 @@

      Examples

      - Source + Source

      @@ -2326,7 +2326,7 @@

      Examples

      - Source + Source

      @@ -2343,7 +2343,7 @@

      Examples

      - Source + Source

      @@ -2359,7 +2359,7 @@

      Examples

      - Source + Source

      @@ -2382,7 +2382,7 @@

      Examples

      - Source + Source

      @@ -2405,7 +2405,7 @@

      Examples

      - Source + Source

      @@ -2424,7 +2424,7 @@

      Examples

      - Source + Source

      @@ -2443,7 +2443,7 @@

      Examples

      - Source + Source

      @@ -2459,7 +2459,7 @@

      Examples

      - Source + Source

      @@ -2475,7 +2475,7 @@

      Examples

      - Source + Source

      @@ -2525,7 +2525,7 @@

      Examples

      to manipulate module attributes.

      - Source + Source

      @@ -2543,7 +2543,7 @@

      Examples

      - Source + Source

      @@ -2561,7 +2561,7 @@

      Examples

      - Source + Source

      @@ -2577,7 +2577,7 @@

      Examples

      - Source + Source

      @@ -2601,7 +2601,7 @@

      Examples

      - Source + Source

      @@ -2619,7 +2619,7 @@

      Examples

      - Source + Source

      @@ -2637,7 +2637,7 @@

      Examples

      - Source + Source

      @@ -2652,7 +2652,7 @@

      Examples

      - Source + Source

      @@ -2679,7 +2679,7 @@

      Examples

      - Source + Source

      @@ -2748,7 +2748,7 @@

      Atoms

      In this case, "Hello" will be printed twice (one per each field).

      - Source + Source

      @@ -2764,7 +2764,7 @@

      Examples

      - Source + Source

      @@ -2779,7 +2779,7 @@

      Examples

      - Source + Source

      @@ -2794,7 +2794,7 @@

      Examples

      - Source + Source

      @@ -2810,7 +2810,7 @@

      Examples

      - Source + Source

      @@ -2826,7 +2826,7 @@

      Examples

      - Source + Source

      @@ -2845,7 +2845,7 @@

      Examples

      - Source + Source

      @@ -2889,7 +2889,7 @@

      Examples

      The example above will actually fail because 10 does not match 1.

      - Source + Source

      @@ -2912,7 +2912,7 @@

      Examples

      - Source + Source

      @@ -2942,7 +2942,7 @@

      Examples

      two arguments and sum them.

      - Source + Source

      @@ -2981,7 +2981,7 @@

      Examples

      - Source + Source

      @@ -3029,7 +3029,7 @@

      Examples

      - Source + Source

      @@ -3047,7 +3047,7 @@

      Examples

      binary as result;

      - Source + Source

      @@ -3057,7 +3057,7 @@

      Examples

      defprotocol/2 for examples.

      - Source + Source

      @@ -3082,7 +3082,7 @@

      Examples

      - Source + Source

      @@ -3091,7 +3091,7 @@

      Examples

      The same as def/4 but generates a macro.

      - Source + Source

      @@ -3103,7 +3103,7 @@

      Examples

      Check defmacro/2 for more information

      - Source + Source

      @@ -3112,7 +3112,7 @@

      Examples

      The same as def/4 but generates a private macro.

      - Source + Source

      @@ -3162,7 +3162,7 @@

      Dynamic names

      returns an atom.

      - Source + Source

      @@ -3173,7 +3173,7 @@

      Dynamic names

      developer to customize it.

      - Source + Source

      @@ -3199,7 +3199,7 @@

      Examples

      through Foo.sum will raise an error.

      - Source + Source

      @@ -3208,7 +3208,7 @@

      Examples

      The same as def/4 but generates a private function.

      - Source + Source

      @@ -3340,7 +3340,7 @@

      Types

      given protocol are valid argument types for the given function.

      - Source + Source

      @@ -3510,7 +3510,7 @@

      Importing records

      See Record.import/2 and defrecordp/2 documentation for more information

      - Source + Source

      @@ -3560,7 +3560,7 @@

      Examples

      - Source + Source

      @@ -3582,7 +3582,7 @@

      Example

      - Source + Source

      @@ -3622,7 +3622,7 @@

      Examples

      it will raise a CaseClauseError.

      - Source + Source

      @@ -3639,7 +3639,7 @@

      Examples

      - Source + Source

      @@ -3658,7 +3658,7 @@

      Example

      - Source + Source

      @@ -3752,7 +3752,7 @@

      Shortcut syntax

      - Source + Source

      @@ -3768,7 +3768,7 @@

      Examples

      - Source + Source

      @@ -3814,7 +3814,7 @@

      Blocks examples

      macro.

      - Source + Source

      @@ -3861,7 +3861,7 @@

      Clauses

      the variable for us.

      - Source + Source

      @@ -3879,7 +3879,7 @@

      Example

      - Source + Source

      @@ -3892,16 +3892,25 @@

      Options

      The following options are supported:

        -
      • :raw - tuples are not formatted as the inspect protocol, they are -always shown as tuples, defaults to false;

      • -
      • :limit - the limit of items that are shown in tuples, bitstrings and -lists. Does not apply to strings;

      • +
      • raw -- when true, record tuples are not formatted by the inspect protocol, + but are printed as just tuples; default: false

      • +
      • limit -- limits the number of items that are printed for tuples, bitstrings, + and lists; does not apply to strings

      Examples

      iex> inspect(:foo)
       ":foo"
      +
      +iex> inspect [1,2,3,4,5], limit: 3
      +"[1,2,3,...]"
      +
      +inspect(ArgumentError[])
      +#=> "ArgumentError[message: "argument error"]"
      +
      +inspect(ArgumentError[], raw: true)
      +#=> "{ArgumentError,:__exception__,"argument error"}"
       

      Note that the inspect protocol does not necessarily return a valid @@ -3913,7 +3922,7 @@

      Examples

      - Source + Source

      @@ -3930,7 +3939,7 @@

      Examples

      - Source + Source

      @@ -3939,7 +3948,7 @@

      Examples

      Checks if the given argument is a range.

      - Source + Source

      @@ -3948,7 +3957,7 @@

      Examples

      Checks if the given argument is a record.

      - Source + Source

      @@ -3967,7 +3976,7 @@

      Examples

      - Source + Source

      @@ -3976,7 +3985,7 @@

      Examples

      Checks if the given argument is a regex.

      - Source + Source

      @@ -4008,7 +4017,7 @@

      Examples

      - Source + Source

      @@ -4026,7 +4035,7 @@

      Examples

      - Source + Source

      @@ -4042,7 +4051,7 @@

      Examples

      - Source + Source

      @@ -4058,7 +4067,7 @@

      Examples

      - Source + Source

      @@ -4108,7 +4117,7 @@

      Examples

      - Source + Source

      @@ -4125,7 +4134,7 @@

      Examples

      - Source + Source

      @@ -4142,7 +4151,7 @@

      Example

      - Source + Source

      @@ -4158,7 +4167,7 @@

      Examples

      - Source + Source

      @@ -4173,7 +4182,7 @@

      Examples

      - Source + Source

      @@ -4292,7 +4301,7 @@

      Variable visibility

      - Source + Source

      @@ -4312,7 +4321,7 @@

      Examples

      - Source + Source

      @@ -4351,7 +4360,7 @@

      Examples

      - Source + Source

      @@ -4370,7 +4379,7 @@

      Examples

      - Source + Source

      @@ -4411,7 +4420,7 @@

      Examples

      - Source + Source

      @@ -4438,7 +4447,7 @@

      Examples

      not only booleans, however it is not allowed in guards.

      - Source + Source diff --git a/docs/master/KeyError.html b/docs/master/KeyError.html index cdf39650d..539551ce3 100644 --- a/docs/master/KeyError.html +++ b/docs/master/KeyError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -71,7 +71,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Keyword.html b/docs/master/Keyword.html index 0be413c57..e62dc7929 100644 --- a/docs/master/Keyword.html +++ b/docs/master/Keyword.html @@ -42,7 +42,7 @@

      - Source + Source @@ -185,7 +185,7 @@

      Examples

      - Source + Source

      @@ -203,7 +203,7 @@

      Examples

      - Source + Source

      @@ -219,7 +219,7 @@

      Examples

      - Source + Source

      @@ -238,7 +238,7 @@

      Examples

      - Source + Source

      @@ -251,12 +251,13 @@

      Examples

      iex> Keyword.fetch!([a: 1], :a)
       1
      +
       iex> Keyword.fetch!([a: 1], :b)
       ** (KeyError) key not found: :b
       
      - Source + Source

      @@ -267,7 +268,7 @@

      Examples

      duplicated entries.

      - Source + Source

      @@ -292,7 +293,7 @@

      Examples

      - Source + Source

      @@ -307,7 +308,7 @@

      Examples

      - Source + Source

      @@ -324,7 +325,7 @@

      Examples

      - Source + Source

      @@ -340,7 +341,7 @@

      Examples

      - Source + Source

      @@ -349,7 +350,7 @@

      Examples

      Checks if the given argument is a keywords list or not

      - Source + Source

      @@ -365,7 +366,7 @@

      Examples

      - Source + Source

      @@ -383,7 +384,7 @@

      Examples

      - Source + Source

      @@ -392,7 +393,7 @@

      Examples

      Returns an empty keyword list, i.e. an empty list.

      - Source + Source

      @@ -408,7 +409,7 @@

      Examples

      - Source + Source

      @@ -425,7 +426,7 @@

      Examples

      - Source + Source

      @@ -443,7 +444,7 @@

      Examples

      - Source + Source

      @@ -459,7 +460,7 @@

      Examples

      - Source + Source

      @@ -472,12 +473,13 @@

      Examples

      iex> Keyword.update([a: 1], :a, &1 * 2)
       [a: 2]
      +
       iex> Keyword.update([a: 1], :b, &1 * 2)
       ** (KeyError) key not found: :b
       
      - Source + Source

      @@ -495,7 +497,7 @@

      Examples

      - Source + Source

      @@ -510,7 +512,7 @@

      Examples

      - Source + Source diff --git a/docs/master/List.Chars.Atom.html b/docs/master/List.Chars.Atom.html index 7d1c90a0e..cd219675f 100644 --- a/docs/master/List.Chars.Atom.html +++ b/docs/master/List.Chars.Atom.html @@ -29,7 +29,7 @@

      - Source + Source @@ -60,7 +60,7 @@

      Functions

      - Source + Source diff --git a/docs/master/List.Chars.BitString.html b/docs/master/List.Chars.BitString.html index 83fc230e3..1ba8adbdb 100644 --- a/docs/master/List.Chars.BitString.html +++ b/docs/master/List.Chars.BitString.html @@ -29,7 +29,7 @@

      - Source + Source @@ -60,7 +60,7 @@

      Functions

      - Source + Source diff --git a/docs/master/List.Chars.List.html b/docs/master/List.Chars.List.html index 5b01a9bfc..47e369349 100644 --- a/docs/master/List.Chars.List.html +++ b/docs/master/List.Chars.List.html @@ -29,7 +29,7 @@

      - Source + Source @@ -60,7 +60,7 @@

      Functions

      - Source + Source diff --git a/docs/master/List.Chars.Number.html b/docs/master/List.Chars.Number.html index fac2c0f24..6e14e88b6 100644 --- a/docs/master/List.Chars.Number.html +++ b/docs/master/List.Chars.Number.html @@ -29,7 +29,7 @@

      - Source + Source @@ -60,7 +60,7 @@

      Functions

      - Source + Source diff --git a/docs/master/List.Chars.html b/docs/master/List.Chars.html index 31a898883..98ce7e86d 100644 --- a/docs/master/List.Chars.html +++ b/docs/master/List.Chars.html @@ -40,7 +40,7 @@

      - Source + Source

      Implementations

      @@ -100,7 +100,7 @@

      Functions

      - Source + Source diff --git a/docs/master/List.html b/docs/master/List.html index 1c8ba6b24..bad89037d 100644 --- a/docs/master/List.html +++ b/docs/master/List.html @@ -39,7 +39,7 @@

      - Source + Source @@ -162,7 +162,7 @@

      Examples

      - Source + Source

      @@ -181,7 +181,7 @@

      Examples

      - Source + Source

      @@ -198,7 +198,7 @@

      Examples

      - Source + Source

      @@ -216,7 +216,7 @@

      Examples

      - Source + Source

      @@ -236,7 +236,7 @@

      Examples

      - Source + Source

      @@ -244,7 +244,7 @@

      Examples

      - Source + Source

      @@ -263,7 +263,7 @@

      Examples

      - Source + Source

      @@ -279,7 +279,7 @@

      Examples

      - Source + Source

      @@ -302,7 +302,7 @@

      Examples

      - Source + Source

      @@ -325,7 +325,7 @@

      Examples

      - Source + Source

      @@ -348,7 +348,7 @@

      Examples

      - Source + Source

      @@ -371,7 +371,7 @@

      Examples

      - Source + Source

      @@ -387,7 +387,7 @@

      Examples

      - Source + Source

      @@ -404,7 +404,7 @@

      Examples

      - Source + Source

      @@ -423,7 +423,7 @@

      Examples

      - Source + Source

      @@ -442,7 +442,7 @@

      Examples

      - Source + Source

      @@ -459,7 +459,7 @@

      Examples

      - Source + Source

      @@ -477,7 +477,7 @@

      Examples

      - Source + Source diff --git a/docs/master/ListDict.html b/docs/master/ListDict.html index 8f02941d3..7ce779a92 100644 --- a/docs/master/ListDict.html +++ b/docs/master/ListDict.html @@ -35,7 +35,7 @@

      - Source + Source @@ -177,7 +177,7 @@

      Functions

      Deletes the entry under the given key from the dict.

      - Source + Source

      @@ -187,7 +187,7 @@

      Functions

      which key is not in keys

      - Source + Source

      @@ -196,7 +196,7 @@

      Functions

      Returns an empty ListDict.

      - Source + Source

      @@ -205,7 +205,7 @@

      Functions

      Check if the ListDict is equal to another ListDict.

      - Source + Source

      @@ -215,7 +215,7 @@

      Functions

      dict in a tagged tuple, otherwise :error.

      - Source + Source

      @@ -225,7 +225,7 @@

      Functions

      raises KeyError if the key does not exist.

      - Source + Source

      @@ -235,7 +235,7 @@

      Functions

      dict or default if no key is set.

      - Source + Source

      @@ -244,7 +244,7 @@

      Functions

      Returns true if the dict has the given key.

      - Source + Source

      @@ -253,7 +253,7 @@

      Functions

      Returns all keys in the dict.

      - Source + Source

      @@ -262,7 +262,7 @@

      Functions

      Merges the given Enumerable into the dict.

      - Source + Source

      @@ -271,7 +271,7 @@

      Functions

      Returns a new ListDict, i.e. an empty list.

      - Source + Source

      @@ -280,7 +280,7 @@

      Functions

      Creates a new ListDict from the given pairs.

      - Source + Source

      @@ -290,7 +290,7 @@

      Functions

      via the given transformation function.

      - Source + Source

      @@ -300,7 +300,7 @@

      Functions

      from the dict as well as the dict without that key.

      - Source + Source

      @@ -309,7 +309,7 @@

      Functions

      Puts the given key-value pair in the dict.

      - Source + Source

      @@ -319,7 +319,7 @@

      Functions

      if no entry exists yet.

      - Source + Source

      @@ -328,7 +328,7 @@

      Functions

      Returns the dict size.

      - Source + Source

      @@ -340,7 +340,7 @@

      Functions

      Returns a 2-tuple of the new dicts.

      - Source + Source

      @@ -350,7 +350,7 @@

      Functions

      which key is in keys

      - Source + Source

      @@ -359,7 +359,7 @@

      Functions

      Converts the dict to a list.

      - Source + Source

      @@ -368,7 +368,7 @@

      Functions

      Updates the key in the dict according to the given function.

      - Source + Source

      @@ -378,7 +378,7 @@

      Functions

      or uses the given initial value if no entry exists.

      - Source + Source

      @@ -387,7 +387,7 @@

      Functions

      Returns all values in the dict.

      - Source + Source
      diff --git a/docs/master/Macro.Env.html b/docs/master/Macro.Env.html index c9618860d..274b0ab06 100644 --- a/docs/master/Macro.Env.html +++ b/docs/master/Macro.Env.html @@ -50,12 +50,13 @@

    3260. functions - a list of functions imported from each module
    3261. macros - a list of macros imported from each module
    3262. context_modules - a list of modules defined in the current context
    3263. +
    3264. macro_aliases - a list of aliases defined inside the current macro
    3265. - Source + Source @@ -123,6 +124,12 @@

      Fields (and defaults)

    3266. +
    3267. + + macro_aliases: nil + +
    3268. + @@ -168,7 +175,7 @@

      Functions

      inside a guard.

      - Source + Source

      @@ -178,7 +185,7 @@

      Functions

      inside a match clause.

      - Source + Source

      @@ -188,7 +195,7 @@

      Functions

      information as keys.

      - Source + Source

      @@ -197,7 +204,7 @@

      Functions

      Returns the environment stacktrace.

      - Source + Source
      diff --git a/docs/master/Macro.html b/docs/master/Macro.html index 17db392d8..f2e5a88c1 100644 --- a/docs/master/Macro.html +++ b/docs/master/Macro.html @@ -32,7 +32,7 @@

      - Source + Source @@ -129,7 +129,7 @@

      Examples

      - Source + Source

      @@ -231,7 +231,7 @@

      Examples

      - Source + Source

      @@ -254,7 +254,7 @@

      Examples

      - Source + Source

      @@ -266,7 +266,7 @@

      Examples

      which is returned as { :unsafe, term }.

      - Source + Source

      @@ -281,7 +281,7 @@

      Examples

      - Source + Source

      @@ -309,7 +309,7 @@

      Examples

      and we return a version with it unescaped.

      - Source + Source

      @@ -359,7 +359,7 @@

      Examples

      - Source + Source

      @@ -375,7 +375,7 @@

      Examples

      for examples.

      - Source + Source

      @@ -385,7 +385,7 @@

      Examples

      Check unescape_tokens/1 and unescape_binary/2 for more information.

      - Source + Source @@ -402,7 +402,7 @@

      Macros

      as a macro so it can be used in guard clauses.

      - Source + Source

      @@ -412,7 +412,7 @@

      Macros

      as a macro so it can be used in guard clauses.

      - Source + Source diff --git a/docs/master/MatchError.html b/docs/master/MatchError.html index 00cfa4749..b224b4a0c 100644 --- a/docs/master/MatchError.html +++ b/docs/master/MatchError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -71,7 +71,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Dep.html b/docs/master/Mix.Dep.html index 41e4dc410..2e1a5e005 100644 --- a/docs/master/Mix.Dep.html +++ b/docs/master/Mix.Dep.html @@ -44,7 +44,7 @@

      - Source + Source diff --git a/docs/master/Mix.Deps.html b/docs/master/Mix.Deps.html index f0c04fb5a..f4522fa54 100644 --- a/docs/master/Mix.Deps.html +++ b/docs/master/Mix.Deps.html @@ -32,7 +32,7 @@

      - Source + Source @@ -159,7 +159,7 @@

      Exceptions

      provides a dependency in the wrong format.

      - Source + Source

      @@ -169,7 +169,7 @@

      Exceptions

      accumulator.

      - Source + Source

      @@ -178,7 +178,7 @@

      Exceptions

      Check if a dependency is available.

      - Source + Source

      @@ -188,7 +188,7 @@

      Exceptions

      Logs a message if the dependency could not be found.

      - Source + Source

      @@ -197,7 +197,7 @@

      Exceptions

      Checks the lock for the given dependency and update its status accordingly.

      - Source + Source

      @@ -206,7 +206,7 @@

      Exceptions

      Returns all direct child dependencies.

      - Source + Source

      @@ -215,7 +215,7 @@

      Exceptions

      Returns all compile paths for the dependency.

      - Source + Source

      @@ -224,7 +224,7 @@

      Exceptions

      Returns all dependencies depending on given dependencies.

      - Source + Source

      @@ -233,7 +233,7 @@

      Exceptions

      Format the dependency for printing.

      - Source + Source

      @@ -242,7 +242,7 @@

      Exceptions

      Formats the status of a dependency.

      - Source + Source

      @@ -253,7 +253,7 @@

      Exceptions

      project into the project stack.

      - Source + Source

      @@ -262,7 +262,7 @@

      Exceptions

      Check if a dependency is part of an umbrella project as a top level project.

      - Source + Source

      @@ -271,7 +271,7 @@

      Exceptions

      Returns all load paths for the dependency.

      - Source + Source

      @@ -280,7 +280,7 @@

      Exceptions

      Returns true if dependency is a make project.

      - Source + Source

      @@ -289,7 +289,7 @@

      Exceptions

      Returns true if dependency is a mix project.

      - Source + Source

      @@ -298,7 +298,7 @@

      Exceptions

      Check if a dependency is ok.

      - Source + Source

      @@ -309,7 +309,7 @@

      Exceptions

      invoking this function.

      - Source + Source

      @@ -318,7 +318,7 @@

      Exceptions

      Returns true if dependency is a rebar project.

      - Source + Source

      @@ -327,7 +327,7 @@

      Exceptions

      Updates the dependency inside the given project.

      - Source + Source
      diff --git a/docs/master/Mix.Error.html b/docs/master/Mix.Error.html index 04a24e70f..6a0432a40 100644 --- a/docs/master/Mix.Error.html +++ b/docs/master/Mix.Error.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/master/Mix.Generator.html b/docs/master/Mix.Generator.html index b3b41d818..870ff6e49 100644 --- a/docs/master/Mix.Generator.html +++ b/docs/master/Mix.Generator.html @@ -32,7 +32,7 @@

      - Source + Source @@ -89,7 +89,7 @@

      Functions

      Creates a directory if one does not exist yet.

      - Source + Source

      @@ -99,7 +99,7 @@

      Functions

      If the file already exists, asks for user confirmation.

      - Source + Source @@ -124,7 +124,7 @@

      Macros

      For more information, check EEx.SmartEngine.

      - Source + Source

      @@ -136,7 +136,7 @@

      Macros

      _text that expects no argument.

      - Source + Source

      @@ -150,7 +150,7 @@

      Macros

      - Source + Source diff --git a/docs/master/Mix.InvalidTaskError.html b/docs/master/Mix.InvalidTaskError.html index 016477ca1..f0752eddb 100644 --- a/docs/master/Mix.InvalidTaskError.html +++ b/docs/master/Mix.InvalidTaskError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -77,7 +77,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Local.html b/docs/master/Mix.Local.html index 89ac247a4..47d47e437 100644 --- a/docs/master/Mix.Local.html +++ b/docs/master/Mix.Local.html @@ -32,7 +32,7 @@

      - Source + Source @@ -79,7 +79,7 @@

      Functions

      Returns all tasks modules in .mix/tasks.

      - Source + Source

      @@ -88,7 +88,7 @@

      Functions

      Append mix paths into Erlang code path.

      - Source + Source

      @@ -97,7 +97,7 @@

      Functions

      Append local tasks path into Erlang code path.

      - Source + Source

      @@ -106,7 +106,7 @@

      Functions

      The path for local tasks.

      - Source + Source
      diff --git a/docs/master/Mix.NoProjectError.html b/docs/master/Mix.NoProjectError.html index 34bf17bbe..cc6664680 100644 --- a/docs/master/Mix.NoProjectError.html +++ b/docs/master/Mix.NoProjectError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/master/Mix.NoTaskError.html b/docs/master/Mix.NoTaskError.html index ce8ccae87..13026bd55 100644 --- a/docs/master/Mix.NoTaskError.html +++ b/docs/master/Mix.NoTaskError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -77,7 +77,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.OutOfDateDepsError.html b/docs/master/Mix.OutOfDateDepsError.html index 7cc86e8cd..5339ec867 100644 --- a/docs/master/Mix.OutOfDateDepsError.html +++ b/docs/master/Mix.OutOfDateDepsError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -77,7 +77,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Project.html b/docs/master/Mix.Project.html index 940a01bab..d0166d8ea 100644 --- a/docs/master/Mix.Project.html +++ b/docs/master/Mix.Project.html @@ -61,7 +61,7 @@

      Examples

      - Source + Source @@ -143,7 +143,7 @@

      Functions

      Returns the path to the apps directory.

      - Source + Source

      @@ -152,7 +152,7 @@

      Functions

      Returns the paths this project compiles to.

      - Source + Source

      @@ -162,7 +162,7 @@

      Functions

      considering the current environment.

      - Source + Source

      @@ -171,7 +171,7 @@

      Functions

      Returns a list of project config files (mix.exs and mix.lock).

      - Source + Source

      @@ -188,7 +188,7 @@

      Functions

      Returns nil if no project.

      - Source + Source

      @@ -197,7 +197,7 @@

      Functions

      Same as get/0 but raises an exception if no project.

      - Source + Source

      @@ -208,7 +208,7 @@

      Functions

      into the project stack.

      - Source + Source

      @@ -217,7 +217,7 @@

      Functions

      Returns all load paths for this project.

      - Source + Source

      @@ -231,7 +231,7 @@

      Functions

      if it is an umbrella project or not.

      - Source + Source

      @@ -241,7 +241,7 @@

      Functions

      when the environment changes during a task.

      - Source + Source

      @@ -250,7 +250,7 @@

      Functions

      Returns true if project is an umbrella project.

      - Source + Source
      diff --git a/docs/master/Mix.SCM.html b/docs/master/Mix.SCM.html index 0dac3796d..6e6711c6b 100644 --- a/docs/master/Mix.SCM.html +++ b/docs/master/Mix.SCM.html @@ -35,7 +35,7 @@

      - Source + Source @@ -75,7 +75,7 @@

      Callbacks summary

    3269. - equals?/2 + equal?/2
    3270. @@ -127,7 +127,7 @@

      Functions

      Returns all available SCM.

      - Source + Source

      @@ -136,7 +136,7 @@

      Functions

      Register the scm repository with the given key and mod.

      - Source + Source

      @@ -145,7 +145,7 @@

      Functions

      Register builtin SCMs.

      - Source + Source
      @@ -163,18 +163,18 @@

      Callbacks

      This behavior function should clean the given dependency.

      - Source + Source
      -

      - equals?(opts1 :: opts(), opts2 :: opts()) +

      + equal?(opts1 :: opts(), opts2 :: opts())

      Receives two options and must return true if the refer to the same repository. The options are guaranteed to belong to the same SCM.

      - Source + Source

      @@ -186,7 +186,7 @@

      Callbacks

      return true.

      - Source + Source

      @@ -202,7 +202,7 @@

      Callbacks

      It must return the current lock.

      - Source + Source

      @@ -216,7 +216,7 @@

      Callbacks

      to the latest version.

      - Source + Source

      @@ -226,7 +226,7 @@

      Callbacks

      dependency is available.

      - Source + Source

      @@ -246,7 +246,7 @@

      Callbacks

      while other SCMs would simply return nil.

      - Source + Source

      @@ -256,7 +256,7 @@

      Callbacks

      lock information for printing.

      - Source + Source

      @@ -266,7 +266,7 @@

      Callbacks

      information for printing.

      - Source + Source diff --git a/docs/master/Mix.Shell.IO.html b/docs/master/Mix.Shell.IO.html index 1814f48f4..9b512b63f 100644 --- a/docs/master/Mix.Shell.IO.html +++ b/docs/master/Mix.Shell.IO.html @@ -33,7 +33,7 @@

      - Source + Source @@ -86,7 +86,7 @@

      Functions

      to stdout as it comes.

      - Source + Source

      @@ -95,7 +95,7 @@

      Functions

      Writes an error message to the shell followed by new line.

      - Source + Source

      @@ -104,7 +104,7 @@

      Functions

      Writes a message to the shell followed by new line.

      - Source + Source

      @@ -112,7 +112,7 @@

      Functions

      - Source + Source

      @@ -123,7 +123,7 @@

      Functions

      regex %r/^Y(es)?$/i.

      - Source + Source diff --git a/docs/master/Mix.Shell.Process.html b/docs/master/Mix.Shell.Process.html index 833f01f3c..40f84b679 100644 --- a/docs/master/Mix.Shell.Process.html +++ b/docs/master/Mix.Shell.Process.html @@ -45,7 +45,7 @@

      - Source + Source @@ -103,7 +103,7 @@

      Functions

      the current process.

      - Source + Source

      @@ -112,7 +112,7 @@

      Functions

      Simply forwards the message to the current process.

      - Source + Source

      @@ -127,7 +127,7 @@

      Examples

      - Source + Source

      @@ -136,7 +136,7 @@

      Examples

      Simply forwards the message to the current process.

      - Source + Source

      @@ -144,7 +144,7 @@

      Examples

      - Source + Source

      @@ -160,7 +160,7 @@

      Examples

      process input given. Value must be true or false.

      - Source + Source diff --git a/docs/master/Mix.Shell.html b/docs/master/Mix.Shell.html index abe8b4db8..9c9bf7f41 100644 --- a/docs/master/Mix.Shell.html +++ b/docs/master/Mix.Shell.html @@ -34,7 +34,7 @@

      - Source + Source @@ -97,7 +97,7 @@

      Functions

      is shared accross different shells.

      - Source + Source

      @@ -106,7 +106,7 @@

      Functions

      Returns if we should output application name to shell.

      - Source + Source
      @@ -125,7 +125,7 @@

      Callbacks

      its exit status.

      - Source + Source

      @@ -134,7 +134,7 @@

      Callbacks

      Asks the user for confirmation.

      - Source + Source

      @@ -143,7 +143,7 @@

      Callbacks

      Warns about the given error message.

      - Source + Source

      @@ -152,7 +152,7 @@

      Callbacks

      Informs the given message.

      - Source + Source
      diff --git a/docs/master/Mix.Task.html b/docs/master/Mix.Task.html index 43bb6e93c..d28e8091b 100644 --- a/docs/master/Mix.Task.html +++ b/docs/master/Mix.Task.html @@ -34,7 +34,7 @@

      - Source + Source @@ -127,7 +127,7 @@

      Functions

      won't show up. Check load_all/0 if you want to preload all tasks.

      - Source + Source

      @@ -137,7 +137,7 @@

      Functions

      Returns an ordset with all the tasks invoked thus far.

      - Source + Source

      @@ -153,7 +153,7 @@

      Exceptions

      - Source + Source

      @@ -162,7 +162,7 @@

      Exceptions

      Checks if the task is hidden or not. Returns a boolean.

      - Source + Source

      @@ -171,7 +171,7 @@

      Exceptions

      Loads all tasks in all code paths.

      - Source + Source

      @@ -181,7 +181,7 @@

      Exceptions

      Returns the moduledoc or nil.

      - Source + Source

      @@ -190,7 +190,7 @@

      Exceptions

      Checks if the task is defined for umbrella projects.

      - Source + Source

      @@ -200,7 +200,7 @@

      Exceptions

      an umbrella project reenables a task it is reenabled for all sub projects.

      - Source + Source

      @@ -217,7 +217,7 @@

      Exceptions

      or it is invalid. Check get/2 for more information.

      - Source + Source

      @@ -227,7 +227,7 @@

      Exceptions

      Returns the shortdoc or nil.

      - Source + Source

      @@ -236,7 +236,7 @@

      Exceptions

      Returns the task name for the given module.

      - Source + Source
      @@ -249,13 +249,13 @@

      Exceptions

      Callbacks

      - run(list(binary())) + run([binary()])

      A task needs to implement run which receives a list of command line args.

      - Source + Source
      diff --git a/docs/master/Mix.Tasks.App.Start.html b/docs/master/Mix.Tasks.App.Start.html index 0c29ecda9..1441c7203 100644 --- a/docs/master/Mix.Tasks.App.Start.html +++ b/docs/master/Mix.Tasks.App.Start.html @@ -40,7 +40,7 @@

      Command line options

      - Source + Source @@ -71,7 +71,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Tasks.Clean.html b/docs/master/Mix.Tasks.Clean.html index 9ec3890cd..711aaf4fa 100644 --- a/docs/master/Mix.Tasks.Clean.html +++ b/docs/master/Mix.Tasks.Clean.html @@ -38,7 +38,7 @@

      Command line options

      - Source + Source @@ -69,7 +69,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Tasks.Compile.App.html b/docs/master/Mix.Tasks.Compile.App.html index 715c31577..b17d54f7b 100644 --- a/docs/master/Mix.Tasks.Compile.App.html +++ b/docs/master/Mix.Tasks.Compile.App.html @@ -56,7 +56,7 @@

      Configuration

      - Source + Source @@ -87,7 +87,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Tasks.Compile.Elixir.html b/docs/master/Mix.Tasks.Compile.Elixir.html index 197840526..fcfbb4b77 100644 --- a/docs/master/Mix.Tasks.Compile.Elixir.html +++ b/docs/master/Mix.Tasks.Compile.Elixir.html @@ -82,7 +82,7 @@

      Configuration

      - Source + Source @@ -113,7 +113,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Tasks.Compile.Erlang.html b/docs/master/Mix.Tasks.Compile.Erlang.html index 0e2a8b450..9ce60ff3a 100644 --- a/docs/master/Mix.Tasks.Compile.Erlang.html +++ b/docs/master/Mix.Tasks.Compile.Erlang.html @@ -72,7 +72,7 @@

      Configuration

      - Source + Source @@ -123,7 +123,7 @@

      Functions

      extension.

      - Source + Source

      @@ -132,7 +132,7 @@

      Functions

      Interprets compilation results and prints them to the console.

      - Source + Source

      @@ -140,7 +140,7 @@

      Functions

      - Source + Source

      @@ -150,7 +150,7 @@

      Functions

      Erlang compilation tools.

      - Source + Source diff --git a/docs/master/Mix.Tasks.Compile.Leex.html b/docs/master/Mix.Tasks.Compile.Leex.html index 98fc614d2..56124d783 100644 --- a/docs/master/Mix.Tasks.Compile.Leex.html +++ b/docs/master/Mix.Tasks.Compile.Leex.html @@ -56,7 +56,7 @@

      Configuration

      - Source + Source @@ -87,7 +87,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Tasks.Compile.Yecc.html b/docs/master/Mix.Tasks.Compile.Yecc.html index d1f6bde6f..1e0022226 100644 --- a/docs/master/Mix.Tasks.Compile.Yecc.html +++ b/docs/master/Mix.Tasks.Compile.Yecc.html @@ -56,7 +56,7 @@

      Configuration

      - Source + Source @@ -87,7 +87,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Tasks.Compile.html b/docs/master/Mix.Tasks.Compile.html index ee3975dce..0b2d03d04 100644 --- a/docs/master/Mix.Tasks.Compile.html +++ b/docs/master/Mix.Tasks.Compile.html @@ -66,7 +66,7 @@

      Common configuration

      - Source + Source @@ -97,7 +97,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Tasks.Deps.Check.html b/docs/master/Mix.Tasks.Deps.Check.html index 384f55d29..06597528d 100644 --- a/docs/master/Mix.Tasks.Deps.Check.html +++ b/docs/master/Mix.Tasks.Deps.Check.html @@ -36,7 +36,7 @@

      - Source + Source @@ -67,7 +67,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Tasks.Deps.Clean.html b/docs/master/Mix.Tasks.Deps.Clean.html index abde4363c..e4ababde8 100644 --- a/docs/master/Mix.Tasks.Deps.Clean.html +++ b/docs/master/Mix.Tasks.Deps.Clean.html @@ -36,7 +36,7 @@

      - Source + Source @@ -67,7 +67,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Tasks.Deps.Compile.html b/docs/master/Mix.Tasks.Deps.Compile.html index b843509f0..1271f2f15 100644 --- a/docs/master/Mix.Tasks.Deps.Compile.html +++ b/docs/master/Mix.Tasks.Deps.Compile.html @@ -50,7 +50,7 @@

      - Source + Source @@ -81,7 +81,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Tasks.Deps.Get.html b/docs/master/Mix.Tasks.Deps.Get.html index bbfe25d8b..2029f61e8 100644 --- a/docs/master/Mix.Tasks.Deps.Get.html +++ b/docs/master/Mix.Tasks.Deps.Get.html @@ -40,7 +40,7 @@

      Command line options

      - Source + Source @@ -71,7 +71,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Tasks.Deps.Loadpaths.html b/docs/master/Mix.Tasks.Deps.Loadpaths.html index dd0a2e92f..acf7acb87 100644 --- a/docs/master/Mix.Tasks.Deps.Loadpaths.html +++ b/docs/master/Mix.Tasks.Deps.Loadpaths.html @@ -33,7 +33,7 @@

      - Source + Source @@ -64,7 +64,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Tasks.Deps.Unlock.html b/docs/master/Mix.Tasks.Deps.Unlock.html index cc536ad46..2068ff470 100644 --- a/docs/master/Mix.Tasks.Deps.Unlock.html +++ b/docs/master/Mix.Tasks.Deps.Unlock.html @@ -33,7 +33,7 @@

      - Source + Source @@ -64,7 +64,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Tasks.Deps.Update.html b/docs/master/Mix.Tasks.Deps.Update.html index 45a245eb7..7b6e8709d 100644 --- a/docs/master/Mix.Tasks.Deps.Update.html +++ b/docs/master/Mix.Tasks.Deps.Update.html @@ -42,7 +42,7 @@

      Command line options

      - Source + Source @@ -73,7 +73,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Tasks.Deps.html b/docs/master/Mix.Tasks.Deps.html index 5524a94a1..db47befb4 100644 --- a/docs/master/Mix.Tasks.Deps.html +++ b/docs/master/Mix.Tasks.Deps.html @@ -39,7 +39,7 @@

      - Source + Source @@ -70,7 +70,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Tasks.Do.html b/docs/master/Mix.Tasks.Do.html index 0c1ac0f7b..7df2c7fff 100644 --- a/docs/master/Mix.Tasks.Do.html +++ b/docs/master/Mix.Tasks.Do.html @@ -40,7 +40,7 @@

      Examples

      - Source + Source @@ -71,7 +71,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Tasks.Escriptize.html b/docs/master/Mix.Tasks.Escriptize.html index bfb30e163..4b953bc4c 100644 --- a/docs/master/Mix.Tasks.Escriptize.html +++ b/docs/master/Mix.Tasks.Escriptize.html @@ -63,7 +63,7 @@

      Configuration

      - Source + Source @@ -94,7 +94,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Tasks.Help.html b/docs/master/Mix.Tasks.Help.html index 978e0a427..81afe6f4c 100644 --- a/docs/master/Mix.Tasks.Help.html +++ b/docs/master/Mix.Tasks.Help.html @@ -40,7 +40,7 @@

      Arguments

      - Source + Source @@ -71,7 +71,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Tasks.Loadpaths.html b/docs/master/Mix.Tasks.Loadpaths.html index b5380733a..4d510536f 100644 --- a/docs/master/Mix.Tasks.Loadpaths.html +++ b/docs/master/Mix.Tasks.Loadpaths.html @@ -39,7 +39,7 @@

      Configuration

      - Source + Source @@ -70,7 +70,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Tasks.Local.Install.html b/docs/master/Mix.Tasks.Local.Install.html index 0896882cb..ade965f69 100644 --- a/docs/master/Mix.Tasks.Local.Install.html +++ b/docs/master/Mix.Tasks.Local.Install.html @@ -43,7 +43,7 @@

      - Source + Source @@ -74,7 +74,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Tasks.Local.Rebar.html b/docs/master/Mix.Tasks.Local.Rebar.html index f34b2b55e..087732872 100644 --- a/docs/master/Mix.Tasks.Local.Rebar.html +++ b/docs/master/Mix.Tasks.Local.Rebar.html @@ -36,7 +36,7 @@

      - Source + Source @@ -73,7 +73,7 @@

      Functions

      Return the path to the local copy of rebar. Used when building deps

      - Source + Source

      @@ -81,7 +81,7 @@

      Functions

      - Source + Source
      diff --git a/docs/master/Mix.Tasks.Local.Uninstall.html b/docs/master/Mix.Tasks.Local.Uninstall.html index c837a7c02..32c11dea7 100644 --- a/docs/master/Mix.Tasks.Local.Uninstall.html +++ b/docs/master/Mix.Tasks.Local.Uninstall.html @@ -35,7 +35,7 @@

      - Source + Source @@ -66,7 +66,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Tasks.Local.html b/docs/master/Mix.Tasks.Local.html index 0e351a949..0a90bb393 100644 --- a/docs/master/Mix.Tasks.Local.html +++ b/docs/master/Mix.Tasks.Local.html @@ -32,7 +32,7 @@

      - Source + Source @@ -63,7 +63,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Tasks.New.html b/docs/master/Mix.Tasks.New.html index c70450c50..6ef24b5f3 100644 --- a/docs/master/Mix.Tasks.New.html +++ b/docs/master/Mix.Tasks.New.html @@ -62,7 +62,7 @@

      Examples

      - Source + Source @@ -93,7 +93,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Tasks.Run.html b/docs/master/Mix.Tasks.Run.html index f0b65552c..fdbf92396 100644 --- a/docs/master/Mix.Tasks.Run.html +++ b/docs/master/Mix.Tasks.Run.html @@ -56,7 +56,7 @@

      Examples

      - Source + Source @@ -87,7 +87,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Tasks.Test.html b/docs/master/Mix.Tasks.Test.html index 69687d302..b591fe753 100644 --- a/docs/master/Mix.Tasks.Test.html +++ b/docs/master/Mix.Tasks.Test.html @@ -65,7 +65,7 @@

      Configuration

      - Source + Source @@ -96,7 +96,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Mix.Utils.html b/docs/master/Mix.Utils.html index dee7a31dc..ed46b00d5 100644 --- a/docs/master/Mix.Utils.html +++ b/docs/master/Mix.Utils.html @@ -43,7 +43,7 @@

      Conversions

      - Source + Source @@ -150,7 +150,7 @@

      Examples

      - Source + Source

      @@ -170,7 +170,7 @@

      Examples

      - Source + Source

      @@ -185,7 +185,7 @@

      Examples

      - Source + Source

      @@ -195,7 +195,7 @@

      Examples

      and concatenating normal lists.

      - Source + Source

      @@ -208,7 +208,7 @@

      Examples

      When looking up directories, files starting with "." are ignored.

      - Source + Source

      @@ -217,7 +217,7 @@

      Examples

      Extract all stale sources compared to the given targets.

      - Source + Source

      @@ -230,7 +230,7 @@

      Examples

      the files removed from the manifest file.

      - Source + Source

      @@ -240,7 +240,7 @@

      Examples

      MIX_HOME environment variable is set.

      - Source + Source

      @@ -252,7 +252,7 @@

      Examples

      use :.

      - Source + Source

      @@ -272,7 +272,7 @@

      Examples

      - Source + Source

      @@ -282,7 +282,7 @@

      Examples

      Used by local.install and local.rebar.

      - Source + Source

      @@ -292,7 +292,7 @@

      Examples

      working directory.

      - Source + Source

      @@ -301,7 +301,7 @@

      Examples

      Gets the source location of a module as a binary.

      - Source + Source

      @@ -311,7 +311,7 @@

      Examples

      compared to the given target.

      - Source + Source

      @@ -337,7 +337,7 @@

      Examples

      - Source + Source diff --git a/docs/master/Mix.html b/docs/master/Mix.html index 3298e02f7..47cc98b28 100644 --- a/docs/master/Mix.html +++ b/docs/master/Mix.html @@ -40,7 +40,7 @@

      - Source + Source @@ -79,11 +79,6 @@

      Functions summary

      shell/1
    3271. -
    3272. - - stop/1 - -
    3273. @@ -102,7 +97,7 @@

      Functions

      Returns the mix environment.

      - Source + Source

      @@ -112,7 +107,7 @@

      Functions

      per environment is not going to be reloaded.

      - Source + Source

      @@ -122,7 +117,7 @@

      Functions

      one step. Useful when invoking mix from an external tool.

      - Source + Source

      @@ -134,7 +129,7 @@

      Functions

      tasks to work without a need for an underlying project.

      - Source + Source

      @@ -148,7 +143,7 @@

      Functions

      messages to the current process.

      - Source + Source

      @@ -157,15 +152,7 @@

      Functions

      Sets the current shell.

      - Source - -
      -

      - stop(_state) -

      -
      - - Source + Source
      diff --git a/docs/master/Module.html b/docs/master/Module.html index ba65c2703..5dea0302b 100644 --- a/docs/master/Module.html +++ b/docs/master/Module.html @@ -39,7 +39,7 @@

      - Source + Source @@ -178,7 +178,7 @@

      Examples

      - Source + Source

      @@ -198,7 +198,7 @@

      Examples

      - Source + Source

      @@ -218,7 +218,7 @@

      Examples

      - Source + Source

      @@ -254,7 +254,7 @@

      Differences with defmodule

      shares the same environment.

      - Source + Source

      @@ -273,7 +273,7 @@

      Examples

      - Source + Source

      @@ -293,7 +293,7 @@

      Examples

      - Source + Source

      @@ -310,7 +310,7 @@

      Examples

      - Source + Source

      @@ -329,7 +329,7 @@

      Examples

      - Source + Source

      @@ -346,7 +346,7 @@

      Examples

      - Source + Source

      @@ -381,7 +381,7 @@

      Examples

      - Source + Source

      @@ -404,7 +404,7 @@

      Examples

      - Source + Source

      @@ -415,7 +415,7 @@

      Examples

      developer to customize it.

      - Source + Source

      @@ -425,7 +425,7 @@

      Examples

      and its attributes and functions can be modified.

      - Source + Source

      @@ -434,7 +434,7 @@

      Examples

      Returns true if the given tuple in module is marked as overridable.

      - Source + Source

      @@ -452,7 +452,7 @@

      Examples

      - Source + Source

      @@ -492,7 +492,7 @@

      Examples

      - Source + Source

      @@ -513,7 +513,7 @@

      Examples

      - Source + Source

      @@ -534,7 +534,7 @@

      Examples

      - Source + Source

      @@ -549,7 +549,7 @@

      Examples

      - Source + Source

      @@ -558,7 +558,7 @@

      Examples

      Convert a module name to binary without the Elixir prefix.

      - Source + Source
      diff --git a/docs/master/Node.html b/docs/master/Node.html index 10ee09261..8bb1aaccd 100644 --- a/docs/master/Node.html +++ b/docs/master/Node.html @@ -32,7 +32,7 @@

      - Source + Source @@ -140,7 +140,7 @@

      Functions

      part of a distributed system. Otherwise, it returns false.

      - Source + Source

      @@ -153,7 +153,7 @@

      Functions

      See http://erlang.org/doc/man/net_kernel.html#connect_node-1 for more info.

      - Source + Source

      @@ -167,7 +167,7 @@

      Functions

      See http://www.erlang.org/doc/man/erlang.html#disconnect_node-1 for more info.

      - Source + Source

      @@ -177,7 +177,7 @@

      Functions

      otherwise :nocookie.

      - Source + Source

      @@ -187,7 +187,7 @@

      Functions

      the local node. Same as list(visible).

      - Source + Source

      @@ -200,7 +200,7 @@

      Functions

      See http://www.erlang.org/doc/man/erlang.html#nodes-1 for more info.

      - Source + Source

      @@ -212,7 +212,7 @@

      Functions

      See http://www.erlang.org/doc/man/erlang.html#monitor_node-2 for more info.

      - Source + Source

      @@ -224,7 +224,7 @@

      Functions

      See http://www.erlang.org/doc/man/erlang.html#monitor_node-3 for more info.

      - Source + Source

      @@ -233,7 +233,7 @@

      Functions

      Returns the current node. It returns the same as the built-in node().

      - Source + Source

      @@ -246,7 +246,7 @@

      Functions

      This function will raise FunctionClauseError if the given node is not alive.

      - Source + Source

      @@ -259,7 +259,7 @@

      Functions

      the list of available options.

      - Source + Source

      @@ -272,7 +272,7 @@

      Functions

      the list of available options.

      - Source + Source

      @@ -286,7 +286,7 @@

      Functions

      the list of available options.

      - Source + Source

      @@ -300,7 +300,7 @@

      Functions

      the list of available options.

      - Source + Source

      @@ -313,7 +313,7 @@

      Functions

      received).

      - Source + Source

      @@ -326,7 +326,7 @@

      Functions

      :noconnection will be received).

      - Source + Source diff --git a/docs/master/OptionParser.html b/docs/master/OptionParser.html index 7ca0aa047..df2a1db42 100644 --- a/docs/master/OptionParser.html +++ b/docs/master/OptionParser.html @@ -27,7 +27,7 @@

      - Source + Source @@ -123,7 +123,7 @@

      Negation switches

      - Source + Source

      @@ -141,7 +141,7 @@

      Example

      - Source + Source diff --git a/docs/master/Path.html b/docs/master/Path.html index 9c7f577e6..1d78855fa 100644 --- a/docs/master/Path.html +++ b/docs/master/Path.html @@ -41,7 +41,7 @@

      - Source + Source @@ -171,7 +171,7 @@

      Windows

      - Source + Source

      @@ -193,7 +193,7 @@

      Examples

      - Source + Source

      @@ -215,7 +215,7 @@

      Examples

      - Source + Source

      @@ -236,7 +236,7 @@

      Examples

      - Source + Source

      @@ -253,7 +253,7 @@

      Examples

      - Source + Source

      @@ -269,7 +269,7 @@

      Examples

      - Source + Source

      @@ -297,7 +297,7 @@

      Examples

      - Source + Source

      @@ -314,7 +314,7 @@

      Examples

      - Source + Source

      @@ -334,7 +334,7 @@

      Examples

      - Source + Source

      @@ -349,7 +349,7 @@

      Examples

      - Source + Source

      @@ -373,7 +373,7 @@

      Windows examples

      - Source + Source

      @@ -399,7 +399,7 @@

      Examples

      - Source + Source

      @@ -416,7 +416,7 @@

      Examples

      - Source + Source

      @@ -434,7 +434,7 @@

      Examples

      - Source + Source

      @@ -454,7 +454,7 @@

      Examples

      - Source + Source

      @@ -479,7 +479,7 @@

      Windows examples

      - Source + Source

      @@ -521,7 +521,7 @@

      Examples

      - Source + Source diff --git a/docs/master/Port.html b/docs/master/Port.html index bac78d1b4..692618c5a 100644 --- a/docs/master/Port.html +++ b/docs/master/Port.html @@ -32,7 +32,7 @@

      - Source + Source @@ -104,7 +104,7 @@

      Functions

      - Source + Source

      @@ -167,7 +167,7 @@

      Functions

      - Source + Source
      diff --git a/docs/master/Process.html b/docs/master/Process.html index be6b74670..c9199afbe 100644 --- a/docs/master/Process.html +++ b/docs/master/Process.html @@ -37,7 +37,7 @@

      - Source + Source @@ -222,7 +222,7 @@

      Functions

      pid must refer to a process at the local node.

      - Source + Source

      @@ -231,7 +231,7 @@

      Functions

      Deletes all items in the dictionary.

      - Source + Source

      @@ -240,7 +240,7 @@

      Functions

      Deletes the given key from the dictionary.

      - Source + Source

      @@ -253,7 +253,7 @@

      Functions

      See http://www.erlang.org/doc/man/erlang.html#demonitor-2 for more info.

      - Source + Source

      @@ -282,7 +282,7 @@

      Examples

      - Source + Source

      @@ -294,7 +294,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#process_flag-2 for more info.

      - Source + Source

      @@ -307,7 +307,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#process_flag-3 for more info.

      - Source + Source

      @@ -316,7 +316,7 @@

      Examples

      Returns all key-values in the dictionary.

      - Source + Source

      @@ -325,7 +325,7 @@

      Examples

      Returns the value for the given key.

      - Source + Source

      @@ -334,7 +334,7 @@

      Examples

      Returns all keys that have the given value.

      - Source + Source

      @@ -343,7 +343,7 @@

      Examples

      Returns the pid of the group leader for the process which evaluates the function.

      - Source + Source

      @@ -353,7 +353,7 @@

      Examples

      started from a certain shell should have another group leader than :init.

      - Source + Source

      @@ -365,7 +365,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#process_info-1 for more info.

      - Source + Source

      @@ -377,7 +377,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#process_info-2 for more info.

      - Source + Source

      @@ -389,7 +389,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#link-1 for more info.

      - Source + Source

      @@ -405,7 +405,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#processes-0 for more info.

      - Source + Source

      @@ -417,7 +417,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#monitor-2 for more info.

      - Source + Source

      @@ -426,7 +426,7 @@

      Examples

      Stores the given key-value in the process dictionary.

      - Source + Source

      @@ -439,7 +439,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#register-2 for more info.

      - Source + Source

      @@ -448,7 +448,7 @@

      Examples

      Returns a list of names which have been registered using register/2.

      - Source + Source

      @@ -458,7 +458,7 @@

      Examples

      It behaves exactly the same as Kernel.spawn/1.

      - Source + Source

      @@ -470,7 +470,7 @@

      Examples

      check http://www.erlang.org/doc/man/erlang.html#spawn_opt-2

      - Source + Source

      @@ -483,7 +483,7 @@

      Examples

      It behaves exactly the same as the Kernel.spawn/3 function.

      - Source + Source

      @@ -497,7 +497,7 @@

      Examples

      check http://www.erlang.org/doc/man/erlang.html#spawn_opt-4

      - Source + Source

      @@ -508,7 +508,7 @@

      Examples

      process, atomically.

      - Source + Source

      @@ -519,7 +519,7 @@

      Examples

      and the new process, atomically. Otherwise works like spawn/3.

      - Source + Source

      @@ -529,7 +529,7 @@

      Examples

      and reference for a monitor created to the new process.

      - Source + Source

      @@ -540,7 +540,7 @@

      Examples

      reference for the monitor. Otherwise works like spawn/3.

      - Source + Source

      @@ -553,7 +553,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#unlink-1 for more info.

      - Source + Source

      @@ -564,7 +564,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#unregister-1 for more info.

      - Source + Source

      @@ -576,7 +576,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#whereis-1 for more info.

      - Source + Source diff --git a/docs/master/Protocol.UndefinedError.html b/docs/master/Protocol.UndefinedError.html index 2d22d7716..f6c558f53 100644 --- a/docs/master/Protocol.UndefinedError.html +++ b/docs/master/Protocol.UndefinedError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -77,7 +77,7 @@

      Functions

      - Source + Source diff --git a/docs/master/Range.Iterator.Number.html b/docs/master/Range.Iterator.Number.html index 56f1ea908..9352f45bc 100644 --- a/docs/master/Range.Iterator.Number.html +++ b/docs/master/Range.Iterator.Number.html @@ -29,7 +29,7 @@

      - Source + Source @@ -65,7 +65,7 @@

      Functions

      - Source + Source

      @@ -73,7 +73,7 @@

      Functions

      - Source + Source
      diff --git a/docs/master/Range.Iterator.html b/docs/master/Range.Iterator.html index 43625f76d..af2ab52b8 100644 --- a/docs/master/Range.Iterator.html +++ b/docs/master/Range.Iterator.html @@ -29,7 +29,7 @@

      - Source + Source

      Implementations

      @@ -77,7 +77,7 @@

      Functions

      Count how many items are in the range.

      - Source + Source

      @@ -85,7 +85,7 @@

      Functions

      - Source + Source
      diff --git a/docs/master/Range.html b/docs/master/Range.html index f2f533e1e..1f9c03e48 100644 --- a/docs/master/Range.html +++ b/docs/master/Range.html @@ -34,7 +34,7 @@

      - Source + Source diff --git a/docs/master/Record.html b/docs/master/Record.html index 3e0a70623..d94a836f2 100644 --- a/docs/master/Record.html +++ b/docs/master/Record.html @@ -32,7 +32,7 @@

      - Source + Source @@ -109,7 +109,7 @@

      Examples

      - Source + Source

      @@ -127,7 +127,7 @@

      Examples

      - Source + Source

      @@ -139,7 +139,7 @@

      Examples

      for more information and documentation.

      - Source + Source

      @@ -151,7 +151,7 @@

      Examples

      so check it for more information and documentation.

      - Source + Source

      @@ -160,7 +160,7 @@

      Examples

      Defines types and specs for the record.

      - Source + Source

      @@ -175,7 +175,7 @@

      Examples

      - Source + Source @@ -205,7 +205,7 @@

      Example

      end

      - Source + Source diff --git a/docs/master/Regex.CompileError.html b/docs/master/Regex.CompileError.html index 16b0810fa..f6a1047dc 100644 --- a/docs/master/Regex.CompileError.html +++ b/docs/master/Regex.CompileError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/master/Regex.html b/docs/master/Regex.html index 3d93a3181..57cfb49fc 100644 --- a/docs/master/Regex.html +++ b/docs/master/Regex.html @@ -77,7 +77,7 @@

      - Source + Source @@ -176,7 +176,7 @@

      Examples

      - Source + Source

      @@ -188,7 +188,7 @@

      Examples

      { :error, reason } otherwise.

      - Source + Source

      @@ -198,7 +198,7 @@

      Examples

      Fails with Regex.CompileError if the regex cannot be compiled.

      - Source + Source

      @@ -213,7 +213,7 @@

      Examples

      - Source + Source

      @@ -232,7 +232,7 @@

      Examples

      - Source + Source

      @@ -249,7 +249,7 @@

      Examples

      - Source + Source

      @@ -264,7 +264,7 @@

      Examples

      - Source + Source

      @@ -273,7 +273,7 @@

      Examples

      Returns the underlying re_pattern in the regular expression.

      - Source + Source

      @@ -302,7 +302,7 @@

      Examples

      - Source + Source

      @@ -321,7 +321,7 @@

      Examples

      - Source + Source

      @@ -343,7 +343,7 @@

      Examples

      - Source + Source

      @@ -358,7 +358,7 @@

      Examples

      - Source + Source

      @@ -368,7 +368,7 @@

      Examples

      If no ammount of parts is given, it defaults to :infinity.

      - Source + Source diff --git a/docs/master/RuntimeError.html b/docs/master/RuntimeError.html index 4b4b46e60..c3e2dffd2 100644 --- a/docs/master/RuntimeError.html +++ b/docs/master/RuntimeError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/master/String.html b/docs/master/String.html index bef1750a0..56e7b85a8 100644 --- a/docs/master/String.html +++ b/docs/master/String.html @@ -139,7 +139,7 @@

      Self-synchronization

      - Source + Source @@ -173,6 +173,11 @@

      Functions summary

      duplicate/2 +
    3274. + + ends_with?/2 + +
    3275. first/1 @@ -248,6 +253,11 @@

      Functions summary

      split/3
    3276. +
    3277. + + starts_with?/2 + +
    3278. strip/1 @@ -321,7 +331,7 @@

      Examples

      - Source + Source

      @@ -346,7 +356,7 @@

      Examples

      - Source + Source

      @@ -365,7 +375,7 @@

      Examples

      - Source + Source

      @@ -384,7 +394,7 @@

      Examples

      - Source + Source

      @@ -401,7 +411,27 @@

      Examples

      - Source + Source + +
      +

      + ends_with?(string, suffixes) +

      +

      Returns true if string ends with any of the suffixes given, otherwise +false. suffixes can be either a single suffix or a list of suffixes.

      + +

      Examples

      + +
      iex> String.ends_with? "language", "age"
      +true
      +iex> String.ends_with? "language", ["youth", "age"]
      +true
      +iex> String.ends_with? "language", ["youth", "elixir"]
      +false
      +
      +
      + + Source

      @@ -419,7 +449,7 @@

      Examples

      - Source + Source

      @@ -434,7 +464,7 @@

      Examples

      - Source + Source

      @@ -452,7 +482,7 @@

      Examples

      - Source + Source

      @@ -469,7 +499,7 @@

      Examples

      - Source + Source

      @@ -485,7 +515,7 @@

      Examples

      - Source + Source

      @@ -500,7 +530,7 @@

      Examples

      - Source + Source

      @@ -524,7 +554,7 @@

      Examples

      - Source + Source

      @@ -543,7 +573,7 @@

      Examples

      - Source + Source

      @@ -559,7 +589,7 @@

      Examples

      - Source + Source

      @@ -588,7 +618,7 @@

      Examples

      - Source + Source

      @@ -604,7 +634,7 @@

      Examples

      - Source + Source

      @@ -619,7 +649,7 @@

      Examples

      - Source + Source

      @@ -650,7 +680,7 @@

      Examples

      - Source + Source

      @@ -670,7 +700,7 @@

      Examples

      - Source + Source

      @@ -702,7 +732,27 @@

      Examples

      - Source + Source + +
      +

      + starts_with?(string, prefixes) +

      +

      Returns true if string starts with any of the prefixes given, otherwise +false. prefixes can be either a single prefix or a list of prefixes.

      + +

      Examples

      + +
      iex> String.starts_with? "elixir", "eli"
      +true
      +iex> String.starts_with? "elixir", ["erlang", "elixir"]
      +true
      +iex> String.starts_with? "elixir", ["erlang", "ruby"]
      +false
      +
      +
      + + Source

      @@ -718,7 +768,7 @@

      Examples

      - Source + Source

      @@ -734,7 +784,7 @@

      Examples

      - Source + Source

      @@ -759,7 +809,7 @@

      Examples

      :error

      - Source + Source

      @@ -780,7 +830,7 @@

      Examples

      - Source + Source

      @@ -799,7 +849,7 @@

      Examples

      - Source + Source

      @@ -820,7 +870,7 @@

      Examples

      - Source + Source

      @@ -845,7 +895,7 @@

      Examples

      - Source + Source

      @@ -869,7 +919,7 @@

      Examples

      - Source + Source diff --git a/docs/master/Supervisor.Behaviour.html b/docs/master/Supervisor.Behaviour.html index e7a9b6796..b1ded59c6 100644 --- a/docs/master/Supervisor.Behaviour.html +++ b/docs/master/Supervisor.Behaviour.html @@ -58,7 +58,7 @@

      Example

      - Source + Source @@ -138,7 +138,7 @@

      Strategies

      - Source + Source

      @@ -201,7 +201,7 @@

      Shutdown values

      - Source + Source

      @@ -264,7 +264,7 @@

      Shutdown values

      - Source + Source diff --git a/docs/master/SyntaxError.html b/docs/master/SyntaxError.html index beb2e20a3..382ba6c27 100644 --- a/docs/master/SyntaxError.html +++ b/docs/master/SyntaxError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -83,7 +83,7 @@

      Functions

      - Source + Source diff --git a/docs/master/System.NoAccessCwdError.html b/docs/master/System.NoAccessCwdError.html index 75f526dc7..055290365 100644 --- a/docs/master/System.NoAccessCwdError.html +++ b/docs/master/System.NoAccessCwdError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/master/System.NoHomeError.html b/docs/master/System.NoHomeError.html index b033ac23b..93a871b7b 100644 --- a/docs/master/System.NoHomeError.html +++ b/docs/master/System.NoHomeError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/master/System.NoTmpDirError.html b/docs/master/System.NoTmpDirError.html index 3d278256f..ce033c338 100644 --- a/docs/master/System.NoTmpDirError.html +++ b/docs/master/System.NoTmpDirError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/master/System.html b/docs/master/System.html index e1ea49c2f..41352bf9d 100644 --- a/docs/master/System.html +++ b/docs/master/System.html @@ -34,7 +34,7 @@

      - Source + Source @@ -156,7 +156,7 @@

      Functions

      Returns the list of command-line arguments passed to the program.

      - Source + Source

      @@ -170,7 +170,7 @@

      Functions

      as argument.

      - Source + Source

      @@ -179,7 +179,7 @@

      Functions

      Returns a keywords list with version, git tag info and date.

      - Source + Source

      @@ -193,7 +193,7 @@

      Functions

      Returns a binary otherwise.

      - Source + Source

      @@ -203,7 +203,7 @@

      Functions

      is not available.

      - Source + Source

      @@ -212,7 +212,7 @@

      Functions

      Returns the current working directory or raises System.NoAccessCwdError.

      - Source + Source

      @@ -226,7 +226,7 @@

      Functions

      Returns a binary otherwise.

      - Source + Source

      @@ -237,7 +237,7 @@

      Functions

      name of the variable and Value its value.

      - Source + Source

      @@ -248,7 +248,7 @@

      Functions

      variable is undefined.

      - Source + Source

      @@ -260,7 +260,7 @@

      Functions

      See http://www.erlang.org/doc/man/os.html#getpid-0 for more info.

      - Source + Source

      @@ -296,7 +296,7 @@

      Examples

      - Source + Source

      @@ -306,7 +306,7 @@

      Examples

      to each key in dict.

      - Source + Source

      @@ -315,7 +315,7 @@

      Examples

      Sets a new value for the environment variable varname.

      - Source + Source

      @@ -328,7 +328,7 @@

      Examples

      latest exception.

      - Source + Source

      @@ -348,7 +348,7 @@

      Examples

      Returns nil if none of the above are writable.

      - Source + Source

      @@ -358,7 +358,7 @@

      Examples

      instead of returning nil if no temp dir is set.

      - Source + Source

      @@ -368,7 +368,7 @@

      Examples

      It returns nil if no user home is set.

      - Source + Source

      @@ -378,7 +378,7 @@

      Examples

      instead of returning nil if no user home is set.

      - Source + Source

      @@ -387,7 +387,7 @@

      Examples

      Returns Elixir's version as binary.

      - Source + Source
      diff --git a/docs/master/SystemLimitError.html b/docs/master/SystemLimitError.html index d17ce8dae..a40eceb77 100644 --- a/docs/master/SystemLimitError.html +++ b/docs/master/SystemLimitError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/master/TokenMissingError.html b/docs/master/TokenMissingError.html index 2f3f2efc6..b64385810 100644 --- a/docs/master/TokenMissingError.html +++ b/docs/master/TokenMissingError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -83,7 +83,7 @@

      Functions

      - Source + Source diff --git a/docs/master/URI.FTP.html b/docs/master/URI.FTP.html index 8e12288b1..ac3fe05f1 100644 --- a/docs/master/URI.FTP.html +++ b/docs/master/URI.FTP.html @@ -27,7 +27,7 @@

      - Source + Source @@ -63,7 +63,7 @@

      Functions

      - Source + Source

      @@ -71,7 +71,7 @@

      Functions

      - Source + Source
      diff --git a/docs/master/URI.HTTP.html b/docs/master/URI.HTTP.html index 0c5bce2bd..d863de87e 100644 --- a/docs/master/URI.HTTP.html +++ b/docs/master/URI.HTTP.html @@ -27,7 +27,7 @@

      - Source + Source @@ -63,7 +63,7 @@

      Functions

      - Source + Source

      @@ -71,7 +71,7 @@

      Functions

      - Source + Source
      diff --git a/docs/master/URI.HTTPS.html b/docs/master/URI.HTTPS.html index a20e475c1..65522bb9d 100644 --- a/docs/master/URI.HTTPS.html +++ b/docs/master/URI.HTTPS.html @@ -27,7 +27,7 @@

      - Source + Source @@ -63,7 +63,7 @@

      Functions

      - Source + Source

      @@ -71,7 +71,7 @@

      Functions

      - Source + Source
      diff --git a/docs/master/URI.LDAP.html b/docs/master/URI.LDAP.html index c5e3606c2..b2642e83f 100644 --- a/docs/master/URI.LDAP.html +++ b/docs/master/URI.LDAP.html @@ -27,7 +27,7 @@

      - Source + Source @@ -63,7 +63,7 @@

      Functions

      - Source + Source

      @@ -71,7 +71,7 @@

      Functions

      - Source + Source
      diff --git a/docs/master/URI.Parser.html b/docs/master/URI.Parser.html index b852a0500..f6dafe4da 100644 --- a/docs/master/URI.Parser.html +++ b/docs/master/URI.Parser.html @@ -35,7 +35,7 @@

      - Source + Source @@ -76,7 +76,7 @@

      Callbacks

      Responsible for returning the default port.

      - Source + Source

      @@ -85,7 +85,7 @@

      Callbacks

      Responsible for parsing extra URL information.

      - Source + Source
      diff --git a/docs/master/URI.SFTP.html b/docs/master/URI.SFTP.html index d05ec23b4..b553e74a7 100644 --- a/docs/master/URI.SFTP.html +++ b/docs/master/URI.SFTP.html @@ -27,7 +27,7 @@

      - Source + Source @@ -63,7 +63,7 @@

      Functions

      - Source + Source

      @@ -71,7 +71,7 @@

      Functions

      - Source + Source
      diff --git a/docs/master/URI.TFTP.html b/docs/master/URI.TFTP.html index 05ddcb765..698c394b9 100644 --- a/docs/master/URI.TFTP.html +++ b/docs/master/URI.TFTP.html @@ -27,7 +27,7 @@

      - Source + Source @@ -63,7 +63,7 @@

      Functions

      - Source + Source

      @@ -71,7 +71,7 @@

      Functions

      - Source + Source
      diff --git a/docs/master/URI.html b/docs/master/URI.html index 5dcd87ae5..d75d6ff46 100644 --- a/docs/master/URI.html +++ b/docs/master/URI.html @@ -32,7 +32,7 @@

      - Source + Source @@ -89,7 +89,7 @@

      Functions

      Unpercent (URL) decodes a URI.

      - Source + Source

      @@ -102,7 +102,7 @@

      Functions

      Use decoder/1 if you want to customize or iterate each value manually.

      - Source + Source

      @@ -111,7 +111,7 @@

      Functions

      Percent (URL) encodes a URI.

      - Source + Source

      @@ -124,7 +124,7 @@

      Functions

      to binary).

      - Source + Source

      @@ -148,7 +148,7 @@

      Functions

      example of one of these extension modules.

      - Source + Source

      @@ -158,7 +158,7 @@

      Functions

      the query string in steps.

      - Source + Source diff --git a/docs/master/UndefinedFunctionError.html b/docs/master/UndefinedFunctionError.html index 4591d3464..cd9fb5042 100644 --- a/docs/master/UndefinedFunctionError.html +++ b/docs/master/UndefinedFunctionError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -83,7 +83,7 @@

      Functions

      - Source + Source diff --git a/docs/master/index.html b/docs/master/index.html index bdab5fcb0..ba88e3113 100644 --- a/docs/master/index.html +++ b/docs/master/index.html @@ -3,7 +3,7 @@ - Elixir v0.9.0 Documentation + Elixir v0.9.1 Documentation diff --git a/docs/master/modules_list.html b/docs/master/modules_list.html index 1fca36e27..a3b7b61c5 100644 --- a/docs/master/modules_list.html +++ b/docs/master/modules_list.html @@ -16,7 +16,7 @@
    3279. -
    3280. - - get!/2 - - Dict -
    3281. -
    3282. get/3 @@ -1191,41 +1184,6 @@

      ExUnit.CLIFormatter

    3283. -
    3284. - - code_change/3 - - ExUnit.CLIFormatter -
    3285. - -
    3286. - - handle_call/3 - - ExUnit.CLIFormatter -
    3287. - -
    3288. - - handle_cast/2 - - ExUnit.CLIFormatter -
    3289. - -
    3290. - - handle_info/2 - - ExUnit.CLIFormatter -
    3291. - -
    3292. - - init/1 - - ExUnit.CLIFormatter -
    3293. -
    3294. suite_finished/3 @@ -1240,13 +1198,6 @@

      ExUnit.CLIFormatter

    3295. -
    3296. - - terminate/2 - - ExUnit.CLIFormatter -
    3297. -
    3298. test_finished/2 @@ -1463,13 +1414,6 @@

      ExUnit

    3299. -
    3300. - - stop/1 - - ExUnit -
    3301. -
    3302. @@ -2192,6 +2136,87 @@

      IEx.Helpers

    3303. + +
    3304. + + + Options + + IEx.Options +
    3305. + @@ -2211,14 +2236,21 @@

    3306. - inspect_opts/0 + color/2 IEx
    3307. - inspect_opts/1 + color_fragment/1 + + IEx +
    3308. + +
    3309. + + color_reset/0 IEx
    3310. @@ -5087,7 +5119,7 @@

    3311. - equals?/2 + equal?/2 Mix.SCM
    3312. @@ -6084,13 +6116,6 @@

      Mix -
    3313. - - stop/1 - - Mix -
    3314. -
    3315. @@ -7030,6 +7055,13 @@

      String

    3316. +
    3317. + + ends_with?/2 + + String +
    3318. +
    3319. first/1 @@ -7135,6 +7167,13 @@

      String

    3320. +
    3321. + + starts_with?/2 + + String +
    3322. +
    3323. strip/1 diff --git a/docs/master/protocols_list.html b/docs/master/protocols_list.html index 714cb4cdf..5c25671fa 100644 --- a/docs/master/protocols_list.html +++ b/docs/master/protocols_list.html @@ -16,7 +16,7 @@
    3324. - -
    3325. - - - Function - - Access.Function -
    3326. -
        - - -
      • - - access/2 - - Access.Function -
      • -
    3327. diff --git a/docs/master/records_list.html b/docs/master/records_list.html index d502e4e33..93918d46e 100644 --- a/docs/master/records_list.html +++ b/docs/master/records_list.html @@ -16,7 +16,7 @@

      - Elixir v0.9.0 + Elixir v0.9.1

      - Source + Source
      diff --git a/docs/stable/Access.Function.html b/docs/stable/Access.Function.html deleted file mode 100644 index b4280fadc..000000000 --- a/docs/stable/Access.Function.html +++ /dev/null @@ -1,78 +0,0 @@ - - - - Access.Function - - - - - - - - - - - - -
      -

      - Access.Function - - impl - -

      - - - - Source - - - - - - -

      Functions summary

      - - - - - - - - -
      -

      Functions

      -
      -

      - access(function, item) -

      -

      The Access protocol for functions simply invokes -the function passing the item as argument. This -is useful because it allows a function to be -passed as argument in places a dict would also fit.

      -
      - - Source - -
      -
      - - - - - -
      - - diff --git a/docs/stable/Access.HashDict.html b/docs/stable/Access.HashDict.html index a5bb6352b..2e961bbb8 100644 --- a/docs/stable/Access.HashDict.html +++ b/docs/stable/Access.HashDict.html @@ -29,7 +29,7 @@

      - Source + Source @@ -60,7 +60,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Access.List.html b/docs/stable/Access.List.html index bd6fcaf8a..76db701f9 100644 --- a/docs/stable/Access.List.html +++ b/docs/stable/Access.List.html @@ -29,7 +29,7 @@

      - Source + Source @@ -72,7 +72,7 @@

      Examples

      - Source + Source diff --git a/docs/stable/Access.html b/docs/stable/Access.html index 548c65e81..fd7d3a250 100644 --- a/docs/stable/Access.html +++ b/docs/stable/Access.html @@ -40,7 +40,7 @@

      - Source + Source

      Implementations

      @@ -52,12 +52,6 @@

      Implementations

    3328. -
    3329. - - Function - -
    3330. -
    3331. HashDict @@ -101,7 +95,7 @@

      Functions

      Receives the element being accessed and the access item.

      - Source + Source diff --git a/docs/stable/Application.Behaviour.html b/docs/stable/Application.Behaviour.html index 3f40c6411..4ab9367a7 100644 --- a/docs/stable/Application.Behaviour.html +++ b/docs/stable/Application.Behaviour.html @@ -78,7 +78,7 @@

      Example

      - Source + Source diff --git a/docs/stable/ArgumentError.html b/docs/stable/ArgumentError.html index 090f3a09a..49a78495c 100644 --- a/docs/stable/ArgumentError.html +++ b/docs/stable/ArgumentError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/stable/ArithmeticError.html b/docs/stable/ArithmeticError.html index 78e61f141..663386e98 100644 --- a/docs/stable/ArithmeticError.html +++ b/docs/stable/ArithmeticError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/stable/BadArityError.html b/docs/stable/BadArityError.html index ab4e36d43..4c320720b 100644 --- a/docs/stable/BadArityError.html +++ b/docs/stable/BadArityError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -77,7 +77,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/BadFunctionError.html b/docs/stable/BadFunctionError.html index 2781f8ed1..f8127301b 100644 --- a/docs/stable/BadFunctionError.html +++ b/docs/stable/BadFunctionError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -71,7 +71,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Behaviour.html b/docs/stable/Behaviour.html index b36ec8f4c..9e6e839c2 100644 --- a/docs/stable/Behaviour.html +++ b/docs/stable/Behaviour.html @@ -73,7 +73,7 @@

      Implementation

      - Source + Source @@ -107,7 +107,7 @@

      Macros

      Defines a callback according to the given type specification.

      - Source + Source diff --git a/docs/stable/Binary.Chars.Atom.html b/docs/stable/Binary.Chars.Atom.html index ff67ab87b..c710f0eba 100644 --- a/docs/stable/Binary.Chars.Atom.html +++ b/docs/stable/Binary.Chars.Atom.html @@ -29,7 +29,7 @@

      - Source + Source @@ -62,7 +62,7 @@

      Functions

      nil which is converted to an empty string.

      - Source + Source diff --git a/docs/stable/Binary.Chars.BitString.html b/docs/stable/Binary.Chars.BitString.html index 9c7a01ddc..cfb1e897a 100644 --- a/docs/stable/Binary.Chars.BitString.html +++ b/docs/stable/Binary.Chars.BitString.html @@ -29,7 +29,7 @@

      - Source + Source @@ -61,7 +61,7 @@

      Functions

      Simply returns the binary itself.

      - Source + Source diff --git a/docs/stable/Binary.Chars.List.html b/docs/stable/Binary.Chars.List.html index 520e27d19..a80caa891 100644 --- a/docs/stable/Binary.Chars.List.html +++ b/docs/stable/Binary.Chars.List.html @@ -29,7 +29,7 @@

      - Source + Source @@ -72,7 +72,7 @@

      Examples

      - Source + Source diff --git a/docs/stable/Binary.Chars.Number.html b/docs/stable/Binary.Chars.Number.html index 7742c956b..dc7b5f3ee 100644 --- a/docs/stable/Binary.Chars.Number.html +++ b/docs/stable/Binary.Chars.Number.html @@ -29,7 +29,7 @@

      - Source + Source @@ -61,7 +61,7 @@

      Functions

      Simply converts the number (integer or a float) to a binary.

      - Source + Source diff --git a/docs/stable/Binary.Chars.html b/docs/stable/Binary.Chars.html index 2491145e2..5f69b91e7 100644 --- a/docs/stable/Binary.Chars.html +++ b/docs/stable/Binary.Chars.html @@ -43,7 +43,7 @@

      - Source + Source

      Implementations

      @@ -103,7 +103,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Binary.Inspect.Atom.html b/docs/stable/Binary.Inspect.Atom.html index 325c917c2..9382c5d8f 100644 --- a/docs/stable/Binary.Inspect.Atom.html +++ b/docs/stable/Binary.Inspect.Atom.html @@ -49,7 +49,7 @@

      Examples

      - Source + Source @@ -80,7 +80,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Binary.Inspect.BitString.html b/docs/stable/Binary.Inspect.BitString.html index d2b44a08e..55c6bc44f 100644 --- a/docs/stable/Binary.Inspect.BitString.html +++ b/docs/stable/Binary.Inspect.BitString.html @@ -43,7 +43,7 @@

      Examples

      - Source + Source @@ -74,7 +74,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Binary.Inspect.Function.html b/docs/stable/Binary.Inspect.Function.html index 414e8a52c..f7fecb2e8 100644 --- a/docs/stable/Binary.Inspect.Function.html +++ b/docs/stable/Binary.Inspect.Function.html @@ -34,7 +34,7 @@

      - Source + Source @@ -65,7 +65,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Binary.Inspect.HashDict.html b/docs/stable/Binary.Inspect.HashDict.html index 587e35da1..45714c212 100644 --- a/docs/stable/Binary.Inspect.HashDict.html +++ b/docs/stable/Binary.Inspect.HashDict.html @@ -29,7 +29,7 @@

      - Source + Source @@ -60,7 +60,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Binary.Inspect.List.html b/docs/stable/Binary.Inspect.List.html index c4093c929..2dbfd7f22 100644 --- a/docs/stable/Binary.Inspect.List.html +++ b/docs/stable/Binary.Inspect.List.html @@ -52,7 +52,7 @@

      Examples

      - Source + Source @@ -83,7 +83,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Binary.Inspect.Number.html b/docs/stable/Binary.Inspect.Number.html index 8f683bb23..92bda1c0e 100644 --- a/docs/stable/Binary.Inspect.Number.html +++ b/docs/stable/Binary.Inspect.Number.html @@ -40,7 +40,7 @@

      Examples

      - Source + Source @@ -71,7 +71,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Binary.Inspect.PID.html b/docs/stable/Binary.Inspect.PID.html index ddbab6ab8..5c62677c5 100644 --- a/docs/stable/Binary.Inspect.PID.html +++ b/docs/stable/Binary.Inspect.PID.html @@ -34,7 +34,7 @@

      - Source + Source @@ -65,7 +65,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Binary.Inspect.Port.html b/docs/stable/Binary.Inspect.Port.html index 4df9fa842..8bf1a9e73 100644 --- a/docs/stable/Binary.Inspect.Port.html +++ b/docs/stable/Binary.Inspect.Port.html @@ -34,7 +34,7 @@

      - Source + Source @@ -65,7 +65,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Binary.Inspect.Range.html b/docs/stable/Binary.Inspect.Range.html index 947f409f0..59c3c5764 100644 --- a/docs/stable/Binary.Inspect.Range.html +++ b/docs/stable/Binary.Inspect.Range.html @@ -29,7 +29,7 @@

      - Source + Source @@ -60,7 +60,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Binary.Inspect.Reference.html b/docs/stable/Binary.Inspect.Reference.html index 0e95faa90..6f8d8f9f8 100644 --- a/docs/stable/Binary.Inspect.Reference.html +++ b/docs/stable/Binary.Inspect.Reference.html @@ -34,7 +34,7 @@

      - Source + Source @@ -65,7 +65,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Binary.Inspect.Regex.html b/docs/stable/Binary.Inspect.Regex.html index 8fe066302..5c895099b 100644 --- a/docs/stable/Binary.Inspect.Regex.html +++ b/docs/stable/Binary.Inspect.Regex.html @@ -40,7 +40,7 @@

      Examples

      - Source + Source @@ -71,7 +71,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Binary.Inspect.Tuple.html b/docs/stable/Binary.Inspect.Tuple.html index 8aa2becf8..0636b21a0 100644 --- a/docs/stable/Binary.Inspect.Tuple.html +++ b/docs/stable/Binary.Inspect.Tuple.html @@ -43,7 +43,7 @@

      Examples

      - Source + Source @@ -74,7 +74,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Binary.Inspect.html b/docs/stable/Binary.Inspect.html index 83719ceee..4ad33b504 100644 --- a/docs/stable/Binary.Inspect.html +++ b/docs/stable/Binary.Inspect.html @@ -40,7 +40,7 @@

      - Source + Source

      Implementations

      @@ -148,7 +148,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Bitwise.html b/docs/stable/Bitwise.html index de8d1fea4..5b34f2b9f 100644 --- a/docs/stable/Bitwise.html +++ b/docs/stable/Bitwise.html @@ -34,11 +34,9 @@

      your module:

      iex> use Bitwise
      -...> bnot 1
      +iex> bnot 1
       -2
      -
      -iex> use Bitwise
      -...> 1 &&& 1
      +iex> 1 &&& 1
       1
       
      @@ -52,7 +50,7 @@

      - Source + Source @@ -146,7 +144,7 @@

      Macros

      Bitwise and as operator.

      - Source + Source

      @@ -155,7 +153,7 @@

      Macros

      Arithmetic bitshift left as operator.

      - Source + Source

      @@ -164,7 +162,7 @@

      Macros

      Arithmetic bitshift right as operator.

      - Source + Source

      @@ -173,7 +171,7 @@

      Macros

      Bitwise xor as operator.

      - Source + Source

      @@ -188,7 +186,7 @@

      Macros

      - Source + Source

      @@ -197,7 +195,7 @@

      Macros

      Bitwise and.

      - Source + Source

      @@ -206,7 +204,7 @@

      Macros

      Bitwise not.

      - Source + Source

      @@ -215,7 +213,7 @@

      Macros

      Bitwise or.

      - Source + Source

      @@ -224,7 +222,7 @@

      Macros

      Arithmetic bitshift left.

      - Source + Source

      @@ -233,7 +231,7 @@

      Macros

      Arithmetic bitshift right.

      - Source + Source

      @@ -242,7 +240,7 @@

      Macros

      Bitwise xor.

      - Source + Source

      @@ -251,7 +249,7 @@

      Macros

      Bitwise or as operator.

      - Source + Source

      @@ -260,7 +258,7 @@

      Macros

      Bitwise not as operator.

      - Source + Source
      diff --git a/docs/stable/CaseClauseError.html b/docs/stable/CaseClauseError.html index 0240f6748..107b112ee 100644 --- a/docs/stable/CaseClauseError.html +++ b/docs/stable/CaseClauseError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -71,7 +71,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Code.LoadError.html b/docs/stable/Code.LoadError.html index 347c4e3f7..4c1e3a436 100644 --- a/docs/stable/Code.LoadError.html +++ b/docs/stable/Code.LoadError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -71,7 +71,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Code.html b/docs/stable/Code.html index 042f12996..dabb01cbd 100644 --- a/docs/stable/Code.html +++ b/docs/stable/Code.html @@ -36,7 +36,7 @@

      - Source + Source @@ -159,7 +159,7 @@

      Functions

      The path is expanded with Path.expand before added.

      - Source + Source

      @@ -170,7 +170,7 @@

      Functions

      binary.

      - Source + Source

      @@ -183,7 +183,7 @@

      Functions

      For compiling many files at once, check Kernel.ParallelCompiler.

      - Source + Source

      @@ -193,7 +193,7 @@

      Functions

      Check compiler_options/1 for more information.

      - Source + Source

      @@ -215,7 +215,7 @@

      Functions

      - Source + Source

      @@ -225,7 +225,7 @@

      Functions

      The path is expanded with Path.expand before deleted.

      - Source + Source

      @@ -244,7 +244,7 @@

      Functions

      and when to use ensure_loaded/1 or ensure_compiled/1.

      - Source + Source

      @@ -254,7 +254,7 @@

      Functions

      it could be ensured or not.

      - Source + Source

      @@ -298,7 +298,7 @@

      Code.ensure_compiled

      that needs to invoke a module for callback information.

      - Source + Source

      @@ -308,7 +308,7 @@

      Code.ensure_compiled

      it could be ensured or not.

      - Source + Source

      @@ -335,7 +335,7 @@

      Examples

      - Source + Source

      @@ -384,7 +384,7 @@

      Examples

      - Source + Source

      @@ -402,7 +402,7 @@

      Examples

      require_file if you don't want a file to be loaded concurrently.

      - Source + Source

      @@ -411,7 +411,7 @@

      Examples

      Returns all the loaded files.

      - Source + Source

      @@ -421,7 +421,7 @@

      Examples

      The path is expanded with Path.expand before added.

      - Source + Source

      @@ -440,7 +440,7 @@

      Examples

      Check load_file if you want a file to be loaded concurrently.

      - Source + Source

      @@ -466,7 +466,7 @@

      Macro.to_binary/1

      representation.

      - Source + Source

      @@ -480,7 +480,7 @@

      Macro.to_binary/1

      Check Code.string_to_ast/2 for options information.

      - Source + Source

      @@ -492,7 +492,7 @@

      Macro.to_binary/1

      allowing it to be required again.

      - Source + Source diff --git a/docs/stable/CompileError.html b/docs/stable/CompileError.html index e6d9e5046..d65ff2d4f 100644 --- a/docs/stable/CompileError.html +++ b/docs/stable/CompileError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -83,7 +83,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Dict.html b/docs/stable/Dict.html index 6916718f2..6e3b63a6b 100644 --- a/docs/stable/Dict.html +++ b/docs/stable/Dict.html @@ -70,7 +70,7 @@

      Protocols

      - Source + Source @@ -268,11 +268,6 @@

      Callbacks summary

      has_key?/2
    3332. -
    3333. - - get!/2 - -
    3334. get/3 @@ -330,7 +325,7 @@

      Examples

      - Source + Source

      @@ -353,7 +348,7 @@

      Examples

      - Source + Source

      @@ -362,7 +357,7 @@

      Examples

      Returns an empty dict of the same type as dict.

      - Source + Source

      @@ -385,7 +380,7 @@

      Examples

      - Source + Source

      @@ -397,16 +392,14 @@

      Examples

      Examples

      iex> d = HashDict.new([a: 1])
      -...> Dict.fetch(d, :a)
      +iex> Dict.fetch(d, :a)
       { :ok, 1 }
      -
      -iex> d = HashDict.new([a: 1])
      -...> Dict.fetch(d, :b)
      +iex> Dict.fetch(d, :b)
       :error
       
      - Source + Source

      @@ -418,15 +411,14 @@

      Examples

      Examples

      iex> d = HashDict.new([a: 1])
      -...> Dict.fetch!(d, :a)
      +iex> Dict.fetch!(d, :a)
       1
      -iex> d = HashDict.new([a: 1])
      -...> Dict.fetch!(d, :b)
      +iex> Dict.fetch!(d, :b)
       ** (KeyError) key not found: :b
       
      - Source + Source

      @@ -438,20 +430,16 @@

      Examples

      Examples

      iex> d = HashDict.new([a: 1])
      -...> Dict.get(d, :a)
      +iex> Dict.get(d, :a)
       1
      -
      -iex> d = HashDict.new([a: 1])
      -...> Dict.get(d, :b)
      +iex> Dict.get(d, :b)
       nil
      -
      -iex> d = HashDict.new([a: 1])
      -...> Dict.get(d, :b, 3)
      +iex> Dict.get(d, :b, 3)
       3
       
      - Source + Source

      @@ -462,16 +450,14 @@

      Examples

      Examples

      iex> d = HashDict.new([a: 1])
      -...> Dict.has_key?(d, :a)
      +iex> Dict.has_key?(d, :a)
       true
      -
      -iex> d = HashDict.new([a: 1])
      -...> Dict.has_key?(d, :b)
      +iex> Dict.has_key?(d, :b)
       false
       
      - Source + Source

      @@ -489,7 +475,7 @@

      Examples

      - Source + Source

      @@ -508,7 +494,7 @@

      Examples

      - Source + Source

      @@ -530,7 +516,7 @@

      Examples

      - Source + Source

      @@ -558,7 +544,7 @@

      Examples

      - Source + Source

      @@ -576,7 +562,7 @@

      Examples

      - Source + Source

      @@ -593,7 +579,7 @@

      Examples

      - Source + Source

      @@ -609,7 +595,7 @@

      Examples

      - Source + Source

      @@ -640,7 +626,7 @@

      Examples

      - Source + Source

      @@ -652,18 +638,18 @@

      Examples

      Examples

      iex> d = HashDict.new([a: 1, b: 2])
      +...>
       ...> d = Dict.take(d, [:a, :c, :d])
       ...> Dict.to_list(d)
       [a: 1]
      -
      -iex> d = HashDict.new([a: 1, b: 2])
      +...>
       ...> d = Dict.take(d, [:c, :d])
       ...> Dict.to_list(d)
       []
       
      - Source + Source

      @@ -673,7 +659,7 @@

      Examples

      No particular order is enforced.

      - Source + Source

      @@ -691,7 +677,7 @@

      Examples

      - Source + Source

      @@ -710,7 +696,7 @@

      Examples

      - Source + Source

      @@ -726,7 +712,7 @@

      Examples

      - Source + Source @@ -743,7 +729,7 @@

      Callbacks

      - Source + Source

      @@ -751,7 +737,7 @@

      Callbacks

      - Source + Source

      @@ -759,7 +745,7 @@

      Callbacks

      - Source + Source

      @@ -767,7 +753,7 @@

      Callbacks

      - Source + Source

      @@ -775,7 +761,7 @@

      Callbacks

      - Source + Source

      @@ -783,7 +769,7 @@

      Callbacks

      - Source + Source

      @@ -791,7 +777,7 @@

      Callbacks

      - Source + Source

      @@ -799,7 +785,7 @@

      Callbacks

      - Source + Source

      @@ -807,7 +793,7 @@

      Callbacks

      - Source + Source

      @@ -815,7 +801,7 @@

      Callbacks

      - Source + Source

      @@ -823,7 +809,7 @@

      Callbacks

      - Source + Source

      @@ -831,7 +817,7 @@

      Callbacks

      - Source + Source

      @@ -839,7 +825,7 @@

      Callbacks

      - Source + Source

      @@ -847,7 +833,7 @@

      Callbacks

      - Source + Source

      @@ -855,15 +841,7 @@

      Callbacks

      - Source - -
      -

      - get!(t(), key()) -

      -
      - - Source + Source

      @@ -871,7 +849,7 @@

      Callbacks

      - Source + Source

      @@ -879,7 +857,7 @@

      Callbacks

      - Source + Source

      @@ -887,7 +865,7 @@

      Callbacks

      - Source + Source

      @@ -895,7 +873,7 @@

      Callbacks

      - Source + Source

      @@ -903,7 +881,7 @@

      Callbacks

      - Source + Source

      @@ -911,7 +889,7 @@

      Callbacks

      - Source + Source
      diff --git a/docs/stable/EEx.AssignsEngine.html b/docs/stable/EEx.AssignsEngine.html index b3630b807..285dfcb43 100644 --- a/docs/stable/EEx.AssignsEngine.html +++ b/docs/stable/EEx.AssignsEngine.html @@ -53,7 +53,7 @@

      Examples

      - Source + Source diff --git a/docs/stable/EEx.Engine.html b/docs/stable/EEx.Engine.html index 6d3b208bc..547eab5b7 100644 --- a/docs/stable/EEx.Engine.html +++ b/docs/stable/EEx.Engine.html @@ -52,7 +52,7 @@

      - Source + Source @@ -93,7 +93,7 @@

      Functions

      - Source + Source

      @@ -108,7 +108,7 @@

      Functions

      All other markers are not implemented by this engine.

      - Source + Source

      @@ -117,7 +117,7 @@

      Functions

      The default implementation simply concatenates text to the buffer.

      - Source + Source
      diff --git a/docs/stable/EEx.SmartEngine.html b/docs/stable/EEx.SmartEngine.html index 77b42521e..e3ac71e79 100644 --- a/docs/stable/EEx.SmartEngine.html +++ b/docs/stable/EEx.SmartEngine.html @@ -34,7 +34,7 @@

      - Source + Source @@ -70,7 +70,7 @@

      Functions

      - Source + Source

      @@ -78,7 +78,7 @@

      Functions

      - Source + Source
      diff --git a/docs/stable/EEx.SyntaxError.html b/docs/stable/EEx.SyntaxError.html index 4ae0ac5de..c67a3b90d 100644 --- a/docs/stable/EEx.SyntaxError.html +++ b/docs/stable/EEx.SyntaxError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/stable/EEx.TransformerEngine.html b/docs/stable/EEx.TransformerEngine.html index 4a3772c4b..f740a5ccd 100644 --- a/docs/stable/EEx.TransformerEngine.html +++ b/docs/stable/EEx.TransformerEngine.html @@ -39,7 +39,7 @@

      - Source + Source diff --git a/docs/stable/EEx.html b/docs/stable/EEx.html index 84d061682..435679b69 100644 --- a/docs/stable/EEx.html +++ b/docs/stable/EEx.html @@ -109,7 +109,7 @@

      Macros

      - Source + Source @@ -172,7 +172,7 @@

      Functions

      that can be evaluated by Elixir or compiled to a function.

      - Source + Source

      @@ -182,7 +182,7 @@

      Functions

      that can be evaluated by Elixir or compiled to a function.

      - Source + Source

      @@ -201,7 +201,7 @@

      Examples

      - Source + Source

      @@ -216,7 +216,7 @@

      Examples

      - Source + Source @@ -252,7 +252,7 @@

      Examples

      - Source + Source

      @@ -273,7 +273,7 @@

      Examples

      - Source + Source diff --git a/docs/stable/Enum.EmptyError.html b/docs/stable/Enum.EmptyError.html index b6d3d272e..457d0a609 100644 --- a/docs/stable/Enum.EmptyError.html +++ b/docs/stable/Enum.EmptyError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/stable/Enum.OutOfBoundsError.html b/docs/stable/Enum.OutOfBoundsError.html index c5363a923..ab207a18b 100644 --- a/docs/stable/Enum.OutOfBoundsError.html +++ b/docs/stable/Enum.OutOfBoundsError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/stable/Enum.html b/docs/stable/Enum.html index 448d5992d..8eb4586d3 100644 --- a/docs/stable/Enum.html +++ b/docs/stable/Enum.html @@ -42,7 +42,7 @@

      - Source + Source @@ -279,7 +279,7 @@

      Examples

      - Source + Source

      @@ -307,7 +307,7 @@

      Examples

      - Source + Source

      @@ -332,7 +332,7 @@

      Examples

      - Source + Source

      @@ -347,7 +347,7 @@

      Examples

      - Source + Source

      @@ -356,7 +356,7 @@

      Examples

      Counts for how many items the function returns true.

      - Source + Source

      @@ -376,7 +376,7 @@

      Examples

      - Source + Source

      @@ -392,7 +392,7 @@

      Examples

      - Source + Source

      @@ -408,7 +408,7 @@

      Examples

      - Source + Source

      @@ -425,7 +425,7 @@

      Examples

      - Source + Source

      @@ -447,7 +447,7 @@

      Examples

      - Source + Source

      @@ -461,14 +461,16 @@

      Examples

      iex> Enum.fetch!([2,4,6], 0)
       2
      +
       iex> Enum.fetch!([2,4,6], 2)
       6
      +
       iex> Enum.fetch!([2,4,6], 4)
       ** (Enum.OutOfBoundsError) out of bounds error
       
      - Source + Source

      @@ -484,7 +486,7 @@

      Examples

      - Source + Source

      @@ -499,7 +501,7 @@

      Examples

      - Source + Source

      @@ -521,7 +523,7 @@

      Examples

      - Source + Source

      @@ -542,7 +544,7 @@

      Examples

      - Source + Source

      @@ -561,7 +563,7 @@

      Examples

      - Source + Source

      @@ -578,7 +580,7 @@

      Examples

      - Source + Source

      @@ -604,7 +606,7 @@

      Examples

      - Source + Source

      @@ -627,7 +629,7 @@

      Examples

      - Source + Source

      @@ -653,7 +655,7 @@

      Examples

      - Source + Source

      @@ -674,7 +676,7 @@

      Examples

      - Source + Source

      @@ -690,7 +692,7 @@

      Examples

      - Source + Source

      @@ -706,7 +708,7 @@

      Examples

      - Source + Source

      @@ -723,7 +725,7 @@

      Examples

      - Source + Source

      @@ -739,7 +741,7 @@

      Examples

      - Source + Source

      @@ -755,7 +757,7 @@

      Examples

      - Source + Source

      @@ -772,7 +774,7 @@

      Examples

      - Source + Source

      @@ -789,7 +791,7 @@

      Examples

      - Source + Source

      @@ -804,7 +806,7 @@

      Examples

      - Source + Source

      @@ -819,7 +821,7 @@

      Examples

      - Source + Source

      @@ -834,7 +836,7 @@

      Examples

      - Source + Source

      @@ -864,7 +866,7 @@

      Examples

      - Source + Source

      @@ -879,7 +881,7 @@

      Examples

      - Source + Source

      @@ -899,7 +901,7 @@

      Examples

      - Source + Source

      @@ -915,7 +917,7 @@

      Examples

      - Source + Source

      @@ -930,7 +932,7 @@

      Examples

      - Source + Source

      @@ -948,7 +950,7 @@

      Examples

      - Source + Source

      @@ -960,7 +962,7 @@

      Examples

      values are filled with nil.

      - Source + Source diff --git a/docs/stable/Enumerable.Function.html b/docs/stable/Enumerable.Function.html index 6c6cf1f33..a8a30fe33 100644 --- a/docs/stable/Enumerable.Function.html +++ b/docs/stable/Enumerable.Function.html @@ -29,7 +29,7 @@

      - Source + Source @@ -70,7 +70,7 @@

      Functions

      - Source + Source

      @@ -78,7 +78,7 @@

      Functions

      - Source + Source

      @@ -86,7 +86,7 @@

      Functions

      - Source + Source
      diff --git a/docs/stable/Enumerable.HashDict.html b/docs/stable/Enumerable.HashDict.html index 8c932ddec..0698de990 100644 --- a/docs/stable/Enumerable.HashDict.html +++ b/docs/stable/Enumerable.HashDict.html @@ -29,7 +29,7 @@

      - Source + Source @@ -70,7 +70,7 @@

      Functions

      - Source + Source

      @@ -78,7 +78,7 @@

      Functions

      - Source + Source

      @@ -86,7 +86,7 @@

      Functions

      - Source + Source
      diff --git a/docs/stable/Enumerable.List.html b/docs/stable/Enumerable.List.html index 7a8f0e528..0ae27785b 100644 --- a/docs/stable/Enumerable.List.html +++ b/docs/stable/Enumerable.List.html @@ -29,7 +29,7 @@

      - Source + Source @@ -70,7 +70,7 @@

      Functions

      - Source + Source

      @@ -78,7 +78,7 @@

      Functions

      - Source + Source

      @@ -86,7 +86,7 @@

      Functions

      - Source + Source
      diff --git a/docs/stable/Enumerable.Range.html b/docs/stable/Enumerable.Range.html index fecce0db8..d9622d3cc 100644 --- a/docs/stable/Enumerable.Range.html +++ b/docs/stable/Enumerable.Range.html @@ -29,7 +29,7 @@

      - Source + Source @@ -70,7 +70,7 @@

      Functions

      - Source + Source

      @@ -78,7 +78,7 @@

      Functions

      - Source + Source

      @@ -86,7 +86,7 @@

      Functions

      - Source + Source
      diff --git a/docs/stable/Enumerable.html b/docs/stable/Enumerable.html index 5ebf9a540..82f4736ba 100644 --- a/docs/stable/Enumerable.html +++ b/docs/stable/Enumerable.html @@ -47,7 +47,7 @@

      - Source + Source

      Implementations

      @@ -118,7 +118,7 @@

      Functions

      The function used to retrieve the collection's size.

      - Source + Source

      @@ -127,7 +127,7 @@

      Functions

      The function used to check if a value exists within the collection.

      - Source + Source

      @@ -154,7 +154,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/ErlangError.html b/docs/stable/ErlangError.html index 15ca778d1..1bb5b250b 100644 --- a/docs/stable/ErlangError.html +++ b/docs/stable/ErlangError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -71,7 +71,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/ExUnit.AssertionError.html b/docs/stable/ExUnit.AssertionError.html index 99d310d44..69fe5cbd2 100644 --- a/docs/stable/ExUnit.AssertionError.html +++ b/docs/stable/ExUnit.AssertionError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/stable/ExUnit.Assertions.html b/docs/stable/ExUnit.Assertions.html index ae96a570a..a139d5be1 100644 --- a/docs/stable/ExUnit.Assertions.html +++ b/docs/stable/ExUnit.Assertions.html @@ -46,7 +46,7 @@

      - Source + Source @@ -169,7 +169,7 @@

      Examples

      - Source + Source

      @@ -185,7 +185,7 @@

      Examples

      - Source + Source

      @@ -200,7 +200,7 @@

      Examples

      - Source + Source

      @@ -217,7 +217,7 @@

      Examples

      - Source + Source

      @@ -234,7 +234,7 @@

      Examples

      - Source + Source

      @@ -248,7 +248,7 @@

      Examples

      - Source + Source

      @@ -263,7 +263,7 @@

      Examples

      - Source + Source

      @@ -278,7 +278,7 @@

      Examples

      - Source + Source @@ -306,7 +306,7 @@

      Examples

      - Source + Source

      @@ -333,7 +333,7 @@

      Examples

      - Source + Source

      @@ -357,7 +357,7 @@

      Examples

      - Source + Source

      @@ -372,7 +372,7 @@

      Examples

      - Source + Source

      @@ -387,7 +387,7 @@

      Examples

      - Source + Source

      @@ -402,7 +402,7 @@

      Examples

      - Source + Source

      @@ -419,7 +419,7 @@

      Examples

      - Source + Source

      @@ -441,7 +441,7 @@

      Examples

      - Source + Source

      @@ -459,7 +459,7 @@

      Examples

      - Source + Source diff --git a/docs/stable/ExUnit.CLIFormatter.html b/docs/stable/ExUnit.CLIFormatter.html index 71fbd10c8..76c5bcc8a 100644 --- a/docs/stable/ExUnit.CLIFormatter.html +++ b/docs/stable/ExUnit.CLIFormatter.html @@ -33,7 +33,7 @@

      - Source + Source @@ -52,31 +52,6 @@

      Functions summary

      case_started/2
    3335. -
    3336. - - code_change/3 - -
    3337. -
    3338. - - handle_call/3 - -
    3339. -
    3340. - - handle_cast/2 - -
    3341. -
    3342. - - handle_info/2 - -
    3343. -
    3344. - - init/1 - -
    3345. suite_finished/3 @@ -87,11 +62,6 @@

      Functions summary

      suite_started/1
    3346. -
    3347. - - terminate/2 - -
    3348. test_finished/2 @@ -119,7 +89,7 @@

      Functions

      - Source + Source

      @@ -127,47 +97,7 @@

      Functions

      - Source - -
      -

      - code_change(_old, state, _extra) -

      -
      - - Source - -
      -

      - handle_call(arg1, arg2, state) -

      -
      - - Source - -
      -

      - handle_cast(arg1, state) -

      -
      - - Source - -
      -

      - handle_info(_msg, state) -

      -
      - - Source - -
      -

      - init(args) -

      -
      - - Source + Source

      @@ -175,7 +105,7 @@

      Functions

      - Source + Source

      @@ -183,15 +113,7 @@

      Functions

      - Source - -
      -

      - terminate(reason, state) -

      -
      - - Source + Source

      @@ -199,7 +121,7 @@

      Functions

      - Source + Source

      @@ -207,7 +129,7 @@

      Functions

      - Source + Source
      diff --git a/docs/stable/ExUnit.Callbacks.html b/docs/stable/ExUnit.Callbacks.html index f74f98880..293a34e16 100644 --- a/docs/stable/ExUnit.Callbacks.html +++ b/docs/stable/ExUnit.Callbacks.html @@ -65,7 +65,7 @@

      Examples

      - Source + Source @@ -116,7 +116,7 @@

      Macros

      Called before the start of each test.

      - Source + Source

      @@ -127,7 +127,7 @@

      Macros

      Called before the start of a case.

      - Source + Source

      @@ -139,7 +139,7 @@

      Macros

      message teardown will not be run.

      - Source + Source

      @@ -150,7 +150,7 @@

      Macros

      Called after the finish of each case.

      - Source + Source
      diff --git a/docs/stable/ExUnit.CaptureIO.html b/docs/stable/ExUnit.CaptureIO.html index 8ac28c024..ff90b72b5 100644 --- a/docs/stable/ExUnit.CaptureIO.html +++ b/docs/stable/ExUnit.CaptureIO.html @@ -48,7 +48,7 @@

      Examples

      - Source + Source @@ -89,7 +89,7 @@

      Functions

      - Source + Source

      @@ -97,7 +97,7 @@

      Functions

      - Source + Source

      @@ -130,7 +130,7 @@

      Examples

      - Source + Source diff --git a/docs/stable/ExUnit.Case.html b/docs/stable/ExUnit.Case.html index bcb475774..bd666abb5 100644 --- a/docs/stable/ExUnit.Case.html +++ b/docs/stable/ExUnit.Case.html @@ -56,7 +56,7 @@

      Examples

      - Source + Source @@ -104,7 +104,7 @@

      Examples

      - Source + Source diff --git a/docs/stable/ExUnit.CaseTemplate.html b/docs/stable/ExUnit.CaseTemplate.html index 58c2fab64..03e7211ed 100644 --- a/docs/stable/ExUnit.CaseTemplate.html +++ b/docs/stable/ExUnit.CaseTemplate.html @@ -57,7 +57,7 @@

      Example

      - Source + Source @@ -94,7 +94,7 @@

      Macros

      this module is used.

      - Source + Source diff --git a/docs/stable/ExUnit.DocTest.Error.html b/docs/stable/ExUnit.DocTest.Error.html new file mode 100644 index 000000000..cbed12b10 --- /dev/null +++ b/docs/stable/ExUnit.DocTest.Error.html @@ -0,0 +1,62 @@ + + + + ExUnit.DocTest.Error + + + + + + + + + + + + +
      +

      + ExUnit.DocTest.Error + + exception + +

      + + + + Source + + + + +

      Fields (and defaults)

      +
        + +
      • + + message: nil + +
      • + +
      + + + + + + + + + + + + + +
      + + diff --git a/docs/stable/ExUnit.DocTest.html b/docs/stable/ExUnit.DocTest.html index d00b35ba3..6aae6c934 100644 --- a/docs/stable/ExUnit.DocTest.html +++ b/docs/stable/ExUnit.DocTest.html @@ -56,9 +56,9 @@

      Examples

      end -

      The doctest macro is going to loop all functions and macros -defined in MyModule, parsing their documentation in search for -code examples.

      +

      The doctest macro is going to loop through all functions and +macros defined in MyModule, parsing their documentation in +search for code examples.

      A very basic example is:

      @@ -66,7 +66,7 @@

      Examples

      2 -

      Multiline is also supported:

      +

      Expressions on multiple lines are also supported:

      iex> Enum.map [1,2,3], fn(x) ->
       ...>   x * 2
      @@ -74,6 +74,24 @@ 

      Examples

      [2,4,6]
      +

      Multiple results can be checked within the same test:

      + +
      iex> a = 1
      +1
      +iex> a + 1
      +2
      +
      + +

      If you want to keep any two tests separate from each other, +add an empty line between them:

      + +
      iex> a = 1
      +1
      +
      +iex> a + 1  # will fail with a "function a/0 undefined" error
      +2
      +
      +

      Similarly to iex you can use numbers in your "prompts":

      iex(1)> [1+2,
      @@ -89,7 +107,7 @@ 

      Examples

      We also allow you to select or skip some functions when calling -doctest. See its documentation documentation for more info.

      +doctest. See its documentation for more info.

      Exceptions

      @@ -112,14 +130,14 @@

      When not to use doctest

      side effects. For example, if a doctest prints to standard output, doctest will not try to capture the output.

      -

      Similarly, doctest does not run in any kind of side box. So any module +

      Similarly, doctest does not run in any kind of sandbox. So any module defined in a code example is going to linger throughout the whole test suite run.

      - Source + Source @@ -152,20 +170,16 @@

      Macros

      This macro is used to generate ExUnit test cases for doctests.

      -

      There are three ways this macro can be used:

      - -
        -
      • doctest(Module) — will generate tests for all doctests found -in the module Module
      • -
      +

      Calling doctest(Module) will generate tests for all doctests found +in the module Module

      Options can also be supplied:

      • :except — generate tests for all functions except those listed (list of {function, arity} tuples)

      • -
      • :only — generate tests only forfunctions listed - (list of {function, arity} tuples)

      • +
      • :only — generate tests only forfunctions listed + (list of {function, arity} tuples)

      • :import — when true, one can test a function defined in the module without referring to the module name. However, this is not feasible when there is a clash with a number module like @@ -178,10 +192,10 @@

        Examples

        doctest MyModule, except: [trick_fun: 1]
         
        -

        This macro is auto-imported into every ExUnit.Case.

        +

        This macro is auto-imported with every ExUnit.Case.

      - Source + Source diff --git a/docs/stable/ExUnit.ExpectationError.html b/docs/stable/ExUnit.ExpectationError.html index 212afddb8..840b43356 100644 --- a/docs/stable/ExUnit.ExpectationError.html +++ b/docs/stable/ExUnit.ExpectationError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -106,7 +106,7 @@

      Functions

      - Source + Source

      @@ -114,7 +114,7 @@

      Functions

      - Source + Source
      diff --git a/docs/stable/ExUnit.Formatter.html b/docs/stable/ExUnit.Formatter.html index 2a94f6ddc..ae02679a5 100644 --- a/docs/stable/ExUnit.Formatter.html +++ b/docs/stable/ExUnit.Formatter.html @@ -35,7 +35,7 @@

      - Source + Source @@ -95,7 +95,7 @@

      Callbacks

      - Source + Source

      @@ -103,7 +103,7 @@

      Callbacks

      - Source + Source

      @@ -111,7 +111,7 @@

      Callbacks

      - Source + Source

      @@ -119,7 +119,7 @@

      Callbacks

      - Source + Source

      @@ -127,15 +127,15 @@

      Callbacks

      - Source + Source

      - suite_started(opts :: list()) + suite_started(opts :: [])

      - Source + Source
      diff --git a/docs/stable/ExUnit.Test.html b/docs/stable/ExUnit.Test.html index b9dd5b705..880c03415 100644 --- a/docs/stable/ExUnit.Test.html +++ b/docs/stable/ExUnit.Test.html @@ -36,7 +36,7 @@

      - Source + Source diff --git a/docs/stable/ExUnit.TestCase.html b/docs/stable/ExUnit.TestCase.html index 92bdf257c..7b2214eee 100644 --- a/docs/stable/ExUnit.TestCase.html +++ b/docs/stable/ExUnit.TestCase.html @@ -36,7 +36,7 @@

      - Source + Source diff --git a/docs/stable/ExUnit.html b/docs/stable/ExUnit.html index d4a25e99f..17f1bc95a 100644 --- a/docs/stable/ExUnit.html +++ b/docs/stable/ExUnit.html @@ -75,7 +75,7 @@

      Case, callbacks and assertions

      - Source + Source @@ -99,11 +99,6 @@

      Functions summary

      start/1
    3349. -
    3350. - - stop/1 - -
    3351. @@ -133,7 +128,7 @@

      Options

      - Source + Source

      @@ -145,7 +140,7 @@

      Options

      Returns the number of failures.

      - Source + Source

      @@ -159,15 +154,7 @@

      Options

      function and rely on configure/1 and run/0 instead.

      - Source - -
      -

      - stop(_state) -

      -
      - - Source + Source
      diff --git a/docs/stable/Exception.html b/docs/stable/Exception.html index 25fbefa5a..e6c0189d1 100644 --- a/docs/stable/Exception.html +++ b/docs/stable/Exception.html @@ -33,7 +33,7 @@

      - Source + Source @@ -84,7 +84,7 @@

      Functions

      - Source + Source

      @@ -97,7 +97,7 @@

      Functions

      the value of System.stacktrace is changed.

      - Source + Source

      @@ -108,7 +108,7 @@

      Functions

      is used to prettify the stacktrace.

      - Source + Source

      @@ -119,7 +119,7 @@

      Functions

      code with Elixir code.

      - Source + Source

      Functions

      the value of System.stacktrace is changed.

      - Source + Source diff --git a/docs/stable/File.CopyError.html b/docs/stable/File.CopyError.html index 1b7d907e9..f21e56bd8 100644 --- a/docs/stable/File.CopyError.html +++ b/docs/stable/File.CopyError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -89,7 +89,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/File.Error.html b/docs/stable/File.Error.html index 43374cdeb..e6c6eb7e8 100644 --- a/docs/stable/File.Error.html +++ b/docs/stable/File.Error.html @@ -29,7 +29,7 @@

      - Source + Source @@ -83,7 +83,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/File.IteratorError.html b/docs/stable/File.IteratorError.html index 8aeee3b2e..b7e952cd6 100644 --- a/docs/stable/File.IteratorError.html +++ b/docs/stable/File.IteratorError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -71,7 +71,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/File.Stat.html b/docs/stable/File.Stat.html index 0cb4b7f62..375a0e9f4 100644 --- a/docs/stable/File.Stat.html +++ b/docs/stable/File.Stat.html @@ -63,7 +63,7 @@

      - Source + Source diff --git a/docs/stable/File.html b/docs/stable/File.html index 40ba42c75..1b0f654b5 100644 --- a/docs/stable/File.html +++ b/docs/stable/File.html @@ -77,7 +77,7 @@

      - Source + Source @@ -331,7 +331,7 @@

      Functions

      binary. Check iterator/1 for more information.

      - Source + Source

      @@ -343,7 +343,7 @@

      Functions

      that the file is opened when the iteration begins.

      - Source + Source

      @@ -353,7 +353,7 @@

      Functions

      { :error, reason } otherwise.

      - Source + Source

      @@ -362,7 +362,7 @@

      Functions

      The same as cd/0, but raises an exception if it fails.

      - Source + Source

      @@ -376,7 +376,7 @@

      Functions

      directory fails.

      - Source + Source

      @@ -390,7 +390,7 @@

      Functions

      See open/2.

      - Source + Source

      @@ -411,7 +411,7 @@

      Functions

      read/1 and write/2.

      - Source + Source

      @@ -421,7 +421,7 @@

      Functions

      Returns the bytes_copied otherwise.

      - Source + Source

      @@ -446,7 +446,7 @@

      Functions

      { :error, reason } otherwise.

      - Source + Source

      @@ -456,7 +456,7 @@

      Functions

      Returns the list of copied files otherwise.

      - Source + Source

      @@ -508,7 +508,7 @@

      Examples

      - Source + Source

      @@ -518,7 +518,7 @@

      Examples

      Returns the list of copied files otherwise.

      - Source + Source

      @@ -530,7 +530,7 @@

      Examples

      in case of success, { :error, reason } otherwise.

      - Source + Source

      @@ -539,7 +539,7 @@

      Examples

      The same as cwd/0, but raises an exception if it fails.

      - Source + Source

      @@ -548,7 +548,7 @@

      Examples

      Returns true if the path is a directory.

      - Source + Source

      @@ -571,7 +571,7 @@

      Examples

      - Source + Source

      @@ -600,7 +600,7 @@

      Examples

      - Source + Source

      @@ -612,7 +612,7 @@

      Examples

      that the file is opened when the iteration begins.

      - Source + Source

      @@ -624,7 +624,7 @@

      Examples

      { :error, reason } otherwise.

      - Source + Source

      @@ -634,7 +634,7 @@

      Examples

      in case of an error.

      - Source + Source

      @@ -655,7 +655,7 @@

      Examples

      - Source + Source

      @@ -664,7 +664,7 @@

      Examples

      Same as mkdir, but raises an exception in case of failure. Otherwise :ok.

      - Source + Source

      @@ -682,7 +682,7 @@

      Examples

      - Source + Source

      @@ -691,7 +691,7 @@

      Examples

      Same as mkdir_p, but raises an exception in case of failure. Otherwise :ok.

      - Source + Source

      @@ -754,7 +754,7 @@

      Examples

      - Source + Source

      @@ -781,7 +781,7 @@

      Examples

      - Source + Source

      @@ -791,7 +791,7 @@

      Examples

      Returns the io_device otherwise.

      - Source + Source

      @@ -801,7 +801,7 @@

      Examples

      Returns the function result otherwise.

      - Source + Source

      @@ -825,7 +825,7 @@

      Examples

      You can use :file.format_error(reason) to get a descriptive string of the error.

      - Source + Source

      @@ -835,7 +835,7 @@

      Examples

      File.Error if an error occurs.

      - Source + Source

      @@ -849,7 +849,7 @@

      Examples

      - Source + Source

      @@ -879,7 +879,7 @@

      Examples

      - Source + Source

      @@ -888,7 +888,7 @@

      Examples

      Same as rm, but raises an exception in case of failure. Otherwise :ok.

      - Source + Source

      @@ -912,7 +912,7 @@

      Examples

      - Source + Source

      @@ -922,7 +922,7 @@

      Examples

      otherwise the list of files or directories removed.

      - Source + Source

      @@ -941,7 +941,7 @@

      Examples

      - Source + Source

      @@ -950,7 +950,7 @@

      Examples

      Same as rmdir/1, but raises an exception in case of failure. Otherwise :ok.

      - Source + Source

      @@ -971,7 +971,7 @@

      Options

      - Source + Source

      @@ -981,7 +981,7 @@

      Options

      throws File.Error if an error is returned.

      - Source + Source

      @@ -991,7 +991,7 @@

      Options

      the given file. File is created if it doesn’t exist.

      - Source + Source

      @@ -1001,7 +1001,7 @@

      Options

      Returns :ok otherwise.

      - Source + Source

      @@ -1023,7 +1023,7 @@

      Options

      - Source + Source

      @@ -1032,7 +1032,7 @@

      Options

      Same as write/3 but raises an exception if it fails, returns :ok otherwise.

      - Source + Source

      @@ -1042,7 +1042,7 @@

      Options

      path. Returns :ok or { :error, reason }.

      - Source + Source

      @@ -1052,7 +1052,7 @@

      Options

      Returns :ok otherwise.

      - Source + Source diff --git a/docs/stable/FunctionClauseError.html b/docs/stable/FunctionClauseError.html index 7fe00281f..95d9c1ebe 100644 --- a/docs/stable/FunctionClauseError.html +++ b/docs/stable/FunctionClauseError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -83,7 +83,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/GenEvent.Behaviour.html b/docs/stable/GenEvent.Behaviour.html index cfb274774..80b9988c0 100644 --- a/docs/stable/GenEvent.Behaviour.html +++ b/docs/stable/GenEvent.Behaviour.html @@ -82,7 +82,7 @@

      Example

      - Source + Source diff --git a/docs/stable/GenServer.Behaviour.html b/docs/stable/GenServer.Behaviour.html index b23389358..750e4c643 100644 --- a/docs/stable/GenServer.Behaviour.html +++ b/docs/stable/GenServer.Behaviour.html @@ -116,7 +116,7 @@

      Example

      - Source + Source diff --git a/docs/stable/HashDict.html b/docs/stable/HashDict.html index 1a3dfc936..1d7b45950 100644 --- a/docs/stable/HashDict.html +++ b/docs/stable/HashDict.html @@ -37,7 +37,7 @@

      - Source + Source @@ -184,7 +184,7 @@

      Functions

      Deletes a value from the dict.

      - Source + Source

      @@ -194,7 +194,7 @@

      Functions

      which key is not in keys

      - Source + Source

      @@ -203,7 +203,7 @@

      Functions

      Returns an empty dict.

      - Source + Source

      @@ -211,7 +211,7 @@

      Functions

      - Source + Source

      @@ -221,7 +221,7 @@

      Functions

      and return it in a tagged tuple.

      - Source + Source

      @@ -229,7 +229,7 @@

      Functions

      - Source + Source

      @@ -238,7 +238,7 @@

      Functions

      Gets the value under key from the dict.

      - Source + Source

      @@ -247,7 +247,7 @@

      Functions

      Checks if the dict has the given key.

      - Source + Source

      @@ -256,7 +256,7 @@

      Functions

      Get all keys in the dict.

      - Source + Source

      @@ -265,7 +265,7 @@

      Functions

      Merges two dictionaries.

      - Source + Source

      @@ -274,7 +274,7 @@

      Functions

      Creates a new empty dict.

      - Source + Source

      @@ -289,7 +289,7 @@

      Examples

      - Source + Source

      @@ -305,7 +305,7 @@

      Examples

      - Source + Source

      @@ -314,7 +314,7 @@

      Examples

      Returns the value under key from the dict as well as the dict without key.

      - Source + Source

      @@ -323,7 +323,7 @@

      Examples

      Puts the given key and value in the dict.

      - Source + Source

      @@ -333,7 +333,7 @@

      Examples

      only if one does not exist yet.

      - Source + Source

      @@ -341,7 +341,7 @@

      Examples

      - Source + Source

      @@ -350,7 +350,7 @@

      Examples

      Returns the dict size.

      - Source + Source

      @@ -362,7 +362,7 @@

      Examples

      Returns a 2-tuple of the new dicts.

      - Source + Source

      @@ -372,7 +372,7 @@

      Examples

      which key is in keys.

      - Source + Source

      @@ -381,7 +381,7 @@

      Examples

      Converts the dict to a list.

      - Source + Source

      @@ -392,7 +392,7 @@

      Examples

      not exist in the dictionary.

      - Source + Source

      @@ -403,7 +403,7 @@

      Examples

      the key does not exist in the dicionary.

      - Source + Source

      @@ -412,7 +412,7 @@

      Examples

      Get all values in the dict.

      - Source + Source
      diff --git a/docs/stable/IEx.Autocomplete.html b/docs/stable/IEx.Autocomplete.html index cffdc91d8..a0c9dea64 100644 --- a/docs/stable/IEx.Autocomplete.html +++ b/docs/stable/IEx.Autocomplete.html @@ -32,7 +32,7 @@

      - Source + Source @@ -63,7 +63,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/IEx.Helpers.html b/docs/stable/IEx.Helpers.html index d407f0532..78afd46f4 100644 --- a/docs/stable/IEx.Helpers.html +++ b/docs/stable/IEx.Helpers.html @@ -74,7 +74,7 @@

      - Source + Source @@ -199,7 +199,7 @@

      Examples

      - Source + Source

      @@ -208,7 +208,7 @@

      Examples

      Changes the current working directory to the given path.

      - Source + Source

      @@ -217,7 +217,7 @@

      Examples

      Flushes all messages sent to the shell and prints them out.

      - Source + Source

      @@ -226,7 +226,7 @@

      Examples

      Prints the documentation for IEx.Helpers.

      - Source + Source

      @@ -235,7 +235,7 @@

      Examples

      Purges and reloads specified module.

      - Source + Source

      @@ -245,7 +245,7 @@

      Examples

      If path points to a file, prints its full path.

      - Source + Source

      @@ -255,7 +255,7 @@

      Examples

      files.

      - Source + Source

      @@ -264,7 +264,7 @@

      Examples

      Prints the current working directory.

      - Source + Source

      @@ -274,7 +274,7 @@

      Examples

      in the current IEx session.

      - Source + Source

      @@ -286,7 +286,7 @@

      Examples

      are recompiled and reloaded.

      - Source + Source

      @@ -296,7 +296,7 @@

      Examples

      their results.

      - Source + Source

      @@ -308,7 +308,7 @@

      Examples

      For instance, v(-1) returns the result of the last evaluated expression.

      - Source + Source @@ -339,7 +339,7 @@

      Examples

      - Source + Source

      @@ -363,7 +363,7 @@

      Examples

      - Source + Source

      @@ -385,7 +385,7 @@

      Examples

      - Source + Source

      @@ -404,7 +404,7 @@

      Examples

      - Source + Source diff --git a/docs/stable/IEx.Options.html b/docs/stable/IEx.Options.html new file mode 100644 index 000000000..8374748dd --- /dev/null +++ b/docs/stable/IEx.Options.html @@ -0,0 +1,277 @@ + + + + IEx.Options + + + + + + + + + + + + +
      +

      + IEx.Options + +

      + + +
      +

      Provides an interface for adjusting options of the running IEx session.

      + +

      Changing options is usually done inside an IEx session or in your .iex file. +See h(IEx) for more info on the latter.

      + +

      If the value of an option is a keyword list, only those keys that are +mentioned will be changed. The rest of the sub-options will keep their +current values. Any extraneous keys are filtered out, i.e. not used.

      + +

      To get the list of all supported options, use list/0. You can also get an +option's description using print_help/1.

      + +

      Examples

      + +
      iex(1)> ArgumentError[]
      +ArgumentError[message: "argument error"]
      +
      +iex(2)> IEx.Options.set :inspect, raw: true
      +[limit: 50, raw: false]
      +
      +iex(3)> ArgumentError[]
      +{ArgumentError,:__exception__,"argument error"}
      +
      +iex(4)> IEx.Options.list
      +[:colors,:inspect]
      +
      +iex(5)> IEx.Options.print_help :colors
      +This is an aggregate option that encapsulates all color settings used
      +by the shell.
      +... # omitted content
      +
      + +
      + + + Source + + + + + + +

      Functions summary

      + + + + + + + + +
      +

      Functions

      +
      +

      + colors() +

      +

      NOTE: This is just a stub for documentation purposes. Use +IEx.Options.get and IEx.Options.set to query and change the option's +value.

      + +

      This is an aggregate option that encapsulates all color settings used by the +shell. See documentation for the IO.ANSI module for the list of supported +colors and attributes.

      + +

      The value is a keyword list. List of supported keys:

      + +
        +
      • enabled -- boolean value that allows for switching the coloring + on and off

      • +
      • eval_result -- color for an expression's resulting value

      • +
      • error -- color for error messages

      • +
      • info -- color for various informational messages

      • +
      • directory -- color for directory entries (ls helper)

      • +
      • device -- color for device entries (ls helper)

      • +
      +
      + + Source + +
      +

      + get() +

      +

      Returns all supported IEx options with their respective values as a keyword +list.

      +
      + + Source + +
      +

      + get(name) +

      +

      Get current value of the option name. Raises ArgumentError if name is not a +known option.

      +
      + + Source + +
      +

      + help(name) +

      +

      Returns a string with the option's description. Raises if name is not a +known option.

      +
      + + Source + +
      +

      + history_size() +

      +

      NOTE: This is just a stub for documentation purposes. Use +IEx.Options.get and IEx.Options.set to query and change the option's +value.

      + +

      Number of expressions and their results to keep in the history.

      + +

      The value is an integer. When it is negative, the history is unlimited.

      +
      + + Source + +
      +

      + inspect() +

      +

      NOTE: This is just a stub for documentation purposes. Use +IEx.Options.get and IEx.Options.set to query and change the option's +value.

      + +

      Inspect options used by the shell when printing results of expression +evaluation.

      + +

      The value is a keyword list.

      + +

      See Kernel.inspect/2 for the full list of options.

      +
      + + Source + +
      +

      + list() +

      +

      Returns all supported options as a list of names.

      +
      + + Source + +
      + +

      Same as help/1 but instead of returning a string, prints it.

      +
      + + Source + +
      +

      + set(opts) +

      +

      Set all options at once by providing a keyword list with option names and +their corresponding values. This is generally obtained from get/0.

      + +

      Returns a keyword list of old option values.

      +
      + + Source + +
      +

      + set(name, value) +

      +

      Sets the value for the option name to value.

      + +

      Returns option's previous value in the case of success.

      + +

      Raises if name is not a known option or if the value is invalid.

      +
      + + Source + +
      +
      + + + + + +
      + + diff --git a/docs/stable/IEx.html b/docs/stable/IEx.html index 8d7bade4f..e9bf16e27 100644 --- a/docs/stable/IEx.html +++ b/docs/stable/IEx.html @@ -120,6 +120,31 @@

      The .iex file

      It is possible to override the default loading sequence for .iex file by supplying the --dot-iex option to iex. See iex --help.

      +

      Configuring the shell

      + +

      There is a number of customization options provided by the shell. Take a look +at the docs for the IEx.Options module.

      + +

      The main functions there are IEx.Options.get/1 and IEx.Options.set/2. One +can also use IEx.Options.list/0 to get the list of all supported options. +IEx.Options.print_help/1 will print documentation for the given option.

      + +

      In particular, it might be convenient to customize those options inside your +.iex file like this:

      + +
      # .iex
      +IEx.Options.set :inspect, limit: 3
      +
      +### now run the shell ###
      +
      +$ iex
      +Erlang R16B (erts-5.10.1) [...]
      +
      +Interactive Elixir (0.9.1.dev) - press Ctrl+C to exit (type h() ENTER for help)
      +iex(1)> [1,2,3,4,5]
      +[1,2,3,...]
      +
      +

      Expressions in IEx

      As an interactive shell, IEx evaluates expressions. This has some @@ -158,7 +183,7 @@

      Expressions in IEx

      - Source + Source @@ -179,12 +204,17 @@

      Functions summary

    3352. - inspect_opts/0 + color/2
    3353. - inspect_opts/1 + color_fragment/1 + +
    3354. +
    3355. + + color_reset/0
    3356. @@ -210,7 +240,7 @@

      Functions

      Returns registered after spawn callbacks.

      - Source + Source

      @@ -219,25 +249,34 @@

      Functions

      Registers a function to be invoked after IEx process is spawned.

      - Source + Source + +
      +

      + color(color_name, string) +

      +

      Returns string escaped using the specified color.

      +
      + + Source
      -

      - inspect_opts() +

      + color_fragment(color_name)

      -

      Returns currently registered inspect options.

      +

      Returns an escaped fragment using the specified color.

      - Source + Source
      -

      - inspect_opts(opts) +

      + color_reset()

      -

      Registers options used on inspect.

      +

      Returns an escaped fragment that resets colors and attributes.

      - Source + Source

      @@ -246,7 +285,7 @@

      Functions

      Returns true if IEx was properly started.

      - Source + Source
      diff --git a/docs/stable/IO.ANSI.html b/docs/stable/IO.ANSI.html index cb63ad762..0861730f5 100644 --- a/docs/stable/IO.ANSI.html +++ b/docs/stable/IO.ANSI.html @@ -35,7 +35,7 @@

      - Source + Source @@ -317,7 +317,7 @@

      Functions

      Sets foreground color to black

      - Source + Source

      @@ -326,7 +326,7 @@

      Functions

      Sets background color to black

      - Source + Source

      Functions

      Blink: off

      - Source + Source

      Functions

      Blink: Rapid. MS-DOS ANSI.SYS; 150 per minute or more; not widely supported

      - Source + Source

      Functions

      Blink: Slow. Less than 150 per minute

      - Source + Source

      @@ -362,7 +362,7 @@

      Functions

      Sets foreground color to blue

      - Source + Source

      @@ -371,7 +371,7 @@

      Functions

      Sets background color to blue

      - Source + Source

      @@ -380,7 +380,7 @@

      Functions

      Bright (increased intensity) or Bold

      - Source + Source

      @@ -389,7 +389,7 @@

      Functions

      Conceal. Not widely supported

      - Source + Source

      @@ -398,7 +398,7 @@

      Functions

      Crossed-out. Characters legible, but marked for deletion. Not widely supported.

      - Source + Source

      @@ -407,7 +407,7 @@

      Functions

      Sets foreground color to cyan

      - Source + Source

      @@ -416,7 +416,7 @@

      Functions

      Sets background color to cyan

      - Source + Source

      @@ -425,7 +425,7 @@

      Functions

      Default background color

      - Source + Source

      @@ -434,7 +434,7 @@

      Functions

      Default text color

      - Source + Source

      @@ -443,19 +443,19 @@

      Functions

      Encircled

      - Source + Source

      escape(string, emit // terminal?())

      -

      Escapes a string coverting named ANSI sequences into actual ANSI codes.

      +

      Escapes a string by converting named ANSI sequences into actual ANSI codes.

      -

      The format for referring sequences is %{red} and %{red,bright} (for -multiple sequences)

      +

      The format for referring to sequences is %{red} and %{red,bright} (for +multiple sequences).

      -

      It will also force a %{reset} to get appended to every string. If you don't -want this behaviour, use escape_fragment/1 and escape_fragment/2.

      +

      It will also append a %{reset} to the string. If you don't want this +behaviour, use escape_fragment/1 and escape_fragment/2.

      An optional boolean parameter can be passed to enable or disable emitting actual ANSI codes. When false, no ANSI codes will emitted. @@ -468,16 +468,16 @@

      Example

      "Hello \e[31m\e[1m\e[32myes\e[0m"

      - Source + Source

      escape_fragment(string, emit // terminal?())

      -

      Escapes a string coverting named ANSI sequences into actual ANSI codes.

      +

      Escapes a string by converting named ANSI sequences into actual ANSI codes.

      -

      The format for referring sequences is %{red} and %{red,bright} (for -multiple sequences)

      +

      The format for referring to sequences is %{red} and %{red,bright} (for +multiple sequences).

      An optional boolean parameter can be passed to enable or disable emitting actual ANSI codes. When false, no ANSI codes will emitted. @@ -486,11 +486,13 @@

      Example

      Example

      -

      iex> IO.ANSI.escape("Hello %{red,bright,green}yes") - "Hello \e[31m\e[1m\e[32myes\e[0m"

      +

      iex> IO.ANSI.escapefragment("Hello %{red,bright,green}yes") + "Hello \e[31m\e[1m\e[32myes" + iex> IO.ANSI.escapefragment("%{reset}bye") + "\e[0mbye"

      - Source + Source

      @@ -499,7 +501,7 @@

      Example

      Faint (decreased intensity), not widely supported

      - Source + Source

      @@ -508,7 +510,7 @@

      Example

      Sets alternative font 1

      - Source + Source

      @@ -517,7 +519,7 @@

      Example

      Sets alternative font 2

      - Source + Source

      @@ -526,7 +528,7 @@

      Example

      Sets alternative font 3

      - Source + Source

      @@ -535,7 +537,7 @@

      Example

      Sets alternative font 4

      - Source + Source

      @@ -544,7 +546,7 @@

      Example

      Sets alternative font 5

      - Source + Source

      @@ -553,7 +555,7 @@

      Example

      Sets alternative font 6

      - Source + Source

      @@ -562,7 +564,7 @@

      Example

      Sets alternative font 7

      - Source + Source

      @@ -571,7 +573,7 @@

      Example

      Sets alternative font 8

      - Source + Source

      @@ -580,7 +582,7 @@

      Example

      Sets alternative font 9

      - Source + Source

      @@ -589,7 +591,7 @@

      Example

      Framed

      - Source + Source

      @@ -598,7 +600,7 @@

      Example

      Sets foreground color to green

      - Source + Source

      @@ -607,7 +609,7 @@

      Example

      Sets background color to green

      - Source + Source

      @@ -616,7 +618,7 @@

      Example

      Image: Negative. Swap foreground and background

      - Source + Source

      @@ -625,7 +627,7 @@

      Example

      Italic: on. Not widely supported. Sometimes treated as inverse.

      - Source + Source

      @@ -634,7 +636,7 @@

      Example

      Sets foreground color to magenta

      - Source + Source

      @@ -643,7 +645,7 @@

      Example

      Sets background color to magenta

      - Source + Source

      @@ -652,7 +654,7 @@

      Example

      Underline: None

      - Source + Source

      @@ -661,7 +663,7 @@

      Example

      Normal color or intensity

      - Source + Source

      @@ -670,7 +672,7 @@

      Example

      Not framed or encircled

      - Source + Source

      @@ -679,7 +681,7 @@

      Example

      Not italic

      - Source + Source

      @@ -688,7 +690,7 @@

      Example

      Not overlined

      - Source + Source

      @@ -697,7 +699,7 @@

      Example

      Overlined

      - Source + Source

      @@ -706,7 +708,7 @@

      Example

      Sets primary (default) font

      - Source + Source

      @@ -715,7 +717,7 @@

      Example

      Sets foreground color to red

      - Source + Source

      @@ -724,7 +726,7 @@

      Example

      Sets background color to red

      - Source + Source

      @@ -733,7 +735,7 @@

      Example

      Resets all attributes

      - Source + Source

      @@ -742,7 +744,7 @@

      Example

      Image: Negative. Swap foreground and background

      - Source + Source

      @@ -754,7 +756,7 @@

      Example

      be printed as intended.

      - Source + Source

      @@ -763,7 +765,7 @@

      Example

      Underline: Single

      - Source + Source

      @@ -772,7 +774,7 @@

      Example

      Sets foreground color to white

      - Source + Source

      @@ -781,7 +783,7 @@

      Example

      Sets background color to white

      - Source + Source

      @@ -790,7 +792,7 @@

      Example

      Sets foreground color to yellow

      - Source + Source

      @@ -799,7 +801,7 @@

      Example

      Sets background color to yellow

      - Source + Source
      diff --git a/docs/stable/IO.html b/docs/stable/IO.html index f40555f00..23dc12d35 100644 --- a/docs/stable/IO.html +++ b/docs/stable/IO.html @@ -50,7 +50,7 @@

      - Source + Source @@ -140,7 +140,7 @@

      Functions

      Check read/2 for more information.

      - Source + Source

      @@ -152,7 +152,7 @@

      Functions

      Check readline/1 for more information.

      - Source + Source

      @@ -164,7 +164,7 @@

      Functions

      Check write/2 for more information.

      - Source + Source

      @@ -184,7 +184,7 @@

      Functions

      - Source + Source

      @@ -196,7 +196,7 @@

      Functions

      Otherwise, the number of raw bytes.

      - Source + Source

      @@ -214,7 +214,7 @@

      Functions

      - Source + Source

      @@ -229,7 +229,7 @@

      Examples

      - Source + Source

      @@ -238,7 +238,7 @@

      Examples

      Inspects the item with options using the given device.

      - Source + Source

      @@ -249,7 +249,7 @@

      Examples

      to be a chardata.

      - Source + Source

      @@ -266,7 +266,7 @@

      Examples

      - Source + Source

      @@ -286,7 +286,7 @@

      Examples

      except the prompt is not required as argument.

      - Source + Source

      @@ -309,7 +309,7 @@

      Examples

      - Source + Source diff --git a/docs/stable/Kernel.CLI.html b/docs/stable/Kernel.CLI.html index a23c8ce84..fb26b8f9d 100644 --- a/docs/stable/Kernel.CLI.html +++ b/docs/stable/Kernel.CLI.html @@ -32,7 +32,7 @@

      - Source + Source @@ -69,7 +69,7 @@

      Functions

      by escripts generated by Elixir.

      - Source + Source diff --git a/docs/stable/Kernel.ParallelCompiler.html b/docs/stable/Kernel.ParallelCompiler.html index 6622625f6..c2ecc43d0 100644 --- a/docs/stable/Kernel.ParallelCompiler.html +++ b/docs/stable/Kernel.ParallelCompiler.html @@ -32,7 +32,7 @@

      - Source + Source @@ -77,7 +77,7 @@

      Functions

      with its name can be optionally given as argument.

      - Source + Source

      @@ -87,7 +87,7 @@

      Functions

      Read files/2 for more information.

      - Source + Source diff --git a/docs/stable/Kernel.ParallelRequire.html b/docs/stable/Kernel.ParallelRequire.html index ff849770b..4ddaca4a0 100644 --- a/docs/stable/Kernel.ParallelRequire.html +++ b/docs/stable/Kernel.ParallelRequire.html @@ -32,7 +32,7 @@

      - Source + Source @@ -67,7 +67,7 @@

      Functions

      can be optionally given as argument.

      - Source + Source diff --git a/docs/stable/Kernel.SpecialForms.html b/docs/stable/Kernel.SpecialForms.html index 4d91c5de8..c2670322b 100644 --- a/docs/stable/Kernel.SpecialForms.html +++ b/docs/stable/Kernel.SpecialForms.html @@ -48,7 +48,7 @@

      - Source + Source @@ -316,7 +316,7 @@

      Bitstring types

      to binary32 and binary64, respectively.

      - Source + Source

      @@ -331,7 +331,7 @@

      Examples

      - Source + Source

      @@ -340,7 +340,7 @@

      Examples

      Returns the current directory as a binary.

      - Source + Source

      @@ -351,7 +351,7 @@

      Examples

      line numbers, set up aliases, the current function and others.

      - Source + Source

      @@ -362,7 +362,7 @@

      Examples

      is a convenient shortcut.

      - Source + Source

      @@ -373,7 +373,7 @@

      Examples

      is a convenient shortcut.

      - Source + Source

      @@ -418,7 +418,7 @@

      Examples

      - Source + Source

      @@ -433,7 +433,7 @@

      Examples

      - Source + Source

      @@ -451,7 +451,7 @@

      Examples

      Check quote/1 for more information.

      - Source + Source

      @@ -497,7 +497,7 @@

      Lexical scope

      specific functions and it won't affect the overall scope.

      - Source + Source

      @@ -508,7 +508,7 @@

      Lexical scope

      the macro is expanded.

      - Source + Source

      @@ -524,7 +524,7 @@

      Lexical scope

      - Source + Source

      @@ -625,7 +625,7 @@

      Ambiguous function/macro names

      errors are emitted lazily, not eagerly.

      - Source + Source

      @@ -675,7 +675,7 @@

      Ambiguous function/macro names

      - Source + Source

      @@ -758,7 +758,10 @@

      Hygiene and context

      Notice how the third element of the returned tuple is the module name. This means that the variable is associated to the ContextSample module and only code generated by this module -will be able to access that particular world variable.

      +will be able to access that particular world variable. +While this means macros from the same module could have +conflicting variables, it also allows different quotes from +the same module to access them.

      The context can be disabled or changed by explicitly setting the context option. All hygiene mechanisms are based on such @@ -973,7 +976,7 @@

      Stacktrace information

      the quote will always point to GenServer.Behaviour file.

      - Source + Source

      @@ -1006,7 +1009,7 @@

      Alias shortcut

      up an alias. Please check alias for more information.

      - Source + Source

      @@ -1037,7 +1040,7 @@

      Examples

      - Source + Source

      @@ -1054,7 +1057,7 @@

      Examples

      - Source + Source

      @@ -1067,7 +1070,7 @@

      Examples

      Check quote/2 for more information.

      - Source + Source

      @@ -1077,7 +1080,7 @@

      Examples

      Check quote/2 for more information.

      - Source + Source

      @@ -1092,7 +1095,7 @@

      Examples

      - Source + Source diff --git a/docs/stable/Kernel.Typespec.html b/docs/stable/Kernel.Typespec.html index 4be9c6f79..6b3fec7e7 100644 --- a/docs/stable/Kernel.Typespec.html +++ b/docs/stable/Kernel.Typespec.html @@ -119,7 +119,7 @@

      Notes

      - Source + Source @@ -237,7 +237,7 @@

      Functions

      on the file system.

      - Source + Source

      @@ -252,7 +252,7 @@

      Functions

      on the file system.

      - Source + Source

      @@ -267,7 +267,7 @@

      Functions

      on the file system.

      - Source + Source

      @@ -276,7 +276,7 @@

      Functions

      Defines a callback by receiving Erlang's typespec.

      - Source + Source

      @@ -285,7 +285,7 @@

      Functions

      Defines a spec by receiving Erlang's typespec.

      - Source + Source

      @@ -294,7 +294,7 @@

      Functions

      Defines a type, typep or opaque by receiving Erlang's typespec.

      - Source + Source

      @@ -304,7 +304,7 @@

      Functions

      This function is only available for modules being compiled.

      - Source + Source

      @@ -314,7 +314,7 @@

      Functions

      This function is only available for modules being compiled.

      - Source + Source

      @@ -325,7 +325,7 @@

      Functions

      for modules being compiled.

      - Source + Source

      @@ -334,7 +334,7 @@

      Functions

      Converts a spec clause back to Elixir AST.

      - Source + Source

      @@ -343,7 +343,7 @@

      Functions

      Converts a type clause back to Elixir AST.

      - Source + Source
      @@ -365,7 +365,7 @@

      Examples

      - Source + Source

      @@ -380,7 +380,7 @@

      Examples

      - Source + Source

      @@ -395,7 +395,7 @@

      Examples

      - Source + Source

      @@ -410,7 +410,7 @@

      Examples

      - Source + Source

      @@ -425,7 +425,7 @@

      Examples

      - Source + Source diff --git a/docs/stable/Kernel.html b/docs/stable/Kernel.html index 8cbd8e0ec..0be9e10b6 100644 --- a/docs/stable/Kernel.html +++ b/docs/stable/Kernel.html @@ -47,7 +47,7 @@

      - Source + Source @@ -904,7 +904,7 @@

      Examples

      - Source + Source

      @@ -923,7 +923,7 @@

      Examples

      - Source + Source

      @@ -938,7 +938,7 @@

      Examples

      - Source + Source

      @@ -965,7 +965,7 @@

      Examples

      - Source + Source

      @@ -983,7 +983,7 @@

      Examples

      - Source + Source

      @@ -992,7 +992,7 @@

      Examples

      Works like binary_to_atom/2, but the atom must already exist.

      - Source + Source

      @@ -1007,7 +1007,7 @@

      Examples

      - Source + Source

      @@ -1022,7 +1022,7 @@

      Examples

      - Source + Source

      @@ -1038,7 +1038,7 @@

      Examples

      - Source + Source

      @@ -1047,7 +1047,7 @@

      Examples

      Returns a list of integers which correspond to the bytes of binary.

      - Source + Source

      @@ -1058,7 +1058,7 @@

      Examples

      are numbered starting from 1.

      - Source + Source

      @@ -1075,7 +1075,7 @@

      Examples

      - Source + Source

      @@ -1101,7 +1101,7 @@

      Examples

      - Source + Source

      @@ -1120,7 +1120,7 @@

      Examples

      - Source + Source

      @@ -1131,7 +1131,7 @@

      Examples

      be a bitstring containing the remaining bits (1 up to 7 bits).

      - Source + Source

      @@ -1152,7 +1152,7 @@

      Examples

      - Source + Source

      @@ -1169,7 +1169,7 @@

      Examples

      - Source + Source

      @@ -1178,7 +1178,7 @@

      Examples

      Converts the given number to a float. Allowed in guard clauses.

      - Source + Source

      @@ -1194,7 +1194,7 @@

      Examples

      - Source + Source

      @@ -1217,7 +1217,7 @@

      Examples

      - Source + Source

      @@ -1232,7 +1232,7 @@

      Examples

      - Source + Source

      @@ -1255,7 +1255,7 @@

      Examples

      - Source + Source

      @@ -1272,7 +1272,7 @@

      Examples

      information.

      - Source + Source

      @@ -1281,7 +1281,7 @@

      Examples

      Returns the head of a list, raises badarg if the list is empty.

      - Source + Source

      @@ -1297,7 +1297,7 @@

      Examples

      - Source + Source

      @@ -1313,7 +1313,7 @@

      Examples

      - Source + Source

      @@ -1328,7 +1328,7 @@

      Examples

      - Source + Source

      @@ -1344,7 +1344,7 @@

      Examples

      - Source + Source

      @@ -1359,7 +1359,7 @@

      Examples

      - Source + Source

      @@ -1377,7 +1377,7 @@

      Examples

      - Source + Source

      @@ -1387,7 +1387,7 @@

      Examples

      if the node can be part of a distributed system.

      - Source + Source

      @@ -1398,7 +1398,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1411,7 +1411,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1422,7 +1422,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1434,7 +1434,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1445,7 +1445,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1456,7 +1456,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1468,7 +1468,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1479,7 +1479,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1490,7 +1490,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1502,7 +1502,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1513,7 +1513,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1524,7 +1524,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1535,7 +1535,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1546,7 +1546,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1563,7 +1563,7 @@

      Examples

      - Source + Source

      @@ -1578,7 +1578,7 @@

      Examples

      - Source + Source

      @@ -1593,7 +1593,7 @@

      Examples

      - Source + Source

      @@ -1612,7 +1612,7 @@

      Examples

      - Source + Source

      @@ -1622,7 +1622,7 @@

      Examples

      exists such atom.

      - Source + Source

      @@ -1637,7 +1637,7 @@

      Examples

      - Source + Source

      @@ -1652,7 +1652,7 @@

      Examples

      - Source + Source

      @@ -1667,7 +1667,7 @@

      Examples

      - Source + Source

      @@ -1688,7 +1688,7 @@

      Examples

      - Source + Source

      @@ -1703,7 +1703,7 @@

      Examples

      - Source + Source

      @@ -1717,7 +1717,7 @@

      Examples

      information.

      - Source + Source

      @@ -1734,7 +1734,7 @@

      Examples

      - Source + Source

      @@ -1751,7 +1751,7 @@

      Examples

      - Source + Source

      @@ -1768,7 +1768,7 @@

      Examples

      - Source + Source

      @@ -1780,7 +1780,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1793,7 +1793,7 @@

      Examples

      Allowed in guard tests.

      - Source + Source

      @@ -1811,7 +1811,7 @@

      Warning:

      It should not be used in application programs.

      - Source + Source

      @@ -1838,7 +1838,7 @@

      Examples

      - Source + Source

      @@ -1861,7 +1861,7 @@

      Examples

      - Source + Source

      @@ -1890,7 +1890,7 @@

      Examples

      may change the System.stacktrace value.

      - Source + Source

      @@ -1906,7 +1906,7 @@

      Examples

      - Source + Source

      @@ -1916,7 +1916,7 @@

      Examples

      Allowed in guard clauses.

      - Source + Source

      @@ -1926,7 +1926,7 @@

      Examples

      or a binary. If possible, please use tuple_size or binary_size.

      - Source + Source

      @@ -1948,7 +1948,7 @@

      Examples

      - Source + Source

      @@ -1966,7 +1966,7 @@

      Examples

      - Source + Source

      @@ -1988,7 +1988,7 @@

      Examples

      - Source + Source

      @@ -2006,7 +2006,7 @@

      Examples

      - Source + Source

      @@ -2020,7 +2020,7 @@

      Examples

      of communications channel not supported by distributed :

      - Source + Source

      @@ -2036,7 +2036,7 @@

      Examples

      - Source + Source

      @@ -2045,7 +2045,7 @@

      Examples

      A non-local return from a function. Check try/2 for more information.

      - Source + Source

      @@ -2054,7 +2054,7 @@

      Examples

      Returns the tail of a list. Raises ArgumentError if the list is empty.

      - Source + Source

      @@ -2070,7 +2070,7 @@

      Examples

      - Source + Source

      @@ -2079,7 +2079,7 @@

      Examples

      Returns the size of a tuple.

      - Source + Source

      @@ -2088,7 +2088,7 @@

      Examples

      Converts a tuple to a list.

      - Source + Source
      @@ -2118,7 +2118,7 @@

      Examples

      - Source + Source

      @@ -2140,7 +2140,7 @@

      Examples

      - Source + Source

      @@ -2159,7 +2159,7 @@

      Examples

      - Source + Source

      @@ -2187,7 +2187,7 @@

      Examples

      not only booleans, however it is not allowed in guards.

      - Source + Source

      @@ -2202,7 +2202,7 @@

      Examples

      - Source + Source

      @@ -2217,7 +2217,7 @@

      Examples

      - Source + Source

      @@ -2235,7 +2235,7 @@

      Examples

      - Source + Source

      @@ -2250,7 +2250,7 @@

      Examples

      - Source + Source

      @@ -2269,7 +2269,7 @@

      Examples

      - Source + Source

      @@ -2291,7 +2291,7 @@

      Examples

      - Source + Source

      @@ -2310,7 +2310,7 @@

      Examples

      - Source + Source

      @@ -2326,7 +2326,7 @@

      Examples

      - Source + Source

      @@ -2343,7 +2343,7 @@

      Examples

      - Source + Source

      @@ -2359,7 +2359,7 @@

      Examples

      - Source + Source

      @@ -2382,7 +2382,7 @@

      Examples

      - Source + Source

      @@ -2405,7 +2405,7 @@

      Examples

      - Source + Source

      @@ -2424,7 +2424,7 @@

      Examples

      - Source + Source

      @@ -2443,7 +2443,7 @@

      Examples

      - Source + Source

      @@ -2459,7 +2459,7 @@

      Examples

      - Source + Source

      @@ -2475,7 +2475,7 @@

      Examples

      - Source + Source

      @@ -2525,7 +2525,7 @@

      Examples

      to manipulate module attributes.

      - Source + Source

      @@ -2543,7 +2543,7 @@

      Examples

      - Source + Source

      @@ -2561,7 +2561,7 @@

      Examples

      - Source + Source

      @@ -2577,7 +2577,7 @@

      Examples

      - Source + Source

      @@ -2601,7 +2601,7 @@

      Examples

      - Source + Source

      @@ -2619,7 +2619,7 @@

      Examples

      - Source + Source

      @@ -2637,7 +2637,7 @@

      Examples

      - Source + Source

      @@ -2652,7 +2652,7 @@

      Examples

      - Source + Source

      @@ -2679,7 +2679,7 @@

      Examples

      - Source + Source

      @@ -2748,7 +2748,7 @@

      Atoms

      In this case, "Hello" will be printed twice (one per each field).

      - Source + Source

      @@ -2764,7 +2764,7 @@

      Examples

      - Source + Source

      @@ -2779,7 +2779,7 @@

      Examples

      - Source + Source

      @@ -2794,7 +2794,7 @@

      Examples

      - Source + Source

      @@ -2810,7 +2810,7 @@

      Examples

      - Source + Source

      @@ -2826,7 +2826,7 @@

      Examples

      - Source + Source

      @@ -2845,7 +2845,7 @@

      Examples

      - Source + Source

      @@ -2889,7 +2889,7 @@

      Examples

      The example above will actually fail because 10 does not match 1.

      - Source + Source

      @@ -2912,7 +2912,7 @@

      Examples

      - Source + Source

      @@ -2942,7 +2942,7 @@

      Examples

      two arguments and sum them.

      - Source + Source

      @@ -2981,7 +2981,7 @@

      Examples

      - Source + Source

      @@ -3029,7 +3029,7 @@

      Examples

      - Source + Source

      @@ -3047,7 +3047,7 @@

      Examples

      binary as result;

      - Source + Source

      @@ -3057,7 +3057,7 @@

      Examples

      defprotocol/2 for examples.

      - Source + Source

      @@ -3082,7 +3082,7 @@

      Examples

      - Source + Source

      @@ -3091,7 +3091,7 @@

      Examples

      The same as def/4 but generates a macro.

      - Source + Source

      @@ -3103,7 +3103,7 @@

      Examples

      Check defmacro/2 for more information

      - Source + Source

      @@ -3112,7 +3112,7 @@

      Examples

      The same as def/4 but generates a private macro.

      - Source + Source

      @@ -3162,7 +3162,7 @@

      Dynamic names

      returns an atom.

      - Source + Source

      @@ -3173,7 +3173,7 @@

      Dynamic names

      developer to customize it.

      - Source + Source

      @@ -3199,7 +3199,7 @@

      Examples

      through Foo.sum will raise an error.

      - Source + Source

      @@ -3208,7 +3208,7 @@

      Examples

      The same as def/4 but generates a private function.

      - Source + Source

      @@ -3340,7 +3340,7 @@

      Types

      given protocol are valid argument types for the given function.

      - Source + Source

      @@ -3510,7 +3510,7 @@

      Importing records

      See Record.import/2 and defrecordp/2 documentation for more information

      - Source + Source

      @@ -3560,7 +3560,7 @@

      Examples

      - Source + Source

      @@ -3582,7 +3582,7 @@

      Example

      - Source + Source

      @@ -3622,7 +3622,7 @@

      Examples

      it will raise a CaseClauseError.

      - Source + Source

      @@ -3639,7 +3639,7 @@

      Examples

      - Source + Source

      @@ -3658,7 +3658,7 @@

      Example

      - Source + Source

      @@ -3752,7 +3752,7 @@

      Shortcut syntax

      - Source + Source

      @@ -3768,7 +3768,7 @@

      Examples

      - Source + Source

      @@ -3814,7 +3814,7 @@

      Blocks examples

      macro.

      - Source + Source

      @@ -3861,7 +3861,7 @@

      Clauses

      the variable for us.

      - Source + Source

      @@ -3879,7 +3879,7 @@

      Example

      - Source + Source

      @@ -3892,16 +3892,25 @@

      Options

      The following options are supported:

        -
      • :raw - tuples are not formatted as the inspect protocol, they are -always shown as tuples, defaults to false;

      • -
      • :limit - the limit of items that are shown in tuples, bitstrings and -lists. Does not apply to strings;

      • +
      • raw -- when true, record tuples are not formatted by the inspect protocol, + but are printed as just tuples; default: false

      • +
      • limit -- limits the number of items that are printed for tuples, bitstrings, + and lists; does not apply to strings

      Examples

      iex> inspect(:foo)
       ":foo"
      +
      +iex> inspect [1,2,3,4,5], limit: 3
      +"[1,2,3,...]"
      +
      +inspect(ArgumentError[])
      +#=> "ArgumentError[message: "argument error"]"
      +
      +inspect(ArgumentError[], raw: true)
      +#=> "{ArgumentError,:__exception__,"argument error"}"
       

      Note that the inspect protocol does not necessarily return a valid @@ -3913,7 +3922,7 @@

      Examples

      - Source + Source

      @@ -3930,7 +3939,7 @@

      Examples

      - Source + Source

      @@ -3939,7 +3948,7 @@

      Examples

      Checks if the given argument is a range.

      - Source + Source

      @@ -3948,7 +3957,7 @@

      Examples

      Checks if the given argument is a record.

      - Source + Source

      @@ -3967,7 +3976,7 @@

      Examples

      - Source + Source

      @@ -3976,7 +3985,7 @@

      Examples

      Checks if the given argument is a regex.

      - Source + Source

      @@ -4008,7 +4017,7 @@

      Examples

      - Source + Source

      @@ -4026,7 +4035,7 @@

      Examples

      - Source + Source

      @@ -4042,7 +4051,7 @@

      Examples

      - Source + Source

      @@ -4058,7 +4067,7 @@

      Examples

      - Source + Source

      @@ -4108,7 +4117,7 @@

      Examples

      - Source + Source

      @@ -4125,7 +4134,7 @@

      Examples

      - Source + Source

      @@ -4142,7 +4151,7 @@

      Example

      - Source + Source

      @@ -4158,7 +4167,7 @@

      Examples

      - Source + Source

      @@ -4173,7 +4182,7 @@

      Examples

      - Source + Source

      @@ -4292,7 +4301,7 @@

      Variable visibility

      - Source + Source

      @@ -4312,7 +4321,7 @@

      Examples

      - Source + Source

      @@ -4351,7 +4360,7 @@

      Examples

      - Source + Source

      @@ -4370,7 +4379,7 @@

      Examples

      - Source + Source

      @@ -4411,7 +4420,7 @@

      Examples

      - Source + Source

      @@ -4438,7 +4447,7 @@

      Examples

      not only booleans, however it is not allowed in guards.

      - Source + Source diff --git a/docs/stable/KeyError.html b/docs/stable/KeyError.html index cdf39650d..539551ce3 100644 --- a/docs/stable/KeyError.html +++ b/docs/stable/KeyError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -71,7 +71,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Keyword.html b/docs/stable/Keyword.html index 0be413c57..e62dc7929 100644 --- a/docs/stable/Keyword.html +++ b/docs/stable/Keyword.html @@ -42,7 +42,7 @@

      - Source + Source @@ -185,7 +185,7 @@

      Examples

      - Source + Source

      @@ -203,7 +203,7 @@

      Examples

      - Source + Source

      @@ -219,7 +219,7 @@

      Examples

      - Source + Source

      @@ -238,7 +238,7 @@

      Examples

      - Source + Source

      @@ -251,12 +251,13 @@

      Examples

      iex> Keyword.fetch!([a: 1], :a)
       1
      +
       iex> Keyword.fetch!([a: 1], :b)
       ** (KeyError) key not found: :b
       
      - Source + Source

      @@ -267,7 +268,7 @@

      Examples

      duplicated entries.

      - Source + Source

      @@ -292,7 +293,7 @@

      Examples

      - Source + Source

      @@ -307,7 +308,7 @@

      Examples

      - Source + Source

      @@ -324,7 +325,7 @@

      Examples

      - Source + Source

      @@ -340,7 +341,7 @@

      Examples

      - Source + Source

      @@ -349,7 +350,7 @@

      Examples

      Checks if the given argument is a keywords list or not

      - Source + Source

      @@ -365,7 +366,7 @@

      Examples

      - Source + Source

      @@ -383,7 +384,7 @@

      Examples

      - Source + Source

      @@ -392,7 +393,7 @@

      Examples

      Returns an empty keyword list, i.e. an empty list.

      - Source + Source

      @@ -408,7 +409,7 @@

      Examples

      - Source + Source

      @@ -425,7 +426,7 @@

      Examples

      - Source + Source

      @@ -443,7 +444,7 @@

      Examples

      - Source + Source

      @@ -459,7 +460,7 @@

      Examples

      - Source + Source

      @@ -472,12 +473,13 @@

      Examples

      iex> Keyword.update([a: 1], :a, &1 * 2)
       [a: 2]
      +
       iex> Keyword.update([a: 1], :b, &1 * 2)
       ** (KeyError) key not found: :b
       
      - Source + Source

      @@ -495,7 +497,7 @@

      Examples

      - Source + Source

      @@ -510,7 +512,7 @@

      Examples

      - Source + Source diff --git a/docs/stable/List.Chars.Atom.html b/docs/stable/List.Chars.Atom.html index 7d1c90a0e..cd219675f 100644 --- a/docs/stable/List.Chars.Atom.html +++ b/docs/stable/List.Chars.Atom.html @@ -29,7 +29,7 @@

      - Source + Source @@ -60,7 +60,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/List.Chars.BitString.html b/docs/stable/List.Chars.BitString.html index 83fc230e3..1ba8adbdb 100644 --- a/docs/stable/List.Chars.BitString.html +++ b/docs/stable/List.Chars.BitString.html @@ -29,7 +29,7 @@

      - Source + Source @@ -60,7 +60,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/List.Chars.List.html b/docs/stable/List.Chars.List.html index 5b01a9bfc..47e369349 100644 --- a/docs/stable/List.Chars.List.html +++ b/docs/stable/List.Chars.List.html @@ -29,7 +29,7 @@

      - Source + Source @@ -60,7 +60,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/List.Chars.Number.html b/docs/stable/List.Chars.Number.html index fac2c0f24..6e14e88b6 100644 --- a/docs/stable/List.Chars.Number.html +++ b/docs/stable/List.Chars.Number.html @@ -29,7 +29,7 @@

      - Source + Source @@ -60,7 +60,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/List.Chars.html b/docs/stable/List.Chars.html index 31a898883..98ce7e86d 100644 --- a/docs/stable/List.Chars.html +++ b/docs/stable/List.Chars.html @@ -40,7 +40,7 @@

      - Source + Source

      Implementations

      @@ -100,7 +100,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/List.html b/docs/stable/List.html index 1c8ba6b24..bad89037d 100644 --- a/docs/stable/List.html +++ b/docs/stable/List.html @@ -39,7 +39,7 @@

      - Source + Source @@ -162,7 +162,7 @@

      Examples

      - Source + Source

      @@ -181,7 +181,7 @@

      Examples

      - Source + Source

      @@ -198,7 +198,7 @@

      Examples

      - Source + Source

      @@ -216,7 +216,7 @@

      Examples

      - Source + Source

      @@ -236,7 +236,7 @@

      Examples

      - Source + Source

      @@ -244,7 +244,7 @@

      Examples

      - Source + Source

      @@ -263,7 +263,7 @@

      Examples

      - Source + Source

      @@ -279,7 +279,7 @@

      Examples

      - Source + Source

      @@ -302,7 +302,7 @@

      Examples

      - Source + Source

      @@ -325,7 +325,7 @@

      Examples

      - Source + Source

      @@ -348,7 +348,7 @@

      Examples

      - Source + Source

      @@ -371,7 +371,7 @@

      Examples

      - Source + Source

      @@ -387,7 +387,7 @@

      Examples

      - Source + Source

      @@ -404,7 +404,7 @@

      Examples

      - Source + Source

      @@ -423,7 +423,7 @@

      Examples

      - Source + Source

      @@ -442,7 +442,7 @@

      Examples

      - Source + Source

      @@ -459,7 +459,7 @@

      Examples

      - Source + Source

      @@ -477,7 +477,7 @@

      Examples

      - Source + Source diff --git a/docs/stable/ListDict.html b/docs/stable/ListDict.html index 8f02941d3..7ce779a92 100644 --- a/docs/stable/ListDict.html +++ b/docs/stable/ListDict.html @@ -35,7 +35,7 @@

      - Source + Source @@ -177,7 +177,7 @@

      Functions

      Deletes the entry under the given key from the dict.

      - Source + Source

      @@ -187,7 +187,7 @@

      Functions

      which key is not in keys

      - Source + Source

      @@ -196,7 +196,7 @@

      Functions

      Returns an empty ListDict.

      - Source + Source

      @@ -205,7 +205,7 @@

      Functions

      Check if the ListDict is equal to another ListDict.

      - Source + Source

      @@ -215,7 +215,7 @@

      Functions

      dict in a tagged tuple, otherwise :error.

      - Source + Source

      @@ -225,7 +225,7 @@

      Functions

      raises KeyError if the key does not exist.

      - Source + Source

      @@ -235,7 +235,7 @@

      Functions

      dict or default if no key is set.

      - Source + Source

      @@ -244,7 +244,7 @@

      Functions

      Returns true if the dict has the given key.

      - Source + Source

      @@ -253,7 +253,7 @@

      Functions

      Returns all keys in the dict.

      - Source + Source

      @@ -262,7 +262,7 @@

      Functions

      Merges the given Enumerable into the dict.

      - Source + Source

      @@ -271,7 +271,7 @@

      Functions

      Returns a new ListDict, i.e. an empty list.

      - Source + Source

      @@ -280,7 +280,7 @@

      Functions

      Creates a new ListDict from the given pairs.

      - Source + Source

      @@ -290,7 +290,7 @@

      Functions

      via the given transformation function.

      - Source + Source

      @@ -300,7 +300,7 @@

      Functions

      from the dict as well as the dict without that key.

      - Source + Source

      @@ -309,7 +309,7 @@

      Functions

      Puts the given key-value pair in the dict.

      - Source + Source

      @@ -319,7 +319,7 @@

      Functions

      if no entry exists yet.

      - Source + Source

      @@ -328,7 +328,7 @@

      Functions

      Returns the dict size.

      - Source + Source

      @@ -340,7 +340,7 @@

      Functions

      Returns a 2-tuple of the new dicts.

      - Source + Source

      @@ -350,7 +350,7 @@

      Functions

      which key is in keys

      - Source + Source

      @@ -359,7 +359,7 @@

      Functions

      Converts the dict to a list.

      - Source + Source

      @@ -368,7 +368,7 @@

      Functions

      Updates the key in the dict according to the given function.

      - Source + Source

      @@ -378,7 +378,7 @@

      Functions

      or uses the given initial value if no entry exists.

      - Source + Source

      @@ -387,7 +387,7 @@

      Functions

      Returns all values in the dict.

      - Source + Source
      diff --git a/docs/stable/Macro.Env.html b/docs/stable/Macro.Env.html index c9618860d..274b0ab06 100644 --- a/docs/stable/Macro.Env.html +++ b/docs/stable/Macro.Env.html @@ -50,12 +50,13 @@

    3357. functions - a list of functions imported from each module
    3358. macros - a list of macros imported from each module
    3359. context_modules - a list of modules defined in the current context
    3360. +
    3361. macro_aliases - a list of aliases defined inside the current macro
    3362. - Source + Source @@ -123,6 +124,12 @@

      Fields (and defaults)

    3363. +
    3364. + + macro_aliases: nil + +
    3365. + @@ -168,7 +175,7 @@

      Functions

      inside a guard.

      - Source + Source

      @@ -178,7 +185,7 @@

      Functions

      inside a match clause.

      - Source + Source

      @@ -188,7 +195,7 @@

      Functions

      information as keys.

      - Source + Source

      @@ -197,7 +204,7 @@

      Functions

      Returns the environment stacktrace.

      - Source + Source
      diff --git a/docs/stable/Macro.html b/docs/stable/Macro.html index 17db392d8..f2e5a88c1 100644 --- a/docs/stable/Macro.html +++ b/docs/stable/Macro.html @@ -32,7 +32,7 @@

      - Source + Source @@ -129,7 +129,7 @@

      Examples

      - Source + Source

      @@ -231,7 +231,7 @@

      Examples

      - Source + Source

      @@ -254,7 +254,7 @@

      Examples

      - Source + Source

      @@ -266,7 +266,7 @@

      Examples

      which is returned as { :unsafe, term }.

      - Source + Source

      @@ -281,7 +281,7 @@

      Examples

      - Source + Source

      @@ -309,7 +309,7 @@

      Examples

      and we return a version with it unescaped.

      - Source + Source

      @@ -359,7 +359,7 @@

      Examples

      - Source + Source

      @@ -375,7 +375,7 @@

      Examples

      for examples.

      - Source + Source

      @@ -385,7 +385,7 @@

      Examples

      Check unescape_tokens/1 and unescape_binary/2 for more information.

      - Source + Source @@ -402,7 +402,7 @@

      Macros

      as a macro so it can be used in guard clauses.

      - Source + Source

      @@ -412,7 +412,7 @@

      Macros

      as a macro so it can be used in guard clauses.

      - Source + Source diff --git a/docs/stable/MatchError.html b/docs/stable/MatchError.html index 00cfa4749..b224b4a0c 100644 --- a/docs/stable/MatchError.html +++ b/docs/stable/MatchError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -71,7 +71,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Dep.html b/docs/stable/Mix.Dep.html index 41e4dc410..2e1a5e005 100644 --- a/docs/stable/Mix.Dep.html +++ b/docs/stable/Mix.Dep.html @@ -44,7 +44,7 @@

      - Source + Source diff --git a/docs/stable/Mix.Deps.html b/docs/stable/Mix.Deps.html index f0c04fb5a..f4522fa54 100644 --- a/docs/stable/Mix.Deps.html +++ b/docs/stable/Mix.Deps.html @@ -32,7 +32,7 @@

      - Source + Source @@ -159,7 +159,7 @@

      Exceptions

      provides a dependency in the wrong format.

      - Source + Source

      @@ -169,7 +169,7 @@

      Exceptions

      accumulator.

      - Source + Source

      @@ -178,7 +178,7 @@

      Exceptions

      Check if a dependency is available.

      - Source + Source

      @@ -188,7 +188,7 @@

      Exceptions

      Logs a message if the dependency could not be found.

      - Source + Source

      @@ -197,7 +197,7 @@

      Exceptions

      Checks the lock for the given dependency and update its status accordingly.

      - Source + Source

      @@ -206,7 +206,7 @@

      Exceptions

      Returns all direct child dependencies.

      - Source + Source

      @@ -215,7 +215,7 @@

      Exceptions

      Returns all compile paths for the dependency.

      - Source + Source

      @@ -224,7 +224,7 @@

      Exceptions

      Returns all dependencies depending on given dependencies.

      - Source + Source

      @@ -233,7 +233,7 @@

      Exceptions

      Format the dependency for printing.

      - Source + Source

      @@ -242,7 +242,7 @@

      Exceptions

      Formats the status of a dependency.

      - Source + Source

      @@ -253,7 +253,7 @@

      Exceptions

      project into the project stack.

      - Source + Source

      @@ -262,7 +262,7 @@

      Exceptions

      Check if a dependency is part of an umbrella project as a top level project.

      - Source + Source

      @@ -271,7 +271,7 @@

      Exceptions

      Returns all load paths for the dependency.

      - Source + Source

      @@ -280,7 +280,7 @@

      Exceptions

      Returns true if dependency is a make project.

      - Source + Source

      @@ -289,7 +289,7 @@

      Exceptions

      Returns true if dependency is a mix project.

      - Source + Source

      @@ -298,7 +298,7 @@

      Exceptions

      Check if a dependency is ok.

      - Source + Source

      @@ -309,7 +309,7 @@

      Exceptions

      invoking this function.

      - Source + Source

      @@ -318,7 +318,7 @@

      Exceptions

      Returns true if dependency is a rebar project.

      - Source + Source

      @@ -327,7 +327,7 @@

      Exceptions

      Updates the dependency inside the given project.

      - Source + Source
      diff --git a/docs/stable/Mix.Error.html b/docs/stable/Mix.Error.html index 04a24e70f..6a0432a40 100644 --- a/docs/stable/Mix.Error.html +++ b/docs/stable/Mix.Error.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/stable/Mix.Generator.html b/docs/stable/Mix.Generator.html index b3b41d818..870ff6e49 100644 --- a/docs/stable/Mix.Generator.html +++ b/docs/stable/Mix.Generator.html @@ -32,7 +32,7 @@

      - Source + Source @@ -89,7 +89,7 @@

      Functions

      Creates a directory if one does not exist yet.

      - Source + Source

      @@ -99,7 +99,7 @@

      Functions

      If the file already exists, asks for user confirmation.

      - Source + Source @@ -124,7 +124,7 @@

      Macros

      For more information, check EEx.SmartEngine.

      - Source + Source

      @@ -136,7 +136,7 @@

      Macros

      _text that expects no argument.

      - Source + Source

      @@ -150,7 +150,7 @@

      Macros

      - Source + Source diff --git a/docs/stable/Mix.InvalidTaskError.html b/docs/stable/Mix.InvalidTaskError.html index 016477ca1..f0752eddb 100644 --- a/docs/stable/Mix.InvalidTaskError.html +++ b/docs/stable/Mix.InvalidTaskError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -77,7 +77,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Local.html b/docs/stable/Mix.Local.html index 89ac247a4..47d47e437 100644 --- a/docs/stable/Mix.Local.html +++ b/docs/stable/Mix.Local.html @@ -32,7 +32,7 @@

      - Source + Source @@ -79,7 +79,7 @@

      Functions

      Returns all tasks modules in .mix/tasks.

      - Source + Source

      @@ -88,7 +88,7 @@

      Functions

      Append mix paths into Erlang code path.

      - Source + Source

      @@ -97,7 +97,7 @@

      Functions

      Append local tasks path into Erlang code path.

      - Source + Source

      @@ -106,7 +106,7 @@

      Functions

      The path for local tasks.

      - Source + Source
      diff --git a/docs/stable/Mix.NoProjectError.html b/docs/stable/Mix.NoProjectError.html index 34bf17bbe..cc6664680 100644 --- a/docs/stable/Mix.NoProjectError.html +++ b/docs/stable/Mix.NoProjectError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/stable/Mix.NoTaskError.html b/docs/stable/Mix.NoTaskError.html index ce8ccae87..13026bd55 100644 --- a/docs/stable/Mix.NoTaskError.html +++ b/docs/stable/Mix.NoTaskError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -77,7 +77,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.OutOfDateDepsError.html b/docs/stable/Mix.OutOfDateDepsError.html index 7cc86e8cd..5339ec867 100644 --- a/docs/stable/Mix.OutOfDateDepsError.html +++ b/docs/stable/Mix.OutOfDateDepsError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -77,7 +77,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Project.html b/docs/stable/Mix.Project.html index 940a01bab..d0166d8ea 100644 --- a/docs/stable/Mix.Project.html +++ b/docs/stable/Mix.Project.html @@ -61,7 +61,7 @@

      Examples

      - Source + Source @@ -143,7 +143,7 @@

      Functions

      Returns the path to the apps directory.

      - Source + Source

      @@ -152,7 +152,7 @@

      Functions

      Returns the paths this project compiles to.

      - Source + Source

      @@ -162,7 +162,7 @@

      Functions

      considering the current environment.

      - Source + Source

      @@ -171,7 +171,7 @@

      Functions

      Returns a list of project config files (mix.exs and mix.lock).

      - Source + Source

      @@ -188,7 +188,7 @@

      Functions

      Returns nil if no project.

      - Source + Source

      @@ -197,7 +197,7 @@

      Functions

      Same as get/0 but raises an exception if no project.

      - Source + Source

      @@ -208,7 +208,7 @@

      Functions

      into the project stack.

      - Source + Source

      @@ -217,7 +217,7 @@

      Functions

      Returns all load paths for this project.

      - Source + Source

      @@ -231,7 +231,7 @@

      Functions

      if it is an umbrella project or not.

      - Source + Source

      @@ -241,7 +241,7 @@

      Functions

      when the environment changes during a task.

      - Source + Source

      @@ -250,7 +250,7 @@

      Functions

      Returns true if project is an umbrella project.

      - Source + Source
      diff --git a/docs/stable/Mix.SCM.html b/docs/stable/Mix.SCM.html index 0dac3796d..6e6711c6b 100644 --- a/docs/stable/Mix.SCM.html +++ b/docs/stable/Mix.SCM.html @@ -35,7 +35,7 @@

      - Source + Source @@ -75,7 +75,7 @@

      Callbacks summary

    3366. - equals?/2 + equal?/2
    3367. @@ -127,7 +127,7 @@

      Functions

      Returns all available SCM.

      - Source + Source

      @@ -136,7 +136,7 @@

      Functions

      Register the scm repository with the given key and mod.

      - Source + Source

      @@ -145,7 +145,7 @@

      Functions

      Register builtin SCMs.

      - Source + Source
      @@ -163,18 +163,18 @@

      Callbacks

      This behavior function should clean the given dependency.

      - Source + Source
      -

      - equals?(opts1 :: opts(), opts2 :: opts()) +

      + equal?(opts1 :: opts(), opts2 :: opts())

      Receives two options and must return true if the refer to the same repository. The options are guaranteed to belong to the same SCM.

      - Source + Source

      @@ -186,7 +186,7 @@

      Callbacks

      return true.

      - Source + Source

      @@ -202,7 +202,7 @@

      Callbacks

      It must return the current lock.

      - Source + Source

      @@ -216,7 +216,7 @@

      Callbacks

      to the latest version.

      - Source + Source

      @@ -226,7 +226,7 @@

      Callbacks

      dependency is available.

      - Source + Source

      @@ -246,7 +246,7 @@

      Callbacks

      while other SCMs would simply return nil.

      - Source + Source

      @@ -256,7 +256,7 @@

      Callbacks

      lock information for printing.

      - Source + Source

      @@ -266,7 +266,7 @@

      Callbacks

      information for printing.

      - Source + Source diff --git a/docs/stable/Mix.Shell.IO.html b/docs/stable/Mix.Shell.IO.html index 1814f48f4..9b512b63f 100644 --- a/docs/stable/Mix.Shell.IO.html +++ b/docs/stable/Mix.Shell.IO.html @@ -33,7 +33,7 @@

      - Source + Source @@ -86,7 +86,7 @@

      Functions

      to stdout as it comes.

      - Source + Source

      @@ -95,7 +95,7 @@

      Functions

      Writes an error message to the shell followed by new line.

      - Source + Source

      @@ -104,7 +104,7 @@

      Functions

      Writes a message to the shell followed by new line.

      - Source + Source

      @@ -112,7 +112,7 @@

      Functions

      - Source + Source

      @@ -123,7 +123,7 @@

      Functions

      regex %r/^Y(es)?$/i.

      - Source + Source diff --git a/docs/stable/Mix.Shell.Process.html b/docs/stable/Mix.Shell.Process.html index 833f01f3c..40f84b679 100644 --- a/docs/stable/Mix.Shell.Process.html +++ b/docs/stable/Mix.Shell.Process.html @@ -45,7 +45,7 @@

      - Source + Source @@ -103,7 +103,7 @@

      Functions

      the current process.

      - Source + Source

      @@ -112,7 +112,7 @@

      Functions

      Simply forwards the message to the current process.

      - Source + Source

      @@ -127,7 +127,7 @@

      Examples

      - Source + Source

      @@ -136,7 +136,7 @@

      Examples

      Simply forwards the message to the current process.

      - Source + Source

      @@ -144,7 +144,7 @@

      Examples

      - Source + Source

      @@ -160,7 +160,7 @@

      Examples

      process input given. Value must be true or false.

      - Source + Source diff --git a/docs/stable/Mix.Shell.html b/docs/stable/Mix.Shell.html index abe8b4db8..9c9bf7f41 100644 --- a/docs/stable/Mix.Shell.html +++ b/docs/stable/Mix.Shell.html @@ -34,7 +34,7 @@

      - Source + Source @@ -97,7 +97,7 @@

      Functions

      is shared accross different shells.

      - Source + Source

      @@ -106,7 +106,7 @@

      Functions

      Returns if we should output application name to shell.

      - Source + Source
      @@ -125,7 +125,7 @@

      Callbacks

      its exit status.

      - Source + Source

      @@ -134,7 +134,7 @@

      Callbacks

      Asks the user for confirmation.

      - Source + Source

      @@ -143,7 +143,7 @@

      Callbacks

      Warns about the given error message.

      - Source + Source

      @@ -152,7 +152,7 @@

      Callbacks

      Informs the given message.

      - Source + Source
      diff --git a/docs/stable/Mix.Task.html b/docs/stable/Mix.Task.html index 43bb6e93c..d28e8091b 100644 --- a/docs/stable/Mix.Task.html +++ b/docs/stable/Mix.Task.html @@ -34,7 +34,7 @@

      - Source + Source @@ -127,7 +127,7 @@

      Functions

      won't show up. Check load_all/0 if you want to preload all tasks.

      - Source + Source

      @@ -137,7 +137,7 @@

      Functions

      Returns an ordset with all the tasks invoked thus far.

      - Source + Source

      @@ -153,7 +153,7 @@

      Exceptions

      - Source + Source

      @@ -162,7 +162,7 @@

      Exceptions

      Checks if the task is hidden or not. Returns a boolean.

      - Source + Source

      @@ -171,7 +171,7 @@

      Exceptions

      Loads all tasks in all code paths.

      - Source + Source

      @@ -181,7 +181,7 @@

      Exceptions

      Returns the moduledoc or nil.

      - Source + Source

      @@ -190,7 +190,7 @@

      Exceptions

      Checks if the task is defined for umbrella projects.

      - Source + Source

      @@ -200,7 +200,7 @@

      Exceptions

      an umbrella project reenables a task it is reenabled for all sub projects.

      - Source + Source

      @@ -217,7 +217,7 @@

      Exceptions

      or it is invalid. Check get/2 for more information.

      - Source + Source

      @@ -227,7 +227,7 @@

      Exceptions

      Returns the shortdoc or nil.

      - Source + Source

      @@ -236,7 +236,7 @@

      Exceptions

      Returns the task name for the given module.

      - Source + Source
      @@ -249,13 +249,13 @@

      Exceptions

      Callbacks

      - run(list(binary())) + run([binary()])

      A task needs to implement run which receives a list of command line args.

      - Source + Source
      diff --git a/docs/stable/Mix.Tasks.App.Start.html b/docs/stable/Mix.Tasks.App.Start.html index 0c29ecda9..1441c7203 100644 --- a/docs/stable/Mix.Tasks.App.Start.html +++ b/docs/stable/Mix.Tasks.App.Start.html @@ -40,7 +40,7 @@

      Command line options

      - Source + Source @@ -71,7 +71,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Tasks.Clean.html b/docs/stable/Mix.Tasks.Clean.html index 9ec3890cd..711aaf4fa 100644 --- a/docs/stable/Mix.Tasks.Clean.html +++ b/docs/stable/Mix.Tasks.Clean.html @@ -38,7 +38,7 @@

      Command line options

      - Source + Source @@ -69,7 +69,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Tasks.Compile.App.html b/docs/stable/Mix.Tasks.Compile.App.html index 715c31577..b17d54f7b 100644 --- a/docs/stable/Mix.Tasks.Compile.App.html +++ b/docs/stable/Mix.Tasks.Compile.App.html @@ -56,7 +56,7 @@

      Configuration

      - Source + Source @@ -87,7 +87,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Tasks.Compile.Elixir.html b/docs/stable/Mix.Tasks.Compile.Elixir.html index 197840526..fcfbb4b77 100644 --- a/docs/stable/Mix.Tasks.Compile.Elixir.html +++ b/docs/stable/Mix.Tasks.Compile.Elixir.html @@ -82,7 +82,7 @@

      Configuration

      - Source + Source @@ -113,7 +113,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Tasks.Compile.Erlang.html b/docs/stable/Mix.Tasks.Compile.Erlang.html index 0e2a8b450..9ce60ff3a 100644 --- a/docs/stable/Mix.Tasks.Compile.Erlang.html +++ b/docs/stable/Mix.Tasks.Compile.Erlang.html @@ -72,7 +72,7 @@

      Configuration

      - Source + Source @@ -123,7 +123,7 @@

      Functions

      extension.

      - Source + Source

      @@ -132,7 +132,7 @@

      Functions

      Interprets compilation results and prints them to the console.

      - Source + Source

      @@ -140,7 +140,7 @@

      Functions

      - Source + Source

      @@ -150,7 +150,7 @@

      Functions

      Erlang compilation tools.

      - Source + Source diff --git a/docs/stable/Mix.Tasks.Compile.Leex.html b/docs/stable/Mix.Tasks.Compile.Leex.html index 98fc614d2..56124d783 100644 --- a/docs/stable/Mix.Tasks.Compile.Leex.html +++ b/docs/stable/Mix.Tasks.Compile.Leex.html @@ -56,7 +56,7 @@

      Configuration

      - Source + Source @@ -87,7 +87,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Tasks.Compile.Yecc.html b/docs/stable/Mix.Tasks.Compile.Yecc.html index d1f6bde6f..1e0022226 100644 --- a/docs/stable/Mix.Tasks.Compile.Yecc.html +++ b/docs/stable/Mix.Tasks.Compile.Yecc.html @@ -56,7 +56,7 @@

      Configuration

      - Source + Source @@ -87,7 +87,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Tasks.Compile.html b/docs/stable/Mix.Tasks.Compile.html index ee3975dce..0b2d03d04 100644 --- a/docs/stable/Mix.Tasks.Compile.html +++ b/docs/stable/Mix.Tasks.Compile.html @@ -66,7 +66,7 @@

      Common configuration

      - Source + Source @@ -97,7 +97,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Tasks.Deps.Check.html b/docs/stable/Mix.Tasks.Deps.Check.html index 384f55d29..06597528d 100644 --- a/docs/stable/Mix.Tasks.Deps.Check.html +++ b/docs/stable/Mix.Tasks.Deps.Check.html @@ -36,7 +36,7 @@

      - Source + Source @@ -67,7 +67,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Tasks.Deps.Clean.html b/docs/stable/Mix.Tasks.Deps.Clean.html index abde4363c..e4ababde8 100644 --- a/docs/stable/Mix.Tasks.Deps.Clean.html +++ b/docs/stable/Mix.Tasks.Deps.Clean.html @@ -36,7 +36,7 @@

      - Source + Source @@ -67,7 +67,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Tasks.Deps.Compile.html b/docs/stable/Mix.Tasks.Deps.Compile.html index b843509f0..1271f2f15 100644 --- a/docs/stable/Mix.Tasks.Deps.Compile.html +++ b/docs/stable/Mix.Tasks.Deps.Compile.html @@ -50,7 +50,7 @@

      - Source + Source @@ -81,7 +81,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Tasks.Deps.Get.html b/docs/stable/Mix.Tasks.Deps.Get.html index bbfe25d8b..2029f61e8 100644 --- a/docs/stable/Mix.Tasks.Deps.Get.html +++ b/docs/stable/Mix.Tasks.Deps.Get.html @@ -40,7 +40,7 @@

      Command line options

      - Source + Source @@ -71,7 +71,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Tasks.Deps.Loadpaths.html b/docs/stable/Mix.Tasks.Deps.Loadpaths.html index dd0a2e92f..acf7acb87 100644 --- a/docs/stable/Mix.Tasks.Deps.Loadpaths.html +++ b/docs/stable/Mix.Tasks.Deps.Loadpaths.html @@ -33,7 +33,7 @@

      - Source + Source @@ -64,7 +64,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Tasks.Deps.Unlock.html b/docs/stable/Mix.Tasks.Deps.Unlock.html index cc536ad46..2068ff470 100644 --- a/docs/stable/Mix.Tasks.Deps.Unlock.html +++ b/docs/stable/Mix.Tasks.Deps.Unlock.html @@ -33,7 +33,7 @@

      - Source + Source @@ -64,7 +64,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Tasks.Deps.Update.html b/docs/stable/Mix.Tasks.Deps.Update.html index 45a245eb7..7b6e8709d 100644 --- a/docs/stable/Mix.Tasks.Deps.Update.html +++ b/docs/stable/Mix.Tasks.Deps.Update.html @@ -42,7 +42,7 @@

      Command line options

      - Source + Source @@ -73,7 +73,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Tasks.Deps.html b/docs/stable/Mix.Tasks.Deps.html index 5524a94a1..db47befb4 100644 --- a/docs/stable/Mix.Tasks.Deps.html +++ b/docs/stable/Mix.Tasks.Deps.html @@ -39,7 +39,7 @@

      - Source + Source @@ -70,7 +70,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Tasks.Do.html b/docs/stable/Mix.Tasks.Do.html index 0c1ac0f7b..7df2c7fff 100644 --- a/docs/stable/Mix.Tasks.Do.html +++ b/docs/stable/Mix.Tasks.Do.html @@ -40,7 +40,7 @@

      Examples

      - Source + Source @@ -71,7 +71,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Tasks.Escriptize.html b/docs/stable/Mix.Tasks.Escriptize.html index bfb30e163..4b953bc4c 100644 --- a/docs/stable/Mix.Tasks.Escriptize.html +++ b/docs/stable/Mix.Tasks.Escriptize.html @@ -63,7 +63,7 @@

      Configuration

      - Source + Source @@ -94,7 +94,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Tasks.Help.html b/docs/stable/Mix.Tasks.Help.html index 978e0a427..81afe6f4c 100644 --- a/docs/stable/Mix.Tasks.Help.html +++ b/docs/stable/Mix.Tasks.Help.html @@ -40,7 +40,7 @@

      Arguments

      - Source + Source @@ -71,7 +71,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Tasks.Loadpaths.html b/docs/stable/Mix.Tasks.Loadpaths.html index b5380733a..4d510536f 100644 --- a/docs/stable/Mix.Tasks.Loadpaths.html +++ b/docs/stable/Mix.Tasks.Loadpaths.html @@ -39,7 +39,7 @@

      Configuration

      - Source + Source @@ -70,7 +70,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Tasks.Local.Install.html b/docs/stable/Mix.Tasks.Local.Install.html index 0896882cb..ade965f69 100644 --- a/docs/stable/Mix.Tasks.Local.Install.html +++ b/docs/stable/Mix.Tasks.Local.Install.html @@ -43,7 +43,7 @@

      - Source + Source @@ -74,7 +74,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Tasks.Local.Rebar.html b/docs/stable/Mix.Tasks.Local.Rebar.html index f34b2b55e..087732872 100644 --- a/docs/stable/Mix.Tasks.Local.Rebar.html +++ b/docs/stable/Mix.Tasks.Local.Rebar.html @@ -36,7 +36,7 @@

      - Source + Source @@ -73,7 +73,7 @@

      Functions

      Return the path to the local copy of rebar. Used when building deps

      - Source + Source

      @@ -81,7 +81,7 @@

      Functions

      - Source + Source
      diff --git a/docs/stable/Mix.Tasks.Local.Uninstall.html b/docs/stable/Mix.Tasks.Local.Uninstall.html index c837a7c02..32c11dea7 100644 --- a/docs/stable/Mix.Tasks.Local.Uninstall.html +++ b/docs/stable/Mix.Tasks.Local.Uninstall.html @@ -35,7 +35,7 @@

      - Source + Source @@ -66,7 +66,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Tasks.Local.html b/docs/stable/Mix.Tasks.Local.html index 0e351a949..0a90bb393 100644 --- a/docs/stable/Mix.Tasks.Local.html +++ b/docs/stable/Mix.Tasks.Local.html @@ -32,7 +32,7 @@

      - Source + Source @@ -63,7 +63,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Tasks.New.html b/docs/stable/Mix.Tasks.New.html index c70450c50..6ef24b5f3 100644 --- a/docs/stable/Mix.Tasks.New.html +++ b/docs/stable/Mix.Tasks.New.html @@ -62,7 +62,7 @@

      Examples

      - Source + Source @@ -93,7 +93,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Tasks.Run.html b/docs/stable/Mix.Tasks.Run.html index f0b65552c..fdbf92396 100644 --- a/docs/stable/Mix.Tasks.Run.html +++ b/docs/stable/Mix.Tasks.Run.html @@ -56,7 +56,7 @@

      Examples

      - Source + Source @@ -87,7 +87,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Tasks.Test.html b/docs/stable/Mix.Tasks.Test.html index 69687d302..b591fe753 100644 --- a/docs/stable/Mix.Tasks.Test.html +++ b/docs/stable/Mix.Tasks.Test.html @@ -65,7 +65,7 @@

      Configuration

      - Source + Source @@ -96,7 +96,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Mix.Utils.html b/docs/stable/Mix.Utils.html index dee7a31dc..ed46b00d5 100644 --- a/docs/stable/Mix.Utils.html +++ b/docs/stable/Mix.Utils.html @@ -43,7 +43,7 @@

      Conversions

      - Source + Source @@ -150,7 +150,7 @@

      Examples

      - Source + Source

      @@ -170,7 +170,7 @@

      Examples

      - Source + Source

      @@ -185,7 +185,7 @@

      Examples

      - Source + Source

      @@ -195,7 +195,7 @@

      Examples

      and concatenating normal lists.

      - Source + Source

      @@ -208,7 +208,7 @@

      Examples

      When looking up directories, files starting with "." are ignored.

      - Source + Source

      @@ -217,7 +217,7 @@

      Examples

      Extract all stale sources compared to the given targets.

      - Source + Source

      @@ -230,7 +230,7 @@

      Examples

      the files removed from the manifest file.

      - Source + Source

      @@ -240,7 +240,7 @@

      Examples

      MIX_HOME environment variable is set.

      - Source + Source

      @@ -252,7 +252,7 @@

      Examples

      use :.

      - Source + Source

      @@ -272,7 +272,7 @@

      Examples

      - Source + Source

      @@ -282,7 +282,7 @@

      Examples

      Used by local.install and local.rebar.

      - Source + Source

      @@ -292,7 +292,7 @@

      Examples

      working directory.

      - Source + Source

      @@ -301,7 +301,7 @@

      Examples

      Gets the source location of a module as a binary.

      - Source + Source

      @@ -311,7 +311,7 @@

      Examples

      compared to the given target.

      - Source + Source

      @@ -337,7 +337,7 @@

      Examples

      - Source + Source diff --git a/docs/stable/Mix.html b/docs/stable/Mix.html index 3298e02f7..47cc98b28 100644 --- a/docs/stable/Mix.html +++ b/docs/stable/Mix.html @@ -40,7 +40,7 @@

      - Source + Source @@ -79,11 +79,6 @@

      Functions summary

      shell/1
    3368. -
    3369. - - stop/1 - -
    3370. @@ -102,7 +97,7 @@

      Functions

      Returns the mix environment.

      - Source + Source

      @@ -112,7 +107,7 @@

      Functions

      per environment is not going to be reloaded.

      - Source + Source

      @@ -122,7 +117,7 @@

      Functions

      one step. Useful when invoking mix from an external tool.

      - Source + Source

      @@ -134,7 +129,7 @@

      Functions

      tasks to work without a need for an underlying project.

      - Source + Source

      @@ -148,7 +143,7 @@

      Functions

      messages to the current process.

      - Source + Source

      @@ -157,15 +152,7 @@

      Functions

      Sets the current shell.

      - Source - -
      -

      - stop(_state) -

      -
      - - Source + Source
      diff --git a/docs/stable/Module.html b/docs/stable/Module.html index ba65c2703..5dea0302b 100644 --- a/docs/stable/Module.html +++ b/docs/stable/Module.html @@ -39,7 +39,7 @@

      - Source + Source @@ -178,7 +178,7 @@

      Examples

      - Source + Source

      @@ -198,7 +198,7 @@

      Examples

      - Source + Source

      @@ -218,7 +218,7 @@

      Examples

      - Source + Source

      @@ -254,7 +254,7 @@

      Differences with defmodule

      shares the same environment.

      - Source + Source

      @@ -273,7 +273,7 @@

      Examples

      - Source + Source

      @@ -293,7 +293,7 @@

      Examples

      - Source + Source

      @@ -310,7 +310,7 @@

      Examples

      - Source + Source

      @@ -329,7 +329,7 @@

      Examples

      - Source + Source

      @@ -346,7 +346,7 @@

      Examples

      - Source + Source

      @@ -381,7 +381,7 @@

      Examples

      - Source + Source

      @@ -404,7 +404,7 @@

      Examples

      - Source + Source

      @@ -415,7 +415,7 @@

      Examples

      developer to customize it.

      - Source + Source

      @@ -425,7 +425,7 @@

      Examples

      and its attributes and functions can be modified.

      - Source + Source

      @@ -434,7 +434,7 @@

      Examples

      Returns true if the given tuple in module is marked as overridable.

      - Source + Source

      @@ -452,7 +452,7 @@

      Examples

      - Source + Source

      @@ -492,7 +492,7 @@

      Examples

      - Source + Source

      @@ -513,7 +513,7 @@

      Examples

      - Source + Source

      @@ -534,7 +534,7 @@

      Examples

      - Source + Source

      @@ -549,7 +549,7 @@

      Examples

      - Source + Source

      @@ -558,7 +558,7 @@

      Examples

      Convert a module name to binary without the Elixir prefix.

      - Source + Source
      diff --git a/docs/stable/Node.html b/docs/stable/Node.html index 10ee09261..8bb1aaccd 100644 --- a/docs/stable/Node.html +++ b/docs/stable/Node.html @@ -32,7 +32,7 @@

      - Source + Source @@ -140,7 +140,7 @@

      Functions

      part of a distributed system. Otherwise, it returns false.

      - Source + Source

      @@ -153,7 +153,7 @@

      Functions

      See http://erlang.org/doc/man/net_kernel.html#connect_node-1 for more info.

      - Source + Source

      @@ -167,7 +167,7 @@

      Functions

      See http://www.erlang.org/doc/man/erlang.html#disconnect_node-1 for more info.

      - Source + Source

      @@ -177,7 +177,7 @@

      Functions

      otherwise :nocookie.

      - Source + Source

      @@ -187,7 +187,7 @@

      Functions

      the local node. Same as list(visible).

      - Source + Source

      @@ -200,7 +200,7 @@

      Functions

      See http://www.erlang.org/doc/man/erlang.html#nodes-1 for more info.

      - Source + Source

      @@ -212,7 +212,7 @@

      Functions

      See http://www.erlang.org/doc/man/erlang.html#monitor_node-2 for more info.

      - Source + Source

      @@ -224,7 +224,7 @@

      Functions

      See http://www.erlang.org/doc/man/erlang.html#monitor_node-3 for more info.

      - Source + Source

      @@ -233,7 +233,7 @@

      Functions

      Returns the current node. It returns the same as the built-in node().

      - Source + Source

      @@ -246,7 +246,7 @@

      Functions

      This function will raise FunctionClauseError if the given node is not alive.

      - Source + Source

      @@ -259,7 +259,7 @@

      Functions

      the list of available options.

      - Source + Source

      @@ -272,7 +272,7 @@

      Functions

      the list of available options.

      - Source + Source

      @@ -286,7 +286,7 @@

      Functions

      the list of available options.

      - Source + Source

      @@ -300,7 +300,7 @@

      Functions

      the list of available options.

      - Source + Source

      @@ -313,7 +313,7 @@

      Functions

      received).

      - Source + Source

      @@ -326,7 +326,7 @@

      Functions

      :noconnection will be received).

      - Source + Source diff --git a/docs/stable/OptionParser.html b/docs/stable/OptionParser.html index 7ca0aa047..df2a1db42 100644 --- a/docs/stable/OptionParser.html +++ b/docs/stable/OptionParser.html @@ -27,7 +27,7 @@

      - Source + Source @@ -123,7 +123,7 @@

      Negation switches

      - Source + Source

      @@ -141,7 +141,7 @@

      Example

      - Source + Source diff --git a/docs/stable/Path.html b/docs/stable/Path.html index 9c7f577e6..1d78855fa 100644 --- a/docs/stable/Path.html +++ b/docs/stable/Path.html @@ -41,7 +41,7 @@

      - Source + Source @@ -171,7 +171,7 @@

      Windows

      - Source + Source

      @@ -193,7 +193,7 @@

      Examples

      - Source + Source

      @@ -215,7 +215,7 @@

      Examples

      - Source + Source

      @@ -236,7 +236,7 @@

      Examples

      - Source + Source

      @@ -253,7 +253,7 @@

      Examples

      - Source + Source

      @@ -269,7 +269,7 @@

      Examples

      - Source + Source

      @@ -297,7 +297,7 @@

      Examples

      - Source + Source

      @@ -314,7 +314,7 @@

      Examples

      - Source + Source

      @@ -334,7 +334,7 @@

      Examples

      - Source + Source

      @@ -349,7 +349,7 @@

      Examples

      - Source + Source

      @@ -373,7 +373,7 @@

      Windows examples

      - Source + Source

      @@ -399,7 +399,7 @@

      Examples

      - Source + Source

      @@ -416,7 +416,7 @@

      Examples

      - Source + Source

      @@ -434,7 +434,7 @@

      Examples

      - Source + Source

      @@ -454,7 +454,7 @@

      Examples

      - Source + Source

      @@ -479,7 +479,7 @@

      Windows examples

      - Source + Source

      @@ -521,7 +521,7 @@

      Examples

      - Source + Source diff --git a/docs/stable/Port.html b/docs/stable/Port.html index bac78d1b4..692618c5a 100644 --- a/docs/stable/Port.html +++ b/docs/stable/Port.html @@ -32,7 +32,7 @@

      - Source + Source @@ -104,7 +104,7 @@

      Functions

      - Source + Source

      @@ -167,7 +167,7 @@

      Functions

      - Source + Source
      diff --git a/docs/stable/Process.html b/docs/stable/Process.html index be6b74670..c9199afbe 100644 --- a/docs/stable/Process.html +++ b/docs/stable/Process.html @@ -37,7 +37,7 @@

      - Source + Source @@ -222,7 +222,7 @@

      Functions

      pid must refer to a process at the local node.

      - Source + Source

      @@ -231,7 +231,7 @@

      Functions

      Deletes all items in the dictionary.

      - Source + Source

      @@ -240,7 +240,7 @@

      Functions

      Deletes the given key from the dictionary.

      - Source + Source

      @@ -253,7 +253,7 @@

      Functions

      See http://www.erlang.org/doc/man/erlang.html#demonitor-2 for more info.

      - Source + Source

      @@ -282,7 +282,7 @@

      Examples

      - Source + Source

      @@ -294,7 +294,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#process_flag-2 for more info.

      - Source + Source

      @@ -307,7 +307,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#process_flag-3 for more info.

      - Source + Source

      @@ -316,7 +316,7 @@

      Examples

      Returns all key-values in the dictionary.

      - Source + Source

      @@ -325,7 +325,7 @@

      Examples

      Returns the value for the given key.

      - Source + Source

      @@ -334,7 +334,7 @@

      Examples

      Returns all keys that have the given value.

      - Source + Source

      @@ -343,7 +343,7 @@

      Examples

      Returns the pid of the group leader for the process which evaluates the function.

      - Source + Source

      @@ -353,7 +353,7 @@

      Examples

      started from a certain shell should have another group leader than :init.

      - Source + Source

      @@ -365,7 +365,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#process_info-1 for more info.

      - Source + Source

      @@ -377,7 +377,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#process_info-2 for more info.

      - Source + Source

      @@ -389,7 +389,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#link-1 for more info.

      - Source + Source

      @@ -405,7 +405,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#processes-0 for more info.

      - Source + Source

      @@ -417,7 +417,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#monitor-2 for more info.

      - Source + Source

      @@ -426,7 +426,7 @@

      Examples

      Stores the given key-value in the process dictionary.

      - Source + Source

      @@ -439,7 +439,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#register-2 for more info.

      - Source + Source

      @@ -448,7 +448,7 @@

      Examples

      Returns a list of names which have been registered using register/2.

      - Source + Source

      @@ -458,7 +458,7 @@

      Examples

      It behaves exactly the same as Kernel.spawn/1.

      - Source + Source

      @@ -470,7 +470,7 @@

      Examples

      check http://www.erlang.org/doc/man/erlang.html#spawn_opt-2

      - Source + Source

      @@ -483,7 +483,7 @@

      Examples

      It behaves exactly the same as the Kernel.spawn/3 function.

      - Source + Source

      @@ -497,7 +497,7 @@

      Examples

      check http://www.erlang.org/doc/man/erlang.html#spawn_opt-4

      - Source + Source

      @@ -508,7 +508,7 @@

      Examples

      process, atomically.

      - Source + Source

      @@ -519,7 +519,7 @@

      Examples

      and the new process, atomically. Otherwise works like spawn/3.

      - Source + Source

      @@ -529,7 +529,7 @@

      Examples

      and reference for a monitor created to the new process.

      - Source + Source

      @@ -540,7 +540,7 @@

      Examples

      reference for the monitor. Otherwise works like spawn/3.

      - Source + Source

      @@ -553,7 +553,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#unlink-1 for more info.

      - Source + Source

      @@ -564,7 +564,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#unregister-1 for more info.

      - Source + Source

      @@ -576,7 +576,7 @@

      Examples

      See http://www.erlang.org/doc/man/erlang.html#whereis-1 for more info.

      - Source + Source diff --git a/docs/stable/Protocol.UndefinedError.html b/docs/stable/Protocol.UndefinedError.html index 2d22d7716..f6c558f53 100644 --- a/docs/stable/Protocol.UndefinedError.html +++ b/docs/stable/Protocol.UndefinedError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -77,7 +77,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/Range.Iterator.Number.html b/docs/stable/Range.Iterator.Number.html index 56f1ea908..9352f45bc 100644 --- a/docs/stable/Range.Iterator.Number.html +++ b/docs/stable/Range.Iterator.Number.html @@ -29,7 +29,7 @@

      - Source + Source @@ -65,7 +65,7 @@

      Functions

      - Source + Source

      @@ -73,7 +73,7 @@

      Functions

      - Source + Source
      diff --git a/docs/stable/Range.Iterator.html b/docs/stable/Range.Iterator.html index 43625f76d..af2ab52b8 100644 --- a/docs/stable/Range.Iterator.html +++ b/docs/stable/Range.Iterator.html @@ -29,7 +29,7 @@

      - Source + Source

      Implementations

      @@ -77,7 +77,7 @@

      Functions

      Count how many items are in the range.

      - Source + Source

      @@ -85,7 +85,7 @@

      Functions

      - Source + Source
      diff --git a/docs/stable/Range.html b/docs/stable/Range.html index f2f533e1e..1f9c03e48 100644 --- a/docs/stable/Range.html +++ b/docs/stable/Range.html @@ -34,7 +34,7 @@

      - Source + Source diff --git a/docs/stable/Record.html b/docs/stable/Record.html index 3e0a70623..d94a836f2 100644 --- a/docs/stable/Record.html +++ b/docs/stable/Record.html @@ -32,7 +32,7 @@

      - Source + Source @@ -109,7 +109,7 @@

      Examples

      - Source + Source

      @@ -127,7 +127,7 @@

      Examples

      - Source + Source

      @@ -139,7 +139,7 @@

      Examples

      for more information and documentation.

      - Source + Source

      @@ -151,7 +151,7 @@

      Examples

      so check it for more information and documentation.

      - Source + Source

      @@ -160,7 +160,7 @@

      Examples

      Defines types and specs for the record.

      - Source + Source

      @@ -175,7 +175,7 @@

      Examples

      - Source + Source @@ -205,7 +205,7 @@

      Example

      end

      - Source + Source diff --git a/docs/stable/Regex.CompileError.html b/docs/stable/Regex.CompileError.html index 16b0810fa..f6a1047dc 100644 --- a/docs/stable/Regex.CompileError.html +++ b/docs/stable/Regex.CompileError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/stable/Regex.html b/docs/stable/Regex.html index 3d93a3181..57cfb49fc 100644 --- a/docs/stable/Regex.html +++ b/docs/stable/Regex.html @@ -77,7 +77,7 @@

      - Source + Source @@ -176,7 +176,7 @@

      Examples

      - Source + Source

      @@ -188,7 +188,7 @@

      Examples

      { :error, reason } otherwise.

      - Source + Source

      @@ -198,7 +198,7 @@

      Examples

      Fails with Regex.CompileError if the regex cannot be compiled.

      - Source + Source

      @@ -213,7 +213,7 @@

      Examples

      - Source + Source

      @@ -232,7 +232,7 @@

      Examples

      - Source + Source

      @@ -249,7 +249,7 @@

      Examples

      - Source + Source

      @@ -264,7 +264,7 @@

      Examples

      - Source + Source

      @@ -273,7 +273,7 @@

      Examples

      Returns the underlying re_pattern in the regular expression.

      - Source + Source

      @@ -302,7 +302,7 @@

      Examples

      - Source + Source

      @@ -321,7 +321,7 @@

      Examples

      - Source + Source

      @@ -343,7 +343,7 @@

      Examples

      - Source + Source

      @@ -358,7 +358,7 @@

      Examples

      - Source + Source

      @@ -368,7 +368,7 @@

      Examples

      If no ammount of parts is given, it defaults to :infinity.

      - Source + Source diff --git a/docs/stable/RuntimeError.html b/docs/stable/RuntimeError.html index 4b4b46e60..c3e2dffd2 100644 --- a/docs/stable/RuntimeError.html +++ b/docs/stable/RuntimeError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/stable/String.html b/docs/stable/String.html index bef1750a0..56e7b85a8 100644 --- a/docs/stable/String.html +++ b/docs/stable/String.html @@ -139,7 +139,7 @@

      Self-synchronization

      - Source + Source @@ -173,6 +173,11 @@

      Functions summary

      duplicate/2 +
    3371. + + ends_with?/2 + +
    3372. first/1 @@ -248,6 +253,11 @@

      Functions summary

      split/3
    3373. +
    3374. + + starts_with?/2 + +
    3375. strip/1 @@ -321,7 +331,7 @@

      Examples

      - Source + Source

      @@ -346,7 +356,7 @@

      Examples

      - Source + Source

      @@ -365,7 +375,7 @@

      Examples

      - Source + Source

      @@ -384,7 +394,7 @@

      Examples

      - Source + Source

      @@ -401,7 +411,27 @@

      Examples

      - Source + Source + +
      +

      + ends_with?(string, suffixes) +

      +

      Returns true if string ends with any of the suffixes given, otherwise +false. suffixes can be either a single suffix or a list of suffixes.

      + +

      Examples

      + +
      iex> String.ends_with? "language", "age"
      +true
      +iex> String.ends_with? "language", ["youth", "age"]
      +true
      +iex> String.ends_with? "language", ["youth", "elixir"]
      +false
      +
      +
      + + Source

      @@ -419,7 +449,7 @@

      Examples

      - Source + Source

      @@ -434,7 +464,7 @@

      Examples

      - Source + Source

      @@ -452,7 +482,7 @@

      Examples

      - Source + Source

      @@ -469,7 +499,7 @@

      Examples

      - Source + Source

      @@ -485,7 +515,7 @@

      Examples

      - Source + Source

      @@ -500,7 +530,7 @@

      Examples

      - Source + Source

      @@ -524,7 +554,7 @@

      Examples

      - Source + Source

      @@ -543,7 +573,7 @@

      Examples

      - Source + Source

      @@ -559,7 +589,7 @@

      Examples

      - Source + Source

      @@ -588,7 +618,7 @@

      Examples

      - Source + Source

      @@ -604,7 +634,7 @@

      Examples

      - Source + Source

      @@ -619,7 +649,7 @@

      Examples

      - Source + Source

      @@ -650,7 +680,7 @@

      Examples

      - Source + Source

      @@ -670,7 +700,7 @@

      Examples

      - Source + Source

      @@ -702,7 +732,27 @@

      Examples

      - Source + Source + +
      +

      + starts_with?(string, prefixes) +

      +

      Returns true if string starts with any of the prefixes given, otherwise +false. prefixes can be either a single prefix or a list of prefixes.

      + +

      Examples

      + +
      iex> String.starts_with? "elixir", "eli"
      +true
      +iex> String.starts_with? "elixir", ["erlang", "elixir"]
      +true
      +iex> String.starts_with? "elixir", ["erlang", "ruby"]
      +false
      +
      +
      + + Source

      @@ -718,7 +768,7 @@

      Examples

      - Source + Source

      @@ -734,7 +784,7 @@

      Examples

      - Source + Source

      @@ -759,7 +809,7 @@

      Examples

      :error

      - Source + Source

      @@ -780,7 +830,7 @@

      Examples

      - Source + Source

      @@ -799,7 +849,7 @@

      Examples

      - Source + Source

      @@ -820,7 +870,7 @@

      Examples

      - Source + Source

      @@ -845,7 +895,7 @@

      Examples

      - Source + Source

      @@ -869,7 +919,7 @@

      Examples

      - Source + Source diff --git a/docs/stable/Supervisor.Behaviour.html b/docs/stable/Supervisor.Behaviour.html index e7a9b6796..b1ded59c6 100644 --- a/docs/stable/Supervisor.Behaviour.html +++ b/docs/stable/Supervisor.Behaviour.html @@ -58,7 +58,7 @@

      Example

      - Source + Source @@ -138,7 +138,7 @@

      Strategies

      - Source + Source

      @@ -201,7 +201,7 @@

      Shutdown values

      - Source + Source

      @@ -264,7 +264,7 @@

      Shutdown values

      - Source + Source diff --git a/docs/stable/SyntaxError.html b/docs/stable/SyntaxError.html index beb2e20a3..382ba6c27 100644 --- a/docs/stable/SyntaxError.html +++ b/docs/stable/SyntaxError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -83,7 +83,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/System.NoAccessCwdError.html b/docs/stable/System.NoAccessCwdError.html index 75f526dc7..055290365 100644 --- a/docs/stable/System.NoAccessCwdError.html +++ b/docs/stable/System.NoAccessCwdError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/stable/System.NoHomeError.html b/docs/stable/System.NoHomeError.html index b033ac23b..93a871b7b 100644 --- a/docs/stable/System.NoHomeError.html +++ b/docs/stable/System.NoHomeError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/stable/System.NoTmpDirError.html b/docs/stable/System.NoTmpDirError.html index 3d278256f..ce033c338 100644 --- a/docs/stable/System.NoTmpDirError.html +++ b/docs/stable/System.NoTmpDirError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/stable/System.html b/docs/stable/System.html index e1ea49c2f..41352bf9d 100644 --- a/docs/stable/System.html +++ b/docs/stable/System.html @@ -34,7 +34,7 @@

      - Source + Source @@ -156,7 +156,7 @@

      Functions

      Returns the list of command-line arguments passed to the program.

      - Source + Source

      @@ -170,7 +170,7 @@

      Functions

      as argument.

      - Source + Source

      @@ -179,7 +179,7 @@

      Functions

      Returns a keywords list with version, git tag info and date.

      - Source + Source

      @@ -193,7 +193,7 @@

      Functions

      Returns a binary otherwise.

      - Source + Source

      @@ -203,7 +203,7 @@

      Functions

      is not available.

      - Source + Source

      @@ -212,7 +212,7 @@

      Functions

      Returns the current working directory or raises System.NoAccessCwdError.

      - Source + Source

      @@ -226,7 +226,7 @@

      Functions

      Returns a binary otherwise.

      - Source + Source

      @@ -237,7 +237,7 @@

      Functions

      name of the variable and Value its value.

      - Source + Source

      @@ -248,7 +248,7 @@

      Functions

      variable is undefined.

      - Source + Source

      @@ -260,7 +260,7 @@

      Functions

      See http://www.erlang.org/doc/man/os.html#getpid-0 for more info.

      - Source + Source

      @@ -296,7 +296,7 @@

      Examples

      - Source + Source

      @@ -306,7 +306,7 @@

      Examples

      to each key in dict.

      - Source + Source

      @@ -315,7 +315,7 @@

      Examples

      Sets a new value for the environment variable varname.

      - Source + Source

      @@ -328,7 +328,7 @@

      Examples

      latest exception.

      - Source + Source

      @@ -348,7 +348,7 @@

      Examples

      Returns nil if none of the above are writable.

      - Source + Source

      @@ -358,7 +358,7 @@

      Examples

      instead of returning nil if no temp dir is set.

      - Source + Source

      @@ -368,7 +368,7 @@

      Examples

      It returns nil if no user home is set.

      - Source + Source

      @@ -378,7 +378,7 @@

      Examples

      instead of returning nil if no user home is set.

      - Source + Source

      @@ -387,7 +387,7 @@

      Examples

      Returns Elixir's version as binary.

      - Source + Source
      diff --git a/docs/stable/SystemLimitError.html b/docs/stable/SystemLimitError.html index d17ce8dae..a40eceb77 100644 --- a/docs/stable/SystemLimitError.html +++ b/docs/stable/SystemLimitError.html @@ -29,7 +29,7 @@

      - Source + Source diff --git a/docs/stable/TokenMissingError.html b/docs/stable/TokenMissingError.html index 2f3f2efc6..b64385810 100644 --- a/docs/stable/TokenMissingError.html +++ b/docs/stable/TokenMissingError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -83,7 +83,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/URI.FTP.html b/docs/stable/URI.FTP.html index 8e12288b1..ac3fe05f1 100644 --- a/docs/stable/URI.FTP.html +++ b/docs/stable/URI.FTP.html @@ -27,7 +27,7 @@

      - Source + Source @@ -63,7 +63,7 @@

      Functions

      - Source + Source

      @@ -71,7 +71,7 @@

      Functions

      - Source + Source
      diff --git a/docs/stable/URI.HTTP.html b/docs/stable/URI.HTTP.html index 0c5bce2bd..d863de87e 100644 --- a/docs/stable/URI.HTTP.html +++ b/docs/stable/URI.HTTP.html @@ -27,7 +27,7 @@

      - Source + Source @@ -63,7 +63,7 @@

      Functions

      - Source + Source

      @@ -71,7 +71,7 @@

      Functions

      - Source + Source
      diff --git a/docs/stable/URI.HTTPS.html b/docs/stable/URI.HTTPS.html index a20e475c1..65522bb9d 100644 --- a/docs/stable/URI.HTTPS.html +++ b/docs/stable/URI.HTTPS.html @@ -27,7 +27,7 @@

      - Source + Source @@ -63,7 +63,7 @@

      Functions

      - Source + Source

      @@ -71,7 +71,7 @@

      Functions

      - Source + Source
      diff --git a/docs/stable/URI.LDAP.html b/docs/stable/URI.LDAP.html index c5e3606c2..b2642e83f 100644 --- a/docs/stable/URI.LDAP.html +++ b/docs/stable/URI.LDAP.html @@ -27,7 +27,7 @@

      - Source + Source @@ -63,7 +63,7 @@

      Functions

      - Source + Source

      @@ -71,7 +71,7 @@

      Functions

      - Source + Source
      diff --git a/docs/stable/URI.Parser.html b/docs/stable/URI.Parser.html index b852a0500..f6dafe4da 100644 --- a/docs/stable/URI.Parser.html +++ b/docs/stable/URI.Parser.html @@ -35,7 +35,7 @@

      - Source + Source @@ -76,7 +76,7 @@

      Callbacks

      Responsible for returning the default port.

      - Source + Source

      @@ -85,7 +85,7 @@

      Callbacks

      Responsible for parsing extra URL information.

      - Source + Source
      diff --git a/docs/stable/URI.SFTP.html b/docs/stable/URI.SFTP.html index d05ec23b4..b553e74a7 100644 --- a/docs/stable/URI.SFTP.html +++ b/docs/stable/URI.SFTP.html @@ -27,7 +27,7 @@

      - Source + Source @@ -63,7 +63,7 @@

      Functions

      - Source + Source

      @@ -71,7 +71,7 @@

      Functions

      - Source + Source
      diff --git a/docs/stable/URI.TFTP.html b/docs/stable/URI.TFTP.html index 05ddcb765..698c394b9 100644 --- a/docs/stable/URI.TFTP.html +++ b/docs/stable/URI.TFTP.html @@ -27,7 +27,7 @@

      - Source + Source @@ -63,7 +63,7 @@

      Functions

      - Source + Source

      @@ -71,7 +71,7 @@

      Functions

      - Source + Source
      diff --git a/docs/stable/URI.html b/docs/stable/URI.html index 5dcd87ae5..d75d6ff46 100644 --- a/docs/stable/URI.html +++ b/docs/stable/URI.html @@ -32,7 +32,7 @@

      - Source + Source @@ -89,7 +89,7 @@

      Functions

      Unpercent (URL) decodes a URI.

      - Source + Source

      @@ -102,7 +102,7 @@

      Functions

      Use decoder/1 if you want to customize or iterate each value manually.

      - Source + Source

      @@ -111,7 +111,7 @@

      Functions

      Percent (URL) encodes a URI.

      - Source + Source

      @@ -124,7 +124,7 @@

      Functions

      to binary).

      - Source + Source

      @@ -148,7 +148,7 @@

      Functions

      example of one of these extension modules.

      - Source + Source

      @@ -158,7 +158,7 @@

      Functions

      the query string in steps.

      - Source + Source diff --git a/docs/stable/UndefinedFunctionError.html b/docs/stable/UndefinedFunctionError.html index 4591d3464..cd9fb5042 100644 --- a/docs/stable/UndefinedFunctionError.html +++ b/docs/stable/UndefinedFunctionError.html @@ -29,7 +29,7 @@

      - Source + Source @@ -83,7 +83,7 @@

      Functions

      - Source + Source diff --git a/docs/stable/index.html b/docs/stable/index.html index bdab5fcb0..ba88e3113 100644 --- a/docs/stable/index.html +++ b/docs/stable/index.html @@ -3,7 +3,7 @@ - Elixir v0.9.0 Documentation + Elixir v0.9.1 Documentation diff --git a/docs/stable/modules_list.html b/docs/stable/modules_list.html index 1fca36e27..a3b7b61c5 100644 --- a/docs/stable/modules_list.html +++ b/docs/stable/modules_list.html @@ -16,7 +16,7 @@
    3376. -
    3377. - - get!/2 - - Dict -
    3378. -
    3379. get/3 @@ -1191,41 +1184,6 @@

      ExUnit.CLIFormatter

    3380. -
    3381. - - code_change/3 - - ExUnit.CLIFormatter -
    3382. - -
    3383. - - handle_call/3 - - ExUnit.CLIFormatter -
    3384. - -
    3385. - - handle_cast/2 - - ExUnit.CLIFormatter -
    3386. - -
    3387. - - handle_info/2 - - ExUnit.CLIFormatter -
    3388. - -
    3389. - - init/1 - - ExUnit.CLIFormatter -
    3390. -
    3391. suite_finished/3 @@ -1240,13 +1198,6 @@

      ExUnit.CLIFormatter

    3392. -
    3393. - - terminate/2 - - ExUnit.CLIFormatter -
    3394. -
    3395. test_finished/2 @@ -1463,13 +1414,6 @@

      ExUnit

    3396. -
    3397. - - stop/1 - - ExUnit -
    3398. -
    3399. @@ -2192,6 +2136,87 @@

      IEx.Helpers

    3400. + +
    3401. + + + Options + + IEx.Options +
    3402. + @@ -2211,14 +2236,21 @@

    3403. - inspect_opts/0 + color/2 IEx
    3404. - inspect_opts/1 + color_fragment/1 + + IEx +
    3405. + +
    3406. + + color_reset/0 IEx
    3407. @@ -5087,7 +5119,7 @@

    3408. - equals?/2 + equal?/2 Mix.SCM
    3409. @@ -6084,13 +6116,6 @@

      Mix -
    3410. - - stop/1 - - Mix -
    3411. -
    3412. @@ -7030,6 +7055,13 @@

      String

    3413. +
    3414. + + ends_with?/2 + + String +
    3415. +
    3416. first/1 @@ -7135,6 +7167,13 @@

      String

    3417. +
    3418. + + starts_with?/2 + + String +
    3419. +
    3420. strip/1 diff --git a/docs/stable/protocols_list.html b/docs/stable/protocols_list.html index 714cb4cdf..5c25671fa 100644 --- a/docs/stable/protocols_list.html +++ b/docs/stable/protocols_list.html @@ -16,7 +16,7 @@
    3421. - -
    3422. - - - Function - - Access.Function -
    3423. -
        - - -
      • - - access/2 - - Access.Function -
      • -
    3424. diff --git a/docs/stable/records_list.html b/docs/stable/records_list.html index d502e4e33..93918d46e 100644 --- a/docs/stable/records_list.html +++ b/docs/stable/records_list.html @@ -16,7 +16,7 @@

      - Elixir v0.9.0 + Elixir v0.9.1